replacing particles with pack.incilynder

Asked by Leticia Morais

Hello everybody,

what I am trying to do is to agglomerate example (https://github.com/yade/trunk/tree/master/examples/agglomerate), but instead of dividing the sphere of makecloud, i want to replace then with an cylinder agglomerates with a hole inside as:

pack.inCylinder((0.0,0.0,0.0),(0.0,0.0,0.05),0.05)-pack.inCylinder((0.0,0.0,0.0),(0.0,0.0,0.05),0.01)
s

but I am not succeeding in it. My script is:

from yade import export,ymport

dim = (1,1,1) # dimensions for makeCloud
radius = 0.05

sp = pack.SpherePack()
sp.makeCloud((0.,0.,0.), dim, rMean=radius, seed=1)
sp.toSimulation()

for s in sp:
 cil=pack.inCylinder((s[0][0],s[0][1],s[0][2]),(s[0][0],s[0][1],s[0][2]+0.05),s[1])-pack.inCylinder((s[0][0],s[0][1],s[0][2]),(s[0][0],s[0][1],s[0][2]+0.05),0.01)
 sp1=pack.randomDensePack(cil,radius=0.01, returnSpherePack=True)

I am not sure if i can do that, I am sorry but I am still learning yade. I have seen question #403360 (https://answers.launchpad.net/yade/+question/403360) and I couldn't use it to solve my problem.

Is there another way of replacing the sphere by the pack? Can I use regularHexa instead of randomdensePack?

hope you can solve my problem.
thanks a lot

Leticia

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Leticia Morais
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> but I am not succeeding in it

please always try to be more specific.. like "I got this error", "The resulting packing does not look like what I want"...

> Can I use regularHexa instead of randomdensePack?

yes, sure

concerning examples/agglomerate, you can just change the inSphere part in divide.py to something like below. Change the values labeled by TODO according to your needs.

######
...
for si,s in enumerate(sp):
   radius = s.shape.radius * sqrt(2) # TODO
   heightHelf = s.shape.radius * sqrt(2) # TODO # sqrt(r^2+hh^2) should be <= s.shape.radius
   radius2 = .2*radius # TODO
   vecHalfH = Vector3(0,0,heightHelf) # TODO random direction?
   bot = s.state.pos - vecHalfH
   top = s.state.pos + vecHalfH
   cyl = pack.inCylinder(bot,top,radius) - pack.inCylinder(bot,top,radius2)
   sp1 = pack.randomDensePack(
      cyl,
      ...
   )
   ...
######

cheers
Jan

Revision history for this message
Leticia Morais (l.morais) said :
#2

Thanks Jan.
That solved my question.

Cheers
Leticia