www.mooseframework.org
ADStressDivergenceShell.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 // MOOSE includes
11 #include "Assembly.h"
12 #include "Material.h"
13 #include "MooseVariable.h"
14 #include "SystemBase.h"
15 #include "RankTwoTensor.h"
16 #include "NonlinearSystem.h"
17 #include "MooseMesh.h"
18 #include "ArbitraryQuadrature.h"
19 #include "DenseMatrix.h"
20 
21 #include "libmesh/quadrature.h"
22 #include "libmesh/enum_quadrature_type.h"
23 #include "libmesh/string_to_enum.h"
24 
25 registerADMooseObject("TensorMechanicsApp", ADStressDivergenceShell);
26 
29  ADKernel,
30  params.addClassDescription("Quasi-static stress divergence kernel for Shell element");
31  params.addRequiredRangeCheckedParam<unsigned int>(
32  "component",
33  "component < 5",
34  "An integer corresponding to the degree of freedom "
35  "this kernel acts on. (0 for disp_x, "
36  "1 for disp_y, 2 for disp_z, 3 for rot_x, 4 for rot_y)");
37  params.addRequiredParam<std::string>("through_thickness_order",
38  "Quadrature order in out of plane direction");
39  params.addParam<bool>("large_strain",
40  false,
41  "Set to true to turn on finite strain calculations.");
42  params.set<bool>("use_displaced_mesh") = false;);
43 
44 template <ComputeStage compute_stage>
46  : ADKernel<compute_stage>(parameters),
47  _component(getParam<unsigned int>("component")),
48  _large_strain(getParam<bool>("large_strain"))
49 {
50  _t_qrule = libmesh_make_unique<QGauss>(
51  1, Utility::string_to_enum<Order>(getParam<std::string>("through_thickness_order")));
52  _t_weights = _t_qrule->get_weights();
53 
54  _stress.resize(_t_weights.size());
55  _stress_old.resize(_t_weights.size());
56  _B_mat.resize(_t_weights.size());
57  if (_large_strain)
58  _B_nl.resize(_t_weights.size());
59  _J_map.resize(_t_weights.size());
60 
61  for (unsigned int i = 0; i < _t_weights.size(); ++i)
62  {
63  _stress[i] = &getADMaterialProperty<RankTwoTensor>("stress_t_points_" + std::to_string(i));
64  _stress_old[i] =
65  &getMaterialPropertyOldByName<RankTwoTensor>("stress_t_points_" + std::to_string(i));
66  _B_mat[i] = &getADMaterialProperty<DenseMatrix<Real>>("B_t_points_" + std::to_string(i));
67  if (_large_strain)
68  _B_nl[i] = &getADMaterialProperty<DenseMatrix<Real>>("B_nl_t_points_" + std::to_string(i));
69 
70  _J_map[i] = &getADMaterialProperty<Real>("J_mapping_t_points_" + std::to_string(i));
71  }
72 }
73 
74 template <ComputeStage compute_stage>
75 ADReal
77 {
78  _q_weights = _qrule->get_weights();
79  ADReal residual = 0.0;
80  ADReal residual1 = 0.0;
81  for (_qp_z = 0; _qp_z < _t_weights.size(); ++_qp_z)
82  {
83  residual1 = (*_stress[_qp_z])[_qp](0, 0) * (*_B_mat[_qp_z])[_qp](0, _i + _component * 4) +
84  (*_stress[_qp_z])[_qp](1, 1) * (*_B_mat[_qp_z])[_qp](1, _i + _component * 4) +
85  2.0 * (*_stress[_qp_z])[_qp](0, 1) * (*_B_mat[_qp_z])[_qp](2, _i + _component * 4) +
86  2.0 * (*_stress[_qp_z])[_qp](0, 2) * (*_B_mat[_qp_z])[_qp](3, _i + _component * 4) +
87  2.0 * (*_stress[_qp_z])[_qp](1, 2) * (*_B_mat[_qp_z])[_qp](4, _i + _component * 4);
88 
89  if (_large_strain)
90  residual1 +=
91  ((*_stress_old[_qp_z])[_qp](0, 0) * (*_B_nl[_qp_z])[_qp](0, _i + _component * 4) +
92  (*_stress_old[_qp_z])[_qp](1, 1) * (*_B_nl[_qp_z])[_qp](1, _i + _component * 4) +
93  2.0 * (*_stress_old[_qp_z])[_qp](0, 1) * (*_B_nl[_qp_z])[_qp](2, _i + _component * 4) +
94  2.0 * (*_stress_old[_qp_z])[_qp](0, 2) * (*_B_nl[_qp_z])[_qp](3, _i + _component * 4) +
95  2.0 * (*_stress_old[_qp_z])[_qp](1, 2) * (*_B_nl[_qp_z])[_qp](4, _i + _component * 4));
96 
97  residual += residual1 * (*_J_map[_qp_z])[_qp] * _q_weights[_qp] * _t_weights[_qp_z] /
98  (_ad_JxW[_qp] * _ad_coord[_qp]);
99  }
100  return residual;
101 }
ADStressDivergenceShell::_stress_old
std::vector< const MaterialProperty< RankTwoTensor > * > _stress_old
Definition: ADStressDivergenceShell.h:53
ADStressDivergenceShell::computeQpResidual
virtual ADReal computeQpResidual() override
Definition: ADStressDivergenceShell.C:76
ADStressDivergenceShell
ADStressDivergenceShell computes the stress divergence term for shell elements.
Definition: ADStressDivergenceShell.h:19
ADStressDivergenceShell::_large_strain
const bool _large_strain
Definition: ADStressDivergenceShell.h:50
ADStressDivergenceShell::_J_map
std::vector< const ADMaterialProperty(Real) * > _J_map
Definition: ADStressDivergenceShell.h:56
ADStressDivergenceShell.h
registerADMooseObject
registerADMooseObject("TensorMechanicsApp", ADStressDivergenceShell)
ADStressDivergenceShell::_t_weights
std::vector< Real > _t_weights
Quadrature weights in the out of plane direction in isoparametric coordinate system.
Definition: ADStressDivergenceShell.h:62
defineADValidParams
defineADValidParams(ADStressDivergenceShell, ADKernel, params.addClassDescription("Quasi-static stress divergence kernel for Shell element");params.addRequiredRangeCheckedParam< unsigned int >("component", "component < 5", "An integer corresponding to the degree of freedom " "this kernel acts on. (0 for disp_x, " "1 for disp_y, 2 for disp_z, 3 for rot_x, 4 for rot_y)");params.addRequiredParam< std::string >("through_thickness_order", "Quadrature order in out of plane direction");params.addParam< bool >("large_strain", false, "Set to true to turn on finite strain calculations.");params.set< bool >("use_displaced_mesh")=false;)
ADStressDivergenceShell::ADStressDivergenceShell
ADStressDivergenceShell(const InputParameters &parameters)
Definition: ADStressDivergenceShell.C:45
ADStressDivergenceShell::_t_qrule
std::unique_ptr< QGauss > _t_qrule
Quadrature rule in the out of plane direction.
Definition: ADStressDivergenceShell.h:59
ADStressDivergenceShell::_B_nl
std::vector< const ADMaterialProperty(DenseMatrix< Real >) * > _B_nl
Definition: ADStressDivergenceShell.h:55
ADStressDivergenceShell::_B_mat
std::vector< const ADMaterialProperty(DenseMatrix< Real >) * > _B_mat
Definition: ADStressDivergenceShell.h:54
ADStressDivergenceShell::_stress
std::vector< const ADMaterialProperty(RankTwoTensor) * > _stress
Definition: ADStressDivergenceShell.h:52