www.mooseframework.org
SideAverageValue.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "SideAverageValue.h"
11 
13 
16 {
18  params.addClassDescription("Computes the average value of a variable on a "
19  "sideset. Note that this cannot be used on the "
20  "centerline of an axisymmetric model.");
21  return params;
22 }
23 
25  : SideIntegralVariablePostprocessor(parameters), _volume(0)
26 {
27 }
28 
29 void
31 {
33  _volume = 0;
34 }
35 
36 void
38 {
40  _volume += volume();
41 }
42 
43 Real
45 {
47  {
49  mooseError("The total area of the boundary is zero. This could be due to "
50  "using a boundary on the centerline of an axisymmetric model.");
51  else
52  mooseError("The total area of the boundary is zero.");
53  }
54 
55  return _integral_value / _volume;
56 }
57 
58 Real
60 {
61  return _current_side_volume;
62 }
63 
64 void
66 {
68  const auto & pps = static_cast<const SideAverageValue &>(y);
69  _volume += pps._volume;
70 }
71 
72 void
74 {
77 }
virtual void execute() override
Execute method.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
Definition: MooseUtils.h:346
This postprocessor computes a volume integral of the specified variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
SideAverageValue(const InputParameters &parameters)
const Real & _current_side_volume
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:125
registerMooseObject("MooseApp", SideAverageValue)
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Real _volume
Volume of the entire surface to average over.
static InputParameters validParams()
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Moose::CoordinateSystemType & _coord_sys
Coordinate system.
Definition: UserObject.h:221
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
virtual void execute() override
Execute method.
virtual void threadJoin(const UserObject &y) override
Must override.
virtual Real volume()
Compute the volume of the current face.
Real _integral_value
Holds the postprocessor result, the integral.
Base class for user-specific data.
Definition: UserObject.h:39
This postprocessor computes a surface integral of the specified variable.