← Back to team overview

yade-users team mailing list archive

Re: [Question #265598]: mixing two different types of materials in a same pack

 

>
>
> yes, my materials are completely different, one of them is sand and the
> another one plastic grains.
>
>
ok, then you can create just one sp (with two makeCloud calls) and do
material assignment afterwards, something like:

from yade import pack
O.materials.append((FrictMat(young=1e9),FrictMat(young=3e9)))
mat1,mat2 = [O.materials[i] for i in (0,1)]
r1,r2 = 1.0,2.0
sp = pack.SpherePack()
maxCorner = (20,20,20)
sp.makeCloud(maxCorner=maxCorner,rMean=r1,num=20)
sp.makeCloud(maxCorner=maxCorner,rMean=r2,num=10)
sp.toSimulation()
bodies1 = [b for b in O.bodies if b.shape.radius==r1]
bodies2 = [b for b in O.bodies if b.shape.radius==r2]
for b in bodies1:
b.mat = mat1
b.shape.color = (1,0,0)
for b in bodies2:
b.mat = mat2
b.shape.color = (0,0,1)

cheers
Jan

Follow ups

References