1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Dubravko Matijasevic, FSB Zagreb. All rights reserved.
29 Updated by Hrvoje Jasak
34 \*---------------------------------------------------------------------------*/
36 #ifndef finiteRotation_H
37 #define finiteRotation_H
39 #include "HamiltonRodriguezRot.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class finiteRotation Declaration
48 \*---------------------------------------------------------------------------*/
55 HamiltonRodriguezRot eInitial_;
60 //- Incremental rotational tensor
61 tensor rotIncrementTensor_;
64 // Private Member Functions
66 //- Calculate unit rotation vector from given rotation tensor
67 static vector rotVector(const tensor& rotT);
69 //- Calculate rotation angle from given rotation tensor
70 static scalar rotAngle(const tensor& rotT);
72 //- Calculate Euler angles (x-y-z (roll-pitch-yaw) convention) from
73 // given rotation tensor. Reference: Mike Day, Insomniac Games,
74 // Extracting Euler Angles from a Rotation Matrix.
75 static vector eulerAngles(const tensor& rotT);
82 //- Construct from cooordinate rotation
83 explicit finiteRotation(const HamiltonRodriguezRot& rot);
85 //- Construct from rotation vector and angle
101 void updateRotation(const HamiltonRodriguezRot& rot);
103 //- Return initial quaternions
104 const HamiltonRodriguezRot& eInitial() const;
106 //- Return current quaternions
107 HamiltonRodriguezRot eCurrent() const;
109 //-Transformations to inertial coordinate system
110 const tensor& rotTensor() const;
112 //- Return rotation vector
113 vector rotVector() const;
115 //- Return rotation angle
116 scalar rotAngle() const;
118 //- Return Euler angles (see static function eulerAngles for convention)
119 vector eulerAngles() const;
121 // Transformations between new and previous rotation
122 const tensor& rotIncrementTensor() const;
124 //- Return rotation vector increment
125 vector rotIncrementVector() const;
127 //- Return rotation angle increment
128 scalar rotIncrementAngle() const;
130 // Return average rotational velocity vector
131 vector omegaAverage(const scalar deltaT) const;
133 // Return mean rotation for last time step
134 tensor rotTensorAverage() const;
136 // Return mean rotation vector for last time step
137 vector rotVectorAverage() const;
139 // Return average rotational velocity vector in absolute coord. system
140 vector omegaAverageAbsolute(const scalar deltaT) const;
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 } // End namespace Foam
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 // ************************************************************************* //