11#include "metaphysicl/raw_type.h"
22 "Evaluates the gradient of a functor (variable, function or functor material property) on "
23 "the current element or quadrature point.");
24 params.
addRequiredParam<MooseFunctorName>(
"functor",
"The functor to evaluate");
25 params.
addParam<MooseFunctorName>(
"factor", 1,
"A factor to apply on the functor");
26 params.
addParam<MaterialPropertyName>(
27 "factor_matprop", 1,
"A (regular) material property factor to apply on the functor");
31 params.
addParam<
unsigned short>(
"ghost_layers", 1,
"The number of layers of elements to ghost.");
33 "ElementSideNeighborLayers",
37 rm_params.
set<
unsigned short>(
"layers") = obj_params.
get<
unsigned short>(
"ghost_layers");
38 rm_params.
set<
bool>(
"use_displaced_mesh") = obj_params.
get<
bool>(
"use_displaced_mesh");
47 _functor(getFunctor<
GenericReal<is_ad>>(
"functor")),
49 _factor_matprop(getGenericMaterialProperty<Real, is_ad>(
"factor_matprop")),
55 "The variable must be a non-vector, non-array finite-volume/finite-element variable.");
58 paramError(
"variable",
"This AuxKernel only supports Elemental fields");
66 const auto state = determineState();
70 return raw_value(_factor(qp_arg, state)) * raw_value(_factor_matprop[_qp]) *
71 raw_value(_functor.gradient(qp_arg, state));
75 const auto elem_arg = makeElemArg(_current_elem);
76 mooseAssert(_qp == 0,
"Only one Qp per element expected when using an elemental argument");
77 return raw_value(_factor(elem_arg, state)) * raw_value(_factor_matprop[_qp]) *
78 raw_value(_functor.gradient(elem_arg, state));
registerMooseObject("MooseApp", FunctorElementalGradientAux)
Moose::GenericType< Real, is_ad > GenericReal
bool isNodal() const
Nodal or elemental kernel?
MooseVariableField< RealVectorValue > & _var
This is a regular kernel so we cast to a regular MooseVariable, hides base _var.
static InputParameters validParams()
Evaluate a functor (functor material property, function or variable) with either the cell-center or q...
virtual RealVectorValue computeValue() override
Compute and return the value of the aux variable.
const bool _use_qp_arg
Whether to use a quadrature-based functor argument, appropriate for finite element evaluations.
FunctorElementalGradientAuxTempl(const InputParameters ¶meters)
static InputParameters validParams()
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Class for stuff related to variables.
This class provides variable solution values for other classes/objects to bind to when looping over f...
Argument for requesting functor evaluation at a quadrature point location in an element.