TensorI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "SymmTensor.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class Cmpt>
37 {}
38 
39 
40 template<class Cmpt>
41 template<class Cmpt2>
42 inline Tensor<Cmpt>::Tensor(const VectorSpace<Tensor<Cmpt2>, Cmpt2, 9>& vs)
43 :
44  VectorSpace<Tensor<Cmpt>, Cmpt, 9>(vs)
45 {}
46 
47 
48 template<class Cmpt>
50 {
51  this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0;
52  this->v_[YX] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0;
53  this->v_[ZX] = 0; this->v_[ZY] = 0; this->v_[ZZ] = st.ii();
54 }
55 
56 
57 template<class Cmpt>
59 {
60  this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz();
61  this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); this->v_[YZ] = st.yz();
62  this->v_[ZX] = st.xz(); this->v_[ZY] = st.yz(); this->v_[ZZ] = st.zz();
63 }
64 
65 
66 template<class Cmpt>
68 {
69  this->v_[XX] = tr.x().x();
70  this->v_[XY] = tr.x().y();
71  this->v_[XZ] = tr.x().z();
72 
73  this->v_[YX] = tr.y().x();
74  this->v_[YY] = tr.y().y();
75  this->v_[YZ] = tr.y().z();
76 
77  this->v_[ZX] = tr.z().x();
78  this->v_[ZY] = tr.z().y();
79  this->v_[ZZ] = tr.z().z();
80 }
81 
82 
83 template<class Cmpt>
85 (
86  const Vector<Cmpt>& x,
87  const Vector<Cmpt>& y,
88  const Vector<Cmpt>& z
89 )
90 {
91  this->v_[XX] = x.x(); this->v_[XY] = x.y(); this->v_[XZ] = x.z();
92  this->v_[YX] = y.x(); this->v_[YY] = y.y(); this->v_[YZ] = y.z();
93  this->v_[ZX] = z.x(); this->v_[ZY] = z.y(); this->v_[ZZ] = z.z();
94 }
95 
96 
97 template<class Cmpt>
99 (
100  const Cmpt txx, const Cmpt txy, const Cmpt txz,
101  const Cmpt tyx, const Cmpt tyy, const Cmpt tyz,
102  const Cmpt tzx, const Cmpt tzy, const Cmpt tzz
103 )
104 {
105  this->v_[XX] = txx; this->v_[XY] = txy; this->v_[XZ] = txz;
106  this->v_[YX] = tyx; this->v_[YY] = tyy; this->v_[YZ] = tyz;
107  this->v_[ZX] = tzx; this->v_[ZY] = tzy; this->v_[ZZ] = tzz;
108 }
109 
110 
111 template<class Cmpt>
113 :
114  VectorSpace<Tensor<Cmpt>, Cmpt, 9>(is)
115 {}
116 
117 
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 
120 template<class Cmpt>
122 {
123  return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
124 }
125 
126 
127 template<class Cmpt>
129 {
130  return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
131 }
132 
133 
134 template<class Cmpt>
136 {
137  return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
138 }
139 
140 
141 template<class Cmpt>
143 {
144  switch (cmpt)
145  {
146  case 0:
147  return x();
148  break;
149  case 1:
150  return y();
151  break;
152  case 2:
153  return z();
154  break;
155  }
156 }
157 
158 
159 template<class Cmpt>
160 inline const Cmpt& Tensor<Cmpt>::xx() const
161 {
162  return this->v_[XX];
163 }
164 
165 
166 template<class Cmpt>
167 inline const Cmpt& Tensor<Cmpt>::xy() const
168 {
169  return this->v_[XY];
170 }
171 
172 
173 template<class Cmpt>
174 inline const Cmpt& Tensor<Cmpt>::xz() const
175 {
176  return this->v_[XZ];
177 }
178 
179 
180 template<class Cmpt>
181 inline const Cmpt& Tensor<Cmpt>::yx() const
182 {
183  return this->v_[YX];
184 }
185 
186 
187 template<class Cmpt>
188 inline const Cmpt& Tensor<Cmpt>::yy() const
189 {
190  return this->v_[YY];
191 }
192 
193 
194 template<class Cmpt>
195 inline const Cmpt& Tensor<Cmpt>::yz() const
196 {
197  return this->v_[YZ];
198 }
199 
200 
201 template<class Cmpt>
202 inline const Cmpt& Tensor<Cmpt>::zx() const
203 {
204  return this->v_[ZX];
205 }
206 
207 
208 template<class Cmpt>
209 inline const Cmpt& Tensor<Cmpt>::zy() const
210 {
211  return this->v_[ZY];
212 }
213 
214 
215 template<class Cmpt>
216 inline const Cmpt& Tensor<Cmpt>::zz() const
217 {
218  return this->v_[ZZ];
219 }
220 
221 
222 template<class Cmpt>
223 inline Cmpt& Tensor<Cmpt>::xx()
224 {
225  return this->v_[XX];
226 }
227 
228 
229 template<class Cmpt>
230 inline Cmpt& Tensor<Cmpt>::xy()
231 {
232  return this->v_[XY];
233 }
234 
235 
236 template<class Cmpt>
237 inline Cmpt& Tensor<Cmpt>::xz()
238 {
239  return this->v_[XZ];
240 }
241 
242 
243 template<class Cmpt>
244 inline Cmpt& Tensor<Cmpt>::yx()
245 {
246  return this->v_[YX];
247 }
248 
249 
250 template<class Cmpt>
251 inline Cmpt& Tensor<Cmpt>::yy()
252 {
253  return this->v_[YY];
254 }
255 
256 
257 template<class Cmpt>
258 inline Cmpt& Tensor<Cmpt>::yz()
259 {
260  return this->v_[YZ];
261 }
262 
263 
264 template<class Cmpt>
265 inline Cmpt& Tensor<Cmpt>::zx()
266 {
267  return this->v_[ZX];
268 }
269 
270 
271 template<class Cmpt>
272 inline Cmpt& Tensor<Cmpt>::zy()
273 {
274  return this->v_[ZY];
275 }
276 
277 
278 template<class Cmpt>
279 inline Cmpt& Tensor<Cmpt>::zz()
280 {
281  return this->v_[ZZ];
282 }
283 
284 
285 template<class Cmpt>
287 {
288  return Tensor<Cmpt>
289  (
290  xx(), yx(), zx(),
291  xy(), yy(), zy(),
292  xz(), yz(), zz()
293  );
294 }
295 
296 
297 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
298 
299 template<class Cmpt>
301 {
302  this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0;
303  this->v_[YX] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0;
304  this->v_[ZX] = 0; this->v_[ZY] = 0; this->v_[ZZ] = st.ii();
305 }
306 
307 
308 template<class Cmpt>
310 {
311  this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz();
312  this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); this->v_[YZ] = st.yz();
313  this->v_[ZX] = st.xz(); this->v_[ZY] = st.yz(); this->v_[ZZ] = st.zz();
314 }
315 
316 
317 template<class Cmpt>
319 {
320  this->v_[XX] = tr.x().x();
321  this->v_[XY] = tr.x().y();
322  this->v_[XZ] = tr.x().z();
323 
324  this->v_[YX] = tr.y().x();
325  this->v_[YY] = tr.y().y();
326  this->v_[YZ] = tr.y().z();
327 
328  this->v_[ZX] = tr.z().x();
329  this->v_[ZY] = tr.z().y();
330  this->v_[ZZ] = tr.z().z();
331 }
332 
333 
334 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
335 
336 template<class Cmpt>
338 {
339  return Vector<Cmpt>(t.yz(), -t.xz(), t.xy());
340 }
341 
342 
343 template<class Cmpt>
345 {
346  return Tensor<Cmpt>
347  (
348  0, -v.z(), v.y(),
349  v.z(), 0, -v.x(),
350  -v.y(), v.x(), 0
351  );
352 }
353 
354 
355 template<class Cmpt>
357 operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
358 {
359  return Tensor<Cmpt>
360  (
361  t1.xx()*t2.xx() + t1.xy()*t2.yx() + t1.xz()*t2.zx(),
362  t1.xx()*t2.xy() + t1.xy()*t2.yy() + t1.xz()*t2.zy(),
363  t1.xx()*t2.xz() + t1.xy()*t2.yz() + t1.xz()*t2.zz(),
364 
365  t1.yx()*t2.xx() + t1.yy()*t2.yx() + t1.yz()*t2.zx(),
366  t1.yx()*t2.xy() + t1.yy()*t2.yy() + t1.yz()*t2.zy(),
367  t1.yx()*t2.xz() + t1.yy()*t2.yz() + t1.yz()*t2.zz(),
368 
369  t1.zx()*t2.xx() + t1.zy()*t2.yx() + t1.zz()*t2.zx(),
370  t1.zx()*t2.xy() + t1.zy()*t2.yy() + t1.zz()*t2.zy(),
371  t1.zx()*t2.xz() + t1.zy()*t2.yz() + t1.zz()*t2.zz()
372  );
373 }
374 
375 
376 template<class Cmpt>
377 inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt> >::type
379 {
380  return Vector<Cmpt>
381  (
382  t.xx()*v.x() + t.xy()*v.y() + t.xz()*v.z(),
383  t.yx()*v.x() + t.yy()*v.y() + t.yz()*v.z(),
384  t.zx()*v.x() + t.zy()*v.y() + t.zz()*v.z()
385  );
386 }
387 
388 
389 template<class Cmpt>
392 {
393  return Vector<Cmpt>
394  (
395  v.x()*t.xx() + v.y()*t.yx() + v.z()*t.zx(),
396  v.x()*t.xy() + v.y()*t.yy() + v.z()*t.zy(),
397  v.x()*t.xz() + v.y()*t.yz() + v.z()*t.zz()
398  );
399 }
400 
401 
402 template<class Cmpt>
404 operator*(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
405 {
406  return Tensor<Cmpt>
407  (
408  v1.x()*v2.x(), v1.x()*v2.y(), v1.x()*v2.z(),
409  v1.y()*v2.x(), v1.y()*v2.y(), v1.y()*v2.z(),
410  v1.z()*v2.x(), v1.z()*v2.y(), v1.z()*v2.z()
411  );
412 }
413 
414 
415 template<class Cmpt>
416 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
418 {
419  return inv(t) & v;
420 }
421 
422 
423 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
424 
425 //- Return the trace of a tensor
426 template<class Cmpt>
427 inline Cmpt tr(const Tensor<Cmpt>& t)
428 {
429  return t.xx() + t.yy() + t.zz();
430 }
431 
432 
433 //- Return the spherical part of a tensor
434 template<class Cmpt>
436 {
437  return (1.0/3.0)*tr(t);
438 }
439 
440 
441 //- Return the symmetric part of a tensor
442 template<class Cmpt>
444 {
445  return SymmTensor<Cmpt>
446  (
447  t.xx(), 0.5*(t.xy() + t.yx()), 0.5*(t.xz() + t.zx()),
448  t.yy(), 0.5*(t.yz() + t.zy()),
449  t.zz()
450  );
451 }
452 
453 
454 //- Return twice the symmetric part of a tensor
455 template<class Cmpt>
457 {
458  return SymmTensor<Cmpt>
459  (
460  2*t.xx(), (t.xy() + t.yx()), (t.xz() + t.zx()),
461  2*t.yy(), (t.yz() + t.zy()),
462  2*t.zz()
463  );
464 }
465 
466 
467 //- Return the skew-symmetric part of a tensor
468 template<class Cmpt>
470 {
471  return Tensor<Cmpt>
472  (
473  0.0, 0.5*(t.xy() - t.yx()), 0.5*(t.xz() - t.zx()),
474  0.5*(t.yx() - t.xy()), 0.0, 0.5*(t.yz() - t.zy()),
475  0.5*(t.zx() - t.xz()), 0.5*(t.zy() - t.yz()), 0.0
476  );
477 }
478 
479 
480 //- Return the skew-symmetric part of a symmetric tensor
481 template<class Cmpt>
482 inline const Tensor<Cmpt>& skew(const SymmTensor<Cmpt>& st)
483 {
484  return Tensor<Cmpt>::zero;
485 }
486 
487 
488 //- Return the deviatoric part of a tensor
489 template<class Cmpt>
490 inline Tensor<Cmpt> dev(const Tensor<Cmpt>& t)
491 {
492  return t - SphericalTensor<Cmpt>::oneThirdI*tr(t);
493 }
494 
495 
496 //- Return the deviatoric part of a tensor
497 template<class Cmpt>
499 {
501 }
502 
503 
504 //- Return the determinant of a tensor
505 template<class Cmpt>
506 inline Cmpt det(const Tensor<Cmpt>& t)
507 {
508  return
509  (
510  t.xx()*t.yy()*t.zz() + t.xy()*t.yz()*t.zx()
511  + t.xz()*t.yx()*t.zy() - t.xx()*t.yz()*t.zy()
512  - t.xy()*t.yx()*t.zz() - t.xz()*t.yy()*t.zx()
513  );
514 }
515 
516 
517 //- Return the cofactor tensor of a tensor
518 template<class Cmpt>
519 inline Tensor<Cmpt> cof(const Tensor<Cmpt>& t)
520 {
521  return Tensor<Cmpt>
522  (
523  t.yy()*t.zz() - t.zy()*t.yz(),
524  t.zx()*t.yz() - t.yx()*t.zz(),
525  t.yx()*t.zy() - t.yy()*t.zx(),
526 
527  t.xz()*t.zy() - t.xy()*t.zz(),
528  t.xx()*t.zz() - t.xz()*t.zx(),
529  t.xy()*t.zx() - t.xx()*t.zy(),
530 
531  t.xy()*t.yz() - t.xz()*t.yy(),
532  t.yx()*t.xz() - t.xx()*t.yz(),
533  t.xx()*t.yy() - t.yx()*t.xy()
534  );
535 }
536 
537 
538 //- Return the inverse of a tensor given the determinant
539 template<class Cmpt>
540 inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t, const Cmpt dett)
541 {
542  return Tensor<Cmpt>
543  (
544  t.yy()*t.zz() - t.zy()*t.yz(),
545  t.xz()*t.zy() - t.xy()*t.zz(),
546  t.xy()*t.yz() - t.xz()*t.yy(),
547 
548  t.zx()*t.yz() - t.yx()*t.zz(),
549  t.xx()*t.zz() - t.xz()*t.zx(),
550  t.yx()*t.xz() - t.xx()*t.yz(),
551 
552  t.yx()*t.zy() - t.yy()*t.zx(),
553  t.xy()*t.zx() - t.xx()*t.zy(),
554  t.xx()*t.yy() - t.yx()*t.xy()
555  )/dett;
556 }
557 
558 
559 //- Return the inverse of a tensor
560 template<class Cmpt>
561 inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t)
562 {
563  return inv(t, det(t));
564 }
565 
566 
567 //- Return the 1st invariant of a tensor
568 template<class Cmpt>
569 inline Cmpt invariantI(const Tensor<Cmpt>& t)
570 {
571  return tr(t);
572 }
573 
574 
575 //- Return the 2nd invariant of a tensor
576 template<class Cmpt>
577 inline Cmpt invariantII(const Tensor<Cmpt>& t)
578 {
579  return
580  (
581  0.5*sqr(tr(t))
582  - 0.5*
583  (
584  t.xx()*t.xx() + t.xy()*t.xy() + t.xz()*t.xz()
585  + t.yx()*t.yx() + t.yy()*t.yy() + t.yz()*t.yz()
586  + t.zx()*t.zx() + t.zy()*t.zy() + t.zz()*t.zz()
587  )
588  );
589 }
590 
591 
592 //- Return the 3rd invariant of a tensor
593 template<class Cmpt>
594 inline Cmpt invariantIII(const Tensor<Cmpt>& t)
595 {
596  return det(t);
597 }
598 
599 
600 // * * * * * * * * * Mixed Tensor SphericalTensor Operators * * * * * * * * //
601 
602 template<class Cmpt>
603 inline Tensor<Cmpt>
605 {
606  return Tensor<Cmpt>
607  (
608  st1.ii() + t2.xx(), t2.xy(), t2.xz(),
609  t2.yx(), st1.ii() + t2.yy(), t2.yz(),
610  t2.zx(), t2.zy(), st1.ii() + t2.zz()
611  );
612 }
613 
614 
615 template<class Cmpt>
616 inline Tensor<Cmpt>
618 {
619  return Tensor<Cmpt>
620  (
621  t1.xx() + st2.ii(), t1.xy(), t1.xz(),
622  t1.yx(), t1.yy() + st2.ii(), t1.yz(),
623  t1.zx(), t1.zy(), t1.zz() + st2.ii()
624  );
625 }
626 
627 
628 template<class Cmpt>
629 inline Tensor<Cmpt>
631 {
632  return Tensor<Cmpt>
633  (
634  st1.ii() - t2.xx(), -t2.xy(), -t2.xz(),
635  -t2.yx(), st1.ii() - t2.yy(), -t2.yz(),
636  -t2.zx(), -t2.zy(), st1.ii() - t2.zz()
637  );
638 }
639 
640 
641 template<class Cmpt>
642 inline Tensor<Cmpt>
644 {
645  return Tensor<Cmpt>
646  (
647  t1.xx() - st2.ii(), t1.xy(), t1.xz(),
648  t1.yx(), t1.yy() - st2.ii(), t1.yz(),
649  t1.zx(), t1.zy(), t1.zz() - st2.ii()
650  );
651 }
652 
653 
654 //- Inner-product between a spherical tensor and a tensor
655 template<class Cmpt>
656 inline Tensor<Cmpt>
658 {
659  return Tensor<Cmpt>
660  (
661  st1.ii()*t2.xx(), st1.ii()*t2.xy(), st1.ii()*t2.xz(),
662  st1.ii()*t2.yx(), st1.ii()*t2.yy(), st1.ii()*t2.yz(),
663  st1.ii()*t2.zx(), st1.ii()*t2.zy(), st1.ii()*t2.zz()
664  );
665 }
666 
667 
668 //- Inner-product between a tensor and a spherical tensor
669 template<class Cmpt>
670 inline Tensor<Cmpt>
672 {
673  return Tensor<Cmpt>
674  (
675  t1.xx()*st2.ii(), t1.xy()*st2.ii(), t1.xz()*st2.ii(),
676  t1.yx()*st2.ii(), t1.yy()*st2.ii(), t1.yz()*st2.ii(),
677  t1.zx()*st2.ii(), t1.zy()*st2.ii(), t1.zz()*st2.ii()
678  );
679 }
680 
681 
682 //- Double-dot-product between a spherical tensor and a tensor
683 template<class Cmpt>
684 inline Cmpt
686 {
687  return(st1.ii()*t2.xx() + st1.ii()*t2.yy() + st1.ii()*t2.zz());
688 }
689 
690 
691 //- Double-dot-product between a tensor and a spherical tensor
692 template<class Cmpt>
693 inline Cmpt
695 {
696  return(t1.xx()*st2.ii() + t1.yy()*st2.ii() + t1.zz()*st2.ii());
697 }
698 
699 
700 template<class Cmpt>
701 class typeOfSum<SphericalTensor<Cmpt>, Tensor<Cmpt> >
702 {
703 public:
704 
706 };
707 
708 
709 template<class Cmpt>
710 class typeOfSum<Tensor<Cmpt>, SphericalTensor<Cmpt> >
711 {
712 public:
713 
715 };
716 
717 
718 template<class Cmpt>
719 class innerProduct<SphericalTensor<Cmpt>, Tensor<Cmpt> >
720 {
721 public:
722 
724 };
725 
726 
727 template<class Cmpt>
728 class innerProduct<Tensor<Cmpt>, SphericalTensor<Cmpt> >
729 {
730 public:
731 
733 };
734 
735 
736 // * * * * * * * * * * Mixed Tensor SymmTensor Operators * * * * * * * * * * //
737 
738 template<class Cmpt>
739 inline Tensor<Cmpt>
741 {
742  return Tensor<Cmpt>
743  (
744  st1.xx() + t2.xx(), st1.xy() + t2.xy(), st1.xz() + t2.xz(),
745  st1.xy() + t2.yx(), st1.yy() + t2.yy(), st1.yz() + t2.yz(),
746  st1.xz() + t2.zx(), st1.yz() + t2.zy(), st1.zz() + t2.zz()
747  );
748 }
749 
750 
751 template<class Cmpt>
752 inline Tensor<Cmpt>
754 {
755  return Tensor<Cmpt>
756  (
757  t1.xx() + st2.xx(), t1.xy() + st2.xy(), t1.xz() + st2.xz(),
758  t1.yx() + st2.xy(), t1.yy() + st2.yy(), t1.yz() + st2.yz(),
759  t1.zx() + st2.xz(), t1.zy() + st2.yz(), t1.zz() + st2.zz()
760  );
761 }
762 
763 
764 template<class Cmpt>
765 inline Tensor<Cmpt>
767 {
768  return Tensor<Cmpt>
769  (
770  st1.xx() - t2.xx(), st1.xy() - t2.xy(), st1.xz() - t2.xz(),
771  st1.xy() - t2.yx(), st1.yy() - t2.yy(), st1.yz() - t2.yz(),
772  st1.xz() - t2.zx(), st1.yz() - t2.zy(), st1.zz() - t2.zz()
773  );
774 }
775 
776 
777 template<class Cmpt>
778 inline Tensor<Cmpt>
780 {
781  return Tensor<Cmpt>
782  (
783  t1.xx() - st2.xx(), t1.xy() - st2.xy(), t1.xz() - st2.xz(),
784  t1.yx() - st2.xy(), t1.yy() - st2.yy(), t1.yz() - st2.yz(),
785  t1.zx() - st2.xz(), t1.zy() - st2.yz(), t1.zz() - st2.zz()
786  );
787 }
788 
789 
790 //- Inner-product between a symmetric tensor and a tensor
791 template<class Cmpt>
792 inline Tensor<Cmpt>
794 {
795  return Tensor<Cmpt>
796  (
797  st1.xx()*t2.xx() + st1.xy()*t2.yx() + st1.xz()*t2.zx(),
798  st1.xx()*t2.xy() + st1.xy()*t2.yy() + st1.xz()*t2.zy(),
799  st1.xx()*t2.xz() + st1.xy()*t2.yz() + st1.xz()*t2.zz(),
800 
801  st1.xy()*t2.xx() + st1.yy()*t2.yx() + st1.yz()*t2.zx(),
802  st1.xy()*t2.xy() + st1.yy()*t2.yy() + st1.yz()*t2.zy(),
803  st1.xy()*t2.xz() + st1.yy()*t2.yz() + st1.yz()*t2.zz(),
804 
805  st1.xz()*t2.xx() + st1.yz()*t2.yx() + st1.zz()*t2.zx(),
806  st1.xz()*t2.xy() + st1.yz()*t2.yy() + st1.zz()*t2.zy(),
807  st1.xz()*t2.xz() + st1.yz()*t2.yz() + st1.zz()*t2.zz()
808  );
809 }
810 
811 
812 //- Inner-product between a tensor and a symmetric tensor
813 template<class Cmpt>
814 inline Tensor<Cmpt>
816 {
817  return Tensor<Cmpt>
818  (
819  t1.xx()*st2.xx() + t1.xy()*st2.xy() + t1.xz()*st2.xz(),
820  t1.xx()*st2.xy() + t1.xy()*st2.yy() + t1.xz()*st2.yz(),
821  t1.xx()*st2.xz() + t1.xy()*st2.yz() + t1.xz()*st2.zz(),
822 
823  t1.yx()*st2.xx() + t1.yy()*st2.xy() + t1.yz()*st2.xz(),
824  t1.yx()*st2.xy() + t1.yy()*st2.yy() + t1.yz()*st2.yz(),
825  t1.yx()*st2.xz() + t1.yy()*st2.yz() + t1.yz()*st2.zz(),
826 
827  t1.zx()*st2.xx() + t1.zy()*st2.xy() + t1.zz()*st2.xz(),
828  t1.zx()*st2.xy() + t1.zy()*st2.yy() + t1.zz()*st2.yz(),
829  t1.zx()*st2.xz() + t1.zy()*st2.yz() + t1.zz()*st2.zz()
830  );
831 }
832 
833 
834 //- Double-dot-product between a symmetric tensor and a tensor
835 template<class Cmpt>
836 inline Cmpt
838 {
839  return
840  (
841  st1.xx()*t2.xx() + st1.xy()*t2.xy() + st1.xz()*t2.xz() +
842  st1.xy()*t2.yx() + st1.yy()*t2.yy() + st1.yz()*t2.yz() +
843  st1.xz()*t2.zx() + st1.yz()*t2.zy() + st1.zz()*t2.zz()
844  );
845 }
846 
847 
848 //- Double-dot-product between a tensor and a symmetric tensor
849 template<class Cmpt>
850 inline Cmpt
852 {
853  return
854  (
855  t1.xx()*st2.xx() + t1.xy()*st2.xy() + t1.xz()*st2.xz() +
856  t1.yx()*st2.xy() + t1.yy()*st2.yy() + t1.yz()*st2.yz() +
857  t1.zx()*st2.xz() + t1.zy()*st2.yz() + t1.zz()*st2.zz()
858  );
859 }
860 
861 
862 template<class Cmpt>
863 class typeOfSum<SymmTensor<Cmpt>, Tensor<Cmpt> >
864 {
865 public:
866 
868 };
869 
870 
871 template<class Cmpt>
872 class typeOfSum<Tensor<Cmpt>, SymmTensor<Cmpt> >
873 {
874 public:
875 
877 };
878 
879 
880 template<class Cmpt>
881 class innerProduct<SymmTensor<Cmpt>, Tensor<Cmpt> >
882 {
883 public:
884 
886 };
887 
888 
889 template<class Cmpt>
890 class innerProduct<Tensor<Cmpt>, SymmTensor<Cmpt> >
891 {
892 public:
893 
895 };
896 
897 
898 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
899 
900 } // End namespace Foam
901 
902 // ************************************************************************* //
tmp< fvMatrix< Type > > operator*(const DimensionedField< scalar, volMesh > &, const fvMatrix< Type > &)
const Cmpt & xy() const
Definition: TensorI.H:167
unsigned char direction
Definition: direction.H:43
Templated 3D tensor derived from VectorSpace adding construction from 9 components, element access using xx(), xy() etc. member functions and the inner-product (dot-product) and outer-product of two Vectors (tensor-product) operators.
Definition: complexI.H:224
dimensionedTensor skew(const dimensionedTensor &dt)
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
const Cmpt & zz() const
Definition: TensorI.H:216
Templated 3D symmetric tensor derived from VectorSpace adding construction from 6 components...
Definition: SymmTensor.H:53
tmp< fvMatrix< Type > > operator+(const fvMatrix< Type > &, const fvMatrix< Type > &)
dimensionedSymmTensor cof(const dimensionedSymmTensor &dt)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
const Cmpt & yy() const
Definition: TensorI.H:188
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
Vector< Cmpt > vectorComponent(const direction) const
Definition: TensorI.H:142
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component, element access using th ii() member function and the inner-product (dot-product) and outer-product operators.
Vector< Cmpt > x() const
Definition: TensorI.H:121
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross product operators.
Definition: Vector.H:57
Cmpt invariantI(const SymmTensor< Cmpt > &st)
Return the 1st invariant of a symmetric tensor.
Definition: SymmTensorI.H:389
const Cmpt & xy() const
Definition: SymmTensorI.H:91
Namespace for OpenFOAM.
Vector< Cmpt > y() const
Definition: TensorI.H:128
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
const Cmpt & xx() const
Definition: SymmTensorI.H:85
Cmpt invariantII(const SymmTensor< Cmpt > &st)
Return the 2nd invariant of a symmetric tensor.
Definition: SymmTensorI.H:397
const Cmpt & ii() const
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
const Cmpt & xz() const
Definition: SymmTensorI.H:97
void operator=(const SphericalTensor< Cmpt > &)
Assign to a SphericalTensor.
Definition: TensorI.H:300
const Cmpt & y() const
Definition: VectorI.H:71
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Cmpt invariantIII(const SymmTensor< Cmpt > &st)
Return the 3rd invariant of a symmetric tensor.
Definition: SymmTensorI.H:414
Cmpt v_[nCmpt]
The components of this vector space.
Definition: VectorSpace.H:95
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Vector< Cmpt > z() const
Definition: TensorI.H:135
const Cmpt & x() const
Definition: VectorI.H:65
const Cmpt & yx() const
Definition: TensorI.H:181
const Cmpt & yy() const
Definition: SymmTensorI.H:103
const Cmpt & yz() const
Definition: SymmTensorI.H:109
const Cmpt & z() const
Definition: VectorI.H:77
const Cmpt & zz() const
Definition: SymmTensorI.H:115
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:589
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a diagonal tensor.
Definition: DiagTensorI.H:281
const Cmpt & zy() const
Definition: TensorI.H:209
Templated vector space.
Definition: VectorSpace.H:52
Tensor< Cmpt > T() const
Transpose.
Definition: TensorI.H:286
dimensioned< typename scalarProduct< Type1, Type2 >::type > operator&&(const dimensioned< Type1 > &, const dimensioned< Type2 > &)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const Cmpt & xx() const
Definition: TensorI.H:160
const Cmpt & yz() const
Definition: TensorI.H:195
const Cmpt & xz() const
Definition: TensorI.H:174
Tensor()
Construct null.
Definition: TensorI.H:36
const Cmpt & zx() const
Definition: TensorI.H:202