https://mooseframework.inl.gov
PowerLawCreepTest.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "PowerLawCreepTest.h"
11 
12 #include "NonlinearSystemBase.h"
13 
14 registerMooseObject("SolidMechanicsTestApp", PowerLawCreepTest);
15 registerMooseObject("SolidMechanicsTestApp", ADPowerLawCreepTest);
16 
17 template <bool is_ad>
20 {
22  params.addClassDescription(
23  "This class duplicates the PowerLawCreepStressUpdate, except at a specificed time step and "
24  "the 1st iteration, at which time a high residual is computed, forcing an exception. "
25  "Optionally, a high or low initial guess can be used to test the check_rage limits, which "
26  "will also force an exception.");
27  params.addParam<int>("failure_step", 2, "Time step for which to inject a high residual.");
28  params.addParam<Real>("initial_guess", 0.0, "Initial guess for inner Newton solve.");
29 
30  return params;
31 }
32 
33 template <bool is_ad>
35  : PowerLawCreepStressUpdateTempl<is_ad>(parameters),
36  _failure_step(this->template getParam<int>("failure_step")),
37  _initial_guess(this->template getParam<Real>("initial_guess"))
38 {
39  _check_range = true;
40 }
41 
42 template <bool is_ad>
45  const GenericReal<is_ad> & scalar)
46 {
47  if (_fe_problem.getNonlinearSystemBase(/*nl_sys_num=*/0).getCurrentNonlinearIterationNumber() ==
48  1 &&
49  _t_step == _failure_step && _dt == 1.0)
50  return 1.0;
51 
52  return PowerLawCreepStressUpdateTempl<is_ad>::computeResidual(effective_trial_stress, scalar);
53 }
54 
55 template <bool is_ad>
58  const GenericReal<is_ad> & scalar)
59 {
60  if (_fe_problem.getNonlinearSystemBase(/*nl_sys_num=*/0).getCurrentNonlinearIterationNumber() ==
61  1 &&
62  _t_step == _failure_step && _dt == 1.0)
63  return 1.0;
64 
65  return PowerLawCreepStressUpdateTempl<is_ad>::computeDerivative(effective_trial_stress, scalar);
66 }
virtual GenericReal< is_ad > computeResidual(const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar) override
Compute the residual for a predicted value of the scalar.
Moose::GenericType< Real, is_ad > GenericReal
static InputParameters validParams()
This class uses the stress update material in a radial return isotropic creep model.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
registerMooseObject("SolidMechanicsTestApp", PowerLawCreepTest)
virtual GenericReal< is_ad > computeDerivative(const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar) override
Compute the derivative of the residual as a function of the scalar variable.
virtual GenericReal< is_ad > computeResidual(const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar) override
Compute the residual for a predicted value of the scalar.
PowerLawCreepTestTempl(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
virtual GenericReal< is_ad > computeDerivative(const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar) override
Compute the derivative of the residual as a function of the scalar variable.
bool _check_range
Whether to check to see whether iterative solution is within admissible range, and set within that ra...
void ErrorVector unsigned int