www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RadialDisplacementCylinderAux Class Reference

Calculates the radial displacement for cylindrical geometries. More...

#include <RadialDisplacementCylinderAux.h>

Inheritance diagram for RadialDisplacementCylinderAux:
[legend]

Public Member Functions

 RadialDisplacementCylinderAux (const InputParameters &parameters)
 
virtual ~RadialDisplacementCylinderAux ()
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual Real computeValue ()
 Compute the value of the radial displacement. More...
 

Protected Attributes

Moose::CoordinateSystemType _coord_system
 Type of coordinate system. More...
 
unsigned int _ndisp
 Number of displacment components. More...
 
std::vector< const VariableValue * > _disp_vals
 Coupled variable values of the displacement components. More...
 
RealVectorValue _axis_vector
 Axis direction. More...
 
RealVectorValue _origin
 Point used to define the origin of the cylinder axis for Cartesian systems. More...
 

Detailed Description

Calculates the radial displacement for cylindrical geometries.

Works for 2D and 3D Cartesian systems and axisymmetric systems

Definition at line 24 of file RadialDisplacementCylinderAux.h.

Constructor & Destructor Documentation

◆ RadialDisplacementCylinderAux()

RadialDisplacementCylinderAux::RadialDisplacementCylinderAux ( const InputParameters &  parameters)

Definition at line 35 of file RadialDisplacementCylinderAux.C.

36  : AuxKernel(parameters), _ndisp(coupledComponents("displacements")), _disp_vals(_ndisp)
37 {
38  const std::set<SubdomainID> & subdomains = _mesh.meshSubdomains();
39  const auto & sbd_begin = *subdomains.begin();
40  for (const auto & sbd : subdomains)
41  {
42  if (sbd == sbd_begin)
43  _coord_system = _subproblem.getCoordSystem(sbd);
44  else if (_subproblem.getCoordSystem(sbd) != _coord_system)
45  mooseError("RadialDisplacementCylinderAux requires that all subdomains have the same "
46  "coordinate type");
47  }
48 
49  for (unsigned int i = 0; i < _ndisp; ++i)
50  _disp_vals[i] = &coupledValue("displacements", i);
51 
52  if (_ndisp != _mesh.dimension())
53  mooseError("The number of displacement variables supplied must match the mesh dimension.");
54 
55  if (_coord_system == Moose::COORD_XYZ && _ndisp == 1)
56  mooseError("RadialDisplacmentCylinderAux is not applicable for 1D Cartesian models");
57 
58  else if (!(_coord_system == Moose::COORD_XYZ || _coord_system == Moose::COORD_RZ))
59  mooseError("RadialDisplacementCylinderAux can only be used with Cartesian or axisymmetric "
60  "coordinate systems");
61 
62  if (isParamValid("origin"))
63  {
64  if (_coord_system != Moose::COORD_XYZ)
65  mooseError("The 'origin' parameter is only valid for Cartesian models.");
66 
67  _origin = getParam<RealVectorValue>("origin");
68  }
69  else if (_coord_system == Moose::COORD_XYZ)
70  mooseError("Must specify 'origin' for models with Cartesian coordinate systems.");
71 
72  if (isParamValid("axis_vector"))
73  {
74  if (!(_coord_system == Moose::COORD_XYZ && _ndisp == 3))
75  mooseError("The 'axis_vector' parameter is only valid for 3D Cartesian models.");
76 
77  _axis_vector = getParam<RealVectorValue>("axis_vector");
78  Real vec_len = _axis_vector.norm();
79  if (MooseUtils::absoluteFuzzyEqual(vec_len, 0.0))
80  mooseError("axis_vector must have nonzero length");
81  _axis_vector /= vec_len;
82  }
83  else if (_coord_system == Moose::COORD_XYZ && _ndisp == 3)
84  mooseError("Must specify 'axis_vector' for 3D Cartesian models");
85 
86  if (!isNodal())
87  mooseError("Must run on a nodal variable");
88 }

◆ ~RadialDisplacementCylinderAux()

virtual RadialDisplacementCylinderAux::~RadialDisplacementCylinderAux ( )
inlinevirtual

Definition at line 31 of file RadialDisplacementCylinderAux.h.

31 {}

Member Function Documentation

◆ computeValue()

Real RadialDisplacementCylinderAux::computeValue ( )
protectedvirtual

Compute the value of the radial displacement.

Definition at line 91 of file RadialDisplacementCylinderAux.C.

92 {
93  Real rad_disp = 0.0;
94  Point current_point(*_current_node);
95 
96  switch (_coord_system)
97  {
98  case Moose::COORD_XYZ:
99  {
100  RealVectorValue rad_vec;
101  const RealVectorValue disp_vec((*_disp_vals[0])[_qp],
102  (*_disp_vals[1])[_qp],
103  (_ndisp == 3 ? (*_disp_vals[2])[_qp] : 0.0));
104 
105  if (_ndisp == 2)
106  rad_vec = current_point - _origin;
107  else if (_ndisp == 3)
108  {
109  // t is the distance along the axis from point 1 to 2 to the point nearest to the current
110  // point.
111  const RealVectorValue p1pc(current_point - _origin);
112  const Real t = p1pc * _axis_vector;
113 
114  // The nearest point on the cylindrical axis to current_point is p.
115  const RealVectorValue p(_origin + t * _axis_vector);
116  rad_vec = current_point - p;
117  }
118 
119  Real rad = rad_vec.norm();
120  if (rad > 0.0)
121  {
122  rad_vec /= rad;
123  rad_disp = rad_vec * disp_vec;
124  }
125  else
126  rad_disp = disp_vec.norm();
127  break;
128  }
129  case Moose::COORD_RZ:
130  rad_disp = (*_disp_vals[0])[_qp];
131  break;
132  default:
133  mooseError("Unsupported coordinate system");
134  }
135 
136  return rad_disp;
137 }

◆ validParams()

InputParameters RadialDisplacementCylinderAux::validParams ( )
static

Definition at line 18 of file RadialDisplacementCylinderAux.C.

19 {
20  InputParameters params = AuxKernel::validParams();
21  params.addClassDescription(
22  "Compute the radial component of the displacement vector for cylindrical models.");
23  params.addRequiredCoupledVar(
24  "displacements",
25  "The displacements appropriate for the simulation geometry and coordinate system");
26  params.addParam<RealVectorValue>(
27  "origin", "Origin of cylinder axis of rotation for 2D and 3D Cartesian models");
28  params.addParam<RealVectorValue>(
29  "axis_vector", "Vector defining direction of cylindrical axis (3D Cartesian models)");
30  params.set<bool>("use_displaced_mesh") = false;
31 
32  return params;
33 }

Member Data Documentation

◆ _axis_vector

RealVectorValue RadialDisplacementCylinderAux::_axis_vector
protected

Axis direction.

Definition at line 46 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

◆ _coord_system

Moose::CoordinateSystemType RadialDisplacementCylinderAux::_coord_system
protected

Type of coordinate system.

Definition at line 38 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

◆ _disp_vals

std::vector<const VariableValue *> RadialDisplacementCylinderAux::_disp_vals
protected

Coupled variable values of the displacement components.

Definition at line 43 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

◆ _ndisp

unsigned int RadialDisplacementCylinderAux::_ndisp
protected

Number of displacment components.

Definition at line 41 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

◆ _origin

RealVectorValue RadialDisplacementCylinderAux::_origin
protected

Point used to define the origin of the cylinder axis for Cartesian systems.

Definition at line 49 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().


The documentation for this class was generated from the following files:
RadialDisplacementCylinderAux::_origin
RealVectorValue _origin
Point used to define the origin of the cylinder axis for Cartesian systems.
Definition: RadialDisplacementCylinderAux.h:49
validParams
InputParameters validParams()
RadialDisplacementCylinderAux::_disp_vals
std::vector< const VariableValue * > _disp_vals
Coupled variable values of the displacement components.
Definition: RadialDisplacementCylinderAux.h:43
RadialDisplacementCylinderAux::_coord_system
Moose::CoordinateSystemType _coord_system
Type of coordinate system.
Definition: RadialDisplacementCylinderAux.h:38
RadialDisplacementCylinderAux::_axis_vector
RealVectorValue _axis_vector
Axis direction.
Definition: RadialDisplacementCylinderAux.h:46
RadialDisplacementCylinderAux::_ndisp
unsigned int _ndisp
Number of displacment components.
Definition: RadialDisplacementCylinderAux.h:41