symplectic.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 | Copyright (C) 2015-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "symplectic.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace sixDoFSolvers
34 {
35  defineTypeNameAndDebug(symplectic, 0);
36  addToRunTimeSelectionTable(sixDoFSolver, symplectic, dictionary);
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const dictionary& dict,
47 )
48 :
49  sixDoFSolver(body)
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
60 
62 (
63  bool firstIter,
64  const vector& fGlobal,
65  const vector& tauGlobal,
66  scalar deltaT,
67  scalar deltaT0
68 )
69 {
70  // First simplectic step:
71  // Half-step for linear and angular velocities
72  // Update position and orientation
73 
74  v() = tConstraints() & (v0() + aDamp()*0.5*deltaT0*a0());
75  pi() = rConstraints() & (pi0() + aDamp()*0.5*deltaT0*tau0());
76 
77  centreOfRotation() = centreOfRotation0() + deltaT*v();
78 
79  Tuple2<tensor, vector> Qpi = rotate(Q0(), pi(), deltaT);
80  Q() = Qpi.first();
81  pi() = rConstraints() & Qpi.second();
82 
83  // Update the linear acceleration and torque
84  updateAcceleration(fGlobal, tauGlobal);
85 
86  // Second simplectic step:
87  // Complete update of linear and angular velocities
88 
89  v() += tConstraints() & aDamp()*0.5*deltaT*a();
90  pi() += rConstraints() & aDamp()*0.5*deltaT*tau();
91 }
92 
93 
94 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
virtual ~symplectic()
Destructor.
Definition: symplectic.C:55
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:66
const Type1 & first() const
Return first.
Definition: Tuple2.H:94
defineTypeNameAndDebug(CrankNicolson, 0)
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Drag coefficient.
Definition: symplectic.C:62
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable(sixDoFSolver, CrankNicolson, dictionary)
symplectic(const dictionary &dict, sixDoFRigidBodyMotion &body)
Construct from a dictionary and the body.
Definition: symplectic.C:44
const dimensionedScalar a0
Bohr radius: default SI units: [m].
const Type2 & second() const
Return second.
Definition: Tuple2.H:106
Namespace for OpenFOAM.