forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a postprocessor to calculate the average value along the centerli…
…ne of an axisymmetric (RZ) mesh. Closes idaholab#7528.
- Loading branch information
Showing
6 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
framework/include/postprocessors/AxisymmetricCenterlineAverageValue.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ | ||
/****************************************************************/ | ||
|
||
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
framework/src/postprocessors/AxisymmetricCenterlineAverageValue.C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
70 changes: 70 additions & 0 deletions
70
...essors/axisymmetric_centerline_average_value/axisymmetric_centerline_average_value_test.i
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+27.8 KB
test/tests/postprocessors/axisymmetric_centerline_average_value/gold/out.e
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
test/tests/postprocessors/axisymmetric_centerline_average_value/tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
[../] | ||
[] |