fieldCoordinateSystemTransform.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-2017 OpenFOAM Foundation
9 Copyright (C) 2015-2020 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
27Class
28 Foam::functionObjects::fieldCoordinateSystemTransform
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Transforms a user-specified selection of fields from global Cartesian
35 coordinates to a local user-specified coordinate system.
36
37 Operands:
38 \table
39 Operand | Type | Location
40 input | {vol,surface}<Type>Field(s) <!--
41 --> | $FOAM_CASE/<time>/<inpField>s
42 output file | - | -
43 output field | {vol,surface}<Type>Field(s) <!--
44 --> | $FOAM_CASE/<time>/<outField>s
45 \endtable
46
47 where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
48
49Usage
50 Minimal example by using \c system/controlDict.functions:
51 \verbatim
52 fieldCoordinateSystemTransform1
53 {
54 // Mandatory entries (unmodifiable)
55 type fieldCoordinateSystemTransform;
56 libs (fieldFunctionObjects);
57
58 // Mandatory entries (runtime modifiable)
59 fields ( U UMean UPrime2Mean );
60 coordinateSystem
61 {
62 origin (0.001 0 0);
63 rotation
64 {
65 type axes;
66 e1 (1 0.15 0);
67 e3 (0 0 -1);
68 }
69 }
70
71 // Optional (inherited) entries
72 ...
73 }
74 \endverbatim
75
76 where the entries mean:
77 \table
78 Property | Description | Type | Req'd | Dflt
79 type | Type name: fieldCoordinateSystemTransform | word | yes | -
80 libs | Library name: fieldFunctionObjects | word | yes | -
81 fields | Names of the operand fields | wordList | yes | -
82 coordinateSystem | Local coordinate system | dict | yes | -
83
84 The inherited entries are elaborated in:
85 - \link functionObject.H \endlink
86 - \link coordinateSystem.H \endlink
87
88 Usage by the \c postProcess utility is not available.
89
90See also
91 - Foam::functionObject
92 - Foam::functionObjects::fvMeshFunctionObject
93 - Foam::coordinateSystem
94 - ExtendedCodeGuide::functionObjects::field::fieldCoordinateSystemTransform
95
96SourceFiles
97 fieldCoordinateSystemTransform.C
98 fieldCoordinateSystemTransformTemplates.C
99
100\*---------------------------------------------------------------------------*/
101
102#ifndef functionObjects_fieldCoordinateSystemTransform_H
103#define functionObjects_fieldCoordinateSystemTransform_H
104
105#include "fvMeshFunctionObject.H"
106#include "coordinateSystem.H"
107#include "volFieldSelection.H"
108
109// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110
111namespace Foam
112{
113namespace functionObjects
114{
115
116/*---------------------------------------------------------------------------*\
117 Class fieldCoordinateSystemTransform Declaration
118\*---------------------------------------------------------------------------*/
119
120class fieldCoordinateSystemTransform
121:
122 public fvMeshFunctionObject
123{
124protected:
125
126 // Protected Data
127
128 //- Fields to transform
129 volFieldSelection fieldSet_;
130
131 //- Coordinate system to transform to
132 autoPtr<coordinateSystem> csysPtr_;
133
134 //- Demand-driven non-uniform rotation field (surface fields)
135 // Eg, for cylindrical coordinates
136 mutable autoPtr<surfaceTensorField> rotTensorSurface_;
137
138 //- Demand-driven non-uniform rotation field (volume fields)
139 // Eg, for cylindrical coordinates
140 mutable autoPtr<volTensorField> rotTensorVolume_;
141
142
143 // Protected Member Functions
144
145 //- Return the name of the transformed field
146 word transformFieldName(const word& fieldName) const;
147
148 //- Demand-driven non-uniform rotation field for surface fields
149 const surfaceTensorField& srotTensor() const;
150
151 //- Demand-driven non-uniform rotation field for volume fields
152 const volTensorField& vrotTensor() const;
153
154
155 //- Transform the given field
156 template<class FieldType>
157 void transformField(const FieldType& field);
158
159 //- Transform the given field
160 template<class FieldType, class RotationFieldType>
161 void transformField
162 (
163 const RotationFieldType& rot,
164 const FieldType& field
165 );
166
167 //- Transform the given field if has the specified element type
168 template<class Type>
169 void transform(const word& fieldName);
170
171
172public:
173
174 //- Runtime type information
175 TypeName("fieldCoordinateSystemTransform");
176
177
178 // Constructors
179
180 //- Construct from Time and dictionary
181 fieldCoordinateSystemTransform
182 (
183 const word& name,
184 const Time& runTime,
185 const dictionary& dict
186 );
187
188 //- No copy construct
189 fieldCoordinateSystemTransform(const fieldCoordinateSystemTransform&)
190 = delete;
191
192 //- No copy assignment
193 void operator=(const fieldCoordinateSystemTransform&) = delete;
194
195
196 //- Destructor
197 virtual ~fieldCoordinateSystemTransform() = default;
198
199
200 // Member Functions
201
202 //- Read the input data
203 virtual bool read(const dictionary&);
204
205 //- Calculate the transformed fields
206 virtual bool execute();
207
208 //- Write the transformed fields
209 virtual bool write();
210};
211
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215} // End namespace functionObjects
216} // End namespace Foam
217
218// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219
220#ifdef NoRepository
222#endif
223
224// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225
226#endif
227
228// ************************************************************************* //
rDeltaTY field()
engineTime & runTime
void read(Istream &, label &val, const dictionary &)
In-place read with dictionary lookup.
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
GeometricField< tensor, fvPatchField, volMesh > volTensorField
Definition: volFieldsFwd.H:87
GeometricField< tensor, fvsPatchField, surfaceMesh > surfaceTensorField
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73