Skip to content

Commit

Permalink
Add a postprocessor to calculate the average value along the centerli…
Browse files Browse the repository at this point in the history
…ne of an axisymmetric (RZ) mesh. Closes idaholab#7528.
  • Loading branch information
gambka committed Aug 17, 2016
1 parent cf9e84b commit ccb06b5
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/

#ifndef AXISYMMETRICCENTERLINEAVERAGEVALUE_H
#define AXISYMMETRICCENTERLINEAVERAGEVALUE_H

#include "SideAverageValue.h"

//Forward Declarations
class AxisymmetricCenterlineAverageValue;

template<>
InputParameters validParams<AxisymmetricCenterlineAverageValue>();

/**
* This postprocessor computes a line integral of the specified variable
* along the centerline of an axisymmetric domain.
*/
class AxisymmetricCenterlineAverageValue : public SideAverageValue
{
public:
AxisymmetricCenterlineAverageValue(const InputParameters & parameters);

protected:
virtual Real computeIntegral() override;
virtual Real volume() override;
Real _volume;
};

#endif
1 change: 1 addition & 0 deletions framework/include/postprocessors/SideAverageValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SideAverageValue : public SideIntegralVariablePostprocessor
virtual void threadJoin(const UserObject & y) override;

protected:
virtual Real volume();
Real _volume;
};

Expand Down
2 changes: 2 additions & 0 deletions framework/src/base/Moose.C
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
#include "ElementL2Difference.h"
#include "TimeExtremeValue.h"
#include "RelativeSolutionDifferenceNorm.h"
#include "AxisymmetricCenterlineAverageValue.h"

// vector PPS
#include "ConstantVectorPostprocessor.h"
Expand Down Expand Up @@ -624,6 +625,7 @@ registerObjects(Factory & factory)
registerPostprocessor(ElementL2Difference);
registerPostprocessor(TimeExtremeValue);
registerPostprocessor(RelativeSolutionDifferenceNorm);
registerPostprocessor(AxisymmetricCenterlineAverageValue);

// vector PPS
registerVectorPostprocessor(ConstantVectorPostprocessor);
Expand Down
45 changes: 45 additions & 0 deletions framework/src/postprocessors/AxisymmetricCenterlineAverageValue.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/

#include "AxisymmetricCenterlineAverageValue.h"
// libmesh includes
#include "libmesh/quadrature.h"

template<>
InputParameters validParams<AxisymmetricCenterlineAverageValue>()
{
InputParameters params = validParams<SideAverageValue>();
return params;
}

AxisymmetricCenterlineAverageValue::AxisymmetricCenterlineAverageValue(const InputParameters & parameters) :
SideAverageValue(parameters),
_volume(0)
{}

Real
AxisymmetricCenterlineAverageValue::volume()
{
Real volume = _current_side_elem->volume();
return volume;
}

Real
AxisymmetricCenterlineAverageValue::computeIntegral()
{
Real sum = 0;
for (_qp=0; _qp<_qrule->n_points(); _qp++)
sum += _JxW[_qp]*computeQpIntegral();
return sum;
}
8 changes: 7 additions & 1 deletion framework/src/postprocessors/SideAverageValue.C
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void
SideAverageValue::execute()
{
SideIntegralVariablePostprocessor::execute();
_volume += _current_side_volume;
_volume += volume();
}

Real
Expand All @@ -48,6 +48,12 @@ SideAverageValue::getValue()
return integral / _volume;
}

Real
SideAverageValue::volume()
{
Real volume = _current_side_volume;
return volume;
}

void
SideAverageValue::threadJoin(const UserObject & y)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[Problem]
coord_type = RZ
[]

[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
xmin = 0
xmax = 2
ymin = 0
ymax = 1
[]

[Variables]
active = 'u'

[./u]
order = FIRST
family = LAGRANGE
[../]
[]

[Kernels]
active = 'diff'

[./diff]
type = Diffusion
variable = u
[../]
[]

[BCs]
active = 'top bottom'

[./top]
type = DirichletBC
variable = u
boundary = top
value = 0
[../]

[./bottom]
type = DirichletBC
variable = u
boundary = bottom
value = 1
[../]
[]

[Executioner]
type = Steady

# Preconditioned JFNK (default)
solve_type = 'PJFNK'
[]

[Postprocessors]
[./average]
type = AxisymmetricCenterlineAverageValue
boundary = left
variable = u
[../]
[]

[Outputs]
file_base = out
exodus = true
[]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Tests]
[./test]
type = 'Exodiff'
input = 'axisymmetric_centerline_average_value_test.i'
exodiff = 'out.e'
[../]
[]

0 comments on commit ccb06b5

Please sign in to comment.