STARCDCoordinateRotation.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-2018 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 explicitly 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 
136  //- Return local-to-global transformation tensor
137  virtual const tensor& R() const
138  {
139  return R_;
140  }
141 
142  //- Return global-to-local transformation tensor
143  virtual const tensor& Rtr() const
144  {
145  return Rtr_;
146  };
147 
148  //- Return local Cartesian x-axis in global coordinates
149  virtual const vector e1() const
150  {
151  return Rtr_.x();
152  }
153 
154  //- Return local Cartesian y-axis in global coordinates
155  virtual const vector e2() const
156  {
157  return Rtr_.y();
158  }
159 
160  //- Return local Cartesian z-axis in global coordinates
161  virtual const vector e3() const
162  {
163  return Rtr_.z();
164  }
165 
166  //- Return transformation tensor field
167  virtual const tensorField& Tr() const;
168 
169  //- Transform vectorField using transformation tensor field
170  virtual tmp<vectorField> transform(const vectorField& st) const;
171 
172  //- Transform vector using transformation tensor
173  virtual vector transform(const vector& st) const;
174 
175  //- Inverse transform vectorField using transformation tensor field
176  virtual tmp<vectorField> invTransform(const vectorField& st) const;
177 
178  //- Inverse transform vector using transformation tensor
179  virtual vector invTransform(const vector& st) const;
180 
181  //- Transform tensor field using transformation tensorField
182  virtual tmp<tensorField> transformTensor(const tensorField& st) const;
183 
184  //- Transform tensor using transformation tensorField
185  virtual tensor transformTensor(const tensor& st) const;
186 
187  //- Transform tensor sub-field using transformation tensorField
189  (
190  const tensorField& st,
191  const labelList& cellMap
192  ) const;
193 
194  //- Transform vectorField using transformation tensorField and return
195  // symmetrical tensorField
197  (
198  const vectorField& st
199  ) const;
200 
201  //- Transform vector using transformation tensor and return
202  // symmetrical tensor
203  virtual symmTensor transformVector(const vector& st) const;
204 
205 
206  // Write
207 
208  //- Write
209  virtual void write(Ostream&) const;
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
virtual tmp< vectorField > transform(const vectorField &st) const
Transform vectorField using transformation tensor field.
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:158
Vector< Cmpt > x() const
Definition: TensorI.H:289
virtual const tensorField & Tr() const
Return transformation tensor field.
Vector< Cmpt > y() const
Definition: TensorI.H:296
virtual void clear()
Reset rotation to an identity rotation.
virtual void write(Ostream &) const
Write.
Vector< Cmpt > z() const
Definition: TensorI.H:303
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
A coordinateRotation defined by the STAR-CD convention.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual tmp< symmTensorField > transformVector(const vectorField &st) const
Transform vectorField using transformation tensorField and return.
virtual tmp< tensorField > transformTensor(const tensorField &st) const
Transform tensor field using transformation tensorField.
virtual tmp< vectorField > invTransform(const vectorField &st) const
Inverse transform vectorField using transformation tensor field.
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:53
Registry of regIOobjects.
virtual const tensor & R() const
Return local-to-global transformation tensor.
TypeName("STARCDRotation")
Runtime type information.
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
Namespace for OpenFOAM.
static const SphericalTensor I