21 "Sets field array variable values to the evaluation of a parsed expression.");
24 "expression",
"FunctionExpression",
"Parsed function expression to compute");
25 params.
addCoupledVar(
"coupled_variables",
"Vector of coupled variable names.");
26 params.
addCoupledVar(
"coupled_array_variables",
"Vector of coupled array variable names.");
31 "Make coordinate (x,y,z) and time (t) variables available in the function expression.");
32 params.
addParam<std::vector<std::string>>(
35 "Vector of constants used in the parsed function (use this for kB etc.)");
36 params.
addParam<std::vector<std::string>>(
37 "constant_expressions",
39 "Vector of values for the constants in constant_names (can be an FParser expression)");
47 _function(getParam<
std::string>(
"expression")),
48 _n_vars(coupledComponents(
"coupled_variables")),
49 _n_array_vars(coupledComponents(
"coupled_array_variables")),
50 _vars(coupledValues(
"coupled_variables")),
51 _array_vars(coupledArrayValues(
"coupled_array_variables")),
52 _use_xyzt(getParam<bool>(
"use_xyzt"))
55 std::string variables;
58 for (
const auto & i : make_range(
_n_vars))
59 variables += (i == 0 ?
"" :
",") +
getFieldVar(
"coupled_variables", i)->
name();
62 const auto & var = *
getArrayVar(
"coupled_array_variables", i);
65 "The number of components in '",
69 ") does not match the number of components in '",
74 variables += (i == 0 &&
_n_vars == 0 ?
"" :
",") + var.name();
78 const std::vector<std::string> xyzt = {
"x",
"y",
"z",
"t"};
81 variables += (variables.empty() ?
"" :
",") + v;
84 _func_F = std::make_shared<SymFunction>();
88 getParam<std::vector<std::string>>(
"constant_names"),
89 getParam<std::vector<std::string>>(
"constant_expressions"),
103 for (
const auto & i : make_range(
_n_vars))
116 for (
const auto & c : make_range(
_var.
count()))
registerMooseObject("MooseApp", ArrayParsedAux)
AuxKernel that evaluates a parsed function expression for each component of an array variable.
static InputParameters validParams()
const unsigned int _n_vars
Number of coupled regular variables.
virtual RealEigenVector computeValue() override
Compute and return the value of the aux variable.
std::string _function
Function expression.
ArrayParsedAux(const InputParameters ¶meters)
const unsigned int _n_array_vars
Number of coupled array variables.
const std::vector< const VariableValue * > _vars
Regular variable values.
const bool _use_xyzt
Import coordinates and time.
SymFunctionPtr _func_F
Function parser object that is evaluated for setting aux-variable values.
const std::vector< const ArrayVariableValue * > _array_vars
Array variable values.
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
bool isNodal() const
Nodal or elemental kernel?
const MooseArray< Point > & _q_point
Active quadrature points.
unsigned int _qp
Quadrature point index.
MooseVariableField< ComputeValueType > & _var
This is a regular kernel so we cast to a regular MooseVariable, hides base _var.
static InputParameters validParams()
const MooseVariableFieldBase * getFieldVar(const std::string &var_name, unsigned int comp) const
ArrayMooseVariable * getArrayVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled array variable.
std::vector< GenericReal< is_ad > > _func_params
Array to stage the parameters passed to the functions when calling Eval.
void parsedFunctionSetup(SymFunctionPtr &function, const std::string &expression, const std::string &variables, const std::vector< std::string > &constant_names, const std::vector< std::string > &constant_expressions, const libMesh::Parallel::Communicator &comm) const
Performs setup steps on a SymFunction.
GenericReal< is_ad > evaluate(SymFunctionPtr &, const std::string &object_name="")
Evaluate FParser object and check EvalError.
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
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 T & getParam(const std::string &name) const
Retrieve a parameter for the object.
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
const Parallel::Communicator & comm() const
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.