symmTensorField.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-2015 OpenFOAM Foundation
9  Copyright (C) 2019-2023 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 Typedef
28  Foam::symmTensorField
29 
30 Description
31  Specialisation of Field<T> for symmTensor.
32 
33 SourceFiles
34  symmTensorField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_symmTensorField_H
39 #define Foam_symmTensorField_H
40 
41 #include "scalarField.H"
42 #include "vectorField.H"
44 #include "symmTensor.H"
45 #include "tensor.H"
46 
47 #define TEMPLATE
48 #include "FieldFunctionsM.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 typedef Field<symmTensor> symmTensorField;
56 
57 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
58 
59 //- Zip together symmTensor field from components
60 template<class Cmpt>
61 void zip
62 (
63  Field<SymmTensor<Cmpt>>& result,
64  const UList<Cmpt>& xx, const UList<Cmpt>& xy, const UList<Cmpt>& xz,
65  const UList<Cmpt>& yy, const UList<Cmpt>& yz,
66  const UList<Cmpt>& zz
67 );
68 
69 //- Unzip symmTensor field into components
70 template<class Cmpt>
71 void unzip
72 (
73  const UList<SymmTensor<Cmpt>>& input,
74  Field<Cmpt>& xx, Field<Cmpt>& xy, Field<Cmpt>& xz,
75  Field<Cmpt>& yy, Field<Cmpt>& yz,
76  Field<Cmpt>& zz
77 );
78 
79 //- Zip together symmTensor field from components
80 template<class Cmpt>
81 tmp<Field<SymmTensor<Cmpt>>> zip
82 (
83  const Field<Cmpt>& xx, const Field<Cmpt>& xy, const Field<Cmpt>& xz,
84  const Field<Cmpt>& yy, const Field<Cmpt>& yz,
85  const Field<Cmpt>& zz
86 );
87 
88 
89 //- Zip together symmTensor field from row components
90 template<class Cmpt>
91 void zipRows
92 (
93  Field<SymmTensor<Cmpt>>& result,
94  const UList<Vector<Cmpt>>& x,
95  const UList<Vector<Cmpt>>& y,
96  const UList<Vector<Cmpt>>& z
97 );
98 
99 //- Zip together symmTensor field from column components
100 template<class Cmpt>
101 void zipCols
102 (
103  Field<SymmTensor<Cmpt>>& result,
104  const UList<Vector<Cmpt>>& x,
105  const UList<Vector<Cmpt>>& y,
106  const UList<Vector<Cmpt>>& z
107 )
108 {
109  zipRows(result, x, y, z);
110 }
111 
112 
113 //- Extract symmTensor field rows
114 template<class Cmpt>
115 void unzipRows
116 (
117  const UList<SymmTensor<Cmpt>>& input,
118  Field<Vector<Cmpt>>& x,
119  Field<Vector<Cmpt>>& y,
120  Field<Vector<Cmpt>>& z
121 );
122 
123 //- Extract symmTensor field columns
124 template<class Cmpt>
125 void unzipCols
126 (
127  const UList<SymmTensor<Cmpt>>& input,
128  Field<Vector<Cmpt>>& x,
129  Field<Vector<Cmpt>>& y,
130  Field<Vector<Cmpt>>& z
131 )
132 {
133  unzipRows(input, x, y, z);
134 }
135 
137 //- Extract a symmTensor field row (x,y,z) == (0,1,2)
138 template<class Cmpt>
139 void unzipRow
140 (
141  const UList<SymmTensor<Cmpt>>& input,
142  const direction idx,
143  Field<Vector<Cmpt>>& result
144 );
145 
146 //- Extract a symmTensor field column (x,y,z) == (0,1,2)
147 template<class Cmpt>
148 void unzipCol
149 (
150  const UList<SymmTensor<Cmpt>>& input,
151  const direction idx,
152  Field<Vector<Cmpt>>& result
153 )
154 {
155  unzipRow(input, idx, result);
156 }
157 
158 
159 //- Extract a symmTensor field diagonal
160 template<class Cmpt>
161 void unzipDiag
162 (
164  Field<Vector<Cmpt>>& result
165 );
166 
167 //- Extract a symmTensor field row (x,y,z) == (0,1,2)
168 template<class Cmpt>
170 (
171  const Field<SymmTensor<Cmpt>>& input,
172  const direction idx
173 );
174 
175 //- Extract a symmTensor field column (x,y,z) == (0,1,2)
176 template<class Cmpt>
178 (
179  const Field<SymmTensor<Cmpt>>& input,
180  const direction idx
181 )
182 {
183  return unzipRow(input, idx);
184 }
185 
186 //- Extract a symmTensor field diagonal
187 template<class Cmpt>
188 tmp<Field<Vector<Cmpt>>> unzipDiag
189 (
190  const Field<SymmTensor<Cmpt>>& input
191 );
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
199 UNARY_FUNCTION(scalar, symmTensor, tr)
207 UNARY_FUNCTION(scalar, symmTensor, det)
211 
212 
213 // * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
214 
216 
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #include "undefFieldFunctionsM.H"
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #ifdef NoRepository
232  #include "symmTensorFieldTemplates.C"
233 #endif
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
uint8_t direction
Definition: direction.H:46
Field< symmTensor > symmTensorField
Specialisation of Field<T> for symmTensor.
A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements, derived from VectorSpace.
Definition: SymmTensor.H:50
void unzipCols(const FieldField< Field, SymmTensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &x, FieldField< Field, Vector< Cmpt >> &y, FieldField< Field, Vector< Cmpt >> &z)
Extract symmTensor field field columns.
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
void zip(FieldField< Field, SphericalTensor< Cmpt >> &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.
void zipCols(FieldField< Field, SymmTensor< Cmpt >> &result, const FieldField< Field, Vector< Cmpt >> &x, const FieldField< Field, Vector< Cmpt >> &y, const FieldField< Field, Vector< Cmpt >> &z)
Zip together symmTensor field from column components.
void unzipRow(const FieldField< Field, SymmTensor< Cmpt >> &input, const direction idx, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field row (x,y,z) == (0,1,2)
SymmTensor< Cmpt > devSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of the symmetric part of a SymmTensor.
Definition: SymmTensorI.H:481
dimensionedScalar det(const dimensionedSphericalTensor &dt)
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
Definition: DiagTensorI.H:110
void unzipRows(const FieldField< Field, SymmTensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &x, FieldField< Field, Vector< Cmpt >> &y, FieldField< Field, Vector< Cmpt >> &z)
Extract symmTensor field field rows.
void zipRows(FieldField< Field, SymmTensor< Cmpt >> &result, const FieldField< Field, Vector< Cmpt >> &x, const FieldField< Field, Vector< Cmpt >> &y, const FieldField< Field, Vector< Cmpt >> &z)
Zip together symmTensor field field from row components.
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void unzip(const FieldField< Field, SphericalTensor< Cmpt >> &input, FieldField< Field, Cmpt > &ii)
Unzip sphericalTensor field field into components.
void unzipDiag(const FieldField< Field, SymmTensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field diagonal.
scalar y
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Generic templated field type.
Definition: Field.H:62
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:55
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
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:33
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Vector< scalar > vector
Definition: vector.H:57
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
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
Macro functions for Field<Type> algebra.
dimensionedSymmTensor innerSqr(const dimensionedSymmTensor &dt)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void unzipCol(const FieldField< Field, SymmTensor< Cmpt >> &input, const direction idx, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field column (x,y,z) == (0,1,2)
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Tensor of scalars, i.e. Tensor<scalar>.
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
dimensionedSymmTensor cof(const dimensionedSymmTensor &dt)
Namespace for OpenFOAM.
SymmTensor< Cmpt > devTwoSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of twice the symmetric part of a SymmTensor.
Definition: SymmTensorI.H:491