Ejemplo n.º 1
0
genDim=4,4,4 # dim will be made by generating genDim and copying
margin=0
r=.01
ktDivKn=.2

sim=clDem.Simulation(breakTension=True,ktDivKn=ktDivKn,opts="-cl-strict-aliasing ")

sim.scene.materials=[clDem.FrictMat(young=1e6,density=1e3,ktDivKn=.2,tanPhi=.5)]
sim.scene.gravity=(-4,-5,-10)
sim.scene.damping=.4
sim.scene.verletDist=.3*r
sim.scene.dt=-.4
sim.maxScheduledSteps=10

if 1:
	sim.par.append(clDem.mkWall(pos=(0,0,0),axis=2,sim=sim,matId=0,groups=0b011))
	sim.par.append(clDem.mkWall(pos=(0,0,0),axis=0,sim=sim,matId=0,groups=0b011))
	sim.par.append(clDem.mkWall(pos=(0,0,0),axis=1,sim=sim,matId=0,groups=0b011))
else:
	# ground
	for x0,x1 in itertools.product(range(0,dim[0]),range(0,dim[1])):
		sim.par.append(clDem.mkSphere((x0*2*r,x1*2*r,0),r,sim,matId=0,groups=0b011,fixed=True))

# walls/ground spheres are in loneGroups, but collide with spheres below (0b001) as well
sim.scene.loneGroups=0b010
#sim.collideGpu = True

import woo.pack
sp=woo.pack.SpherePack()
sp.makeCloud((0,0,0),2*r*Vector3(genDim),r,rRelFuzz=.5,periodic=True)
sp.translate(2*r*Vector3.Ones)
Ejemplo n.º 2
0
import sys
sys.path.append('..')
import clDem

from miniEigen import *
from math import *

# set platform and device numbers here
# if left at -1, first platform and device will be used
# you will be notified in the terminal as well
sim=clDem.Simulation(platformNum=2,deviceNum=0,breakTension=True,ktDivKn=.2,opts="-cl-strict-aliasing -I..")
sim.scene.materials=[clDem.FrictMat(young=1e6,density=1e3,ktDivKn=.2,tanPhi=.5)]
# add boundaries
for axis in 0,1,2: sim.par.append(clDem.mkWall(pos=(0,0,0),axis=axis,sim=sim,matId=0,groups=0b011))
# load spheres from file
for l in file(sys.argv[1]):
	if l.startswith('#'): continue
	x,y,z,r=[float(n) for n in l.split()]
	sim.par.append(clDem.mkSphere((x,y,z),r,sim,matId=0,groups=0b001,fixed=False))

sim.scene.gravity=(-4,-5,-10)
sim.scene.damping=.4
sim.scene.verletDist=-.3 # negative means relative to minimum sphere size
sim.scene.loneGroups=0b010  # no contacts of walls with themselves

sim.showND=0 # show NDRange for all kernels every 20 steps; set to 0 to disable

# maximum number of enqueued steps (times 7 kernels/step), before returning back to CPU
sim.maxScheduledSteps=100

if 1:
Ejemplo n.º 3
0
from math import *
import pylab, itertools, random

pNum=int(sys.argv[1]) if len(sys.argv)>1 else -1
dNum=int(sys.argv[2]) if len(sys.argv)>2 else -1

sim=clDem.Simulation(pNum,dNum,breakTension=True,trackEnergy=True)

r=0.1
sim.scene.materials=[clDem.ElastMat(young=1e6,density=1e3)]
sim.scene.gravity=(0,0,-10)
sim.scene.damping=.4
sim.scene.verletDist=.2*r # collision detection in this case
sim.maxScheduledSteps=1

sim.par.append(clDem.mkWall(pos=(-10,-10,5),axis=2,sim=sim,matId=0))
sim.par.append(clDem.mkSphere(pos=(2,2,5+1.1*r),radius=r,sim=sim,matId=0))
sim.par[-1].vel=(0,0,-.0005)

sim.scene.dt=.2*sim.pWaveDt()

sim.run(1)
#for i in range(0,len(sim.par)):
#	print i,sim.getBbox(i)

if 1:
	from woo import *
	import woo.cld
	import woo.log
	import woo.gl
	S=woo.master.scene
Ejemplo n.º 4
0
# set platform and device numbers here
# if left at -1, first platform and device will be used
# you will be notified in the terminal as well
sim = clDem.Simulation(platformNum=2,
                       deviceNum=0,
                       breakTension=True,
                       ktDivKn=.2,
                       opts="-cl-strict-aliasing -I..")
sim.scene.materials = [
    clDem.FrictMat(young=1e6, density=1e3, ktDivKn=.2, tanPhi=.5)
]
# add boundaries
for axis in 0, 1, 2:
    sim.par.append(
        clDem.mkWall(pos=(0, 0, 0), axis=axis, sim=sim, matId=0, groups=0b011))
# load spheres from file
for l in file(sys.argv[1]):
    if l.startswith('#'): continue
    x, y, z, r = [float(n) for n in l.split()]
    sim.par.append(
        clDem.mkSphere((x, y, z), r, sim, matId=0, groups=0b001, fixed=False))

sim.scene.gravity = (-4, -5, -10)
sim.scene.damping = .4
sim.scene.verletDist = -.3  # negative means relative to minimum sphere size
sim.scene.loneGroups = 0b010  # no contacts of walls with themselves

sim.showND = 0  # show NDRange for all kernels every 20 steps; set to 0 to disable

# maximum number of enqueued steps (times 7 kernels/step), before returning back to CPU