Go to the documentation of this file.
26 "The SolutionUserObject to extract data from.");
27 params.
addParam<std::vector<std::string>>(
29 "The names of the variables in the file that are to be extracted, in x, y "
30 "order if they are vector components");
35 "Scale factor (a) to be applied to the solution (x): ax+b, where b is the 'add_factor'");
39 "Add this value (b) to the solution (x): ax+b, where a is the 'scale_factor'");
40 params.
addParam<Real>(
"axial_dimension_ratio",
42 "Ratio of the axial dimension in the 3d model to that in the 2d model. "
43 "Optinally permits the 3d model to be larger than the 2d model in that "
44 "dimension, and scales vector solutions in that direction by this factor.");
48 "Start point for axis of symmetry for the 2d model");
51 "End point for axis of symmetry for the 2d model");
54 "Start point for axis of symmetry for the 3d model");
57 "End point for axis of symmetry for the 3d model");
59 params.
addParam<
unsigned int>(
"component",
60 "Component of the variable to be computed if it is a vector");
63 "mapping it to a 3D Cartesian model");
71 _solution_object_ptr(NULL),
72 _scale_factor(getParam<Real>(
"scale_factor")),
73 _add_factor(getParam<Real>(
"add_factor")),
74 _axial_dim_ratio(getParam<Real>(
"axial_dimension_ratio")),
79 _has_component(isParamValid(
"component")),
80 _component(_has_component ? getParam<unsigned int>(
"component") : 99999),
81 _var_names(getParam<
std::vector<
std::string>>(
"from_variables"))
84 mooseError(
"Must supply names of 2 variables in 'from_variables' if 'component' is specified");
86 mooseError(
"Must supply 'component' if 2 variables specified in 'from_variables'");
88 mooseError(
"If 'from_variables' is specified, it must have either 1 (scalar) or 2 (vector "
89 "components) variables");
101 mooseError(
"3d_axis_point1 and 3d_axis_point2 must be different points");
103 mooseError(
"2d_axis_point1 and 2d_axis_point2 must be different points");
122 mooseError(
"If the SolutionUserObject contains multiple variables, the variable name must be "
123 "specified in the input file with 'from_variables'");
129 mooseError(
"3rd component of 2d_axis_point1 must be zero");
131 mooseError(
"3rd component of 2d_axis_point2 must be zero");
134 for (
unsigned int i = 0; i <
_var_names.size(); ++i)
146 bool r_gt_zero =
false;
154 Real r = r_dir_3d.norm();
161 xypoint(0) = std::sqrt(p(0) * p(0) + p(2) * p(2));
168 z_dir_3d /= z_dir_3d.norm();
170 Real z = z_dir_3d * v3dp1p;
172 Point axis_proj_to_p = p - axis_proj;
173 Real r = axis_proj_to_p.norm();
177 r_dir_3d = axis_proj_to_p / r;
182 z_dir_2d /= z_dir_2d.norm();
183 Point out_of_plane_vec(0, 0, 1);
184 r_dir_2d = z_dir_2d.cross(out_of_plane_vec);
185 r_dir_2d /= r_dir_2d.norm();
197 val_vec_rz(0) = r_dir_2d(0) * val_x + r_dir_2d(1) * val_y;
198 val_vec_rz(1) = z_dir_2d(0) * val_x + z_dir_2d(1) * val_y;
200 mooseError(
"In Axisymmetric2D3DSolutionFunction r=0 and r component of value vector != 0");
201 Point val_vec_3d = val_vec_rz(0) * r_dir_3d + val_vec_rz(1) * z_dir_3d;
Axisymmetric2D3DSolutionFunction(const InputParameters ¶meters)
const RealVectorValue _2d_axis_point2
void mooseError(Args &&... args) const
const Real _scale_factor
Factor to scale the solution by (default = 1)
virtual void initialSetup() override
Setup the function for use Gathers a pointer to the SolutionUserObject containing the solution that w...
Function for reading a 2D axisymmetric solution from file and mapping it to a 3D Cartesian system.
std::vector< unsigned int > _solution_object_var_indices
The local SolutionUserObject indices for the variables extracted from the file.
unsigned int getLocalVarIndex(const std::string &var_name) const
Returns the local index for a given variable name.
virtual Real value(Real t, const Point &p) const override
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
const Real _add_factor
Factor to add to the solution (default = 0)
VectorValue< Real > RealVectorValue
const RealVectorValue _3d_axis_point1
Two points that define the axis of rotation for the 3d model.
registerMooseObject("MooseApp", Axisymmetric2D3DSolutionFunction)
const RealVectorValue _3d_axis_point2
const SolutionUserObject * _solution_object_ptr
Pointer to SolutionUserObject containing the solution of interest.
std::vector< std::string > _var_names
The variable names to extract from the file.
static InputParameters validParams()
Constructor.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
defineLegacyParams(Axisymmetric2D3DSolutionFunction)
static InputParameters validParams()
Class constructor.
const Real _axial_dim_ratio
Ratio of axial dimension of 3d model to its counterpart in the 2d model.
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)
const std::vector< std::string > & variableNames() const
bool _default_axes
Are the default axes of rotation being used?
Base class for function objects.
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether a variable is greater than another variable within an absolute tolerance.
const RealVectorValue _2d_axis_point1
Two points that define the axis of rotation for the 2d model.
const unsigned int _component
The index of the component.
const bool _has_component
If the solution field is a vector, the desired component must be specified Has the component been spe...