tensor.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2014 OpenFOAM Foundation
9  Copyright (C) 2019-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::tensor
29 
30 Description
31  Tensor of scalars, i.e. Tensor<scalar>.
32 
33  Analytical functions for the computation of complex eigenvalues and
34  complex eigenvectors from a given tensor.
35 
36 See also
37  Test-Tensor.C
38 
39 SourceFiles
40  floatTensors.C
41  tensor.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef Foam_tensor_H
46 #define Foam_tensor_H
47 
48 #include "Tensor.H"
49 #include "vector.H"
50 #include "sphericalTensor.H"
51 #include "symmTensor.H"
52 #include "complex.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
64 
68 
69 // With float or double precision (depending on compilation)
70 typedef Tensor<scalar> tensor;
71 
72 
73 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
74 
75 //- Return complex eigenvalues of a given tensor
76 // \param T tensor
77 //
78 // \return Vector<complex> eigenvalues
80 
81 
82 //- Return a complex eigenvector corresponding to
83 //- a given complex eigenvalue of a given tensor
84 // \param T tensor
85 // \param eVal complex eigenvalue
86 // \param standardBasis1 tensor orthogonal component 1
87 // \param standardBasis2 tensor orthogonal component 2
88 //
89 // \return Vector<complex> eigenvector
91 (
92  const tensor& T,
93  const complex& eVal,
94  const Vector<complex>& standardBasis1,
95  const Vector<complex>& standardBasis2
96 );
97 
98 
99 //- Return complex eigenvectors corresponding to
100 //- given complex eigenvalues of a given tensor
101 // \param T tensor
102 // \param eVals complex eigenvalues
103 //
104 // \return Tensor<complex> eigenvectors, each row is an eigenvector
106 (
107  const tensor& T,
108  const Vector<complex>& eVals
109 );
110 
111 
112 //- Return complex eigenvectors of a given tensor by computing
113 //- the complex eigenvalues of the tensor in the background
114 // \param T tensor
115 //
116 // \return Tensor<complex> complex eigenvectors, each row is an eigenvector
118 
119 
120 //- Return inverse of a given tensor, and fall back
121 //- into pseudo-inverse if the tensor is singular
122 // \param t tensor
123 //
124 // \return tensor inverse of tensor
125 tensor pinv(const tensor& t);
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
vector eigenVector(const symmTensor &T, const scalar eVal, const vector &standardBasis1, const vector &standardBasis2)
Return a real eigenvector corresponding to a given real eigenvalue of a given symmTensor.
Definition: symmTensor.C:146
Tensor< float > floatTensor
Definition: tensor.H:58
Tensor< scalar > tensor
Definition: symmTensor.H:57
dimensionedTensor eigenVectors(const dimensionedSymmTensor &dt)
symmTensor pinv(const symmTensor &st)
Return inverse of a given symmTensor, and fall back to pseudo-inverse if the symmTensor is singular...
Definition: symmTensor.C:334
Tensor< double > doubleTensor
Definition: tensor.H:62
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:58
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedVector eigenValues(const dimensionedSymmTensor &dt)
A complex number, similar to the C++ complex type.
Definition: complex.H:70
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: complexI.H:266
Tensor of scalars, i.e. Tensor<scalar>.
Namespace for OpenFOAM.