23 "This class takes up to three scalar-valued functors corresponding to vector " 24 "components *or* a single vector functor and computes the Euclidean norm.");
25 params.
addParam<MooseFunctorName>(
"x_functor",
"The functor corresponding to the x component.");
27 "y_functor", 0,
"The functor corresponding to the y component.");
29 "z_functor", 0,
"The functor corresponding to the z component.");
31 "vector_magnitude_name",
"The name of the vector magnitude functor that we are creating.");
33 "vector_functor",
"The name of a vector functor that we will take the magnitude of.");
41 _x(isParamValid(
"x_functor") ? &getFunctor<
GenericReal<is_ad>>(
"x_functor") : nullptr),
44 _vector_functor(isParamValid(
"vector_functor")
45 ? &getFunctor<VectorValue<
GenericReal<is_ad>>>(
"vector_functor")
49 [
this, &
parameters](
const std::string & scalar_functor,
const bool must_equal_one)
51 auto error_message = [&scalar_functor,
this]()
55 "' or 'vector_functor' parameter " 56 "must be provided to '",
60 const unsigned short sum =
74 check_error(
"x_functor",
true);
75 check_error(
"y_functor",
false);
76 check_error(
"z_functor",
false);
82 "vector_magnitude_name",
85 const auto x = (*_x)(r, t);
86 const auto y =
_y(r, t);
87 const auto z =
_z(r, t);
88 return std::sqrt((x * x) + (y * y) + (z * z));
92 addFunctorProperty<GenericReal<is_ad>>(
93 "vector_magnitude_name",
96 const auto vec = (*_vector_functor)(r, t);
Moose::GenericType< Real, is_ad > GenericReal
A MultiMooseEnum object to hold "execute_on" flags.
static InputParameters validParams()
MooseEnumIterator begin() const
Returns a begin/end iterator to all of the set values in the enum.
const InputParameters & parameters() const
Get the parameters of the object.
MooseEnumIterator end() const
const ExecFlagType EXEC_ALWAYS
registerMooseObject("MooseApp", VectorMagnitudeFunctorMaterial)
const std::string & name() const
Get the name of the class.
FunctorMaterials compute functor material properties.
This class takes up to three functors corresponding to vector components and computes the Euclidean n...
const ExecFlagEnum & _execute_enum
Execute settings for this object.
const Moose::Functor< GenericReal< is_ad > > & _y
The y-component functor.
VectorMagnitudeFunctorMaterialTempl(const InputParameters ¶meters)
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
const Moose::FunctorBase< T > & addFunctorProperty(const std::string &name, PolymorphicLambda my_lammy, const std::set< ExecFlagType > &clearance_schedule={EXEC_ALWAYS})
Declare a functor material property.
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< GenericReal< is_ad > > & _z
The z-component functor.
static InputParameters validParams()
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.