https://mooseframework.inl.gov
src
postprocessors
ElementAverageMaterialProperty.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 "
ElementAverageMaterialProperty.h
"
11
12
registerMooseObject
(
"MooseApp"
,
ElementAverageMaterialProperty
);
13
registerMooseObject
(
"MooseApp"
,
ADElementAverageMaterialProperty
);
14
15
template
<
bool
is_ad>
16
InputParameters
17
ElementAverageMaterialPropertyTempl<is_ad>::validParams
()
18
{
19
InputParameters
params =
ElementIntegralMaterialPropertyTempl<is_ad>::validParams
();
20
params.
addClassDescription
(
"Computes the average of a material property over a volume."
);
21
return
params;
22
}
23
24
template
<
bool
is_ad>
25
ElementAverageMaterialPropertyTempl<is_ad>::ElementAverageMaterialPropertyTempl
(
26
const
InputParameters
& parameters)
27
:
ElementIntegralMaterialPropertyTempl
<is_ad>(parameters), _volume(0.0)
28
{
29
}
30
31
template
<
bool
is_ad>
32
void
33
ElementAverageMaterialPropertyTempl<is_ad>::initialize
()
34
{
35
ElementIntegralMaterialPropertyTempl<is_ad>::initialize
();
36
37
_volume = 0.0;
38
}
39
40
template
<
bool
is_ad>
41
void
42
ElementAverageMaterialPropertyTempl<is_ad>::execute
()
43
{
44
ElementIntegralMaterialPropertyTempl<is_ad>::execute
();
45
46
_volume += this->_current_elem_volume;
47
}
48
49
template
<
bool
is_ad>
50
Real
51
ElementAverageMaterialPropertyTempl<is_ad>::getValue
()
const
52
{
53
return
_integral_value / _volume;
54
}
55
56
template
<
bool
is_ad>
57
void
58
ElementAverageMaterialPropertyTempl<is_ad>::finalize
()
59
{
60
ElementIntegralMaterialPropertyTempl<is_ad>::gatherSum
(_volume);
61
ElementIntegralMaterialPropertyTempl<is_ad>::gatherSum
(_integral_value);
62
}
63
64
template
<
bool
is_ad>
65
void
66
ElementAverageMaterialPropertyTempl<is_ad>::threadJoin
(
const
UserObject
& y)
67
{
68
ElementIntegralMaterialPropertyTempl<is_ad>::threadJoin
(y);
69
70
const
auto
& pps =
static_cast<
const
ElementAverageMaterialPropertyTempl<is_ad>
&
>
(y);
71
_volume += pps.
_volume
;
72
}
73
74
template
class
ElementAverageMaterialPropertyTempl<false>
;
75
template
class
ElementAverageMaterialPropertyTempl<true>
;
ElementIntegralMaterialPropertyTempl::validParams
static InputParameters validParams()
Definition:
ElementIntegralMaterialProperty.C:19
ElementAverageMaterialPropertyTempl
Computes the average of a material property over a volume.
Definition:
ElementAverageMaterialProperty.h:18
registerMooseObject
registerMooseObject("MooseApp", ElementAverageMaterialProperty)
ElementAverageMaterialPropertyTempl::finalize
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
Definition:
ElementAverageMaterialProperty.C:58
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Definition:
InputParameters.h:66
ElementAverageMaterialPropertyTempl::execute
virtual void execute() override
Execute method.
Definition:
ElementAverageMaterialProperty.C:42
ElementIntegralPostprocessor::threadJoin
virtual void threadJoin(const UserObject &y) override
Must override.
Definition:
ElementIntegralPostprocessor.C:45
ElementAverageMaterialPropertyTempl::validParams
static InputParameters validParams()
Definition:
ElementAverageMaterialProperty.C:17
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
ElementAverageMaterialPropertyTempl::_volume
Real _volume
Domain volume.
Definition:
ElementAverageMaterialProperty.h:33
ElementAverageMaterialProperty.h
ElementIntegralMaterialPropertyTempl
Definition:
ElementIntegralMaterialProperty.h:15
ElementAverageMaterialPropertyTempl::ElementAverageMaterialPropertyTempl
ElementAverageMaterialPropertyTempl(const InputParameters ¶meters)
Definition:
ElementAverageMaterialProperty.C:25
ElementAverageMaterialPropertyTempl::threadJoin
virtual void threadJoin(const UserObject &y) override
Must override.
Definition:
ElementAverageMaterialProperty.C:66
Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ElementAverageMaterialPropertyTempl::initialize
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition:
ElementAverageMaterialProperty.C:33
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
ElementAverageMaterialPropertyTempl::getValue
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition:
ElementAverageMaterialProperty.C:51
Generated on Tue Aug 5 2025 09:55:43 for https://mooseframework.inl.gov by
1.8.14