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 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::septernion
Septernion class used to perform translations and rotations in 3D space.
Definition: septernion.H:66
Foam::read
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:108
unitConversion.H
Unit conversion functions.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
axisRotationMotion.H
Foam::quaternion
Quaternion class used to perform rotations in 3D space.
Definition: quaternion.H:56
Foam::solidBodyMotionFunctions::axisRotationMotion::read
virtual bool read(const dictionary &SBMFCoeffs)
Update properties from given dictionary.
Definition: axisRotationMotion.C:91
R
#define R(A, B, C, D, E, F, K, M)
Foam::solidBodyMotionFunctions::axisRotationMotion
Constant velocity rotation around CoG. Similar to rotatingMotion but motion specified as rotation vec...
Definition: axisRotationMotion.H:56
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:365
Foam::solidBodyMotionFunctions::axisRotationMotion::transformation
virtual septernion transformation() const
Return the solid-body motion transformation septernion.
Definition: axisRotationMotion.C:68
Foam::solidBodyMotionFunction
Base class for defining solid-body motions.
Definition: solidBodyMotionFunction.H:63
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::degToRad
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Definition: unitConversion.H:48
Foam::solidBodyMotionFunction::read
virtual bool read(const dictionary &SBMFCoeffs)=0
Update properties from given dictionary.
Definition: solidBodyMotionFunction.C:60
Foam::constant::mathematical
Mathematical constants.
Foam::Vector< scalar >
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)