fieldCoordinateSystemTransform.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::fieldCoordinateSystemTransform
26 
27 Description
28  Transforms a user-specified selection of fields from global Cartesian
29  co-ordinates to a local co-ordinate system. The fields are run-time
30  modifiable.
31 
32  Example of function object specification:
33  \verbatim
34  fieldCoordinateSystemTransform1
35  {
36  type fieldCoordinateSystemTransform;
37  libs ("libfieldFunctionObjects.so");
38 
39  writeControl writeTime;
40 
41  fields
42  (
43  U
44  UMean
45  UPrime2Mean
46  );
47 
48  coordinateSystem
49  {
50  type cartesian;
51  origin (0.001 0 0);
52  coordinateRotation
53  {
54  type axesRotation;
55  e1 (1 0.15 0);
56  e3 (0 0 -1);
57  }
58  }
59  }
60  \endverbatim
61 
62 Usage
63  \table
64  Property | Description | Required | Default value
65  type | type name: fieldCoordinateSystemTransform | yes |
66  fields | list of fields to be transformed |yes |
67  coordinateSystem | local co-ordinate system | yes |
68  \endtable
69 
70 See also
71  Foam::functionObjects::fvMeshFunctionObject
72  Foam::coordinateSystem
73 
74 SourceFiles
75  fieldCoordinateSystemTransform.C
76  fieldCoordinateSystemTransformTemplates.C
77 
78 \*---------------------------------------------------------------------------*/
79 
80 #ifndef functionObjects_fieldCoordinateSystemTransform_H
81 #define functionObjects_fieldCoordinateSystemTransform_H
82 
83 #include "fvMeshFunctionObject.H"
84 #include "coordinateSystem.H"
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 namespace functionObjects
91 {
92 
93 /*---------------------------------------------------------------------------*\
94  Class fieldCoordinateSystemTransform Declaration
95 \*---------------------------------------------------------------------------*/
96 
97 class fieldCoordinateSystemTransform
98 :
99  public fvMeshFunctionObject
100 {
101 protected:
102 
103  // Protected data
104 
105  //- Fields to transform
107 
108  //- Co-ordinate system to transform to
109  coordinateSystem coordSys_;
110 
111 
112  // Protected Member Functions
113 
114  //- Return the name of the transformed field
115  word transformFieldName(const word& fieldName) const;
117  //- Transform the given field
118  template<class FieldType>
119  void transformField(const FieldType& field);
120 
121  //- Transform the given field if has the specified element type
122  template<class Type>
123  void transform(const word& fieldName);
124 
126 public:
127 
128  //- Runtime type information
129  TypeName("fieldCoordinateSystemTransform");
130 
131 
132  // Constructors
133 
134  //- Construct from Time and dictionary
136  (
137  const word& name,
138  const Time& runTime,
139  const dictionary& dict
140  );
141 
142 
143  //- Destructor
145 
146 
147  // Member Functions
148 
149  //- Read the input data
150  virtual bool read(const dictionary&);
151 
152  //- Return the field required
153  virtual wordList fields() const;
154 
155  //- Calculate the transformed fields
156  virtual bool execute();
157 
158  //- Write the transformed fields
159  virtual bool write();
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace functionObjects
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #ifdef NoRepository
172 #endif
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
dictionary dict
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
coordinateSystem coordSys_
Co-ordinate system to transform to.
TypeName("fieldCoordinateSystemTransform")
Runtime type information.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
void transformField(const FieldType &field)
Transform the given field.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool read(const dictionary &)
Read the input data.
void transform(const word &fieldName)
Transform the given field if has the specified element type.
List< word > wordList
A List of words.
Definition: fileName.H:54
word transformFieldName(const word &fieldName) const
Return the name of the transformed field.
virtual wordList fields() const
Return the field required.
virtual bool execute()
Calculate the transformed fields.
fieldCoordinateSystemTransform(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
rDeltaTY field()
Namespace for OpenFOAM.