www.mooseframework.org
IsotropicPlasticity.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "IsotropicPlasticity.h"
8 
10 
11 #include "PiecewiseLinear.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<ReturnMappingModel>();
18  params.addClassDescription("Calculates the stress and plastic strain in the general isotropic "
19  "linear strain hardening plasticity model");
20 
21  // Linear strain hardening parameters
22  params.addParam<Real>("yield_stress", "The point at which plastic strain begins accumulating");
23  params.addParam<FunctionName>("yield_stress_function",
24  "Yield stress as a function of temperature");
25  params.addParam<Real>("hardening_constant", "Hardening slope");
26  params.addParam<FunctionName>("hardening_function",
27  "True stress as a function of plastic strain");
28 
29  return params;
30 }
31 
32 IsotropicPlasticity::IsotropicPlasticity(const InputParameters & parameters)
33  : ReturnMappingModel(parameters, "plastic"),
34  _yield_stress_function(
35  isParamValid("yield_stress_function") ? &getFunction("yield_stress_function") : NULL),
36  _yield_stress(isParamValid("yield_stress") ? getParam<Real>("yield_stress") : 0),
37  _hardening_constant(isParamValid("hardening_constant") ? getParam<Real>("hardening_constant")
38  : 0),
39  _hardening_function(isParamValid("hardening_function")
40  ? dynamic_cast<PiecewiseLinear *>(&getFunction("hardening_function"))
41  : NULL),
42 
43  _plastic_strain(declareProperty<SymmTensor>("plastic_strain")),
44  _plastic_strain_old(getMaterialPropertyOld<SymmTensor>("plastic_strain")),
45 
46  _hardening_variable(declareProperty<Real>("hardening_variable")),
47  _hardening_variable_old(getMaterialPropertyOld<Real>("hardening_variable"))
48 {
49  if (isParamValid("yield_stress") && _yield_stress <= 0)
50  mooseError("Yield stress must be greater than zero");
51 
52  if (_yield_stress_function == NULL && !isParamValid("yield_stress"))
53  mooseError("Either yield_stress or yield_stress_function must be given");
54 
55  if ((isParamValid("hardening_constant") && isParamValid("hardening_function")) ||
56  (!isParamValid("hardening_constant") && !isParamValid("hardening_function")))
57  mooseError("Either hardening_constant or hardening_function must be defined");
58 
59  if (isParamValid("hardening_function") && !_hardening_function)
60  mooseError("The hardening_function must be PiecewiseLinear");
61 }
62 
63 void
65 {
66  _hardening_variable[_qp] = 0;
68 }
69 
70 void
72  const SymmElasticityTensor & elasticityTensor)
73 {
75  dynamic_cast<const SymmIsotropicElasticityTensor *>(&elasticityTensor);
76  if (!eT)
77  mooseError("IsotropicPlasticity requires a SymmIsotropicElasticityTensor");
78 
81  _yield_condition = effectiveTrialStress - _hardening_variable_old[_qp] - _yield_stress;
84 }
85 
86 void
88 {
89  _plastic_strain[_qp] += plasticStrainIncrement;
90 }
91 
92 Real
93 IsotropicPlasticity::computeResidual(const Real effectiveTrialStress, const Real scalar)
94 {
95  Real residual = 0.0;
96  _hardening_slope = 0.0;
97  if (_yield_condition > 0.0)
98  {
101 
102  // The order here is important. The final term can be small, and we don't want it lost to
103  // roundoff.
105  residual = (effectiveTrialStress - _hardening_variable[_qp] - _yield_stress) -
106  (3 * _shear_modulus * scalar);
107  else
108  residual = (effectiveTrialStress - _hardening_variable[_qp] - _yield_stress) /
109  (3.0 * _shear_modulus) -
110  scalar;
111  }
112 
113  return residual;
114 }
115 
116 Real
117 IsotropicPlasticity::computeDerivative(const Real /*effectiveTrialStress*/, const Real /*scalar*/)
118 {
119  Real derivative(1);
120  if (_yield_condition > 0)
121  {
123  derivative = -3.0 * _shear_modulus - _hardening_slope;
124  else
125  derivative = -1.0 - _hardening_slope / (3.0 * _shear_modulus);
126  }
127 
128  return derivative;
129 }
130 
131 void
133 {
134  if (_yield_condition > 0)
136 }
137 
138 Real
140 {
141  Real hardening = _hardening_variable_old[_qp] + (_hardening_slope * scalar);
143  {
144  const Real strain_old = _effective_inelastic_strain_old[_qp];
145  Point p;
146 
147  hardening = _hardening_function->value(strain_old + scalar, p) - _yield_stress;
148  }
149  return hardening;
150 }
151 
153 {
154  Real slope = _hardening_constant;
156  {
157  const Real strain_old = _effective_inelastic_strain_old[_qp];
158  Point p;
159 
160  slope = _hardening_function->timeDerivative(strain_old, p);
161  }
162  return slope;
163 }
164 
165 void
167 {
169  {
170  Point p;
172  if (_yield_stress <= 0)
173  mooseError("Yield stress must be greater than zero");
174  }
175 }
This class defines a basic set of capabilities any elasticity tensor should have. ...
virtual Real computeResidual(const Real effectiveTrialStress, const Real scalar) override
Compute the residual for a predicted value of the scalar.
const VariableValue & _temperature
MaterialProperty< SymmTensor > & _plastic_strain
MaterialProperty< Real > & _hardening_variable
const MaterialProperty< Real > & _hardening_variable_old
Base class for models that perform return mapping iterations to compute stress.
virtual void computeYieldStress()
bool _legacy_return_mapping
Whether to use the legacy return mapping algorithm and compute residuals in the legacy manner...
InputParameters validParams< ReturnMappingModel >()
const MaterialProperty< SymmTensor > & _plastic_strain_old
virtual void iterationFinalize(Real scalar) override
Finalize internal state variables for a model for a given iteration.
virtual void computeStressFinalize(const SymmTensor &plasticStrainIncrement) override
Perform any necessary steps to finalize state after return mapping iterations.
virtual void initQpStatefulProperties() override
virtual void initQpStatefulProperties() override
virtual Real computeDerivative(const Real effectiveTrialStress, const Real scalar) override
Compute the derivative of the residual as a function of the scalar variable.
IsotropicPlasticity(const InputParameters &parameters)
virtual void computeStressInitialize(Real effectiveTrialStress, const SymmElasticityTensor &elasticityTensor) override
Perform any necessary initialization before return mapping iterations.
virtual Real computeHardeningValue(Real scalar)
const MaterialProperty< Real > & _effective_inelastic_strain_old
Function * _yield_stress_function
Real shearModulus() const
Return the shear modulus...
InputParameters validParams< IsotropicPlasticity >()
PiecewiseLinear *const _hardening_function
virtual Real computeHardeningDerivative(Real scalar)
Defines an Isotropic Elasticity Tensor.