yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #25757
Re: [Question #697545]: How to create a cylinder model with hard and soft interlayer
Question #697545 on Yade changed:
https://answers.launchpad.net/yade/+question/697545
Jan Stránský proposed the following answer:
> 1. How to select particles representing soft rock (different thickness
and dip angle).
e.g.:
###
# return true if z-coordinate is between 1.5 and 2.5
# adjust the condition to your needs
def isSoftRockParticle(b):
x,y,z = b.state.pos
return z > 1.5 and z < 2.5
softRockParticles = [b for b in O.bodies if isSoftRockParticle(b)]
###
> 2.About changing the material, can i use the following method:
in general yes, BUT
> for i in 'softrock':
> O.bodies[i].mat.cohesion=softMat.cohesion
does probably something different than you want, better use
###
sp.toSimulation(material=mat1)
for b in softRockParticles:
b.mat = mat2
###
i.e. change material entirely.
The reason is that material is (usually) shared among (many) particles and changing b.mat.property of one particle applies to the other particles, too (because b.mat is the same Material).
Have a try:
###
mat1 = FrictMat(young=3)
b1 = sphere((0,0,0),1,material=mat1)
b2 = sphere((2,0,0),1,material=mat1)
print(b1.mat.young)
print(b2.mat.young)
b1.mat.young = 7
print(b1.mat.young)
print(b2.mat.young) # !!!
###
compared to
###
mat1 = FrictMat(young=4)
mat2 = FrictMat(young=5)
b1 = sphere((0,0,0),1,material=mat1)
b2 = sphere((2,0,0),1,material=mat1)
print(b1.mat.young)
print(b2.mat.young)
b1.mat = mat2
print(b1.mat.young)
print(b2.mat.young) # OK
###
Cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.