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>
300 inline void Tensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st)
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>
309 inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st)
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>
318 inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt> >& tr)
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>
356 inline typename innerProduct<Tensor<Cmpt>, Tensor<Cmpt> >::type
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>
390 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
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>
403 inline typename outerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
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 // ************************************************************************* //
Foam::typeOfSum< Tensor< Cmpt >, SphericalTensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:714
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::twoSymm
SymmTensor< Cmpt > twoSymm(const Tensor< Cmpt > &t)
Return twice the symmetric part of a tensor.
Definition: TensorI.H:456
Foam::SymmTensor
Templated 3D symmetric tensor derived from VectorSpace adding construction from 6 components,...
Definition: SymmTensor.H:53
Foam::Tensor::zx
const Cmpt & zx() const
Definition: TensorI.H:202
Foam::SphericalTensor::ii
const Cmpt & ii() const
Definition: SphericalTensorI.H:68
Foam::det
Cmpt det(const Tensor< Cmpt > &t)
Return the determinant of a tensor.
Definition: TensorI.H:506
Foam::SymmTensor::zz
const Cmpt & zz() const
Definition: SymmTensorI.H:115
SymmTensor.H
Foam::inv
Tensor< Cmpt > inv(const Tensor< Cmpt > &t)
Return the inverse of a tensor.
Definition: TensorI.H:561
Foam::typeOfSum< Tensor< Cmpt >, SymmTensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:876
Foam::innerProduct
Definition: products.H:89
Foam::SymmTensor::xy
const Cmpt & xy() const
Definition: SymmTensorI.H:91
Foam::operator*
outerProduct< Vector< Cmpt >, Vector< Cmpt > >::type operator*(const Vector< Cmpt > &v1, const Vector< Cmpt > &v2)
Definition: TensorI.H:404
Foam::invariantIII
Cmpt invariantIII(const Tensor< Cmpt > &t)
Return the 3rd invariant of a tensor.
Definition: TensorI.H:594
Foam::Tensor::yx
const Cmpt & yx() const
Definition: TensorI.H:181
Foam::invariantII
Cmpt invariantII(const Tensor< Cmpt > &t)
Return the 2nd invariant of a tensor.
Definition: TensorI.H:577
Foam::tr
Cmpt tr(const Tensor< Cmpt > &t)
Return the trace of a tensor.
Definition: TensorI.H:427
Foam::operator-
Tensor< Cmpt > operator-(const Tensor< Cmpt > &t1, const SymmTensor< Cmpt > &st2)
Definition: TensorI.H:779
Foam::typeOfSum< SymmTensor< Cmpt >, Tensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:867
Foam::Tensor::xz
const Cmpt & xz() const
Definition: TensorI.H:174
Foam::Tensor::yz
const Cmpt & yz() const
Definition: TensorI.H:195
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:52
Foam::SymmTensor::yz
const Cmpt & yz() const
Definition: SymmTensorI.H:109
Foam::operator/
innerProduct< Vector< Cmpt >, Tensor< Cmpt > >::type operator/(const Vector< Cmpt > &v, const Tensor< Cmpt > &t)
Definition: TensorI.H:417
Foam::Tensor::zy
const Cmpt & zy() const
Definition: TensorI.H:209
Foam::typeOfSum
Definition: products.H:55
Foam::Tensor::yy
const Cmpt & yy() const
Definition: TensorI.H:188
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::invariantI
Cmpt invariantI(const Tensor< Cmpt > &t)
Return the 1st invariant of a tensor.
Definition: TensorI.H:569
Foam::SymmTensor::xx
const Cmpt & xx() const
Definition: SymmTensorI.H:85
Foam::Tensor::zz
const Cmpt & zz() const
Definition: TensorI.H:216
Foam::dev2
Tensor< Cmpt > dev2(const Tensor< Cmpt > &t)
Return the deviatoric part of a tensor.
Definition: TensorI.H:498
Foam::innerProduct< Tensor< Cmpt >, SymmTensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:894
Foam::Vector::x
const Cmpt & x() const
Definition: VectorI.H:65
Foam::Tensor::xy
const Cmpt & xy() const
Definition: TensorI.H:167
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::Vector::z
const Cmpt & z() const
Definition: VectorI.H:77
Foam::sph
SphericalTensor< Cmpt > sph(const Tensor< Cmpt > &t)
Return the spherical part of a tensor.
Definition: TensorI.H:435
Foam::SphericalTensor
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor.H:51
Foam::operator+
Tensor< Cmpt > operator+(const Tensor< Cmpt > &t1, const SymmTensor< Cmpt > &st2)
Definition: TensorI.H:753
Foam::innerProduct< SymmTensor< Cmpt >, Tensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:885
Foam::dev
Tensor< Cmpt > dev(const Tensor< Cmpt > &t)
Return the deviatoric part of a tensor.
Definition: TensorI.H:490
Foam::skew
const Tensor< Cmpt > & skew(const SymmTensor< Cmpt > &st)
Return the skew-symmetric part of a symmetric tensor.
Definition: TensorI.H:482
Foam::Tensor::xx
const Cmpt & xx() const
Definition: TensorI.H:160
Foam::Tensor::Tensor
Tensor()
Construct null.
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
T
const volScalarField & T
Definition: createFields.H:25
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:57
Foam::SymmTensor::yy
const Cmpt & yy() const
Definition: SymmTensorI.H:103
Foam::symm
SymmTensor< Cmpt > symm(const Tensor< Cmpt > &t)
Return the symmetric part of a tensor.
Definition: TensorI.H:443
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::typeOfSum< SphericalTensor< Cmpt >, Tensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:705
Foam::Vector::y
const Cmpt & y() const
Definition: VectorI.H:71
Foam::operator&&
Cmpt operator&&(const Tensor< Cmpt > &t1, const SymmTensor< Cmpt > &st2)
Double-dot-product between a tensor and a symmetric tensor.
Definition: TensorI.H:851
Foam::SymmTensor::xz
const Cmpt & xz() const
Definition: SymmTensorI.H:97
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Vector
Definition: Test-Field.H:4
Foam::cof
Tensor< Cmpt > cof(const Tensor< Cmpt > &t)
Return the cofactor tensor of a tensor.
Definition: TensorI.H:519
Foam::innerProduct< Tensor< Cmpt >, SphericalTensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:732
Foam::operator&
Tensor< Cmpt > operator&(const Tensor< Cmpt > &t1, const SymmTensor< Cmpt > &st2)
Inner-product between a tensor and a symmetric tensor.
Definition: TensorI.H:815
Foam::innerProduct< SphericalTensor< Cmpt >, Tensor< Cmpt > >::type
Tensor< Cmpt > type
Definition: TensorI.H:723
y
scalar y
Definition: LISASMDCalcMethod1.H:14