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-------------------------------------------------------------------------------
10License
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
32using namespace Foam::constant::mathematical;
33
34// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36namespace Foam
37{
38namespace solidBodyMotionFunctions
39{
42 (
46 );
47}
48}
49
50
51// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52
54(
55 const dictionary& SBMFCoeffs,
56 const Time& runTime
57)
58:
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// ************************************************************************* //
#define R(A, B, C, D, E, F, K, M)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Quaternion class used to perform rotations in 3D space.
Definition: quaternion.H:58
Septernion class used to perform translations and rotations in 3D space.
Definition: septernion.H:67
Base class for defining solid-body motions.
Constant velocity rotation around CoG. Similar to rotatingMotion but motion specified as rotation vec...
virtual septernion transformation() const
Return the solid-body motion transformation septernion.
virtual bool read(const dictionary &SBMFCoeffs)
Update properties from given dictionary.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
engineTime & runTime
#define DebugInFunction
Report an information message using Foam::Info.
Mathematical constants.
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Unit conversion functions.