axisRotationMotion.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "axisRotationMotion.H"
30 #include "unitConversion.H"
31 
32 using namespace Foam::constant::mathematical;
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace solidBodyMotionFunctions
39 {
42  (
46  );
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
53 Foam::solidBodyMotionFunctions::axisRotationMotion::axisRotationMotion
54 (
55  const dictionary& SBMFCoeffs,
56  const Time& runTime
57 )
58 :
59  solidBodyMotionFunction(SBMFCoeffs, runTime)
60 {
61  read(SBMFCoeffs);
62 }
63 
64 
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66 
69 {
70  scalar t = time_.value();
71 
72  // Rotation origin (in radians)
73  vector omega
74  (
75  t*degToRad(radialVelocity_.x()),
76  t*degToRad(radialVelocity_.y()),
77  t*degToRad(radialVelocity_.z())
78  );
79 
80  scalar magOmega = mag(omega);
81  quaternion R(omega/magOmega, magOmega);
82  septernion TR(septernion(-origin_)*R*septernion(origin_));
83 
84  DebugInFunction << "Time = " << t << " transformation: " << TR << endl;
85 
86  return TR;
87 }
88 
89 
91 (
92  const dictionary& SBMFCoeffs
93 )
94 {
96 
97  SBMFCoeffs_.readEntry("origin", origin_);
98  SBMFCoeffs_.readEntry("radialVelocity", radialVelocity_);
99 
100  return true;
101 }
102 
103 
104 // ************************************************************************* //
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Unit conversion functions.
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Septernion class used to perform translations and rotations in 3D space.
Definition: septernion.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Macros for easy insertion into run-time selection tables.
Base class for defining solid-body motions.
Mathematical constants.
#define DebugInFunction
Report an information message using Foam::Info.
virtual bool read(const dictionary &SBMFCoeffs)=0
Update properties from given dictionary.
Quaternion class used to perform rotations in 3D space.
Definition: quaternion.H:53
virtual bool read(const dictionary &SBMFCoeffs)
Update properties from given dictionary.
Constant velocity rotation around CoG. Similar to rotatingMotion but motion specified as rotation vec...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
defineTypeNameAndDebug(combustionModel, 0)
#define R(A, B, C, D, E, F, K, M)
virtual septernion transformation() const
Return the solid-body motion transformation septernion.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Namespace for OpenFOAM.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)