STARCDCoordinateRotation.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::STARCDCoordinateRotation
26 
27 Description
28  A coordinateRotation defined by the STAR-CD convention.
29 
30  The 3 rotations are defined in the STAR-CD convention
31  (around Z, around X' and around Y'').
32  The order of the parameter arguments matches this rotation order.
33 
34  - the rotation angles are in degrees, unless otherwise explictly specified:
35 
36  \verbatim
37  coordinateRotation
38  {
39  type STARCDRotation;
40  degrees false;
41  rotation (0 0 3.141592654);
42  }
43  \endverbatim
44 
45 SourceFiles
46  STARCDCoordinateRotation.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef STARCDCoordinateRotation_H
51 #define STARCDCoordinateRotation_H
52 
53 #include "coordinateRotation.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class STARCDCoordinateRotation Declaration
62 \*---------------------------------------------------------------------------*/
63 
65 :
66  public coordinateRotation
67 {
68 
69  // Private Member Data
70 
71  //- Local-to-Global transformation tensor
72  tensor R_;
73 
74  //- Global-to-Local transformation tensor
75  tensor Rtr_;
76 
77 
78  // Private Member Functions
79 
80  //- Calculate transformation tensor
81  void calcTransform
82  (
83  const scalar rotZ,
84  const scalar rotX,
85  const scalar rotY,
86  const bool inDegrees=true
87  );
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("STARCDRotation");
94 
95 
96  // Constructors
97 
98  //- Construct null
100 
101  //- Construct from rotation vector
103  (
104  const vector& rotZrotXrotY,
105  const bool inDegrees=true
106  );
107 
108  //- Construct from components of rotation vector
110  (
111  const scalar rotZ,
112  const scalar rotX,
113  const scalar rotY,
114  const bool inDegrees=true
115  );
116 
117  //- Construct from dictionary
119 
120  //- Construct from dictionary and mesh
122 
123  // Member Functions
124 
125  //- Reset rotation to an identity rotation
126  virtual void clear()
127  {
128  R_ = sphericalTensor::I;
129  Rtr_ = sphericalTensor::I;
130  }
131 
132  //- Update the rotation for a list of cells
133  virtual void updateCells(const polyMesh&, const labelList&)
134  {
135  // do nothing
136  }
137 
138  //- Return local-to-global transformation tensor
139  virtual const tensor& R() const
140  {
141  return R_;
142  }
143 
144  //- Return global-to-local transformation tensor
145  virtual const tensor& Rtr() const
146  {
147  return Rtr_;
148  };
149 
150  //- Return local Cartesian x-axis in global coordinates
151  virtual const vector e1() const
152  {
153  return Rtr_.x();
154  }
155 
156  //- Return local Cartesian y-axis in global coordinates
157  virtual const vector e2() const
158  {
159  return Rtr_.y();
160  }
161 
162  //- Return local Cartesian z-axis in global coordinates
163  virtual const vector e3() const
164  {
165  return Rtr_.z();
166  }
167 
168  //- Return transformation tensor field
169  virtual const tensorField& Tr() const;
170 
171  //- Transform vectorField using transformation tensor field
172  virtual tmp<vectorField> transform(const vectorField& st) const;
173 
174  //- Transform vector using transformation tensor
175  virtual vector transform(const vector& st) const;
176 
177  //- Inverse transform vectorField using transformation tensor field
178  virtual tmp<vectorField> invTransform(const vectorField& st) const;
179 
180  //- Inverse transform vector using transformation tensor
181  virtual vector invTransform(const vector& st) const;
182 
183  //- Transform tensor field using transformation tensorField
184  virtual tmp<tensorField> transformTensor(const tensorField& st) const;
185 
186  //- Transform tensor using transformation tensorField
187  virtual tensor transformTensor(const tensor& st) const;
188 
189  //- Transform tensor sub-field using transformation tensorField
191  (
192  const tensorField& st,
193  const labelList& cellMap
194  ) const;
195 
196  //- Transform vectorField using transformation tensorField and return
197  // symmetrical tensorField
199  (
200  const vectorField& st
201  ) const;
202 
203  //- Transform vector using transformation tensor and return
204  // symmetrical tensor
205  virtual symmTensor transformVector(const vector& st) const;
206 
207 
208  // Write
209 
210  //- Write
211  virtual void write(Ostream&) const;
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
Abstract base class for coordinate rotation.
virtual void updateCells(const polyMesh &, const labelList &)
Update the rotation for a list of cells.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void write(Ostream &) const
Write.
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
virtual void clear()
Reset rotation to an identity rotation.
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
Vector< Cmpt > x() const
Definition: TensorI.H:279
Vector< Cmpt > y() const
Definition: TensorI.H:286
virtual tmp< tensorField > transformTensor(const tensorField &st) const
Transform tensor field using transformation tensorField.
virtual tmp< vectorField > transform(const vectorField &st) const
Transform vectorField using transformation tensor field.
virtual const tensorField & Tr() const
Return transformation tensor field.
A coordinateRotation defined by the STAR-CD convention.
Vector< Cmpt > z() const
Definition: TensorI.H:293
virtual const tensor & R() const
Return local-to-global transformation tensor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual tmp< vectorField > invTransform(const vectorField &st) const
Inverse transform vectorField using transformation tensor field.
virtual tmp< symmTensorField > transformVector(const vectorField &st) const
Transform vectorField using transformation tensorField and return.
virtual const tensor & Rtr() const
Return global-to-local transformation tensor.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:54
Registry of regIOobjects.
TypeName("STARCDRotation")
Runtime type information.
Namespace for OpenFOAM.
static const SphericalTensor I