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

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

#include <RadialDisplacementSphereAux.h>

Inheritance diagram for RadialDisplacementSphereAux:
[legend]

Public Member Functions

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

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 _origin
 Point used to define an origin for 2D axisymmetric or 3D Cartesian systems. More...
 

Detailed Description

Calculates the radial displacement for spherical geometries.

Works for 3D, 2D axisymmetric, and 1D geometries

Definition at line 22 of file RadialDisplacementSphereAux.h.

Constructor & Destructor Documentation

RadialDisplacementSphereAux::RadialDisplacementSphereAux ( const InputParameters &  parameters)

Definition at line 27 of file RadialDisplacementSphereAux.C.

28  : AuxKernel(parameters), _ndisp(coupledComponents("displacements")), _disp_vals(_ndisp)
29 {
30  const std::set<SubdomainID> & subdomains = _mesh.meshSubdomains();
31  const auto & sbd_begin = *subdomains.begin();
32  for (const auto & sbd : subdomains)
33  {
34  if (sbd == sbd_begin)
35  _coord_system = _subproblem.getCoordSystem(sbd);
36  else if (_subproblem.getCoordSystem(sbd) != _coord_system)
37  mooseError(
38  "RadialDisplacementSphereAux requires that all subdomains have the same coordinate type");
39  }
40 
41  for (unsigned int i = 0; i < _ndisp; ++i)
42  _disp_vals[i] = &coupledValue("displacements", i);
43 
44  if (_ndisp != _mesh.dimension())
45  mooseError("The number of displacement variables supplied must match the mesh dimension.");
46 
47  if ((_coord_system == Moose::COORD_XYZ) || (_coord_system == Moose::COORD_RZ))
48  {
49  if (isParamValid("origin"))
50  _origin = getParam<RealVectorValue>("origin");
51  else
52  mooseError(
53  "Must specify 'origin' for models with Cartesian or axisymmetric coordinate systems.");
54  }
55  else if (isParamValid("origin"))
56  mooseError("The 'origin' parameter is only valid for models with Cartesian or axisymmetric "
57  "coordinate systems.");
58 
59  if (_coord_system == Moose::COORD_XYZ && _ndisp != 3)
60  mooseError("Cannot compute radial displacement for models with 1D or 2D Cartesian system");
61 
62  if (_coord_system == Moose::COORD_RZ && _ndisp != 2)
63  mooseError(
64  "Can only compute radial displacement for axisymmetric systems if the dimensionality is 2");
65 
66  if (!isNodal())
67  mooseError("Must run on a nodal variable");
68 }
RealVectorValue _origin
Point used to define an origin for 2D axisymmetric or 3D Cartesian systems.
std::vector< const VariableValue * > _disp_vals
Coupled variable values of the displacement components.
unsigned int _ndisp
Number of displacment components.
Moose::CoordinateSystemType _coord_system
Type of coordinate system.
virtual RadialDisplacementSphereAux::~RadialDisplacementSphereAux ( )
inlinevirtual

Definition at line 27 of file RadialDisplacementSphereAux.h.

27 {}

Member Function Documentation

Real RadialDisplacementSphereAux::computeValue ( )
protectedvirtual

Compute the value of the radial displacement.

Definition at line 71 of file RadialDisplacementSphereAux.C.

Referenced by ~RadialDisplacementSphereAux().

72 {
73  Real rad_disp = 0.0;
74 
75  if ((_coord_system == Moose::COORD_XYZ && _ndisp == 3) ||
76  (_coord_system == Moose::COORD_RZ && _ndisp == 2))
77  {
78  Point current_point(*_current_node);
79  RealVectorValue rad_vec(current_point - _origin);
80  Real rad = rad_vec.norm();
81  const RealVectorValue disp_vec(
82  (*_disp_vals[0])[_qp], (*_disp_vals[1])[_qp], (_ndisp == 3 ? (*_disp_vals[2])[_qp] : 0.0));
83  if (rad > 0.0)
84  {
85  rad_vec /= rad;
86  rad_disp = rad_vec * disp_vec;
87  }
88  else
89  rad_disp = disp_vec.norm();
90  }
91  else if (_coord_system == Moose::COORD_RSPHERICAL)
92  rad_disp = (*_disp_vals[0])[_qp];
93  else
94  mooseError("Unsupported coordinate system");
95 
96  return rad_disp;
97 }
RealVectorValue _origin
Point used to define an origin for 2D axisymmetric or 3D Cartesian systems.
std::vector< const VariableValue * > _disp_vals
Coupled variable values of the displacement components.
unsigned int _ndisp
Number of displacment components.
Moose::CoordinateSystemType _coord_system
Type of coordinate system.

Member Data Documentation

Moose::CoordinateSystemType RadialDisplacementSphereAux::_coord_system
protected

Type of coordinate system.

Definition at line 34 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().

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

Coupled variable values of the displacement components.

Definition at line 39 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().

unsigned int RadialDisplacementSphereAux::_ndisp
protected

Number of displacment components.

Definition at line 37 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().

RealVectorValue RadialDisplacementSphereAux::_origin
protected

Point used to define an origin for 2D axisymmetric or 3D Cartesian systems.

Definition at line 43 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().


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