www.mooseframework.org
MultiParameterPlasticityStressUpdate.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 #include "Conversion.h" // for stringify
12 #include "MooseEnum.h" // for enum
13 
14 // libMesh includes
15 #include "libmesh/utility.h" // for Utility::pow
16 
17 // PETSc includes
18 #include <petscblaslapack.h> // LAPACKgesv_
19 
21 
22 InputParameters
24 {
25  InputParameters params = StressUpdateBase::validParams();
26  params.addClassDescription("Return-map and Jacobian algorithms for plastic models where the "
27  "yield function and flow directions depend on multiple functions of "
28  "stress");
29  params.addRangeCheckedParam<unsigned int>(
30  "max_NR_iterations",
31  20,
32  "max_NR_iterations>0",
33  "Maximum number of Newton-Raphson iterations allowed during the return-map algorithm");
34  params.addParam<bool>("perform_finite_strain_rotations",
35  false,
36  "Tensors are correctly rotated "
37  "in finite-strain simulations. "
38  "For optimal performance you can "
39  "set this to 'false' if you are "
40  "only ever using small strains");
41  params.addRequiredParam<Real>(
42  "smoothing_tol",
43  "Intersections of the yield surfaces will be smoothed by this amount (this "
44  "is measured in units of stress). Often this is related to other physical "
45  "parameters (eg, 0.1*cohesion) but it is important to set this small enough "
46  "so that the individual yield surfaces do not mix together in the smoothing "
47  "process to produce a result where no stress is admissible (for example, "
48  "mixing together tensile and compressive failure envelopes).");
49  params.addRequiredParam<Real>("yield_function_tol",
50  "The return-map process will be deemed to have converged if all "
51  "yield functions are within yield_function_tol of zero. If this "
52  "is set very low then precision-loss might be encountered: if the "
53  "code detects precision loss then it also deems the return-map "
54  "process has converged.");
55  MooseEnum tangent_operator("elastic nonlinear", "nonlinear");
56  params.addParam<Real>("min_step_size",
57  1.0,
58  "In order to help the Newton-Raphson procedure, the applied strain "
59  "increment may be applied in sub-increments of size greater than this "
60  "value. Usually it is better for Moose's nonlinear convergence to "
61  "increase max_NR_iterations rather than decrease this parameter.");
62  params.addParam<bool>("warn_about_precision_loss",
63  false,
64  "Output a message to the console every "
65  "time precision-loss is encountered "
66  "during the Newton-Raphson process");
67  params.addParam<std::vector<Real>>("admissible_stress",
68  "A single admissible value of the value of the stress "
69  "parameters for internal parameters = 0. This is used "
70  "to initialize the return-mapping algorithm during the first "
71  "nonlinear iteration. If not given then it is assumed that "
72  "stress parameters = 0 is admissible.");
73  MooseEnum smoother_fcn_enum("cos poly1 poly2 poly3", "cos");
74  params.addParam<MooseEnum>("smoother_function_type",
75  smoother_fcn_enum,
76  "Type of smoother function to use. 'cos' means (-a/pi)cos(pi x/2/a), "
77  "'polyN' means a polynomial of degree 2N+2");
78  params.addParamNamesToGroup("smoother_function_type", "Advanced");
79  return params;
80 }
81 
83  const InputParameters & parameters, unsigned num_sp, unsigned num_yf, unsigned num_intnl)
84  : StressUpdateBase(parameters),
85  _num_sp(num_sp),
86  _definitely_ok_sp(isParamValid("admissible_stress")
87  ? getParam<std::vector<Real>>("admissible_stress")
88  : std::vector<Real>(_num_sp, 0.0)),
89  _Eij(num_sp, std::vector<Real>(num_sp)),
90  _En(1.0),
91  _Cij(num_sp, std::vector<Real>(num_sp)),
92  _num_yf(num_yf),
93  _num_intnl(num_intnl),
94  _max_nr_its(getParam<unsigned>("max_NR_iterations")),
95  _perform_finite_strain_rotations(getParam<bool>("perform_finite_strain_rotations")),
96  _smoothing_tol(getParam<Real>("smoothing_tol")),
97  _smoothing_tol2(Utility::pow<2>(getParam<Real>("smoothing_tol"))),
98  _f_tol(getParam<Real>("yield_function_tol")),
99  _f_tol2(Utility::pow<2>(getParam<Real>("yield_function_tol"))),
100  _min_step_size(getParam<Real>("min_step_size")),
101  _step_one(declareRestartableData<bool>("step_one", true)),
102  _warn_about_precision_loss(getParam<bool>("warn_about_precision_loss")),
103 
104  _plastic_strain(declareProperty<RankTwoTensor>(_base_name + "plastic_strain")),
105  _plastic_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "plastic_strain")),
106  _intnl(declareProperty<std::vector<Real>>(_base_name + "plastic_internal_parameter")),
107  _intnl_old(
108  getMaterialPropertyOld<std::vector<Real>>(_base_name + "plastic_internal_parameter")),
109  _yf(declareProperty<std::vector<Real>>(_base_name + "plastic_yield_function")),
110  _iter(declareProperty<Real>(_base_name +
111  "plastic_NR_iterations")), // this is really an unsigned int, but
112  // for visualisation i convert it to Real
113  _max_iter_used(declareProperty<Real>(
114  _base_name + "max_plastic_NR_iterations")), // this is really an unsigned int, but
115  // for visualisation i convert it to Real
116  _max_iter_used_old(getMaterialPropertyOld<Real>(_base_name + "max_plastic_NR_iterations")),
117  _linesearch_needed(
118  declareProperty<Real>(_base_name + "plastic_linesearch_needed")), // this is really a
119  // boolean, but for
120  // visualisation i
121  // convert it to Real
122  _trial_sp(num_sp),
123  _stress_trial(RankTwoTensor()),
124  _rhs(num_sp + 1),
125  _dvar_dtrial(num_sp + 1, std::vector<Real>(num_sp, 0.0)),
126  _ok_sp(num_sp),
127  _ok_intnl(num_intnl),
128  _del_stress_params(num_sp),
129  _current_sp(num_sp),
130  _current_intnl(num_intnl),
131  _smoother_function_type(
132  parameters.get<MooseEnum>("smoother_function_type").getEnum<SmootherFunctionType>())
133 {
134  if (_definitely_ok_sp.size() != _num_sp)
135  mooseError("MultiParameterPlasticityStressUpdate: admissible_stress parameter must consist of ",
136  _num_sp,
137  " numbers");
138 }
139 
140 void
142 {
143  _plastic_strain[_qp].zero();
144  _intnl[_qp].assign(_num_intnl, 0);
145  _yf[_qp].assign(_num_yf, 0);
146  _iter[_qp] = 0.0;
147  _max_iter_used[_qp] = 0.0;
148  _linesearch_needed[_qp] = 0.0;
149 }
150 
151 void
153 {
155  std::copy(_intnl_old[_qp].begin(), _intnl_old[_qp].end(), _intnl[_qp].begin());
157 }
158 
159 void
161  RankTwoTensor & inelastic_strain_increment,
162  const RankTwoTensor & rotation_increment,
163  RankTwoTensor & stress_new,
164  const RankTwoTensor & stress_old,
165  const RankFourTensor & elasticity_tensor,
166  const RankTwoTensor & /*elastic_strain_old*/,
167  bool compute_full_tangent_operator,
168  RankFourTensor & tangent_operator)
169 {
170  // Size _yf[_qp] appropriately
171  _yf[_qp].assign(_num_yf, 0);
172  // _plastic_strain and _intnl are usually sized appropriately because they are stateful, but this
173  // Material may be used from a DiracKernel where stateful materials are not allowed. The best we
174  // can do is:
175  if (_intnl[_qp].size() != _num_intnl)
177 
179 
180  if (_t_step >= 2)
181  _step_one = false;
182 
183  // initially assume an elastic deformation
184  std::copy(_intnl_old[_qp].begin(), _intnl_old[_qp].end(), _intnl[_qp].begin());
185 
186  _iter[_qp] = 0.0;
187  _max_iter_used[_qp] = std::max(_max_iter_used[_qp], _max_iter_used_old[_qp]);
188  _linesearch_needed[_qp] = 0.0;
189 
190  computeStressParams(stress_new, _trial_sp);
192 
193  if (yieldF(_yf[_qp]) <= _f_tol)
194  {
196  inelastic_strain_increment.zero();
197  if (_fe_problem.currentlyComputingJacobian())
198  tangent_operator = elasticity_tensor;
199  return;
200  }
201 
202  _stress_trial = stress_new;
203  /* The trial stress must be inadmissible
204  * so we need to return to the yield surface. The following
205  * equations must be satisfied.
206  *
207  * 0 = rhs[0] = S[0] - S[0]^trial + ga * E[0, i] * dg/dS[i]
208  * 0 = rhs[1] = S[1] - S[1]^trial + ga * E[1, i] * dg/dS[i]
209  * ...
210  * 0 = rhs[N-1] = S[N-1] - S[N-1]^trial + ga * E[N-1, i] * dg/dS[i]
211  * 0 = rhs[N] = f(S, intnl)
212  *
213  * as well as equations defining intnl parameters as functions of
214  * stress_params, trial_stress_params and intnl_old
215  *
216  * The unknowns are S[0], ..., S[N-1], gaE, and the intnl parameters.
217  * Here gaE = ga * _En (the _En serves to make gaE similar magnitude to S)
218  * I find it convenient to solve the first N+1 equations for p, q and gaE,
219  * while substituting the "intnl parameters" equations into these during the solve process
220  */
221 
222  for (auto & deriv : _dvar_dtrial)
223  deriv.assign(_num_sp, 0.0);
224 
225  preReturnMapV(_trial_sp, stress_new, _intnl_old[_qp], _yf[_qp], elasticity_tensor);
226 
227  setEffectiveElasticity(elasticity_tensor);
228 
229  if (_step_one)
230  std::copy(_definitely_ok_sp.begin(), _definitely_ok_sp.end(), _ok_sp.begin());
231  else
232  computeStressParams(stress_old, _ok_sp);
233  std::copy(_intnl_old[_qp].begin(), _intnl_old[_qp].end(), _ok_intnl.begin());
234 
235  // Return-map problem: must apply the following changes in stress_params,
236  // and find the returned stress_params and gaE
237  for (unsigned i = 0; i < _num_sp; ++i)
238  _del_stress_params[i] = _trial_sp[i] - _ok_sp[i];
239 
240  Real step_taken = 0.0; // amount of del_stress_params that we've applied and the return-map
241  // problem has succeeded
242  Real step_size = 1.0; // potentially can apply del_stress_params in substeps
243  Real gaE_total = 0.0;
244 
245  // current values of the yield function, derivatives, etc
246  yieldAndFlow smoothed_q;
247 
248  // In the following sub-stepping procedure it is possible that
249  // the last step is an elastic step, and therefore smoothed_q won't
250  // be computed on the last step, so we have to compute it.
251  bool smoothed_q_calculated = false;
252 
253  while (step_taken < 1.0 && step_size >= _min_step_size)
254  {
255  if (1.0 - step_taken < step_size)
256  // prevent over-shoots of substepping
257  step_size = 1.0 - step_taken;
258 
259  // trial variables in terms of admissible variables
260  for (unsigned i = 0; i < _num_sp; ++i)
261  _trial_sp[i] = _ok_sp[i] + step_size * _del_stress_params[i];
262 
263  // initialize variables that are to be found via Newton-Raphson
265  Real gaE = 0.0;
266 
267  // flags indicating failure of Newton-Raphson and line-search
268  int nr_failure = 0;
269  int ls_failure = 0;
270 
271  // NR iterations taken in this substep
272  unsigned step_iter = 0;
273 
274  // The residual-squared for the line-search
275  Real res2 = 0.0;
276 
277  if (step_size < 1.0 && yieldF(_trial_sp, _ok_intnl) <= _f_tol)
278  // This is an elastic step
279  // The "step_size < 1.0" in above condition is for efficiency: we definitely
280  // know that this is a plastic step if step_size = 1.0
281  smoothed_q_calculated = false;
282  else
283  {
284  // this is a plastic step
285 
286  // initialize current_sp, gaE and current_intnl based on the non-smoothed situation
288  // and find the smoothed yield function, flow potential and derivatives
290  smoothed_q_calculated = true;
291  calculateRHS(_trial_sp, _current_sp, gaE, smoothed_q, _rhs);
292  res2 = calculateRes2(_rhs);
293 
294  // Perform a Newton-Raphson with linesearch to get current_sp, gaE, and also smoothed_q
295  while (res2 > _f_tol2 && step_iter < _max_nr_its && nr_failure == 0 && ls_failure == 0)
296  {
297  // solve the linear system and store the answer (the "updates") in rhs
298  nr_failure = nrStep(smoothed_q, _trial_sp, _current_sp, _current_intnl, gaE, _rhs);
299  if (nr_failure != 0)
300  break;
301 
302  // handle precision loss
303  if (precisionLoss(_rhs, _current_sp, gaE))
304  {
306  {
307  Moose::err << "MultiParameterPlasticityStressUpdate: precision-loss in element "
308  << _current_elem->id() << " quadpoint=" << _qp << ". Stress_params =";
309  for (unsigned i = 0; i < _num_sp; ++i)
310  Moose::err << " " << _current_sp[i];
311  Moose::err << " gaE = " << gaE << "\n";
312  }
313  res2 = 0.0;
314  break;
315  }
316 
317  // apply (parts of) the updates, re-calculate smoothed_q, and res2
318  ls_failure = lineSearch(res2,
319  _current_sp,
320  gaE,
321  _trial_sp,
322  smoothed_q,
323  _ok_intnl,
325  _rhs,
326  _linesearch_needed[_qp]);
327  step_iter++;
328  }
329  }
330  if (res2 <= _f_tol2 && step_iter < _max_nr_its && nr_failure == 0 && ls_failure == 0 &&
331  gaE >= 0.0)
332  {
333  // this Newton-Raphson worked fine, or this was an elastic step
334  std::copy(_current_sp.begin(), _current_sp.end(), _ok_sp.begin());
335  gaE_total += gaE;
336  step_taken += step_size;
338  std::copy(_intnl[_qp].begin(), _intnl[_qp].end(), _ok_intnl.begin());
339  // calculate dp/dp_trial, dp/dq_trial, etc, for Jacobian
340  dVardTrial(!smoothed_q_calculated,
341  _trial_sp,
342  _ok_sp,
343  gaE,
344  _ok_intnl,
345  smoothed_q,
346  step_size,
347  compute_full_tangent_operator,
348  _dvar_dtrial);
349  if (static_cast<Real>(step_iter) > _iter[_qp])
350  _iter[_qp] = static_cast<Real>(step_iter);
351  if (static_cast<Real>(step_iter) > _max_iter_used[_qp])
352  _max_iter_used[_qp] = static_cast<Real>(step_iter);
353  step_size *= 1.1;
354  }
355  else
356  {
357  // Newton-Raphson + line-search process failed
358  step_size *= 0.5;
359  }
360  }
361 
362  if (step_size < _min_step_size)
363  errorHandler("MultiParameterPlasticityStressUpdate: Minimum step-size violated");
364 
365  // success!
366  finalizeReturnProcess(rotation_increment);
367  yieldFunctionValuesV(_ok_sp, _intnl[_qp], _yf[_qp]);
368 
369  if (!smoothed_q_calculated)
370  smoothed_q = smoothAllQuantities(_ok_sp, _intnl[_qp]);
371 
373  _stress_trial, _ok_sp, gaE_total, _intnl[_qp], smoothed_q, elasticity_tensor, stress_new);
374 
376  gaE_total,
377  smoothed_q,
378  elasticity_tensor,
379  stress_new,
380  inelastic_strain_increment);
381 
382  strain_increment = strain_increment - inelastic_strain_increment;
383  _plastic_strain[_qp] = _plastic_strain_old[_qp] + inelastic_strain_increment;
384 
385  if (_fe_problem.currentlyComputingJacobian())
386  // for efficiency, do not compute the tangent operator if not currently computing Jacobian
388  _trial_sp,
389  stress_new,
390  _ok_sp,
391  gaE_total,
392  smoothed_q,
393  elasticity_tensor,
394  compute_full_tangent_operator,
395  _dvar_dtrial,
396  tangent_operator);
397 }
398 
400 MultiParameterPlasticityStressUpdate::smoothAllQuantities(const std::vector<Real> & stress_params,
401  const std::vector<Real> & intnl) const
402 {
403  std::vector<yieldAndFlow> all_q(_num_yf, yieldAndFlow(_num_sp, _num_intnl));
404  computeAllQV(stress_params, intnl, all_q);
405 
406  /* This routine holds the key to my smoothing strategy. It
407  * may be proved that this smoothing strategy produces a
408  * yield surface that is both C2 differentiable and convex,
409  * assuming the individual yield functions are C2 and
410  * convex too.
411  * Of course all the derivatives must also be smoothed.
412  * Also, I assume that d(flow potential)/dstress gets smoothed
413  * by the Yield Function (which produces a C2 flow potential).
414  * See the line identified in the loop below.
415  * Only time will tell whether this is a good strategy, but it
416  * works well in all tests so far. Convexity is irrelevant
417  * for the non-associated case, but at least the return-map
418  * problem should always have a unique solution.
419  * For two yield functions+flows, labelled 1 and 2, we
420  * should have
421  * d(g1 - g2) . d(f1 - f2) >= 0
422  * If not then the return-map problem for even the
423  * multi-surface plasticity with no smoothing won't have a
424  * unique solution. If the multi-surface plasticity has
425  * a unique solution then the smoothed version defined
426  * below will too.
427  */
428 
429  // res_f is the index that contains the smoothed yieldAndFlow
430  std::size_t res_f = 0;
431 
432  for (std::size_t a = 1; a < all_q.size(); ++a)
433  {
434  if (all_q[res_f].f >= all_q[a].f + _smoothing_tol)
435  // no smoothing is needed: res_f is already indexes the largest yield function
436  continue;
437  else if (all_q[a].f >= all_q[res_f].f + _smoothing_tol)
438  {
439  // no smoothing is needed, and res_f needs to index to all_q[a]
440  res_f = a;
441  continue;
442  }
443  else
444  {
445  // smoothing is required
446  const Real f_diff = all_q[res_f].f - all_q[a].f;
447  const Real ism = ismoother(f_diff);
448  const Real sm = smoother(f_diff);
449  const Real dsm = dsmoother(f_diff);
450  // we want: all_q[res_f].f = 0.5 * all_q[res_f].f + all_q[a].f + _smoothing_tol) + ism,
451  // but we have to do the derivatives first
452  for (unsigned i = 0; i < _num_sp; ++i)
453  {
454  for (unsigned j = 0; j < _num_sp; ++j)
455  all_q[res_f].d2g[i][j] =
456  0.5 * (all_q[res_f].d2g[i][j] + all_q[a].d2g[i][j]) +
457  dsm * (all_q[res_f].df[j] - all_q[a].df[j]) * (all_q[res_f].dg[i] - all_q[a].dg[i]) +
458  sm * (all_q[res_f].d2g[i][j] - all_q[a].d2g[i][j]);
459  for (unsigned j = 0; j < _num_intnl; ++j)
460  all_q[res_f].d2g_di[i][j] = 0.5 * (all_q[res_f].d2g_di[i][j] + all_q[a].d2g_di[i][j]) +
461  dsm * (all_q[res_f].df_di[j] - all_q[a].df_di[j]) *
462  (all_q[res_f].dg[i] - all_q[a].dg[i]) +
463  sm * (all_q[res_f].d2g_di[i][j] - all_q[a].d2g_di[i][j]);
464  }
465  for (unsigned i = 0; i < _num_sp; ++i)
466  {
467  all_q[res_f].df[i] = 0.5 * (all_q[res_f].df[i] + all_q[a].df[i]) +
468  sm * (all_q[res_f].df[i] - all_q[a].df[i]);
469  // whether the following (smoothing g with f's smoother) is a good strategy remains to be
470  // seen...
471  all_q[res_f].dg[i] = 0.5 * (all_q[res_f].dg[i] + all_q[a].dg[i]) +
472  sm * (all_q[res_f].dg[i] - all_q[a].dg[i]);
473  }
474  for (unsigned i = 0; i < _num_intnl; ++i)
475  all_q[res_f].df_di[i] = 0.5 * (all_q[res_f].df_di[i] + all_q[a].df_di[i]) +
476  sm * (all_q[res_f].df_di[i] - all_q[a].df_di[i]);
477  all_q[res_f].f = 0.5 * (all_q[res_f].f + all_q[a].f + _smoothing_tol) + ism;
478  }
479  }
480  return all_q[res_f];
481 }
482 
483 Real
485 {
486  if (std::abs(f_diff) >= _smoothing_tol)
487  return 0.0;
488  switch (_smoother_function_type)
489  {
491  return -_smoothing_tol / M_PI * std::cos(0.5 * M_PI * f_diff / _smoothing_tol);
493  return 0.75 / _smoothing_tol *
494  (0.5 * (Utility::pow<2>(f_diff) - _smoothing_tol2) -
495  (_smoothing_tol2 / 12.0) * (Utility::pow<4>(f_diff / _smoothing_tol) - 1.0));
497  return 0.625 / _smoothing_tol *
498  (0.5 * (Utility::pow<2>(f_diff) - _smoothing_tol2) -
499  (_smoothing_tol2 / 30.0) * (Utility::pow<6>(f_diff / _smoothing_tol) - 1.0));
501  return (7.0 / 12.0 / _smoothing_tol) *
502  (0.5 * (Utility::pow<2>(f_diff) - _smoothing_tol2) -
503  (_smoothing_tol2 / 56.0) * (Utility::pow<8>(f_diff / _smoothing_tol) - 1.0));
504  default:
505  return 0.0;
506  }
507 }
508 
509 Real
511 {
512  if (std::abs(f_diff) >= _smoothing_tol)
513  return 0.0;
514  switch (_smoother_function_type)
515  {
517  return 0.5 * std::sin(f_diff * M_PI * 0.5 / _smoothing_tol);
519  return 0.75 / _smoothing_tol *
520  (f_diff - (_smoothing_tol / 3.0) * Utility::pow<3>(f_diff / _smoothing_tol));
522  return 0.625 / _smoothing_tol *
523  (f_diff - (_smoothing_tol / 5.0) * Utility::pow<5>(f_diff / _smoothing_tol));
525  return (7.0 / 12.0 / _smoothing_tol) *
526  (f_diff - (_smoothing_tol / 7.0) * Utility::pow<7>(f_diff / _smoothing_tol));
527  default:
528  return 0.0;
529  }
530 }
531 
532 Real
534 {
535  if (std::abs(f_diff) >= _smoothing_tol)
536  return 0.0;
537  switch (_smoother_function_type)
538  {
540  return 0.25 * M_PI / _smoothing_tol * std::cos(f_diff * M_PI * 0.5 / _smoothing_tol);
542  return 0.75 / _smoothing_tol * (1.0 - Utility::pow<2>(f_diff / _smoothing_tol));
544  return 0.625 / _smoothing_tol * (1.0 - Utility::pow<4>(f_diff / _smoothing_tol));
546  return (7.0 / 12.0 / _smoothing_tol) * (1.0 - Utility::pow<6>(f_diff / _smoothing_tol));
547  default:
548  return 0.0;
549  }
550 }
551 
552 int
554  std::vector<Real> & stress_params,
555  Real & gaE,
556  const std::vector<Real> & trial_stress_params,
557  yieldAndFlow & smoothed_q,
558  const std::vector<Real> & intnl_ok,
559  std::vector<Real> & intnl,
560  std::vector<Real> & rhs,
561  Real & linesearch_needed) const
562 {
563  const Real res2_old = res2;
564  const std::vector<Real> sp_params_old = stress_params;
565  const Real gaE_old = gaE;
566  const std::vector<Real> delta_nr_params = rhs;
567 
568  Real lam = 1.0; // line-search parameter
569  const Real lam_min = 1E-10; // minimum value of lam allowed
570  const Real slope = -2.0 * res2_old; // "Numerical Recipes" uses -b*A*x, in order to check for
571  // roundoff, but i hope the nrStep would warn if there were
572  // problems
573  Real tmp_lam; // cached value of lam used in quadratic & cubic line search
574  Real f2 = res2_old; // cached value of f = residual2 used in the cubic in the line search
575  Real lam2 = lam; // cached value of lam used in the cubic in the line search
576 
577  while (true)
578  {
579  // update variables using the current line-search parameter
580  for (unsigned i = 0; i < _num_sp; ++i)
581  stress_params[i] = sp_params_old[i] + lam * delta_nr_params[i];
582  gaE = gaE_old + lam * delta_nr_params[_num_sp];
583 
584  // and internal parameters
585  setIntnlValuesV(trial_stress_params, stress_params, intnl_ok, intnl);
586 
587  smoothed_q = smoothAllQuantities(stress_params, intnl);
588 
589  // update rhs for next-time through
590  calculateRHS(trial_stress_params, stress_params, gaE, smoothed_q, rhs);
591  res2 = calculateRes2(rhs);
592 
593  // do the line-search
594  if (res2 < res2_old + 1E-4 * lam * slope)
595  break;
596  else if (lam < lam_min)
597  return 1;
598  else if (lam == 1.0)
599  {
600  // model as a quadratic
601  tmp_lam = -0.5 * slope / (res2 - res2_old - slope);
602  }
603  else
604  {
605  // model as a cubic
606  const Real rhs1 = res2 - res2_old - lam * slope;
607  const Real rhs2 = f2 - res2_old - lam2 * slope;
608  const Real a = (rhs1 / Utility::pow<2>(lam) - rhs2 / Utility::pow<2>(lam2)) / (lam - lam2);
609  const Real b =
610  (-lam2 * rhs1 / Utility::pow<2>(lam) + lam * rhs2 / Utility::pow<2>(lam2)) / (lam - lam2);
611  if (a == 0.0)
612  tmp_lam = -slope / (2.0 * b);
613  else
614  {
615  const Real disc = Utility::pow<2>(b) - 3.0 * a * slope;
616  if (disc < 0)
617  tmp_lam = 0.5 * lam;
618  else if (b <= 0)
619  tmp_lam = (-b + std::sqrt(disc)) / (3.0 * a);
620  else
621  tmp_lam = -slope / (b + std::sqrt(disc));
622  }
623  if (tmp_lam > 0.5 * lam)
624  tmp_lam = 0.5 * lam;
625  }
626  lam2 = lam;
627  f2 = res2;
628  lam = std::max(tmp_lam, 0.1 * lam);
629  }
630 
631  if (lam < 1.0)
632  linesearch_needed = 1.0;
633  return 0;
634 }
635 
636 int
638  const std::vector<Real> & trial_stress_params,
639  const std::vector<Real> & stress_params,
640  const std::vector<Real> & intnl,
641  Real gaE,
642  std::vector<Real> & rhs) const
643 {
644  std::vector<std::vector<Real>> dintnl(_num_intnl, std::vector<Real>(_num_sp));
645  setIntnlDerivativesV(trial_stress_params, stress_params, intnl, dintnl);
646 
647  std::vector<double> jac((_num_sp + 1) * (_num_sp + 1));
648  dnRHSdVar(smoothed_q, dintnl, stress_params, gaE, jac);
649 
650  // use LAPACK to solve the linear system
651  const int nrhs = 1;
652  std::vector<int> ipiv(_num_sp + 1);
653  int info;
654  const int gesv_num_rhs = _num_sp + 1;
655  LAPACKgesv_(
656  &gesv_num_rhs, &nrhs, &jac[0], &gesv_num_rhs, &ipiv[0], &rhs[0], &gesv_num_rhs, &info);
657  return info;
658 }
659 
660 void
661 MultiParameterPlasticityStressUpdate::errorHandler(const std::string & message) const
662 {
663  throw MooseException(message);
664 }
665 
666 void
668 {
669 }
670 
671 void
673  const RankTwoTensor & /*rotation_increment*/)
674 {
675 }
676 
677 void
679  const std::vector<Real> & /*trial_stress_params*/,
680  const RankTwoTensor & /*stress_trial*/,
681  const std::vector<Real> & /*intnl_old*/,
682  const std::vector<Real> & /*yf*/,
683  const RankFourTensor & /*Eijkl*/)
684 {
685 }
686 
687 Real
688 MultiParameterPlasticityStressUpdate::yieldF(const std::vector<Real> & stress_params,
689  const std::vector<Real> & intnl) const
690 {
691  std::vector<Real> yfs(_num_yf);
692  yieldFunctionValuesV(stress_params, intnl, yfs);
693  return yieldF(yfs);
694 }
695 
696 Real
697 MultiParameterPlasticityStressUpdate::yieldF(const std::vector<Real> & yfs) const
698 {
699  Real yf = yfs[0];
700  for (std::size_t i = 1; i < yfs.size(); ++i)
701  if (yf >= yfs[i] + _smoothing_tol)
702  // no smoothing is needed, and yf is the biggest yield function
703  continue;
704  else if (yfs[i] >= yf + _smoothing_tol)
705  // no smoothing is needed, and yfs[i] is the biggest yield function
706  yf = yfs[i];
707  else
708  yf = 0.5 * (yf + yfs[i] + _smoothing_tol) + ismoother(yf - yfs[i]);
709  return yf;
710 }
711 
712 void
713 MultiParameterPlasticityStressUpdate::initializeVarsV(const std::vector<Real> & trial_stress_params,
714  const std::vector<Real> & intnl_old,
715  std::vector<Real> & stress_params,
716  Real & gaE,
717  std::vector<Real> & intnl) const
718 {
719  gaE = 0.0;
720  std::copy(trial_stress_params.begin(), trial_stress_params.end(), stress_params.begin());
721  std::copy(intnl_old.begin(), intnl_old.end(), intnl.begin());
722 }
723 
724 void
726  const RankTwoTensor & stress_trial,
727  const std::vector<Real> & /*trial_stress_params*/,
728  const RankTwoTensor & stress,
729  const std::vector<Real> & /*stress_params*/,
730  Real gaE,
731  const yieldAndFlow & smoothed_q,
732  const RankFourTensor & elasticity_tensor,
733  bool compute_full_tangent_operator,
734  const std::vector<std::vector<Real>> & dvar_dtrial,
735  RankFourTensor & cto)
736 {
737  cto = elasticity_tensor;
738  if (!compute_full_tangent_operator)
739  return;
740 
741  const Real ga = gaE / _En;
742 
743  const std::vector<RankTwoTensor> dsp = dstress_param_dstress(stress);
744  const std::vector<RankTwoTensor> dsp_trial = dstress_param_dstress(stress_trial);
745 
746  for (unsigned a = 0; a < _num_sp; ++a)
747  {
748  for (unsigned b = 0; b < _num_sp; ++b)
749  {
750  const RankTwoTensor t = elasticity_tensor * dsp_trial[a];
751  RankTwoTensor s = _Cij[b][a] * dsp[b];
752  for (unsigned c = 0; c < _num_sp; ++c)
753  s -= dsp[b] * _Cij[b][c] * dvar_dtrial[c][a];
754  s = elasticity_tensor * s;
755  cto -= s.outerProduct(t);
756  }
757  }
758 
759  const std::vector<RankFourTensor> d2sp = d2stress_param_dstress(stress);
760  RankFourTensor Tijab;
761  for (unsigned i = 0; i < _num_sp; ++i)
762  Tijab += smoothed_q.dg[i] * d2sp[i];
763  Tijab = ga * elasticity_tensor * Tijab;
764 
765  RankFourTensor inv = RankFourTensor(RankFourTensor::initIdentityFour) + Tijab;
766  try
767  {
768  inv = inv.transposeMajor().invSymm();
769  }
770  catch (const MooseException & e)
771  {
772  // Cannot form the inverse, so probably at some degenerate place in stress space.
773  // Just return with the "best estimate" of the cto.
774  mooseWarning("MultiParameterPlasticityStressUpdate: Cannot invert 1+T in consistent tangent "
775  "operator computation at quadpoint ",
776  _qp,
777  " of element ",
778  _current_elem->id());
779  return;
780  }
781 
782  cto = (cto.transposeMajor() * inv).transposeMajor();
783 }
784 
785 void
787  const RankTwoTensor & /*stress_trial*/,
788  Real gaE,
789  const yieldAndFlow & smoothed_q,
790  const RankFourTensor & /*elasticity_tensor*/,
791  const RankTwoTensor & returned_stress,
792  RankTwoTensor & inelastic_strain_increment) const
793 {
794  const std::vector<RankTwoTensor> dsp_dstress = dstress_param_dstress(returned_stress);
795  inelastic_strain_increment = RankTwoTensor();
796  for (unsigned i = 0; i < _num_sp; ++i)
797  inelastic_strain_increment += smoothed_q.dg[i] * dsp_dstress[i];
798  inelastic_strain_increment *= gaE / _En;
799 }
800 
801 Real
802 MultiParameterPlasticityStressUpdate::calculateRes2(const std::vector<Real> & rhs) const
803 {
804  Real res2 = 0.0;
805  for (const auto & r : rhs)
806  res2 += r * r;
807  return res2;
808 }
809 
810 void
811 MultiParameterPlasticityStressUpdate::calculateRHS(const std::vector<Real> & trial_stress_params,
812  const std::vector<Real> & stress_params,
813  Real gaE,
814  const yieldAndFlow & smoothed_q,
815  std::vector<Real> & rhs) const
816 {
817  const Real ga = gaE / _En;
818  for (unsigned i = 0; i < _num_sp; ++i)
819  {
820  rhs[i] = stress_params[i] - trial_stress_params[i];
821  for (unsigned j = 0; j < _num_sp; ++j)
822  rhs[i] += ga * _Eij[i][j] * smoothed_q.dg[j];
823  }
824  rhs[_num_sp] = smoothed_q.f;
825 }
826 
827 void
829  const std::vector<std::vector<Real>> & dintnl,
830  const std::vector<Real> & /*stress_params*/,
831  Real gaE,
832  std::vector<double> & jac) const
833 {
834  for (auto & jac_entry : jac)
835  jac_entry = 0.0;
836 
837  const Real ga = gaE / _En;
838 
839  unsigned ind = 0;
840  for (unsigned var = 0; var < _num_sp; ++var)
841  {
842  for (unsigned rhs = 0; rhs < _num_sp; ++rhs)
843  {
844  if (var == rhs)
845  jac[ind] -= 1.0;
846  for (unsigned j = 0; j < _num_sp; ++j)
847  {
848  jac[ind] -= ga * _Eij[rhs][j] * smoothed_q.d2g[j][var];
849  for (unsigned k = 0; k < _num_intnl; ++k)
850  jac[ind] -= ga * _Eij[rhs][j] * smoothed_q.d2g_di[j][k] * dintnl[k][var];
851  }
852  ind++;
853  }
854  // now rhs = _num_sp (that is, the yield function)
855  jac[ind] -= smoothed_q.df[var];
856  for (unsigned k = 0; k < _num_intnl; ++k)
857  jac[ind] -= smoothed_q.df_di[k] * dintnl[k][var];
858  ind++;
859  }
860 
861  // now var = _num_sp (that is, gaE)
862  for (unsigned rhs = 0; rhs < _num_sp; ++rhs)
863  {
864  for (unsigned j = 0; j < _num_sp; ++j)
865  jac[ind] -= (1.0 / _En) * _Eij[rhs][j] * smoothed_q.dg[j];
866  ind++;
867  }
868  // now rhs = _num_sp (that is, the yield function)
869  jac[ind] = 0.0;
870 }
871 
872 void
874  const std::vector<Real> & trial_stress_params,
875  const std::vector<Real> & stress_params,
876  Real gaE,
877  const std::vector<Real> & intnl,
878  const yieldAndFlow & smoothed_q,
879  Real step_size,
880  bool compute_full_tangent_operator,
881  std::vector<std::vector<Real>> & dvar_dtrial) const
882 {
883  if (!_fe_problem.currentlyComputingJacobian())
884  return;
885 
886  if (!compute_full_tangent_operator)
887  return;
888 
889  if (elastic_only)
890  {
891  // no change to gaE, and all off-diag stuff remains unchanged from previous step
892  for (unsigned v = 0; v < _num_sp; ++v)
893  dvar_dtrial[v][v] += step_size;
894  return;
895  }
896 
897  const Real ga = gaE / _En;
898 
899  std::vector<std::vector<Real>> dintnl(_num_intnl, std::vector<Real>(_num_sp));
900  setIntnlDerivativesV(trial_stress_params, stress_params, intnl, dintnl);
901 
902  // rhs is described elsewhere, the following are changes in rhs wrt the trial_stress_param
903  // values
904  // In the following we use d(intnl)/d(trial variable) = - d(intnl)/d(variable)
905  std::vector<Real> rhs_cto((_num_sp + 1) * _num_sp);
906 
907  unsigned ind = 0;
908  for (unsigned a = 0; a < _num_sp; ++a)
909  {
910  // change in RHS[b] wrt changes in stress_param_trial[a]
911  for (unsigned b = 0; b < _num_sp; ++b)
912  {
913  if (a == b)
914  rhs_cto[ind] -= 1.0;
915  for (unsigned j = 0; j < _num_sp; ++j)
916  for (unsigned k = 0; k < _num_intnl; ++k)
917  rhs_cto[ind] -= ga * _Eij[b][j] * smoothed_q.d2g_di[j][k] * dintnl[k][a];
918  ind++;
919  }
920  // now b = _num_sp (that is, the yield function)
921  for (unsigned k = 0; k < _num_intnl; ++k)
922  rhs_cto[ind] -= smoothed_q.df_di[k] * dintnl[k][a];
923  ind++;
924  }
925 
926  // jac = d(-rhs)/d(var)
927  std::vector<double> jac((_num_sp + 1) * (_num_sp + 1));
928  dnRHSdVar(smoothed_q, dintnl, stress_params, gaE, jac);
929 
930  std::vector<int> ipiv(_num_sp + 1);
931  int info;
932  const int gesv_num_rhs = _num_sp + 1;
933  const int gesv_num_pq = _num_sp;
934  LAPACKgesv_(&gesv_num_rhs,
935  &gesv_num_pq,
936  &jac[0],
937  &gesv_num_rhs,
938  &ipiv[0],
939  &rhs_cto[0],
940  &gesv_num_rhs,
941  &info);
942  if (info != 0)
943  errorHandler("MultiParameterPlasticityStressUpdate: PETSC LAPACK gsev routine returned with "
944  "error code " +
945  Moose::stringify(info));
946 
947  ind = 0;
948  std::vector<std::vector<Real>> dvarn_dtrialn(_num_sp + 1, std::vector<Real>(_num_sp, 0.0));
949  for (unsigned spt = 0; spt < _num_sp; ++spt) // loop over trial stress-param variables
950  {
951  for (unsigned v = 0; v < _num_sp; ++v) // loop over variables in NR procedure
952  {
953  dvarn_dtrialn[v][spt] = rhs_cto[ind];
954  ind++;
955  }
956  // the final NR variable is gaE
957  dvarn_dtrialn[_num_sp][spt] = rhs_cto[ind];
958  ind++;
959  }
960 
961  const std::vector<std::vector<Real>> dvar_dtrial_old = dvar_dtrial;
962 
963  for (unsigned v = 0; v < _num_sp; ++v) // loop over variables in NR procedure
964  {
965  for (unsigned spt = 0; spt < _num_sp; ++spt) // loop over trial stress-param variables
966  {
967  dvar_dtrial[v][spt] = step_size * dvarn_dtrialn[v][spt];
968  for (unsigned a = 0; a < _num_sp; ++a)
969  dvar_dtrial[v][spt] += dvarn_dtrialn[v][a] * dvar_dtrial_old[a][spt];
970  }
971  }
972  // for gaE the formulae are a little different
973  const unsigned v = _num_sp;
974  for (unsigned spt = 0; spt < _num_sp; ++spt)
975  {
976  dvar_dtrial[v][spt] += step_size * dvarn_dtrialn[v][spt]; // note +=
977  for (unsigned a = 0; a < _num_sp; ++a)
978  dvar_dtrial[v][spt] += dvarn_dtrialn[v][a] * dvar_dtrial_old[a][spt];
979  }
980 }
981 
982 bool
983 MultiParameterPlasticityStressUpdate::precisionLoss(const std::vector<Real> & solution,
984  const std::vector<Real> & stress_params,
985  Real gaE) const
986 {
987  if (std::abs(solution[_num_sp]) > 1E-13 * std::abs(gaE))
988  return false;
989  for (unsigned i = 0; i < _num_sp; ++i)
990  if (std::abs(solution[i]) > 1E-13 * std::abs(stress_params[i]))
991  return false;
992  return true;
993 }
MultiParameterPlasticityStressUpdate::computeAllQV
virtual void computeAllQV(const std::vector< Real > &stress_params, const std::vector< Real > &intnl, std::vector< yieldAndFlow > &all_q) const =0
Completely fills all_q with correct values.
MultiParameterPlasticityStressUpdate::_max_nr_its
const unsigned _max_nr_its
Maximum number of Newton-Raphson iterations allowed in the return-map process.
Definition: MultiParameterPlasticityStressUpdate.h:153
MultiParameterPlasticityStressUpdate::_warn_about_precision_loss
const bool _warn_about_precision_loss
Output a warning message if precision loss is encountered during the return-map process.
Definition: MultiParameterPlasticityStressUpdate.h:181
MultiParameterPlasticityStressUpdate::_stress_trial
RankTwoTensor _stress_trial
"Trial" value of stress that is set at the beginning of the return-map process.
Definition: MultiParameterPlasticityStressUpdate.h:688
MultiParameterPlasticityStressUpdate::ismoother
Real ismoother(Real f_diff) const
Smooths yield functions.
Definition: MultiParameterPlasticityStressUpdate.C:484
MultiParameterPlasticityStressUpdate::MultiParameterPlasticityStressUpdate
MultiParameterPlasticityStressUpdate(const InputParameters &parameters, unsigned num_sp, unsigned num_yf, unsigned num_intnl)
Definition: MultiParameterPlasticityStressUpdate.C:82
MultiParameterPlasticityStressUpdate::yieldAndFlow::d2g
std::vector< std::vector< Real > > d2g
Definition: MultiParameterPlasticityStressUpdate.h:220
MultiParameterPlasticityStressUpdate::_current_intnl
std::vector< Real > _current_intnl
The current values of the internal params during the Newton-Raphson.
Definition: MultiParameterPlasticityStressUpdate.h:737
MultiParameterPlasticityStressUpdate::SmootherFunctionType::poly1
MultiParameterPlasticityStressUpdate::SmootherFunctionType::cos
MultiParameterPlasticityStressUpdate::yieldAndFlow
Struct designed to hold info about a single yield function and its derivatives, as well as the flow d...
Definition: MultiParameterPlasticityStressUpdate.h:214
MultiParameterPlasticityStressUpdate::_smoothing_tol
const Real _smoothing_tol
Smoothing tolerance: edges of the yield surface get smoothed by this amount.
Definition: MultiParameterPlasticityStressUpdate.h:159
MultiParameterPlasticityStressUpdate::yieldAndFlow::dg
std::vector< Real > dg
Definition: MultiParameterPlasticityStressUpdate.h:219
MultiParameterPlasticityStressUpdate::finalizeReturnProcess
virtual void finalizeReturnProcess(const RankTwoTensor &rotation_increment)
Derived classes may use this to perform calculations after the return-map process has completed succe...
Definition: MultiParameterPlasticityStressUpdate.C:672
MultiParameterPlasticityStressUpdate::_smoother_function_type
enum MultiParameterPlasticityStressUpdate::SmootherFunctionType _smoother_function_type
MultiParameterPlasticityStressUpdate::_Cij
std::vector< std::vector< Real > > _Cij
_Cij[i, j] * _Eij[j, k] = 1 iff j == k
Definition: MultiParameterPlasticityStressUpdate.h:144
MultiParameterPlasticityStressUpdate::lineSearch
int lineSearch(Real &res2, std::vector< Real > &stress_params, Real &gaE, const std::vector< Real > &trial_stress_params, yieldAndFlow &smoothed_q, const std::vector< Real > &intnl_ok, std::vector< Real > &intnl, std::vector< Real > &rhs, Real &linesearch_needed) const
Performs a line-search to find stress_params and gaE Upon entry:
Definition: MultiParameterPlasticityStressUpdate.C:553
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
defineLegacyParams
defineLegacyParams(MultiParameterPlasticityStressUpdate)
MultiParameterPlasticityStressUpdate::SmootherFunctionType::poly3
MultiParameterPlasticityStressUpdate::_iter
MaterialProperty< Real > & _iter
Number of Newton-Raphson iterations used in the return-map.
Definition: MultiParameterPlasticityStressUpdate.h:199
MultiParameterPlasticityStressUpdate::_f_tol2
const Real _f_tol2
Square of the yield-function tolerance.
Definition: MultiParameterPlasticityStressUpdate.h:168
MultiParameterPlasticityStressUpdate::_min_step_size
const Real _min_step_size
In order to help the Newton-Raphson procedure, the applied strain increment may be applied in sub-inc...
Definition: MultiParameterPlasticityStressUpdate.h:175
MultiParameterPlasticityStressUpdate::setEffectiveElasticity
virtual void setEffectiveElasticity(const RankFourTensor &Eijkl)=0
Sets _Eij and _En and _Cij.
MultiParameterPlasticityStressUpdate::d2stress_param_dstress
virtual std::vector< RankFourTensor > d2stress_param_dstress(const RankTwoTensor &stress) const =0
d2(stress_param[i])/d(stress)/d(stress) at given stress
MultiParameterPlasticityStressUpdate::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: MultiParameterPlasticityStressUpdate.C:141
MultiParameterPlasticityStressUpdate::_ok_intnl
std::vector< Real > _ok_intnl
The state (ok_sp, ok_intnl) is known to be admissible.
Definition: MultiParameterPlasticityStressUpdate.h:718
MultiParameterPlasticityStressUpdate::updateState
virtual void updateState(RankTwoTensor &strain_increment, RankTwoTensor &inelastic_strain_increment, const RankTwoTensor &rotation_increment, RankTwoTensor &stress_new, const RankTwoTensor &stress_old, const RankFourTensor &elasticity_tensor, const RankTwoTensor &elastic_strain_old, bool compute_full_tangent_operator, RankFourTensor &tangent_operator) override
Given a strain increment that results in a trial stress, perform some procedure (such as an iterative...
Definition: MultiParameterPlasticityStressUpdate.C:160
MultiParameterPlasticityStressUpdate::_linesearch_needed
MaterialProperty< Real > & _linesearch_needed
Whether a line-search was needed in the latest Newton-Raphson process (1 if true, 0 otherwise)
Definition: MultiParameterPlasticityStressUpdate.h:208
MultiParameterPlasticityStressUpdate::dstress_param_dstress
virtual std::vector< RankTwoTensor > dstress_param_dstress(const RankTwoTensor &stress) const =0
d(stress_param[i])/d(stress) at given stress
MultiParameterPlasticityStressUpdate::dVardTrial
void dVardTrial(bool elastic_only, const std::vector< Real > &trial_stress_params, const std::vector< Real > &stress_params, Real gaE, const std::vector< Real > &intnl, const yieldAndFlow &smoothed_q, Real step_size, bool compute_full_tangent_operator, std::vector< std::vector< Real >> &dvar_dtrial) const
Calculates derivatives of the stress_params and gaE with repect to the trial values of the stress_par...
Definition: MultiParameterPlasticityStressUpdate.C:873
MultiParameterPlasticityStressUpdate::initializeVarsV
virtual void initializeVarsV(const std::vector< Real > &trial_stress_params, const std::vector< Real > &intnl_old, std::vector< Real > &stress_params, Real &gaE, std::vector< Real > &intnl) const
Sets (stress_params, intnl) at "good guesses" of the solution to the Return-Map algorithm.
Definition: MultiParameterPlasticityStressUpdate.C:713
MultiParameterPlasticityStressUpdate::precisionLoss
bool precisionLoss(const std::vector< Real > &solution, const std::vector< Real > &stress_params, Real gaE) const
Check whether precision loss has occurred.
Definition: MultiParameterPlasticityStressUpdate.C:983
MultiParameterPlasticityStressUpdate::validParams
static InputParameters validParams()
Definition: MultiParameterPlasticityStressUpdate.C:23
MultiParameterPlasticityStressUpdate::_plastic_strain_old
const MaterialProperty< RankTwoTensor > & _plastic_strain_old
Old value of plastic strain.
Definition: MultiParameterPlasticityStressUpdate.h:187
MultiParameterPlasticityStressUpdate::_Eij
std::vector< std::vector< Real > > _Eij
E[i, j] in the system of equations to be solved.
Definition: MultiParameterPlasticityStressUpdate.h:138
MultiParameterPlasticityStressUpdate::yieldF
Real yieldF(const std::vector< Real > &stress_params, const std::vector< Real > &intnl) const
Computes the smoothed yield function.
Definition: MultiParameterPlasticityStressUpdate.C:688
MultiParameterPlasticityStressUpdate::_del_stress_params
std::vector< Real > _del_stress_params
_del_stress_params = trial_stress_params - ok_sp This is fixed at the beginning of the return-map pro...
Definition: MultiParameterPlasticityStressUpdate.h:727
MultiParameterPlasticityStressUpdate::_intnl_old
const MaterialProperty< std::vector< Real > > & _intnl_old
old values of internal parameters
Definition: MultiParameterPlasticityStressUpdate.h:193
MultiParameterPlasticityStressUpdate::computeStressParams
virtual void computeStressParams(const RankTwoTensor &stress, std::vector< Real > &stress_params) const =0
Computes stress_params, given stress.
MultiParameterPlasticityStressUpdate::initializeReturnProcess
virtual void initializeReturnProcess()
Derived classes may use this to perform calculations before any return-map process is performed,...
Definition: MultiParameterPlasticityStressUpdate.C:667
MultiParameterPlasticityStressUpdate::smoother
Real smoother(Real f_diff) const
Derivative of ismoother.
Definition: MultiParameterPlasticityStressUpdate.C:510
MultiParameterPlasticityStressUpdate::_rhs
std::vector< Real > _rhs
0 = rhs[0] = S[0] - S[0]^trial + ga * E[0, i] * dg/dS[i] 0 = rhs[1] = S[1] - S[1]^trial + ga * E[1,...
Definition: MultiParameterPlasticityStressUpdate.h:698
MultiParameterPlasticityStressUpdate::_num_sp
const unsigned _num_sp
Number of stress parameters.
Definition: MultiParameterPlasticityStressUpdate.h:132
MultiParameterPlasticityStressUpdate::yieldFunctionValuesV
virtual void yieldFunctionValuesV(const std::vector< Real > &stress_params, const std::vector< Real > &intnl, std::vector< Real > &yf) const =0
Computes the values of the yield functions, given stress_params and intnl parameters.
MultiParameterPlasticityStressUpdate::_yf
MaterialProperty< std::vector< Real > > & _yf
yield functions
Definition: MultiParameterPlasticityStressUpdate.h:196
MultiParameterPlasticityStressUpdate::_num_yf
const unsigned _num_yf
Number of yield functions.
Definition: MultiParameterPlasticityStressUpdate.h:147
MultiParameterPlasticityStressUpdate::dnRHSdVar
void dnRHSdVar(const yieldAndFlow &smoothed_q, const std::vector< std::vector< Real >> &dintnl, const std::vector< Real > &stress_params, Real gaE, std::vector< double > &jac) const
Derivative of -RHS with respect to the stress_params and gaE, placed into an array ready for solving ...
Definition: MultiParameterPlasticityStressUpdate.C:828
MultiParameterPlasticityStressUpdate::_plastic_strain
MaterialProperty< RankTwoTensor > & _plastic_strain
plastic strain
Definition: MultiParameterPlasticityStressUpdate.h:184
MultiParameterPlasticityStressUpdate::_definitely_ok_sp
const std::vector< Real > _definitely_ok_sp
An admissible value of stress_params at the initial time.
Definition: MultiParameterPlasticityStressUpdate.h:135
MultiParameterPlasticityStressUpdate::propagateQpStatefulProperties
virtual void propagateQpStatefulProperties() override
If updateState is not called during a timestep, this will be.
Definition: MultiParameterPlasticityStressUpdate.C:152
MultiParameterPlasticityStressUpdate::SmootherFunctionType
SmootherFunctionType
The type of smoother function.
Definition: MultiParameterPlasticityStressUpdate.h:743
MultiParameterPlasticityStressUpdate::_trial_sp
std::vector< Real > _trial_sp
"Trial" value of stress_params that initializes the return-map process This is derived from stress = ...
Definition: MultiParameterPlasticityStressUpdate.h:681
MultiParameterPlasticityStressUpdate::_num_intnl
const unsigned _num_intnl
Number of internal parameters.
Definition: MultiParameterPlasticityStressUpdate.h:150
RankTwoTensor
RankTwoTensorTempl< Real > RankTwoTensor
Definition: ACGrGrElasticDrivingForce.h:17
MultiParameterPlasticityStressUpdate::_step_one
bool _step_one
handles case of initial_stress that is inadmissible being supplied
Definition: MultiParameterPlasticityStressUpdate.h:178
MultiParameterPlasticityStressUpdate::dsmoother
Real dsmoother(Real f_diff) const
Derivative of smoother.
Definition: MultiParameterPlasticityStressUpdate.C:533
MultiParameterPlasticityStressUpdate::calculateRes2
Real calculateRes2(const std::vector< Real > &rhs) const
Calculates the residual-squared for the Newton-Raphson + line-search.
Definition: MultiParameterPlasticityStressUpdate.C:802
MultiParameterPlasticityStressUpdate::setIntnlDerivativesV
virtual void setIntnlDerivativesV(const std::vector< Real > &trial_stress_params, const std::vector< Real > &current_stress_params, const std::vector< Real > &intnl, std::vector< std::vector< Real >> &dintnl) const =0
Sets the derivatives of internal parameters, based on the trial values of stress_params,...
MultiParameterPlasticityStressUpdate::errorHandler
virtual void errorHandler(const std::string &message) const
Performs any necessary cleaning-up, then throw MooseException(message)
Definition: MultiParameterPlasticityStressUpdate.C:661
MultiParameterPlasticityStressUpdate::_current_sp
std::vector< Real > _current_sp
The current values of the stress params during the Newton-Raphson.
Definition: MultiParameterPlasticityStressUpdate.h:732
MultiParameterPlasticityStressUpdate::_En
Real _En
normalising factor
Definition: MultiParameterPlasticityStressUpdate.h:141
MultiParameterPlasticityStressUpdate::yieldAndFlow::f
Real f
Definition: MultiParameterPlasticityStressUpdate.h:216
RankFourTensorTempl< Real >
MultiParameterPlasticityStressUpdate::yieldAndFlow::df
std::vector< Real > df
Definition: MultiParameterPlasticityStressUpdate.h:217
MultiParameterPlasticityStressUpdate::consistentTangentOperatorV
virtual void consistentTangentOperatorV(const RankTwoTensor &stress_trial, const std::vector< Real > &trial_stress_params, const RankTwoTensor &stress, const std::vector< Real > &stress_params, Real gaE, const yieldAndFlow &smoothed_q, const RankFourTensor &Eijkl, bool compute_full_tangent_operator, const std::vector< std::vector< Real >> &dvar_dtrial, RankFourTensor &cto)
Calculates the consistent tangent operator.
Definition: MultiParameterPlasticityStressUpdate.C:725
MultiParameterPlasticityStressUpdate::_max_iter_used
MaterialProperty< Real > & _max_iter_used
Maximum number of Newton-Raphson iterations used in the return-map during the course of the entire si...
Definition: MultiParameterPlasticityStressUpdate.h:202
StressUpdateBase
StressUpdateBase is a material that is not called by MOOSE because of the compute=false flag set in t...
Definition: StressUpdateBase.h:52
MultiParameterPlasticityStressUpdate.h
MultiParameterPlasticityStressUpdate::SmootherFunctionType::poly2
MultiParameterPlasticityStressUpdate::setIntnlValuesV
virtual void setIntnlValuesV(const std::vector< Real > &trial_stress_params, const std::vector< Real > &current_stress_params, const std::vector< Real > &intnl_old, std::vector< Real > &intnl) const =0
Sets the internal parameters based on the trial values of stress_params, their current values,...
MultiParameterPlasticityStressUpdate::_dvar_dtrial
std::vector< std::vector< Real > > _dvar_dtrial
d({stress_param[i], gaE})/d(trial_stress_param[j])
Definition: MultiParameterPlasticityStressUpdate.h:703
MultiParameterPlasticityStressUpdate::smoothAllQuantities
yieldAndFlow smoothAllQuantities(const std::vector< Real > &stress_params, const std::vector< Real > &intnl) const
Calculates all yield functions and derivatives, and then performs the smoothing scheme.
Definition: MultiParameterPlasticityStressUpdate.C:400
MultiParameterPlasticityStressUpdate::calculateRHS
void calculateRHS(const std::vector< Real > &trial_stress_params, const std::vector< Real > &stress_params, Real gaE, const yieldAndFlow &smoothed_q, std::vector< Real > &rhs) const
Calculates the RHS in the following 0 = rhs[0] = S[0] - S[0]^trial + ga * E[0, j] * dg/dS[j] 0 = rhs[...
Definition: MultiParameterPlasticityStressUpdate.C:811
RankTwoTensorTempl< Real >
MultiParameterPlasticityStressUpdate::yieldAndFlow::d2g_di
std::vector< std::vector< Real > > d2g_di
Definition: MultiParameterPlasticityStressUpdate.h:221
MultiParameterPlasticityStressUpdate::_ok_sp
std::vector< Real > _ok_sp
The state (ok_sp, ok_intnl) is known to be admissible, so ok_sp are stress_params that are "OK".
Definition: MultiParameterPlasticityStressUpdate.h:713
MultiParameterPlasticityStressUpdate::setStressAfterReturnV
virtual void setStressAfterReturnV(const RankTwoTensor &stress_trial, const std::vector< Real > &stress_params, Real gaE, const std::vector< Real > &intnl, const yieldAndFlow &smoothed_q, const RankFourTensor &Eijkl, RankTwoTensor &stress) const =0
Sets stress from the admissible parameters.
MultiParameterPlasticityStressUpdate::preReturnMapV
virtual void preReturnMapV(const std::vector< Real > &trial_stress_params, const RankTwoTensor &stress_trial, const std::vector< Real > &intnl_old, const std::vector< Real > &yf, const RankFourTensor &Eijkl)
Derived classes may employ this function to record stuff or do other computations prior to the return...
Definition: MultiParameterPlasticityStressUpdate.C:678
MultiParameterPlasticityStressUpdate
MultiParameterPlasticityStressUpdate performs the return-map algorithm and associated stress updates ...
Definition: MultiParameterPlasticityStressUpdate.h:99
MultiParameterPlasticityStressUpdate::yieldAndFlow::df_di
std::vector< Real > df_di
Definition: MultiParameterPlasticityStressUpdate.h:218
MultiParameterPlasticityStressUpdate::_smoothing_tol2
const Real _smoothing_tol2
Square of the smoothing tolerance.
Definition: MultiParameterPlasticityStressUpdate.h:162
MultiParameterPlasticityStressUpdate::nrStep
int nrStep(const yieldAndFlow &smoothed_q, const std::vector< Real > &trial_stress_params, const std::vector< Real > &stress_params, const std::vector< Real > &intnl, Real gaE, std::vector< Real > &rhs) const
Performs a Newton-Raphson step to attempt to zero rhs Upon return, rhs will contain the solution.
Definition: MultiParameterPlasticityStressUpdate.C:637
MultiParameterPlasticityStressUpdate::_intnl
MaterialProperty< std::vector< Real > > & _intnl
internal parameters
Definition: MultiParameterPlasticityStressUpdate.h:190
MultiParameterPlasticityStressUpdate::_max_iter_used_old
const MaterialProperty< Real > & _max_iter_used_old
Old value of maximum number of Newton-Raphson iterations used in the return-map during the course of ...
Definition: MultiParameterPlasticityStressUpdate.h:205
MultiParameterPlasticityStressUpdate::setInelasticStrainIncrementAfterReturn
virtual void setInelasticStrainIncrementAfterReturn(const RankTwoTensor &stress_trial, Real gaE, const yieldAndFlow &smoothed_q, const RankFourTensor &elasticity_tensor, const RankTwoTensor &returned_stress, RankTwoTensor &inelastic_strain_increment) const
Sets inelastic strain increment from the returned configuration This is called after the return-map p...
Definition: MultiParameterPlasticityStressUpdate.C:786
StressUpdateBase::validParams
static InputParameters validParams()
Definition: StressUpdateBase.C:17
MultiParameterPlasticityStressUpdate::_f_tol
const Real _f_tol
The yield-function tolerance.
Definition: MultiParameterPlasticityStressUpdate.h:165