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