www.mooseframework.org
ADStressDivergenceRZTensors.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "Assembly.h"
12 #include "RankTwoTensor.h"
13 #include "ElasticityTensorTools.h"
14 #include "libmesh/quadrature.h"
15 
17 
20 {
22  params.addClassDescription(
23  "Calculate stress divergence for an axisymmetric problem in cylindrical coordinates.");
24  params.addRequiredRangeCheckedParam<unsigned int>(
25  "component",
26  "component < 2",
27  "An integer corresponding to the direction the variable this kernel acts in. (0 "
28  "refers to the radial and 1 to the axial displacement.)");
29  params.set<bool>("use_displaced_mesh") = true;
30  return params;
31 }
32 
34  : ADStressDivergenceTensors(parameters)
35 {
36 }
37 
38 void
40 {
42  mooseError("The coordinate system in the Problem block must be set to RZ for axisymmetric "
43  "geometries.");
44 }
45 
46 ADReal
48 {
49  ADReal div = 0.0;
50  if (_component == 0)
51  {
52  div = _grad_test[_i][_qp](0) * _stress[_qp](0, 0) +
53  (_test[_i][_qp] / _ad_q_point[_qp](0)) * _stress[_qp](2, 2) +
54  _grad_test[_i][_qp](1) * _stress[_qp](0, 1); // stress_{rz}
55 
56  // volumetric locking correction
58  div += (_avg_grad_test[_i] - _grad_test[_i][_qp](0) - _test[_i][_qp] / _ad_q_point[_qp](0)) *
59  (_stress[_qp].trace()) / 3.0;
60  }
61  else if (_component == 1)
62  {
63  div = _grad_test[_i][_qp](1) * _stress[_qp](1, 1) +
64  _grad_test[_i][_qp](0) * _stress[_qp](1, 0); // stress_{zr}
65 
66  // volumetric locking correction
68  div += (_avg_grad_test[_i] - _grad_test[_i][_qp](1)) * (_stress[_qp].trace()) / 3.0;
69  }
70  else
71  mooseError("Invalid component for this AxisymmetricRZ problem.");
72 
73  return div;
74 }
75 
76 void
78 {
80  return;
81 
82  ADReal ad_current_elem_volume = 0.0;
83  for (unsigned int qp = 0; qp < _qrule->n_points(); qp++)
84  ad_current_elem_volume += _ad_JxW[qp] * _ad_coord[qp];
85 
86  // calculate volume averaged value of shape function derivative
87  _avg_grad_test.resize(_test.size());
88  for (_i = 0; _i < _test.size(); ++_i)
89  {
90  _avg_grad_test[_i] = 0.0;
91  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
92  {
93  if (_component == 0)
94  _avg_grad_test[_i] +=
97  else
99  }
100  _avg_grad_test[_i] /= ad_current_elem_volume;
101  }
102 }
std::vector< ADReal > _avg_grad_test
Gradient of test function averaged over the element. Used in volumetric locking correction calculatio...
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
const ADTemplateVariableTestGradient< T > & _grad_test
const unsigned int _component
An integer corresponding to the direction this kernel acts in.
static InputParameters validParams()
Moose::CoordinateSystemType getBlockCoordSystem()
T & set(const std::string &name, bool quiet_mode=false)
const ADMaterialProperty< R2 > & _stress
The stress tensor that the divergence operator operates on.
const ADTemplateVariableTestValue< T > & _test
const QBase *const & _qrule
const MooseArray< ADPoint > & _ad_q_point
unsigned int _i
DualReal ADReal
const MooseArray< ADReal > & _ad_JxW
registerMooseObject("SolidMechanicsApp", ADStressDivergenceRZTensors)
const bool _volumetric_locking_correction
Flag for volumetric locking correction.
ADStressDivergenceRZTensors is the automatic differentiation version of StressDivergenceRZTensors.
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
ADStressDivergenceTensors is the automatic differentiation version of StressDivergenceTensors.
const MooseArray< ADReal > & _ad_coord
ADStressDivergenceRZTensors(const InputParameters &parameters)
unsigned int _qp