https://mooseframework.inl.gov
Compute2DFiniteStrain.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 "Compute2DFiniteStrain.h"
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  : ComputeFiniteStrain(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] = &_zero;
41  _grad_disp[i] = &_grad_zero;
42  }
43  else
44  {
45  _disp[i] = &coupledValue("displacements", i);
46  _grad_disp[i] = &coupledGradient("displacements", i);
47  }
48 
50  _grad_disp_old[i] = &coupledGradientOld("displacements", i);
51  else
53  }
54 }
55 
56 void
58 {
59  RankTwoTensor ave_Fhat;
60  Real ave_dfgrd_det = 0.0;
61 
62  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
63  {
64  // Deformation gradient calculation for 2D problems
66  (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
67 
68  // Old Deformation gradient
70  (*_grad_disp_old[0])[_qp], (*_grad_disp_old[1])[_qp], (*_grad_disp_old[2])[_qp]);
71 
72  // Compute the displacement gradient for the out of plane direction for plane strain,
73  // generalized plane strain, or axisymmetric problems
74 
77 
78  // Gauss point deformation gradient
80  _deformation_gradient[_qp].addIa(1.0);
81 
82  // deformation gradient midpoint
83  if (_use_hw)
84  {
85  (*_def_grad_mid)[_qp].setToIdentity();
86  (*_def_grad_mid)[_qp] += 0.5 * (A + Fbar);
87  }
88 
89  A -= Fbar; // very nearly A = gradU - gradUold
90 
91  // _f_bar = dDU/dX_o
92  if (_use_hw)
93  (*_f_bar)[_qp] = A;
94 
95  Fbar.addIa(1.0); // Fbar = ( I + gradUold)
96 
97  // Incremental deformation gradient _Fhat = I + A Fbar^-1
98  _Fhat[_qp] = A * Fbar.inverse();
99  _Fhat[_qp].addIa(1.0);
100 
102  {
103  // Calculate average _Fhat for volumetric locking correction
104  ave_Fhat += _Fhat[_qp] * _JxW[_qp] * _coord[_qp];
105 
106  // Average deformation gradient
107  ave_dfgrd_det += _deformation_gradient[_qp].det() * _JxW[_qp] * _coord[_qp];
108  }
109  }
111  {
112  // needed for volumetric locking correction
113  ave_Fhat /= _current_elem_volume;
114  // average deformation gradient
115  ave_dfgrd_det /= _current_elem_volume;
116  }
117  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
118  {
120  {
121  // Finalize volumetric locking correction
122  _Fhat[_qp] *= std::cbrt(ave_Fhat.det() / _Fhat[_qp].det());
123  // Volumetric locking correction
124  _deformation_gradient[_qp] *= std::cbrt(ave_dfgrd_det / _deformation_gradient[_qp].det());
125  }
126 
127  computeQpStrain();
128  }
129 }
130 
131 void
133 {
134  if (_out_of_plane_direction != 2 && _ndisp != 3)
135  mooseError("For 2D simulations where the out-of-plane direction is x or y the number of "
136  "supplied displacements must be three.");
137  else if (_out_of_plane_direction == 2 && _ndisp != 2)
138  mooseError("For 2D simulations where the out-of-plane direction is z the number of supplied "
139  "displacements must be two.");
140 }
virtual void displacementIntegrityCheck() override
static InputParameters validParams()
static InputParameters validParams()
const Real & _current_elem_volume
Compute2DFiniteStrain(const InputParameters &parameters)
MaterialProperty< RankTwoTensor > & _deformation_gradient
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< Real > & _JxW
std::vector< const VariableValue * > _disp
Displacement variables.
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0) const
virtual void computeQpStrain()
static RankTwoTensorTempl initializeFromRows(const libMesh::TypeVector< Real > &row0, const libMesh::TypeVector< Real > &row1, const libMesh::TypeVector< Real > &row2)
virtual const VariableValue & coupledValue(const std::string &var_name, unsigned int comp=0) const
const bool _use_hw
Flag if using HughesWinget method.
virtual const VariableGradient & coupledGradientOld(const std::string &var_name, unsigned int comp=0) const
unsigned int _ndisp
Coupled displacement variables.
virtual Real computeOutOfPlaneGradDisp()=0
Computes the current out-of-plane component of the displacement gradient; as a virtual function...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ComputeFiniteStrain defines a strain increment and rotation increment, for finite strains...
std::vector< const VariableGradient * > _grad_disp_old
virtual Real computeOutOfPlaneGradDispOld()=0
Computes the old out-of-plane component of the displacement gradient; as a virtual function...
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const bool _volumetric_locking_correction
virtual bool isTransient() const override
const unsigned int _out_of_plane_direction
const MooseArray< Real > & _coord
std::vector< RankTwoTensor > _Fhat
Incremental deformation gradient.
virtual void computeProperties() override
std::vector< const VariableGradient * > _grad_disp
Gradient of displacements.