18 SolutionFunction::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");
34 "Scale factor (a) to be applied to the solution (x): ax+b, where b is the 'add_factor'");
38 "Add this value (b) to the solution (x): ax+b, where a is the 'scale_factor'");
46 _solution_object_ptr(NULL),
47 _scale_factor(getParam<
Real>(
"scale_factor")),
48 _add_factor(getParam<
Real>(
"add_factor"))
51 _add_grad(d) = _add_factor;
55 SolutionFunction::initialSetup()
60 _solution_object_ptr = &getUserObject<SolutionUserObject>(
"solution");
66 var_name = getParam<std::string>(
"from_variable");
72 const std::vector<std::string> & vars = _solution_object_ptr->
variableNames();
76 mooseError(
"The SolutionUserObject contains multiple variables, the SolutionFunction must " 77 "specifiy the desired variable in the input file with 'from_variable'");
82 _solution_object_var_index = _solution_object_ptr->
getLocalVarIndex(var_name);
86 SolutionFunction::value(Real t,
const Point & p)
const 88 return _scale_factor * (_solution_object_ptr->
pointValue(t, p, _solution_object_var_index)) +
93 SolutionFunction::gradient(Real t,
const Point & p)
const 95 return _scale_factor *
Base class for function objects.
const std::vector< std::string > & variableNames() const
FEProblemBase & _ti_feproblem
unsigned int getLocalVarIndex(const std::string &var_name) const
Returns the local index for a given variable name.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
RealGradient pointValueGradient(Real t, const Point &p, const std::string &var_name, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
Returns the gradient at a specific location and variable (see SolutionFunction)
SolutionFunction()=default
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Function for reading a solution from file Creates a function that extracts values from a solution rea...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual MooseMesh & mesh() override
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
registerMooseObject("MooseApp", SolutionFunction)
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)
static InputParameters validParams()
Class constructor.