Clump inertia and orientation

Asked by Karol Brzezinski

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

[1] https://answers.launchpad.net/yade/+question/698572
[2] https://answers.launchpad.net/yade/+question/274324

# ------------------------------------------------------------------------------------------------------------------------------- YADE SCRIPT
from math import *
from yade import *
from yade import utils, geom
from yade import plot
# ---------------------------------------------------------------------------------- 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),
]

# ---------------------------------------------------------------------------------- additional engines
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)

def addPlotData():
 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 information about clumps
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)

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Best Jan Stránský (honzik) said :
#1

Hi Karol,

What version of Yade you are using?
I am using Ubuntu 18.04.
Concerning problem 1, I had the same problem with (wrong) same orientation for Yade 2018.02b and 2020-06-23.git-f03a37c.
However, I got expected different orientations for yadedaily 20210813-5683~749bba8~bionic1

Also, using yadedaily I could not reproduce the problem 2 - different periods. In my case, the two pendulums are oscilating exactly same, both with T=3.4 s
The other Yade versions did have the problem.

Cheers
Jan

Revision history for this message
Jan Stránský (honzik) said (last edit ):
#2
Revision history for this message
Karol Brzezinski (kbrzezinski) said :
#3

Hi Jan,

thank you for quick response. I am using yade 2020.01a on Ubuntu 20.04. I don't know why I didn't use yadedaily before.

On yadedaily everything works fine: clumps have different orientations and pendulums show identical dynamic behavior.

Thank you for your time!

Cheers,
Karol

Revision history for this message
Karol Brzezinski (kbrzezinski) said :
#4

Thanks Jan Stránský, that solved my question.