18SolutionFunction::validParams()
26 "The SolutionUserObject to extract data from.");
27 params.
addParam<std::string>(
"from_variable",
28 "The name of the variable in the file that is to be extracted");
32 "The policy used to select a unique value when the imported solution is multivalued.");
38 "Scale factor (a) to be applied to the solution (x): ax+b, where b is the 'add_factor'");
42 "Add this value (b) to the solution (x): ax+b, where a is the 'scale_factor'");
50 _solution_object_ptr(nullptr),
51 _weighting_type(isParamSetByUser(
"weighting_type")
52 ?
std::make_optional(getParam<
MooseEnum>(
"weighting_type")
55 _scale_factor(getParam<
Real>(
"scale_factor")),
56 _add_factor(getParam<
Real>(
"add_factor"))
58 for (
unsigned int d = 0; d < _ti_feproblem.mesh().dimension(); ++d)
59 _add_grad(d) = _add_factor;
63SolutionFunction::initialSetup()
68 _solution_object_ptr = &getUserObject<SolutionUserObjectBase>(
"solution");
72 _solution_object_var_name = getParam<std::string>(
"from_variable");
83 "The SolutionUserObject contains no variables for the SolutionFunction to extract");
87 mooseError(
"The SolutionUserObject contains multiple variables, the SolutionFunction must "
88 "specify the desired variable in the input file with 'from_variable'");
91 _solution_object_var_name =
vars[0];
97 "The imported variable '",
98 _solution_object_var_name,
99 "' is vector-valued, but SolutionFunction supports only scalar-valued imported variables.");
106 "A weighting policy should be specified when the imported variable '",
107 _solution_object_var_name,
108 "' is spatially discontinuous. Values evaluated on element interfaces may depend on "
109 "source element ordering.");
113SolutionFunction::value(Real t,
const Point & p)
const
116 return _scale_factor *
117 _solution_object_ptr->
pointValue(t, p, _solution_object_var_name, *_weighting_type) +
120 return _scale_factor * _solution_object_ptr->
pointValue(t, p, _solution_object_var_name) +
125SolutionFunction::gradient(Real t,
const Point & p)
const
129 t, p, _solution_object_var_name, *_weighting_type) +
132 return _scale_factor * _solution_object_ptr->
pointValueGradient(t, p, _solution_object_var_name) +
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
registerMooseObject("MooseApp", SolutionFunction)
Base class for function objects.
static InputParameters validParams()
Class constructor.
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 ...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
SolutionFunction()=default
void paramWarning(const std::string ¶m, Args... args) const
User object that reads an existing solution from an input file and uses it in the current simulation.
Real pointValue(Real t, const Point &p, const unsigned int local_var_index, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
Returns a value at a specific location and variable (see SolutionFunction)
bool isVariableADiscontinuousScalarField(const std::string &var_name) const
Returns whether the imported variable is a discontinuous scalar finite element field.
static MooseEnum weightingType()
bool isVariableScalarValued(const std::string &var_name) const
Returns whether the imported variable has a scalar finite element field type.
const std::vector< std::string > & variableNames() const
libMesh::RealGradient pointValueGradient(Real t, const Point &p, const std::string &var_name, WeightingType weighting_type, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
Returns the gradient at a specific location and variable, reducing multiple gradients according to th...
RealVectorValue RealGradient
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real