20 params.
addClassDescription(
"Creates fields by using information from a SolutionUserObject.");
21 params.
addRequiredParam<UserObjectName>(
"solution",
"The name of the SolutionUserObject");
22 params.
addParam<std::string>(
"from_variable",
23 "The name of the variable to extract from the file");
27 "The policy used to select a unique value when the imported solution is multivalued and "
32 "If true the meshes must be the same and then the values are simply copied over.");
36 "Scale factor (a) to be applied to the solution (x): ax+b, where b is the 'add_factor'");
40 "Add this value (b) to the solution (x): ax+b, where a is the 'scale_factor'");
47 _weighting_type(isParamSetByUser(
"weighting_type")
48 ?
std::make_optional(getParam<
MooseEnum>(
"weighting_type")
51 _direct(getParam<bool>(
"direct")),
52 _scale_factor(getParam<Real>(
"scale_factor")),
53 _add_factor(getParam<Real>(
"add_factor"))
64 _var_name = getParam<std::string>(
"from_variable");
74 mooseError(
"The SolutionUserObject contains multiple variables, please specify the desired "
75 "variables in the input file with 'from_variable' parameter.");
99 "The SolutionUserObject must be initialized before validating its imported variable.");
104 "The imported variable '",
106 "' is vector-valued, but SolutionAux supports only scalar-valued imported variables.");
113 "A weighting policy should be specified when the imported variable '",
115 "' is spatially discontinuous. Values evaluated on element interfaces may depend on "
116 "source element ordering.");
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
registerMooseObject("MooseApp", SolutionAux)
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
bool isNodal() const
Nodal or elemental kernel?
virtual void compute() override
Computes the value and stores it in the solution vector.
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
const Node *const & _current_node
Current node (valid only for nodal kernels)
static InputParameters validParams()
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...
AuxKernel for reading a solution from file.
const std::optional< SolutionUserObjectBase::WeightingType > _weighting_type
Policy used when the imported solution is multivalued at the query point.
virtual void initialSetup() override
Sets up the variable name for extraction from the SolutionUserObject.
void validateVariable()
Validates that the selected imported variable is compatible with this AuxKernel.
static InputParameters validParams()
bool _variable_is_validated
Whether the imported variable has been validated.
const Real _scale_factor
Multiplier for the solution, the a of ax+b.
const SolutionUserObjectBase & _solution_object
Reference to the SolutionUserObject storing the solution.
virtual Real computeValue() override
Computes a value for a node or element depending on the type of kernel, it also uses the 'direct' fla...
virtual void compute() override
Validates the imported variable once before computing values.
bool _direct
Flag for directly grabbing the data based on the dof.
std::string _var_name
The variable name of interest.
const Real _add_factor
Additional factor added to the solution, the b of ax+b.
SolutionAux(const InputParameters ¶meters)
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 initialized() const
Returns whether the imported solution has been initialized.
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
Real directValue(const Node *node, const std::string &var_name) const
Return a value directly from a Node.