← Back to team overview

yade-users team mailing list archive

Re: [Question #632453]: Growing radius in randomDensePack

 

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

Jan Stránský posted a new comment:
Hi Xavier,
you can grow radius until they touch a surrounding particle

A specific implementation could be something like this (not tested):
#####################
class ParticleGrower:
   def __init__(self, particles, multiplier=1.05):
      self.particles = set(p.id for p in particles)
      self.multiplier = multiplier
   def go(self):
      self.check()
      self.grow()
   def check(self):
      for pid in self.particles:
         p = O.bodies[pid]
         intrs = p.intrs()
         if intrs: # nonzero overlap
            growParticle(p.id, 1./self.multiplier) # decrease particle back to non-overlapping configuration
            self.particles.discard(pid) # do not deal with this particle any more
   def grow(self):
      for pid in self.particles:
         growParticle(pid, self.multiplier)

aloneParticles = [...] # list of particles, that are alone and make problems
grower = ParticleGrower(particles)

O.engines = [
   ...
   PyRunner(iterPeriod=1,command='grower.go()')
]

while grower.particles:
   O.run(10,True):
   print len(grower.particles)
#####################

cheers
Jan

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