www.mooseframework.org
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 ()
 

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 25 of file RadialDisplacementCylinderAux.h.

Constructor & Destructor Documentation

◆ RadialDisplacementCylinderAux()

RadialDisplacementCylinderAux::RadialDisplacementCylinderAux ( const InputParameters &  parameters)

Definition at line 34 of file RadialDisplacementCylinderAux.C.

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

◆ ~RadialDisplacementCylinderAux()

virtual RadialDisplacementCylinderAux::~RadialDisplacementCylinderAux ( )
inlinevirtual

Definition at line 30 of file RadialDisplacementCylinderAux.h.

30 {}

Member Function Documentation

◆ computeValue()

Real RadialDisplacementCylinderAux::computeValue ( )
protectedvirtual

Compute the value of the radial displacement.

Definition at line 90 of file RadialDisplacementCylinderAux.C.

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

Member Data Documentation

◆ _axis_vector

RealVectorValue RadialDisplacementCylinderAux::_axis_vector
protected

Axis direction.

Definition at line 45 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

◆ _coord_system

Moose::CoordinateSystemType RadialDisplacementCylinderAux::_coord_system
protected

Type of coordinate system.

Definition at line 37 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 42 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

◆ _ndisp

unsigned int RadialDisplacementCylinderAux::_ndisp
protected

Number of displacment components.

Definition at line 40 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 48 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().


The documentation for this class was generated from the following files: