12 #include "RankTwoTensor.h"
14 #include "libmesh/quadrature.h"
20 template <ComputeStage compute_stage>
25 params.addClassDescription(
26 "Calculate stress divergence for an axisymmetric problem in cylindrical coordinates.");
27 params.addRequiredRangeCheckedParam<
unsigned int>(
30 "An integer corresponding to the direction the variable this kernel acts in. (0 "
31 "refers to the radial and 1 to the axial displacement.)");
32 params.set<
bool>(
"use_displaced_mesh") =
true;
36 template <ComputeStage compute_stage>
38 const InputParameters & parameters)
43 template <ComputeStage compute_stage>
47 if (getBlockCoordSystem() != Moose::COORD_RZ)
48 mooseError(
"The coordinate system in the Problem block must be set to RZ for axisymmetric "
52 template <ComputeStage compute_stage>
59 div = _grad_test[_i][_qp](0) * _stress[_qp](0, 0) +
60 (_test[_i][_qp] / _ad_q_point[_qp](0)) * _stress[_qp](2, 2) +
61 _grad_test[_i][_qp](1) * _stress[_qp](0, 1);
64 if (_volumetric_locking_correction)
65 div += (_avg_grad_test[_i] - _grad_test[_i][_qp](0) - _test[_i][_qp] / _ad_q_point[_qp](0)) *
66 (_stress[_qp].trace()) / 3.0;
68 else if (_component == 1)
70 div = _grad_test[_i][_qp](1) * _stress[_qp](1, 1) +
71 _grad_test[_i][_qp](0) * _stress[_qp](1, 0);
74 if (_volumetric_locking_correction)
75 div += (_avg_grad_test[_i] - _grad_test[_i][_qp](1)) * (_stress[_qp].trace()) / 3.0;
78 mooseError(
"Invalid component for this AxisymmetricRZ problem.");
83 template <ComputeStage compute_stage>
87 if (!_volumetric_locking_correction)
90 ADReal ad_current_elem_volume = 0.0;
91 for (
unsigned int qp = 0; qp < _qrule->n_points(); qp++)
92 ad_current_elem_volume += _ad_JxW[qp] * _ad_coord[qp];
95 _avg_grad_test.resize(_test.size());
96 for (_i = 0; _i < _test.size(); ++_i)
98 _avg_grad_test[_i] = 0.0;
99 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
102 _avg_grad_test[_i] +=
103 (_grad_test[_i][_qp](_component) + _test[_i][_qp] / _ad_q_point[_qp](0)) *
104 _ad_JxW[_qp] * _ad_coord[_qp];
106 _avg_grad_test[_i] += _grad_test[_i][_qp](_component) * _ad_JxW[_qp] * _ad_coord[_qp];
108 _avg_grad_test[_i] /= ad_current_elem_volume;