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

Constructor & Destructor Documentation

RadialDisplacementCylinderAux::RadialDisplacementCylinderAux ( const InputParameters &  parameters)

Definition at line 29 of file RadialDisplacementCylinderAux.C.

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

Definition at line 27 of file RadialDisplacementCylinderAux.h.

27 {}

Member Function Documentation

Real RadialDisplacementCylinderAux::computeValue ( )
protectedvirtual

Compute the value of the radial displacement.

Definition at line 85 of file RadialDisplacementCylinderAux.C.

Referenced by ~RadialDisplacementCylinderAux().

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

RealVectorValue RadialDisplacementCylinderAux::_axis_vector
protected

Axis direction.

Definition at line 42 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

Moose::CoordinateSystemType RadialDisplacementCylinderAux::_coord_system
protected

Type of coordinate system.

Definition at line 34 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

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

Coupled variable values of the displacement components.

Definition at line 39 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

unsigned int RadialDisplacementCylinderAux::_ndisp
protected

Number of displacment components.

Definition at line 37 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().

RealVectorValue RadialDisplacementCylinderAux::_origin
protected

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

Definition at line 45 of file RadialDisplacementCylinderAux.h.

Referenced by computeValue(), and RadialDisplacementCylinderAux().


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