www.mooseframework.org
Public Member Functions | Static 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 ()
 

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

Constructor & Destructor Documentation

◆ RadialDisplacementSphereAux()

RadialDisplacementSphereAux::RadialDisplacementSphereAux ( const InputParameters &  parameters)

Definition at line 33 of file RadialDisplacementSphereAux.C.

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

◆ ~RadialDisplacementSphereAux()

virtual RadialDisplacementSphereAux::~RadialDisplacementSphereAux ( )
inlinevirtual

Definition at line 31 of file RadialDisplacementSphereAux.h.

31 {}

Member Function Documentation

◆ computeValue()

Real RadialDisplacementSphereAux::computeValue ( )
protectedvirtual

Compute the value of the radial displacement.

Definition at line 77 of file RadialDisplacementSphereAux.C.

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

◆ validParams()

InputParameters RadialDisplacementSphereAux::validParams ( )
static

Definition at line 18 of file RadialDisplacementSphereAux.C.

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

Member Data Documentation

◆ _coord_system

Moose::CoordinateSystemType RadialDisplacementSphereAux::_coord_system
protected

Type of coordinate system.

Definition at line 38 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 43 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().

◆ _ndisp

unsigned int RadialDisplacementSphereAux::_ndisp
protected

Number of displacment components.

Definition at line 41 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 47 of file RadialDisplacementSphereAux.h.

Referenced by computeValue(), and RadialDisplacementSphereAux().


The documentation for this class was generated from the following files:
RadialDisplacementSphereAux::_coord_system
Moose::CoordinateSystemType _coord_system
Type of coordinate system.
Definition: RadialDisplacementSphereAux.h:38
RadialDisplacementSphereAux::_ndisp
unsigned int _ndisp
Number of displacment components.
Definition: RadialDisplacementSphereAux.h:41
RadialDisplacementSphereAux::_disp_vals
std::vector< const VariableValue * > _disp_vals
Coupled variable values of the displacement components.
Definition: RadialDisplacementSphereAux.h:43
RadialDisplacementSphereAux::_origin
RealVectorValue _origin
Point used to define an origin for 2D axisymmetric or 3D Cartesian systems.
Definition: RadialDisplacementSphereAux.h:47
validParams
InputParameters validParams()