15 #include "MooseVariable.h"
17 #include "SystemBase.h"
19 #include "libmesh/quadrature.h"
27 InputParameters params = validParams<Kernel>();
28 params.addRequiredParam<
unsigned int>(
"component",
29 "An integer corresponding to the direction "
30 "the variable this kernel acts in. (0 for r, "
32 params.addCoupledVar(
"disp_r",
"The r displacement");
33 params.addCoupledVar(
"disp_z",
"The z displacement");
34 params.addCoupledVar(
"temp",
"The temperature");
36 params.addParam<Real>(
"zeta", 0.0,
"Stiffness dependent damping parameter for Rayleigh damping");
37 params.addParam<Real>(
"alpha", 0.0,
"alpha parameter for HHT time integration");
38 params.addParam<std::string>(
39 "appended_property_name",
"",
"Name appended to material properties to make them unique");
40 params.addParam<
bool>(
"volumetric_locking_correction",
42 "Set to false to turn off volumetric locking correction");
44 params.set<
bool>(
"use_displaced_mesh") =
true;
51 _stress(getMaterialProperty<
SymmTensor>(
"stress")),
53 _d_stress_dT(getMaterialProperty<
SymmTensor>(
"d_stress_dT")),
54 _component(getParam<unsigned int>(
"component")),
55 _rdisp_coupled(isCoupled(
"disp_r")),
56 _zdisp_coupled(isCoupled(
"disp_z")),
57 _temp_coupled(isCoupled(
"temp")),
58 _rdisp_var(_rdisp_coupled ? coupled(
"disp_r") : 0),
59 _zdisp_var(_zdisp_coupled ? coupled(
"disp_z") : 0),
60 _temp_var(_temp_coupled ? coupled(
"temp") : 0),
61 _avg_grad_test(_test.size(), std::vector<Real>(3, 0.0)),
62 _avg_grad_phi(_phi.size(), std::vector<Real>(3, 0.0)),
63 _volumetric_locking_correction(getParam<bool>(
"volumetric_locking_correction"))
65 mooseDeprecated(
name(),
": StressDivergenceRZ is deprecated. \
66 The solid_mechanics module will be removed from MOOSE on July 31, 2020. \
67 Please update your input files to utilize the tensor_mechanics equivalents of \
68 models based on solid_mechanics. A detailed migration guide that was developed \
69 for BISON, but which is generally applicable to any MOOSE model is available at: \
70 https://mooseframework.org/bison/tutorials/mechanics_conversion/overview.html");
76 prepareVectorTag(_assembly, _var.number());
82 for (_i = 0; _i < _test.size(); _i++)
86 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
90 (_grad_test[_i][_qp](
_component) + _test[_i][_qp] / _q_point[_qp](0)) * _JxW[_qp] *
94 _grad_test[_i][_qp](
_component) * _JxW[_qp] * _coord[_qp];
100 precalculateResidual();
101 for (_i = 0; _i < _test.size(); _i++)
102 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
105 accumulateTaggedLocalResidual();
109 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
110 for (
const auto & var : _save_in)
111 var->sys().solution().add_vector(_local_re, var->dofIndices());
121 div = _grad_test[_i][_qp](0) *
_stress[_qp].xx() +
123 +_test[_i][_qp] / _q_point[_qp](0) *
_stress[_qp].zz() +
124 +_grad_test[_i][_qp](1) *
_stress[_qp].xy();
128 div += (
_avg_grad_test[_i][0] - _grad_test[_i][_qp](0) - _test[_i][_qp] / _q_point[_qp](0)) *
135 _grad_test[_i][_qp](1) *
_stress[_qp].yy() +
137 _grad_test[_i][_qp](0) *
_stress[_qp].xy();
145 mooseError(
"Invalid component");
154 prepareMatrixTag(_assembly, _var.number(), _var.number());
160 for (_i = 0; _i < _test.size(); _i++)
164 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
168 (_grad_test[_i][_qp](
_component) + _test[_i][_qp] / _q_point[_qp](0)) * _JxW[_qp] *
172 _grad_test[_i][_qp](
_component) * _JxW[_qp] * _coord[_qp];
178 for (_i = 0; _i < _phi.size(); _i++)
184 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
188 (_grad_phi[_i][_qp](
component) + _phi[_i][_qp] / _q_point[_qp](0)) * _JxW[_qp] *
199 for (_i = 0; _i < _test.size(); _i++)
200 for (_j = 0; _j < _phi.size(); _j++)
201 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
204 accumulateTaggedLocalMatrix();
206 if (_has_diag_save_in)
208 unsigned int rows = _local_ke.m();
209 DenseVector<Number> diag(rows);
210 for (
unsigned int i = 0; i < rows; i++)
211 diag(i) = _local_ke(i, i);
213 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
214 for (
const auto & var : _diag_save_in)
215 var->sys().solution().add_vector(diag, var->dofIndices());
232 test.
xx() = _grad_test[_i][_qp](0);
233 test.
xy() = 0.5 * _grad_test[_i][_qp](1);
234 test.
zz() = _test[_i][_qp] / _q_point[_qp](0);
238 test.
xy() = 0.5 * _grad_test[_i][_qp](0);
239 test.
yy() = _grad_test[_i][_qp](1);
243 phi.
xx() = _grad_phi[_j][_qp](0);
244 phi.
xy() = 0.5 * _grad_phi[_j][_qp](1);
245 phi.
zz() = _phi[_j][_qp] / _q_point[_qp](0);
249 phi.
xy() = 0.5 * _grad_phi[_j][_qp](0);
250 phi.
yy() = _grad_phi[_j][_qp](1);
264 new_test(0) = _grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0);
265 new_test(1) = _grad_test[_i][_qp](1);
266 new_phi(0) = _grad_phi[_j][_qp](0) + _phi[_j][_qp] / _q_point[_qp](0);
267 new_phi(1) = _grad_phi[_j][_qp](1);
275 if (ivar == 0 && jvar == 0)
277 (sum_3x1(0) * test.
xx() + sum_3x1(2) * test.
zz()) * (
_avg_grad_phi[_j][0] - new_phi(0));
278 else if (ivar == 0 && jvar == 1)
280 (sum_3x1(0) * test.
xx() + sum_3x1(2) * test.
zz()) * (
_avg_grad_phi[_j][1] - new_phi(1));
281 else if (ivar == 1 && jvar == 0)
293 return val / 3.0 + first_term;
299 size_t jvar_num = jvar.number();
300 if (jvar_num == _var.number())
306 auto phi_size = _sys.getVariable(_tid, jvar.number()).dofIndices().size();
312 for (_i = 0; _i < _test.size(); _i++)
316 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
320 (_grad_test[_i][_qp](
_component) + _test[_i][_qp] / _q_point[_qp](0)) * _JxW[_qp] *
324 _grad_test[_i][_qp](
_component) * _JxW[_qp] * _coord[_qp];
330 for (_i = 0; _i < phi_size; _i++)
336 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
340 (_grad_phi[_i][_qp](
component) + _phi[_i][_qp] / _q_point[_qp](0)) * _JxW[_qp] *
344 _grad_phi[_i][_qp](
component) * _JxW[_qp] * _coord[_qp];
352 prepareMatrixTag(_assembly, _var.number(), jvar_num);
354 for (_i = 0; _i < _test.size(); _i++)
355 for (_j = 0; _j < phi_size; _j++)
356 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
359 accumulateTaggedLocalMatrix();
380 test.
xx() = _grad_test[_i][_qp](0);
381 test.
xy() = 0.5 * _grad_test[_i][_qp](1);
382 test.
zz() = _test[_i][_qp] / _q_point[_qp](0);
386 test.
xy() = 0.5 * _grad_test[_i][_qp](0);
387 test.
yy() = _grad_test[_i][_qp](1);
389 return _d_stress_dT[_qp].doubleContraction(test) * _phi[_j][_qp];