← Back to team overview

yade-users team mailing list archive

Re: [Question #701793]: Replace by clump

 

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

    Status: Open => Answered

Karol Brzezinski proposed the following answer:
Hi Fereshteh,

I think that you can just create another clump template and call replaceByClumps() again. 
Try whether it is the effect that you wanted to achieve:

############ Code
from yade import pack
sp=pack.SpherePack()
spSmall = pack.SpherePack()
spBig = pack.SpherePack()

sp.makeCloud((0,0,0),(1,1,1),psdSizes=[.001,.002,.078,.08],psdCumm=[0,.07,.71,1])

for ss in sp: #split SpherePack into two other packs based on the particle size
 r = ss[1]
 if r > .078/2:# please note that you feed diameters nor radii in psdSizes, that is why I divide it by 2
  spBig.add(ss[0],ss[1])

 else:
  spSmall.add(ss[0],ss[1])

# add only the spheres that you want to replace and replace them with clump1
spSmall.toSimulation()
ct1 = clumpTemplate([1,1],[[0,0,0],[0,0,1]])

O.bodies.replaceByClumps( [ct1] , [1], discretization = 20 )
#add the remaining spheres stored in the other sphere pack
spBig.toSimulation()
ct2 = clumpTemplate([1,1,1,1,1],[[0,0,0],[0,0,1],[-1,0,0],[0,1,0],[0,-1,0]])
O.bodies.replaceByClumps( [ct2] , [1], discretization = 20 )
########### end of code

Please note, that I didn't use your template, just another clump
uncomplicated clump template, to keep the example simple.

Cheers,
Karol

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