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 | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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::fieldCoordinateSystemTransform
26 
27 Group
28  grpFieldFunctionObjects
29 
30 Description
31  This function object transforms a user-specified selection of fields from
32  global Cartesian co-ordinates to a local co-ordinate system. The fields
33  are run-time modifiable.
34 
35  Example of function object specification:
36  \verbatim
37  fieldCoordinateSystemTransform1
38  {
39  type fieldCoordinateSystemTransform;
40  functionObjectLibs ("libfieldFunctionObjects.so");
41  ...
42  fields
43  (
44  U
45  UMean
46  UPrime2Mean
47  );
48  origin (0.001 0 0);
49 
50  coordinateRotation
51  {
52  type axesRotation;
53  e1 (1 0.15 0);
54  e3 (0 0 -1);
55  }
56  }
57  \endverbatim
58 
59  \heading Function object 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  origin | origin of local co-ordinate system | yes |
65  coordinateRotation | orientation of local co-ordinate system | yes |
66  log | Log to standard output | no | yes
67  \endtable
68 
69 SeeAlso
70  Foam::functionObject
71  Foam::OutputFilterFunctionObject
72  Foam::coordinateSystem
73 
74 SourceFiles
75  fieldCoordinateSystemTransform.C
76  fieldCoordinateSystemTransformTemplates.C
77  IOfieldCoordinateSystemTransform.H
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef fieldCoordinateSystemTransform_H
82 #define fieldCoordinateSystemTransform_H
83 
84 #include "OFstream.H"
85 #include "volFields.H"
86 #include "surfaceFields.H"
87 #include "coordinateSystem.H"
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 namespace Foam
92 {
93 
94 // Forward declaration of classes
95 class objectRegistry;
96 class dictionary;
97 class polyMesh;
98 class mapPolyMesh;
99 
100 /*---------------------------------------------------------------------------*\
101  Class fieldCoordinateSystemTransform Declaration
102 \*---------------------------------------------------------------------------*/
103 
104 class fieldCoordinateSystemTransform
105 {
106 protected:
107 
108  // Protected data
109 
110  //- Name
111  word name_;
112 
113  const objectRegistry& obr_;
114 
115  //- on/off switch
116  bool active_;
117 
118  //- Fields to transform
120 
121  //- Co-ordinate system to transform to
122  coordinateSystem coordSys_;
123 
124  //- Switch to send output to Info as well as to file
125  Switch log_;
126 
127 
128  // Protected Member Functions
129 
130  //- Disallow default bitwise copy construct
132 
133  //- Disallow default bitwise assignment
135 
136  template<class Type>
137  void transform(const word& fieldName) const;
138 
139  template<class Type>
140  void transformField(const Type& field) const;
141 
142 
143 public:
144 
145  //- Runtime type information
146  TypeName("fieldCoordinateSystemTransform");
147 
148 
149  // Constructors
150 
151  //- Construct for given objectRegistry and dictionary.
152  // Allow the possibility to load fields from files
154  (
155  const word& name,
156  const objectRegistry&,
157  const dictionary&,
158  const bool loadFromFiles = false
159  );
160 
161 
162  //- Destructor
164 
165 
166  // Member Functions
167 
168  //- Return name of the fieldCoordinateSystemTransform object
169  virtual const word& name() const
170  {
171  return name_;
172  }
173 
174  //- Read the input data
175  virtual void read(const dictionary&);
176 
177  //- Execute, currently does nothing
178  virtual void execute();
179 
180  //- Execute at the final time-loop, currently does nothing
181  virtual void end();
182 
183  //- Called when time was set at the end of the Time::operator++
184  virtual void timeSet();
185 
186  //- Write
187  virtual void write();
188 
189  //- Update for changes of mesh
190  virtual void updateMesh(const mapPolyMesh&)
191  {}
192 
193  //- Update for changes of mesh
194  virtual void movePoints(const polyMesh&)
195  {}
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #ifdef NoRepository
207 #endif
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
volFields.H
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::fieldCoordinateSystemTransform::obr_
const objectRegistry & obr_
Definition: fieldCoordinateSystemTransform.H:142
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
fieldCoordinateSystemTransform(const fieldCoordinateSystemTransform &)
Disallow default bitwise copy construct.
Foam::fieldCoordinateSystemTransform::TypeName
TypeName("fieldCoordinateSystemTransform")
Runtime type information.
Foam::fieldCoordinateSystemTransform::name_
word name_
Name.
Definition: fieldCoordinateSystemTransform.H:140
surfaceFields.H
Foam::surfaceFields.
Foam::fieldCoordinateSystemTransform::log_
Switch log_
Switch to send output to Info as well as to file.
Definition: fieldCoordinateSystemTransform.H:154
coordinateSystem.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
OFstream.H
Foam::fieldCoordinateSystemTransform::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: fieldCoordinateSystemTransform.H:219
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:54
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::fieldCoordinateSystemTransform::fieldSet_
wordList fieldSet_
Fields to transform.
Definition: fieldCoordinateSystemTransform.H:148
Foam::fieldCoordinateSystemTransform::write
virtual void write()
Write.
Definition: fieldCoordinateSystemTransform.C:123
Foam::fieldCoordinateSystemTransform::read
virtual void read(const dictionary &)
Read the input data.
Definition: fieldCoordinateSystemTransform.C:82
Foam::fieldCoordinateSystemTransform::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: fieldCoordinateSystemTransform.C:111
Foam::fieldCoordinateSystemTransform::name
virtual const word & name() const
Return name of the fieldCoordinateSystemTransform object.
Definition: fieldCoordinateSystemTransform.H:198
fieldCoordinateSystemTransformTemplates.C
Foam::fieldCoordinateSystemTransform::~fieldCoordinateSystemTransform
virtual ~fieldCoordinateSystemTransform()
Destructor.
Definition: fieldCoordinateSystemTransform.C:76
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fieldCoordinateSystemTransform::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: fieldCoordinateSystemTransform.H:223
Foam::fieldCoordinateSystemTransform::transformField
void transformField(const Type &field) const
Definition: fieldCoordinateSystemTransformTemplates.C:36
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fieldCoordinateSystemTransform::operator=
void operator=(const fieldCoordinateSystemTransform &)
Disallow default bitwise assignment.
Foam::fieldCoordinateSystemTransform::coordSys_
coordinateSystem coordSys_
Co-ordinate system to transform to.
Definition: fieldCoordinateSystemTransform.H:151
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::fieldCoordinateSystemTransform::execute
virtual void execute()
Execute, currently does nothing.
Definition: fieldCoordinateSystemTransform.C:92
Foam::fieldCoordinateSystemTransform::transform
void transform(const word &fieldName) const
Definition: fieldCoordinateSystemTransformTemplates.C:78
Foam::fieldCoordinateSystemTransform
This function object transforms a user-specified selection of fields from global Cartesian co-ordinat...
Definition: fieldCoordinateSystemTransform.H:133
Foam::fieldCoordinateSystemTransform::active_
bool active_
on/off switch
Definition: fieldCoordinateSystemTransform.H:145
Foam::coordinateSystem
Base class for other coordinate system specifications.
Definition: coordinateSystem.H:85
Foam::fieldCoordinateSystemTransform::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: fieldCoordinateSystemTransform.C:117