← Back to team overview

yade-users team mailing list archive

Re: [Question #256038]: Slope geometry creation

 

Question #256038 on Yade changed:
https://answers.launchpad.net/yade/+question/256038

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Mario,


> In the Catalano thesis (
> https://yade-dem.org/w/images/a/af/SlopeStability.pdf) page 32, it is
> mentioned that the slope geometry was created by removing a number of
> spheres through geometrical conditions. I have found the method "erase" of
> the "BodyContainer" class, so I think I have to delete the elements from
> the O.bodies object, but I tried to find an example or something in the
> documentation about how to remove particles based in geometrical conditions
> and I am stuck with it. Any help will be greatly appreciated.
>

you have more options here.

1) your proposed method:

from yade import pack
pred = pack.inAlignedBox((0,0,0),(2,2,2))
spheres = pack.randomDensePack(pred,radius=.1,spheresInCell=200)
O.bodies.append(spheres)
#
nx,ny,nz,d = 1.,1.,0.,-3 # for plane equation nx*x+ny*y+nz*z+d=0
for b in O.bodies:
p = b.state.pos
if nx*p[0]+ny*p[1]+nz*p[2]+d>0: # p is on positive halfspace of
plane nx*x+ny*y+nz*z+d=0
O.bodies.erase(b.id)
#
from yade import qt
qt.View()

you can use any geometric condition you want, instead of mere halfspace
check


2) you don't need to erase particles using pack.inGtsSurface, have a look
at documentation [1,2] and examples [3]. gts surface can have arbitrary
shape and can be constructed using python scripting, not only with file
loading.


>
> In another topic, I am struggling with the size of the spheres as well. If
> you have any comment that points me in the right direction it will be
> excellent. Thanks in advanced.
>

Does documentation (and radius parameter) help [4]? If not, please be more
specific on "struggling with the size of the spheres".

cheers
Jan


[1]  https://yade-dem.org/doc/user.html#boundary-representation-brep
[2]
https://yade-dem.org/doc/yade.pack.html#yade._packPredicates.inGtsSurface
[3]
http://bazaar.launchpad.net/~yade-pkg/yade/git-trunk/view/head:/examples/gts-horse/gts-horse.py
[4] https://yade-dem.org/doc/yade.pack.html#yade.pack.randomDensePack

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.