1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Generate simple sinusoidal 6-DoF motion control-file.
30 \*---------------------------------------------------------------------------*/
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 int main(int argc, char *argv[])
45 // End-time of the table
46 const scalar endTime = 40;
48 // Number of entries in the table
49 const label nTimes = 100;
51 // Amplitude of the translation [m]
52 const vector transAmp(2, 3, 2);
54 // Frequency of the translation [rad/s]
55 const vector transOmega(0.5, 0.8, 0.4);
57 // Amplitude of the rotation [deg]
58 const vector rotAmp(30, 10, 10);
60 // Frequency of the rotation [rad/s]
61 const vector rotOmega(0.4, 0.7, 0.5);
63 List<Tuple2<scalar, Vector2D<vector> > > timeValues(nTimes);
67 scalar t = (endTime*i)/(nTimes - 1);
68 timeValues[i].first() = t;
70 timeValues[i].second()[0] = vector
72 transAmp.x()*Foam::sin(transOmega.x()*t),
73 transAmp.y()*Foam::sin(transOmega.y()*t),
74 transAmp.z()*Foam::sin(transOmega.z()*t)
77 timeValues[i].second()[1] = vector
79 rotAmp.x()*Foam::sin(rotOmega.x()*t),
80 rotAmp.y()*Foam::sin(rotOmega.y()*t),
81 rotAmp.z()*Foam::sin(rotOmega.z()*t)
86 OFstream dataFile("6DoF.dat");
87 dataFile << timeValues << endl;
90 Info<< "End\n" << endl;
96 // ************************************************************************* //