www.mooseframework.org
ADRadialReturnStressUpdate.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 "MooseMesh.h"
13 #include "ElasticityTensorTools.h"
14 
16 
17 template <ComputeStage compute_stage>
18 InputParameters
20 {
21  InputParameters params = ADStressUpdateBase<compute_stage>::validParams();
22  params.addClassDescription("Calculates the effective inelastic strain increment required to "
23  "return the isotropic stress state to a J2 yield surface. This class "
24  "is intended to be a parent class for classes with specific "
25  "constitutive models.");
27  params.addParam<Real>("max_inelastic_increment",
28  1e-4,
29  "The maximum inelastic strain increment allowed in a time step");
30  params.addRequiredParam<std::string>(
31  "effective_inelastic_strain_name",
32  "Name of the material property that stores the effective inelastic strain");
33  params.addParam<bool>("apply_strain", true, "Flag to apply strain. Used for testing.");
34  params.addParamNamesToGroup("effective_inelastic_strain_name apply_strain", "Advanced");
35  return params;
36 }
37 
38 template <ComputeStage compute_stage>
40  const InputParameters & parameters)
41  : ADStressUpdateBase<compute_stage>(parameters),
42  ADSingleVariableReturnMappingSolution<compute_stage>(parameters),
43  _effective_inelastic_strain(declareADProperty<Real>(
44  _base_name + getParam<std::string>("effective_inelastic_strain_name"))),
45  _effective_inelastic_strain_old(getMaterialPropertyOld<Real>(
46  _base_name + getParam<std::string>("effective_inelastic_strain_name"))),
47  _max_inelastic_increment(getParam<Real>("max_inelastic_increment")),
48  _apply_strain(getParam<bool>("apply_strain"))
49 {
50 }
51 
52 template <ComputeStage compute_stage>
53 void
55 {
56  _effective_inelastic_strain[_qp] = 0.0;
57 }
58 
59 template <ComputeStage compute_stage>
60 void
62 {
63  _effective_inelastic_strain[_qp] = _effective_inelastic_strain_old[_qp];
64 }
65 
66 template <ComputeStage compute_stage>
67 void
69  ADRankTwoTensor & strain_increment,
70  ADRankTwoTensor & inelastic_strain_increment,
71  const ADRankTwoTensor & /*rotation_increment*/,
72  ADRankTwoTensor & stress_new,
73  const RankTwoTensor & /*stress_old*/,
74  const ADRankFourTensor & elasticity_tensor,
75  const RankTwoTensor & elastic_strain_old)
76 {
77  // compute the deviatoric trial stress and trial strain from the current intermediate
78  // configuration
79  ADRankTwoTensor deviatoric_trial_stress = stress_new.deviatoric();
80 
81  // compute the effective trial stress
82  ADReal dev_trial_stress_squared =
83  deviatoric_trial_stress.doubleContraction(deviatoric_trial_stress);
84  ADReal effective_trial_stress =
85  dev_trial_stress_squared == 0.0 ? 0.0 : std::sqrt(3.0 / 2.0 * dev_trial_stress_squared);
86 
87  // Set the value of 3 * shear modulus for use as a reference residual value
88  _three_shear_modulus = 3.0 * ElasticityTensorTools::getIsotropicShearModulus(elasticity_tensor);
89 
90  computeStressInitialize(effective_trial_stress, elasticity_tensor);
91 
92  // Use Newton iteration to determine the scalar effective inelastic strain increment
93  ADReal scalar_effective_inelastic_strain = 0.0;
94  if (!MooseUtils::absoluteFuzzyEqual(effective_trial_stress, 0.0))
95  {
96  returnMappingSolve(effective_trial_stress, scalar_effective_inelastic_strain, _console);
97  if (scalar_effective_inelastic_strain != 0.0)
98  inelastic_strain_increment =
99  deviatoric_trial_stress *
100  (1.5 * scalar_effective_inelastic_strain / effective_trial_stress);
101  else
102  inelastic_strain_increment.zero();
103  }
104  else
105  inelastic_strain_increment.zero();
106 
107  if (_apply_strain)
108  {
109  strain_increment -= inelastic_strain_increment;
110  _effective_inelastic_strain[_qp] =
111  _effective_inelastic_strain_old[_qp] + scalar_effective_inelastic_strain;
112 
113  // Use the old elastic strain here because we require tensors used by this class
114  // to be isotropic and this method natively allows for changing in time
115  // elasticity tensors
116  stress_new = elasticity_tensor * (elastic_strain_old + strain_increment);
117  }
118 
119  computeStressFinalize(inelastic_strain_increment);
120 }
121 
122 template <ComputeStage compute_stage>
123 Real
125  const ADReal & effective_trial_stress, const ADReal & scalar_effective_inelastic_strain)
126 {
127  return MetaPhysicL::raw_value(effective_trial_stress / _three_shear_modulus) -
128  MetaPhysicL::raw_value(scalar_effective_inelastic_strain);
129 }
130 
131 template <ComputeStage compute_stage>
132 ADReal
134  const ADReal & effective_trial_stress) const
135 {
136  return effective_trial_stress / _three_shear_modulus;
137 }
138 
139 template <ComputeStage compute_stage>
140 Real
142 {
143  Real scalar_inelastic_strain_incr = MetaPhysicL::raw_value(_effective_inelastic_strain[_qp]) -
144  _effective_inelastic_strain_old[_qp];
145  if (MooseUtils::absoluteFuzzyEqual(scalar_inelastic_strain_incr, 0.0))
146  return std::numeric_limits<Real>::max();
147 
148  return _dt * _max_inelastic_increment / scalar_inelastic_strain_incr;
149 }
150 
151 template <ComputeStage compute_stage>
152 void
154  const unsigned int total_it)
155 {
156  if (iter_output)
157  {
158  *iter_output << "At element " << _current_elem->id() << " _qp=" << _qp << " Coordinates "
159  << _q_point[_qp] << " block=" << _current_elem->subdomain_id() << '\n';
160  }
162  total_it);
163 }
164 
165 // explicit instantiation is required for AD base classes
adBaseClass
adBaseClass(ADRadialReturnStressUpdate)
ADRadialReturnStressUpdate::validParams
static InputParameters validParams()
Definition: ADRadialReturnStressUpdate.C:19
defineADLegacyParams
defineADLegacyParams(ADRadialReturnStressUpdate)
ADRadialReturnStressUpdate::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: ADRadialReturnStressUpdate.C:54
ADSingleVariableReturnMappingSolution::validParams
static InputParameters validParams()
Definition: ADSingleVariableReturnMappingSolution.C:32
ADRadialReturnStressUpdate::propagateQpStatefulPropertiesRadialReturn
void propagateQpStatefulPropertiesRadialReturn()
Propagate the properties pertaining to this intermediate class.
Definition: ADRadialReturnStressUpdate.C:61
ADRadialReturnStressUpdate
ADRadialReturnStressUpdate computes the radial return stress increment for an isotropic elastic-visco...
Definition: ADRadialReturnStressUpdate.h:26
ADStressUpdateBase
ADStressUpdateBase is a material that is not called by MOOSE because of the compute=false flag set in...
Definition: ADComputeMultipleInelasticStress.h:28
ADRadialReturnStressUpdate.h
ElasticityTensorTools.h
ADRadialReturnStressUpdate::outputIterationSummary
void outputIterationSummary(std::stringstream *iter_output, const unsigned int total_it) override
Output summary information for the convergence history of the model.
Definition: ADRadialReturnStressUpdate.C:153
ADRadialReturnStressUpdate::computeReferenceResidual
virtual Real computeReferenceResidual(const ADReal &effective_trial_stress, const ADReal &scalar_effective_inelastic_strain) override
Compute a reference quantity to be used for checking relative convergence.
Definition: ADRadialReturnStressUpdate.C:124
ADRadialReturnStressUpdate::maximumPermissibleValue
virtual ADReal maximumPermissibleValue(const ADReal &effective_trial_stress) const override
Compute the maximum permissible value of the scalar.
Definition: ADRadialReturnStressUpdate.C:133
ElasticityTensorTools::getIsotropicShearModulus
T getIsotropicShearModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the shear modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be ...
Definition: ElasticityTensorTools.h:71
ADRadialReturnStressUpdate::ADRadialReturnStressUpdate
ADRadialReturnStressUpdate(const InputParameters &parameters)
Definition: ADRadialReturnStressUpdate.C:39
RankTwoTensorTempl< Real >
ADRadialReturnStressUpdate::computeTimeStepLimit
virtual Real computeTimeStepLimit() override
Compute the limiting value of the time step for this material.
Definition: ADRadialReturnStressUpdate.C:141
ADRadialReturnStressUpdate::updateState
virtual void updateState(ADRankTwoTensor &strain_increment, ADRankTwoTensor &inelastic_strain_increment, const ADRankTwoTensor &rotation_increment, ADRankTwoTensor &stress_new, const RankTwoTensor &stress_old, const ADRankFourTensor &elasticity_tensor, const RankTwoTensor &elastic_strain_old) override
A radial return (J2) mapping method is performed with return mapping iterations.
Definition: ADRadialReturnStressUpdate.C:68
ADSingleVariableReturnMappingSolution::outputIterationSummary
virtual void outputIterationSummary(std::stringstream *iter_output, const unsigned int total_it)
Output summary information for the convergence history of the model.
Definition: ADSingleVariableReturnMappingSolution.C:416
ADSingleVariableReturnMappingSolution
Base class that provides capability for Newton return mapping iterations on a single variable.
Definition: ADSingleVariableReturnMappingSolution.h:32
ADStressUpdateBase::validParams
static InputParameters validParams()
Definition: ADStressUpdateBase.C:19