13 #include "metaphysicl/raw_type.h" 26 params.
addRequiredParam<MooseFunctorName>(
"vel_x",
"x-component of the velocity vector");
27 params.
addParam<MooseFunctorName>(
"vel_y",
"y-component of the velocity vector");
28 params.
addParam<MooseFunctorName>(
"vel_z",
"z-component of the velocity vector");
31 "The advected variable quantity of which to compute advection flux; useful for " 32 "finite element simulations");
33 params.
addParam<MaterialPropertyName>(
36 "The advected material property of which to compute advection flux; " 37 "useful for finite element simulations");
38 params.
addParam<MooseFunctorName>(
"advected_quantity",
39 "The quantity to advect. This is the canonical parameter to " 40 "set the advected quantity when finite volume is being used.");
51 _use_normal(getParam<
MooseEnum>(
"component") ==
"normal"),
52 _component(getParam<
MooseEnum>(
"component")),
53 _advected_variable_supplied(isParamValid(
"advected_variable")),
54 _advected_variable(_advected_variable_supplied ? coupledValue(
"advected_variable") : _zero),
55 _advected_mat_prop_supplied(parameters.isParamSetByUser(
"advected_mat_prop")),
56 _advected_material_property(getGenericMaterialProperty<
Real, is_ad>(
"advected_mat_prop")),
57 _adv_quant(isParamValid(
"advected_quantity") ? &getFunctor<
Real>(
"advected_quantity")
59 _vel_x(getFunctor<
Real>(
"vel_x")),
60 _vel_y(_mesh.dimension() >= 2 ? &getFunctor<
Real>(
"vel_y") : nullptr),
61 _vel_z(_mesh.dimension() == 3 ? &getFunctor<
Real>(
"vel_z") : nullptr)
68 "SideAdvectiveFluxIntegralPostprocessor should be provided either an advected quantity " 69 "or an advected material property");
86 mooseAssert(fi,
"We should have a face info in " +
name());
87 mooseAssert(_adv_quant,
"We should have an advected quantity in " +
name());
89 const auto state = determineState();
112 const bool elem_is_upwind =
RealVectorValue(vel_x, vel_y, vel_z) * fi_normal >= 0;
114 const auto adv_quant_face = (*_adv_quant)(
119 return fi_normal * adv_quant_face *
RealVectorValue(vel_x, vel_y, vel_z);
122 template <
bool is_ad>
128 const auto state = determineState();
129 const Moose::ElemSideQpArg side_arg = {_current_elem, _current_side, _qp, _qrule, _q_point[_qp]};
130 const auto vel_x =
raw_value(_vel_x(side_arg, state));
131 const auto vel_y = _vel_y ?
raw_value((*_vel_y)(side_arg, state)) : 0;
132 const auto vel_z = _vel_z ?
raw_value((*_vel_z)(side_arg, state)) : 0;
134 if (_advected_variable_supplied)
137 auto & variable = getCoupledMooseVars();
138 if (std::any_of(variable.begin(), variable.end(), [](
auto & var) {
return !var->isNodal(); }))
139 mooseError(
"Trying to use a non-nodal variable 'advected_variable' for side advection " 140 "integral calculation, which is currently not supported.");
143 ? _advected_variable[_qp] *
RealVectorValue(vel_x, vel_y, vel_z) * _normals[_qp]
144 : _advected_variable[_qp] *
RealVectorValue(vel_x, vel_y, vel_z)(_component));
146 else if (_advected_mat_prop_supplied)
147 return (_use_normal ?
raw_value(_advected_material_property[_qp]) *
149 :
raw_value(_advected_material_property[_qp]) *
152 return (_use_normal ?
RealVectorValue(vel_x, vel_y, vel_z) * _normals[_qp]
std::string name(const ElemQuality q)
bool _qp_integration
Whether to integrate over quadrature points or FaceInfos.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
static InputParameters validParams()
registerMooseObject("MooseApp", SideAdvectiveFluxIntegral)
SideAdvectiveFluxIntegralTempl(const InputParameters ¶meters)
Real computeQpIntegral() override
This data structure is used to store geometric and variable related metadata about each cell face in ...
Real computeFaceInfoIntegral(const FaceInfo *fi) override
const bool _advected_variable_supplied
Whether an advected variable was supplied in the input.
A structure defining a "face" evaluation calling argument for Moose functors.
const Moose::Functor< Real > *const _vel_z
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
This postprocessor computes a surface integral of the specified variable on a sideset on the boundary...
const Point & normal() const
Returns the unit normal vector for the face oriented outward from the face's elem element...
const Elem * elemPtr() const
const bool _advected_mat_prop_supplied
Whether an advected material property was supplied in the input.
This postprocessor computes a side integral of the mass flux.
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Moose::Functor< Real > *const _adv_quant
The functor representing the advected quantity for finite volume.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
const Moose::Functor< Real > *const _vel_y
Argument for requesting functor evaluation at quadrature point locations on an element side...