https://mooseframework.inl.gov
ADComputeShellStress.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 
10 #include "ADComputeShellStress.h"
11 #include "RankTwoTensor.h"
12 #include "RankFourTensor.h"
14 
15 #include "libmesh/quadrature.h"
16 #include "libmesh/utility.h"
17 #include "libmesh/enum_quadrature_type.h"
18 #include "libmesh/fe_type.h"
19 #include "libmesh/string_to_enum.h"
20 #include "libmesh/quadrature_gauss.h"
21 
22 registerMooseObject("SolidMechanicsApp", ADComputeShellStress);
23 
26 {
28  params.addClassDescription("Compute in-plane stress using elasticity for shell");
29  params.addRequiredParam<std::string>("through_thickness_order",
30  "Quadrature order in out of plane direction");
31  return params;
32 }
33 
35  : Material(parameters)
36 {
37  // get number of quadrature points along thickness based on order
38  std::unique_ptr<libMesh::QGauss> t_qrule = std::make_unique<libMesh::QGauss>(
39  1, Utility::string_to_enum<Order>(getParam<std::string>("through_thickness_order")));
40  _t_points = t_qrule->get_points();
41  _elasticity_tensor.resize(_t_points.size());
42  _stress.resize(_t_points.size());
43  _stress_old.resize(_t_points.size());
44  _strain_increment.resize(_t_points.size());
47  _global_stress.resize(_t_points.size());
48  _local_stress.resize(_t_points.size());
49  for (unsigned int t = 0; t < _t_points.size(); ++t)
50  {
52  &getADMaterialProperty<RankFourTensor>("elasticity_tensor_t_points_" + std::to_string(t));
53  _stress[t] = &declareADProperty<RankTwoTensor>("stress_t_points_" + std::to_string(t));
54  _stress_old[t] =
55  &getMaterialPropertyOldByName<RankTwoTensor>("stress_t_points_" + std::to_string(t));
57  &getADMaterialProperty<RankTwoTensor>("strain_increment_t_points_" + std::to_string(t));
58  // rotation matrix and stress for output purposes only
60  &getMaterialProperty<RankTwoTensor>("local_transformation_t_points_" + std::to_string(t));
61  _covariant_transformation_matrix[t] = &getMaterialProperty<RankTwoTensor>(
62  "covariant_transformation_t_points_" + std::to_string(t));
63  _global_stress[t] =
64  &declareProperty<RankTwoTensor>("global_stress_t_points_" + std::to_string(t));
65  _local_stress[t] =
66  &declareProperty<RankTwoTensor>("local_stress_t_points_" + std::to_string(t));
67  }
68 }
69 
70 void
72 {
73  // initialize stress tensor to zero
74  for (unsigned int i = 0; i < _t_points.size(); ++i)
75  (*_stress[i])[_qp].zero();
76 }
77 
78 void
80 {
81  for (unsigned int i = 0; i < _t_points.size(); ++i)
82  {
83  (*_stress[i])[_qp] =
84  (*_stress_old[i])[_qp] + (*_elasticity_tensor[i])[_qp] * (*_strain_increment[i])[_qp];
85 
86  for (unsigned int ii = 0; ii < 3; ++ii)
87  for (unsigned int jj = 0; jj < 3; ++jj)
88  _unrotated_stress(ii, jj) = MetaPhysicL::raw_value((*_stress[i])[_qp](ii, jj));
89  (*_global_stress[i])[_qp] = (*_covariant_transformation_matrix[i])[_qp].transpose() *
93  }
94 }
std::vector< const ADMaterialProperty< RankTwoTensor > * > _strain_increment
Material property for strain increment.
std::vector< const MaterialProperty< RankTwoTensor > * > _covariant_transformation_matrix
Covariant base vector matrix material property to transform stress.
std::vector< Point > _t_points
Quadrature points along thickness.
std::vector< const ADMaterialProperty< RankFourTensor > * > _elasticity_tensor
Material property for elasticity tensor.
auto raw_value(const Eigen::Map< T > &in)
std::vector< MaterialProperty< RankTwoTensor > * > _local_stress
local stress tensor material property
ADComputeShellStress(const InputParameters &parameters)
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::vector< const MaterialProperty< RankTwoTensor > * > _stress_old
Material property for old stress.
unsigned int _qp
std::vector< const MaterialProperty< RankTwoTensor > * > _local_transformation_matrix
Transformation matrix to map the global stress to the element&#39;s local coordinate. ...
static InputParameters validParams()
virtual void initQpStatefulProperties() override
static InputParameters validParams()
RankTwoTensorTempl< Real > transpose() const
registerMooseObject("SolidMechanicsApp", ADComputeShellStress)
virtual void computeQpProperties() override
void addClassDescription(const std::string &doc_string)
RankTwoTensor _unrotated_stress
Real value of stress in the local coordinate system.
std::vector< MaterialProperty< RankTwoTensor > * > _global_stress
Global stress tensor material property.
std::vector< ADMaterialProperty< RankTwoTensor > * > _stress
Material property for current stress.