10#ifdef MOOSE_MFEM_ENABLED
22 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
23 params,
"variable",
"Name of the scalar variable to average.");
31 getMFEMProblem().getMFEMVariableMesh(getParam<VariableName>(
"variable"))),
32 _var(*getMFEMProblem().getGridFunction(getParam<VariableName>(
"variable"))),
34 _lf(_var.ParFESpace())
39 _lf.AddDomainIntegrator(
new mfem::DomainLFIntegrator(
_one));
47 const mfem::real_t integral =
_lf(
_var);
51 mfem::ParGridFunction ones(
_var.ParFESpace());
52 ones.ProjectCoefficient(
_one);
53 const mfem::real_t volume =
_lf(ones);
55 _value = integral / volume;
registerMooseObject("MooseApp", MFEMElementAverageValue)
Real PostprocessorValue
various MOOSE typedefs
Base class for construction of an object that is restricted to a subset of subdomains of the problem ...
static InputParameters validParams()
bool isSubdomainRestricted()
Returns a bool indicating if the object is restricted to a subset of subdomains.
mfem::Array< int > & getSubdomainMarkers()
Computes the volumetric average of a scalar MFEM variable over the mesh or a subset of subdomains.
mfem::ParGridFunction & _var
Reference to the MFEM grid function whose average is being computed.
mfem::ParLinearForm _lf
Linear form used to accumulate the integral of the variable over elements.
PostprocessorValue getValue() const override final
This will get called to actually grab the final value the postprocessor has calculated.
static InputParameters validParams()
mfem::real_t _value
Cached computed average value returned by getValue()
mfem::ConstantCoefficient _one
Constant coefficient of value 1 used in integration for volume calculation.
MFEMElementAverageValue(const InputParameters ¶meters)
void execute() override
Perform the main work for this object.
Postprocessor for MFEM results.
static InputParameters validParams()