← Back to team overview

yade-users team mailing list archive

Re: [Question #678263]: determining contacts with getBodyIdsContacts() ?

 

Question #678263 on Yade changed:
https://answers.launchpad.net/yade/+question/678263

Description changed to:
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()

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.