← Back to team overview

yade-users team mailing list archive

Re: [Question #661749]: Number of neighbouring sphere particles

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hi John,
it pretty much depends on the definition of " immediate neighbours (or neighbours within a distance)". Below there is a simple script counting with distance of centers (regardless particle size)
cheers
Jan

##############################
dist = 3.5 # distance to find "neighbors"

# creates bodies
bodies = (
   sphere(( 0,0,0),1),
   sphere((+5,0,0),1),
   sphere((-3,0,0),1),
)
O.bodies.append(bodies)

# save bodies to SpherePack
sp = SpherePack()
sp.fromSimulation()

# use the data in a separate simulation
O.switchScene()
sp.toSimulation()
for b in O.bodies:
   b.shape.radius = .5*dist
O.dt = 0.
O.engines = [
   InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=0.),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()],
   )
]
O.step() # create interactions
print len(O.bodies[0].intrs()) # number of interactions (neighbors) [1]

O.switchScene() # return back to original simulation
##############################

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Body.intrs

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