www.mooseframework.org
ADComputeSmallStrain.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 
10 #include "ADComputeSmallStrain.h"
11 #include "RankTwoTensor.h"
12 #include "SymmetricRankTwoTensor.h"
13 #include "libmesh/quadrature.h"
14 
15 registerMooseObject("SolidMechanicsApp", ADComputeSmallStrain);
16 registerMooseObject("SolidMechanicsApp", ADSymmetricSmallStrain);
17 
18 template <typename R2>
21 {
23  params.addClassDescription("Compute a small strain.");
24  return params;
25 }
26 
27 template <typename R2>
29  : ADComputeStrainBaseTempl<R2>(parameters)
30 {
31 }
32 
33 template <typename R2>
34 void
36 {
37  ADReal volumetric_strain = 0.0;
38 
39  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
40  {
41  // strain = (grad_disp + grad_disp^R2)/2
43  (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
44 
45  if (_volumetric_locking_correction)
46  volumetric_strain += _total_strain[_qp].trace() * _JxW[_qp] * _coord[_qp];
47  }
48 
49  if (_volumetric_locking_correction)
50  volumetric_strain /= _current_elem_volume;
51 
52  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
53  {
54  if (_volumetric_locking_correction)
55  {
56  ADReal correction = (volumetric_strain - _total_strain[_qp].trace()) / 3.0;
57  _total_strain[_qp].addIa(correction);
58  }
59 
60  if (_global_strain)
61  _total_strain[_qp] += (*_global_strain)[_qp];
62 
63  _mechanical_strain[_qp] = _total_strain[_qp];
64 
65  // Remove the Eigen strain
66  for (auto es : _eigenstrains)
67  _mechanical_strain[_qp] -= (*es)[_qp];
68  }
69 }
70 
static InputParameters validParams()
ADComputeStrainBase is the base class for strain tensors.
static InputParameters validParams()
ADComputeSmallStrainTempl(const InputParameters &parameters)
ADComputeSmallStrain defines a strain tensor, assuming small strains.
registerMooseObject("SolidMechanicsApp", ADComputeSmallStrain)
void addClassDescription(const std::string &doc_string)
virtual void computeProperties() override