← Back to team overview

yade-users team mailing list archive

[Question #698541]: Material of particle changed in the repeated cell

 

New question #698541 on Yade:
https://answers.launchpad.net/yade/+question/698541

Hi,

I'd like to ask that why the material of particle changed in the repeated cell. I have two types of particles (material 1 and 2, respectively) in a cell, and after I repeated the cell by using cellRepeat function, all the particles in the repeated cells are changed into material 2. 

The MWE below may show my question. If you run the MWE, you will see that all the material Ids are 1, but I expect to have two types of materials.
##################
from yade import pack
O.periodic=True
#### define material, two materials are used for 2 type of particles
Mat1 = O.materials.append(FrictMat(young=2e6,poisson=0.3,frictionAngle=radians(30),label='mat1'))
Mat2 = O.materials.append(FrictMat(young=2e6,poisson=0.3,frictionAngle=radians(30),label='mat2'))
######## particles with Mat1
sp1=pack.SpherePack()
sp1.makeCloud((0,0,0),(5,5,5),rMean=.5,rRelFuzz=.5,periodic=True,num=5)
sp1.toSimulation(color=(0,0,1),material='mat1')
######## particles with Mat2
sp2=pack.SpherePack()
sp2.makeCloud((0,0,0),(5,5,5),rMean=.05,rRelFuzz=.0,periodic=True,num=5)
sp2.toSimulation(color=[1,0,0],material='mat2')
#### store all the ids of particles from sp1 and sp2, they will be deleted after repeat cell.
idIn1stCell=[]
for i in O.bodies:
	idIn1stCell.append(i.id)
## repeat cell
sp=pack.SpherePack()
sp.fromSimulation()
sp.cellRepeat((1, 3, 1))
sp.toSimulation(color=[1,1,1])
## remove the original particles in the 1st cell
for i in idIn1stCell:
	O.bodies.erase(i)
## print the material ids, I found that all the material ids are 1, but I expect to have two types of materials.
for i in O.bodies:
	print (i.material.id)
#######################

Thanks!
Leonard

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