GeometricSymmTensorField.C
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 \*---------------------------------------------------------------------------*/
28 
30 #include "symmTensorFieldField.H"
31 
32 #define TEMPLATE template<template<class> class PatchField, class GeoMesh>
34 
35 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
36 
37 template<class Cmpt, template<class> class PatchField, class GeoMesh>
38 void Foam::zip
39 (
40  GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& result,
47 )
48 {
49  Foam::zip
50  (
51  result.primitiveFieldRef(),
53  yy.primitiveField(), yz.primitiveField(),
54  zz.primitiveField()
55  );
56 
57  Foam::zip
58  (
59  result.boundaryFieldRef(),
60  xx.boundaryField(), xy.boundaryField(), xz.boundaryField(),
61  yy.boundaryField(), yz.boundaryField(),
63  );
64 }
65 
66 
67 template<class Cmpt, template<class> class PatchField, class GeoMesh>
68 void Foam::unzip
69 (
70  const GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& input,
71  GeometricField<Cmpt, PatchField, GeoMesh>& xx,
72  GeometricField<Cmpt, PatchField, GeoMesh>& xy,
73  GeometricField<Cmpt, PatchField, GeoMesh>& xz,
74  GeometricField<Cmpt, PatchField, GeoMesh>& yy,
75  GeometricField<Cmpt, PatchField, GeoMesh>& yz,
76  GeometricField<Cmpt, PatchField, GeoMesh>& zz
77 )
78 {
80  (
81  input.primitiveField(),
82  xx.primitiveFieldRef(), xy.primitiveFieldRef(), xz.primitiveFieldRef(),
83  yy.primitiveFieldRef(), yz.primitiveFieldRef(),
84  zz.primitiveFieldRef()
85  );
86 
88  (
89  input.boundaryField(),
90  xx.boundaryFieldRef(), xy.boundaryFieldRef(), xz.boundaryFieldRef(),
91  yy.boundaryFieldRef(), yz.boundaryFieldRef(),
92  zz.boundaryFieldRef()
93  );
94 }
95 
96 
97 template<class Cmpt, template<class> class PatchField, class GeoMesh>
98 void Foam::zipRows
99 (
100  GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& result,
101  const GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& x,
102  const GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& y,
103  const GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& z
104 )
105 {
107  (
108  result.primitiveFieldRef(),
109  x.primitiveField(),
110  y.primitiveField(),
111  z.primitiveField()
112  );
113 
115  (
116  result.boundaryFieldRef(),
117  x.boundaryField(),
118  y.boundaryField(),
119  z.boundaryField()
120  );
121 }
122 
123 
124 template<class Cmpt, template<class> class PatchField, class GeoMesh>
125 void Foam::zipCols
126 (
127  GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& result,
128  const GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& x,
129  const GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& y,
130  const GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& z
131 )
132 {
134  (
135  result.primitiveFieldRef(),
136  x.primitiveField(),
137  y.primitiveField(),
138  z.primitiveField()
139  );
140 
142  (
143  result.boundaryFieldRef(),
144  x.boundaryField(),
145  y.boundaryField(),
146  z.boundaryField()
147  );
148 }
149 
150 
151 template<class Cmpt, template<class> class PatchField, class GeoMesh>
152 void Foam::unzipRows
153 (
154  const GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& input,
155  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& x,
156  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& y,
157  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& z
158 )
159 {
161  (
162  input.primitiveField(),
163  x.primitiveFieldRef(),
164  y.primitiveFieldRef(),
165  z.primitiveFieldRef()
166  );
167 
169  (
170  input.boundaryField(),
171  x.boundaryFieldRef(),
172  y.boundaryFieldRef(),
173  z.boundaryFieldRef()
174  );
175 }
176 
177 
178 template<class Cmpt, template<class> class PatchField, class GeoMesh>
179 void Foam::unzipCols
180 (
181  const GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& input,
182  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& x,
183  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& y,
184  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& z
185 )
186 {
188  (
189  input.primitiveField(),
190  x.primitiveFieldRef(),
191  y.primitiveFieldRef(),
192  z.primitiveFieldRef()
193  );
194 
196  (
197  input.boundaryField(),
198  x.boundaryFieldRef(),
199  y.boundaryFieldRef(),
200  z.boundaryFieldRef()
201  );
202 }
203 
204 
205 template<class Cmpt, template<class> class PatchField, class GeoMesh>
206 void Foam::unzipRow
207 (
208  const GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& input,
209  const direction idx,
210  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& result
211 )
212 {
213  Foam::unzipRow(input.primitiveField(), idx, result.primitiveFieldRef());
215  Foam::unzipRow(input.boundaryField(), idx, result.boundaryFieldRef());
216 }
217 
218 
219 template<class Cmpt, template<class> class PatchField, class GeoMesh>
220 void Foam::unzipCol
221 (
222  const GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& input,
223  const direction idx,
224  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& result
225 )
226 {
227  Foam::unzipCol(input.primitiveField(), idx, result.primitiveFieldRef());
229  Foam::unzipCol(input.boundaryField(), idx, result.boundaryFieldRef());
230 }
231 
232 
233 template<class Cmpt, template<class> class PatchField, class GeoMesh>
234 void Foam::unzipDiag
235 (
236  const GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& input,
237  GeometricField<Vector<Cmpt>, PatchField, GeoMesh>& result
238 )
239 {
240  Foam::unzipDiag(input.primitiveField(), result.primitiveFieldRef());
241 
242  Foam::unzipDiag(input.boundaryField(), result.boundaryFieldRef());
243 }
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 namespace Foam
249 {
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
255 
267 
268 
269 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
270 
272 
275 
276 
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 
279 } // End namespace Foam
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 #include "undefFieldFunctionsM.H"
284 
285 // ************************************************************************* //
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
uint8_t direction
Definition: direction.H:46
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements, derived from VectorSpace.
Definition: SymmTensor.H:50
Specialisation of FieldField<T> for symmTensor.
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.
Tensor< scalar > tensor
Definition: symmTensor.H:57
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
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
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)
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:55
SymmTensor specific part of the implementation of GeometricField.
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:33
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Vector< scalar > vector
Definition: vector.H:57
dimensionSet pow2(const dimensionSet &ds)
Definition: dimensionSet.C:352
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
dimensionedSymmTensor innerSqr(const dimensionedSymmTensor &dt)
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)
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:42
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
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