symplectic.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2015-2024 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 {
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 symplectic 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 symplectic 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 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:66
const Type2 & second() const
Return second.
Definition: Tuple2.H:131
const Type1 & first() const
Return first.
Definition: Tuple2.H:119
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Six degree of freedom motion for a rigid body.
Symplectic 2nd-order explicit time-integrator for 6DoF solid-body motion.
Definition: symplectic.H:77
virtual ~symplectic()
Destructor.
Definition: symplectic.C:55
symplectic(const dictionary &dict, sixDoFRigidBodyMotion &body)
Construct from a dictionary and the body.
Definition: symplectic.C:44
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Drag coefficient.
Definition: symplectic.C:62
const dimensionedScalar a0
Bohr radius: default SI units: [m].
addToRunTimeSelectionTable(sixDoFSolver, CrankNicolson, dictionary)
defineTypeNameAndDebug(CrankNicolson, 0)
Namespace for OpenFOAM.
dictionary dict