www.mooseframework.org
TemperatureDependentHardeningStressUpdate.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 
9 #include "PiecewiseLinear.h"
10 #include "ElasticityTensorTools.h"
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<IsotropicPlasticityStressUpdate>();
17 
18  params.set<Real>("yield_stress") = 1.0;
19  params.set<Real>("hardening_constant") = 1.0;
20 
21  params.suppressParameter<Real>("yield_stress");
22  params.suppressParameter<FunctionName>("yield_stress_function");
23  params.suppressParameter<Real>("hardening_constant");
24  params.suppressParameter<FunctionName>("hardening_function");
25 
26  params.addRequiredParam<std::vector<FunctionName>>(
27  "hardening_functions",
28  "List of functions of true stress as function of plastic strain at different temperatures");
29  params.addRequiredParam<std::vector<Real>>(
30  "temperatures",
31  "List of temperatures corresponding to the functions listed in 'hardening_functions'");
32 
33  return params;
34 }
35 
37  const InputParameters & parameters)
38  : IsotropicPlasticityStressUpdate(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  if (_hf_temperatures[i] <= _hf_temperatures[i - 1])
55  mooseError("The temperature dependent hardening functions and corresponding temperatures "
56  "should be listed in order of increasing temperature.");
57 
58  std::vector<Real> yield_stress_vec;
59  for (unsigned int i = 0; i < len; ++i)
60  {
61  PiecewiseLinear * const f =
62  dynamic_cast<PiecewiseLinear *>(&getFunctionByName(_hardening_functions_names[i]));
63  if (!f)
64  mooseError("Function ", _hardening_functions_names[i], " not found in ", name());
65 
66  _hardening_functions[i] = f;
67 
68  yield_stress_vec.push_back(f->value(0.0, Point()));
69  }
70 
71  _interp_yield_stress = MooseSharedPointer<LinearInterpolation>(
72  new LinearInterpolation(_hf_temperatures, yield_stress_vec));
73 }
74 
75 void
77  const Real effectiveTrialStress, const RankFourTensor & elasticity_tensor)
78 {
80  computeYieldStress(elasticity_tensor);
81  _yield_condition = effectiveTrialStress - _hardening_variable_old[_qp] - _yield_stress;
84 }
85 
86 void
88 {
89  const Real temp = _temperature[_qp];
90  if (temp > _hf_temperatures[0] && temp < _hf_temperatures.back())
91  {
92  for (unsigned int i = 0; i < _hf_temperatures.size() - 1; ++i)
93  {
94  if (temp >= _hf_temperatures[i] && temp < _hf_temperatures[i + 1])
95  {
96  _hf_index_lo = i;
97  _hf_index_hi = i + 1;
98  Real temp_lo = _hf_temperatures[i];
99  Real temp_hi = _hf_temperatures[i + 1];
100  _hf_fraction = (temp - temp_lo) / (temp_hi - temp_lo);
101  }
102  }
103  }
104 
105  else if (temp <= _hf_temperatures[0])
106  {
107  _hf_index_lo = 0;
109  _hf_fraction = 0.0;
110  }
111 
112  else if (temp >= _hf_temperatures.back())
113  {
114  _hf_index_lo = _hf_temperatures.size() - 1;
116  _hf_fraction = 1.0;
117  }
118 
119  if (_hf_fraction < 0.0)
120  mooseError("The hardening function fraction cannot be less than zero.");
121 }
122 
123 Real
125 {
126  const Real strain = _effective_inelastic_strain_old[_qp] + scalar;
127  const Real stress =
128  (1.0 - _hf_fraction) * _hardening_functions[_hf_index_lo]->value(strain, Point()) +
129  _hf_fraction * _hardening_functions[_hf_index_hi]->value(strain, Point());
130 
131  return stress - _yield_stress;
132 }
133 
135 {
136  const Real strain_old = _effective_inelastic_strain_old[_qp];
137 
138  return (1.0 - _hf_fraction) *
139  _hardening_functions[_hf_index_lo]->timeDerivative(strain_old, Point()) +
140  _hf_fraction * _hardening_functions[_hf_index_hi]->timeDerivative(strain_old, Point());
141 }
142 
143 void
145  const RankFourTensor & /*elasticity_tensor*/)
146 {
148  if (_yield_stress <= 0.0)
149  mooseError("The yield stress must be greater than zero, but during the simulation your yield "
150  "stress became less than zero.");
151 }
const MaterialProperty< Real > & _effective_inelastic_strain_old
const MaterialProperty< Real > & _hardening_variable_old
virtual void computeStressInitialize(const Real effectiveTrialStress, const RankFourTensor &elasticity_tensor) override
Perform any necessary initialization before return mapping iterations.
This class uses the Discrete material in a radial return isotropic plasticity model.
TemperatureDependentHardeningStressUpdate(const InputParameters &parameters)
MooseSharedPointer< LinearInterpolation > _interp_yield_stress
const MaterialProperty< RankTwoTensor > & _plastic_strain_old
old value of plastic strain
InputParameters validParams< IsotropicPlasticityStressUpdate >()
InputParameters validParams< TemperatureDependentHardeningStressUpdate >()
virtual void computeYieldStress(const RankFourTensor &elasticity_tensor) override
MaterialProperty< RankTwoTensor > & _plastic_strain
plastic strain in this model