21 "function",
"FunctionExpression",
"function expression");
24 params.
addParam<std::vector<PostprocessorName>>(
"pp_names", {},
"Post-processors arguments");
25 params.
addParam<std::vector<std::string>>(
26 "pp_symbols", {},
"Symbol associated with each post-processor argument");
27 params.
addParam<std::vector<std::string>>(
30 "Vector of constants used in the parsed function (use this for kB etc.)");
31 params.
addParam<std::vector<std::string>>(
32 "constant_expressions",
34 "Vector of values for the constants in constant_names (can be an FParser expression)");
36 "use_t",
false,
"Make time (t) variable available in the function expression.");
45 _n_pp(coupledPostprocessors(
"pp_names")),
46 _use_t(getParam<bool>(
"use_t")),
50 std::string postprocessors;
52 const std::vector<std::string> pp_symbols = getParam<std::vector<std::string>>(
"pp_symbols");
54 if (!pp_symbols.empty() && (pp_symbols.size() !=
_n_pp))
55 paramError(
"pp_symbols",
"pp_symbols must be the same length as pp_names.");
58 std::vector<PostprocessorName> pp_names = getParam<std::vector<PostprocessorName>>(
"pp_names");
59 if (pp_symbols.empty())
61 for (std::size_t i = 0; i <
_n_pp; ++i)
62 postprocessors += (i == 0 ?
"" :
",") + pp_names[i];
69 postprocessors += (postprocessors.empty() ?
"" :
",") + std::string(
"t");
72 _func_F = std::make_shared<SymFunction>();
74 getParam<std::string>(
"expression"),
76 getParam<std::vector<std::string>>(
"constant_names"),
77 getParam<std::vector<std::string>>(
"constant_expressions"),
83 for (
unsigned int i = 0; i <
_n_pp; i++)
100 for (
unsigned int i = 0; i <
_n_pp; i++)
GenericReal< is_ad > evaluate(SymFunctionPtr &, const std::string &object_name="")
Evaluate FParser object and check EvalError.
std::vector< const PostprocessorValue * > _pp_values
values of the postprocessors part of the parsed expression
const Parallel::Communicator & comm() const
virtual void finalize() override final
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
const PostprocessorValue & getPostprocessorValue(const std::string ¶m_name, const unsigned int index=0) const
doco-normal-methods-begin Retrieve the value of a Postprocessor or one of it's old or older values ...
registerMooseObject("MooseApp", ParsedPostprocessor)
const bool _use_t
whether time is part of the parsed expression
static InputParameters validParams()
const unsigned int _n_pp
number of postprocessors in parsed expression
Real _value
This post-processor value.
Real PostprocessorValue
various MOOSE typedefs
virtual void initialize() override final
Called before execute() is ever called so that data can be cleared.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
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.
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 ...
virtual void execute() override final
Execute method.
std::vector< GenericReal< is_ad > > _func_params
Array to stage the parameters passed to the functions when calling Eval.
SymFunctionPtr _func_F
function parser object for the resudual and on-diagonal Jacobian
Postprocessor that evaluates a parsed function expression.
static InputParameters validParams()
static InputParameters validParams()
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
ParsedPostprocessor(const InputParameters ¶meters)
virtual PostprocessorValue getValue() const override final
This will get called to actually grab the final value the postprocessor has calculated.