rigidBodyDynamics: Added rotating joint
This joint allows two bodies to rotate relative to each other at a
specified speed. The relative motion is completely specified, so this
joint has zero degrees of freedom.
It could be used, for example, to attach a rotating propeller to a
moving ship:
bodies
{
hull
{
...
}
propeller
{
type rigidBody;
// Dynamic properties
mass ...;
centreOfMass ...;
inertia ...;
// The propeller is connected to the hull
parent hull;
// The position relative to the hull
transform (1 0 0 0 1 0 0 0 1) (20 0 0);
// Rotation settings
joint
{
type rotating;
omega (6 0 0);
}
}
}
This commit is contained in:
59
applications/test/rigidBodyDynamics/doublePendulumAndRotor
Normal file
59
applications/test/rigidBodyDynamics/doublePendulumAndRotor
Normal file
@ -0,0 +1,59 @@
|
||||
solver
|
||||
{
|
||||
type symplectic;
|
||||
}
|
||||
|
||||
bodies
|
||||
{
|
||||
bar1
|
||||
{
|
||||
type rigidBody;
|
||||
mass 3;
|
||||
centreOfMass (0 -0.5 0);
|
||||
inertia (0.2575 0 0 0.015 0 0.2575);
|
||||
parent root;
|
||||
transform (1 0 0 0 1 0 0 0 1) (0 0 0);
|
||||
joint
|
||||
{
|
||||
type Rz;
|
||||
}
|
||||
outline ((0 0 0) (0 -1 0));
|
||||
}
|
||||
bar2
|
||||
{
|
||||
type rigidBody;
|
||||
mass 3;
|
||||
centreOfMass (0 -0.5 0);
|
||||
inertia (0.2575 0 0 0.015 0 0.2575);
|
||||
parent bar1;
|
||||
transform (1 0 0 0 1 0 0 0 1) (0 -1 0);
|
||||
joint
|
||||
{
|
||||
type Rz;
|
||||
}
|
||||
outline ((0 0 0) (0 -1 0));
|
||||
}
|
||||
rotor
|
||||
{
|
||||
type rigidBody;
|
||||
mass 3;
|
||||
centreOfMass (0 -0.5 0);
|
||||
inertia (0.2575 0 0 0.015 0 0.2575);
|
||||
parent bar2;
|
||||
transform (1 0 0 0 1 0 0 0 1) (0 -1 0);
|
||||
joint
|
||||
{
|
||||
type rotating;
|
||||
omega (0 0 1);
|
||||
}
|
||||
outline ((0 0 0) (0 -1 0));
|
||||
}
|
||||
}
|
||||
|
||||
g (0 -9.81 0);
|
||||
|
||||
q (1.5707963267948966 0 0);
|
||||
|
||||
deltaT 0.01;
|
||||
|
||||
endTime 20;
|
||||
@ -27,6 +27,7 @@ joints/Pa/Pa.C
|
||||
joints/Pxyz/Pxyz.C
|
||||
|
||||
joints/rigid/rigid.C
|
||||
joints/rotating/rotating.C
|
||||
joints/function/function.C
|
||||
joints/functionDot/functionDot.C
|
||||
|
||||
|
||||
106
src/rigidBodyDynamics/joints/rotating/rotating.C
Normal file
106
src/rigidBodyDynamics/joints/rotating/rotating.C
Normal file
@ -0,0 +1,106 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "rotating.H"
|
||||
#include "rigidBodyModelState.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RBD
|
||||
{
|
||||
namespace joints
|
||||
{
|
||||
defineTypeNameAndDebug(rotating, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
joint,
|
||||
rotating,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::RBD::joints::rotating::rotating
|
||||
(
|
||||
const rigidBodyModel& model,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
joint(model, 0),
|
||||
omega_(Function1<vector>::New("omega", dict))
|
||||
{}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::RBD::joint> Foam::RBD::joints::rotating::clone() const
|
||||
{
|
||||
return autoPtr<joint>(new rotating(*this));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::RBD::joints::rotating::~rotating()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::RBD::joints::rotating::jcalc
|
||||
(
|
||||
joint::XSvc& J,
|
||||
const rigidBodyModelState& state
|
||||
) const
|
||||
{
|
||||
const scalar t = state.t(), deltaT = state.deltaT();
|
||||
|
||||
if (t < vSmall || deltaT < vSmall)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const vector omega = omega_->value(t);
|
||||
const vector omegaDot = (omega - omega_->value(t - deltaT))/deltaT;
|
||||
const vector theta = omega_->integral(0, t);
|
||||
const scalar magTheta = mag(theta);
|
||||
const tensor R =
|
||||
magTheta > vSmall ? quaternion(theta, magTheta).R() : tensor::I;
|
||||
|
||||
J.X = spatialTransform(R, Zero);
|
||||
J.S = Zero;
|
||||
J.S1 = Zero;
|
||||
J.v = spatialVector(omega, Zero);
|
||||
J.c = - spatialVector(omegaDot, Zero);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
114
src/rigidBodyDynamics/joints/rotating/rotating.H
Normal file
114
src/rigidBodyDynamics/joints/rotating/rotating.H
Normal file
@ -0,0 +1,114 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::RBD::joints::rotating
|
||||
|
||||
Description
|
||||
Joint with a specified rotational speed
|
||||
|
||||
Reference:
|
||||
\verbatim
|
||||
Featherstone, R. (2008).
|
||||
Rigid body dynamics algorithms.
|
||||
Springer.
|
||||
Chapter 4.
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
rotating.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RBD_joints_rotating_H
|
||||
#define RBD_joints_rotating_H
|
||||
|
||||
#include "joint.H"
|
||||
#include "Function1.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RBD
|
||||
{
|
||||
namespace joints
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class rotating Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class rotating
|
||||
:
|
||||
public joint
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Rotation vector function
|
||||
autoPtr<Function1<vector>> omega_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("rotating");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given model from dictionary
|
||||
rotating(const rigidBodyModel& model, const dictionary& dict);
|
||||
|
||||
//- Clone this joint
|
||||
virtual autoPtr<joint> clone() const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~rotating();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update the model state for this joint
|
||||
virtual void jcalc
|
||||
(
|
||||
joint::XSvc& J,
|
||||
const rigidBodyModelState& state
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace joints
|
||||
} // End namespace RBD
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user