Triaxial Test on a cylinder

Asked by Hashir Ahmad

I am a newbie in yade. I executed the TriaxialTest(numberOfGrains=500).load() on the yade command line, and then I executed O.run(1000) and started the yade.qt.Controller(). After some iterations, packing is acheived. I want to generate a cylinder out of the particles. How to do that?

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> I am a newbie in yade

welcome :-)

please be more specific on "generate a cylinder".
If it means to extract particles within a cylindrical predicate, you can try:
#############
from yade import pack
pred = pack.inCylinder((0.5,0.5,0),(0.5,0.5,1),.4) #[1]
cyl = [b for b in O.bodies if isinstance(b.shape,Sphere) and pred(b.state.pos,b.shape.radius)]
# predicate(center,radius) returns True if it contains the sphere(center,radius), False otherwise

# test
sphs = [(b.state.pos,b.shape.radius) for b in cyl]
O.reset()
O.bodies.append([sphere(pos,r) for pos,r in sphs])
#############

if you need more help to understand the example (it is a bit compressed commands, could be rewritten to more understandable way), let us know
cheers
Jan

[1] https://yade-dem.org/doc/yade.pack.html#yade._packPredicates.inCylinder

Revision history for this message
Hashir Ahmad (hash.ir) said :
#2

Yes, I meant a cylindrical predicate. Now, where I have to put this snippet of code or modify the existing one in the trunk repository?

Revision history for this message
Jan Stránský (honzik) said :
#3

you place/execute the snippet just after your commands :-)

#############
TriaxialTest(numberOfGrains=500).load()
O.run(1000,True) # True argument is important, prevent further commands to be executed before 1000 iterations are finished

from yade import pack
pred = pack.inCylinder((0.5,0.5,0),(0.5,0.5,1),.4) #[1]
cyl = [b for b in O.bodies if isinstance(b.shape,Sphere) and pred(b.state.pos,b.shape.radius)]
# predicate(center,radius) returns True if it contains the sphere(center,radius), False otherwise

# test
sphs = [(b.state.pos,b.shape.radius) for b in cyl]
O.reset()
O.bodies.append([sphere(pos,r) for pos,r in sphs])
#############

cheers
Jan

Can you help with this problem?

Provide an answer of your own, or ask Hashir Ahmad for more information if necessary.

To post a message you must log in.