www.mooseframework.org
PowerLawCreepExceptionTest.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 
12 #include "NonlinearSystemBase.h"
13 
14 registerMooseObject("TensorMechanicsTestApp", PowerLawCreepExceptionTest);
15 
17 
18 InputParameters
20 {
21  InputParameters params = PowerLawCreepStressUpdate::validParams();
22  params.addClassDescription(
23  "This class duplicates the PowerLawCreepStressUpdate, except at 2nd time step and the 1st "
24  "iteration, at which time a high residual is computed, forcing an exception.");
25  return params;
26 }
27 
28 PowerLawCreepExceptionTest::PowerLawCreepExceptionTest(const InputParameters & parameters)
29  : PowerLawCreepStressUpdate(parameters)
30 {
31 }
32 
33 Real
34 PowerLawCreepExceptionTest::computeResidual(const Real effective_trial_stress, const Real scalar)
35 {
36  if (_fe_problem.getNonlinearSystemBase().getCurrentNonlinearIterationNumber() == 1 &&
37  _t_step == 1 && _dt > 0.9)
38  return 1.0;
39 
40  return PowerLawCreepStressUpdate::computeResidual(effective_trial_stress, scalar);
41 }
42 
43 Real
44 PowerLawCreepExceptionTest::computeDerivative(const Real effective_trial_stress, const Real scalar)
45 {
46  if (_fe_problem.getNonlinearSystemBase().getCurrentNonlinearIterationNumber() == 1 &&
47  _t_step == 1 && _dt > 0.9)
48  return 1.0;
49 
50  return PowerLawCreepStressUpdate::computeDerivative(effective_trial_stress, scalar);
51 }
PowerLawCreepExceptionTest::computeResidual
virtual Real computeResidual(const Real effective_trial_stress, const Real scalar) override
Compute the residual for a predicted value of the scalar.
Definition: PowerLawCreepExceptionTest.C:34
PowerLawCreepStressUpdate
This class uses the stress update material in a radial return isotropic creep model.
Definition: PowerLawCreepStressUpdate.h:29
PowerLawCreepExceptionTest
Definition: PowerLawCreepExceptionTest.h:19
defineLegacyParams
defineLegacyParams(PowerLawCreepExceptionTest)
PowerLawCreepStressUpdate::computeResidual
virtual Real computeResidual(const Real effective_trial_stress, const Real scalar) override
Compute the residual for a predicted value of the scalar.
Definition: PowerLawCreepStressUpdate.C:67
PowerLawCreepExceptionTest::computeDerivative
virtual Real computeDerivative(const Real effective_trial_stress, const Real scalar) override
Compute the derivative of the residual as a function of the scalar variable.
Definition: PowerLawCreepExceptionTest.C:44
PowerLawCreepStressUpdate::computeDerivative
virtual Real computeDerivative(const Real effective_trial_stress, const Real scalar) override
Compute the derivative of the residual as a function of the scalar variable.
Definition: PowerLawCreepStressUpdate.C:76
registerMooseObject
registerMooseObject("TensorMechanicsTestApp", PowerLawCreepExceptionTest)
PowerLawCreepStressUpdate::validParams
static InputParameters validParams()
Definition: PowerLawCreepStressUpdate.C:17
PowerLawCreepExceptionTest::PowerLawCreepExceptionTest
PowerLawCreepExceptionTest(const InputParameters &parameters)
Definition: PowerLawCreepExceptionTest.C:28
PowerLawCreepExceptionTest.h
PowerLawCreepExceptionTest::validParams
static InputParameters validParams()
Definition: PowerLawCreepExceptionTest.C:19