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-2020 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 rotational field can be created in two ways:
31  -# Each rotational tensor is defined with two vectors (\c dir and \c axis)
32  where <tt>dir = point - origin</tt> and \c axis is the rotation axis.
33  Per each point an axesRotation type of rotation is created
34  (cylindrical coordinates). For example:
35  \verbatim
36  cylindrical
37  {
38  type localAxes;
39  axis (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 axis_;
80 
81 
82  // Private members
83 
84  //- Return the local transformation tensor
85  // corresponding to the given point
86  tensor R(const vector& p) const;
87 
88  //- Initialise transformation tensor field for given points
89  void init(const UList<vector>& points);
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("cylindrical");
96 
97  // Constructors
98 
99  //- Construct from components for list of points
101  (
102  const vector& axis,
103  const point& origin,
104  const UList<vector>& points
105  );
106 
107  //- Construct from dictionary
108  cylindrical(const dictionary&);
109 
110  //- Construct from dictionary
111  cylindrical(const dictionary&, const UList<vector>& points);
112 
113  //- Return clone
114  virtual autoPtr<coordinateRotation> clone() const
115  {
116  return autoPtr<coordinateRotation>(new cylindrical(*this));
117  }
118 
119 
120  //- Destructor
121  virtual ~cylindrical()
122  {}
123 
124 
125  // Member Functions
126 
127  //- Update the rotation for a list of points
128  virtual void updatePoints(const UList<vector>& points);
129 
130  //- Return local-to-global transformation tensor
131  virtual const tensor& R() const
132  {
134  return tensor::zero;
135  }
136 
137  //- Return local Cartesian x-axis in global coordinates
138  virtual const vector e1() const
139  {
141  return vector::zero;
142  }
143 
144  //- Return local Cartesian y-axis in global coordinates
145  virtual const vector e2() const
146  {
148  return vector::zero;
149  }
150 
151  //- Return local Cartesian z-axis in global coordinates
152  virtual const vector e3() const
153  {
154  return axis_;
155  }
156 
157  //- Return local Cartesian z-axis in global coordinates
158  virtual const vector axis() const
159  {
160  return axis_;
161  }
162 
163  //- Return if the rotation is uniform
164  virtual bool uniform() const
165  {
166  return false;
167  }
168 
169  //- Transform vector using transformation tensor
170  virtual vector transform(const vector& v) const;
171 
172  //- Transform vectorField using transformation tensor field
173  virtual tmp<vectorField> transform(const vectorField& tf) const;
174 
175  //- Transform vector using transformation tensor for component
176  virtual vector transform(const vector& v, const label cmptI) const;
177 
178  //- Inverse transform vector using transformation tensor
179  virtual vector invTransform(const vector& v) const;
180 
181  //- Inverse transform vectorField using transformation tensor field
182  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
183 
184  //- Inverse transform vector using transformation tensor for component
185  virtual vector invTransform(const vector& v, const label cmptI) const;
186 
187  //- Transform tensor using transformation tensorField
188  virtual tensor transformTensor(const tensor& t) const;
189 
190  //- Transform tensor field using transformation tensorField
191  virtual tmp<tensorField> transformTensor(const tensorField& tf) const;
192 
193  //- Transform vector using transformation tensor and return
194  // symmetrical tensor
195  virtual symmTensor transformVector(const vector& v) const;
196 
197  //- Transform vectorField using transformation tensorField and return
198  // symmetrical tensorField
200  (
201  const vectorField& vf
202  ) const;
203 
204 
205  // Write
206 
207  //- Write
208  virtual void write(Ostream&) const;
209 };
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
Definition: cylindrical.H:137
Abstract base class for coordinate rotation.
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
Definition: cylindrical.H:144
virtual ~cylindrical()
Destructor.
Definition: cylindrical.H:120
virtual vector transform(const vector &v) const
Transform vector using transformation tensor.
Definition: cylindrical.C:157
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void updatePoints(const UList< vector > &points)
Update the rotation for a list of points.
Definition: cylindrical.C:121
const tensorField & tf
virtual const tensor & R() const
Return local-to-global transformation tensor.
Definition: cylindrical.H:130
cylindrical(const vector &axis, const point &origin, const UList< vector > &points)
Construct from components for list of points.
Definition: cylindrical.C:80
const pointField & points
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
Definition: cylindrical.H:151
A local coordinate rotation.
Definition: cylindrical.H:65
virtual void write(Ostream &) const
Write.
Definition: cylindrical.C:266
TypeName("cylindrical")
Runtime type information.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual autoPtr< coordinateRotation > clone() const
Return clone.
Definition: cylindrical.H:113
virtual const vector axis() const
Return local Cartesian z-axis in global coordinates.
Definition: cylindrical.H:157
virtual bool uniform() const
Return if the rotation is uniform.
Definition: cylindrical.H:163
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual vector invTransform(const vector &v) const
Inverse transform vector using transformation tensor.
Definition: cylindrical.C:190
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
virtual symmTensor transformVector(const vector &v) const
Transform vector using transformation tensor and return.
Definition: cylindrical.C:257
virtual tensor transformTensor(const tensor &t) const
Transform tensor using transformation tensorField.
Definition: cylindrical.C:223
Namespace for OpenFOAM.