https://mooseframework.inl.gov
src
postprocessors
FunctionElementAverage.C
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://mooseframework.inl.gov
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 "
FunctionElementAverage.h
"
11
12
registerMooseObject
(
"MooseApp"
,
FunctionElementAverage
);
13
14
InputParameters
15
FunctionElementAverage::validParams
()
16
{
17
InputParameters
params =
FunctionElementIntegral::validParams
();
18
params.
addClassDescription
(
"Computes the average of a function over a volume."
);
19
return
params;
20
}
21
22
FunctionElementAverage::FunctionElementAverage
(
const
InputParameters
& parameters)
23
:
FunctionElementIntegral
(parameters)
24
{
25
}
26
27
void
28
FunctionElementAverage::initialize
()
29
{
30
FunctionElementIntegral::initialize
();
31
_volume
= 0;
32
}
33
34
void
35
FunctionElementAverage::execute
()
36
{
37
FunctionElementIntegral::execute
();
38
_volume
+=
_current_elem_volume
;
39
}
40
41
Real
42
FunctionElementAverage::getValue
()
const
43
{
44
return
_integral_value
/
_volume
;
45
}
46
47
void
48
FunctionElementAverage::finalize
()
49
{
50
gatherSum
(
_volume
);
51
gatherSum
(
_integral_value
);
52
}
53
54
void
55
FunctionElementAverage::threadJoin
(
const
UserObject
& y)
56
{
57
FunctionElementIntegral::threadJoin
(y);
58
const
auto
& pps =
static_cast<
const
FunctionElementAverage
&
>
(y);
59
_volume
+= pps._volume;
60
}
FunctionElementAverage
Computes the average of a function over a volume.
Definition:
FunctionElementAverage.h:17
FunctionElementAverage::getValue
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition:
FunctionElementAverage.C:42
FunctionElementIntegral::validParams
static InputParameters validParams()
Definition:
FunctionElementIntegral.C:16
FunctionElementAverage.h
registerMooseObject
registerMooseObject("MooseApp", FunctionElementAverage)
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Definition:
InputParameters.h:66
FunctionElementAverage::_volume
Real _volume
Definition:
FunctionElementAverage.h:31
ElementIntegralPostprocessor::_integral_value
Real _integral_value
Definition:
ElementIntegralPostprocessor.h:39
ElementUserObject::_current_elem_volume
const Real & _current_elem_volume
The current element volume (available during execute())
Definition:
ElementUserObject.h:47
ElementIntegralPostprocessor::threadJoin
virtual void threadJoin(const UserObject &y) override
Must override.
Definition:
ElementIntegralPostprocessor.C:45
UserObject::gatherSum
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition:
UserObject.h:126
ElementIntegralPostprocessor::execute
virtual void execute() override
Execute method.
Definition:
ElementIntegralPostprocessor.C:33
FunctionElementAverage::finalize
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
Definition:
FunctionElementAverage.C:48
FunctionElementAverage::FunctionElementAverage
FunctionElementAverage(const InputParameters ¶meters)
Definition:
FunctionElementAverage.C:22
FunctionElementAverage::initialize
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition:
FunctionElementAverage.C:28
FunctionElementIntegral
Integrates a function over elements.
Definition:
FunctionElementIntegral.h:17
FunctionElementAverage::validParams
static InputParameters validParams()
Definition:
FunctionElementAverage.C:15
Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
FunctionElementAverage::execute
virtual void execute() override
Execute method.
Definition:
FunctionElementAverage.C:35
ElementIntegralPostprocessor::initialize
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition:
ElementIntegralPostprocessor.C:27
InputParameters::addClassDescription
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...
Definition:
InputParameters.C:82
UserObject
Base class for user-specific data.
Definition:
UserObject.h:40
FunctionElementAverage::threadJoin
virtual void threadJoin(const UserObject &y) override
Must override.
Definition:
FunctionElementAverage.C:55
Generated on Tue Aug 5 2025 09:55:43 for https://mooseframework.inl.gov by
1.8.14