← 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,

you can achieve this by splitting a sphere pack into two separate packs.
First, load only the spheres that you want to replace with clumps. After
you replace them, load the remaining spheres.

######################## MWE
from yade import pack
sp=pack.SpherePack()
spSpheres = pack.SpherePack()
spClumps = 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
		spClumps.add(ss[0],ss[1])
		
	else:
		spSpheres.add(ss[0],ss[1])

# add only the spheres that you want to replace and replace them with clumps		
spClumps.toSimulation()
ct = clumpTemplate([1,1],[[0,0,0],[0,0,1]])
O.bodies.replaceByClumps( [ct] , [1], discretization = 20 )
#add the remaining spheres stored in the other sphere pack
spSpheres.toSimulation()
#################### end of MWE

Cheers,
Karol

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