www.mooseframework.org
SymmIsotropicElasticityTensor.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  : SymmElasticityTensor(constant),
14  _lambda_set(false),
15  _mu_set(false),
16  _E_set(false),
17  _nu_set(false),
18  _k_set(false),
19  _lambda(0),
20  _mu(0),
21  _E(0),
22  _nu(0),
23  _k(0)
24 {
25 }
26 
27 void
29 {
30  _lambda = lambda;
31  _lambda_set = true;
32 }
33 
34 void
36 {
37  _mu = mu;
38  _mu_set = true;
39 }
40 
41 void
43 {
44  _E = E;
45  _E_set = true;
46 }
47 
48 void
50 {
51  _nu = nu;
52  _nu_set = true;
53 }
54 
55 void
57 {
58  _k = k;
59  _k_set = true;
60 }
61 
62 void
64 {
65  setMu(k);
66 }
67 
68 Real
70 {
71  return mu();
72 }
73 
74 Real
76 {
77  if (!_E_set)
78  mooseError("Youngs modulus not set");
79 
80  return _E;
81 }
82 
83 Real
85 {
86  if (!_mu_set)
87  {
88  mooseError("mu not set");
89  }
90  return _mu;
91 }
92 
93 void
95 {
96  if (_lambda_set && _mu_set) // First and second Lame
97  return;
98  else if (_lambda_set && _nu_set)
99  _mu = (_lambda * (1.0 - 2.0 * _nu)) / (2.0 * _nu);
100  else if (_lambda_set && _k_set)
101  _mu = (3.0 * (_k - _lambda)) / 2.0;
102  else if (_lambda_set && _E_set)
103  _mu = ((_E - 3.0 * _lambda) / 4.0) +
104  (std::sqrt((_E - 3.0 * _lambda) * (_E - 3.0 * _lambda) + 8.0 * _lambda * _E) / 4.0);
105  else if (_mu_set && _nu_set)
106  _lambda = (2.0 * _mu * _nu) / (1.0 - 2.0 * _nu);
107  else if (_mu_set && _k_set)
108  _lambda = (3.0 * _k - 2.0 * _mu) / 3.0;
109  else if (_mu_set && _E_set)
110  _lambda = ((2.0 * _mu - _E) * _mu) / (_E - 3.0 * _mu);
111  else if (_nu_set && _k_set)
112  {
113  _lambda = (3.0 * _k * _nu) / (1.0 + _nu);
114  _mu = (3.0 * _k * (1.0 - 2.0 * _nu)) / (2.0 * (1.0 + _nu));
115  }
116  else if (_E_set && _nu_set) // Young's Modulus and Poisson's Ratio
117  {
118  _lambda = (_nu * _E) / ((1.0 + _nu) * (1 - 2.0 * _nu));
119  _mu = _E / (2.0 * (1.0 + _nu));
120  }
121  else if (_E_set && _k_set)
122  {
123  _lambda = (3.0 * _k * (3.0 * _k - _E)) / (9.0 * _k - _E);
124  _mu = (3.0 * _E * _k) / (9.0 * _k - _E);
125  }
126  _lambda_set = true;
127  _mu_set = true;
128 }
129 
130 void
132 {
134 
135  const Real C12(_lambda);
136  const Real C44(_mu);
137  const Real C11(2 * C44 + C12);
138 
139  setEntries(C11, C12, C44);
140 }
141 
142 void
143 SymmIsotropicElasticityTensor::setEntries(Real C11, Real C12, Real C44)
144 {
145  _val[0] = _val[6] = _val[11] = C11;
146  _val[1] = _val[2] = _val[7] = C12;
147  _val[15] = _val[18] = _val[20] = C44;
148  _val[3] = _val[4] = _val[5] = 0;
149  _val[8] = _val[9] = _val[10] = 0;
150  _val[12] = _val[13] = _val[14] = 0;
151  _val[16] = _val[17] = 0;
152  _val[19] = 0;
153 }
154 
155 Real
157  const unsigned int j,
158  const RealGradient & test,
159  const RealGradient & phi) const
160 {
161  RealGradient b;
162  if (0 == i && 0 == j)
163  {
164  b(0) = _val[0] * phi(0);
165  b(1) = _val[15] * phi(1);
166  b(2) = _val[20] * phi(2);
167  }
168  else if (1 == i && 1 == j)
169  {
170  b(0) = _val[15] * phi(0);
171  b(1) = _val[6] * phi(1);
172  b(2) = _val[18] * phi(2);
173  }
174  else if (2 == i && 2 == j)
175  {
176  b(0) = _val[20] * phi(0);
177  b(1) = _val[18] * phi(1);
178  b(2) = _val[11] * phi(2);
179  }
180  else if (0 == i && 1 == j)
181  {
182  b(0) = _val[1] * phi(1);
183  b(1) = _val[15] * phi(0);
184  b(2) = 0;
185  }
186  else if (1 == i && 0 == j)
187  {
188  b(0) = _val[15] * phi(1);
189  b(1) = _val[1] * phi(0);
190  b(2) = 0;
191  }
192  else if (1 == i && 2 == j)
193  {
194  b(0) = 0;
195  b(1) = _val[7] * phi(2);
196  b(2) = _val[18] * phi(1);
197  }
198  else if (2 == i && 1 == j)
199  {
200  b(0) = 0;
201  b(1) = _val[18] * phi(2);
202  b(2) = _val[7] * phi(1);
203  }
204  else if (0 == i && 2 == j)
205  {
206  b(0) = _val[2] * phi(2);
207  b(1) = 0;
208  b(2) = _val[20] * phi(0);
209  }
210  else if (2 == i && 0 == j)
211  {
212  b(0) = _val[20] * phi(2);
213  b(1) = 0;
214  b(2) = _val[2] * phi(0);
215  }
216  else
217  {
218  mooseError("Wrong index in stiffness calculation");
219  }
220  return test * b;
221 }
222 
223 void
225 {
226  const Real xx = x.xx();
227  const Real yy = x.yy();
228  const Real zz = x.zz();
229  const Real xy = x.xy();
230  const Real yz = x.yz();
231  const Real zx = x.zx();
232 
233  b.xx() = _val[0] * xx + _val[1] * yy + _val[2] * zz;
234  b.yy() = _val[1] * xx + _val[6] * yy + _val[7] * zz;
235  b.zz() = _val[2] * xx + _val[7] * yy + _val[11] * zz;
236  b.xy() = 2 * _val[15] * xy;
237  b.yz() = 2 * _val[18] * yz;
238  b.zx() = 2 * _val[20] * zx;
239 
240  b.xx() += 2 * (_val[3] * xy + _val[4] * yz + _val[5] * zx);
241  b.yy() += 2 * (_val[8] * xy + _val[9] * yz + _val[10] * zx);
242  b.zz() += 2 * (_val[12] * xy + _val[13] * yz + _val[14] * zx);
243  b.xy() += _val[3] * xx + _val[8] * yy + _val[12] * zz;
244  b.yz() += _val[4] * xx + _val[9] * yy + _val[13] * zz;
245  b.zx() += _val[5] * xx + _val[10] * yy + _val[14] * zz;
246  b.yz() += 2 * _val[16] * xy;
247  b.zx() += 2 * _val[17] * xy + 2 * _val[19] * yz;
248 }
249 
250 void
251 SymmIsotropicElasticityTensor::adjustForCracking(const RealVectorValue & crack_flags)
252 {
253  const RealVectorValue & c(crack_flags);
254  const Real c0(c(0));
255  const Real c0_coupled(c0 < 1 ? 0 : 1);
256  const Real c1(c(1));
257  const Real c1_coupled(c1 < 1 ? 0 : 1);
258  const Real c2(c(2));
259  const Real c2_coupled(c2 < 1 ? 0 : 1);
260 
261  const Real c01(c0_coupled * c1_coupled);
262  const Real c02(c0_coupled * c2_coupled);
263  const Real c12(c1_coupled * c2_coupled);
264  const Real c012(c0_coupled * c12);
265 
266  const Real ym = _mu * (3 * _lambda + 2 * _mu) / (_lambda + _mu);
267 
268  // Assume Poisson's ratio goes to zero for the cracked direction.
269 
270  _val[0] = (c0 < 1 ? c0 * ym : _val[0]);
271  _val[1] *= c01;
272  _val[2] *= c02;
273  _val[3] *= c01;
274  _val[4] *= c012;
275  _val[5] *= c02;
276 
277  _val[6] = (c1 < 1 ? c1 * ym : _val[6]);
278  _val[7] *= c12;
279  _val[8] *= c01;
280  _val[9] *= c12;
281  _val[10] *= c012;
282 
283  _val[11] = (c2 < 1 ? c2 * ym : _val[11]);
284  _val[12] *= c012;
285  _val[13] *= c12;
286  _val[14] *= c02;
287 }
288 
289 void
291  const RealVectorValue & crack_flags)
292 {
293  const RealVectorValue & c = crack_flags;
294  const Real c0 = c(0);
295  const Real c0_coupled = (c0 < 1 ? 0 : 1);
296  const Real c1 = c(1);
297  const Real c1_coupled = (c1 < 1 ? 0 : 1);
298  const Real c2 = c(2);
299  const Real c2_coupled = (c2 < 1 ? 0 : 1);
300  const Real c01 = c0_coupled * c1_coupled;
301  const Real c02 = c0_coupled * c2_coupled;
302  const Real c12 = c1_coupled * c2_coupled;
303  const Real c012 = c0_coupled * c12;
304  adjustForCracking(crack_flags);
305  _val[15] *= c01;
306  _val[16] *= c012;
307  _val[17] *= c012;
308  _val[18] *= c12;
309  _val[19] *= c012;
310  _val[20] *= c02;
311 }
SymmIsotropicElasticityTensor::mu
Real mu() const
Return Mu.
Definition: SymmIsotropicElasticityTensor.C:84
SymmTensor::xx
Real xx() const
Definition: SymmTensor.h:131
SymmTensor::zx
Real zx() const
Definition: SymmTensor.h:136
SymmTensor::zz
Real zz() const
Definition: SymmTensor.h:133
SymmIsotropicElasticityTensor::youngsModulus
Real youngsModulus() const
Return the youngs modulus.
Definition: SymmIsotropicElasticityTensor.C:75
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
SymmIsotropicElasticityTensor::setEntries
void setEntries(Real C11, Real C12, Real C44)
Definition: SymmIsotropicElasticityTensor.C:143
SymmIsotropicElasticityTensor::stiffness
virtual Real stiffness(const unsigned i, const unsigned j, const RealGradient &test, const RealGradient &phi) const
Definition: SymmIsotropicElasticityTensor.C:156
SymmIsotropicElasticityTensor.h
SymmIsotropicElasticityTensor::calculateEntries
virtual void calculateEntries(unsigned int qp)
Fill in the matrix.
Definition: SymmIsotropicElasticityTensor.C:131
SymmIsotropicElasticityTensor::_k
Real _k
Definition: SymmIsotropicElasticityTensor.h:100
SymmIsotropicElasticityTensor::_mu_set
bool _mu_set
Definition: SymmIsotropicElasticityTensor.h:98
SymmIsotropicElasticityTensor::SymmIsotropicElasticityTensor
SymmIsotropicElasticityTensor(const bool constant=true)
Definition: SymmIsotropicElasticityTensor.C:12
SymmIsotropicElasticityTensor::_lambda
Real _lambda
Definition: SymmIsotropicElasticityTensor.h:100
SymmTensor::xy
Real xy() const
Definition: SymmTensor.h:134
SymmElasticityTensor
This class defines a basic set of capabilities any elasticity tensor should have.
Definition: SymmElasticityTensor.h:55
SymmIsotropicElasticityTensor::_nu
Real _nu
Definition: SymmIsotropicElasticityTensor.h:100
SymmIsotropicElasticityTensor::setYoungsModulus
void setYoungsModulus(const Real E)
Set the Young's Modulus.
Definition: SymmIsotropicElasticityTensor.C:42
SymmTensor::yz
Real yz() const
Definition: SymmTensor.h:135
SymmIsotropicElasticityTensor::_nu_set
bool _nu_set
Definition: SymmIsotropicElasticityTensor.h:98
SymmIsotropicElasticityTensor::_k_set
bool _k_set
Definition: SymmIsotropicElasticityTensor.h:98
SymmIsotropicElasticityTensor::_mu
Real _mu
Definition: SymmIsotropicElasticityTensor.h:100
SymmIsotropicElasticityTensor::adjustForCracking
virtual void adjustForCracking(const RealVectorValue &crack_flags)
Definition: SymmIsotropicElasticityTensor.C:251
SymmIsotropicElasticityTensor::adjustForCrackingWithShearRetention
virtual void adjustForCrackingWithShearRetention(const RealVectorValue &crack_flags)
Definition: SymmIsotropicElasticityTensor.C:290
SymmTensor
Definition: SymmTensor.h:21
SymmIsotropicElasticityTensor::calculateLameCoefficients
void calculateLameCoefficients()
Calculates lambda and mu based on what has been set.
Definition: SymmIsotropicElasticityTensor.C:94
SymmIsotropicElasticityTensor::setLambda
void setLambda(const Real lambda)
Set the first Lame Coefficient.
Definition: SymmIsotropicElasticityTensor.C:28
SymmIsotropicElasticityTensor::setPoissonsRatio
void setPoissonsRatio(const Real nu)
Set Poissons Ratio.
Definition: SymmIsotropicElasticityTensor.C:49
SymmIsotropicElasticityTensor::setMu
void setMu(const Real mu)
Set the second Lame Coefficient.
Definition: SymmIsotropicElasticityTensor.C:35
SymmIsotropicElasticityTensor::_lambda_set
bool _lambda_set
Definition: SymmIsotropicElasticityTensor.h:98
SymmIsotropicElasticityTensor::multiply
virtual void multiply(const SymmTensor &x, SymmTensor &b) const
Definition: SymmIsotropicElasticityTensor.C:224
SymmTensor::yy
Real yy() const
Definition: SymmTensor.h:132
SymmIsotropicElasticityTensor::setBulkModulus
void setBulkModulus(const Real k)
Set the Bulk Modulus.
Definition: SymmIsotropicElasticityTensor.C:56
SymmElasticityTensor::_val
Real _val[21]
Definition: SymmElasticityTensor.h:188
SymmIsotropicElasticityTensor::_E_set
bool _E_set
Definition: SymmIsotropicElasticityTensor.h:98
SymmIsotropicElasticityTensor::_E
Real _E
Definition: SymmIsotropicElasticityTensor.h:100
SymmIsotropicElasticityTensor::shearModulus
Real shearModulus() const
Return the shear modulus...
Definition: SymmIsotropicElasticityTensor.C:69
SymmIsotropicElasticityTensor::setShearModulus
void setShearModulus(const Real k)
Set the shear modulus...
Definition: SymmIsotropicElasticityTensor.C:63