Introduction Exploring the library Demonstration
A rigidBodyDynamics Tutorialfor the course
CFD with OpenSource Software
Navdeep Kumar
Marine Technology/Naval Architecture,Chalmers University of Technology,
Gothenburg, Sweden
2016-12-05
Navdeep Kumar 2016-12-05 1 / 25
Introduction Exploring the library Demonstration
Sequence
The algorithm used in library is discussed
Implementation of the algorithm is discussed
Options in the library is explored
Two cases are demonstrated
Navdeep Kumar 2016-12-05 2 / 25
Introduction Exploring the library Demonstration
Introduction
New library added in OpenFoam4xUsed for solving rigid body dynamics problemsMost useful in the field of roboticsDeveloped for Carnegie wave energy
Figure: Illustrative figure of multi body system
Navdeep Kumar 2016-12-05 3 / 25
Introduction Exploring the library Demonstration
Mathematical Background
Equation of motion of a rigid body system can be written as:
H(q)q̈ + C(q, q̇) = τ
Based on the input two outputs are possible:
q̈ = FD(model, q, q̇, τ)
τ = ID(model, q, q̇, q̈)
Navdeep Kumar 2016-12-05 4 / 25
Introduction Exploring the library Demonstration
Mathematical Background
Figure: n link system with base
Uses Articulated body algorithm
Complexity of order n
Navdeep Kumar 2016-12-05 5 / 25
Introduction Exploring the library Demonstration
Mathematical Background
Figure: Defining articulated bodies
Divided into three passes
First pass calculates absolute velocities and bias forces
Second pass calculates articulated body inertia
Third pass calculates joint accelerations
Navdeep Kumar 2016-12-05 6 / 25
Introduction Exploring the library Demonstration
Implementation of the Algorithm
The model is created using rigidBodyModel
solver rigidBodyMotion is used
forwardDynamics is implemented
Articulated body algorithm is implemented here
rigidBodySolver is implemented
forwardDynamicsCorrection is implemented
rigidBodyModel is updated for the next time step
Navdeep Kumar 2016-12-05 7 / 25
Introduction Exploring the library Demonstration
Library options
The three main things are:
Bodies
CuboidSphererigidBodymasslessBodyjointBody
Joints
Restraints
Navdeep Kumar 2016-12-05 8 / 25
Introduction Exploring the library Demonstration
BodiesCuboid:
floatingObject
{
type cuboid;
parent root;
// Cuboid dimensions
Lx 0.3;
Ly 0.2;
Lz 0.5;
// Density of the cuboid
rho 500;
// Cuboid mass
mass #calc "$rho*$Lx*$Ly*$Lz";
L ($Lx $Ly $Lz);
centreOfMass (1.5 1.5 1.5);
}
Rigid Body:
floatingObject
{
type rigidBody;
parent root;
// Cuboid properties
mass 15;
centreOfMass (0 0 0.25);
inertia (0.3625 0 0
0.425 0 0.1625);
patches (floatingObject);
}
Navdeep Kumar 2016-12-05 9 / 25
Introduction Exploring the library Demonstration
Bodies-Merging optionPendulum
bodies
{
hinge
{
type masslessBody;
parent root;
transform (1 0 0 0 1 0 0 0 1) (0 0 0);
joint
{type Rz;}
}
weight
{type sphere;
mass 1;
centreOfMass (0 -1 0);
radius 0.05;
transform (1 0 0 0 1 0 0 0 1) (0 -1 0);
mergeWith hinge;}
Navdeep Kumar 2016-12-05 10 / 25
Introduction Exploring the library Demonstration
Joints
Three types of joints:
Prismatic
Revolute
Spherical
Navdeep Kumar 2016-12-05 11 / 25
Introduction Exploring the library Demonstration
Joints
Prismatic:
Px
Py
Pz
Pa
Revolute:
Rx
Ry
Rz
Ra
Spherical:
Rxyz
Ryxz
Rzyx
Arbitrary axis:
Pa is translation about arbitraryaxis
Ra is rotation about arbitraryaxis
Navdeep Kumar 2016-12-05 12 / 25
Introduction Exploring the library Demonstration
Restraints
linearAxialAngularSpring
restraints
{
torsionalspring
{
body floatingObject;
type linearAxialAngularSpring;
axis (1.0 2.0 3.0);
referenceOrientation (1 0 0 1 0 0 1 0 0);
stiffness 100;
damping 0;
}
}
Navdeep Kumar 2016-12-05 13 / 25
Introduction Exploring the library Demonstration
Restraints
sphericalAngularDamper
restraints
{
torsionalspring
{
body floatingObject;
type sphericalAngularDamper;
coeff 10;
}
}
Linear damper restraint is similarto spherical angular damper
Linear spring is shown later
Navdeep Kumar 2016-12-05 14 / 25
Introduction Exploring the library Demonstration
Floating Sphere
OF4x
cp -r $FOAM_TUTORIALS/multiphase/interDyMFoam/ras/
floatingObject $FOAM_RUN
cd $FOAM_RUN
mv floatingObject floatingObjectSphere
cd floatingObjectSphere
Navdeep Kumar 2016-12-05 15 / 25
Introduction Exploring the library Demonstration
Floating Sphere
vertices
( (0 0 0)
(3 0 0)
(3 3 0)
(0 3 0)
(0 0 3)
(3 0 3)
(3 3 3)
(0 3 3)
);
blocks
(
hex (0 1 2 3 4 5 6 7)
(50 50 50)
simpleGrading (1 1 1)
);
topoSetDict:
actions
(
{
name c0;
type cellSet;
action new;
source sphereToCell;//changed
sourceInfo
{
centre (1.5 1.5 1.5);
radius 0.3;}
Navdeep Kumar 2016-12-05 16 / 25
Introduction Exploring the library Demonstration
Floating Sphere
dynamicMeshDict:
bodies
{floatingObject
{type sphere;//changed
parent root;
// sphere dimensions
radius 0.3;//changed
// Density of the sphere
rho 500;
// sphere mass
mass #calc "$rho*4/3*3.14*
$radius*$radius*$radius";
centreOfMass (1.5 1.5 1.5);
transform (1 0 0 0 1 0 0 0 1)
(0.5 0.45 0.1);
joint
{
type composite;
joints
(
{
type Py;
}
{
type Ry;
}
);
}
patches (floatingObject);
innerDistance 0.05;
outerDistance 0.35;
}
}
Navdeep Kumar 2016-12-05 17 / 25
Introduction Exploring the library Demonstration
Floating Sphere
Allrun
runApplication blockMesh
runApplication topoSet
runApplication subsetMesh -overwrite c0 -patch floatingObject
cp -r 0.orig 0 > /dev/null 2>&1
runApplication setFields
runApplication $application
Navdeep Kumar 2016-12-05 18 / 25
Introduction Exploring the library Demonstration
Two bodies
OF4x
run
cp -r floatingObjectSphere floatingObjectwobody&
cd floatingObjectwobody
vi system/blockMeshDict
Navdeep Kumar 2016-12-05 19 / 25
Introduction Exploring the library Demonstration
Two bodies
blockMeshDict:
body1
{
type wall;
faces ();
}
body2
{
type wall;
faces ();
}
toposetDict:
{
name c1;
type cellSet;
action new;
source boxToCell;//changed
sourceInfo
{
box (0.85 1.4 1.2) (1.15 1.6 1.7);
}
}
Navdeep Kumar 2016-12-05 20 / 25
Introduction Exploring the library Demonstration
Two bodies
dynamicMeshDict
bodies
{
body1
{
dimension and mass properties
joint
{type Pz;}
patches (floatingObject1);
innerDistance 0.05;
outerDistance 0.35;
}
body2
{properties
}
restraints //added
{
verticalspring1
{
body body1;
type linearSpring;
anchor (0.6 1.05 0);
refAttachmentPt (0.6 1.05 1.2);
stiffness 100;
damping 0;
restLength 0.1;
}
verticalspring2
{properties
}
Navdeep Kumar 2016-12-05 21 / 25
Introduction Exploring the library Demonstration
Two bodies
Allrun
runApplication blockMesh
topoSet -dict system/topoSetDict1
subsetMesh -overwrite c1 -patch body1
topoSet -dict system/topoSetDict2
subsetMesh -overwrite c2 -patch body2
cp -r 0.orig 0 > /dev/null 2>&1
runApplication setFields
runApplication $application
Navdeep Kumar 2016-12-05 22 / 25
Introduction Exploring the library Demonstration
Conclusions
Easier to insert bodies and joints
Can simulate multiple body system
The algorithm is of least possible order
More options than sixDof library
Navdeep Kumar 2016-12-05 23 / 25
Introduction Exploring the library Demonstration
Future Work
Floating sphere could be improved
Figure: Sphere
Simulate some more cases for better demonstration
Navdeep Kumar 2016-12-05 24 / 25
Introduction Exploring the library Demonstration
Questions
ThankYou
Navdeep Kumar 2016-12-05 25 / 25