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-2022 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 from dictionary
100 
101  //- Construct from dictionary and list of points
103  (
104  const dictionary&,
105  const UList<vector>& points
106  );
107 
108  //- Construct and return a clone
109  virtual autoPtr<coordinateRotation> clone() const
110  {
112  (
113  new STARCDCoordinateRotation(*this)
114  );
115  }
116 
117 
118  // Member Functions
119 
120  //- Update the rotation for a list of points
121  virtual void updatePoints(const UList<vector>& points)
122  {}
123 
124  //- Return local-to-global transformation tensor
125  virtual const tensor& R() const
126  {
127  return R_;
128  }
129 
130  //- Return local Cartesian x-axis in global coordinates
131  virtual const vector e1() const
132  {
133  return Rtr_.x();
134  }
135 
136  //- Return local Cartesian y-axis in global coordinates
137  virtual const vector e2() const
138  {
139  return Rtr_.y();
140  }
141 
142  //- Return local Cartesian z-axis in global coordinates
143  virtual const vector e3() const
144  {
145  return Rtr_.z();
146  }
147 
148  //- Transform vectorField using transformation tensor field
149  virtual tmp<vectorField> transform(const vectorField& vf) const;
150 
151  //- Transform vector using transformation tensor
152  virtual vector transform(const vector& v) const;
153 
154  //- Inverse transform vectorField using transformation tensor field
155  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
156 
157  //- Inverse transform vector using transformation tensor
158  virtual vector invTransform(const vector& v) const;
159 
160  //- Transform tensor field using transformation tensorField
161  virtual tmp<tensorField> transform(const tensorField& tf) const;
162 
163  //- Transform tensor using transformation tensorField
164  virtual tensor transform(const vector& p, const tensor& t) const;
165 
166  //- Transform diagTensor masquerading as a vector using transformation
167  // tensor and return symmTensor
169  (
170  const vector& p,
171  const vector& v
172  ) const;
173 
174  //- Transform diagTensorField masquerading as a vectorField
175  // using transformation tensorField and return symmTensorField
177  (
178  const vectorField& vf
179  ) const;
180 
181 
182  // Write
183 
184  //- Write
185  virtual void write(Ostream&) const;
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A coordinateRotation defined by the STAR-CD convention.
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
virtual void write(Ostream &) const
Write.
virtual autoPtr< coordinateRotation > clone() const
Construct and return a clone.
virtual const tensor & R() const
Return local-to-global transformation tensor.
TypeName("STARCDRotation")
Runtime type information.
virtual void updatePoints(const UList< vector > &points)
Update the rotation for a list of points.
virtual tmp< vectorField > invTransform(const vectorField &vf) const
Inverse transform vectorField using transformation tensor field.
virtual tmp< vectorField > transform(const vectorField &vf) const
Transform vectorField using transformation tensor field.
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.
virtual symmTensor transformDiagTensor(const vector &p, const vector &v) const
Transform diagTensor masquerading as a vector using transformation.
STARCDCoordinateRotation(const dictionary &)
Construct from dictionary.
Vector< Cmpt > z() const
Definition: TensorI.H:303
Vector< Cmpt > y() const
Definition: TensorI.H:296
Vector< Cmpt > x() const
Definition: TensorI.H:289
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:74
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Abstract base class for coordinate rotation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A class for managing temporary objects.
Definition: tmp.H:55
const tensorField & tf
const pointField & points
Namespace for OpenFOAM.
volScalarField & p