1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2009 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
26 Foam::sixDoFRigidBodyMotion
29 Six degree of freedom motion for a rigid body. Angular momentum stored in
30 body fixed reference frame. Reference orientation of the body must align
31 with the cartesian axes such that the Inertia tensor is in principle
34 Symplectic motion as per:
36 title = {Symplectic splitting methods for rigid body molecular dynamics},
39 journal = {The Journal of Chemical Physics},
43 url = {http://link.aip.org/link/?JCP/107/5840/1},
44 doi = {10.1063/1.474310}
47 sixDoFRigidBodyMotionI.H
48 sixDoFRigidBodyMotion.C
49 sixDoFRigidBodyMotionIO.C
51 \*---------------------------------------------------------------------------*/
53 #ifndef sixDoFRigidBodyMotion_H
54 #define sixDoFRigidBodyMotion_H
56 #include "sixDoFRigidBodyMotionState.H"
57 #include "pointField.H"
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 // Forward declaration of classes
68 // Forward declaration of friend functions and operators
69 class sixDoFRigidBodyMotion;
70 Istream& operator>>(Istream&, sixDoFRigidBodyMotion&);
71 Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&);
74 /*---------------------------------------------------------------------------*\
75 Class sixDoFRigidBodyMotion Declaration
76 \*---------------------------------------------------------------------------*/
78 class sixDoFRigidBodyMotion
83 sixDoFRigidBodyMotionState motionState_;
85 //- Centre of mass of reference state
86 point refCentreOfMass_;
88 //- Moment of inertia of the body in reference configuration
89 diagTensor momentOfInertia_;
95 // Private Member Functions
97 //- Calculate the rotation tensor around the body reference
98 // frame x-axis by the given angle
99 inline tensor rotationTensorX(scalar deltaT) const;
101 //- Calculate the rotation tensor around the body reference
102 // frame y-axis by the given angle
103 inline tensor rotationTensorY(scalar deltaT) const;
105 //- Calculate the rotation tensor around the body reference
106 // frame z-axis by the given angle
107 inline tensor rotationTensorZ(scalar deltaT) const;
115 sixDoFRigidBodyMotion();
117 //- Construct from components
118 sixDoFRigidBodyMotion
120 const point& centreOfMass,
127 const point& refCentreOfMass,
128 const diagTensor& momentOfInertia
131 //- Construct from dictionary
132 sixDoFRigidBodyMotion(const dictionary& dict);
134 //- Construct as copy
135 sixDoFRigidBodyMotion(const sixDoFRigidBodyMotion&);
139 ~sixDoFRigidBodyMotion();
151 const vector& fGlobal,
152 const vector& tauGlobal,
158 const pointField& positions,
159 const vectorField& forces,
163 tmp<pointField> generatePositions(const pointField& pts) const;
167 //- Return access to the motion state
168 inline const sixDoFRigidBodyMotionState& motionState() const;
170 //- Return access to the centre of mass
171 inline const point& centreOfMass() const;
173 //- Return access to the centre of mass
174 inline const point& refCentreOfMass() const;
176 //- Return access to the inertia tensor
177 inline const diagTensor& momentOfInertia() const;
179 //- Return access to the mass
180 inline scalar mass() const;
182 //- Return access to the orientation
183 inline const tensor& Q() const;
185 //- Return access to velocity
186 inline const vector& v() const;
188 //- Return access to acceleration
189 inline const vector& a() const;
191 //- Return access to angular momentum
192 inline const vector& pi() const;
194 //- Return access to torque
195 inline const vector& tau() const;
200 //- Return non-const access to the centre of mass
201 inline point& centreOfMass();
203 //- Return access to the centre of mass
204 inline point& refCentreOfMass();
206 //- Return non-const access to the inertia tensor
207 inline diagTensor& momentOfInertia();
209 //- Return non-const access to the mass
210 inline scalar& mass();
212 //- Return non-const access to the orientation
215 //- Return non-const access to vector
218 //- Return non-const access to acceleration
221 //- Return non-const access to angular momentum
224 //- Return non-const access to torque
225 inline vector& tau();
229 void write(Ostream&) const;
232 // IOstream Operators
234 friend Istream& operator>>(Istream&, sixDoFRigidBodyMotion&);
235 friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&);
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 } // End namespace Foam
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 #include "sixDoFRigidBodyMotionI.H"
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 // ************************************************************************* //