www.mooseframework.org
IsotropicTempDepHardening.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 /****************************************************************/
8 
10 
11 #include "PiecewiseLinear.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<IsotropicPlasticity>();
18 
19  params.set<Real>("yield_stress") = 1.0;
20  params.set<Real>("hardening_constant") = 1.0;
21 
22  params.suppressParameter<Real>("yield_stress");
23  params.suppressParameter<FunctionName>("yield_stress_function");
24  params.suppressParameter<Real>("hardening_constant");
25  params.suppressParameter<FunctionName>("hardening_function");
26 
27  params.addRequiredParam<std::vector<FunctionName>>(
28  "hardening_functions",
29  "List of functions of true stress as function of plastic strain at different temperatures");
30  params.addRequiredParam<std::vector<Real>>(
31  "temperatures",
32  "List of temperatures corresponding to the functions listed in 'hardening_functions'");
33 
34  return params;
35 }
36 
37 IsotropicTempDepHardening::IsotropicTempDepHardening(const InputParameters & parameters)
38  : IsotropicPlasticity(parameters),
39  _hardening_functions_names(getParam<std::vector<FunctionName>>("hardening_functions")),
40  _hf_temperatures(getParam<std::vector<Real>>("temperatures"))
41 {
42  const unsigned int len = _hardening_functions_names.size();
43  if (len < 2)
44  mooseError("At least two stress-strain curves must be provided in hardening_functions");
45  _hardening_functions.resize(len);
46 
47  const unsigned int len_temps = _hf_temperatures.size();
48  if (len != len_temps)
49  mooseError("The vector of hardening function temperatures must have the same length as the "
50  "vector of temperature dependent hardening functions.");
51 
52  // Check that the temperatures are strictly increasing
53  for (unsigned int i = 1; i < len_temps; ++i)
54  {
55  if (_hf_temperatures[i] <= _hf_temperatures[i - 1])
56  mooseError("The temperature dependent hardening functions and corresponding temperatures "
57  "should be listed in order of increasing temperature.");
58  }
59 
60  std::vector<Real> yield_stress_vec;
61  for (unsigned int i = 0; i < len; ++i)
62  {
63  PiecewiseLinear * const f =
64  dynamic_cast<PiecewiseLinear *>(&getFunctionByName(_hardening_functions_names[i]));
65  if (!f)
66  mooseError("Function ", _hardening_functions_names[i], " not found in ", name());
67 
68  _hardening_functions[i] = f;
69 
70  yield_stress_vec.push_back(f->value(0.0, Point()));
71  }
72 
73  _interp_yield_stress = MooseSharedPointer<LinearInterpolation>(
74  new LinearInterpolation(_hf_temperatures, yield_stress_vec));
75 }
76 
77 void
79  const SymmElasticityTensor & elasticityTensor)
80 {
82  dynamic_cast<const SymmIsotropicElasticityTensor *>(&elasticityTensor);
83  if (!eT)
84  mooseError("IsotropicPlasticity requires a SymmIsotropicElasticityTensor");
85 
89  _yield_condition = effectiveTrialStress - _hardening_variable_old[_qp] - _yield_stress;
92 }
93 
94 void
96 {
97  const Real temp = _temperature[_qp];
98  if (temp > _hf_temperatures[0] && temp < _hf_temperatures.back())
99  {
100  for (unsigned int i = 0; i < _hf_temperatures.size() - 1; ++i)
101  {
102  if (temp >= _hf_temperatures[i] && temp < _hf_temperatures[i + 1])
103  {
104  _hf_index_lo = i;
105  _hf_index_hi = i + 1;
106  Real temp_lo = _hf_temperatures[i];
107  Real temp_hi = _hf_temperatures[i + 1];
108  _hf_fraction = (temp - temp_lo) / (temp_hi - temp_lo);
109  }
110  }
111  }
112 
113  else if (temp <= _hf_temperatures[0])
114  {
115  _hf_index_lo = 0;
117  _hf_fraction = 0.0;
118  }
119 
120  else if (temp >= _hf_temperatures.back())
121  {
122  _hf_index_lo = _hf_temperatures.size() - 1;
124  _hf_fraction = 1.0;
125  }
126 
127  if (_hf_fraction < 0.0)
128  mooseError("The hardening function fraction cannot be less than zero.");
129 }
130 
131 Real
133 {
134  const Real strain = _effective_inelastic_strain_old[_qp] + scalar;
135 
136  const Real stress =
137  (1.0 - _hf_fraction) * _hardening_functions[_hf_index_lo]->value(strain, Point()) +
138  _hf_fraction * _hardening_functions[_hf_index_hi]->value(strain, Point());
139 
140  return stress - _yield_stress;
141 }
142 
144 {
145  const Real strain_old = _effective_inelastic_strain_old[_qp];
146 
147  const Real derivative =
148  (1.0 - _hf_fraction) *
149  _hardening_functions[_hf_index_lo]->timeDerivative(strain_old, Point()) +
150  _hf_fraction * _hardening_functions[_hf_index_hi]->timeDerivative(strain_old, Point());
151 
152  return derivative;
153 }
154 
155 void
157 {
159  if (_yield_stress <= 0.0)
160  mooseError("The yield stress must be greater than zero, but during the simulation your yield "
161  "stress became less than zero.");
162 }
This class defines a basic set of capabilities any elasticity tensor should have. ...
const VariableValue & _temperature
MaterialProperty< SymmTensor > & _plastic_strain
MaterialProperty< Real > & _hardening_variable
const MaterialProperty< Real > & _hardening_variable_old
IsotropicTempDepHardening(const InputParameters &parameters)
const MaterialProperty< SymmTensor > & _plastic_strain_old
InputParameters validParams< IsotropicTempDepHardening >()
const std::vector< FunctionName > _hardening_functions_names
std::vector< PiecewiseLinear * > _hardening_functions
InputParameters validParams< IsotropicPlasticity >()
const MaterialProperty< Real > & _effective_inelastic_strain_old
virtual Real computeHardeningValue(Real scalar)
Real shearModulus() const
Return the shear modulus...
virtual void computeStressInitialize(Real effectiveTrialStress, const SymmElasticityTensor &elasticityTensor)
Perform any necessary initialization before return mapping iterations.
Defines an Isotropic Elasticity Tensor.
MooseSharedPointer< LinearInterpolation > _interp_yield_stress
virtual Real computeHardeningDerivative(Real scalar)