22 "Computes a functor material from a parsed expression of other functors.");
24 "expression",
"FunctionExpression",
"Expression to parse for the new functor material");
25 params.
addParam<std::vector<std::string>>(
26 "functor_names", {},
"Functors to use in the parsed expression");
27 params.
addParam<std::vector<std::string>>(
30 "Symbolic name to use for each functor in 'functor_names' in the parsed expression. If not "
31 "provided, then the actual functor names must be used in the parsed expression.");
33 "Name to give the new functor material property");
42 _expression(getParam<
std::string>(
"expression")),
43 _functor_names(getParam<
std::vector<
std::string>>(
"functor_names")),
44 _n_functors(_functor_names.size()),
45 _functor_symbols(getParam<
std::vector<
std::string>>(
"functor_symbols")),
46 _property_name(getParam<
std::string>(
"property_name"))
55 "The number of entries must be equal to either zero or the number of entries in "
69 addFunctorProperty<GenericReal<is_ad>>(
74 for (
const auto i : index_range(
_functors))
78 const auto r_point = r.getPoint();
93 _parsed_function = std::make_shared<SymFunction>();
96 std::vector<std::string> symbols(_functor_symbols);
99 symbols_str += symbols_str.empty() ?
"x,y,z" :
",x,y,z";
101 mooseError(
"ParsedFunctorMaterial assumes the dimension is always equal to 3.");
102 symbols_str += symbols_str.empty() ?
"t" :
",t";
105 this->parsedFunctionSetup(_parsed_function,
109 {std::to_string(
libMesh::pi), std::to_string(std::exp(Real(1)))},
113 _func_params.resize(_n_functors +
Moose::dim + 1);
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Moose::GenericType< Real, is_ad > GenericReal
registerMooseObject("MooseApp", ParsedFunctorMaterial)
Real getTimeFromStateArg(const Moose::StateArg &state) const
Returns the time associated with the requested state.
std::vector< GenericReal< is_ad > > _func_params
Array to stage the parameters passed to the functions when calling Eval.
GenericReal< is_ad > evaluate(SymFunctionPtr &, const std::string &object_name="")
Evaluate FParser object and check EvalError.
static InputParameters validParams()
const Moose::Functor< T > & getFunctor(const std::string &name)
Retrieves a functor from the subproblem.
FunctorMaterials compute functor material properties.
static InputParameters validParams()
FEProblemBase & _fe_problem
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 ...
const std::string & _name
The name of this class.
MooseEnumIterator end() const
MooseEnumIterator begin() const
Returns a begin/end iterator to all of the set values in the enum.
Computes a functor material from a parsed expression of other functors.
void buildParsedFunction()
Builds the parsed function.
const std::vector< std::string > & _functor_names
Functors to use in the parsed expression.
SymFunctionPtr _parsed_function
The parsed function.
ParsedFunctorMaterialTempl(const InputParameters ¶meters)
static InputParameters validParams()
const std::string & _property_name
Name to give the new functor material property.
const unsigned int _n_functors
Number of functors.
std::vector< std::string > _functor_symbols
Symbolic name to use for each functor.
std::vector< const Moose::Functor< GenericReal< is_ad > > * > _functors
Functors.
const ExecFlagEnum & _execute_enum
Execute settings for this object.
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
std::string stringify(const T &t)
conversion to string