https://mooseframework.inl.gov
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 
11 
14 
15 template <bool is_ad>
18 {
20  params.addClassDescription("Computes the average of a material property over a volume.");
21  return params;
22 }
23 
24 template <bool is_ad>
26  const InputParameters & parameters)
27  : ElementIntegralMaterialPropertyTempl<is_ad>(parameters), _volume(0.0)
28 {
29 }
30 
31 template <bool is_ad>
32 void
34 {
36 
37  _volume = 0.0;
38 }
39 
40 template <bool is_ad>
41 void
43 {
45 
46  _volume += this->_current_elem_volume;
47 }
48 
49 template <bool is_ad>
50 Real
52 {
53  return _integral_value / _volume;
54 }
55 
56 template <bool is_ad>
57 void
59 {
62 }
63 
64 template <bool is_ad>
65 void
67 {
69 
70  const auto & pps = static_cast<const ElementAverageMaterialPropertyTempl<is_ad> &>(y);
71  _volume += pps._volume;
72 }
73 
Computes the average of a material property over a volume.
registerMooseObject("MooseApp", ElementAverageMaterialProperty)
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void execute() override
Execute method.
virtual void threadJoin(const UserObject &y) override
Must override.
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:126
virtual void execute() override
Execute method.
ElementAverageMaterialPropertyTempl(const InputParameters &parameters)
virtual void threadJoin(const UserObject &y) override
Must override.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
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...
Base class for user-specific data.
Definition: UserObject.h:40
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.