11 #include "MooseMesh.h"
21 params.addClassDescription(
22 "Compute the radial component of the displacement vector for spherical models.");
23 params.addRequiredCoupledVar(
25 "The displacements appropriate for the simulation geometry and coordinate system");
26 params.addParam<RealVectorValue>(
"origin",
27 "Sphere origin for 3D Cartesian and 2D axisymmetric models");
28 params.set<
bool>(
"use_displaced_mesh") =
false;
34 : AuxKernel(parameters), _ndisp(coupledComponents(
"displacements")), _disp_vals(_ndisp)
36 const std::set<SubdomainID> & subdomains = _mesh.meshSubdomains();
37 const auto & sbd_begin = *subdomains.begin();
38 for (
const auto & sbd : subdomains)
44 "RadialDisplacementSphereAux requires that all subdomains have the same coordinate type");
47 for (
unsigned int i = 0; i <
_ndisp; ++i)
48 _disp_vals[i] = &coupledValue(
"displacements", i);
50 if (
_ndisp != _mesh.dimension())
51 mooseError(
"The number of displacement variables supplied must match the mesh dimension.");
55 if (isParamValid(
"origin"))
56 _origin = getParam<RealVectorValue>(
"origin");
59 "Must specify 'origin' for models with Cartesian or axisymmetric coordinate systems.");
61 else if (isParamValid(
"origin"))
62 mooseError(
"The 'origin' parameter is only valid for models with Cartesian or axisymmetric "
63 "coordinate systems.");
66 mooseError(
"Cannot compute radial displacement for models with 1D or 2D Cartesian system");
70 "Can only compute radial displacement for axisymmetric systems if the dimensionality is 2");
73 mooseError(
"Must run on a nodal variable");
84 Point current_point(*_current_node);
85 RealVectorValue rad_vec(current_point -
_origin);
86 Real rad = rad_vec.norm();
87 const RealVectorValue disp_vec(
92 rad_disp = rad_vec * disp_vec;
95 rad_disp = disp_vec.norm();
100 mooseError(
"Unsupported coordinate system");