cylindrical.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::cylindrical
26 
27 Description
28  A local coordinate rotation.
29 
30  The cell based rotational field can be created in two ways:
31  -# Each rotational tensor is defined with two vectors (\c dir and \c e3)
32  where <tt>dir = cellC - origin</tt> and \c e3 is the rotation axis.
33  Per each cell an axesRotation type of rotation is created
34  (cylindrical coordinates). For example:
35  \verbatim
36  cylindrical
37  {
38  type localAxes;
39  e3 (0 0 1);
40  }
41  \endverbatim
42 
43  -# The rotational tensor field is provided at construction.
44 
45 SourceFiles
46  cylindrical.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef cylindrical_H
51 #define cylindrical_H
52 
53 #include "point.H"
54 #include "vector.H"
55 #include "coordinateRotation.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class cylindrical Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class cylindrical
67 :
68  public coordinateRotation
69 {
70  // Private data
71 
72  //- AutoPtr to transformation tensor
74 
75  //- Origin of the coordinate system
76  point origin_;
77 
78  //- Rotation axis
79  vector e3_;
80 
81 
82  // Private members
83 
84  //- Init transformation tensor field
85  void init
86  (
87  const objectRegistry& obr,
88  const List<label>& cells = List<label>()
89  );
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("cylindrical");
96 
97  // Constructors
98 
99  //- Construct from dictionary and objectRegistry
100  cylindrical(const dictionary&, const objectRegistry&);
101 
102  //- Construct from components for all cells
104  (
105  const objectRegistry&,
106  const vector& axis,
107  const point& origin
108  );
109 
110  //- Construct from components for list of cells
112  (
113  const objectRegistry&,
114  const vector& axis,
115  const point& origin,
116  const List<label>& cells
117  );
118 
119  //- Construct from dictionary
120  cylindrical(const dictionary&);
121 
122  //- Construct from tensor Field
123  cylindrical(const tensorField&);
124 
125  //- Return clone
127  {
128  return autoPtr<cylindrical>(new cylindrical(*this));
129  }
130 
131 
132  //- Destructor
133  virtual ~cylindrical()
134  {}
135 
136 
137  // Member Functions
138 
139  //- Reset rotation to an identity rotation
140  virtual void clear();
141 
142  //- Update the rotation for a list of cells
143  virtual void updateCells(const polyMesh& mesh, const labelList& cells);
144 
145  //- Return local-to-global transformation tensor
146  virtual const tensor& R() const
147  {
149  return tensor::zero;
150  }
151 
152  //- Return global-to-local transformation tensor
153  virtual const tensor& Rtr() const
154  {
156  return tensor::zero;
157  }
158 
159  //- Return local Cartesian x-axis in global coordinates
160  virtual const vector e1() const
161  {
163  return vector::zero;
164  }
165 
166  //- Return local Cartesian y-axis in global coordinates
167  virtual const vector e2() const
168  {
170  return vector::zero;
171  }
172 
173  //- Return local Cartesian z-axis in global coordinates
174  virtual const vector e3() const
175  {
176  return e3_;
177  }
179  virtual const tensorField& Tr() const
180  {
181  return Rptr_();
182  }
183 
184  //- Transform vectorField using transformation tensor field
185  virtual tmp<vectorField> transform(const vectorField& tf) const;
186 
187  //- Transform vector using transformation tensor
188  virtual vector transform(const vector& v) const;
189 
190  //- Transform vector using transformation tensor for component
191  virtual vector transform(const vector& v, const label cmptI) const;
192 
193  //- Inverse transform vectorField using transformation tensor field
194  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
195 
196  //- Inverse transform vector using transformation tensor
197  virtual vector invTransform(const vector& v) const;
198 
199  //- Inverse transform vector using transformation tensor for component
200  virtual vector invTransform(const vector& v, const label cmptI) const;
201 
202  //- Return if the rotation is uniform
203  virtual bool uniform() const
204  {
205  return false;
206  }
207 
208  //- Transform tensor field using transformation tensorField
209  virtual tmp<tensorField> transformTensor(const tensorField& tf) const;
210 
211  //- Transform tensor using transformation tensorField
212  virtual tensor transformTensor(const tensor& t) const;
213 
214  //- Transform tensor sub-field using transformation tensorField
216  (
217  const tensorField& tf,
218  const labelList& cellMap
219  ) const;
220 
221  //- Transform vectorField using transformation tensorField and return
222  // symmetrical tensorField
224  (
225  const vectorField& vf
226  ) const;
227 
228  //- Transform vector using transformation tensor and return
229  // symmetrical tensor (R & st & R.T())
230  virtual symmTensor transformVector(const vector& v) const;
231 
232 
233  // Write
234 
235  //- Write
236  virtual void write(Ostream&) const;
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #endif
247 
248 // ************************************************************************* //
virtual const tensor & R() const
Return local-to-global transformation tensor.
Definition: cylindrical.H:145
Abstract base class for coordinate rotation.
virtual ~cylindrical()
Destructor.
Definition: cylindrical.H:132
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
Definition: cylindrical.H:173
virtual void write(Ostream &) const
Write.
Definition: cylindrical.C:352
const tensorField & tf
virtual tmp< vectorField > transform(const vectorField &tf) const
Transform vectorField using transformation tensor field.
Definition: cylindrical.C:207
autoPtr< cylindrical > clone() const
Return clone.
Definition: cylindrical.H:125
dynamicFvMesh & mesh
const cellShapeList & cells
virtual const tensor & Rtr() const
Return global-to-local transformation tensor.
Definition: cylindrical.H:152
A local coordinate rotation.
Definition: cylindrical.H:65
cylindrical(const dictionary &, const objectRegistry &)
Construct from dictionary and objectRegistry.
Definition: cylindrical.C:96
virtual tmp< vectorField > invTransform(const vectorField &vf) const
Inverse transform vectorField using transformation tensor field.
Definition: cylindrical.C:240
virtual tmp< tensorField > transformTensor(const tensorField &tf) const
Transform tensor field using transformation tensorField.
Definition: cylindrical.C:266
TypeName("cylindrical")
Runtime type information.
virtual bool uniform() const
Return if the rotation is uniform.
Definition: cylindrical.H:202
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
Definition: cylindrical.H:166
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
Definition: cylindrical.H:159
virtual void updateCells(const polyMesh &mesh, const labelList &cells)
Update the rotation for a list of cells.
Definition: cylindrical.C:187
virtual void clear()
Reset rotation to an identity rotation.
Definition: cylindrical.C:177
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:54
Registry of regIOobjects.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
virtual const tensorField & Tr() const
Return local-to-global transformation tensor.
Definition: cylindrical.H:178
Namespace for OpenFOAM.
virtual tmp< symmTensorField > transformVector(const vectorField &vf) const
Transform vectorField using transformation tensorField and return.
Definition: cylindrical.C:319