https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADStressDivergenceRZTensors.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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"
14#include "libmesh/quadrature.h"
15
17
20{
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
37
38void
40{
42 mooseError("The coordinate system in the Problem block must be set to RZ for axisymmetric "
43 "geometries.");
44}
45
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
76void
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
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)
97 else
99 }
100 _avg_grad_test[_i] /= ad_current_elem_volume;
101 }
102}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("SolidMechanicsApp", ADStressDivergenceRZTensors)
const MooseArray< ADPoint > & _ad_q_point
const ADTemplateVariableTestValue< T > & _test
const ADTemplateVariableTestGradient< T > & _grad_test
const MooseArray< ADReal > & _ad_JxW
const MooseArray< ADReal > & _ad_coord
ADStressDivergenceRZTensors is the automatic differentiation version of StressDivergenceRZTensors.
ADStressDivergenceRZTensors(const InputParameters &parameters)
ADStressDivergenceTensors is the automatic differentiation version of StressDivergenceTensors.
const unsigned int _component
An integer corresponding to the direction this kernel acts in.
std::vector< ADReal > _avg_grad_test
Gradient of test function averaged over the element. Used in volumetric locking correction calculatio...
const bool _volumetric_locking_correction
Flag for volumetric locking correction.
const ADMaterialProperty< R2 > & _stress
The stress tensor that the divergence operator operates on.
Moose::CoordinateSystemType getBlockCoordSystem()
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
unsigned int _qp
unsigned int _i
const QBase *const & _qrule
void resize(unsigned int size)
void mooseError(Args &&... args) const