← Back to team overview

yade-users team mailing list archive

Re: [Question #679387]: packing of spheres with different properties

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

with one material it is easy:
###
sp = yade.pack.SpherePack()
min,max = (0,0,0),(10,10,10)
sp.makeCloud(min,max,rMean=1,rRelFuzz=.1,num=20)  # 1st set
sp.makeCloud(min,max,rMean=.4,rRelFuzz=.2,num=50) # 2nd set
sp.toSimulation() # you can use sp.toSimulation(material=...)
###

sp just stores centers and radii and you can set material to all spheres at toSimulation time. To have two materials, you can do something like:
###
mat1 = FrictMat() # maybe O.materials.append(...)
mat2 = CohFrictMat()
sp = yade.pack.SpherePack()
min,max = (0,0,0),(10,10,10)
n1 = sp.makeCloud(min,max,rMean=1,rRelFuzz=.1,num=20)  # makeCloud returns number of created particles
n2 = sp.makeCloud(min,max,rMean=.4,rRelFuzz=.2,num=50) # --//--
sp.toSimulation() # no material needded
# set material of spheres with ids from 0 to n1 (the 1st makeCloud)
for i in range(0,n1): 
   O.bodies[i].mat = mat1
# set material of spheres with ids from n1 to n2 (the 2nd makeCloud)
for i in range(n1,n2):
   O.bodies[i].mat = mat2
# check
for b in O.bodies:
   print b.id,b.mat
###

cheers
Jan

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