Inertia Tensor for clumps with Intersecting Spheres

Asked by Bokkisa Srinivas Vivek on 2019-04-23

Hello community,

I was going through the Source code- Clump.cpp

The inertia tensor at local level for the intersecting spheres clump is calculated from the below equation (line no. 178):

Ig += m*(*Matrix3r::Identity()-x*x.transpose())+Matrix3r(Vector3r::Constant(dv*pow(dx,2)/6.).asDiagonal())

In the second part- "Matrix3r(Vector3r::Constant(dv*pow(dx,2)/6.).asDiagonal())",

I believe it should be m*pow(dx,2)/6 but instead it computes dv*pow(dx,2)/6, was it a mistake in code or done purposefully?


Thank you

Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Robert Caulk
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :

It looks like a mistake in the code. In fact, both terms were originally multiplied by dv. I think this commit [1] was aiming to fix it but only noticed the first term.

Can you confirm, Jan?


Revision history for this message
Jan Stránský (honzik) said :

good point, it looks like a mistake, definitely there should be m instead of dv..

2 points:
- the term tends to zero as discretization tends to infinity
- at the moment I have no idea why it is computed with respect to principal axes of the voxel, I **think** it should be computed with respect to global coordinate system..


Revision history for this message
Best Robert Caulk (rcaulk) said :

Thanks Bokkisa, I submitted the merge request for changing dv to m [1].


Revision history for this message
Bokkisa Srinivas Vivek (bsrinivasvivek) said :

Thanks Robert Caulk, that solved my question.

Revision history for this message
Bokkisa Srinivas Vivek (bsrinivasvivek) said :

Dear Jan, thanks for your confirmation.

I think inertia of all the voxels are calculated w.r.t Global Coordinate System (GCS) only. Using parallel axis theorem inertia at principal axis of voxel is translated to GCS. (Line 178)

After computing the centre of mass (C.O.M) of the clump, the inertia is translated again to the C.O.M. (Line 215)

Revision history for this message
Jan Stránský (honzik) said :

Yes, sorry, just ignore this part of my answer :-)