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

Constructor & Destructor Documentation

◆ RadialDisplacementSphereAux()

RadialDisplacementSphereAux::RadialDisplacementSphereAux ( const InputParameters &  parameters)

Definition at line 32 of file RadialDisplacementSphereAux.C.

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

◆ ~RadialDisplacementSphereAux()

virtual RadialDisplacementSphereAux::~RadialDisplacementSphereAux ( )
inlinevirtual

Definition at line 30 of file RadialDisplacementSphereAux.h.

30 {}

Member Function Documentation

◆ computeValue()

Real RadialDisplacementSphereAux::computeValue ( )
protectedvirtual

Compute the value of the radial displacement.

Definition at line 76 of file RadialDisplacementSphereAux.C.

77 {
78  Real rad_disp = 0.0;
79 
80  if ((_coord_system == Moose::COORD_XYZ && _ndisp == 3) ||
81  (_coord_system == Moose::COORD_RZ && _ndisp == 2))
82  {
83  Point current_point(*_current_node);
84  RealVectorValue rad_vec(current_point - _origin);
85  Real rad = rad_vec.norm();
86  const RealVectorValue disp_vec(
87  (*_disp_vals[0])[_qp], (*_disp_vals[1])[_qp], (_ndisp == 3 ? (*_disp_vals[2])[_qp] : 0.0));
88  if (rad > 0.0)
89  {
90  rad_vec /= rad;
91  rad_disp = rad_vec * disp_vec;
92  }
93  else
94  rad_disp = disp_vec.norm();
95  }
96  else if (_coord_system == Moose::COORD_RSPHERICAL)
97  rad_disp = (*_disp_vals[0])[_qp];
98  else
99  mooseError("Unsupported coordinate system");
100 
101  return rad_disp;
102 }
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

◆ _coord_system

Moose::CoordinateSystemType RadialDisplacementSphereAux::_coord_system
protected

Type of coordinate system.

Definition at line 37 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().

◆ _disp_vals

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

Coupled variable values of the displacement components.

Definition at line 42 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().

◆ _ndisp

unsigned int RadialDisplacementSphereAux::_ndisp
protected

Number of displacment components.

Definition at line 40 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().

◆ _origin

RealVectorValue RadialDisplacementSphereAux::_origin
protected

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

Definition at line 46 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().


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