1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 Foam::sixDoFRigidBodyMotion::rotationTensorX(scalar phi) const
34 0, Foam::cos(phi), -Foam::sin(phi),
35 0, Foam::sin(phi), Foam::cos(phi)
41 Foam::sixDoFRigidBodyMotion::rotationTensorY(scalar phi) const
45 Foam::cos(phi), 0, Foam::sin(phi),
47 -Foam::sin(phi), 0, Foam::cos(phi)
53 Foam::sixDoFRigidBodyMotion::rotationTensorZ(scalar phi) const
57 Foam::cos(phi), -Foam::sin(phi), 0,
58 Foam::sin(phi), Foam::cos(phi), 0,
64 inline void Foam::sixDoFRigidBodyMotion::rotate
73 R = rotationTensorX(0.5*deltaT*pi.x()/momentOfInertia_.xx());
77 R = rotationTensorY(0.5*deltaT*pi.y()/momentOfInertia_.yy());
81 R = rotationTensorZ(deltaT*pi.z()/momentOfInertia_.zz());
85 R = rotationTensorY(0.5*deltaT*pi.y()/momentOfInertia_.yy());
89 R = rotationTensorX(0.5*deltaT*pi.x()/momentOfInertia_.xx());
95 inline const Foam::sixDoFRigidBodyMotionState&
96 Foam::sixDoFRigidBodyMotion::motionState() const
102 inline const Foam::PtrList<Foam::sixDoFRigidBodyMotionRestraint>&
103 Foam::sixDoFRigidBodyMotion::restraints() const
109 inline const Foam::wordList& Foam::sixDoFRigidBodyMotion::restraintNames() const
111 return restraintNames_;
115 inline const Foam::PtrList<Foam::sixDoFRigidBodyMotionConstraint>&
116 Foam::sixDoFRigidBodyMotion::constraints() const
122 inline const Foam::wordList&
123 Foam::sixDoFRigidBodyMotion::constraintNames() const
125 return constraintNames_;
129 inline Foam::label Foam::sixDoFRigidBodyMotion::maxConstraintIterations() const
131 return maxConstraintIterations_;
135 inline const Foam::point&
136 Foam::sixDoFRigidBodyMotion::initialCentreOfMass() const
138 return initialCentreOfMass_;
142 inline const Foam::tensor&
143 Foam::sixDoFRigidBodyMotion::initialQ() const
149 inline const Foam::tensor& Foam::sixDoFRigidBodyMotion::Q() const
151 return motionState_.Q();
155 inline const Foam::vector& Foam::sixDoFRigidBodyMotion::v() const
157 return motionState_.v();
161 inline const Foam::vector& Foam::sixDoFRigidBodyMotion::a() const
163 return motionState_.a();
167 inline const Foam::vector& Foam::sixDoFRigidBodyMotion::pi() const
169 return motionState_.pi();
173 inline const Foam::vector& Foam::sixDoFRigidBodyMotion::tau() const
175 return motionState_.tau();
179 inline Foam::point& Foam::sixDoFRigidBodyMotion::initialCentreOfMass()
181 return initialCentreOfMass_;
185 inline Foam::tensor& Foam::sixDoFRigidBodyMotion::initialQ()
191 inline Foam::tensor& Foam::sixDoFRigidBodyMotion::Q()
193 return motionState_.Q();
197 inline Foam::vector& Foam::sixDoFRigidBodyMotion::v()
199 return motionState_.v();
203 inline Foam::vector& Foam::sixDoFRigidBodyMotion::a()
205 return motionState_.a();
209 inline Foam::vector& Foam::sixDoFRigidBodyMotion::pi()
211 return motionState_.pi();
215 inline Foam::vector& Foam::sixDoFRigidBodyMotion::tau()
217 return motionState_.tau();
221 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
223 inline Foam::tmp<Foam::pointField>
224 Foam::sixDoFRigidBodyMotion::currentPosition(const pointField& pInitial) const
229 + (Q() & initialQ_.T() & (pInitial - initialCentreOfMass_)))
234 inline Foam::point Foam::sixDoFRigidBodyMotion::currentPosition
236 const point& pInitial
242 + (Q() & initialQ_.T() & (pInitial - initialCentreOfMass_))
247 inline Foam::vector Foam::sixDoFRigidBodyMotion::currentOrientation
249 const vector& vInitial
252 return (Q() & initialQ_.T() & vInitial);
256 inline const Foam::tensor&
257 Foam::sixDoFRigidBodyMotion::orientation() const
263 inline Foam::vector Foam::sixDoFRigidBodyMotion::omega() const
265 return Q() & (inv(momentOfInertia_) & pi());
269 inline Foam::point Foam::sixDoFRigidBodyMotion::currentVelocity
274 return (omega() ^ (pt - centreOfMass())) + v();
278 inline const Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass() const
280 return motionState_.centreOfMass();
284 inline const Foam::diagTensor&
285 Foam::sixDoFRigidBodyMotion::momentOfInertia() const
287 return momentOfInertia_;
291 inline Foam::scalar Foam::sixDoFRigidBodyMotion::mass() const
297 inline bool Foam::sixDoFRigidBodyMotion::report() const
303 inline Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass()
305 return motionState_.centreOfMass();
309 inline Foam::diagTensor& Foam::sixDoFRigidBodyMotion::momentOfInertia()
311 return momentOfInertia_;
315 inline Foam::scalar& Foam::sixDoFRigidBodyMotion::mass()
320 // ************************************************************************* //