1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 6-DOF solver for multiple bodies
32 Dubravko Matijasevic, FSB Zagreb. All rights reserved.
34 \*----------------------------------------------------------------------------*/
36 #include "sixDOFbodies.H"
38 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40 void Foam::sixDOFbodies::setBodies()
42 // Find if duplicate name existes
43 forAll (names_, bodyI)
47 label otherBody = bodyI + 1;
48 otherBody < names_.size();
52 if (names_[bodyI] == names_[otherBody])
54 FatalErrorIn("sixDOFbodies::setBodies()")
55 << "Duplicate names of bodies: this is not allowed"
61 odes_.setSize(names_.size());
62 solvers_.setSize(names_.size());
64 forAll (names_, bodyI)
95 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
97 Foam::sixDOFbodies::sixDOFbodies
116 names_(lookup("bodies"))
122 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 void Foam::sixDOFbodies::solve()
126 const scalar tol = readScalar(lookup("eps"));
128 forAll (odes_, bodyI)
130 Info << "Solving 6-DOF for " << names_[bodyI] << " in time"
131 << tab << "T = " << runTime_.value() << " s" << endl;
133 solvers_[bodyI].solve
136 runTime_.value() + runTime_.deltaT().value(),
138 runTime_.deltaT().value()
144 const Foam::wordList& Foam::sixDOFbodies::names() const
150 const Foam::PtrList<Foam::sixDOFqODE>& Foam::sixDOFbodies::operator()() const
156 // ************************************************************************* //