www.mooseframework.org
TemperatureDependentHardeningStressUpdate.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 "PiecewiseLinear.h"
13 #include "ElasticityTensorTools.h"
14 
16 
18 
19 InputParameters
21 {
22  InputParameters params = IsotropicPlasticityStressUpdate::validParams();
23  params.addClassDescription("Computes the stress as a function of temperature "
24  "and plastic strain from user-supplied hardening "
25  "functions. This class can be used in conjunction "
26  "with other creep and plasticity materials for "
27  "more complex simulations");
28  params.set<Real>("yield_stress") = 1.0;
29  params.set<Real>("hardening_constant") = 1.0;
30 
31  params.suppressParameter<Real>("yield_stress");
32  params.suppressParameter<FunctionName>("yield_stress_function");
33  params.suppressParameter<Real>("hardening_constant");
34  params.suppressParameter<FunctionName>("hardening_function");
35 
36  params.addRequiredParam<std::vector<FunctionName>>(
37  "hardening_functions",
38  "List of functions of true stress as function of plastic strain at different temperatures");
39  params.addRequiredParam<std::vector<Real>>(
40  "temperatures",
41  "List of temperatures corresponding to the functions listed in 'hardening_functions'");
42 
43  return params;
44 }
45 
47  const InputParameters & parameters)
48  : IsotropicPlasticityStressUpdate(parameters),
49  _hardening_functions_names(getParam<std::vector<FunctionName>>("hardening_functions")),
50  _hf_temperatures(getParam<std::vector<Real>>("temperatures"))
51 {
52  const unsigned int len = _hardening_functions_names.size();
53  if (len < 2)
54  mooseError("At least two stress-strain curves must be provided in hardening_functions");
55  _hardening_functions.resize(len);
56 
57  const unsigned int len_temps = _hf_temperatures.size();
58  if (len != len_temps)
59  mooseError("The vector of hardening function temperatures must have the same length as the "
60  "vector of temperature dependent hardening functions.");
61 
62  // Check that the temperatures are strictly increasing
63  for (unsigned int i = 1; i < len_temps; ++i)
64  if (_hf_temperatures[i] <= _hf_temperatures[i - 1])
65  mooseError("The temperature dependent hardening functions and corresponding temperatures "
66  "should be listed in order of increasing temperature.");
67 
68  std::vector<Real> yield_stress_vec;
69  for (unsigned int i = 0; i < len; ++i)
70  {
71  const PiecewiseLinear * const f =
72  dynamic_cast<const PiecewiseLinear *>(&getFunctionByName(_hardening_functions_names[i]));
73  if (!f)
74  mooseError("Function ", _hardening_functions_names[i], " not found in ", name());
75 
76  _hardening_functions[i] = f;
77 
78  yield_stress_vec.push_back(f->value(0.0, Point()));
79  }
80 
81  _interp_yield_stress = MooseSharedPointer<LinearInterpolation>(
82  new LinearInterpolation(_hf_temperatures, yield_stress_vec));
83 }
84 
85 void
87  const Real effectiveTrialStress, const RankFourTensor & elasticity_tensor)
88 {
90  computeYieldStress(elasticity_tensor);
91 
92  _yield_condition = effectiveTrialStress - _hardening_variable_old[_qp] - _yield_stress;
95 }
96 
97 void
99 {
100  const Real temp = _temperature[_qp];
101  if (temp > _hf_temperatures[0] && temp < _hf_temperatures.back())
102  {
103  for (unsigned int i = 0; i < _hf_temperatures.size() - 1; ++i)
104  {
105  if (temp >= _hf_temperatures[i] && temp < _hf_temperatures[i + 1])
106  {
107  _hf_index_lo = i;
108  _hf_index_hi = i + 1;
109  _hf_fraction =
110  (temp - _hf_temperatures[i]) / (_hf_temperatures[i + 1] - _hf_temperatures[i]);
111  }
112  }
113  }
114  else if (temp <= _hf_temperatures[0])
115  {
116  _hf_index_lo = 0;
118  _hf_fraction = 0.0;
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  const Real stress =
136  (1.0 - _hf_fraction) * _hardening_functions[_hf_index_lo]->value(strain, Point()) +
137  _hf_fraction * _hardening_functions[_hf_index_hi]->value(strain, Point());
138 
139  return stress - _yield_stress;
140 }
141 
143 {
144  const Real strain_old = _effective_inelastic_strain_old[_qp];
145 
146  return (1.0 - _hf_fraction) *
147  _hardening_functions[_hf_index_lo]->timeDerivative(strain_old, Point()) +
148  _hf_fraction * _hardening_functions[_hf_index_hi]->timeDerivative(strain_old, Point());
149 }
150 
151 void
153  const RankFourTensor & /*elasticity_tensor*/)
154 {
156  if (_yield_stress <= 0.0)
157  mooseError("The yield stress must be greater than zero, but during the simulation your yield "
158  "stress became less than zero.");
159 }
IsotropicPlasticityStressUpdate::_yield_condition
Real _yield_condition
Definition: IsotropicPlasticityStressUpdate.h:67
defineLegacyParams
defineLegacyParams(TemperatureDependentHardeningStressUpdate)
TemperatureDependentHardeningStressUpdate::_hf_temperatures
std::vector< Real > _hf_temperatures
The temperatures at which each of the hardening functions are defined.
Definition: TemperatureDependentHardeningStressUpdate.h:57
TemperatureDependentHardeningStressUpdate::computeYieldStress
virtual void computeYieldStress(const RankFourTensor &elasticity_tensor) override
Definition: TemperatureDependentHardeningStressUpdate.C:152
TemperatureDependentHardeningStressUpdate::_hf_index_lo
unsigned int _hf_index_lo
Indices to identify the lower and upper temperature bounds for the current value.
Definition: TemperatureDependentHardeningStressUpdate.h:60
IsotropicPlasticityStressUpdate::validParams
static InputParameters validParams()
Definition: IsotropicPlasticityStressUpdate.C:20
registerMooseObject
registerMooseObject("TensorMechanicsApp", TemperatureDependentHardeningStressUpdate)
TemperatureDependentHardeningStressUpdate.h
TemperatureDependentHardeningStressUpdate::_hf_index_hi
unsigned int _hf_index_hi
Definition: TemperatureDependentHardeningStressUpdate.h:61
TemperatureDependentHardeningStressUpdate::validParams
static InputParameters validParams()
Definition: TemperatureDependentHardeningStressUpdate.C:20
TemperatureDependentHardeningStressUpdate::computeHardeningValue
virtual Real computeHardeningValue(Real scalar) override
Definition: TemperatureDependentHardeningStressUpdate.C:132
IsotropicPlasticityStressUpdate::_hardening_variable_old
const MaterialProperty< Real > & _hardening_variable_old
Definition: IsotropicPlasticityStressUpdate.h:77
RadialReturnStressUpdate::_effective_inelastic_strain_old
const MaterialProperty< Real > & _effective_inelastic_strain_old
Definition: RadialReturnStressUpdate.h:136
IsotropicPlasticityStressUpdate::_yield_stress
Real _yield_stress
Definition: IsotropicPlasticityStressUpdate.h:63
TemperatureDependentHardeningStressUpdate::computeStressInitialize
virtual void computeStressInitialize(const Real effectiveTrialStress, const RankFourTensor &elasticity_tensor) override
Perform any necessary initialization before return mapping iterations.
Definition: TemperatureDependentHardeningStressUpdate.C:86
IsotropicPlasticityStressUpdate::_plastic_strain_old
const MaterialProperty< RankTwoTensor > & _plastic_strain_old
old value of plastic strain
Definition: IsotropicPlasticityStressUpdate.h:74
TemperatureDependentHardeningStressUpdate::_hardening_functions
std::vector< const PiecewiseLinear * > _hardening_functions
Definition: TemperatureDependentHardeningStressUpdate.h:53
IsotropicPlasticityStressUpdate::_hardening_variable
MaterialProperty< Real > & _hardening_variable
Definition: IsotropicPlasticityStressUpdate.h:76
IsotropicPlasticityStressUpdate::_plastic_strain
MaterialProperty< RankTwoTensor > & _plastic_strain
plastic strain in this model
Definition: IsotropicPlasticityStressUpdate.h:71
TemperatureDependentHardeningStressUpdate::TemperatureDependentHardeningStressUpdate
TemperatureDependentHardeningStressUpdate(const InputParameters &parameters)
Definition: TemperatureDependentHardeningStressUpdate.C:46
ElasticityTensorTools.h
TemperatureDependentHardeningStressUpdate::_hf_fraction
Real _hf_fraction
The fraction of the temperature within the bounds of the relevant section of the piecewise hardening ...
Definition: TemperatureDependentHardeningStressUpdate.h:70
name
const std::string name
Definition: Setup.h:21
TemperatureDependentHardeningStressUpdate::initializeHardeningFunctions
void initializeHardeningFunctions()
Determines the section of the piecewise temperature dependent hardening function for the current temp...
Definition: TemperatureDependentHardeningStressUpdate.C:98
RankFourTensorTempl< Real >
TemperatureDependentHardeningStressUpdate
This class inherits from IsotropicPlasticityStressUpdate.
Definition: TemperatureDependentHardeningStressUpdate.h:27
TemperatureDependentHardeningStressUpdate::_hardening_functions_names
const std::vector< FunctionName > _hardening_functions_names
The function names and expressions for hardening as a function of temperature.
Definition: TemperatureDependentHardeningStressUpdate.h:52
TemperatureDependentHardeningStressUpdate::_interp_yield_stress
MooseSharedPointer< LinearInterpolation > _interp_yield_stress
Definition: TemperatureDependentHardeningStressUpdate.h:49
IsotropicPlasticityStressUpdate::_temperature
const VariableValue & _temperature
Definition: IsotropicPlasticityStressUpdate.h:78
IsotropicPlasticityStressUpdate
This class uses the Discrete material in a radial return isotropic plasticity model.
Definition: IsotropicPlasticityStressUpdate.h:37
TemperatureDependentHardeningStressUpdate::computeHardeningDerivative
virtual Real computeHardeningDerivative(Real scalar) override
Definition: TemperatureDependentHardeningStressUpdate.C:142