# yade-users team mailing list archive

## [Question #698635]: Clump inertia and orientation

Hi,

while seeking for solution to Rohit John's problem [1], I got confused by inertia and orientation of clumps. I have found a discussion [2] explaining that:
> inertia is defined in the space of principal axes
> The orientation is internally stored as a quaternion

I modified John's code [1] where he uses eccentricAxisEngine() to pin one of the clumps spheres to create a clump pendulum. The weird thing is that behavior of this pendulum depends on its orientation. To visualize this problem I create two clumps. The first one is aligned along the y axis and oscillates in y-z plane. The second one is aligned along x axis and oscillates in x-z plane.

Two observations are odd:
1) For both clumps inertia and orientation are the same. If I understand the convention properly, the orientations should be different ( Quaternion((0,1,0),0) in case of the first clump? )
2) The two pendulums have different periods of oscillations - the one that is x axis aligned move slower (T=3.4s) while the y axis aligned pendulum has period T=2.5s.

I think that may be a potential bug, but I would like to confirm this first.

Cheers,
Karol

from math import *
# ---------------------------------------------------------------------------------- bodies
sph1 = sphere((0, 2, 0), radius=.5)
sph2 = sphere(center=(0, 0, 0), radius=.5)

sph3 = sphere((2, 5, 0), radius=.5)
sph4 = sphere(center=(0, 5, 0), radius=.5)

sph1_id = O.bodies.append(sph1)
sph2_id = O.bodies.append(sph2)

sph3_id = O.bodies.append(sph3)
sph4_id = O.bodies.append(sph4)

g = Vector3([0,0,-10])
stiffnes = 1e7

# ---------------------------------------------------------------- clumps
clump1_id = O.bodies.clump([sph1_id, sph2_id])
clump2_id = O.bodies.clump([sph3_id, sph4_id])
# ---------------------------------------------------------------------------------- engines
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()], # collision geometry
[Ip2_FrictMat_FrictMat_FrictPhys()], # collision "physics"
[Law2_ScGeom_FrictPhys_CundallStrack()] # contact law -- apply forces
),
PyRunner(command = "eccentricAxisEngine()", iterPeriod = 1),
PyRunner(command = "addPlotData()", iterPeriod = 100),
NewtonIntegrator(gravity=g, damping=0.0),
]

def eccentricAxisEngine():
pos_01 = O.bodies[sph2_id].state.pos# anchor clump 1
pos_02 = O.bodies[sph4_id].state.pos# anchor clump 2
force1 = -stiffnes*pos_01
force2 = -stiffnes*(pos_02-Vector3(0,5,0))
O.forces.addF(id = sph2_id, f = force1)
O.forces.addF(id = sph4_id, f = force2)

h1 = O.bodies[sph1_id].state.pos[2]
h2 = O.bodies[sph3_id].state.pos[2]

plot.addData(t = O.time, m1_height = h1, m2_height = h2)

# ---------------------------------------------------------------------------------- sim setup
O.dt = .5e-2 * PWaveTimeStep()
#

plot.plots={'t':('m1_height','m2_height')}
plot.plot(subPlots =False)

print("*************** ORIENTATION OF CLUMP NO 1 ***************")
print(O.bodies[clump1_id].state.se3[1])
print("*************** ORIENTATION OF CLUMP NO 2 ***************")
print(O.bodies[clump2_id].state.se3[1])

print("*************** INERTIA OF CLUMP NO 1 ***************")
print(O.bodies[clump1_id].state.inertia)
print("*************** INERTIA OF CLUMP NO 2 ***************")
print(O.bodies[clump2_id].state.inertia)

--