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-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
31
32#define TEMPLATE template<template<class> class PatchField, class GeoMesh>
34
35// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
36
37template<class Cmpt, template<class> class PatchField, class GeoMesh>
39(
40 GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& result,
47)
48{
50 (
51 result.primitiveFieldRef(),
55 );
56
58 (
59 result.boundaryFieldRef(),
62 zz.boundaryField()
63 );
64}
65
66
67template<class Cmpt, template<class> class PatchField, class GeoMesh>
69(
70 const GeometricField<SymmTensor<Cmpt>, PatchField, GeoMesh>& input,
77)
78{
80 (
81 input.primitiveField(),
85 );
86
88 (
89 input.boundaryField(),
93 );
94}
95
96
97template<class Cmpt, template<class> class PatchField, class GeoMesh>
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
124template<class Cmpt, template<class> class PatchField, class GeoMesh>
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
151template<class Cmpt, template<class> class PatchField, class GeoMesh>
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
178template<class Cmpt, template<class> class PatchField, class GeoMesh>
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
205template<class Cmpt, template<class> class PatchField, class GeoMesh>
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());
214
215 Foam::unzipRow(input.boundaryField(), idx, result.boundaryFieldRef());
216}
217
218
219template<class Cmpt, template<class> class PatchField, class GeoMesh>
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());
228
229 Foam::unzipCol(input.boundaryField(), idx, result.boundaryFieldRef());
230}
231
232
233template<class Cmpt, template<class> class PatchField, class GeoMesh>
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
248namespace Foam
249{
250
251// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252
255
265
266
267// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
268
270
273
274
275// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276
277} // End namespace Foam
278
279// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280
281#include "undefFieldFunctionsM.H"
282
283// ************************************************************************* //
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
SymmTensor specific part of the implementation of GeometricField.
scalar y
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:49
Generic GeometricField class.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements,...
Definition: SymmTensor.H:57
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:65
Tensor of scalars, i.e. Tensor<scalar>.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Namespace for OpenFOAM.
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
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.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
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.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
void unzipDiag(const FieldField< Field, SymmTensor< Cmpt > > &input, FieldField< Field, Vector< Cmpt > > &result)
Extract a symmTensor field field diagonal.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:59
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
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 cof(const dimensionedSymmTensor &dt)
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
Definition: DiagTensorI.H:130
uint8_t direction
Definition: direction.H:56
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 unzip(const FieldField< Field, SphericalTensor< Cmpt > > &input, FieldField< Field, Cmpt > &ii)
Unzip sphericalTensor field field into components.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor innerSqr(const dimensionedSymmTensor &dt)
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)
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.
dimensionSet pow2(const dimensionSet &ds)
Definition: dimensionSet.C:369
void zip(FieldField< Field, SphericalTensor< Cmpt > > &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.
Specialisation of FieldField<T> for symmTensor.