https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADComputeFiniteStrain.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#include "RankTwoTensor.h"
12#include "RankFourTensor.h"
15
16#include "libmesh/quadrature.h"
17#include "libmesh/utility.h"
18
21
22template <typename R2, typename R4>
25{
26 return MooseEnum("TaylorExpansion EigenSolution", "TaylorExpansion");
27}
28
29template <typename R2, typename R4>
32{
35 "Compute a strain increment and rotation increment for finite strains.");
36 params.addParam<MooseEnum>("decomposition_method",
38 "Methods to calculate the strain and rotation increments");
39 return params;
40}
41
42template <typename R2, typename R4>
45 _Fhat(this->_fe_problem.getMaxQps()),
46 _decomposition_method(
47 this->template getParam<MooseEnum>("decomposition_method").template getEnum<DecompMethod>())
48{
49}
50
51template <typename R2, typename R4>
52void
54{
55 ADRankTwoTensor ave_Fhat;
56 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
57 {
58 // Deformation gradient
60 (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
61
62 // Old Deformation gradient
64 (*_grad_disp_old[0])[_qp], (*_grad_disp_old[1])[_qp], (*_grad_disp_old[2])[_qp]);
65
66 // A = gradU - gradUold
67 A -= Fbar;
68
69 // Fbar = ( I + gradUold)
70 Fbar.addIa(1.0);
71
72 // Incremental deformation gradient _Fhat = I + A Fbar^-1
73 _Fhat[_qp] = A * Fbar.inverse();
74 _Fhat[_qp].addIa(1.0);
75
76 // Calculate average _Fhat for volumetric locking correction
77 if (_volumetric_locking_correction)
78 ave_Fhat += _Fhat[_qp] * _JxW[_qp] * _coord[_qp];
79 }
80
81 if (_volumetric_locking_correction)
82 ave_Fhat /= _current_elem_volume;
83
84 const auto ave_Fhat_det = ave_Fhat.det();
85 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
86 {
87 // Finalize volumetric locking correction
88 if (_volumetric_locking_correction)
89 {
90 using std::cbrt;
91 _Fhat[_qp] *= cbrt(ave_Fhat_det / _Fhat[_qp].det());
92 }
93
94 computeQpStrain();
95 }
96}
97
98template <typename R2, typename R4>
99void
101{
102 ADR2 total_strain_increment;
103
104 // two ways to calculate these increments: TaylorExpansion(default) or EigenSolution
105 computeQpIncrements(total_strain_increment, _rotation_increment[_qp]);
106
107 _strain_increment[_qp] = total_strain_increment;
108
109 // Remove the eigenstrain increment
110 this->subtractEigenstrainIncrementFromStrain(_strain_increment[_qp]);
111
112 if (_dt > 0)
113 _strain_rate[_qp] = _strain_increment[_qp] / _dt;
114 else
115 _strain_rate[_qp].zero();
116
117 // Update strain in intermediate configuration
118 _mechanical_strain[_qp] = _mechanical_strain_old[_qp] + _strain_increment[_qp];
119 _total_strain[_qp] = _total_strain_old[_qp] + total_strain_increment;
120
121 // Rotate strain to current configuration
122 _mechanical_strain[_qp].rotate(_rotation_increment[_qp]);
123 _total_strain[_qp].rotate(_rotation_increment[_qp]);
124
125 if (_global_strain)
126 _total_strain[_qp] += (*_global_strain)[_qp];
127}
128
129template <typename R2, typename R4>
130void
132 ADRankTwoTensor & rotation_increment)
133{
134 using std::sqrt;
135
136 switch (_decomposition_method)
137 {
138 case DecompMethod::TaylorExpansion:
139 {
140 // inverse of _Fhat
141 const ADRankTwoTensor invFhat = _Fhat[_qp].inverse();
142
143 // A = I - _Fhat^-1
145 A -= invFhat;
146
147 // Cinv - I = A A^T - (A + A^T);
148 ADR2 Cinv_I = ADR2::timesTranspose(A) - ADR2::plusTranspose(A);
149
150 // strain rate D from Taylor expansion, Chat = (-1/2(Chat^-1 - I) + 1/4*(Chat^-1 - I)^2 + ...
151 total_strain_increment = -Cinv_I * 0.5 + Cinv_I.square() * 0.25;
152
153 const ADReal a[3] = {invFhat(1, 2) - invFhat(2, 1),
154 invFhat(2, 0) - invFhat(0, 2),
155 invFhat(0, 1) - invFhat(1, 0)};
156
157 const auto q = (a[0] * a[0] + a[1] * a[1] + a[2] * a[2]) / 4.0;
158 const auto trFhatinv_1 = invFhat.trace() - 1.0;
159 const auto p = trFhatinv_1 * trFhatinv_1 / 4.0;
160
161 // cos theta_a
162 const ADReal C1_squared =
163 p + 3.0 * Utility::pow<2>(p) * (1.0 - (p + q)) / Utility::pow<2>(p + q) -
164 2.0 * Utility::pow<3>(p) * (1.0 - (p + q)) / Utility::pow<3>(p + q);
165 if (C1_squared <= 0.0)
166 mooseException(
167 "Cannot take square root of a number less than or equal to zero in the calculation of "
168 "C1 for the Rashid approximation for the rotation tensor. This zero or negative number "
169 "may occur when elements become heavily distorted.");
170
171 const ADReal C1 = sqrt(C1_squared);
172
173 ADReal C2;
174 if (q > 0.01)
175 // (1-cos theta_a)/4q
176 C2 = (1.0 - C1) / (4.0 * q);
177 else
178 // alternate form for small q
179 C2 = 0.125 + q * 0.03125 * (Utility::pow<2>(p) - 12.0 * (p - 1.0)) / Utility::pow<2>(p) +
180 Utility::pow<2>(q) * (p - 2.0) * (Utility::pow<2>(p) - 10.0 * p + 32.0) /
181 Utility::pow<3>(p) +
182 Utility::pow<3>(q) *
183 (1104.0 - 992.0 * p + 376.0 * Utility::pow<2>(p) - 72.0 * Utility::pow<3>(p) +
184 5.0 * Utility::pow<4>(p)) /
185 (512.0 * Utility::pow<4>(p));
186
187 const ADReal C3_test =
188 (p * q * (3.0 - q) + Utility::pow<3>(p) + Utility::pow<2>(q)) / Utility::pow<3>(p + q);
189 if (C3_test <= 0.0)
190 mooseException(
191 "Cannot take square root of a number less than or equal to zero in the calculation of "
192 "C3_test for the Rashid approximation for the rotation tensor. This zero or negative "
193 "number may occur when elements become heavily distorted.");
194 const ADReal C3 = 0.5 * sqrt(C3_test); // sin theta_a/(2 sqrt(q))
195
196 // Calculate incremental rotation. Note that this value is the transpose of that from Rashid,
197 // 93, so we transpose it before storing
198 ADRankTwoTensor R_incr;
199 R_incr.addIa(C1);
200 for (unsigned int i = 0; i < 3; ++i)
201 for (unsigned int j = 0; j < 3; ++j)
202 R_incr(i, j) += C2 * a[i] * a[j];
203
204 R_incr(0, 1) += C3 * a[2];
205 R_incr(0, 2) -= C3 * a[1];
206 R_incr(1, 0) -= C3 * a[2];
207 R_incr(1, 2) += C3 * a[0];
208 R_incr(2, 0) += C3 * a[1];
209 R_incr(2, 1) -= C3 * a[0];
210
211 rotation_increment = R_incr.transpose();
212 break;
213 }
214
215 case DecompMethod::EigenSolution:
216 {
217 // Add a small perturbation to F for the case when F=I, which occurs with no deformation,
218 // which commonly occurs in initialization. The perturbation to F does not affect the computed
219 // stress, but prevents a singularity in the AD-computed material Jacobian.
220 if (this->_fe_problem.currentlyComputingJacobian() &&
221 _Fhat[_qp] == ADRankTwoTensor::Identity())
222 _Fhat[_qp] +=
223 ADRankTwoTensor(0.0, 5.0e-13, 5.0e-13, 5.0e-13, 0.0, 5.0e-13, 5.0e-13, 5.0e-13, 0.0);
224
225 FADR2 Chat = ADR2::transposeTimes(_Fhat[_qp]);
226 FADR2 Uhat = MathUtils::sqrt(Chat);
227 rotation_increment = _Fhat[_qp] * Uhat.inverse().template get<ADRankTwoTensor>();
228 total_strain_increment = MathUtils::log(Uhat).template get<ADR2>();
229 break;
230 }
231
232 default:
233 mooseError("ADComputeFiniteStrain Error: Pass valid decomposition type: TaylorExpansion or "
234 "EigenSolution.");
235 }
236}
237
registerMooseObject("SolidMechanicsApp", ADComputeFiniteStrain)
DualNumber< Real, DNDerivativeType, true > ADReal
const Real p
void mooseError(Args &&... args)
ADComputeFiniteStrain defines a strain increment and rotation increment, for finite strains.
static InputParameters validParams()
virtual void computeQpIncrements(ADR2 &e, ADRankTwoTensor &r)
Moose::GenericType< R2, true > ADR2
ADComputeFiniteStrainTempl(const InputParameters &parameters)
ADComputeIncrementalStrainBase is the base class for strain tensors using incremental formulations.
FactorizedRankTwoTensorTempl< T > inverse() const
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)
static RankTwoTensorTempl initializeFromRows(const libMesh::TypeVector< T > &row0, const libMesh::TypeVector< T > &row1, const libMesh::TypeVector< T > &row2)
void addIa(const T &a)
RankTwoTensorTempl< T > inverse() const
RankTwoTensorTempl< T > transpose() const
static RankTwoTensorTempl Identity()