yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #15254
Re: [Question #645973]: Triaxial Test on a cylinder
Question #645973 on Yade changed:
https://answers.launchpad.net/yade/+question/645973
Status: Open => Answered
Jan Stránský proposed the following answer:
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
--
You received this question notification because your team yade-users is
an answer contact for Yade.