determining contacts with getBodyIdsContacts() ?

Asked by Johannes Welsch on 2019-02-01

Hi,

I am new to Yade, and I have a question concerning the determination of contacts of particles.
I want to calculate the coordination number of a binary packing. One for the bigger particles and one for the smaller particles. My idea was to use getBodyIdsContacts() of each particle and to use len(getBodyIdsContacts()) as the number of contacts, with which I can calculate the Coordination Number.

As an easy example I am using two spheres to tryout the functions.
I am creating two spheres with a radius of 0.5, so the distance in case of a contact should be 1.0 or less.
I am using getBodyIdsContacts() to print a list of contacting bodies, the simulation stops when there is a contact of the two spheres. I am also printing the force acting between the two spheres.

The problem is, that getBodyIdsContacts() shows a contact of the particles, although there is no force between them and the distance of the particles assumes that there is no contact (d = 1.024). Can you give me some hints how to solve the problem, or which other function I can use to determine the number of contacts of a particles.

kind regards
Johannes Welsch

example:

O.bodies.append([
   sphere(center=(0,0,0),radius=.5,fixed=True),
   sphere((0,0,1.5),radius=.5),
   ])

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
   ),

   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1),
   PyRunner(command='PrintContacts()',iterPeriod=1),
]

O.dt=.5e-3*PWaveTimeStep()

def PrintContacts():

    contacts = utils.getBodyIdsContacts(1)

    if len(contacts) > 0:
        print "Position Partikel 1", O.bodies[1].state.pos
        print "Kontakte Partikel 1", utils.getBodyIdsContacts(1)
        print "Partikel 1",O.forces.f(1)

        O.pause()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Robert Caulk
Solved:
2019-02-01
Last query:
2019-02-01
Last reply:
2019-02-01
Best Robert Caulk (rcaulk) said : #1

See [1]. The VIRTUAL interactions you mention are kept handy (for efficiency purposes?), but they do not participate in the simulation. You are right in wanting to exclude these from your coordination number calculation. As pointed out by [1]:

len(O.bodies[i].intrs())

returns a list of REAL interactions for that particular body.

[1]https://answers.launchpad.net/yade/+question/674901

Thanks Robert Caulk, that solved my question.