https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADStressDivergenceShell.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
12// MOOSE includes
13#include "Assembly.h"
14#include "Material.h"
15#include "MooseVariable.h"
16#include "SystemBase.h"
17#include "RankTwoTensor.h"
18#include "NonlinearSystem.h"
19#include "MooseMesh.h"
20#include "ArbitraryQuadrature.h"
21#include "DenseMatrix.h"
22
23#include "libmesh/quadrature.h"
24#include "libmesh/enum_quadrature_type.h"
25#include "libmesh/string_to_enum.h"
26
28
31{
33 params.addClassDescription("Quasi-static stress divergence kernel for Shell element");
34 params.addRequiredRangeCheckedParam<unsigned int>(
35 "component",
36 "component < 5",
37 "An integer corresponding to the degree of freedom "
38 "this kernel acts on. (0 for disp_x, "
39 "1 for disp_y, 2 for disp_z, 3 for rot_x, 4 for rot_y)");
40 params.addRequiredParam<std::string>("through_thickness_order",
41 "Quadrature order in out of plane direction");
42 params.addParam<bool>(
43 "large_strain", false, "Set to true to turn on finite strain calculations.");
44 params.set<bool>("use_displaced_mesh") = false;
45 return params;
46}
47
49 : ADKernel(parameters),
50 _component(getParam<unsigned int>("component")),
51 _large_strain(getParam<bool>("large_strain"))
52{
53 _t_qrule = std::make_unique<libMesh::QGauss>(
54 1, Utility::string_to_enum<Order>(getParam<std::string>("through_thickness_order")));
55 _t_weights = _t_qrule->get_weights();
56
57 _stress.resize(_t_weights.size());
58 _stress_old.resize(_t_weights.size());
59 _B_mat.resize(_t_weights.size());
60 if (_large_strain)
61 _B_nl.resize(_t_weights.size());
62 _J_map.resize(_t_weights.size());
63
64 for (unsigned int i = 0; i < _t_weights.size(); ++i)
65 {
66 _stress[i] = &getADMaterialProperty<RankTwoTensor>("stress_t_points_" + std::to_string(i));
67 _stress_old[i] =
68 &getMaterialPropertyOldByName<RankTwoTensor>("stress_t_points_" + std::to_string(i));
69 _B_mat[i] = &getADMaterialProperty<DenseMatrix<Real>>("B_t_points_" + std::to_string(i));
70 if (_large_strain)
71 _B_nl[i] = &getADMaterialProperty<DenseMatrix<Real>>("B_nl_t_points_" + std::to_string(i));
72
73 _J_map[i] = &getADMaterialProperty<Real>("J_mapping_t_points_" + std::to_string(i));
74 }
75}
76
79{
80 _q_weights = _qrule->get_weights();
81 ADReal residual = 0.0;
82 ADReal residual1 = 0.0;
83 for (_qp_z = 0; _qp_z < _t_weights.size(); ++_qp_z)
84 {
85 residual1 = (*_stress[_qp_z])[_qp](0, 0) * (*_B_mat[_qp_z])[_qp](0, _i + _component * 4) +
86 (*_stress[_qp_z])[_qp](1, 1) * (*_B_mat[_qp_z])[_qp](1, _i + _component * 4) +
87 2.0 * (*_stress[_qp_z])[_qp](0, 1) * (*_B_mat[_qp_z])[_qp](2, _i + _component * 4) +
88 2.0 * (*_stress[_qp_z])[_qp](0, 2) * (*_B_mat[_qp_z])[_qp](3, _i + _component * 4) +
89 2.0 * (*_stress[_qp_z])[_qp](1, 2) * (*_B_mat[_qp_z])[_qp](4, _i + _component * 4);
90
91 if (_large_strain)
92 residual1 +=
93 ((*_stress_old[_qp_z])[_qp](0, 0) * (*_B_nl[_qp_z])[_qp](0, _i + _component * 4) +
94 (*_stress_old[_qp_z])[_qp](1, 1) * (*_B_nl[_qp_z])[_qp](1, _i + _component * 4) +
95 2.0 * (*_stress_old[_qp_z])[_qp](0, 1) * (*_B_nl[_qp_z])[_qp](2, _i + _component * 4) +
96 2.0 * (*_stress_old[_qp_z])[_qp](0, 2) * (*_B_nl[_qp_z])[_qp](3, _i + _component * 4) +
97 2.0 * (*_stress_old[_qp_z])[_qp](1, 2) * (*_B_nl[_qp_z])[_qp](4, _i + _component * 4));
98
99 residual += residual1 * (*_J_map[_qp_z])[_qp] * _q_weights[_qp] * _t_weights[_qp_z] /
100 (_ad_JxW[_qp] * _ad_coord[_qp]);
101 }
102 return residual;
103}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("SolidMechanicsApp", ADStressDivergenceShell)
void ErrorVector unsigned int
static InputParameters validParams()
const MooseArray< ADReal > & _ad_JxW
const MooseArray< ADReal > & _ad_coord
ADStressDivergenceShell computes the stress divergence term for shell elements.
std::vector< const ADMaterialProperty< Real > * > _J_map
std::vector< const ADMaterialProperty< DenseMatrix< Real > > * > _B_mat
static InputParameters validParams()
std::vector< const ADMaterialProperty< DenseMatrix< Real > > * > _B_nl
std::vector< const MaterialProperty< RankTwoTensor > * > _stress_old
virtual ADReal computeQpResidual() override
unsigned int _qp_z
qp index in out of plane direction
ADStressDivergenceShell(const InputParameters &parameters)
const unsigned int _component
An integer corresponding to the direction this kernel acts in.
std::vector< Real > _t_weights
Quadrature weights in the out of plane direction in isoparametric coordinate system.
std::vector< Real > _q_weights
Qrule weights in isoparametric coordinate system.
std::unique_ptr< libMesh::QGauss > _t_qrule
Quadrature rule in the out of plane direction.
std::vector< const ADMaterialProperty< RankTwoTensor > * > _stress
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, 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