https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeLagrangianStrainBase.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
12#include "MathUtils.h"
13#include "PermutationTensor.h"
14
15template <class G>
18{
20
21 params.addRequiredCoupledVar("displacements", "Displacement variables");
22 params.addParam<bool>(
23 "large_kinematics", false, "Use large displacement kinematics in the kernel.");
24 params.addParam<bool>("stabilize_strain", false, "Average the volumetric strains");
25 MooseEnum F_bar_mode("total incremental", "total");
26 params.addParam<MooseEnum>(
27 "F_bar_mode",
28 F_bar_mode,
29 "What deformation gradient F-bar averages over (only used when `stabilize_strain = true`). "
30 "'total' (default) averages the full F at each qp and rescales each qp's F by "
31 "cbrt(det(F_avg)/det(F_ust)). 'incremental' averages the incremental F "
32 "(F_ust * F_ust_old^{-1}) at each qp and rescales by cbrt(det(f_avg)/det(f_ust)); this is "
33 "bit-for-bit compatible with the OLD `ComputeFiniteStrain` + `volumetric_locking_correction "
34 "= "
35 "true` formulation. Set to 'incremental' when cross-checking against the old kernel system.");
36 params.addParam<bool>(
37 "publish_rotation_increment",
38 false,
39 "If true, publish `rotation_increment = exp(vorticity_increment)` (Rodrigues) for "
40 "downstream consumers that rotate by it (e.g. `ComputeMultiPlasticityStress` with "
41 "`perform_finite_strain_rotations = true`). Default false keeps `rotation_increment = I` "
42 "(the historical behavior -- the Lagrangian objective-rate machinery applies rotation "
43 "externally). Enable when wrapping plasticity that needs its internal stress state to "
44 "track the rotated Cauchy stress between steps, in tandem with `rotate_old_stress = true` "
45 "on the objective rate.");
46 params.addRangeCheckedParam<Real>(
47 "alpha",
48 1.0,
49 "alpha >= 0.5 & alpha <= 1.0",
50 "Generalized midpoint weight for the deformation gradient. 1.0 = backward Euler (default), "
51 "0.5 = midpoint rule (matches Abaqus/Implicit).");
52 MooseEnum kinematic_approximation("linear quadratic rashid_approximate rashid_eigen", "linear");
53 params.addParam<MooseEnum>(
54 "kinematic_approximation",
55 kinematic_approximation,
56 "Approximation to the increment in the spatial velocity gradient: 'linear' (default; "
57 "dL = I - f^{-1}), 'quadratic' (one more Taylor term), 'rashid_approximate' (Rashid's "
58 "symmetric+skew formulas), or 'rashid_eigen' (exact log f via polar decomposition + "
59 "matrix logs). Only affects large_kinematics; small kinematics is always linear.");
60 params.addParam<std::vector<MaterialPropertyName>>(
61 "eigenstrain_names", {}, "List of eigenstrains to account for");
62 params.addParam<std::vector<MaterialPropertyName>>(
63 "homogenization_gradient_names",
64 {},
65 "List of homogenization gradients to add to the displacement gradient");
66
67 params.addParam<std::string>("base_name", "Material property base name");
68
69 // We rely on this *not* having use_displaced mesh on
70 params.suppressParameter<bool>("use_displaced_mesh");
71
72 return params;
73}
74
75template <class G>
77 : Material(parameters),
79 _ndisp(coupledComponents("displacements")),
80 _disp(coupledValues("displacements")),
81 _grad_disp(coupledGradients("displacements")),
82 _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
83 _large_kinematics(getParam<bool>("large_kinematics")),
84 _stabilize_strain(getParam<bool>("stabilize_strain")),
85 _F_bar_mode(getParam<MooseEnum>("F_bar_mode").template getEnum<FBarMode>()),
86 _publish_rotation_increment(getParam<bool>("publish_rotation_increment")),
87 _alpha(getParam<Real>("alpha")),
88 _kinematic_approximation(
89 getParam<MooseEnum>("kinematic_approximation").template getEnum<KinematicApproximation>()),
90 _eigenstrain_names(getParam<std::vector<MaterialPropertyName>>("eigenstrain_names")),
91 _eigenstrains(_eigenstrain_names.size()),
92 _eigenstrains_old(_eigenstrain_names.size()),
93 _total_strain(declareProperty<RankTwoTensor>(_base_name + "total_strain")),
94 _total_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "total_strain")),
95 _mechanical_strain(declareProperty<RankTwoTensor>(_base_name + "mechanical_strain")),
96 _mechanical_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "mechanical_strain")),
97 _rotated_mechanical_strain(
98 declareProperty<RankTwoTensor>(_base_name + "rotated_mechanical_strain")),
99 _rotated_mechanical_strain_old(
100 getMaterialPropertyOld<RankTwoTensor>(_base_name + "rotated_mechanical_strain")),
101 _strain_increment(declareProperty<RankTwoTensor>(_base_name + "strain_increment")),
102 _deformation_gradient_increment(
103 declareProperty<RankTwoTensor>(_base_name + "spatial_deformation_gradient_increment")),
104 _vorticity_increment(declareProperty<RankTwoTensor>(_base_name + "vorticity_increment")),
105 _F_ust(declareProperty<RankTwoTensor>(_base_name + "unstabilized_deformation_gradient")),
106 _F_ust_old(
107 getMaterialPropertyOld<RankTwoTensor>(_base_name + "unstabilized_deformation_gradient")),
108 _F_actual(declareProperty<RankTwoTensor>(_base_name + "actual_deformation_gradient")),
109 _F_avg(declareProperty<RankTwoTensor>(_base_name + "average_deformation_gradient")),
110 _F(declareProperty<RankTwoTensor>(_base_name + "deformation_gradient")),
111 _F_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "deformation_gradient")),
112 _F_inv(declareProperty<RankTwoTensor>(_base_name + "inverse_deformation_gradient")),
113 _f_inv(declareProperty<RankTwoTensor>(_base_name + "inverse_incremental_deformation_gradient")),
114 _F_ust_inv(
115 declareProperty<RankTwoTensor>(_base_name + "inverse_unstabilized_deformation_gradient")),
116 _F_ust_det(declareProperty<Real>(_base_name + "det_unstabilized_deformation_gradient")),
117 _d_deformation_gradient_increment_d_F(declareProperty<RankFourTensor>(
118 _base_name + "d_spatial_deformation_gradient_increment_d_deformation_gradient")),
119 _d_vorticity_increment_d_F(declareProperty<RankFourTensor>(
120 _base_name + "d_vorticity_increment_d_deformation_gradient")),
121 _d_F_d_grad_u(
122 declareProperty<RankFourTensor>(_base_name + "d_deformation_gradient_d_grad_displacement")),
123 _rotation(declareProperty<RankTwoTensor>(_base_name + "rotation")),
124 _stretch(declareProperty<RankTwoTensor>(_base_name + "stretch")),
125 _d_rotation_d_F(
126 declareProperty<RankFourTensor>(_base_name + "d_rotation_d_deformation_gradient")),
127 _d_F_stab_d_F_ust(declareProperty<RankFourTensor>(_base_name + "d_F_stab_d_F_unstabilized")),
128 _d_F_stab_d_F_avg(declareProperty<RankFourTensor>(_base_name + "d_F_stab_d_F_average")),
129 _homogenization_gradient_names(
130 getParam<std::vector<MaterialPropertyName>>("homogenization_gradient_names")),
131 _homogenization_contributions(_homogenization_gradient_names.size()),
132 _rotation_increment(declareProperty<RankTwoTensor>(_base_name + "rotation_increment"))
133{
134 // Couple old displacements only when the simulation is transient. With a Steady executioner
135 // there is no "previous step", and the generalized midpoint rule treats the old state as
136 // the undeformed reference (u_n = 0, grad u_n = 0, so F_n = I). The (1 - alpha) contribution
137 // is then identically zero and we skip it in computeQpUnstabilizedDeformationGradient.
139 {
140 _disp_old = coupledValuesOld("displacements");
141 _grad_disp_old = coupledGradientsOld("displacements");
142 }
143
144 // Setup eigenstrains
145 for (auto i : make_range(_eigenstrain_names.size()))
146 {
147 _eigenstrains[i] = &getMaterialProperty<RankTwoTensor>(_eigenstrain_names[i]);
148 _eigenstrains_old[i] = &getMaterialPropertyOld<RankTwoTensor>(_eigenstrain_names[i]);
149 }
150
151 // In the future maybe there is a reason to have more than one, but for now
152 if (_homogenization_gradient_names.size() > 1)
153 mooseError("ComputeLagrangianStrainBase cannot accommodate more than one "
154 "homogenization gradient");
155
156 // Setup homogenization contributions
157 for (unsigned int i = 0; i < _homogenization_gradient_names.size(); i++)
159 &getMaterialProperty<RankTwoTensor>(_homogenization_gradient_names[i]);
160
161 // The strain calculator is the single source of truth for the kinematics regime. Publish a
162 // LARGE_KINEMATICS guarantee on the deformation gradient (issued in the constructor so it is in
163 // place before any consumer's initialSetup); the Lagrangian stress calculators and
164 // stress-divergence kernels derive their own `large_kinematics` from it. Small kinematics leaves
165 // the guarantee absent, which the consumers read as `large_kinematics = false`.
167 issueGuarantee(_base_name + "deformation_gradient", Guarantee::LARGE_KINEMATICS);
168 // Likewise for the F-bar settings, which the stress-divergence kernels must match
170 issueGuarantee(_base_name + "deformation_gradient", Guarantee::F_BAR);
172 issueGuarantee(_base_name + "deformation_gradient", Guarantee::F_BAR_INCREMENTAL);
173}
174
175template <class G>
176void
178{
179 _total_strain[_qp].zero();
180 _mechanical_strain[_qp].zero();
181 _rotated_mechanical_strain[_qp].zero();
182 _F[_qp].setToIdentity();
183 _F_ust[_qp].setToIdentity();
184 _rotation[_qp].setToIdentity();
185}
186
187template <class G>
188void
190{
191 // Average the volumetric terms, if required
192 computeDeformationGradient();
193
194 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
195 computeQpProperties();
196}
197
198template <class G>
199void
201{
202 // Add in the macroscale gradient contribution to both the stabilized `_F` (used by the
203 // strain chain via `_f_inv`) AND the unstabilized `_F_ust` (used by the stress materials to
204 // pull the Cauchy stress back to PK1). The homogenization gradient is a real
205 // deformation imposed via the scalar constraint, not a stabilization -- it must appear
206 // in F_ust too or PK1 = det(F_ust) sigma F_ust^{-T} will be missing its contribution.
207 for (auto contribution : _homogenization_contributions)
208 {
209 _F[_qp] += (*contribution)[_qp];
210 _F_ust[_qp] += (*contribution)[_qp];
211 }
212
213 // Publish F_ust^{-1} and det(F_ust) for the large-kinematics consumers' spatial push-forward
214 // (grad_x = F_ust^{-T} grad_X, J_ust = det F_ust) and the Cauchy -> PK1 wrap. Computed once per
215 // qp here -- shared by all displacement kernels and the stress calculator via the material
216 // system -- instead of recomputed per test/trial/qp downstream. Gated on `_large_kinematics`
217 // (every consumer reads these only on the large-kinematics path) and on `isPropertyActive` (so
218 // consumers that never request them pay nothing).
219 if (_large_kinematics && isPropertyActive(_F_ust_inv.id()))
220 {
221 _F_ust_inv[_qp] = _F_ust[_qp].inverse();
222 _F_ust_det[_qp] = _F_ust[_qp].det();
223 }
224
225 // Skip the Jacobian-only RankFourTensor derivative chain when no downstream consumer
226 // will read it (i.e. we're in a residual-only sweep). All of `_d_F_d_grad_u`,
227 // `_d_deformation_gradient_increment_d_F`, `_d_vorticity_increment_d_F`, and the
228 // `_d_rotation_d_F` slot of the polar decomposition feed only `*_jacobian` material
229 // properties, which the kernel consumes only during Jacobian or
230 // residual-and-Jacobian-together assembly.
231 const bool need_jacobian = _fe_problem.currentlyComputingJacobian() ||
232 _fe_problem.currentlyComputingResidualAndJacobian();
233
234 // dF/d(grad u_{n+1}) = alpha * I^{(4)} for the generalized midpoint rule
235 // (alpha = 1.0 reduces to backward Euler).
236 if (need_jacobian)
237 _d_F_d_grad_u[_qp] = _alpha * RankFourTensor::IdentityFour();
238
239 if (_large_kinematics)
240 {
241 _F_inv[_qp] = _F[_qp].inverse();
242 // For `F_bar_mode = incremental`: `_f_inv` must invert the *incremental* F that was
243 // F-bar'd (= `gamma_inc * F_ust * F_ust_old^{-1}`, matching OLD `ComputeFiniteStrain`'s
244 // `_Fhat` after its volumetric-locking correction). Since `_F = gamma_inc * F_ust`,
245 // `(gamma_inc * F_ust * F_ust_old^{-1})^{-1} = F_ust_old * _F^{-1}` -- i.e., pair the
246 // unstabilized old F with the (cumulative) stabilized current `_F^{-1}`. Using
247 // `_F_old` (the *cumulative* F-bar'd previous-step `_F`) here would compound F-bar
248 // across steps and break OLD-compat. `total` mode keeps the existing form (where `_F`
249 // and `_F_old` are the cumulative full-F F-bar'd values and the ratio gives the
250 // F-bar'd incremental F directly).
251 if (_stabilize_strain && _F_bar_mode == FBarMode::Incremental)
252 _f_inv[_qp] = _F_ust_old[_qp] * _F_inv[_qp];
253 else
254 _f_inv[_qp] = _F_old[_qp] * _F_inv[_qp];
255
256 // Dispatch to the active kinematic-approximation helper. Each helper returns
257 // dd (= Deltad), dw (= Deltaw), and -- only when `need_jacobian` -- the
258 // f^{-1}-derivatives of dL = dd + dw and of dw alone. The (dd, dw) outputs are needed
259 // every iteration; the RankFour derivatives feed only the Jacobian chain below, so on
260 // residual-only sweeps the helper skips them entirely.
261 RankTwoTensor dd, dw;
262 RankFourTensor d_dL_d_f_inv, d_dw_d_f_inv;
263 computeQpLargeKinematicIncrement(
264 _f_inv[_qp], dd, dw, d_dL_d_f_inv, d_dw_d_f_inv, need_jacobian);
265
266 if (need_jacobian)
267 {
268 // Common chain rule: d(f^{-1})_{pq}/dF_{mn} = -f^{-1}_{pm} * F^{-1}_{nq}.
269 usingTensorIndices(p_, q_, m_, n_);
270 const RankFourTensor d_f_inv_d_F = -_f_inv[_qp].template times<p_, m_, n_, q_>(_F_inv[_qp]);
271 _d_deformation_gradient_increment_d_F[_qp] = d_dL_d_f_inv * d_f_inv_d_F;
272 _d_vorticity_increment_d_F[_qp] = d_dw_d_f_inv * d_f_inv_d_F;
273 }
274
275 setQpIncrementalStrains(dd, dw);
276 // The polar decomposition (a tensor eigensolve + sqrt per qp, on every residual and Jacobian
277 // eval) feeds only the Green-Naghdi objective rate's `_rotation` / `_d_rotation_d_F` (and its
278 // internal `_stretch`). Skip it entirely when no active consumer needs it -- Truesdell uses
279 // the deformation-gradient increment, Jaumann the vorticity increment, Rashid the Rodrigues
280 // `_rotation_increment`. The active-property set self-corrects for future consumers with no
281 // coupling flag.
282 if (isPropertyActive(_rotation.id()) || isPropertyActive(_stretch.id()))
283 computeQpPolarDecomposition(need_jacobian);
284 }
285 // For small deformations we just provide the identity (and always linear)
286 else
287 {
288 _F_inv[_qp] = RankTwoTensor::Identity();
289 _f_inv[_qp] = RankTwoTensor::Identity();
290 const RankTwoTensor dL = _F[_qp] - _F_old[_qp];
291
292 if (need_jacobian)
293 {
294 // d(dL)/dF = I^{(4)} when dL = F - F_old. d(dW)/dF = the skew projector.
295 _d_deformation_gradient_increment_d_F[_qp] = RankFourTensor::IdentityFour();
296 usingTensorIndices(i_, j_, k_, l_);
297 const auto I2 = RankTwoTensor::Identity();
298 _d_vorticity_increment_d_F[_qp] =
299 0.5 * (RankFourTensor::IdentityFour() - I2.template times<j_, k_, i_, l_>(I2));
300
301 // Small kinematics: R = I, U = I, dR/dF = 0. Defensive defaults; GN is not used here.
302 _d_rotation_d_F[_qp].zero();
303 }
304 _rotation[_qp].setToIdentity();
305 _stretch[_qp].setToIdentity();
306
307 setQpIncrementalStrains(0.5 * (dL + dL.transpose()), 0.5 * (dL - dL.transpose()));
308 }
309}
310
311template <class G>
312void
314{
315 // Polar decomposition F = R * U of the alpha-weighted, F-bar-stabilized deformation
316 // gradient at this qp. We decompose _F rather than _F_actual because the rest of the
317 // kernel/rate chain treats _F as the spatial frame; using _F here matches the pre-3.1
318 // GN rate exactly (it read _def_grad, which is _F via ComputeLagrangianStressCauchy).
319 const RankTwoTensor & F = _F[_qp];
321 // Reuse the sqrt factorization (a tensor eigensolve) for both U and U^{-1}.
322 const auto sqrt_C = MathUtils::sqrt(C);
323 _stretch[_qp] = sqrt_C.get();
324 const RankTwoTensor U_inv = sqrt_C.inverse().get();
325 _rotation[_qp] = F * U_inv;
326
327 if (!need_jacobian)
328 return;
329
330 // dR/dF closed form. See ComputeLagrangianObjectiveStress.C:221-227.
331 const auto I = RankTwoTensor::Identity();
332 const RankTwoTensor Y = _stretch[_qp].trace() * I - _stretch[_qp];
333 const RankTwoTensor Z = _rotation[_qp] * Y;
334 const RankTwoTensor O = Z * _rotation[_qp].transpose();
335 usingTensorIndices(i_, j_, k_, l_);
336 _d_rotation_d_F[_qp] =
337 (O.template times<i_, k_, l_, j_>(Y) - Z.template times<i_, l_, k_, j_>(Z)) / Y.det();
338}
339
340template <class G>
341void
343 RankTwoTensor & dd,
344 RankTwoTensor & dw,
345 RankFourTensor & d_dL_d_f_inv,
346 RankFourTensor & d_dw_d_f_inv,
347 bool need_jacobian)
348{
349 switch (_kinematic_approximation)
350 {
351 case KinematicApproximation::Linear:
352 computeLinearIncrement(f_inv, dd, dw, d_dL_d_f_inv, d_dw_d_f_inv, need_jacobian);
353 break;
354 case KinematicApproximation::Quadratic:
355 computeQuadraticIncrement(f_inv, dd, dw, d_dL_d_f_inv, d_dw_d_f_inv, need_jacobian);
356 break;
357 case KinematicApproximation::RashidApproximate:
358 computeRashidApproximateIncrement(f_inv, dd, dw, d_dL_d_f_inv, d_dw_d_f_inv, need_jacobian);
359 break;
360 case KinematicApproximation::RashidEigen:
361 computeRashidEigenIncrement(f_inv, dd, dw, d_dL_d_f_inv, d_dw_d_f_inv, need_jacobian);
362 break;
363 }
364}
365
366template <class G>
367void
369{
370 // Backward-compatible entry point: split into sym/skew and delegate.
371 setQpIncrementalStrains(0.5 * (dL + dL.transpose()), 0.5 * (dL - dL.transpose()));
372}
373
374template <class G>
375void
377 const RankTwoTensor & dw)
378{
379 _strain_increment[_qp] = dd;
380 _vorticity_increment[_qp] = dw;
381 // Full kinematic spatial velocity gradient increment, before any eigenstrain subtraction.
382 // The objective-rate advection in ComputeLagrangianObjectiveStress consumes this.
383 _deformation_gradient_increment[_qp] = dd + dw;
384
385 // Increment the total strain
386 _total_strain[_qp] = _total_strain_old[_qp] + _strain_increment[_qp];
387
388 // Get rid of the eigenstrains
389 // Note we currently do not alter the deformation gradient -- this will be
390 // needed in the future for a "complete" system
391 subtractQpEigenstrainIncrement(_strain_increment[_qp]);
392
393 // Increment the mechanical strain
394 _mechanical_strain[_qp] = _mechanical_strain_old[_qp] + _strain_increment[_qp];
395
396 // Additionally maintain the rotated mechanical-strain accumulator,
397 // eps_n+1 = r_hat (eps_n + Deltad) r_hat^T, where r_hat = exp(Deltaw) via Rodrigues. This matches
398 // the mechanical_strain output convention of `ComputeFiniteStrain` and is consumed only by aux
399 // variables -- the stress chain still uses the un-rotated `_mechanical_strain` above. In small
400 // kinematics dw is small and r_hat ~= I + dw + 1/2 dw^2, which contributes only second-order
401 // corrections (equivalent to no rotation for small strain).
402 RankTwoTensor r_hat;
403 if (_large_kinematics)
404 {
405 const Real theta2 = 0.5 * dw.doubleContraction(dw);
406 const Real theta = std::sqrt(theta2);
407 Real f, g;
408 const Real small_theta = 1.0e-7;
409 if (theta < small_theta)
410 {
411 f = 1.0 - theta2 / 6.0;
412 g = 0.5 - theta2 / 24.0;
413 }
414 else
415 {
416 f = std::sin(theta) / theta;
417 g = (1.0 - std::cos(theta)) / theta2;
418 }
419 r_hat = RankTwoTensor::Identity() + f * dw + g * dw * dw;
420 }
421 else
422 {
423 r_hat = RankTwoTensor::Identity();
424 }
425 _rotated_mechanical_strain[_qp] =
426 r_hat * (_rotated_mechanical_strain_old[_qp] + _strain_increment[_qp]) * r_hat.transpose();
427
428 // Published rotation increment for downstream `ComputeStressBase`-style materials. The
429 // default (identity) preserves the historical Lagrangian pipeline where the objective
430 // rate is the sole rotation source. With `publish_rotation_increment = true` we dispatch
431 // to the `kinematic_approximation`-matched formula so wrapped plasticity with
432 // `perform_finite_strain_rotations = true` rotates its `_stress` bit-for-bit like OLD's
433 // `ComputeFiniteStrain` would have done (the rate then runs in `rotate_old_stress`
434 // passthrough mode so we don't double-rotate). Specifically `rashid_approximate` uses
435 // OLD's C1/C2/C3 polynomial form (not `exp(dw)`) so the wrapped material's accumulated
436 // stress storage matches OLD's `_stress` byte-for-byte through return mapping; without
437 // this, the small (~1e-5) per-step rotation drift between `exp(dw)` and OLD's R_incr
438 // amplifies through plastic flow into ~1e-3 cumulative stress error.
439 _rotation_increment[_qp] = (_publish_rotation_increment && _large_kinematics)
440 ? computeQpRotationIncrement(_f_inv[_qp], dw)
442}
443
444template <class G>
445void
447 RankTwoTensor & dd,
448 RankTwoTensor & dw,
449 RankFourTensor & d_dL_d_f_inv,
450 RankFourTensor & d_dw_d_f_inv,
451 bool need_jacobian) const
452{
453 // Deltal = I - f^{-1}, so Deltad = sym(Deltal), Deltaw = skew(Deltal).
454 const RankTwoTensor dL = RankTwoTensor::Identity() - f_inv;
455 dd = 0.5 * (dL + dL.transpose());
456 dw = 0.5 * (dL - dL.transpose());
457
458 if (!need_jacobian)
459 return;
460 // d(Deltal)/d(f^{-1}) = -I^{(4)}.
461 d_dL_d_f_inv = -RankFourTensor::IdentityFour();
462 // d(Deltaw)/d(f^{-1}) = - skew projector on f^{-1} = -(1/2)(I^{ikjl} - I^{iljk}).
463 usingTensorIndices(i_, j_, m_, n_);
464 const auto I2 = RankTwoTensor::Identity();
465 d_dw_d_f_inv = -0.5 * (RankFourTensor::IdentityFour() - I2.template times<j_, m_, i_, n_>(I2));
466}
467
468template <class G>
469void
471 RankTwoTensor & dd,
472 RankTwoTensor & dw,
473 RankFourTensor & d_dL_d_f_inv,
474 RankFourTensor & d_dw_d_f_inv,
475 bool need_jacobian) const
476{
477 // Deltal = X + (1/2) X^2 with X = I - f^{-1} (one more Taylor term of -log f^{-1}).
478 const RankTwoTensor X = RankTwoTensor::Identity() - f_inv;
479 const RankTwoTensor dL = X + 0.5 * X * X;
480 dd = 0.5 * (dL + dL.transpose());
481 dw = 0.5 * (dL - dL.transpose());
482
483 if (!need_jacobian)
484 return;
485 // dX/d(f^{-1}) = -I^{(4)}, and d(X^2)_{ij}/dX_{mn} = delta_{im} X_{nj} + X_{im} delta_{jn}.
486 // So d(Deltal)/d(f^{-1}) = -I^{(4)} - (1/2) (delta_{im} X_{nj} + X_{im} delta_{jn}).
487 usingTensorIndices(i_, j_, m_, n_);
488 const auto I2 = RankTwoTensor::Identity();
489 const RankFourTensor dXX_dX =
490 I2.template times<i_, m_, n_, j_>(X) + X.template times<i_, m_, j_, n_>(I2);
491 d_dL_d_f_inv = -RankFourTensor::IdentityFour() - 0.5 * dXX_dX;
492 // dw = (1/2)(dL - dL^T), so d(dw)_{ij}/d... = (1/2)(d(dL)_{ij}/d... - d(dL)_{ji}/d...).
493 d_dw_d_f_inv = 0.5 * (d_dL_d_f_inv - d_dL_d_f_inv.transposeIj());
494}
495
496template <class G>
497void
499 RankTwoTensor & dd,
500 RankTwoTensor & dw,
501 RankFourTensor & d_dL_d_f_inv,
502 RankFourTensor & d_dw_d_f_inv,
503 bool need_jacobian) const
504{
505 // See plan_outline.pdf Sec.2.3 (eq 10-15, with the corrected vorticity).
506 // X = I - f^{-1}. Symmetric part: A = X X^T - X - X^T, Deltad = -A/2 + A^2/4.
507 // Skew part (from the rotation tensor): alpha_i = eps_ijk (f^{-1})_jk,
508 // cos theta = (tr(f^{-1}) - 1)/2, sin theta = sqrt(1 - cos^2theta), Q = (1/4) alpha*alpha,
509 // Deltaw_ij = -(theta / (2sqrtQ)) eps_ijk alpha_k.
510 usingTensorIndices(i_, j_, m_, n_);
511 const auto I2 = RankTwoTensor::Identity();
512 const auto I4 = RankFourTensor::IdentityFour();
513
514 // ---- symmetric part ----
515 const RankTwoTensor X = I2 - f_inv;
516 const RankTwoTensor Xt = X.transpose();
517 const RankTwoTensor A = X * Xt - X - Xt;
518 dd = -0.5 * A + 0.25 * A * A;
519
520 // ---- skew part ----
521 // alpha_i = eps_ijk (f^{-1})_jk (axial vector of f^{-1}'s skew part, doubled).
522 RealVectorValue alpha;
523 for (unsigned int i = 0; i < 3; ++i)
524 {
525 Real ai = 0.0;
526 for (unsigned int j = 0; j < 3; ++j)
527 for (unsigned int k = 0; k < 3; ++k)
528 ai += PermutationTensor::eps(i, j, k) * f_inv(j, k);
529 alpha(i) = ai;
530 }
531 // Derive theta from the axial vector's magnitude rather than from tr(f^{-1}): the trace
532 // formula assumes f^{-1} is exactly a rotation, which is only true in the limit. Here
533 // sin theta = sqrtQ (Q = |skew part|^2/4); a true rotation matches both, and an arbitrary f^{-1}
534 // is projected onto its nearest "rotation-like" interpretation.
535 const Real Q_raw = 0.25 * (alpha * alpha);
536 // Clamp Q just below 1 so cos theta stays strictly positive (theta -> pi/2 is unphysical for one
537 // step).
538 const Real Q = std::min(Q_raw, 1.0 - 1.0e-12);
539
540 // Small-angle fallback: when sin theta -> 0, theta/(2sqrtQ) -> 1/2 (L'Hopital) and Deltaw ->
541 // -alpha/2, which matches sym/skew of the linear approximation. d(Deltaw)/d(f^{-1}) is the
542 // antisymmetrizer (1/2)(delta_im delta_jn - delta_jm delta_in).
543 const Real small_Q = 1.0e-12;
544 if (Q < small_Q)
545 {
546 // Deltaw_ij = -(1/2) eps_ijk alpha_k
547 for (unsigned int i = 0; i < 3; ++i)
548 for (unsigned int j = 0; j < 3; ++j)
549 {
550 Real v = 0.0;
551 for (unsigned int k = 0; k < 3; ++k)
552 v += PermutationTensor::eps(i, j, k) * alpha(k);
553 dw(i, j) = -0.5 * v;
554 }
555 // d(Deltaw)/d(f^{-1}) = -(1/2)(delta_{im} delta_{jn} - delta_{jm} delta_{in})
556 if (need_jacobian)
557 d_dw_d_f_inv = -0.5 * (I4 - I2.template times<j_, m_, i_, n_>(I2));
558 }
559 else
560 {
561 const Real sin_theta = std::sqrt(Q);
562 const Real cos_theta = std::sqrt(1.0 - Q);
563 const Real theta = std::asin(sin_theta);
564 const Real coeff = -theta / (2.0 * sin_theta);
565
566 for (unsigned int i = 0; i < 3; ++i)
567 for (unsigned int j = 0; j < 3; ++j)
568 {
569 Real v = 0.0;
570 for (unsigned int k = 0; k < 3; ++k)
571 v += PermutationTensor::eps(i, j, k) * alpha(k);
572 dw(i, j) = coeff * v;
573 }
574
575 // Build d(Deltaw)/d(f^{-1}) analytically.
576 // Deltaw_ij = c(f^{-1}) * E_ij(f^{-1}), E_ij = eps_ijk alpha_k, c = -theta/(2 sin theta).
577 //
578 // dalpha_k/d(f^{-1})_{mn} = eps_{kmn} (Levi-Civita is constant).
579 // dQ/d(f^{-1})_{mn} = (1/2) alpha_k eps_{kmn}.
580 // With sin theta = sqrtQ : dsin theta/d(f^{-1})_{mn} = alpha_k eps_{kmn} / (4 sin theta).
581 // dtheta/d(f^{-1})_{mn} = dsin theta/d(f^{-1})_{mn} / cos theta.
582 // dc/dtheta = -(sin theta - theta cos theta)/(2 sin^2 theta); dc/d(f^{-1})_{mn} = dc/dtheta *
583 // dtheta/d(f^{-1})_{mn}
584 // = (theta cos theta - sin theta) alpha_k eps_{kmn} / (8 sin^3 theta cos theta).
585 // dE_ij/d(f^{-1})_{mn} = eps_{ijk} eps_{kmn}.
586 //
587 // Final:
588 // d(Deltaw)_{ij}/d(f^{-1})_{mn} = (dc/d(f^{-1})_{mn}) * E_ij + c * dE_ij/d(f^{-1})_{mn}.
589 if (need_jacobian)
590 {
591 const Real dc_pref =
592 (theta * cos_theta - sin_theta) / (8.0 * sin_theta * sin_theta * sin_theta * cos_theta);
593 for (unsigned int i = 0; i < 3; ++i)
594 for (unsigned int j = 0; j < 3; ++j)
595 {
596 Real E_ij = 0.0;
597 for (unsigned int k = 0; k < 3; ++k)
598 E_ij += PermutationTensor::eps(i, j, k) * alpha(k);
599 for (unsigned int m = 0; m < 3; ++m)
600 for (unsigned int n = 0; n < 3; ++n)
601 {
602 Real eps_alpha = 0.0;
603 for (unsigned int k = 0; k < 3; ++k)
604 eps_alpha += PermutationTensor::eps(k, m, n) * alpha(k);
605 const Real dc_dfinv = dc_pref * eps_alpha;
606 Real dE_dfinv = 0.0;
607 for (unsigned int k = 0; k < 3; ++k)
608 dE_dfinv += PermutationTensor::eps(i, j, k) * PermutationTensor::eps(k, m, n);
609 d_dw_d_f_inv(i, j, m, n) = dc_dfinv * E_ij + coeff * dE_dfinv;
610 }
611 }
612 }
613 }
614
615 if (!need_jacobian)
616 return;
617
618 // ---- symmetric-part derivative + assemble d(Deltal)/d(f^{-1}) (Jacobian only) ----
619 // dX/d(f^{-1}) = -I^{(4)}.
620 // d(X X^T)_{ij}/dX_{mn} = delta_{im} X_{jn} + X_{in} delta_{jm} (from (X X^T)_{ij} = X_{ik}
621 // X_{jk}). d(X^T)_{ij}/dX_{mn} = delta_{jm} delta_{in}.
622 // -> d(A)/d(f^{-1}) = -[d(X X^T)/dX] + I^{(4)} + (transposed I^{(4)}).
623 const RankFourTensor d_XXt_dX =
624 I2.template times<i_, m_, j_, n_>(X) + X.template times<i_, n_, j_, m_>(I2);
625 const RankFourTensor d_Xt_dX = I2.template times<j_, m_, i_, n_>(I2);
626 const RankFourTensor dA_dfinv = -d_XXt_dX + I4 + d_Xt_dX;
627
628 // d(A^2)_{ij}/dA_{mn} = delta_{im} A_{nj} + A_{im} delta_{jn}.
629 const RankFourTensor d_AA_dA =
630 I2.template times<i_, m_, n_, j_>(A) + A.template times<i_, m_, j_, n_>(I2);
631 const RankFourTensor d_AA_dfinv = d_AA_dA * dA_dfinv;
632
633 const RankFourTensor d_dd_dfinv = -0.5 * dA_dfinv + 0.25 * d_AA_dfinv;
634 d_dL_d_f_inv = d_dd_dfinv + d_dw_d_f_inv;
635}
636
637template <class G>
638void
640 RankTwoTensor & dd,
641 RankTwoTensor & dw,
642 RankFourTensor & d_dL_d_f_inv,
643 RankFourTensor & d_dw_d_f_inv,
644 bool need_jacobian) const
645{
646 // See plan_outline.pdf Sec.2.4. Polar-decompose f^{-1} = r' u', with u' symmetric positive
647 // definite and r' a proper rotation. The PDF's identity `log f^{-1} = -log d - log w`
648 // only holds when log u and log r commute (i.e. for non-rotating deformation); in general
649 // the right stretch of f^{-1} is u' = R * U^{-1} * R^T where R, U are the right polar of f.
650 // So -log(u') = R * log U * R^T is the *spatial-frame* log strain, not the co-rotated
651 // log U. We compute it that way first, then rotate by r' = R^T to land in the n-frame
652 // so that _strain_increment = log U exactly. This is the strain measure the Rashid
653 // objective stress update consumes (eq. 22, sigma_{n+1} = r_hat (sigma_n + Deltasigma) r_hat^T
654 // expects Deltasigma in the n-frame).
655 usingTensorIndices(a_, b_, m_, n_);
656 const auto I2 = RankTwoTensor::Identity();
657
658 // ---- polar decomposition of f^{-1} ----
659 FactorizedRankTwoTensor cprime(f_inv.transpose() * f_inv);
660 // Reuse the sqrt factorization (a tensor eigensolve) for both u and u^{-1}.
661 const auto sqrt_cprime = MathUtils::sqrt(cprime);
662 const RankTwoTensor u = sqrt_cprime.get();
663 const RankTwoTensor u_inv = sqrt_cprime.inverse().get();
664 const RankTwoTensor r = f_inv * u_inv;
665
666 // ---- intermediate Deltad_spatial = -log u' = R * log U * R^T (n+1 frame) ----
667 // u' = sqrt(c'), so log(u') = (1/2) log(c'). Reuse c''s already-computed factorization
668 // (`sqrt_cprime` shares c''s eigenvectors) instead of re-decomposing u -- one fewer 3x3
669 // eigensolve per qp, on both residual and Jacobian sweeps.
670 const RankTwoTensor dd_spatial = -0.5 * MathUtils::log(cprime).get();
671
672 // ---- Deltaw = -log r via Rodrigues. ----
673 // log r = phi(theta) (r - r^T) with phi(theta) = theta/(2 sin theta), cos theta = (tr r - 1)/2.
674 const Real cos_theta = MathUtils::clamp(0.5 * (r.trace() - 1.0), -1.0, 1.0);
675 const Real sin2 = std::max(1.0 - cos_theta * cos_theta, 0.0);
676 const Real sin_theta = std::sqrt(sin2);
677 const Real theta = std::acos(cos_theta);
678 const RankTwoTensor A = r - r.transpose();
679
680 // d(log r)_{ij}/d(r)_{mn} = (dphi/dr_{mn}) A_{ij} + phi (delta_{im} delta_{jn} - delta_{jm}
681 // delta_{in}).
682 // dphi/dr_{mn} = (dphi/dtheta)(dtheta/d cos theta)(d cos theta/dr_{mn})
683 // = psi delta_{mn}, where psi = (theta cos theta - sin theta)/(4 sin^3 theta).
684 // Small-angle: phi -> 1/2, psi -> -1/12, so d(log r)/dr -> (1/2)(I^(4) - swap_ij).
685 // `d_logr_d_r` feeds only the Jacobian, so it is built only when `need_jacobian`.
686 const Real small_sin = 1.0e-7;
687 RankFourTensor d_logr_d_r;
688 RankTwoTensor log_r;
689 usingTensorIndices(i_, j_, k_, l_);
690 if (std::abs(sin_theta) < small_sin)
691 {
692 log_r = 0.5 * A;
693 if (need_jacobian)
694 {
695 const RankFourTensor swap_ij = I2.template times<j_, m_, i_, n_>(I2);
696 d_logr_d_r = 0.5 * (RankFourTensor::IdentityFour() - swap_ij);
697 }
698 }
699 else
700 {
701 const Real phi = theta / (2.0 * sin_theta);
702 log_r = phi * A;
703 if (need_jacobian)
704 {
705 const Real psi = (theta * cos_theta - sin_theta) / (4.0 * sin_theta * sin2);
706 const RankFourTensor swap_ij = I2.template times<j_, m_, i_, n_>(I2);
707 // (dphi/dr)_{mn} = psi delta_{mn} -> outer with A_{ij} gives A.times<i_, j_, m_, n_>(I2) *
708 // psi.
709 const RankFourTensor dphi_outer_A = A.template times<i_, j_, m_, n_>(I2);
710 d_logr_d_r = psi * dphi_outer_A + phi * (RankFourTensor::IdentityFour() - swap_ij);
711 }
712 }
713 dw = -log_r;
714
715 // ---- Rotate Deltad from spatial back to co-rotated (n) frame: log U = r' * (R log U R^T) *
716 // r'^T, using r' = R^T from the polar of f^{-1}. ----
717 dd = r * dd_spatial * r.transpose();
718
719 // Everything below is the Jacobian chain (RankFour matrix-log derivatives, the
720 // polar-decomposition dr/d(f^{-1}) closed form, and the three-piece sandwich chain rule).
721 // Skip it wholesale on residual-only sweeps.
722 if (!need_jacobian)
723 return;
724
725 // d(log u)/d(c') = (1/2) dlog(c'), and d(c')_{ab}/d(f^{-1})_{mn} = delta_{an} f_inv_{mb}
726 // + delta_{bn} f_inv_{ma}.
727 const RankFourTensor dlog_cprime = MathUtils::dlog(cprime);
728 const RankFourTensor d_cprime_d_finv =
729 I2.template times<a_, n_, m_, b_>(f_inv) + I2.template times<b_, n_, m_, a_>(f_inv);
730 const RankFourTensor d_dd_spatial_d_finv = -0.5 * (dlog_cprime * d_cprime_d_finv);
731
732 // ---- d(r)/d(f^{-1}) via the polar-decomposition closed form (same trick as
733 // ComputeLagrangianObjectiveStress::polarDecomposition). ----
734 const RankTwoTensor Y = u.trace() * I2 - u;
735 const RankTwoTensor Z = r * Y;
736 const RankTwoTensor O = Z * r.transpose();
737 const RankFourTensor d_r_d_finv =
738 (O.template times<i_, k_, l_, j_>(Y) - Z.template times<i_, l_, k_, j_>(Z)) / Y.det();
739
740 d_dw_d_f_inv = -(d_logr_d_r * d_r_d_finv);
741
742 // The derivative of the sandwich r'*A*r'^T w.r.t. f^{-1} expands to three rank-4 pieces
743 // (chain rule on r' AND on A). The 6-argument `times<>(RankFourTensor)` overload uses
744 // x[0..4] (one dummy at index 4), so we reuse the same dummy label `p2_` in each
745 // sub-contraction.
746 {
747 usingTensorIndices(i2_, j2_, m2_, n2_, p2_);
748 const RankTwoTensor M = dd_spatial * r.transpose(); // dd * r^T (p, j) shape
749 const RankTwoTensor N = r * dd_spatial; // r * dd (i, q) shape
750 // T1_{ijmn} = (dr/d_finv)_{ip,mn} * M_{pj}
751 const RankFourTensor T1 = M.template times<p2_, j2_, i2_, p2_, m2_, n2_>(d_r_d_finv);
752 // T2_{ijmn} = r_{ip} * (d_dd_spatial_d_finv)_{pq,mn} * r_{jq}: contract twice over the dummy.
753 const RankFourTensor mid = r.template times<i2_, p2_, p2_, j2_, m2_, n2_>(d_dd_spatial_d_finv);
754 const RankFourTensor T2 = r.template times<j2_, p2_, i2_, p2_, m2_, n2_>(mid);
755 // T3_{ijmn} = N_{iq} * (dr/d_finv)_{jq,mn}
756 const RankFourTensor T3 = N.template times<i2_, p2_, j2_, p2_, m2_, n2_>(d_r_d_finv);
757 const RankFourTensor d_dd_d_finv = T1 + T2 + T3;
758 d_dL_d_f_inv = d_dd_d_finv + d_dw_d_f_inv;
759 }
760}
761
762template <class G>
763void
765{
766 for (auto i : make_range(_eigenstrain_names.size()))
767 strain -= (*_eigenstrains[i])[_qp] - (*_eigenstrains_old[i])[_qp];
768}
769
770template <class G>
771void
773{
774 // Generalized midpoint: F^alpha_{n+1} = I + alpha * (grad u_{n+1}, u_{n+1})
775 // + (1 - alpha) * (grad u_n, u_n).
776 // alpha = 1.0 reduces to backward Euler (no old contribution). With a Steady executioner
777 // the old displacement is treated as identically zero (F_n = I), so we skip the old call
778 // entirely - this lets a user run with alpha != 1 in steady mode as well.
779 _F_ust[_qp].setToIdentity();
780 const bool include_old = _alpha != 1.0 && _fe_problem.isTransient();
781 for (auto component : make_range(_ndisp))
782 {
783 G::addGradOp(_F_ust[_qp],
784 component,
785 _alpha * (*_grad_disp[component])[_qp],
786 _alpha * (*_disp[component])[_qp],
787 _q_point[_qp]);
788 if (include_old)
789 G::addGradOp(_F_ust[_qp],
790 component,
791 (1.0 - _alpha) * (*_grad_disp_old[component])[_qp],
792 (1.0 - _alpha) * (*_disp_old[component])[_qp],
793 _q_point[_qp]);
794 }
795}
796
797template <class G>
798void
800{
801 // The literal deformation gradient at n+1 (no alpha weighting, no F-bar). For alpha = 1
802 // this is identical to _F_ust.
803 _F_actual[_qp].setToIdentity();
804 for (auto component : make_range(_ndisp))
805 G::addGradOp(_F_actual[_qp],
806 component,
807 (*_grad_disp[component])[_qp],
808 (*_disp[component])[_qp],
809 _q_point[_qp]);
810}
811
812template <class G>
813void
815{
816 // First calculate the unstabilized deformation gradient at each qp
817 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
818 {
819 computeQpUnstabilizedDeformationGradient();
820 computeQpActualDeformationGradient();
821 _F[_qp] = _F_ust[_qp];
822 }
823
824 usingTensorIndices(i_, j_, k_, l_);
825 const auto I2 = RankTwoTensor::Identity();
826
827 // The F-bar local/non-local derivative material properties feed only the Jacobian path
828 // (the stress materials chain them into `_pk1_jacobian`/`_cauchy_jacobian`, and the
829 // TL kernel's non-local F-bar term contracts `_d_F_stab_d_F_avg`). The residual sweep
830 // never reads them, so skip the R4 algebra when assembling a residual alone.
831 const bool need_jacobian = _fe_problem.currentlyComputingJacobian() ||
832 _fe_problem.currentlyComputingResidualAndJacobian();
833
834 // If stabilization is on do the volumetric correction
835 if (_stabilize_strain)
836 {
837 // `_F_avg` consistently stores the element average of `F_ust` regardless of mode;
838 // it's consumed by the UL kernel for the spatial-frame push-forward, which is a
839 // purely-geometric quantity. In `F_bar_mode = incremental` the F-bar chain itself
840 // operates on the *incremental* averaged tensor `f_avg = avg(F_ust * F_ust_old^{-1})`,
841 // which we compute locally -- the kernel matches by weighting grad_phi by F_ust_old^{-1}
842 // in its element average. Incremental mode only makes sense for large kinematics
843 // (OLD's Fhat F-bar lives in the finite-strain code path).
844 const bool incremental = (_F_bar_mode == FBarMode::Incremental);
845 if (incremental && !_large_kinematics)
846 mooseError("`F_bar_mode = incremental` requires `large_kinematics = true`. The "
847 "incremental F-bar formulation is the multiplicative correction to the "
848 "incremental F, which is only defined for large kinematics. Use "
849 "`F_bar_mode = total` (the default) with small kinematics.");
850 const auto F_avg = StabilizationUtils::elementAverage(
851 [this](unsigned int qp) { return _F_ust[qp]; }, _JxW, _coord);
852 const auto f_avg =
853 incremental
854 ? StabilizationUtils::elementAverage([this](unsigned int qp)
855 { return _F_ust[qp] * _F_ust_old[qp].inverse(); },
856 _JxW,
857 _coord)
858 : RankTwoTensor();
859 // Always publish avg(F_ust) -- UL kernel uses this for the push-forward.
860 _F_avg.set().setAllValues(F_avg);
861 // What the F-bar gamma and `_d_F_stab_d_F_avg` are built against (also what the
862 // kernel-side `_avg_grad_trial` will represent the delta of):
863 const auto & avg_for_chain = incremental ? f_avg : F_avg;
864 // Make the appropriate modification, depending on small or large deformations
865 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
866 {
867 if (_large_kinematics)
868 {
869 // Multiplicative F-bar: F_stab = gamma * F_ust where
870 // gamma_total = cbrt(det(F_avg) / det(F_ust)) (total mode)
871 // gamma_inc = cbrt(det(f_avg) / det(f_ust)), f_ust = F_ust*F_ust_old^{-1}
872 // (incremental mode)
873 // For incremental: det(f_ust) = det(F_ust)/det(F_ust_old).
874 // d log det(f_ust)/d F_ust = F_ust^{-T} (same as the total-mode chain)
875 // so `_d_F_stab_d_F_ust` shares the total-mode shape. The non-local chain
876 // contracts `_d_F_stab_d_F_avg` with delta(averaged-quantity); kernel computes
877 // deltaf_avg in incremental mode by weighting grad_phi by F_ust_old^{-1} in its
878 // element average.
879 const Real det_ust_local =
880 incremental ? _F_ust[_qp].det() / _F_ust_old[_qp].det() : _F[_qp].det();
881 const Real gamma = std::pow(avg_for_chain.det() / det_ust_local, 1.0 / 3.0);
882 if (need_jacobian)
883 {
884 const auto Fust_invT = _F_ust[_qp].inverse().transpose();
885 const auto avg_invT = avg_for_chain.inverse().transpose();
886 _d_F_stab_d_F_ust[_qp] =
888 (gamma / 3.0) * _F_ust[_qp].template times<i_, j_, k_, l_>(Fust_invT);
889 _d_F_stab_d_F_avg[_qp] =
890 (gamma / 3.0) * _F_ust[_qp].template times<i_, j_, k_, l_>(avg_invT);
891 }
892 _F[_qp] *= gamma;
893 }
894 else
895 {
896 if (need_jacobian)
897 {
898 // Additive (trace) F-bar: F_stab = F_ust + (tr(F_avg - F_ust)/3) * I.
899 // dF_stab/dF_ust = I^(4) - (1/3) * I2 (x) I2 (each diagonal component pulled out).
900 // dF_stab/dF_avg = (1/3) * I2 (x) I2.
901 const auto outer = I2.template times<i_, j_, k_, l_>(I2);
902 _d_F_stab_d_F_ust[_qp] = RankFourTensor::IdentityFour() - (1.0 / 3.0) * outer;
903 _d_F_stab_d_F_avg[_qp] = (1.0 / 3.0) * outer;
904 }
905 _F[_qp] += (F_avg.trace() - _F[_qp].trace()) * I2 / 3.0;
906 }
907 }
908 }
909 else if (need_jacobian)
910 {
911 // F-bar off: dF_stab/dF_ust = I^(4), dF_stab/dF_avg = 0.
912 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
913 {
914 _d_F_stab_d_F_ust[_qp] = RankFourTensor::IdentityFour();
915 _d_F_stab_d_F_avg[_qp].zero();
916 }
917 }
918}
919
920template <class G>
923 const RankTwoTensor & dw) const
924{
925 // For `rashid_approximate` port OLD `ComputeFiniteStrain`'s C1/C2/C3 polynomial form
926 // exactly (Rashid 1993). Pairing this rotation with the wrapped material's FSR (via
927 // `_rotation_increment`) lets the constitutive's `_stress` evolution match OLD's bit-
928 // for-bit at the same converged displacement state.
929 if (_kinematic_approximation == KinematicApproximation::RashidApproximate)
930 {
931 const Real a[3] = {
932 f_inv(1, 2) - f_inv(2, 1), f_inv(2, 0) - f_inv(0, 2), f_inv(0, 1) - f_inv(1, 0)};
933 const Real q = (a[0] * a[0] + a[1] * a[1] + a[2] * a[2]) / 4.0;
934 const Real trFhatinv_1 = f_inv.trace() - 1.0;
935 const Real p = trFhatinv_1 * trFhatinv_1 / 4.0;
936 const Real C1_squared = p +
937 3.0 * Utility::pow<2>(p) * (1.0 - (p + q)) / Utility::pow<2>(p + q) -
938 2.0 * Utility::pow<3>(p) * (1.0 - (p + q)) / Utility::pow<3>(p + q);
939 if (C1_squared <= 0.0)
940 mooseException(
941 "Cannot take square root of a number less than or equal to zero in the calculation of "
942 "C1 for the Rashid approximation for the rotation tensor.");
943 const Real C1 = std::sqrt(C1_squared);
944 Real C2;
945 if (q > 0.01)
946 C2 = (1.0 - C1) / (4.0 * q);
947 else
948 C2 = 0.125 + q * 0.03125 * (Utility::pow<2>(p) - 12.0 * (p - 1.0)) / Utility::pow<2>(p) +
949 Utility::pow<2>(q) * (p - 2.0) * (Utility::pow<2>(p) - 10.0 * p + 32.0) /
950 Utility::pow<3>(p) +
951 Utility::pow<3>(q) *
952 (1104.0 - 992.0 * p + 376.0 * Utility::pow<2>(p) - 72.0 * Utility::pow<3>(p) +
953 5.0 * Utility::pow<4>(p)) /
954 (512.0 * Utility::pow<4>(p));
955 const Real C3_test =
956 (p * q * (3.0 - q) + Utility::pow<3>(p) + Utility::pow<2>(q)) / Utility::pow<3>(p + q);
957 if (C3_test <= 0.0)
958 mooseException(
959 "Cannot take square root of a number less than or equal to zero in the calculation of "
960 "C3_test for the Rashid approximation for the rotation tensor.");
961 const Real C3 = 0.5 * std::sqrt(C3_test);
962 RankTwoTensor R_incr;
963 R_incr.addIa(C1);
964 for (unsigned int i = 0; i < 3; ++i)
965 for (unsigned int j = 0; j < 3; ++j)
966 R_incr(i, j) += C2 * a[i] * a[j];
967 R_incr(0, 1) += C3 * a[2];
968 R_incr(0, 2) -= C3 * a[1];
969 R_incr(1, 0) -= C3 * a[2];
970 R_incr(1, 2) += C3 * a[0];
971 R_incr(2, 0) += C3 * a[1];
972 R_incr(2, 1) -= C3 * a[0];
973 return R_incr.transpose();
974 }
975
976 // For `rashid_eigen`, `linear`, `quadratic`: r_hat = exp(dw) via Rodrigues. For RashidEigen,
977 // dw is the matrix log of the polar-decomposition R, so exp(dw) recovers that R bit-for-bit
978 // -- equivalent to OLD `ComputeFiniteStrain`'s EigenSolution rotation.
979 const Real theta2 = 0.5 * dw.doubleContraction(dw);
980 const Real theta = std::sqrt(theta2);
981 Real f, g;
982 const Real small_theta = 1.0e-7;
983 if (theta < small_theta)
984 {
985 f = 1.0 - theta2 / 6.0;
986 g = 0.5 - theta2 / 24.0;
987 }
988 else
989 {
990 f = std::sin(theta) / theta;
991 g = (1.0 - std::cos(theta)) / theta2;
992 }
993 return RankTwoTensor::Identity() + f * dw + g * dw * dw;
994}
995
Real f(Real x)
Test function for Brents method.
const double M
const Real p
const double v
@ LARGE_KINEMATICS
@ F_BAR_INCREMENTAL
void mooseError(Args &&... args)
Calculate strains to use the MOOSE materials with the Lagrangian kernels.
void computeQpLargeKinematicIncrement(const RankTwoTensor &f_inv, RankTwoTensor &dd, RankTwoTensor &dw, RankFourTensor &d_dL_d_f_inv, RankFourTensor &d_dw_d_f_inv, bool need_jacobian)
Dispatcher: compute (Deltad, Deltaw, d(Deltal)/d(f^{-1}), d(Deltaw)/d(f^{-1})) for the active kinemat...
std::vector< const VariableValue * > _disp_old
Old displacement values for the generalized midpoint rule.
void computeLinearIncrement(const RankTwoTensor &f_inv, RankTwoTensor &dd, RankTwoTensor &dw, RankFourTensor &d_dL_d_f_inv, RankFourTensor &d_dw_d_f_inv, bool need_jacobian) const
Linear approximation: dL = I - f^{-1}.
KinematicApproximation
Approximation used to convert the inverse incremental deformation gradient f^{-1} into the increment ...
const FBarMode _F_bar_mode
Selected F-bar averaging mode (Total vs. Incremental). See FBarMode.
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains_old
virtual void computeQpUnstabilizedDeformationGradient()
Calculate the unstabilized (alpha-weighted) deformation gradient at the quadrature point.
virtual void computeQpActualDeformationGradient()
Calculate the actual deformation gradient at n+1 (no alpha weighting, no F-bar)
FBarMode
What F gets F-bar volumetric correction applied to.
void computeRashidEigenIncrement(const RankTwoTensor &f_inv, RankTwoTensor &dd, RankTwoTensor &dw, RankFourTensor &d_dL_d_f_inv, RankFourTensor &d_dw_d_f_inv, bool need_jacobian) const
"Exact" via polar decomposition of f^{-1} + matrix logs.
void setQpIncrementalStrains(const RankTwoTensor &dd, const RankTwoTensor &dw)
Update strain / vorticity / mechanical-strain bookkeeping from already-split (dd, dw) tensors.
std::vector< const VariableGradient * > _grad_disp_old
Old displacement gradients for the generalized midpoint rule.
RankTwoTensor computeQpRotationIncrement(const RankTwoTensor &f_inv, const RankTwoTensor &dw) const
Rotation increment matched to the active _kinematic_approximation, suitable for publishing as _rotati...
ComputeLagrangianStrainBase(const InputParameters &parameters)
std::vector< MaterialPropertyName > _homogenization_gradient_names
Names of any extra homogenization gradients.
virtual void computeDeformationGradient()
Calculate the unstabilized and optionally the stabilized deformation gradients.
std::vector< const MaterialProperty< RankTwoTensor > * > _homogenization_contributions
Actual homogenization contributions.
const bool _stabilize_strain
If true stabilize the strains with F_bar.
const std::string _base_name
Material system base name.
virtual void subtractQpEigenstrainIncrement(RankTwoTensor &strain)
Subtract the eigenstrain increment to subtract from the total strain.
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains
void computeRashidApproximateIncrement(const RankTwoTensor &f_inv, RankTwoTensor &dd, RankTwoTensor &dw, RankFourTensor &d_dL_d_f_inv, RankFourTensor &d_dw_d_f_inv, bool need_jacobian) const
Rashid's approximate symmetric+skew formulas.
virtual void initQpStatefulProperties() override
void computeQuadraticIncrement(const RankTwoTensor &f_inv, RankTwoTensor &dd, RankTwoTensor &dw, RankFourTensor &d_dL_d_f_inv, RankFourTensor &d_dw_d_f_inv, bool need_jacobian) const
Quadratic approximation: dL = (I - f^{-1}) + 0.5 (I - f^{-1})^2.
virtual void computeQpIncrementalStrains(const RankTwoTensor &dL)
Calculate the strains based on the spatial velocity gradient.
void computeQpPolarDecomposition(bool need_jacobian)
Compute and publish the polar decomposition of _F_actual at the current qp.
std::vector< MaterialPropertyName > _eigenstrain_names
virtual void computeQpProperties() override
const bool _large_kinematics
If true the equilibrium conditions is calculated with large deformations.
std::vector< const VariableGradient * > coupledGradientsOld(const std::string &var_name) const
std::vector< const VariableValue * > coupledValuesOld(const std::string &var_name) const
virtual bool isTransient() const override
Add-on class that provides the functionality to issue guarantees for declared material properties.
void issueGuarantee(const MaterialPropertyName &prop_name, Guarantee guarantee)
void suppressParameter(const std::string &name)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
FEProblemBase & _fe_problem
static InputParameters validParams()
void mooseError(Args &&... args) const
RankFourTensorTempl< T > transposeIj() const
static RankFourTensorTempl< T > IdentityFour()
void addIa(const T &a)
T doubleContraction(const RankTwoTensorTempl< T > &a) const
RankTwoTensorTempl< T > inverse() const
RankTwoTensorTempl< T > transpose() const
static RankTwoTensorTempl Identity()
T clamp(const T &x, T2 lowerlimit, T2 upperlimit)
int eps(unsigned int i, unsigned int j)
auto elementAverage(const Functor &f, const MooseArray< Real > &JxW, const MooseArray< Real > &coord)