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