1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Generate simple sinusoidal 6-DoF motion control-file.
31 \*---------------------------------------------------------------------------*/
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 int main(int argc, char *argv[])
46 // End-time of the table
47 const scalar endTime = 40;
49 // Number of entries in the table
50 const label nTimes = 100;
52 // Amplitude of the translation [m]
53 const vector transAmp(2, 3, 2);
55 // Frequency of the translation [rad/s]
56 const vector transOmega(0.5, 0.8, 0.4);
58 // Amplitude of the rotation [deg]
59 const vector rotAmp(30, 10, 10);
61 // Frequency of the rotation [rad/s]
62 const vector rotOmega(0.4, 0.7, 0.5);
64 List<Tuple2<scalar, Vector2D<vector> > > timeValues(nTimes);
68 scalar t = (endTime*i)/(nTimes - 1);
69 timeValues[i].first() = t;
71 timeValues[i].second()[0] = vector
73 transAmp.x()*Foam::sin(transOmega.x()*t),
74 transAmp.y()*Foam::sin(transOmega.y()*t),
75 transAmp.z()*Foam::sin(transOmega.z()*t)
78 timeValues[i].second()[1] = vector
80 rotAmp.x()*Foam::sin(rotOmega.x()*t),
81 rotAmp.y()*Foam::sin(rotOmega.y()*t),
82 rotAmp.z()*Foam::sin(rotOmega.z()*t)
87 OFstream dataFile("6DoF.dat");
88 dataFile << timeValues << endl;
91 Info << "End\n" << endl;
97 // ************************************************************************* //