Ejemplo n.º 1
0
radiusSph = 0.05
numBoxes = Vector3(15, 5, 2)
gapBetweenBoxes = 0.05
sizeBox = (lengthKnife - (numBoxes[1] - 1) * gapBetweenBoxes) / numBoxes[1]

### Creating the Buldozer Knife
### from facets, using GTS
Knife = []
for i in linspace(pi, pi * 3 / 2, num=numKnifeParts, endpoint=True):
    Knife.append(Vector3(radiusKnife * cos(i), 0, radiusKnife * sin(i)))

KnifeP = [Knife, [p + Vector3(0, lengthKnife, 0) for p in Knife]]
KnifePoly = pack.sweptPolylines2gtsSurface(KnifeP, threshold=1e-4)
KnifeIDs = []
KnifeIDs = O.bodies.append(
    pack.gtsSurface2Facets(KnifePoly, color=(1, 0, 0), wire=False))

KnifeIDs += O.bodies.append(
    geom.facetBox((-lengthKnife / 2 - radiusKnife, lengthKnife / 2,
                   -radiusKnife + buldozerHeight / 2),
                  (lengthKnife / 2, lengthKnife / 2, buldozerHeight / 2.),
                  wallMask=47,
                  color=(0, 1, 0),
                  wire=False))

KnifeIDs += O.bodies.append(
    geom.facetBox(
        (-lengthKnife / 2 - radiusKnife - lengthKnife / 4., lengthKnife / 2,
         -radiusKnife + buldozerHeight * 3. / 2. - buldozerHeight / 4.),
        (lengthKnife / 4., lengthKnife / 3., buldozerHeight / 4.),
        wallMask=47,
Ejemplo n.º 2
0
es = 0.3

## Materials
params=utils.getViscoelasticFromSpheresInteraction(tc,en,es)
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs
sphereMat=O.materials.append(ViscElMat(density=Density,frictionAngle=frictionAngle,**params))

### Creating the Buldozer Knife
### from facets, using GTS
Knife=[]
for i in linspace(pi, pi*3/2, num=numKnifeParts, endpoint=True):
	Knife.append(Vector3(radiusKnife*cos(i),0,radiusKnife*sin(i)))
	
KnifeP=[Knife,[p+Vector3(0,lengthKnife,0) for p in Knife]]
KnifePoly=pack.sweptPolylines2gtsSurface(KnifeP,threshold=1e-4)
KnifeIDs=O.bodies.append(pack.gtsSurface2Facets(KnifePoly,color=(1,0,0),wire=False,material=facetMat))

KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife,lengthKnife/2,-radiusKnife+buldozerHeight/2),(lengthKnife/2,lengthKnife/2,buldozerHeight/2.),wallMask=47,color=(0,1,0),wire=False))

KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife-lengthKnife/4.,lengthKnife/2,-radiusKnife+buldozerHeight*3./2.-buldozerHeight/4.),(lengthKnife/4.,lengthKnife/3.,buldozerHeight/4.),wallMask=47,color=(0,0,1),wire=False))

O.bodies.append(geom.facetBox((0,0,radiusKnife),(lengthKnife*3,lengthKnife*3,lengthKnife),wallMask=16,color=(1,1,1),wire=False,material=facetMat))


### Creating the material for buldozer
colorsph1=Vector3(120,234,150);
colorsph2=Vector3(0,0,1);

colorsph1.normalize();
colorsph2.normalize();
colorSph=colorsph1
Ejemplo n.º 3
0
(or other VTK-based) program, you can create video, make screenshots etc."""
import woo
from woo import *
from woo.dem import *
from woo.core import *
from numpy import linspace
from woo import pack,qt,utils
from minieigen import *
from math import *

S=woo.master.scene=Scene(fields=[DemField(gravity=(0,0,-9.81))])

thetas=linspace(0,2*pi,num=16,endpoint=True)
meridians=pack.revolutionSurfaceMeridians([[Vector2(3+rad*sin(th),10*rad+rad*cos(th)) for th in thetas] for rad in linspace(1,2,num=10)],angles=linspace(0,pi,num=10))
surf=pack.sweptPolylines2gtsSurface(meridians+[[Vector3(5*sin(-th),-10+5*cos(-th),30) for th in thetas]])
S.dem.par.add(pack.gtsSurface2Facets(surf))
S.dem.par.add(InfCylinder.make((0,0,0),axis=0,radius=2,glAB=(-10,10)))
# edgy helix from contiguous rods
nPrev=None
for i in range(25):
    nNext=Node(pos=(3+3*sin(i),3*cos(i),3+.3*i))
    if nPrev: S.dem.par.add(Rod.make(vertices=[nPrev,nNext],radius=.5,wire=False,fixed=True))
    nPrev=nNext

sp=pack.SpherePack()
sp.makeCloud(Vector3(-1,-9,30),Vector3(1,-13,32),.2,rRelFuzz=.3)
S.dem.par.add([utils.sphere(c,r) for c,r in sp])

S.engines=DemField.minimalEngines(damping=.2)+[VtkExport(stepPeriod=100,what=VtkExport.spheres|VtkExport.mesh,out='/tmp/p1-'),PyRunner(initRun=False,stepPeriod=0,virtPeriod=13,nDo=1,command='import woo.paraviewscript; woo.paraviewscript.fromEngines(S,launch=True); S.stop()')]

qt.Controller()
Ejemplo n.º 4
0
kw=utils.getViscoelasticFromSpheresInteraction(10e3,tc,en,es)
params=utils.getViscoelasticFromSpheresInteraction(10e3,tc,en,es)
# facets material
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params)) 
# default spheres material
dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle))

O.dt=.2*tc # time step

Rs=0.02 # mean particle radius
Rf=0.01 # dispersion (Rs±Rf*Rs)
nSpheres=1000# number of particles

# Create geometry
pln=Plane( (-.5, -.5, 0), (.5, -.5, -.05), (.5, .5, 0), (-.5, .5, -.05) ); 
plnIds=O.bodies.append(pack.gtsSurface2Facets(pln.faces(),material=facetMat,color=(0,1,0)))

fct=Plane( (-.25, -.25, .5), (.25, -.25, .5), (.25, .25, .5), (-.25, .25, .5) ); 
fctIds=O.bodies.append(pack.gtsSurface2Facets(fct.faces(),material=facetMat,color=(1,0,0),noBound=True))

# Create spheres
sp=pack.SpherePack(); 
sp.makeCloud(Vector3(-.5, -.5, 0),Vector3(.5, .5, .2), Rs, Rf, int(nSpheres), False)
spheres=O.bodies.append([utils.sphere(s[0],s[1],color=(0.929,0.412,0.412),material=dfltSpheresMat) for s in sp])
for id in spheres:
	s=O.bodies[id]
	p=utils.getViscoelasticFromSpheresInteraction(s.state['mass'],tc,en,es)
	s.mat['kn'],s.mat['cn'],s.mat['ks'],s.mat['cs']=p['kn'],p['cn'],p['ks'],p['cs']

# Create engines
O.engines=[
Ejemplo n.º 5
0
from numpy import linspace
from woo import pack, qt, utils
from minieigen import *
from math import *

S = woo.master.scene = Scene(fields=[DemField(gravity=(0, 0, -9.81))])

thetas = linspace(0, 2 * pi, num=16, endpoint=True)
meridians = pack.revolutionSurfaceMeridians(
    [[Vector2(3 + rad * sin(th), 10 * rad + rad * cos(th)) for th in thetas]
     for rad in linspace(1, 2, num=10)],
    angles=linspace(0, pi, num=10))
surf = pack.sweptPolylines2gtsSurface(
    meridians +
    [[Vector3(5 * sin(-th), -10 + 5 * cos(-th), 30) for th in thetas]])
S.dem.par.add(pack.gtsSurface2Facets(surf))

sp = pack.SpherePack()
sp.makeCloud(Vector3(-1, -9, 30), Vector3(1, -13, 32), .2, rRelFuzz=.3)
S.dem.par.add([utils.sphere(c, r) for c, r in sp])

S.engines = DemField.minimalEngines(damping=.2) + [
    VtkExport(stepPeriod=100,
              what=VtkExport.spheres | VtkExport.mesh,
              out='/tmp/p1-')
]

qt.Controller()
qt.View()
S.stopAtTime = 13.
S.saveTmp()
Ejemplo n.º 6
0
dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle, **params)) 

O.dt=.1*tc # time step

Rs=0.05 # particle radius

# Create geometry

x0=0.; y0=0.; z0=0.; ab=.7; at=2.; h=1.; hl=h; al=at*3

zb=z0;   x0b=x0-ab/2.; y0b=y0-ab/2.; x1b=x0+ab/2.; y1b=y0+ab/2.
zt=z0+h; x0t=x0-at/2.; y0t=y0-at/2.; x1t=x0+at/2.; y1t=y0+at/2.
zl=z0-hl;x0l=x0-al/2.; y0l=y0-al/2.; x1l=x0+al/2.; y1l=y0+al/2.

left = pack.sweptPolylines2gtsSurface([[Vector3(x0b,y0b,zb),Vector3(x0t,y0t,zt),Vector3(x0t,y1t,zt),Vector3(x0b,y1b,zb)]],capStart=True,capEnd=True)
lftIds=O.bodies.append(pack.gtsSurface2Facets(left.faces(),material=facetMat,color=(0,1,0)))

right = pack.sweptPolylines2gtsSurface([[Vector3(x1b,y0b,zb),Vector3(x1t,y0t,zt),Vector3(x1t,y1t,zt),Vector3(x1b,y1b,zb)]],capStart=True,capEnd=True)
rgtIds=O.bodies.append(pack.gtsSurface2Facets(right.faces(),material=facetMat,color=(0,1,0)))

near = pack.sweptPolylines2gtsSurface([[Vector3(x0b,y0b,zb),Vector3(x0t,y0t,zt),Vector3(x1t,y0t,zt),Vector3(x1b,y0b,zb)]],capStart=True,capEnd=True)
nearIds=O.bodies.append(pack.gtsSurface2Facets(near.faces(),material=facetMat,color=(0,1,0)))

far = pack.sweptPolylines2gtsSurface([[Vector3(x0b,y1b,zb),Vector3(x0t,y1t,zt),Vector3(x1t,y1t,zt),Vector3(x1b,y1b,zb)]],capStart=True,capEnd=True)
farIds=O.bodies.append(pack.gtsSurface2Facets(far.faces(),material=facetMat,color=(0,1,0)))

table = pack.sweptPolylines2gtsSurface([[Vector3(x0l,y0l,zl),Vector3(x0l,y1l,zl),Vector3(x1l,y1l,zl),Vector3(x1l,y0l,zl)]],capStart=True,capEnd=True)
tblIds=O.bodies.append(pack.gtsSurface2Facets(table.faces(),material=facetMat,color=(0,1,0)))

# Create clumps...
clumpColor=(0.0, 0.5, 0.5)
Ejemplo n.º 7
0
O.dt = .01 * tc  # time step

Rs = 0.1  # particle radius

# Create geometry
plnSurf = pack.sweptPolylines2gtsSurface([[
    Vector3(-.5, 0, 0),
    Vector3(.5, 0, 0),
    Vector3(.5, 0, -.5),
    Vector3(-.5, 0, -.5)
]],
                                         capStart=True,
                                         capEnd=True)
plnIds = O.bodies.append(
    pack.gtsSurface2Facets(plnSurf.faces(), material=facetMat,
                           color=(0, 1, 0)))

plnSurf1 = pack.sweptPolylines2gtsSurface([[
    Vector3(-.5, -.5, -.5),
    Vector3(.5, -.5, -.5),
    Vector3(.5, 1.5, -.5),
    Vector3(-.5, 1.5, -.5)
]],
                                          capStart=True,
                                          capEnd=True)
plnIds1 = O.bodies.append(
    pack.gtsSurface2Facets(plnSurf1.faces(),
                           material=facetMat,
                           color=(0, 1, 0)))

# Create clumps
Ejemplo n.º 8
0
facetMat = O.materials.append(ViscElMat(
    frictionAngle=frictionAngle, **params))  # **params sets kn, cn, ks, cs
sphereMat = O.materials.append(
    ViscElMat(density=Density, frictionAngle=frictionAngle, **params))

### Creating the Buldozer Knife
### from facets, using GTS
Knife = []
for i in linspace(pi, pi * 3 / 2, num=numKnifeParts, endpoint=True):
    Knife.append(Vector3(radiusKnife * cos(i), 0, radiusKnife * sin(i)))

KnifeP = [Knife, [p + Vector3(0, lengthKnife, 0) for p in Knife]]
KnifePoly = pack.sweptPolylines2gtsSurface(KnifeP, threshold=1e-4)
KnifeIDs = O.bodies.append(
    pack.gtsSurface2Facets(KnifePoly,
                           color=(1, 0, 0),
                           wire=False,
                           material=facetMat))

KnifeIDs += O.bodies.append(
    geom.facetBox((-lengthKnife / 2 - radiusKnife, lengthKnife / 2,
                   -radiusKnife + buldozerHeight / 2),
                  (lengthKnife / 2, lengthKnife / 2, buldozerHeight / 2.),
                  wallMask=47,
                  color=(0, 1, 0),
                  wire=False))

KnifeIDs += O.bodies.append(
    geom.facetBox(
        (-lengthKnife / 2 - radiusKnife - lengthKnife / 4., lengthKnife / 2,
         -radiusKnife + buldozerHeight * 3. / 2. - buldozerHeight / 4.),
        (lengthKnife / 4., lengthKnife / 3., buldozerHeight / 4.),
Ejemplo n.º 9
0
zl = z0 - hl
x0l = x0 - al / 2.
y0l = y0 - al / 2.
x1l = x0 + al / 2.
y1l = y0 + al / 2.

left = pack.sweptPolylines2gtsSurface([[
    Vector3(x0b, y0b, zb),
    Vector3(x0t, y0t, zt),
    Vector3(x0t, y1t, zt),
    Vector3(x0b, y1b, zb)
]],
                                      capStart=True,
                                      capEnd=True)
lftIds = O.bodies.append(
    pack.gtsSurface2Facets(left.faces(), material=facetMat, color=(0, 1, 0)))

right = pack.sweptPolylines2gtsSurface([[
    Vector3(x1b, y0b, zb),
    Vector3(x1t, y0t, zt),
    Vector3(x1t, y1t, zt),
    Vector3(x1b, y1b, zb)
]],
                                       capStart=True,
                                       capEnd=True)
rgtIds = O.bodies.append(
    pack.gtsSurface2Facets(right.faces(), material=facetMat, color=(0, 1, 0)))

near = pack.sweptPolylines2gtsSurface([[
    Vector3(x0b, y0b, zb),
    Vector3(x0t, y0t, zt),
Ejemplo n.º 10
0
# for each angle, put the poly a little bit higher (+2e-3*theta);
# this is just to demonstrate that you can do whatever here as long as the resulting
# meridian has the same number of points
#
# There is origin (translation) and orientation arguments, allowing to transform all the 3d points once computed.
#
# without these transformation, it would look a little simpler:
#     pts=pack.revolutionSurfaceMeridians([[(pt[0],pt[1]+2e-3*theta) for pt in poly] for theta in thetas],thetas
#
pts=pack.revolutionSurfaceMeridians([[(pt[0],pt[1]+1e-2*theta) for pt in poly] for theta in thetas],thetas,origin=Vector3(0,-.05,.1),orientation=Quaternion((1,1,0),pi/4))
# connect meridians to make surfaces
# caps will close it at the beginning and the end
# threshold will merge points closer than 1e-4; this is important: we want it to be closed for filling
surf=pack.sweptPolylines2gtsSurface(pts,capStart=True,capEnd=True,threshold=1e-4)
# add the surface as facets to the simulation, to make it visible
O.bodies.append(pack.gtsSurface2Facets(surf,color=(1,0,1)))
# now fill the inGtsSurface predicate constructed form the same surface with sphere packing generated by TriaxialTest
# with given radius and standard deviation (see documentation of pack.randomDensePack)
#
# The memoizeDb will save resulting packing into given file and next time, if you run with the same
# parameters (or parameters that can be scaled to the same one),
# it will load the packing instead of running the triaxial compaction again.
# Try running for the second time to see the speed difference!
memoizeDb='/tmp/gts-triax-packings.sqlite'
O.bodies.append(pack.randomDensePack(pack.inGtsSurface(surf),radius=5e-3,rRelFuzz=1e-4,memoizeDb=memoizeDb))
# We could also fill the horse with triaxial packing, but have nice approximation, the triaxial would run terribly long,
# since horse discard most volume of its bounding box
# Here, we would use a very crude one, however
if 1:
    import gts
    horse=gts.read(open('horse.coarse.gts')) #; horse.scale(.25,.25,.25)
Ejemplo n.º 11
0
surface or another: with padding, several points on the sphere are tested. Therefore,
areas near both surfaces' boundary will not be filled at all.

Note that GTS only moves references to surfaces around, therefore e.g. translating
surface that is part of the union will move also the part of the united surface.
Therefore, we use the copy() method for deep copy here.
"""
from __future__ import print_function
from woo import pack, qt
import gts

s1 = gts.read(open("horse.coarse.gts"))
s2 = gts.Surface()
s2.copy(s1)
s2.translate(0.04, 0, 0)
O.bodies.append(pack.gtsSurface2Facets(s1, color=(0, 1, 0)) + pack.gtsSurface2Facets(s2, color=(1, 0, 0)))

s12 = gts.Surface()
s12.copy(s1.union(s2))
s12.translate(0, 0, 0.1)
radius = 0.002
O.bodies.append(pack.gtsSurface2Facets(s12, color=(0, 0, 1)))

qt.View()
from time import time

t0 = time()
O.bodies.append(pack.regularHexa(pack.inGtsSurface(s1) | pack.inGtsSurface(s2), radius, gap=0, color=(0, 1, 0)))
t1 = time()
print("Using predicate union: %gs" % (t1 - t0))
O.bodies.append(pack.regularHexa(pack.inGtsSurface(s12), radius, gap=0.0, color=(1, 0, 0)))
Ejemplo n.º 12
0
# facets material
facetMat = O.materials.append(ViscElMat(frictionAngle=frictionAngle, **params))
# default spheres material
dfltSpheresMat = O.materials.append(
    ViscElMat(density=density, frictionAngle=frictionAngle))

O.dt = .2 * tc  # time step

Rs = 0.02  # mean particle radius
Rf = 0.01  # dispersion (Rs±Rf*Rs)
nSpheres = 1000  # number of particles

# Create geometry
pln = Plane((-.5, -.5, 0), (.5, -.5, -.05), (.5, .5, 0), (-.5, .5, -.05))
plnIds = O.bodies.append(
    pack.gtsSurface2Facets(pln.faces(), material=facetMat, color=(0, 1, 0)))

fct = Plane((-.25, -.25, .5), (.25, -.25, .5), (.25, .25, .5), (-.25, .25, .5))
fctIds = O.bodies.append(
    pack.gtsSurface2Facets(fct.faces(),
                           material=facetMat,
                           color=(1, 0, 0),
                           noBound=True))

# Create spheres
sp = pack.SpherePack()
sp.makeCloud(Vector3(-.5, -.5, 0), Vector3(.5, .5, .2), Rs, Rf, int(nSpheres),
             False)
spheres = O.bodies.append([
    utils.sphere(s[0],
                 s[1],
Ejemplo n.º 13
0
zl = z0 - hl
x0l = x0 - al / 2.
y0l = y0 - al / 2.
x1l = x0 + al / 2.
y1l = y0 + al / 2.

left = pack.sweptPolylines2gtsSurface([[
    Vector3(x0b, y0b, zb),
    Vector3(x0t, y0t, zt),
    Vector3(x0t, y1t, zt),
    Vector3(x0b, y1b, zb)
]],
                                      capStart=True,
                                      capEnd=True)
lftIds = O.bodies.append(
    pack.gtsSurface2Facets(left.faces(), material=facetMat, color=(0, 1, 0)))

right = pack.sweptPolylines2gtsSurface([[
    Vector3(x1b, y0b, zb),
    Vector3(x1t, y0t, zt),
    Vector3(x1t, y1t, zt),
    Vector3(x1b, y1b, zb)
]],
                                       capStart=True,
                                       capEnd=True)
rgtIds = O.bodies.append(
    pack.gtsSurface2Facets(right.faces(), material=facetMat, color=(0, 1, 0)))

near = pack.sweptPolylines2gtsSurface([[
    Vector3(x0b, y0b, zb),
    Vector3(x0t, y0t, zt),
Ejemplo n.º 14
0
es=.3  # tangential restitution coefficient
frictionAngle=radians(35)# 
density=2700
# facets material
params=utils.getViscoelasticFromSpheresInteraction(10e3,tc,en,es)
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs
# default spheres material
dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle)) 

O.dt=.01*tc # time step

Rs=0.1 # particle radius

# Create geometry
plnSurf = pack.sweptPolylines2gtsSurface([[Vector3(-.5,0,0),Vector3(.5,0,0),Vector3(.5, 0, -.5),Vector3(-.5, 0, -.5)]],capStart=True,capEnd=True)
plnIds=O.bodies.append(pack.gtsSurface2Facets(plnSurf.faces(),material=facetMat,color=(0,1,0)))

plnSurf1 = pack.sweptPolylines2gtsSurface([[Vector3(-.5,-.5,-.5),Vector3(.5,-.5,-.5),Vector3(.5, 1.5, -.5),Vector3(-.5, 1.5, -.5)]],capStart=True,capEnd=True)
plnIds1=O.bodies.append(pack.gtsSurface2Facets(plnSurf1.faces(),material=facetMat,color=(0,1,0)))

# Create clumps
clpId,sphId=O.bodies.appendClumped([utils.sphere(Vector3(0,Rs*2*i,Rs*2),Rs,material=dfltSpheresMat) for i in xrange(4)])
for id in sphId:
	s=O.bodies[id]
	p=utils.getViscoelasticFromSpheresInteraction(s.state['mass'],tc,en,es)
	s.mat['kn'],s.mat['cn'],s.mat['ks'],s.mat['cs']=p['kn'],p['cn'],p['ks'],p['cs']

# Create engines
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
Ejemplo n.º 15
0
import pylab
# define the section shape as polygon in 2d; repeat first point at the end to close the polygon
sq2 = sqrt(2)
poly = ((3 + .1, 0), (3 + 0, .1), (3 + sq2, .1 + sq2), (3 + .1 + sq2, sq2),
        (3 + .1, 0))
#pylab.plot(*zip(*poly)); pylab.xlim(xmin=0); pylab.grid(); pylab.title('Meridian of the revolution surface\n(close to continue)'); pylab.gca().set_aspect(aspect='equal',adjustable='box'); pylab.show()
thetas = arange(0, pi / 8, pi / 24)
pts = pack.revolutionSurfaceMeridians([poly for theta in thetas],
                                      thetas,
                                      origin=Vector3(-4, 0, -1),
                                      orientation=Quaternion.Identity)
surf = pack.sweptPolylines2gtsSurface(pts,
                                      capStart=True,
                                      capEnd=True,
                                      threshold=1e-4)
O.bodies.append(pack.gtsSurface2Facets(surf, color=(1, 0, 1)))
# fill this solid with triaxial packing; it will compute minimum-volume oriented bounding box
# to minimize the number of throw-away spheres.
# It does away with about 3k spheres for radius 3e-2
O.bodies.append(
    pack.randomDensePack(pack.inGtsSurface(surf),
                         radius=3e-2,
                         rRelFuzz=1e-1,
                         memoizeDb='/tmp/gts-triax-packings.sqlite'))
# translate the surface away and pack it again with sphere, but without the oriented bounding box (useOBB=False)
# Here, we need 20k spheres (with more or less the same result)
surf.translate(0, 0, 1)
O.bodies.append(pack.gtsSurface2Facets(surf, color=(1, 0, 0)))
O.bodies.append(
    pack.randomDensePack(pack.inGtsSurface(surf),
                         radius=3e-2,
Ejemplo n.º 16
0
surface or another: with padding, several points on the sphere are tested. Therefore,
areas near both surfaces' boundary will not be filled at all.

Note that GTS only moves references to surfaces around, therefore e.g. translating
surface that is part of the union will move also the part of the united surface.
Therefore, we use the copy() method for deep copy here.
"""
from woo import pack, qt
import gts

s1 = gts.read(open('horse.coarse.gts'))
s2 = gts.Surface()
s2.copy(s1)
s2.translate(0.04, 0, 0)
O.bodies.append(
    pack.gtsSurface2Facets(s1, color=(0, 1, 0)) +
    pack.gtsSurface2Facets(s2, color=(1, 0, 0)))

s12 = gts.Surface()
s12.copy(s1.union(s2))
s12.translate(0, 0, .1)
radius = 0.002
O.bodies.append(pack.gtsSurface2Facets(s12, color=(0, 0, 1)))

qt.View()
from time import time
t0 = time()
O.bodies.append(
    pack.regularHexa(pack.inGtsSurface(s1) | pack.inGtsSurface(s2),
                     radius,
                     gap=0,
Ejemplo n.º 17
0
es=.3  # tangential restitution coefficient
frictionAngle=radians(35)# 
density=2700
# facets material
params=utils.getViscoelasticFromSpheresInteraction(10e3,tc,en,es)
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs
# default spheres material
dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle)) 

O.dt=.01*tc # time step

Rs=0.1 # particle radius

# Create geometry
plnSurf = pack.sweptPolylines2gtsSurface([[Vector3(-.5,0,0),Vector3(.5,0,0),Vector3(.5, 0, -.5),Vector3(-.5, 0, -.5)]],capStart=True,capEnd=True)
plnIds=O.bodies.append(pack.gtsSurface2Facets(plnSurf.faces(),material=facetMat,color=(0,1,0)))

plnSurf1 = pack.sweptPolylines2gtsSurface([[Vector3(-.5,-.5,-.5),Vector3(.5,-.5,-.5),Vector3(.5, 1.5, -.5),Vector3(-.5, 1.5, -.5)]],capStart=True,capEnd=True)
plnIds1=O.bodies.append(pack.gtsSurface2Facets(plnSurf1.faces(),material=facetMat,color=(0,1,0)))

# Create clumps
clpId,sphId=O.bodies.appendClumped([utils.sphere(Vector3(0,Rs*2*i,Rs*2),Rs,material=dfltSpheresMat) for i in range(4)])
for id in sphId:
    s=O.bodies[id]
    p=utils.getViscoelasticFromSpheresInteraction(s.state['mass'],tc,en,es)
    s.mat['kn'],s.mat['cn'],s.mat['ks'],s.mat['cs']=p['kn'],p['cn'],p['ks'],p['cs']

# Create engines
O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),