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-2014 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 \*---------------------------------------------------------------------------*/
46 
47 #ifndef STARCDCoordinateRotation_H
48 #define STARCDCoordinateRotation_H
49 
50 #include "coordinateRotation.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class STARCDCoordinateRotation Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
63  public coordinateRotation
64 {
65 
66  // Private Member Data
67 
68  //- Local-to-Global transformation tensor
69  tensor R_;
70 
71  //- Global-to-Local transformation tensor
72  tensor Rtr_;
73 
74 
75  // Private Member Functions
76 
77  //- Calculate transformation tensor
78  void calcTransform
79  (
80  const scalar rotZ,
81  const scalar rotX,
82  const scalar rotY,
83  const bool inDegrees=true
84  );
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("STARCDRotation");
91 
92 
93  // Constructors
94 
95  //- Construct null
97 
98  //- Construct from rotation vector
100  (
101  const vector& rotZrotXrotY,
102  const bool inDegrees=true
103  );
104 
105  //- Construct from components of rotation vector
107  (
108  const scalar rotZ,
109  const scalar rotX,
110  const scalar rotY,
111  const bool inDegrees=true
112  );
113 
114  //- Construct from dictionary
116 
117  //- Construct from dictionary and mesh
119 
120  //- Construct as copy
122 
123  //- Return clone
125  {
127  (
129  (
130  *this
131  )
132  );
133  }
134 
135 
136  // Member Functions
137 
138  //- Reset rotation to an identity rotation
139  virtual void clear()
140  {
143  }
144 
145  //- Update the rotation for a list of cells
146  virtual void updateCells(const polyMesh&, const labelList&)
147  {
148  // do nothing
149  }
150 
151  //- Return local-to-global transformation tensor
152  virtual const tensor& R() const
153  {
154  return R_;
155  }
156 
157  //- Return global-to-local transformation tensor
158  virtual const tensor& Rtr() const
159  {
160  return Rtr_;
161  };
162 
163  //- Return local Cartesian x-axis
164  virtual const vector e1() const
165  {
166  return R_.x();
167  }
168 
169  //- Return local Cartesian y-axis
170  virtual const vector e2() const
171  {
172  return R_.y();
173  }
174 
175  //- Return local Cartesian z-axis
176  virtual const vector e3() const
177  {
178  return R_.z();
179  }
180 
181  //- Return transformation tensor field
182  virtual const tensorField& Tr() const;
183 
184  //- Transform vectorField using transformation tensor field
185  virtual tmp<vectorField> transform(const vectorField& st) const;
186 
187  //- Transform vector using transformation tensor
188  virtual vector transform(const vector& st) const;
189 
190  //- Inverse transform vectorField using transformation tensor field
191  virtual tmp<vectorField> invTransform(const vectorField& st) const;
192 
193  //- Inverse transform vector using transformation tensor
194  virtual vector invTransform(const vector& st) const;
195 
196  //- Transform tensor field using transformation tensorField
197  virtual tmp<tensorField> transformTensor(const tensorField& st) const;
198 
199  //- Transform tensor using transformation tensorField
200  virtual tensor transformTensor(const tensor& st) const;
201 
202  //- Transform tensor sub-field using transformation tensorField
204  (
205  const tensorField& st,
206  const labelList& cellMap
207  ) const;
208 
209  //- Transform vectorField using transformation tensorField and return
210  // symmetrical tensorField
212  (
213  const vectorField& st
214  ) const;
215 
216  //- Transform vector using transformation tensor and return
217  // symmetrical tensor
218  virtual symmTensor transformVector(const vector& st) const;
219 
220 
221  // Write
222 
223  //- Write
224  virtual void write(Ostream&) const;
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::STARCDCoordinateRotation::Rtr_
tensor Rtr_
Global-to-Local transformation tensor.
Definition: STARCDCoordinateRotation.H:71
Foam::STARCDCoordinateRotation::Tr
virtual const tensorField & Tr() const
Return transformation tensor field.
Definition: STARCDCoordinateRotation.C:88
Foam::SymmTensor< scalar >
Foam::STARCDCoordinateRotation::transform
virtual tmp< vectorField > transform(const vectorField &st) const
Transform vectorField using transformation tensor field.
Definition: STARCDCoordinateRotation.C:69
Foam::STARCDCoordinateRotation::TypeName
TypeName("STARCDRotation")
Runtime type information.
Foam::STARCDCoordinateRotation
A coordinateRotation defined by the STAR-CD convention.
Definition: STARCDCoordinateRotation.H:60
Foam::Tensor::y
Vector< Cmpt > y() const
Definition: TensorI.H:128
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::STARCDCoordinateRotation::e2
virtual const vector e2() const
Return local Cartesian y-axis.
Definition: STARCDCoordinateRotation.H:169
Foam::STARCDCoordinateRotation::updateCells
virtual void updateCells(const polyMesh &, const labelList &)
Update the rotation for a list of cells.
Definition: STARCDCoordinateRotation.H:145
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::STARCDCoordinateRotation::calcTransform
void calcTransform(const scalar rotZ, const scalar rotX, const scalar rotY, const bool inDegrees=true)
Calculate transformation tensor.
Definition: STARCDCoordinateRotation.C:153
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::coordinateRotation
Abstract base class for coordinate rotation.
Definition: coordinateRotation.H:68
Foam::STARCDCoordinateRotation::write
virtual void write(Ostream &) const
Write.
Definition: STARCDCoordinateRotation.C:284
Foam::STARCDCoordinateRotation::transformTensor
virtual tmp< tensorField > transformTensor(const tensorField &st) const
Transform tensor field using transformation tensorField.
Definition: STARCDCoordinateRotation.C:96
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::STARCDCoordinateRotation::R_
tensor R_
Local-to-Global transformation tensor.
Definition: STARCDCoordinateRotation.H:68
Foam::Tensor::z
Vector< Cmpt > z() const
Definition: TensorI.H:135
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::STARCDCoordinateRotation::R
virtual const tensor & R() const
Return local-to-global transformation tensor.
Definition: STARCDCoordinateRotation.H:151
Foam::STARCDCoordinateRotation::clone
autoPtr< coordinateRotation > clone() const
Return clone.
Definition: STARCDCoordinateRotation.H:123
Foam::Tensor::x
Vector< Cmpt > x() const
Definition: TensorI.H:121
Foam::STARCDCoordinateRotation::Rtr
virtual const tensor & Rtr() const
Return global-to-local transformation tensor.
Definition: STARCDCoordinateRotation.H:157
Foam::Vector< scalar >
Foam::STARCDCoordinateRotation::e1
virtual const vector e1() const
Return local Cartesian x-axis.
Definition: STARCDCoordinateRotation.H:163
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::STARCDCoordinateRotation::e3
virtual const vector e3() const
Return local Cartesian z-axis.
Definition: STARCDCoordinateRotation.H:175
coordinateRotation.H
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
STARCDCoordinateRotation()
Construct null.
Definition: STARCDCoordinateRotation.C:195
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::STARCDCoordinateRotation::transformVector
virtual tmp< symmTensorField > transformVector(const vectorField &st) const
Transform vectorField using transformation tensorField and return.
Definition: STARCDCoordinateRotation.C:127
Foam::SphericalTensor::I
static const SphericalTensor I
Definition: SphericalTensor.H:78
Foam::STARCDCoordinateRotation::clear
virtual void clear()
Reset rotation to an identity rotation.
Definition: STARCDCoordinateRotation.H:138
Foam::STARCDCoordinateRotation::invTransform
virtual tmp< vectorField > invTransform(const vectorField &st) const
Inverse transform vectorField using transformation tensor field.
Definition: STARCDCoordinateRotation.C:79