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-2018 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  fields
40  (
41  U
42  UMean
43  UPrime2Mean
44  );
45 
46  coordinateSystem
47  {
48  origin (0.001 0 0);
49  coordinateRotation
50  {
51  type axesRotation;
52  e1 (1 0.15 0);
53  e3 (0 0 -1);
54  }
55  }
56  }
57  \endverbatim
58 
59 Usage
60  \table
61  Property | Description | Required | Default value
62  type | type name: fieldCoordinateSystemTransform | yes |
63  fields | list of fields to be transformed |yes |
64  coordinateSystem | local co-ordinate system | yes |
65  \endtable
66 
67 See also
68  Foam::functionObjects::fvMeshFunctionObject
69  Foam::coordinateSystem
70 
71 SourceFiles
72  fieldCoordinateSystemTransform.C
73  fieldCoordinateSystemTransformTemplates.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef functionObjects_fieldCoordinateSystemTransform_H
78 #define functionObjects_fieldCoordinateSystemTransform_H
79 
80 #include "fvMeshFunctionObject.H"
81 #include "coordinateSystem.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 namespace functionObjects
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class fieldCoordinateSystemTransform Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class fieldCoordinateSystemTransform
95 :
96  public fvMeshFunctionObject
97 {
98 protected:
99 
100  // Protected data
101 
102  //- Fields to transform
104 
105  //- Co-ordinate system to transform to
106  coordinateSystem coordSys_;
107 
108 
109  // Protected Member Functions
110 
111  //- Return the name of the transformed field
112  word transformFieldName(const word& fieldName) const;
114  //- Transform the given field
115  template<class FieldType>
116  void transformField(const FieldType& field);
117 
118  //- Transform the given field if has the specified element type
119  template<class Type>
120  void transform(const word& fieldName);
121 
123 public:
124 
125  //- Runtime type information
126  TypeName("fieldCoordinateSystemTransform");
127 
128 
129  // Constructors
130 
131  //- Construct from Time and dictionary
133  (
134  const word& name,
135  const Time& runTime,
136  const dictionary& dict
137  );
138 
139 
140  //- Destructor
142 
143 
144  // Member Functions
145 
146  //- Read the input data
147  virtual bool read(const dictionary&);
148 
149  //- Calculate the transformed fields
150  virtual bool execute();
151 
152  //- Write the transformed fields
153  virtual bool write();
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace functionObjects
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #ifdef NoRepository
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
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:137
coordinateSystem coordSys_
Co-ordinate system to transform to.
engineTime & runTime
TypeName("fieldCoordinateSystemTransform")
Runtime type information.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
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 bool execute()
Calculate the transformed fields.
fieldCoordinateSystemTransform(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Namespace for OpenFOAM.