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 572d3e6
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 0 deletions.
@@ -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 */
/****************************************************************/

#ifndef AXISYMMETRICCENTERLINEAVERAGEVALUE_H
#define AXISYMMETRICCENTERLINEAVERAGEVALUE_H

#include "SideIntegralVariablePostprocessor.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 SideIntegralVariablePostprocessor
{
public:
AxisymmetricCenterlineAverageValue(const InputParameters & parameters);

virtual void initialize() override;
virtual void execute() override;
virtual Real getValue() override;
virtual void threadJoin(const UserObject & y) override;
virtual Real computeIntegral() override;

protected:
Real _volume;
};

#endif
2 changes: 2 additions & 0 deletions framework/src/base/Moose.C
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
68 changes: 68 additions & 0 deletions framework/src/postprocessors/AxisymmetricCenterlineAverageValue.C
@@ -0,0 +1,68 @@
/****************************************************************/
/* 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<SideIntegralVariablePostprocessor>();
return params;
}

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

void
AxisymmetricCenterlineAverageValue::initialize()
{
SideIntegralVariablePostprocessor::initialize();
_volume = 0;
}

void
AxisymmetricCenterlineAverageValue::execute()
{
SideIntegralVariablePostprocessor::execute();
_volume += _current_side_elem->volume();
}

Real
AxisymmetricCenterlineAverageValue::getValue()
{
Real integral = SideIntegralVariablePostprocessor::getValue();
gatherSum(_volume);
return integral / _volume;
}

Real
AxisymmetricCenterlineAverageValue::computeIntegral()
{
Real sum = 0;
for (_qp=0; _qp<_qrule->n_points(); _qp++)
sum += _JxW[_qp]*computeQpIntegral();
return sum;
}

void
AxisymmetricCenterlineAverageValue::threadJoin(const UserObject & y)
{
SideIntegralVariablePostprocessor::threadJoin(y);
const AxisymmetricCenterlineAverageValue & pps = static_cast<const AxisymmetricCenterlineAverageValue &>(y);
_volume += pps._volume;
}
@@ -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.
@@ -0,0 +1,7 @@
[Tests]
[./test]
type = 'Exodiff'
input = 'axisymmetric_centerline_average_value_test.i'
exodiff = 'out.e'
[../]
[]

0 comments on commit 572d3e6

Please sign in to comment.