www.mooseframework.org
ComputeIsotropicElasticityTensor.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 
16 
17 template <bool is_ad, typename T>
20 {
22  params.addClassDescription("Compute a constant isotropic elasticity tensor.");
23  params.addParam<Real>("bulk_modulus", -1, "The bulk modulus for the material.");
24  params.addParam<Real>("lambda", -1, "Lame's first constant for the material.");
25  params.addParam<Real>("poissons_ratio", -1, "Poisson's ratio for the material.");
26  params.addParam<Real>("shear_modulus", -1, "The shear modulus of the material.");
27  params.addParam<Real>("youngs_modulus", -1, "Young's modulus of the material.");
28  params.declareControllable("bulk_modulus lambda poissons_ratio shear_modulus youngs_modulus");
29  return params;
30 }
31 
32 template <bool is_ad, typename T>
34  const InputParameters & parameters)
35  : ComputeElasticityTensorBaseTempl<is_ad, T>(parameters),
36  _bulk_modulus_set(parameters.isParamSetByUser("bulk_modulus")),
37  _lambda_set(parameters.isParamSetByUser("lambda")),
38  _poissons_ratio_set(parameters.isParamSetByUser("poissons_ratio")),
39  _shear_modulus_set(parameters.isParamSetByUser("shear_modulus")),
40  _youngs_modulus_set(parameters.isParamSetByUser("youngs_modulus")),
41  _bulk_modulus(this->template getParam<Real>("bulk_modulus")),
42  _lambda(this->template getParam<Real>("lambda")),
43  _poissons_ratio(this->template getParam<Real>("poissons_ratio")),
44  _shear_modulus(this->template getParam<Real>("shear_modulus")),
45  _youngs_modulus(this->template getParam<Real>("youngs_modulus")),
46  _effective_stiffness_local(parameters.isParamValid("effective_stiffness_local"))
47 {
48  unsigned int num_elastic_constants = _bulk_modulus_set + _lambda_set + _poissons_ratio_set +
50  if (num_elastic_constants != 2)
51  mooseError("Exactly two elastic constants must be defined for material '" + name() + "'.");
52 
53  // all tensors created by this class are always isotropic
55  issueGuarantee("effective_stiffness", Guarantee::ISOTROPIC);
56  if (!isParamValid("elasticity_tensor_prefactor"))
58 
59  if (_bulk_modulus_set && _bulk_modulus <= 0.0)
60  mooseError("Bulk modulus must be positive in material '" + name() + "'.");
61 
62  if (_poissons_ratio_set && (_poissons_ratio <= -1.0 || _poissons_ratio >= 0.5))
63  mooseError("Poissons ratio must be greater than -1 and less than 0.5 in "
64  "material '" +
65  name() + "'.");
66 
68  mooseError("Shear modulus must not be negative in material '" + name() + "'.");
69 
71  mooseError("Youngs modulus must be positive in material '" + name() + "'.");
72 }
73 
74 template <bool is_ad, typename T>
75 void
77 {
78  std::vector<Real> iso_const(2);
79  Real elas_mod;
80  Real poiss_rat;
81 
82  if (_youngs_modulus_set && _poissons_ratio_set)
83  {
84  _Cijkl.fillSymmetricIsotropicEandNu(_youngs_modulus, _poissons_ratio);
85  _effective_stiffness_local =
86  std::max(std::sqrt((_youngs_modulus * (1 - _poissons_ratio)) /
87  ((1 + _poissons_ratio) * (1 - 2 * _poissons_ratio))),
88  std::sqrt(_youngs_modulus / (2 * (1 + _poissons_ratio))));
89  return;
90  }
91 
92  if (_lambda_set && _shear_modulus_set)
93  {
94  iso_const[0] = _lambda;
95  iso_const[1] = _shear_modulus;
96  elas_mod = (_shear_modulus * (3 * _lambda + 2 * _shear_modulus)) / (_lambda + _shear_modulus);
97  poiss_rat = _lambda / (2 * (_lambda + _shear_modulus));
98  _effective_stiffness_local =
99  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
100  std::sqrt(_shear_modulus));
101  }
102  else if (_shear_modulus_set && _bulk_modulus_set)
103  {
104  iso_const[0] = _bulk_modulus - 2.0 / 3.0 * _shear_modulus;
105  iso_const[1] = _shear_modulus;
106  elas_mod = (9 * _bulk_modulus * _shear_modulus) / (3 * _bulk_modulus + _shear_modulus);
107  poiss_rat =
108  (3 * _bulk_modulus - 2 * _shear_modulus) / (2 * (3 * _bulk_modulus + _shear_modulus));
109  _effective_stiffness_local =
110  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
111  std::sqrt(_shear_modulus));
112  }
113  else if (_poissons_ratio_set && _bulk_modulus_set)
114  {
115  iso_const[0] = 3.0 * _bulk_modulus * _poissons_ratio / (1.0 + _poissons_ratio);
116  iso_const[1] =
117  3.0 * _bulk_modulus * (1.0 - 2.0 * _poissons_ratio) / (2.0 * (1.0 + _poissons_ratio));
118  elas_mod = 3 * _bulk_modulus * (1 - 2 * _poissons_ratio);
119  poiss_rat = _poissons_ratio;
120  _effective_stiffness_local =
121  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
122  std::sqrt(elas_mod / (2 * (1 + poiss_rat))));
123  }
124  else if (_lambda_set && _bulk_modulus_set)
125  {
126  iso_const[0] = _lambda;
127  iso_const[1] = 3.0 * (_bulk_modulus - _lambda) / 2.0;
128  elas_mod = (9 * _bulk_modulus * (_bulk_modulus - _lambda)) / (3 * _bulk_modulus - _lambda);
129  poiss_rat = (_lambda) / ((3 * _bulk_modulus - _lambda));
130  _effective_stiffness_local =
131  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
132  std::sqrt(elas_mod / (2 * (1 + poiss_rat))));
133  }
134  else if (_shear_modulus_set && _youngs_modulus_set)
135  {
136  iso_const[0] = _shear_modulus * (_youngs_modulus - 2.0 * _shear_modulus) /
137  (3.0 * _shear_modulus - _youngs_modulus);
138  iso_const[1] = _shear_modulus;
139  elas_mod = _youngs_modulus;
140  poiss_rat = (_youngs_modulus - 2 * _shear_modulus) / (2 * _shear_modulus);
141  _effective_stiffness_local =
142  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
143  std::sqrt(elas_mod / (2 * (1 + poiss_rat))));
144  }
145  else if (_shear_modulus_set && _poissons_ratio_set)
146  {
147  iso_const[0] = 2.0 * _shear_modulus * _poissons_ratio / (1.0 - 2.0 * _poissons_ratio);
148  iso_const[1] = _shear_modulus;
149  elas_mod = (2 * _shear_modulus * (1 + _poissons_ratio));
150  poiss_rat = (_poissons_ratio);
151  _effective_stiffness_local =
152  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
153  std::sqrt(elas_mod / (2 * (1 + poiss_rat))));
154  }
155  else if (_youngs_modulus_set && _bulk_modulus_set)
156  {
157  iso_const[0] = 3.0 * _bulk_modulus * (3.0 * _bulk_modulus - _youngs_modulus) /
158  (9.0 * _bulk_modulus - _youngs_modulus);
159  iso_const[1] = 3.0 * _bulk_modulus * _youngs_modulus / (9.0 * _bulk_modulus - _youngs_modulus);
160  elas_mod = (_youngs_modulus);
161  poiss_rat = (3 * _bulk_modulus - _youngs_modulus) / (6 * _bulk_modulus);
162  _effective_stiffness_local =
163  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
164  std::sqrt(elas_mod / (2 * (1 + poiss_rat))));
165  }
166  else if (_lambda_set && _poissons_ratio_set)
167  {
168  iso_const[0] = _lambda;
169  iso_const[1] = _lambda * (1.0 - 2.0 * _poissons_ratio) / (2.0 * _poissons_ratio);
170  elas_mod = (_lambda * (1 + _poissons_ratio) * (1 - 2 * _poissons_ratio)) / (_poissons_ratio);
171  poiss_rat = (_poissons_ratio);
172  _effective_stiffness_local =
173  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
174  std::sqrt(elas_mod / (2 * (1 + poiss_rat))));
175  }
176  else if (_lambda_set && _youngs_modulus_set)
177  {
178  iso_const[0] = _lambda;
179  iso_const[1] = (_youngs_modulus - 3.0 * _lambda +
180  std::sqrt(_youngs_modulus * _youngs_modulus + 9.0 * _lambda * _lambda +
181  2.0 * _youngs_modulus * _lambda)) /
182  4.0;
183  elas_mod = (_youngs_modulus);
184  poiss_rat = (2 * _lambda) / (_youngs_modulus + _lambda +
185  std::sqrt(std::pow(_youngs_modulus, 2) + 9 * std::pow(_lambda, 2) +
186  2 * _youngs_modulus * _lambda));
187  _effective_stiffness_local =
188  std::max(std::sqrt((elas_mod * (1 - poiss_rat)) / ((1 + poiss_rat) * (1 - 2 * poiss_rat))),
189  std::sqrt(elas_mod / (2 * (1 + poiss_rat))));
190  }
191  else
192  mooseError("Incorrect combination of elastic properties in ComputeIsotropicElasticityTensor.");
193 
194  // Fill elasticity tensor
195  _Cijkl.fillFromInputVector(iso_const, T::symmetric_isotropic);
196 }
197 
198 template <bool is_ad, typename T>
199 void
201 {
202  // Assign elasticity tensor at a given quad point
203  _elasticity_tensor[_qp] = _Cijkl;
204 
205  // Assign effective stiffness at a given quad point
206  _effective_stiffness[_qp] = _effective_stiffness_local;
207 }
208 
ComputeIsotropicElasticityTensorTempl(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void mooseError(Args &&... args)
registerMooseObject("SolidMechanicsApp", ComputeIsotropicElasticityTensor)
ComputeElasticityTensorBase the base class for computing elasticity tensors.
void issueGuarantee(const MaterialPropertyName &prop_name, Guarantee guarantee)
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
virtual const std::string & name() const
bool isParamValid(const std::string &name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ComputeIsotropicElasticityTensor defines an elasticity tensor material for isotropic materials...
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
MooseUnits pow(const MooseUnits &, int)
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})