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