www.mooseframework.org
FiniteStrainUObasedCP.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 "FiniteStrainUObasedCP.h"
11 #include "petscblaslapack.h"
12 #include "MooseException.h"
17 
18 registerMooseObject("SolidMechanicsApp", FiniteStrainUObasedCP);
19 
22 {
24  params.addClassDescription("UserObject based Crystal Plasticity system.");
25  params.addParam<Real>("rtol", 1e-6, "Constitutive stress residue relative tolerance");
26  params.addParam<Real>("abs_tol", 1e-6, "Constitutive stress residue absolute tolerance");
27  params.addParam<Real>(
28  "stol", 1e-2, "Constitutive slip system resistance relative residual tolerance");
29  params.addParam<Real>(
30  "zero_tol", 1e-12, "Tolerance for residual check when variable value is zero");
31  params.addParam<unsigned int>("maxiter", 100, "Maximum number of iterations for stress update");
32  params.addParam<unsigned int>(
33  "maxiter_state_variable", 100, "Maximum number of iterations for state variable update");
34  MooseEnum tan_mod_options("exact none", "none"); // Type of read
35  params.addParam<MooseEnum>("tan_mod_type",
36  tan_mod_options,
37  "Type of tangent moduli for preconditioner: default elastic");
38  params.addParam<unsigned int>(
39  "maximum_substep_iteration", 1, "Maximum number of substep iteration");
40  params.addParam<bool>("use_line_search", false, "Use line search in constitutive update");
41  params.addParam<Real>("min_line_search_step_size", 0.01, "Minimum line search step size");
42  params.addParam<Real>("line_search_tol", 0.5, "Line search bisection method tolerance");
43  params.addParam<unsigned int>(
44  "line_search_maxiter", 20, "Line search bisection method maximum number of iteration");
45  MooseEnum line_search_method("CUT_HALF BISECTION", "CUT_HALF");
46  params.addParam<MooseEnum>(
47  "line_search_method", line_search_method, "The method used in line search");
48  params.addRequiredParam<std::vector<UserObjectName>>(
49  "uo_slip_rates",
50  "List of names of user objects that define the slip rates for this material.");
51  params.addRequiredParam<std::vector<UserObjectName>>(
52  "uo_slip_resistances",
53  "List of names of user objects that define the slip resistances for this material.");
54  params.addRequiredParam<std::vector<UserObjectName>>(
55  "uo_state_vars",
56  "List of names of user objects that define the state variable for this material.");
57  params.addRequiredParam<std::vector<UserObjectName>>(
58  "uo_state_var_evol_rate_comps",
59  "List of names of user objects that define the state "
60  "variable evolution rate components for this material.");
61  return params;
62 }
63 
65  : ComputeStressBase(parameters),
66  _num_uo_slip_rates(parameters.get<std::vector<UserObjectName>>("uo_slip_rates").size()),
67  _num_uo_slip_resistances(
68  parameters.get<std::vector<UserObjectName>>("uo_slip_resistances").size()),
69  _num_uo_state_vars(parameters.get<std::vector<UserObjectName>>("uo_state_vars").size()),
70  _num_uo_state_var_evol_rate_comps(
71  parameters.get<std::vector<UserObjectName>>("uo_state_var_evol_rate_comps").size()),
72  _rtol(getParam<Real>("rtol")),
73  _abs_tol(getParam<Real>("abs_tol")),
74  _stol(getParam<Real>("stol")),
75  _zero_tol(getParam<Real>("zero_tol")),
76  _maxiter(getParam<unsigned int>("maxiter")),
77  _maxiterg(getParam<unsigned int>("maxiter_state_variable")),
78  _tan_mod_type(getParam<MooseEnum>("tan_mod_type")),
79  _max_substep_iter(getParam<unsigned int>("maximum_substep_iteration")),
80  _use_line_search(getParam<bool>("use_line_search")),
81  _min_lsrch_step(getParam<Real>("min_line_search_step_size")),
82  _lsrch_tol(getParam<Real>("line_search_tol")),
83  _lsrch_max_iter(getParam<unsigned int>("line_search_maxiter")),
84  _lsrch_method(getParam<MooseEnum>("line_search_method")),
85  _fp(declareProperty<RankTwoTensor>("fp")), // Plastic deformation gradient
86  _fp_old(getMaterialPropertyOld<RankTwoTensor>(
87  "fp")), // Plastic deformation gradient of previous increment
88  _pk2(declareProperty<RankTwoTensor>("pk2")), // 2nd Piola-Kirchoff Stress
89  _pk2_old(getMaterialPropertyOld<RankTwoTensor>(
90  "pk2")), // 2nd Piola Kirchoff Stress of previous increment
91  _lag_e(declareProperty<RankTwoTensor>("lage")), // Lagrangian strain
92  _update_rot(declareProperty<RankTwoTensor>(
93  "update_rot")), // Rotation tensor considering material rotation and crystal orientation
94  _update_rot_old(getMaterialPropertyOld<RankTwoTensor>("update_rot")),
95  _elasticity_tensor_name(_base_name + "elasticity_tensor"),
96  _elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name)),
97  _deformation_gradient(getMaterialProperty<RankTwoTensor>("deformation_gradient")),
98  _deformation_gradient_old(getMaterialPropertyOld<RankTwoTensor>("deformation_gradient")),
99  _crysrot(getMaterialProperty<RankTwoTensor>("crysrot"))
100 {
101  _err_tol = false;
102 
103  _delta_dfgrd.zero();
104 
105  // resize the material properties for each userobject
111 
112  // resize the flow direction
114 
115  // resize local state variables
119 
120  // resize user objects
125 
126  // assign the user objects
127  for (unsigned int i = 0; i < _num_uo_slip_rates; ++i)
128  {
129  _uo_slip_rates[i] = &getUserObjectByName<CrystalPlasticitySlipRate>(
130  parameters.get<std::vector<UserObjectName>>("uo_slip_rates")[i]);
131  _mat_prop_slip_rates[i] = &declareProperty<std::vector<Real>>(
132  parameters.get<std::vector<UserObjectName>>("uo_slip_rates")[i]);
133  _flow_direction[i] = &declareProperty<std::vector<RankTwoTensor>>(
134  parameters.get<std::vector<UserObjectName>>("uo_slip_rates")[i] + "_flow_direction");
135  }
136 
137  for (unsigned int i = 0; i < _num_uo_slip_resistances; ++i)
138  {
139  _uo_slip_resistances[i] = &getUserObjectByName<CrystalPlasticitySlipResistance>(
140  parameters.get<std::vector<UserObjectName>>("uo_slip_resistances")[i]);
141  _mat_prop_slip_resistances[i] = &declareProperty<std::vector<Real>>(
142  parameters.get<std::vector<UserObjectName>>("uo_slip_resistances")[i]);
143  }
144 
145  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
146  {
147  _uo_state_vars[i] = &getUserObjectByName<CrystalPlasticityStateVariable>(
148  parameters.get<std::vector<UserObjectName>>("uo_state_vars")[i]);
149  _mat_prop_state_vars[i] = &declareProperty<std::vector<Real>>(
150  parameters.get<std::vector<UserObjectName>>("uo_state_vars")[i]);
151  _mat_prop_state_vars_old[i] = &getMaterialPropertyOld<std::vector<Real>>(
152  parameters.get<std::vector<UserObjectName>>("uo_state_vars")[i]);
153  }
154 
155  for (unsigned int i = 0; i < _num_uo_state_var_evol_rate_comps; ++i)
156  {
157  _uo_state_var_evol_rate_comps[i] = &getUserObjectByName<CrystalPlasticityStateVarRateComponent>(
158  parameters.get<std::vector<UserObjectName>>("uo_state_var_evol_rate_comps")[i]);
159  _mat_prop_state_var_evol_rate_comps[i] = &declareProperty<std::vector<Real>>(
160  parameters.get<std::vector<UserObjectName>>("uo_state_var_evol_rate_comps")[i]);
161  }
162 
163  _substep_dt = 0.0;
164 }
165 
166 void
168 {
169  for (unsigned int i = 0; i < _num_uo_slip_rates; ++i)
170  {
171  (*_mat_prop_slip_rates[i])[_qp].resize(_uo_slip_rates[i]->variableSize());
172  (*_flow_direction[i])[_qp].resize(_uo_slip_rates[i]->variableSize());
173  }
174 
175  for (unsigned int i = 0; i < _num_uo_slip_resistances; ++i)
176  (*_mat_prop_slip_resistances[i])[_qp].resize(_uo_slip_resistances[i]->variableSize());
177 
178  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
179  {
180  (*_mat_prop_state_vars[i])[_qp].resize(_uo_state_vars[i]->variableSize());
181  _state_vars_old[i].resize(_uo_state_vars[i]->variableSize());
182  _state_vars_old_stored[i].resize(_uo_state_vars[i]->variableSize());
183  _state_vars_prev[i].resize(_uo_state_vars[i]->variableSize());
184  }
185 
186  for (unsigned int i = 0; i < _num_uo_state_var_evol_rate_comps; ++i)
188  _uo_state_var_evol_rate_comps[i]->variableSize());
189 
190  _stress[_qp].zero();
191  _pk2[_qp].zero();
192  _lag_e[_qp].zero();
193 
194  _fp[_qp].setToIdentity();
195  _update_rot[_qp].setToIdentity();
196 
197  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
198  // Initializes slip system related properties
199  _uo_state_vars[i]->initSlipSysProps((*_mat_prop_state_vars[i])[_qp], _q_point[_qp]);
200 }
201 
206 void
208 {
209  // Userobject based crystal plasticity does not support face/boundary material property
210  // calculation.
211  if (isBoundaryMaterial())
212  return;
213  // Depth of substepping; Limited to maximum substep iteration
214  unsigned int substep_iter = 1;
215  // Calculated from substep_iter as 2^substep_iter
216  unsigned int num_substep = 1;
217 
219  if (_dfgrd_tmp_old.det() == 0)
220  _dfgrd_tmp_old.addIa(1.0);
221 
223 
224  // Saves the old stateful properties that are modified during sub stepping
225  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
227 
228  for (unsigned int i = 0; i < _num_uo_slip_rates; ++i)
229  _uo_slip_rates[i]->calcFlowDirection(_qp, (*_flow_direction[i])[_qp]);
230 
231  do
232  {
233  _err_tol = false;
234 
235  preSolveQp();
236 
237  _substep_dt = _dt / num_substep;
238 
239  for (unsigned int istep = 0; istep < num_substep; ++istep)
240  {
241  _dfgrd_tmp = (static_cast<Real>(istep) + 1) / num_substep * _delta_dfgrd + _dfgrd_tmp_old;
242 
243  solveQp();
244 
245  if (_err_tol)
246  {
247  substep_iter++;
248  num_substep *= 2;
249  break;
250  }
251  }
252 
253  if (substep_iter > _max_substep_iter && _err_tol)
254  throw MooseException("FiniteStrainUObasedCP: Constitutive failure.");
255  } while (_err_tol);
256 
257  postSolveQp();
258 }
259 
260 void
262 {
263  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
265 
266  _pk2[_qp] = _pk2_old[_qp];
267  _fp_old_inv = _fp_old[_qp].inverse();
268 }
269 
270 void
272 {
274  solveStatevar();
275  if (_err_tol)
276  return;
277 
279 }
280 
281 void
283 {
284  _stress[_qp] = _fe * _pk2[_qp] * _fe.transpose() / _fe.det();
285 
286  // Calculate jacobian for preconditioner
288 
290 
291  _lag_e[_qp] = _deformation_gradient[_qp].transpose() * _deformation_gradient[_qp] - iden;
292  _lag_e[_qp] = _lag_e[_qp] * 0.5;
293 
294  RankTwoTensor rot;
295  // Calculate material rotation
296  _deformation_gradient[_qp].getRUDecompositionRotation(rot);
297  _update_rot[_qp] = rot * _crysrot[_qp];
298 }
299 
300 void
302 {
303  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
305 
306  for (unsigned int i = 0; i < _num_uo_slip_resistances; ++i)
307  _uo_slip_resistances[i]->calcSlipResistance(_qp, (*_mat_prop_slip_resistances[i])[_qp]);
308 
310 }
311 
312 void
314 {
315  unsigned int iterg;
316  bool iter_flag = true;
317 
318  iterg = 0;
319  // Check for slip system resistance update tolerance
320  while (iter_flag && iterg < _maxiterg)
321  {
322  preSolveStress();
323  solveStress();
324  if (_err_tol)
325  return;
326 
327  postSolveStress();
328 
329  // Update slip system resistance and state variable
331 
332  if (_err_tol)
333  return;
334 
335  iter_flag = isStateVariablesConverged();
336  iterg++;
337  }
338 
339  if (iterg == _maxiterg)
340  {
341 #ifdef DEBUG
342  mooseWarning("FiniteStrainUObasedCP: Hardness Integration error\n");
343 #endif
344  _err_tol = true;
345  }
346 }
347 
348 bool
350 {
351  Real diff;
352 
353  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
354  {
355  unsigned int n = (*_mat_prop_state_vars[i])[_qp].size();
356  for (unsigned j = 0; j < n; j++)
357  {
358  diff = std::abs((*_mat_prop_state_vars[i])[_qp][j] - _state_vars_prev[i][j]);
359 
360  if (std::abs(_state_vars_old_stored[i][j]) < _zero_tol && diff > _zero_tol)
361  return true;
363  diff > _stol * std::abs(_state_vars_old_stored[i][j]))
364  return true;
365  }
366  }
367  return false;
368 }
369 
370 void
372 {
373  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
375 
377 }
378 
379 void
381 {
382 }
383 
384 void
386 {
387  unsigned int iter = 0;
388  RankTwoTensor dpk2;
389  Real rnorm, rnorm0, rnorm_prev;
390 
391  // Calculate stress residual
392  calcResidJacob();
393  if (_err_tol)
394  {
395 #ifdef DEBUG
396  mooseWarning("FiniteStrainUObasedCP: Slip increment exceeds tolerance - Element number ",
397  _current_elem->id(),
398  " Gauss point = ",
399  _qp);
400 #endif
401  return;
402  }
403 
404  rnorm = _resid.L2norm();
405  rnorm0 = rnorm;
406 
407  // Check for stress residual tolerance
408  while (rnorm > _rtol * rnorm0 && rnorm0 > _abs_tol && iter < _maxiter)
409  {
410  // Calculate stress increment
411  dpk2 = -_jac.invSymm() * _resid;
412  _pk2[_qp] = _pk2[_qp] + dpk2;
413 
414  calcResidJacob();
415 
416  if (_err_tol)
417  {
418 #ifdef DEBUG
419  mooseWarning("FiniteStrainUObasedCP: Slip increment exceeds tolerance - Element number ",
420  _current_elem->id(),
421  " Gauss point = ",
422  _qp);
423 #endif
424  return;
425  }
426 
427  rnorm_prev = rnorm;
428  rnorm = _resid.L2norm();
429 
430  if (_use_line_search && rnorm > rnorm_prev && !lineSearchUpdate(rnorm_prev, dpk2))
431  {
432 #ifdef DEBUG
433  mooseWarning("FiniteStrainUObasedCP: Failed with line search");
434 #endif
435  _err_tol = true;
436  return;
437  }
438 
439  if (_use_line_search)
440  rnorm = _resid.L2norm();
441 
442  iter++;
443  }
444 
445  if (iter >= _maxiter)
446  {
447 #ifdef DEBUG
448  mooseWarning("FiniteStrainUObasedCP: Stress Integration error rmax = ",
449  rnorm,
450  " and the tolerance is ",
451  _rtol * rnorm0,
452  " when the rnorm0 value is ",
453  rnorm0,
454  " for element ",
455  _current_elem->id(),
456  " and qp ",
457  _qp);
458 #endif
459  _err_tol = true;
460  }
461 }
462 
463 void
465 {
466  _fp[_qp] = _fp_inv.inverse();
467 }
468 
469 void
471 {
472  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
474 
475  for (unsigned int i = 0; i < _num_uo_state_var_evol_rate_comps; ++i)
476  _uo_state_var_evol_rate_comps[i]->calcStateVariableEvolutionRateComponent(
478 
479  for (unsigned int i = 0; i < _num_uo_state_vars; ++i)
480  {
481  if (!_uo_state_vars[i]->updateStateVariable(
483  _err_tol = true;
484  }
485 
486  for (unsigned int i = 0; i < _num_uo_slip_resistances; ++i)
487  _uo_slip_resistances[i]->calcSlipResistance(_qp, (*_mat_prop_slip_resistances[i])[_qp]);
488 }
489 
490 // Calculates stress residual equation and jacobian
491 void
493 {
494  calcResidual();
495  if (_err_tol)
496  return;
497  calcJacobian();
498 }
499 
500 void
502 {
503  for (unsigned int i = 0; i < _num_uo_slip_rates; ++i)
504  {
505  if (!_uo_slip_rates[i]->calcSlipRate(_qp, _substep_dt, (*_mat_prop_slip_rates[i])[_qp]))
506  {
507  _err_tol = true;
508  return;
509  }
510  }
511 }
512 
513 void
515 {
516  RankTwoTensor iden(RankTwoTensor::initIdentity), ce, ee, ce_pk2, eqv_slip_incr, pk2_new;
517 
518  getSlipRates();
519  if (_err_tol)
520  return;
521 
522  for (unsigned int i = 0; i < _num_uo_slip_rates; ++i)
523  for (unsigned int j = 0; j < _uo_slip_rates[i]->variableSize(); ++j)
524  eqv_slip_incr +=
526 
527  eqv_slip_incr = iden - eqv_slip_incr;
528  _fp_inv = _fp_old_inv * eqv_slip_incr;
529  _fe = _dfgrd_tmp * _fp_inv;
530 
531  ce = _fe.transpose() * _fe;
532  ee = ce - iden;
533  ee *= 0.5;
534 
535  pk2_new = _elasticity_tensor[_qp] * ee;
536 
537  _resid = _pk2[_qp] - pk2_new;
538 }
539 
540 void
542 {
543  RankFourTensor dfedfpinv, deedfe, dfpinvdpk2;
544 
545  for (const auto i : make_range(Moose::dim))
546  for (const auto j : make_range(Moose::dim))
547  for (const auto k : make_range(Moose::dim))
548  dfedfpinv(i, j, k, j) = _dfgrd_tmp(i, k);
549 
550  for (const auto i : make_range(Moose::dim))
551  for (const auto j : make_range(Moose::dim))
552  for (const auto k : make_range(Moose::dim))
553  {
554  deedfe(i, j, k, i) = deedfe(i, j, k, i) + _fe(k, j) * 0.5;
555  deedfe(i, j, k, j) = deedfe(i, j, k, j) + _fe(k, i) * 0.5;
556  }
557 
558  for (unsigned int i = 0; i < _num_uo_slip_rates; ++i)
559  {
560  unsigned int nss = _uo_slip_rates[i]->variableSize();
561  std::vector<RankTwoTensor> dtaudpk2(nss), dfpinvdslip(nss);
562  std::vector<Real> dslipdtau;
563  dslipdtau.resize(nss);
564  _uo_slip_rates[i]->calcSlipRateDerivative(_qp, _substep_dt, dslipdtau);
565  for (unsigned int j = 0; j < nss; j++)
566  {
567  dtaudpk2[j] = (*_flow_direction[i])[_qp][j];
568  dfpinvdslip[j] = -_fp_old_inv * (*_flow_direction[i])[_qp][j];
569  dfpinvdpk2 += (dfpinvdslip[j] * dslipdtau[j] * _substep_dt).outerProduct(dtaudpk2[j]);
570  }
571  }
572  _jac =
573  RankFourTensor::IdentityFour() - (_elasticity_tensor[_qp] * deedfe * dfedfpinv * dfpinvdpk2);
574 }
575 
576 void
578 {
579  switch (_tan_mod_type)
580  {
581  case 0:
583  break;
584  default:
586  }
587 }
588 
589 void
591 {
592  RankFourTensor tan_mod;
593  RankTwoTensor pk2fet, fepk2;
594  RankFourTensor deedfe, dsigdpk2dfe, dfedf;
595 
596  // Fill in the matrix stiffness material property
597  for (const auto i : make_range(Moose::dim))
598  for (const auto j : make_range(Moose::dim))
599  for (const auto k : make_range(Moose::dim))
600  {
601  deedfe(i, j, k, i) = deedfe(i, j, k, i) + _fe(k, j) * 0.5;
602  deedfe(i, j, k, j) = deedfe(i, j, k, j) + _fe(k, i) * 0.5;
603  }
604 
605  usingTensorIndices(i_, j_, k_, l_);
606  dsigdpk2dfe = _fe.times<i_, k_, j_, l_>(_fe) * _elasticity_tensor[_qp] * deedfe;
607 
608  pk2fet = _pk2[_qp] * _fe.transpose();
609  fepk2 = _fe * _pk2[_qp];
610 
611  for (const auto i : make_range(Moose::dim))
612  for (const auto j : make_range(Moose::dim))
613  for (const auto l : make_range(Moose::dim))
614  {
615  tan_mod(i, j, i, l) += pk2fet(l, j);
616  tan_mod(i, j, j, l) += fepk2(i, l);
617  }
618 
619  tan_mod += dsigdpk2dfe;
620 
621  Real je = _fe.det();
622  if (je > 0.0)
623  tan_mod /= je;
624 
625  for (const auto i : make_range(Moose::dim))
626  for (const auto j : make_range(Moose::dim))
627  for (const auto l : make_range(Moose::dim))
628  dfedf(i, j, i, l) = _fp_inv(l, j);
629 
630  _Jacobian_mult[_qp] = tan_mod * dfedf;
631 }
632 
633 void
635 {
636  // update jacobian_mult
638 }
639 
640 bool
641 FiniteStrainUObasedCP::lineSearchUpdate(const Real rnorm_prev, const RankTwoTensor dpk2)
642 {
643  switch (_lsrch_method)
644  {
645  case 0: // CUT_HALF
646  {
647  Real rnorm;
648  Real step = 1.0;
649 
650  do
651  {
652  _pk2[_qp] = _pk2[_qp] - step * dpk2;
653  step /= 2.0;
654  _pk2[_qp] = _pk2[_qp] + step * dpk2;
655 
656  calcResidual();
657  rnorm = _resid.L2norm();
658  } while (rnorm > rnorm_prev && step > _min_lsrch_step);
659 
660  // has norm improved or is the step still above minumum search step size?
661  return (rnorm <= rnorm_prev || step > _min_lsrch_step);
662  }
663 
664  case 1: // BISECTION
665  {
666  unsigned int count = 0;
667  Real step_a = 0.0;
668  Real step_b = 1.0;
669  Real step = 1.0;
670  Real s_m = 1000.0;
671  Real rnorm = 1000.0;
672 
673  calcResidual();
674  Real s_b = _resid.doubleContraction(dpk2);
675  Real rnorm1 = _resid.L2norm();
676  _pk2[_qp] = _pk2[_qp] - dpk2;
677  calcResidual();
678  Real s_a = _resid.doubleContraction(dpk2);
679  Real rnorm0 = _resid.L2norm();
680  _pk2[_qp] = _pk2[_qp] + dpk2;
681 
682  if ((rnorm1 / rnorm0) < _lsrch_tol || s_a * s_b > 0)
683  {
684  calcResidual();
685  return true;
686  }
687 
688  while ((rnorm / rnorm0) > _lsrch_tol && count < _lsrch_max_iter)
689  {
690  _pk2[_qp] = _pk2[_qp] - step * dpk2;
691  step = 0.5 * (step_b + step_a);
692  _pk2[_qp] = _pk2[_qp] + step * dpk2;
693  calcResidual();
694  s_m = _resid.doubleContraction(dpk2);
695  rnorm = _resid.L2norm();
696 
697  if (s_m * s_a < 0.0)
698  {
699  step_b = step;
700  s_b = s_m;
701  }
702  if (s_m * s_b < 0.0)
703  {
704  step_a = step;
705  s_a = s_m;
706  }
707  count++;
708  }
709 
710  // below tolerance and max iterations?
711  return ((rnorm / rnorm0) < _lsrch_tol && count < _lsrch_max_iter);
712  }
713 
714  default:
715  mooseError("Line search method is not provided.");
716  }
717 }
const MooseArray< Point > & _q_point
virtual bool isStateVariablesConverged()
evaluates convergence of state variables.
const MaterialProperty< RankTwoTensor > & _pk2_old
MaterialProperty< RankFourTensor > & _Jacobian_mult
derivative of stress w.r.t. strain (_dstress_dstrain)
RankTwoTensorTempl< Real > inverse() const
std::vector< std::vector< Real > > _state_vars_old
Local state variable.
ComputeStressBase is the base class for stress tensors computed from MOOSE&#39;s strain calculators...
virtual void postSolveStatevar()
update internal variable after solve.
bool _err_tol
Flag to check whether convergence is achieved.
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_slip_rates
Slip rates material property.
Real _stol
Internal variable update equation tolerance.
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_state_var_evol_rate_comps
State variable evolution rate component material property.
std::vector< const CrystalPlasticitySlipResistance * > _uo_slip_resistances
User objects that define the slip resistance.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static RankFourTensorTempl< Real > IdentityFour()
MooseEnum _tan_mod_type
Type of tangent moduli calculation.
unsigned int _lsrch_max_iter
Line search bisection method maximum iteration number.
Real _zero_tol
Residual tolerance when variable value is zero. Default 1e-12.
static InputParameters validParams()
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
FiniteStrainUObasedCP(const InputParameters &parameters)
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_slip_resistances
Slip resistance material property.
std::vector< const CrystalPlasticityStateVarRateComponent * > _uo_state_var_evol_rate_comps
User objects that define the state variable evolution rate component.
virtual void initQpStatefulProperties()
initializes the stateful properties such as stress, plastic deformation gradient, slip system resista...
std::vector< std::vector< Real > > _state_vars_old_stored
Local stored state variable (for sub-stepping)
RankTwoTensor _delta_dfgrd
Used for substepping; Uniformly divides the increment in deformation gradient.
static constexpr std::size_t dim
static InputParameters validParams()
std::vector< std::vector< Real > > _state_vars_prev
Local old state variable.
unsigned int _maxiter
Maximum number of iterations for stress update.
std::vector< const CrystalPlasticityStateVariable * > _uo_state_vars
User objects that define the state variable.
virtual void calcTangentModuli()
calculate the tangent moduli for preconditioner.
virtual bool isBoundaryMaterial() const override
void mooseWarning(Args &&... args) const
virtual void calcResidJacob()
calls the residual and jacobian functions used in the stress update algorithm.
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual void updateSlipSystemResistanceAndStateVariable()
updates the slip system resistances and state variables.
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
virtual void calcResidual()
calculate stress residual.
virtual void computeQpStress()
updates the stress at a quadrature point.
virtual void postSolveQp()
update stress and internal variable after solve.
MaterialProperty< RankTwoTensor > & _fp
virtual void getSlipRates()
updates the slip rates.
Real _lsrch_tol
Line search bisection method tolerance.
virtual void postSolveStress()
update stress and plastic deformation gradient after solve.
virtual void preSolveStress()
set variables for stress solve.
unsigned int _num_uo_slip_rates
Number of slip rate user objects.
unsigned int _maxiterg
Maximum number of iterations for internal variable update.
void addIa(const Real &a)
const MaterialProperty< RankTwoTensor > & _deformation_gradient
std::vector< const CrystalPlasticitySlipRate * > _uo_slip_rates
User objects that define the slip rate.
RankFourTensor _jac
Jacobian tensor.
Real doubleContraction(const RankTwoTensorTempl< Real > &a) const
unsigned int _num_uo_state_vars
Number of state variable user objects.
unsigned int _num_uo_slip_resistances
Number of slip resistance user objects.
MaterialProperty< RankTwoTensor > & _lag_e
unsigned int _num_uo_state_var_evol_rate_comps
Number of state variable evolution rate component user objects.
Real _rtol
Stress residual equation relative tolerance.
FiniteStrainUObasedCP uses the multiplicative decomposition of deformation gradient and solves the PK...
bool lineSearchUpdate(const Real rnorm_prev, const RankTwoTensor)
performs the line search update
virtual void preSolveQp()
set variables for stress and internal variable solve.
Real _substep_dt
Current substep size.
virtual void elastoPlasticTangentModuli()
calculate the exact tangent moduli for preconditioner.
const MaterialProperty< RankTwoTensor > & _crysrot
Crystal rotation.
virtual void elasticTangentModuli()
calculate the elastic tangent moduli for preconditioner.
RankTwoTensorTempl< Real > transpose() const
std::vector< const MaterialProperty< std::vector< Real > > * > _mat_prop_state_vars_old
Old state variable material property.
virtual void preSolveStatevar()
set variables for internal variable solve.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RankFourTensorTempl< Real > times(const RankTwoTensorTempl< Real > &b) const
MaterialProperty< RankTwoTensor > & _update_rot
virtual void solveQp()
solve stress and internal variables.
RankTwoTensor _resid
Residual tensor.
IntRange< T > make_range(T beg, T end)
bool _use_line_search
Flag to activate line serach.
void mooseError(Args &&... args) const
const MaterialProperty< RankTwoTensor > & _fp_old
unsigned int _max_substep_iter
Maximum number of substep iterations.
Real _abs_tol
Stress residual equation absolute tolerance.
void addClassDescription(const std::string &doc_string)
const InputParameters & parameters() const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
MaterialProperty< RankTwoTensor > & _stress
Stress material property.
virtual void solveStatevar()
solve internal variables.
const MaterialProperty< RankTwoTensor > & _deformation_gradient_old
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_state_vars
State variable material property.
const MaterialProperty< RankFourTensor > & _elasticity_tensor
Elasticity tensor material property.
std::vector< MaterialProperty< std::vector< RankTwoTensor > > * > _flow_direction
Real _min_lsrch_step
Minimum line search step size.
registerMooseObject("SolidMechanicsApp", FiniteStrainUObasedCP)
virtual void solveStress()
solves for stress, updates plastic deformation gradient.
MooseEnum _lsrch_method
Line search method.
RankFourTensorTempl< T > invSymm() const
static const std::string k
Definition: NS.h:124
void ErrorVector unsigned int
const Elem & get(const ElemType type_in)
MaterialProperty< RankTwoTensor > & _pk2
virtual void calcJacobian()
calculate jacobian.