oscillatingRotatingMotion.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
31#include "unitConversion.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
37namespace solidBodyMotionFunctions
38{
41 (
45 );
46}
47}
48
49
50// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51
52Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::
53oscillatingRotatingMotion
54(
55 const dictionary& SBMFCoeffs,
56 const Time& runTime
57)
58:
60{
61 read(SBMFCoeffs);
62}
63
64
65// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66
69transformation() const
70{
71 scalar t = time_.value();
72
73 vector eulerAngles = amplitude_*sin(omega_*t);
74
75 // Convert the rotational motion from deg to rad
76 eulerAngles *= degToRad();
77
78 quaternion R(quaternion::XYZ, eulerAngles);
79 septernion TR(septernion(-origin_)*R*septernion(origin_));
80
81 DebugInFunction << "Time = " << t << " transformation: " << TR << endl;
82
83 return TR;
84}
85
86
88(
89 const dictionary& SBMFCoeffs
90)
91{
93
94 SBMFCoeffs_.readEntry("origin", origin_);
95 SBMFCoeffs_.readEntry("amplitude", amplitude_);
96 SBMFCoeffs_.readEntry("omega", omega_);
97
98 return true;
99}
100
101
102// ************************************************************************* //
#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.
SolidBodyMotionFvMesh 6DoF motion function. Oscillating rotation.
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.
Namespace for OpenFOAM.
dimensionedScalar sin(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
Unit conversion functions.