cylindrical.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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  //- Return the local transformation tensor
85  // corresponding to the given vector
86  tensor R(const vector& dir) const;
87 
88  //- Initialise transformation tensor field for cell set
89  void init
90  (
91  const objectRegistry& obr,
92  const List<label>& cells
93  );
94 
95  //- Initialise transformation tensor field for all cells
96  void init(const objectRegistry& obr);
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("cylindrical");
103 
104  // Constructors
105 
106  //- Construct from dictionary and objectRegistry
107  cylindrical(const dictionary&, const objectRegistry&);
108 
109  //- Construct from components for all cells
111  (
112  const objectRegistry&,
113  const vector& axis,
114  const point& origin
115  );
116 
117  //- Construct from components for list of cells
119  (
120  const objectRegistry&,
121  const vector& axis,
122  const point& origin,
123  const List<label>& cells
124  );
125 
126  //- Construct from dictionary
127  cylindrical(const dictionary&);
128 
129  //- Construct from tensor Field
130  cylindrical(const tensorField&);
131 
132  //- Return clone
134  {
135  return autoPtr<cylindrical>(new cylindrical(*this));
136  }
137 
138 
139  //- Destructor
140  virtual ~cylindrical()
141  {}
142 
143 
144  // Member Functions
145 
146  //- Reset rotation to an identity rotation
147  virtual void clear();
148 
149  //- Update the rotation for a list of cells
150  virtual void updateCells(const polyMesh& mesh, const labelList& cells);
151 
152  //- Return local-to-global transformation tensor
153  virtual const tensor& R() const
154  {
156  return tensor::zero;
157  }
158 
159  //- Return global-to-local transformation tensor
160  virtual const tensor& Rtr() const
161  {
163  return tensor::zero;
164  }
165 
166  //- Return local Cartesian x-axis in global coordinates
167  virtual const vector e1() const
168  {
170  return vector::zero;
171  }
172 
173  //- Return local Cartesian y-axis in global coordinates
174  virtual const vector e2() const
175  {
177  return vector::zero;
178  }
179 
180  //- Return local Cartesian z-axis in global coordinates
181  virtual const vector e3() const
182  {
183  return e3_;
184  }
186  virtual const tensorField& Tr() const
187  {
188  return Rptr_();
189  }
190 
191  //- Transform vectorField using transformation tensor field
192  virtual tmp<vectorField> transform(const vectorField& tf) const;
193 
194  //- Transform vector using transformation tensor
195  virtual vector transform(const vector& v) const;
196 
197  //- Transform vector using transformation tensor for component
198  virtual vector transform(const vector& v, const label cmptI) const;
199 
200  //- Inverse transform vectorField using transformation tensor field
201  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
202 
203  //- Inverse transform vector using transformation tensor
204  virtual vector invTransform(const vector& v) const;
205 
206  //- Inverse transform vector using transformation tensor for component
207  virtual vector invTransform(const vector& v, const label cmptI) const;
208 
209  //- Return if the rotation is uniform
210  virtual bool uniform() const
211  {
212  return false;
213  }
214 
215  //- Transform tensor field using transformation tensorField
216  virtual tmp<tensorField> transformTensor(const tensorField& tf) const;
217 
218  //- Transform tensor using transformation tensorField
219  virtual tensor transformTensor(const tensor& t) const;
220 
221  //- Transform tensor sub-field using transformation tensorField
223  (
224  const tensorField& tf,
225  const labelList& cellMap
226  ) const;
227 
228  //- Transform vectorField using transformation tensorField and return
229  // symmetrical tensorField
231  (
232  const vectorField& vf
233  ) const;
234 
235  //- Transform vector using transformation tensor and return
236  // symmetrical tensor (R & st & R.T())
237  virtual symmTensor transformVector(const vector& v) const;
238 
239 
240  // Write
241 
242  //- Write
243  virtual void write(Ostream&) const;
244 };
245 
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 } // End namespace Foam
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #endif
254 
255 // ************************************************************************* //
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
Definition: cylindrical.H:166
Abstract base class for coordinate rotation.
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
Definition: cylindrical.H:173
virtual tmp< tensorField > transformTensor(const tensorField &tf) const
Transform tensor field using transformation tensorField.
Definition: cylindrical.C:277
virtual ~cylindrical()
Destructor.
Definition: cylindrical.H:139
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:159
virtual tmp< vectorField > invTransform(const vectorField &vf) const
Inverse transform vectorField using transformation tensor field.
Definition: cylindrical.C:251
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const tensorField & tf
virtual const tensor & R() const
Return local-to-global transformation tensor.
Definition: cylindrical.H:152
dynamicFvMesh & mesh
const cellShapeList & cells
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
Definition: cylindrical.H:180
A local coordinate rotation.
Definition: cylindrical.H:65
cylindrical(const dictionary &, const objectRegistry &)
Construct from dictionary and objectRegistry.
Definition: cylindrical.C:107
autoPtr< cylindrical > clone() const
Return clone.
Definition: cylindrical.H:132
virtual const tensorField & Tr() const
Return local-to-global transformation tensor.
Definition: cylindrical.H:185
virtual tmp< vectorField > transform(const vectorField &tf) const
Transform vectorField using transformation tensor field.
Definition: cylindrical.C:218
virtual void write(Ostream &) const
Write.
Definition: cylindrical.C:362
TypeName("cylindrical")
Runtime type information.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual void updateCells(const polyMesh &mesh, const labelList &cells)
Update the rotation for a list of cells.
Definition: cylindrical.C:198
virtual void clear()
Reset rotation to an identity rotation.
Definition: cylindrical.C:188
virtual bool uniform() const
Return if the rotation is uniform.
Definition: cylindrical.H:209
virtual tmp< symmTensorField > transformVector(const vectorField &vf) const
Transform vectorField using transformation tensorField and return.
Definition: cylindrical.C:329
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
Namespace for OpenFOAM.