https://mooseframework.inl.gov
CrystalPlasticityStateVarRateComponentVoce.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 #include "MooseError.h"
12 
14 
17 {
18 
20  params.addParam<std::string>(
21  "uo_slip_rate_name",
22  "Name of slip rate property: Same as slip rate user object specified in input file.");
23  params.addParam<std::string>("uo_state_var_name",
24  "Name of state variable property: Same as "
25  "state variable user object specified in input "
26  "file.");
27  params.addParam<MooseEnum>(
28  "crystal_lattice_type",
30  "Type of crystal lattyce structure output");
31  params.addParam<std::vector<unsigned int>>("groups",
32  {},
33  "To group the initial values on different "
34  "slip systems 'format: [start end)', i.e.'0 "
35  "12 24 48' groups 0-11, 12-23 and 24-48 ");
36  params.addParam<std::vector<Real>>("h0_group_values",
37  "h0 hardening constant for each group "
38  " i.e. '0.0 1.0 2.0' means 0-11 = 0.0, "
39  "12-23 = 1.0 and 24-48 = 2.0 ");
40  params.addParam<std::vector<Real>>("tau0_group_values",
41  "The initial critical resolved shear stress"
42  "corresponding to each group"
43  " i.e. '100.0 110.0 120.0' means 0-11 = 100.0, "
44  "12-23 = 110.0 and 24-48 = 120.0 ");
45  params.addParam<std::vector<Real>>("tauSat_group_values",
46  "The saturation resolved shear stress"
47  "corresponding to each group"
48  " i.e. '150.0 170.0 180.0' means 0-11 = 150.0, "
49  "12-23 = 170.0 and 24-48 = 180.0 ");
50  params.addParam<std::vector<Real>>("hardeningExponent_group_values",
51  "The hardening exponent m"
52  "corresponding to each group"
53  " i.e. '1.0 2.0 3.0' means 0-11 = 1.0, "
54  "12-23 = 2.0 and 24-48 = 3.0 ");
55  params.addParam<std::vector<Real>>("selfHardening_group_values",
56  "The self hardening coefficient q_aa"
57  "corresponding to each group"
58  " i.e. '1.0 2.0 3.0' means 0-11 = 1.0, "
59  "12-23 = 2.0 and 24-48 = 3.0 "
60  " usually these are all 1.");
61  params.addParam<std::vector<Real>>("coplanarHardening_group_values",
62  "The coplanar latent hardening coefficient q_ab"
63  "corresponding to each group"
64  " i.e. '1.0 2.0 3.0' means 0-11 = 1.0, "
65  "12-23 = 2.0 and 24-48 = 3.0 ");
66  params.addParam<std::vector<Real>>("GroupGroup_Hardening_group_values",
67  "The group-to-group latent hardening coefficient q_ab"
68  "This is a NxN vector"
69  " i.e. '1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0' "
70  "means non-coplanar slip systems in gr_11,22,33= "
71  "1.0, 5.0 and 9.0 respectively."
72  "latent hardening between for gr_12,13 = 2.0 3.0"
73  " respectively");
74  params.addClassDescription("Phenomenological Voce constitutive model state variable evolution "
75  "rate component base class.");
76  return params;
77 }
78 
80  const InputParameters & parameters)
82  _mat_prop_slip_rate(
83  getMaterialProperty<std::vector<Real>>(parameters.get<std::string>("uo_slip_rate_name"))),
84  _mat_prop_state_var(
85  getMaterialProperty<std::vector<Real>>(parameters.get<std::string>("uo_state_var_name"))),
86  _crystal_lattice_type(getParam<MooseEnum>("crystal_lattice_type")),
87  _groups(getParam<std::vector<unsigned int>>("groups")),
88  _h0_group_values(getParam<std::vector<Real>>("h0_group_values")),
89  _tau0_group_values(getParam<std::vector<Real>>("tau0_group_values")),
90  _tauSat_group_values(getParam<std::vector<Real>>("tauSat_group_values")),
91  _hardeningExponent_group_values(getParam<std::vector<Real>>("hardeningExponent_group_values")),
92  _selfHardening_group_values(getParam<std::vector<Real>>("selfHardening_group_values")),
93  _coplanarHardening_group_values(getParam<std::vector<Real>>("coplanarHardening_group_values")),
94  _GroupGroup_Hardening_group_values(
95  getParam<std::vector<Real>>("GroupGroup_Hardening_group_values")),
96  _n_groups(_groups.size())
97 {
98  // perform input checks
99  if (_n_groups < 2)
100  paramError("groups",
101  "the number of slip system groups provided is not "
102  "correct. At least two values are expected");
103 
104  // check the size of all the user provided parameters
105  if (_h0_group_values.size() != _n_groups - 1)
106  paramError("h0_group_values",
107  "the number of supplied parameters does not"
108  " match the number of ip system groups");
109 
110  if (_tau0_group_values.size() != _n_groups - 1)
111  paramError("tau0_group_values",
112  "the number of supplied parameters does "
113  "not match the number of slip system groups");
114 
115  if (_tauSat_group_values.size() != _n_groups - 1)
116  paramError("tauSat_group_values",
117  "the number of supplied parameters does "
118  "not match the number of slip system groups");
119 
120  if (_hardeningExponent_group_values.size() != _n_groups - 1)
121  paramError("hardeningExponent_group_values",
122  "the number of supplied "
123  "parameters does not match the number of slip system groups");
124 
125  if (_selfHardening_group_values.size() != _n_groups - 1)
126  paramError("selfHardening_group_values",
127  "the number of supplied parameters "
128  "does not match the number of slip system groups");
129 
130  if (_coplanarHardening_group_values.size() != _n_groups - 1)
131  paramError("coplanarHardening_group_values",
132  "the number of supplied "
133  "parameters does not match the number of slip system groups");
134 
135  if (_GroupGroup_Hardening_group_values.size() != (_n_groups - 1) * (_n_groups - 1))
136  paramError("GroupGroup_Hardening_group_values",
137  "the number of supplied "
138  "parameters does not match the number of slip system groups");
139 
140  // initialize useful variables;
143 }
144 
145 bool
147  unsigned int qp, std::vector<Real> & val) const
148 {
149  val.assign(_variable_size, 0.0);
150 
151  unsigned int group_i;
152  Real h0;
153  Real tau_0;
154  Real tau_sat;
155  Real hardening_exponenet;
156  Real delta_tau;
157 
158  DenseVector<Real> hb(_variable_size);
159 
160  for (unsigned int i = 0; i < _variable_size; ++i)
161  {
162  group_i = _slipSystem_GroupID[i];
163  h0 = _h0_group_values[group_i];
164  tau_0 = _tau0_group_values[group_i];
165  tau_sat = _tauSat_group_values[group_i];
166  hardening_exponenet = _hardeningExponent_group_values[group_i];
167 
168  delta_tau = tau_sat - tau_0;
169 
170  hb(i) = h0 *
171  std::pow(std::abs(1.0 - (_mat_prop_state_var[qp][i] - tau_0) / delta_tau),
172  hardening_exponenet) *
173  std::copysign(1.0, 1.0 - (_mat_prop_state_var[qp][i] - tau_0) / delta_tau);
174  }
175 
176  for (unsigned int i = 0; i < _variable_size; ++i)
177  for (unsigned int j = 0; j < _variable_size; ++j)
178  {
179  const Real q_ab = getHardeningCoefficient(i, j);
180  val[i] += std::abs(_mat_prop_slip_rate[qp][j]) * q_ab * hb(j);
181  }
182 
183  return true;
184 }
185 
186 MooseEnum
188 {
189  return MooseEnum("FCC BCC", "FCC");
190 }
191 
192 void
194  std::vector<unsigned int> & _slipSystem_PlaneID) const
195 {
197 
198  for (unsigned int slipSystemIndex = 0; slipSystemIndex < _variable_size; ++slipSystemIndex)
199  switch (_crystal_lattice_type)
200  {
201  case 0: // FCC
202  if (slipSystemIndex < 12)
203  _slipSystem_PlaneID[slipSystemIndex] = slipSystemIndex / 3;
204  else
205  mooseError("FCC with more than 12 slip planes is not implemented ");
206 
207  break;
208 
209  case 1: // BCC
210  if (slipSystemIndex < 12)
211  _slipSystem_PlaneID[slipSystemIndex] = slipSystemIndex / 2;
212 
213  else if (slipSystemIndex >= 12 && slipSystemIndex < 48)
214  _slipSystem_PlaneID[slipSystemIndex] = (slipSystemIndex - 6);
215 
216  else
217  mooseError("BCC with more than 48 slip systems is not implemented ");
218 
219  break;
220 
221  default:
222  mooseError("VoceHardeningError: Pass valid crustal_structure_type ");
223  }
224 }
225 
226 void
228  std::vector<unsigned int> & _slipSystem_GroupID) const
229 {
231 
232  for (unsigned int slipSystemIndex = 0; slipSystemIndex < _variable_size; ++slipSystemIndex)
233  for (unsigned int i = 0; i < _n_groups - 1; ++i)
234  if (slipSystemIndex >= _groups[i] && slipSystemIndex < _groups[i + 1])
235  {
236  _slipSystem_GroupID[slipSystemIndex] = i;
237  break;
238  }
239 }
240 
241 Real
243  unsigned int slipSystemIndex_i, unsigned int slipSystemIndex_j) const
244 {
245  // collect slip system plane and group
246  const unsigned int group_i = _slipSystem_GroupID[slipSystemIndex_i];
247  const unsigned int group_j = _slipSystem_GroupID[slipSystemIndex_j];
248  const unsigned int plane_i = _slipSystem_PlaneID[slipSystemIndex_i];
249  const unsigned int plane_j = _slipSystem_PlaneID[slipSystemIndex_j];
250 
251  // create check for clarity
252  const bool same_slipSystem = slipSystemIndex_i == slipSystemIndex_j;
253  const bool same_group = group_i == group_j;
254  const bool same_plane = plane_i == plane_j;
255 
256  // retrieve appropriate coefficient
257  Real q_ab;
258  if (same_slipSystem)
259  q_ab = _selfHardening_group_values[group_i];
260  else if (same_plane)
261  q_ab = _coplanarHardening_group_values[group_i];
262  else if (same_group) // here for debugging purposes this if could be removed
263  q_ab = _GroupGroup_Hardening_group_values[group_i * (_n_groups - 1) + group_i];
264  else if (!same_group)
265  q_ab = _GroupGroup_Hardening_group_values[group_i * (_n_groups - 1) + group_j];
266  else // here for debugging purposes
267  mooseError("VoceHardeningError:getHardeningCoefficient: case not listed, abort ");
268 
269  return q_ab;
270 }
void paramError(const std::string &param, Args... args) const
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const MaterialProperty< std::vector< Real > > & _mat_prop_state_var
virtual void initSlipSystemPlaneID(std::vector< unsigned int > &_slipSystem_PlaneID) const
method associating slip system to their group by generating a vector containing the association betwe...
registerMooseObject("SolidMechanicsApp", CrystalPlasticityStateVarRateComponentVoce)
virtual void initSlipSystemGroupID(std::vector< unsigned int > &_slipSystem_GroupID) const
method associating slip system to their slip plane by generating a vector containing the association ...
const unsigned int _n_groups
the number of slip system groups
std::vector< unsigned int > _slipSystem_GroupID
the vector associating a slip system to its groud ID
static MooseEnum crystalLatticeTypeOptions()
class for switching between different crystal lattice types
virtual bool calcStateVariableEvolutionRateComponent(unsigned int qp, std::vector< Real > &val) const
computing the slip system hardening rate
const MaterialProperty< std::vector< Real > > & _mat_prop_slip_rate
std::vector< unsigned int > _groups
the vectors of the input paramters
MooseEnum _crystal_lattice_type
the variable to switch crystal lattice type (i.e. FCC or BCC)
virtual Real getHardeningCoefficient(unsigned int slipSystemIndex_i, unsigned int slipSystemIndex_j) const
method retriving the appropiate self/latent hardening coefficient
std::vector< unsigned int > _slipSystem_PlaneID
the vector associating a slip system to its slip plane ID
CrystalPlasticityStateVarRateComponentVoce(const InputParameters &parameters)
Crystal plasticity state variable evolution rate component userobject base class. ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
Phenomenological constitutive model state variable evolution rate component userobject class...
MooseUnits pow(const MooseUnits &, int)
void ErrorVector unsigned int
const Elem & get(const ElemType type_in)