Generating triangular wedge predicate for randomDensePack

Asked by Matt Kesseler

Hi all. I'm a new user of YADE and I'm currently trying to model an avalanche down a slope of variable angle (pi/6 - pi/3). I'm currently using yade.pack.randomDensePack to generate a box of particles to slide down the slope. However, I want to generate a wedge that matches the angle of the slope, essentially a triangular prism with the triangle being a vertical edge, a horizontal edge, and the diagonal edge, extended uniformly across the width of the ramp. I can't figure out how to do this using the existing tools.

Here is the existing code that I'm using to generate the box.

pred=pack.inAlignedBox((-.1,-.05,-.1),(.1,.05,0))
SpherePack=pack.randomDensePack(pred,spheresInCell=2000,radius=.005,rRelFuzz=0,color=(0,0,1),material="sand",returnSpherePack=True)
SpherePack.toSimulation()

I thought I could achieve the desired result by subtracting another inAlignedBox from the predicate like this...

pred=pack.inAlignedBox((-.1,-.05,-.1),(.1,.05,0))-pack.inAlignedBox((-.1,-.05,-.1),(.1,.05,0),orientation=Quaternion((1,0,0),pi/4))

...or something similar, but it doesn't work.

Please let me know what the easiest way to generate this triangular wedge predicate is. I'm probably missing something very obvious... :p

Question information

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

Hi Matt,

I'm a new user of YADE

welcome :-)

Please let me know what the easiest way to generate this triangular wedge
> predicate is

one solution is to use gts surface (first building vertices, than edges,
then triangle faces and finally closed surface). It can be put in a
function. Apart from wedge, you can create pretty complex surfaces with
this approach (you can also load gts surface from file) [1]

##########################
from yade import pack
import gts
from math import tan

length = 10.
width = 5.
angle = .3*pi/6.
height = length*tan(angle)

v0 = gts.Vertex(0 ,0 ,0)
v1 = gts.Vertex(width,0 ,0)
v2 = gts.Vertex(0 ,length,0)
v3 = gts.Vertex(width,length,0)
v4 = gts.Vertex(0 ,0 ,height)
v5 = gts.Vertex(width,0 ,height)

e0 = gts.Edge(v0,v1)
e1 = gts.Edge(v2,v3)
e2 = gts.Edge(v4,v5)
e3 = gts.Edge(v0,v2)
e4 = gts.Edge(v1,v3)
e5 = gts.Edge(v0,v4)
e6 = gts.Edge(v1,v5)
e7 = gts.Edge(v2,v4)
e8 = gts.Edge(v3,v5)
e9 = gts.Edge(v0,v5)
e10 = gts.Edge(v0,v3)
e11 = gts.Edge(v3,v4)

f0 = gts.Face(e0,e4,e10)
f1 = gts.Face(e1,e3,e10)
f2 = gts.Face(e5,e2,e9)
f3 = gts.Face(e0,e6,e9)
f4 = gts.Face(e1,e7,e11)
f5 = gts.Face(e2,e8,e11)
f6 = gts.Face(e3,e5,e7)
f7 = gts.Face(e4,e6,e8)

surf = gts.Surface()
for f in (f0,f1,f2,f3,f4,f5,f6,f7):
surf.add(f)

pred = pack.inGtsSurface(surf)
sp =
pack.randomDensePack(pred,spheresInCell=400,radius=.1,returnSpherePack=True)
sp.toSimulation()
##########################

I hope the creating of the surface is self-explanatory, if not, do not
hesitate to ask for more details.

cheers
Jan

[1] https://yade-dem.org/doc/user.html#boundary-representation-brep (e.g.
the horse predicate)

2015-12-09 17:51 GMT+01:00 Matt Kesseler <
<email address hidden>>:

> Question #277328 on Yade changed:
> https://answers.launchpad.net/yade/+question/277328
>
> Description changed to:
> Hi all. I'm a new user of YADE and I'm currently trying to model an
> avalanche down a slope of variable angle (pi/6 - pi/3). I'm currently
> using yade.pack.randomDensePack to generate a box of particles to slide
> down the slope. However, I want to generate a wedge that matches the
> angle of the slope, essentially a triangular prism with the triangle
> being a vertical edge, a horizontal edge, and the diagonal edge,
> extended uniformly across the width of the ramp. I can't figure out how
> to do this using the existing tools.
>
> Here is the existing code that I'm using to generate the box.
>
> pred=pack.inAlignedBox((-.1,-.05,-.1),(.1,.05,0))
>
> SpherePack=pack.randomDensePack(pred,spheresInCell=2000,radius=.005,rRelFuzz=0,color=(0,0,1),material="sand",returnSpherePack=True)
> SpherePack.toSimulation()
>
> I thought I could achieve the desired result by subtracting another
> inAlignedBox from the predicate like this...
>
>
> pred=pack.inAlignedBox((-.1,-.05,-.1),(.1,.05,0))-pack.inAlignedBox((-.1,-.05,-.1),(.1,.05,0),orientation=Quaternion((1,0,0),pi/4))
>
> ...or something similar, but it doesn't work.
>
> Please let me know what the easiest way to generate this triangular
> wedge predicate is. I'm probably missing something very obvious... :p
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Matt Kesseler (evxmk9) said :
#2

Thanks for your help, I thought this approach could be used but did not know how to code in the surface. :)

Revision history for this message
Grace Mejico (mejicograce) said :
#3

Good morning everyone, i noticed this question is pretty similar to what i want to know. So ill make it here, hope i can get an answer to my problem.

Actually, im modelling a dry stone retaining wall, and it has the form of a trapezoidal prism. It is possible to way to generate that form for the pack?

As i understood from the answers ,i can see it is possible to make a triangle form.So, I was thinking about create a pack in Parallelepiped and add the triangle wedge form ; in that way, those volumes can make the trapezoidal prism. Is that possible? If there is any script for the pack of trapezoidal prism , i will really grateful if you share it .

Thank you so much, and hopefully i could be clear with my request.

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

Hello,
please open a new question for a new question [1]. In the meantime I will prepare the answer ;-)
cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask