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-2024 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 z,
84  const scalar x,
85  const scalar y
86  );
87 
88 
89 public:
90 
91  //- Runtime type information
92  TypeName("STARCDRotation");
93 
94 
95  // Constructors
96 
97  //- Construct from dictionary
99 
100  //- Construct from dictionary and list of points
102  (
103  const dictionary&,
104  const UList<vector>& points
105  );
106 
107  //- Construct and return a clone
108  virtual autoPtr<coordinateRotation> clone() const
109  {
111  (
112  new STARCDCoordinateRotation(*this)
113  );
114  }
115 
116 
117  // Member Functions
118 
119  //- Update the rotation for a list of points
120  virtual void updatePoints(const UList<vector>& points)
121  {}
122 
123  //- Return local-to-global transformation tensor
124  virtual const tensor& R() const
125  {
126  return R_;
127  }
128 
129  //- Return local Cartesian x-axis in global coordinates
130  virtual const vector e1() const
131  {
132  return Rtr_.x();
133  }
134 
135  //- Return local Cartesian y-axis in global coordinates
136  virtual const vector e2() const
137  {
138  return Rtr_.y();
139  }
140 
141  //- Return local Cartesian z-axis in global coordinates
142  virtual const vector e3() const
143  {
144  return Rtr_.z();
145  }
146 
147  //- Transform vectorField using transformation tensor field
148  virtual tmp<vectorField> transform(const vectorField& vf) const;
149 
150  //- Transform vector using transformation tensor
151  virtual vector transform(const vector& v) const;
152 
153  //- Inverse transform vectorField using transformation tensor field
154  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
155 
156  //- Inverse transform vector using transformation tensor
157  virtual vector invTransform(const vector& v) const;
158 
159  //- Transform tensor field using transformation tensorField
160  virtual tmp<tensorField> transform(const tensorField& tf) const;
161 
162  //- Transform tensor using transformation tensorField
163  virtual tensor transform(const vector& p, const tensor& t) const;
164 
165  //- Transform diagTensor masquerading as a vector using transformation
166  // tensor and return symmTensor
168  (
169  const vector& p,
170  const vector& v
171  ) const;
172 
173  //- Transform diagTensorField masquerading as a vectorField
174  // using transformation tensorField and return symmTensorField
176  (
177  const vectorField& vf
178  ) const;
179 
180 
181  // Write
182 
183  //- Write
184  virtual void write(Ostream&) const;
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
scalar y
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:162
A class for managing temporary objects.
Definition: tmp.H:55
const tensorField & tf
const pointField & points
Namespace for OpenFOAM.
volScalarField & p