Exemplo n.º 1
0
import woo
from woo import utils, pack, plot
from woo.dem import *
from woo.core import *
woo.master.usesApi = 10101
woo.master.scene = S = Scene(fields=[DemField(gravity=(0, 0, -10))])
mat = woo.dem.PelletMat(young=1e6, tanPhi=.5, ktDivKn=.2, density=1000)
if 1:
    sp = pack.SpherePack()
    sp.makeCloud((0, 0, 0), (10, 10, 10), .4, rRelFuzz=.5)
    sp.toSimulation(S, mat=mat)
else:
    S.dem.par.add(Sphere.make((0, 0, 1), .5, mat=mat))

S.dem.par.add(Wall.make(0, axis=2, sense=1, mat=mat))
S.engines = utils.defaultEngines(
    damping=0.,
    cp2=Cp2_PelletMat_PelletPhys(),
    law=Law2_L6Geom_PelletPhys_Pellet(plastSplit=True)
) + [
    PyRunner(
        1,
        'S.plot.addData(i=S.step,t=S.time,Eerr=(S.energy.relErr() if S.step>100 else 0),**S.energy)'
    ),
]

S.trackEnergy = True
S.saveTmp()
S.plot.plots = {'i': ('**S.energy', None, ('Eerr', 'g--'))}
S.plot.plot()
S.run(500)
Exemplo n.º 2
0
from woo import pack,plot

utils.readParamsFromTable(useL3Geom=True,nonviscDamp=0,frictAngle=0,useClumps=False,noTableOk=True)
from woo.params import table

if 1:
    sp=pack.SpherePack();
    # bunch of balls, with an infinite plane just underneath
    if not table.useClumps: sp.makeCloud((0,0,0),(1,1,1),.05,.5);
    # use clumps of 2 spheres instead, to have rotation without friction 
    else: sp.makeClumpCloud((0,0,0),(1,1,1),[pack.SpherePack([((0,0,0),.05),((0,0,.08),.02)])],periodic=False)
    sp.toSimulation()
else: O.bodies.append(utils.sphere((0,0,2),radius=.5)) # one single bouncing ball
O.bodies.append(utils.wall(position=0,axis=2,sense=1))

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Wall_Aabb()]),
    ContactLoop(
        [Cg2_Sphere_Sphere_L6Geom(),Cg2_Wall_Sphere_L3Geom],
        [Cp2_FrictMat_FrictPhys(frictAngle=table.frictAngle)],
        [Law2_L6Geom_ElPerfPl()]
    ),
    IntraForce(
    GravityEngine(gravity=(0,0,-9.81)),
    NewtonIntegrator(damping=table.nonviscDamp,kinSplit=True),
    PyRunner(iterPeriod=1,command='addPlotData()'),
]
O.dt=.1*utils.PWaveTimeStep()

def addPlotData():
Exemplo n.º 3
0
# create a few clump configurations by hand
from woo import pack
c1 = pack.SpherePack([((0, 0, 0), .5), ((.5, 0, 0), .5), ((0, .5, 0), .3)])
c2 = pack.SpherePack([((0, 0, 0), .5), ((.7, 0, 0), .3), ((.9, 0, 0), .2)])
sp = pack.SpherePack()
print 'Generated # of clumps:', sp.makeClumpCloud((0, 0, 0), (15, 15, 15),
                                                  [c1, c2],
                                                  periodic=False)
sp.toSimulation()

O.bodies.append(utils.wall(position=0, axis=2))

O.engines = [
    #SubdomainBalancer(),
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),
                           Bo1_Wall_Aabb()]),
    InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),
                     Ig2_Wall_Sphere_ScGeom()],
                    [Ip2_FrictMat_FrictMat_FrictPhys()],
                    [Law2_ScGeom_FrictPhys_CundallStrack()]),
    GravityEngine(gravity=(0, 0, -100)),
    NewtonIntegrator(damping=.4)
]
O.dt = .7 * utils.PWaveTimeStep()
O.saveTmp()
O.step()
Exemplo n.º 4
0
Arquivo: psd.py Projeto: yankang84/woo
# encoding: utf-8
#
# demonstrate how to generate sphere packing based on arbitrary PSD (particle size distribution)
# show the difference between size-based and mass-based (≡ volume-based in our case) PSD
#
import matplotlib
matplotlib.rc('axes', grid=True)
from woo import pack
import pylab
# PSD given as points of piecewise-linear function
psdSizes, psdCumm = [.02, 0.04, 0.045, .05, .06, .08,
                     .12], [0., 0.1, 0.3, 0.3, .3, .7, 1.]
pylab.plot(psdSizes, psdCumm, label='precribed mass PSD')
sp0 = pack.SpherePack()
sp0.makeCloud((0, 0, 0), (1, 1, 1),
              psdSizes=psdSizes,
              psdCumm=psdCumm,
              distributeMass=True)
sp1 = pack.SpherePack()
sp1.makeCloud((0, 0, 0), (1, 1, 1),
              psdSizes=psdSizes,
              psdCumm=psdCumm,
              distributeMass=True,
              num=5000)
sp2 = pack.SpherePack()
sp2.makeCloud((0, 0, 0), (1, 1, 1),
              psdSizes=psdSizes,
              psdCumm=psdCumm,
              distributeMass=True,
              num=20000)
pylab.semilogx(*sp0.psd(bins=30, mass=True),