www.mooseframework.org
Element.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "Element.h"
8 #include "Nonlinear3D.h"
9 #include "SolidModel.h"
10 
11 namespace SolidMechanics
12 {
13 
15  const std::string & /*name*/,
16  const InputParameters & parameters)
17  : Coupleable(&solid_model, false), ZeroInterface(parameters), _solid_model(solid_model)
18 {
19 }
20 
22 
24 
26 
27 Real
28 Element::detMatrix(const ColumnMajorMatrix & A)
29 {
30  mooseAssert(A.n() == 3 && A.m() == 3, "detMatrix requires 3x3 matrix");
31 
32  Real Axx = A(0, 0);
33  Real Axy = A(0, 1);
34  Real Axz = A(0, 2);
35  Real Ayx = A(1, 0);
36  Real Ayy = A(1, 1);
37  Real Ayz = A(1, 2);
38  Real Azx = A(2, 0);
39  Real Azy = A(2, 1);
40  Real Azz = A(2, 2);
41 
42  return Axx * Ayy * Azz + Axy * Ayz * Azx + Axz * Ayx * Azy - Azx * Ayy * Axz - Azy * Ayz * Axx -
43  Azz * Ayx * Axy;
44 }
45 
47 
48 void
49 Element::invertMatrix(const ColumnMajorMatrix & A, ColumnMajorMatrix & Ainv)
50 {
51  Real Axx = A(0, 0);
52  Real Axy = A(0, 1);
53  Real Axz = A(0, 2);
54  Real Ayx = A(1, 0);
55  Real Ayy = A(1, 1);
56  Real Ayz = A(1, 2);
57  Real Azx = A(2, 0);
58  Real Azy = A(2, 1);
59  Real Azz = A(2, 2);
60 
61  mooseAssert(detMatrix(A) > 0, "Matrix is not positive definite!");
62  Real detInv = 1 / detMatrix(A);
63 
64  Ainv(0, 0) = +(Ayy * Azz - Azy * Ayz) * detInv;
65  Ainv(0, 1) = -(Axy * Azz - Azy * Axz) * detInv;
66  Ainv(0, 2) = +(Axy * Ayz - Ayy * Axz) * detInv;
67  Ainv(1, 0) = -(Ayx * Azz - Azx * Ayz) * detInv;
68  Ainv(1, 1) = +(Axx * Azz - Azx * Axz) * detInv;
69  Ainv(1, 2) = -(Axx * Ayz - Ayx * Axz) * detInv;
70  Ainv(2, 0) = +(Ayx * Azy - Azx * Ayy) * detInv;
71  Ainv(2, 1) = -(Axx * Azy - Azx * Axy) * detInv;
72  Ainv(2, 2) = +(Axx * Ayy - Ayx * Axy) * detInv;
73 }
74 
76 
77 void
78 Element::rotateSymmetricTensor(const ColumnMajorMatrix & R,
79  const RealTensorValue & T,
80  RealTensorValue & result)
81 {
82 
83  // R T Rt
84  // 00 01 02 00 01 02 00 10 20
85  // 10 11 12 * 10 11 12 * 01 11 21
86  // 20 21 22 20 21 22 02 12 22
87  //
88  const Real T00 = R(0, 0) * T(0, 0) + R(0, 1) * T(1, 0) + R(0, 2) * T(2, 0);
89  const Real T01 = R(0, 0) * T(0, 1) + R(0, 1) * T(1, 1) + R(0, 2) * T(2, 1);
90  const Real T02 = R(0, 0) * T(0, 2) + R(0, 1) * T(1, 2) + R(0, 2) * T(2, 2);
91 
92  const Real T10 = R(1, 0) * T(0, 0) + R(1, 1) * T(1, 0) + R(1, 2) * T(2, 0);
93  const Real T11 = R(1, 0) * T(0, 1) + R(1, 1) * T(1, 1) + R(1, 2) * T(2, 1);
94  const Real T12 = R(1, 0) * T(0, 2) + R(1, 1) * T(1, 2) + R(1, 2) * T(2, 2);
95 
96  const Real T20 = R(2, 0) * T(0, 0) + R(2, 1) * T(1, 0) + R(2, 2) * T(2, 0);
97  const Real T21 = R(2, 0) * T(0, 1) + R(2, 1) * T(1, 1) + R(2, 2) * T(2, 1);
98  const Real T22 = R(2, 0) * T(0, 2) + R(2, 1) * T(1, 2) + R(2, 2) * T(2, 2);
99 
100  result = RealTensorValue(T00 * R(0, 0) + T01 * R(0, 1) + T02 * R(0, 2),
101  T00 * R(1, 0) + T01 * R(1, 1) + T02 * R(1, 2),
102  T00 * R(2, 0) + T01 * R(2, 1) + T02 * R(2, 2),
103 
104  T10 * R(0, 0) + T11 * R(0, 1) + T12 * R(0, 2),
105  T10 * R(1, 0) + T11 * R(1, 1) + T12 * R(1, 2),
106  T10 * R(2, 0) + T11 * R(2, 1) + T12 * R(2, 2),
107 
108  T20 * R(0, 0) + T21 * R(0, 1) + T22 * R(0, 2),
109  T20 * R(1, 0) + T21 * R(1, 1) + T22 * R(1, 2),
110  T20 * R(2, 0) + T21 * R(2, 1) + T22 * R(2, 2));
111 }
112 
114 
115 void
116 Element::rotateSymmetricTensor(const ColumnMajorMatrix & R,
117  const SymmTensor & T,
118  SymmTensor & result)
119 {
120 
121  // R T Rt
122  // 00 01 02 00 01 02 00 10 20
123  // 10 11 12 * 10 11 12 * 01 11 21
124  // 20 21 22 20 21 22 02 12 22
125  //
126  const Real T00 = R(0, 0) * T.xx() + R(0, 1) * T.xy() + R(0, 2) * T.zx();
127  const Real T01 = R(0, 0) * T.xy() + R(0, 1) * T.yy() + R(0, 2) * T.yz();
128  const Real T02 = R(0, 0) * T.zx() + R(0, 1) * T.yz() + R(0, 2) * T.zz();
129 
130  const Real T10 = R(1, 0) * T.xx() + R(1, 1) * T.xy() + R(1, 2) * T.zx();
131  const Real T11 = R(1, 0) * T.xy() + R(1, 1) * T.yy() + R(1, 2) * T.yz();
132  const Real T12 = R(1, 0) * T.zx() + R(1, 1) * T.yz() + R(1, 2) * T.zz();
133 
134  const Real T20 = R(2, 0) * T.xx() + R(2, 1) * T.xy() + R(2, 2) * T.zx();
135  const Real T21 = R(2, 0) * T.xy() + R(2, 1) * T.yy() + R(2, 2) * T.yz();
136  const Real T22 = R(2, 0) * T.zx() + R(2, 1) * T.yz() + R(2, 2) * T.zz();
137 
138  result.xx(T00 * R(0, 0) + T01 * R(0, 1) + T02 * R(0, 2));
139  result.yy(T10 * R(1, 0) + T11 * R(1, 1) + T12 * R(1, 2));
140  result.zz(T20 * R(2, 0) + T21 * R(2, 1) + T22 * R(2, 2));
141  result.xy(T00 * R(1, 0) + T01 * R(1, 1) + T02 * R(1, 2));
142  result.yz(T10 * R(2, 0) + T11 * R(2, 1) + T12 * R(2, 2));
143  result.zx(T00 * R(2, 0) + T01 * R(2, 1) + T02 * R(2, 2));
144 }
145 
147 
148 void
149 Element::unrotateSymmetricTensor(const ColumnMajorMatrix & R,
150  const SymmTensor & T,
151  SymmTensor & result)
152 {
153 
154  // Rt T R
155  // 00 10 20 00 01 02 00 01 02
156  // 01 11 21 * 10 11 12 * 10 11 12
157  // 02 12 22 20 21 22 20 21 22
158  //
159  const Real T00 = R(0, 0) * T.xx() + R(1, 0) * T.xy() + R(2, 0) * T.zx();
160  const Real T01 = R(0, 0) * T.xy() + R(1, 0) * T.yy() + R(2, 0) * T.yz();
161  const Real T02 = R(0, 0) * T.zx() + R(1, 0) * T.yz() + R(2, 0) * T.zz();
162 
163  const Real T10 = R(0, 1) * T.xx() + R(1, 1) * T.xy() + R(2, 1) * T.zx();
164  const Real T11 = R(0, 1) * T.xy() + R(1, 1) * T.yy() + R(2, 1) * T.yz();
165  const Real T12 = R(0, 1) * T.zx() + R(1, 1) * T.yz() + R(2, 1) * T.zz();
166 
167  const Real T20 = R(0, 2) * T.xx() + R(1, 2) * T.xy() + R(2, 2) * T.zx();
168  const Real T21 = R(0, 2) * T.xy() + R(1, 2) * T.yy() + R(2, 2) * T.yz();
169  const Real T22 = R(0, 2) * T.zx() + R(1, 2) * T.yz() + R(2, 2) * T.zz();
170 
171  result.xx(T00 * R(0, 0) + T01 * R(1, 0) + T02 * R(2, 0));
172  result.yy(T10 * R(0, 1) + T11 * R(1, 1) + T12 * R(2, 1));
173  result.zz(T20 * R(0, 2) + T21 * R(1, 2) + T22 * R(2, 2));
174  result.xy(T00 * R(0, 1) + T01 * R(1, 1) + T02 * R(2, 1));
175  result.yz(T10 * R(0, 2) + T11 * R(1, 2) + T12 * R(2, 2));
176  result.zx(T00 * R(0, 2) + T01 * R(1, 2) + T02 * R(2, 2));
177 }
178 
180 
181 void
182 Element::polarDecompositionEigen(const ColumnMajorMatrix & Fhat,
183  ColumnMajorMatrix & Rhat,
184  SymmTensor & strain_increment)
185 {
186  const int ND = 3;
187 
188  ColumnMajorMatrix eigen_value(ND, 1), eigen_vector(ND, ND);
189  ColumnMajorMatrix n1(ND, 1), n2(ND, 1), n3(ND, 1), N1(ND, 1), N2(ND, 1), N3(ND, 1);
190 
191  ColumnMajorMatrix Chat = Fhat.transpose() * Fhat;
192 
193  Chat.eigen(eigen_value, eigen_vector);
194 
195  for (int i = 0; i < ND; i++)
196  {
197  N1(i) = eigen_vector(i, 0);
198  N2(i) = eigen_vector(i, 1);
199  N3(i) = eigen_vector(i, 2);
200  }
201 
202  const Real lamda1 = std::sqrt(eigen_value(0));
203  const Real lamda2 = std::sqrt(eigen_value(1));
204  const Real lamda3 = std::sqrt(eigen_value(2));
205 
206  const Real log1 = std::log(lamda1);
207  const Real log2 = std::log(lamda2);
208  const Real log3 = std::log(lamda3);
209 
210  ColumnMajorMatrix Uhat =
211  N1 * N1.transpose() * lamda1 + N2 * N2.transpose() * lamda2 + N3 * N3.transpose() * lamda3;
212 
213  ColumnMajorMatrix invUhat(ND, ND);
214  invertMatrix(Uhat, invUhat);
215 
216  Rhat = Fhat * invUhat;
217 
218  strain_increment =
219  N1 * N1.transpose() * log1 + N2 * N2.transpose() * log2 + N3 * N3.transpose() * log3;
220 }
221 
223 
224 void
225 Element::fillMatrix(unsigned int qp,
226  const VariableGradient & grad_x,
227  const VariableGradient & grad_y,
228  const VariableGradient & grad_z,
229  ColumnMajorMatrix & A)
230 {
231  A(0, 0) = grad_x[qp](0);
232  A(0, 1) = grad_x[qp](1);
233  A(0, 2) = grad_x[qp](2);
234  A(1, 0) = grad_y[qp](0);
235  A(1, 1) = grad_y[qp](1);
236  A(1, 2) = grad_y[qp](2);
237  A(2, 0) = grad_z[qp](0);
238  A(2, 1) = grad_z[qp](1);
239  A(2, 2) = grad_z[qp](2);
240 }
241 
243 
244 } // namespace solid_mechanics
Real yy() const
Definition: SymmTensor.h:130
static void polarDecompositionEigen(const ColumnMajorMatrix &Fhat, ColumnMajorMatrix &Rhat, SymmTensor &strain_increment)
Definition: Element.C:182
static void unrotateSymmetricTensor(const ColumnMajorMatrix &R, const SymmTensor &T, SymmTensor &result)
Definition: Element.C:149
Element(SolidModel &solid_model, const std::string &name, const InputParameters &parameters)
Definition: Element.C:14
Real xx() const
Definition: SymmTensor.h:129
static void rotateSymmetricTensor(const ColumnMajorMatrix &R, const RealTensorValue &T, RealTensorValue &result)
Definition: Element.C:78
SolidModel is the base class for all this module&#39;s solid mechanics material models.
Definition: SolidModel.h:31
Real zz() const
Definition: SymmTensor.h:131
virtual ~Element()
Definition: Element.C:23
static Real detMatrix(const ColumnMajorMatrix &A)
Definition: Element.C:28
Real xy() const
Definition: SymmTensor.h:132
void fillMatrix(unsigned int qp, const VariableGradient &grad_x, const VariableGradient &grad_y, const VariableGradient &grad_z, ColumnMajorMatrix &A)
Definition: Element.C:225
Real yz() const
Definition: SymmTensor.h:133
Real zx() const
Definition: SymmTensor.h:134
static void invertMatrix(const ColumnMajorMatrix &A, ColumnMajorMatrix &Ainv)
Definition: Element.C:49