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  //- Return clone
125  {
126  return autoPtr<cylindrical>(new cylindrical(*this));
127  }
128 
129 
130  //- Destructor
131  virtual ~cylindrical()
132  {}
133 
134 
135  // Member Functions
136 
137  //- Reset rotation to an identity rotation
138  virtual void clear();
139 
140  //- Update the rotation for a list of cells
141  virtual void updateCells(const polyMesh& mesh, const labelList& cells);
142 
143  //- Return local-to-global transformation tensor
144  virtual const tensor& R() const
145  {
146  notImplemented("const tensor& cylindrical::R() const");
147  return tensor::zero;
148  }
149 
150  //- Return global-to-local transformation tensor
151  virtual const tensor& Rtr() const
152  {
153  notImplemented("const tensor& cylindrical::Rtr() const");
154  return tensor::zero;
155  }
156 
157  //- Return local Cartesian x-axis
158  virtual const vector e1() const
159  {
160  notImplemented("const tensor& cylindrical::e1() const");
161  return vector::zero;
162  }
163 
164  //- Return local Cartesian y-axis
165  virtual const vector e2() const
166  {
167  notImplemented("const tensor& cylindrical::e2() const");
168  return vector::zero;
169  }
170 
171  //- Return local Cartesian z-axis
172  virtual const vector e3() const
173  {
174  return e3_;
175  }
177  virtual const tensorField& Tr() const
178  {
179  return Rptr_();
180  }
181 
182  //- Transform vectorField using transformation tensor field
183  virtual tmp<vectorField> transform(const vectorField& tf) const;
184 
185  //- Transform vector using transformation tensor
186  virtual vector transform(const vector& v) const;
187 
188  //- Transform vector using transformation tensor for component
189  virtual vector transform(const vector& v, const label cmptI) const;
190 
191  //- Inverse transform vectorField using transformation tensor field
192  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
193 
194  //- Inverse transform vector using transformation tensor
195  virtual vector invTransform(const vector& v) const;
196 
197  //- Inverse transform vector using transformation tensor for component
198  virtual vector invTransform(const vector& v, const label cmptI) const;
199 
200  //- Return if the rotation is uniform
201  virtual bool uniform() const
202  {
203  return false;
204  }
205 
206  //- Transform tensor field using transformation tensorField
207  virtual tmp<tensorField> transformTensor(const tensorField& tf) const;
208 
209  //- Transform tensor using transformation tensorField
210  virtual tensor transformTensor(const tensor& t) const;
211 
212  //- Transform tensor sub-field using transformation tensorField
214  (
215  const tensorField& tf,
216  const labelList& cellMap
217  ) const;
218 
219  //- Transform vectorField using transformation tensorField and return
220  // symmetrical tensorField
222  (
223  const vectorField& vf
224  ) const;
225 
226  //- Transform vector using transformation tensor and return
227  // symmetrical tensor (R & st & R.T())
228  virtual symmTensor transformVector(const vector& v) const;
229 
230 
231  // Write
232 
233  //- Write
234  virtual void write(Ostream&) const;
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
TypeName("cylindrical")
Runtime type information.
virtual tmp< symmTensorField > transformVector(const vectorField &vf) const
Transform vectorField using transformation tensorField and return.
Definition: cylindrical.C:344
virtual const vector e1() const
Return local Cartesian x-axis.
Definition: cylindrical.H:157
A local coordinate rotation. The cell based rotational field can be created in two ways: ...
Definition: cylindrical.H:63
virtual const vector e3() const
Return local Cartesian z-axis.
Definition: cylindrical.H:171
Templated 3D symmetric tensor derived from VectorSpace adding construction from 6 components...
Definition: SymmTensor.H:53
static const Tensor zero
Definition: Tensor.H:80
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
virtual const tensor & Rtr() const
Return global-to-local transformation tensor.
Definition: cylindrical.H:150
virtual tmp< vectorField > invTransform(const vectorField &vf) const
Inverse transform vectorField using transformation tensor field.
Definition: cylindrical.C:246
dynamicFvMesh & mesh
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
virtual void clear()
Reset rotation to an identity rotation.
Definition: cylindrical.C:177
Abstract base class for coordinate rotation.
cylindrical(const dictionary &, const objectRegistry &)
Construct from dictionary and objectRegistry.
Definition: cylindrical.C:96
virtual tmp< vectorField > transform(const vectorField &tf) const
Transform vectorField using transformation tensor field.
Definition: cylindrical.C:207
virtual ~cylindrical()
Destructor.
Definition: cylindrical.H:130
autoPtr< cylindrical > clone() const
Return clone.
Definition: cylindrical.H:123
virtual tmp< tensorField > transformTensor(const tensorField &tf) const
Transform tensor field using transformation tensorField.
Definition: cylindrical.C:275
const tensorField & tf
const cellShapeList & cells
virtual const tensorField & Tr() const
Return local-to-global transformation tensor.
Definition: cylindrical.H:176
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual const vector e2() const
Return local Cartesian y-axis.
Definition: cylindrical.H:164
Registry of regIOobjects.
virtual const tensor & R() const
Return local-to-global transformation tensor.
Definition: cylindrical.H:143
virtual void write(Ostream &) const
Write.
Definition: cylindrical.C:380
static const Vector zero
Definition: Vector.H:80
virtual void updateCells(const polyMesh &mesh, const labelList &cells)
Update the rotation for a list of cells.
Definition: cylindrical.C:187
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
virtual bool uniform() const
Return if the rotation is uniform.
Definition: cylindrical.H:200
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
A class for managing temporary objects.
Definition: PtrList.H:118