Ejemplo n.º 1
0
sim = clDem.Simulation()  #platformNum,deviceNum


def show(obj):
    import pprint
    d = {}
    for a in dir(obj):
        if a.startswith('_'): continue
        if callable(getattr(obj, a)): continue
        d[a] = getattr(obj, a)
    pprint.pprint(d)


show(sim.scene)
print sim.con
print sim.par
par = clDem.Particle()
show(par)
par.shape = clDem.Sphere(radius=4)
show(par)
sim.par = [
    par,
]
print sim.par
print sim.scene.materials
sim.scene.materials = []
sim.scene.materials = [clDem.ElastMat()]
print sim.par[0].shape.radius
c = clDem.Contact()
show(c)
Ejemplo n.º 2
0
r = .005
E = 1e4
rho = 1e4
nan = float('nan')

useL1Geom, ktDivKn, charLen, dtFrac = (
    (False, .2, nan, .05),
    (False, .8, 1e5 * r, .01),
)[0]  # pick configuration set here

sim = clDem.Simulation(pNum,
                       dNum,
                       charLen=charLen,
                       ktDivKn=ktDivKn,
                       trackEnergy=True)
sim.scene.materials = [clDem.ElastMat(density=rho, young=E)]
sim.scene.gravity = (0, 0, -10)
sim.scene.damping = .4
sim.scene.verletDist = .3 * r

for i in range(0, N):
    sim.par.append(
        clDem.mkSphere((2 * r * i * .9, 0, 0),
                       r,
                       sim,
                       matId=0,
                       fixed=(i in supports)))

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

Ejemplo n.º 3
0
import clDem
from minieigen import *
from math import *
import itertools

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

M, N = 100, 100
r = .005
E = 1e4
rho = 1e4

sim = clDem.Simulation(pNum, dNum)  # pass from command-line

sim.scene.materials = [clDem.ElastMat(young=E, density=rho)]
sim.scene.gravity = (0, 0, -10)
sim.scene.damping = .2
sim.scene.verletDist = float('nan')  # no collision detection

for n, m in itertools.product(range(0, N), range(0,
                                                 M)):  # m advances the fastest
    isSupp = (m == 0 or n == 0 or (m == M - 1 and n < N / 2))
    sim.par.append(
        clDem.mkSphere((2 * r * m * .999999, 2 * r * n * .9999999, 0),
                       r,
                       sim,
                       matId=0,
                       fixed=isSupp))
    pid = len(sim.par) - 1
    assert (pid == n * M + m)
Ejemplo n.º 4
0
sys.path.append('.')
import clDem
from minieigen import *
from math import *
import pylab

N = 50
supports = [
    0,
    49,
]
r = .005
E = 1e4
rho = 1e3

sim = clDem.Simulation(breakTension=True, trackEnergy=True, opts='')
sim.scene.materials = [clDem.ElastMat(young=1e4, density=1e4)]
sim.scene.gravity = (0, 0, -10)
sim.scene.damping = 0.
sim.scene.dt = -.01

sim.par.append(clDem.mkSphere((0, 0, 0), .005, sim, matId=0, fixed=True))
sim.par.append(clDem.mkSphere((0, 0, .015), .005, sim, matId=0, fixed=False))

import woo.cld

woo.master.scene = woo.cld.CLDemField.clDemToWoo(sim,
                                                 stepPeriod=1,
                                                 relTol=1e-8)
#pylab.plot(zCoord,label='z-coord'); pylab.legend(loc='lower left'); pylab.twinx(); pylab.plot(f1z,c='red',label='F1z'); pylab.legend(); pylab.show()
Ejemplo n.º 5
0
import sys
sys.path.append('.')
import clDem

from minieigen import *
from math import *
import pylab, itertools, random

import woo.core

sim=clDem.Simulation(breakTension=True)

sim.scene.materials=[clDem.ElastMat(young=1e6,density=1e3)] #,ktDivKn=.2,tanPhi=.5)]
sim.scene.gravity=(0,0,-10)
sim.scene.damping=.1
sim.maxScheduledSteps=10
sim.scene.dt=-.3

# stand-alone sphere
# sim.par.append(clDem.mkSphere([0,0,0],.5,sim=sim))
# clumps
relPos=[(0,-.5,-.5),(0,.5,0),(.5,0,0),(0,0,.5)]
coords=[(-2,0,0),] #,(2,0,0),(0,2,0),(0,-2,0)]
for i,cc in enumerate(coords):
	# This shorthand command does something like this:
	# O.bodies.appendClumped([utils.sphere(...),utils.sphere(...),utils.sphere(...)])
	# and returns tuple of clumpId,[bodyId1,bodyId2,bodyId3]
	clump,spheres=sim.addClump([clDem.mkSphere([relPos[j][0]+coords[i][0],relPos[j][1]+coords[i][1],relPos[j][2]+coords[i][2]],.5,sim=sim) for j in range(0,i+3)])
	print clump,spheres
sim.par.append(clDem.mkWall(pos=(0,0,-1.3),axis=2,sim=sim,matId=0,groups=0b011))