12#include "metaphysicl/raw_type.h"
23 "functor",
"The name of the functor that this postprocessor integrates");
24 params.
addParam<MooseFunctorName>(
"prefactor", 1,
"Factor multiplying the integrand");
25 params.
addParam<
bool>(
"restrict_to_functors_domain",
27 "If the functor (and the prefactor) is only defined only along part of "
28 "the sideset, allows to skip the parts where it is not defined. Please "
29 "keep in mind that if the sideset is defined with the wrong normal, this "
30 "may allow to skip the entire integral.");
31 MooseEnum functor_args(
"qp face",
"face");
33 "functor_argument", functor_args,
"Location to evaluate the functors at");
35 "Computes a surface integral of the specified functor, using the "
36 "single-sided face argument, which usually means that the functor will be"
37 " evaluated from a single side of the surface, not interpolated between "
47 _prefactor(getFunctor<
GenericReal<is_ad>>(
"prefactor")),
48 _partial_integral(getParam<bool>(
"restrict_to_functors_domain"))
50 _qp_integration = (getParam<MooseEnum>(
"functor_argument") ==
"qp");
52 checkFunctorSupportsSideIntegration<GenericReal<is_ad>>(
"functor", _qp_integration);
53 checkFunctorSupportsSideIntegration<GenericReal<is_ad>>(
"prefactor", _qp_integration);
60 mooseAssert(fi,
"We should have a FaceInfo");
61 const auto face = makeCDFace(*fi);
62 return computeLocalContribution(face);
74 const bool has_elem = checkFunctorDefinedOnSideBlock();
78 _functor(functor_arg, determineState()));
81 if (!_partial_integral)
82 errorFunctorNotDefinedOnSideBlock();
92 return computeLocalContribution(elem_side_qp);
99 if (_functor.hasBlocks(_current_elem->subdomain_id()) &&
100 _prefactor.hasBlocks(_current_elem->subdomain_id()))
105 const auto neighbor_ptr = _current_elem->neighbor_ptr(_current_side);
108 mooseAssert(_functor.hasBlocks(_current_elem->subdomain_id()) ||
109 _functor.hasBlocks(neighbor_ptr->subdomain_id()),
110 "Functor should be defined on at least one side of the boundary");
111 mooseAssert(_prefactor.hasBlocks(_current_elem->subdomain_id()) ||
112 _prefactor.hasBlocks(neighbor_ptr->subdomain_id()),
113 "Prefactor should be defined on at least one side of the boundary");
124 paramError(
"boundary",
125 "Functor " + _functor.functorName() +
" (or prefactor " + _prefactor.functorName() +
126 ") is not defined on block " + std::to_string(_current_elem->subdomain_id()) +
127 ". Is the functor defined along the whole sideset? "
128 "Are the sidesets in 'boundary' all oriented correctly?");
134 const bool fi_elem_side)
const
136 return _current_elem == (fi_elem_side ? &fi.
elem() : fi.
neighborPtr());
Moose::GenericType< Real, is_ad > GenericReal
registerMooseObject("MooseApp", SideIntegralFunctorPostprocessor)
This data structure is used to store geometric and variable related metadata about each cell face in ...
const Elem & elem() const
const Elem * neighborPtr() const
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
void errorFunctorNotDefinedOnSideBlock() const
Error with a helpful message if the functor is not defined on the primary block by the sideset.
Real computeQpIntegral() override
bool checkFunctorDefinedOnSideBlock() const
Check if the functor and the prefactor are defined on the primary block by the sideset.
SideIntegralFunctorPostprocessorTempl(const InputParameters ¶meters)
static InputParameters validParams()
bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const override
virtual Real computeFaceInfoIntegral(const FaceInfo *fi) override
Compute contribution from an element face, either on a boundary or between two active elements.
Real computeLocalContribution(const T &functor_arg) const
This postprocessor computes a surface integral of the specified variable on a sideset on the boundary...
static InputParameters validParams()
Argument for requesting functor evaluation at quadrature point locations on an element side.