www.mooseframework.org
ADCompute2DFiniteStrain.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 
11 
12 #include "libmesh/quadrature.h"
13 
16 {
18  params.addClassDescription(
19  "Compute a strain increment and rotation increment for finite strains in 2D geometries.");
20 
21  MooseEnum outOfPlaneDirection("x y z", "z");
22  params.addParam<MooseEnum>(
23  "out_of_plane_direction", outOfPlaneDirection, "The direction of the out-of-plane strain.");
24  return params;
25 }
26 
28  : ADComputeFiniteStrain(parameters),
29  _out_of_plane_direction(getParam<MooseEnum>("out_of_plane_direction"))
30 {
31 }
32 
33 void
35 {
36  for (unsigned int i = 0; i < 3; ++i)
37  {
38  if (_out_of_plane_direction == i)
39  {
40  _disp[i] = &_ad_zero;
42  }
43  else
44  {
45  _disp[i] = &adCoupledValue("displacements", i);
46  _grad_disp[i] = &adCoupledGradient("displacements", i);
47  }
48 
50  _grad_disp_old[i] = &coupledGradientOld("displacements", i);
51  else
53  }
54 }
55 
56 void
58 {
59  ADRankTwoTensor ave_Fhat;
60 
61  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
62  {
63  // Deformation gradient calculation for 2D problems
65  (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
66 
67  // Old Deformation gradient
69  (*_grad_disp_old[0])[_qp], (*_grad_disp_old[1])[_qp], (*_grad_disp_old[2])[_qp]);
70 
71  // Compute the displacement gradient for the out of plane direction for plane strain,
72  // generalized plane strain, or axisymmetric problems
75 
76  A -= Fbar; // very nearly A = gradU - gradUold
77 
78  Fbar.addIa(1.0); // Fbar = ( I + gradUold)
79 
80  // Incremental deformation gradient _Fhat = I + A Fbar^-1
81  _Fhat[_qp] = A * Fbar.inverse();
82  _Fhat[_qp].addIa(1.0);
83 
84  // Calculate average _Fhat for volumetric locking correction
86  ave_Fhat += _Fhat[_qp] * _JxW[_qp] * _coord[_qp];
87  }
88 
90  ave_Fhat /= _current_elem_volume;
91 
92  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
93  {
94  // Finalize volumetric locking correction
96  _Fhat[_qp] *= std::cbrt(ave_Fhat.det() / _Fhat[_qp].det());
97 
99  }
100 }
101 
102 void
104 {
105  if (_out_of_plane_direction != 2 && _ndisp != 3)
106  mooseError("For 2D simulations where the out-of-plane direction is x or y the number of "
107  "supplied displacements must be three.");
108  else if (_out_of_plane_direction == 2 && _ndisp != 2)
109  mooseError("For 2D simulations where the out-of-plane direction is z the number of supplied "
110  "displacements must be two.");
111 }
FEProblemBase & _fe_problem
const QBase *const & _qrule
const unsigned int _ndisp
Coupled displacement variables.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const VariableGradient & _grad_zero
const MooseArray< ADRealVectorValue > & _ad_grad_zero
virtual void computeProperties() override
const ADVariableGradient & adCoupledGradient(const std::string &var_name, unsigned int comp=0) const
const ADVariableValue & adCoupledValue(const std::string &var_name, unsigned int comp=0) const
const MooseArray< Real > & _JxW
virtual void displacementIntegrityCheck() override
const MooseArray< DualReal > & _ad_zero
static RankTwoTensorTempl initializeFromRows(const libMesh::TypeVector< ADReal > &row0, const libMesh::TypeVector< ADReal > &row1, const libMesh::TypeVector< ADReal > &row2)
unsigned int _qp
virtual Real computeOutOfPlaneGradDispOld()=0
Computes the old out-of-plane component of the displacement gradient; as a virtual function...
virtual const VariableGradient & coupledGradientOld(const std::string &var_name, unsigned int comp=0) const
std::vector< const ADVariableGradient * > _grad_disp
Gradient of displacements.
ADComputeFiniteStrain defines a strain increment and rotation increment, for finite strains...
virtual ADReal computeOutOfPlaneGradDisp()=0
Computes the current out-of-plane component of the displacement gradient; as a virtual function...
std::vector< ADRankTwoTensor > _Fhat
const unsigned int _out_of_plane_direction
static InputParameters validParams()
std::vector< const VariableGradient * > _grad_disp_old
void mooseError(Args &&... args) const
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
std::vector< const ADVariableValue * > _disp
Displacement variables.
ADCompute2DFiniteStrain(const InputParameters &parameters)
virtual bool isTransient() const override
const MooseArray< Real > & _coord