Ejemplo n.º 1
0
def randomPeriPack(radius,initSize,rRelFuzz=0.0,memoizeDb=None):
	"""Generate periodic dense packing.

	A cell of initSize is stuffed with as many spheres as possible, then we run periodic compression with PeriIsoCompressor, just like with randomDensePack.

	:param radius: mean sphere radius
	:param rRelFuzz: relative fuzz of sphere radius (equal distribution); see the same param for randomDensePack.
	:param initSize: initial size of the periodic cell.

	:return: SpherePack object, which also contains periodicity information.
	"""
	from math import pi
	from woo import core, dem
	sp=_getMemoizedPacking(memoizeDb,radius,rRelFuzz,initSize[0],initSize[1],initSize[2],fullDim=Vector3(0,0,0),wantPeri=True,fillPeriodic=False,spheresInCell=-1,memoDbg=True)
	if sp: return sp
	#oldScene=O.scene
	S=core.Scene(fields=[dem.DemField()])
	sp=SpherePack()
	S.periodic=True
	S.cell.setBox(initSize)
	sp.makeCloud(Vector3().Zero,S.cell.size0,radius,rRelFuzz,-1,True)
	from woo import log
	log.setLevel('PeriIsoCompressor',log.DEBUG)
	S.engines=[dem.ForceResetter(),dem.InsertionSortCollider([dem.Bo1_Sphere_Aabb()],verletDist=.05*radius),dem.ContactLoop([dem.Cg2_Sphere_Sphere_L6Geom()],[dem.Cp2_FrictMat_FrictPhys()],[dem.Law2_L6Geom_FrictPhys_IdealElPl()],applyForces=True),dem.PeriIsoCompressor(charLen=2*radius,stresses=[-100e9,-1e8],maxUnbalanced=1e-2,doneHook='print "done"; S.stop();',globalUpdateInt=20,keepProportions=True),dem.Leapfrog(damping=.8)]
	mat=dem.FrictMat(young=30e9,tanPhi=.1,ktDivKn=.3,density=1e3)
	for s in sp: S.dem.par.add(utils.sphere(s[0],s[1],mat=mat))
	S.dt=utils.pWaveDt(S)
	#O.timingEnabled=True
	S.run(); S.wait()
	ret=SpherePack()
	ret.fromDem(S,S.dem)
	_memoizePacking(memoizeDb,ret,radius,rRelFuzz,wantPeri=True,fullDim=Vector3(0,0,0)) # fullDim unused
	return ret
Ejemplo n.º 2
0
import time
# change this line to load your reference simulation
O.load2('ref.boost.bin.gz')
base='~sim~'
from woo import log
log.setLevel('Omega',log.WARN)

# http://blogmag.net/blog/read/38/Print_human_readable_file_size
def sizeof_fmt(num):
	for x in ['bytes','KB','MB','GB','TB']:
		if num<1024.0: return "%3.1f%s"%(num,x)
		num/=1024.0


def io(ext,load,noBoost=False):
	t0=time.time()
	f=base+('.woo.' if noBoost else '.boost.')+ext
	((O.load if noBoost else O.load2) if load else (O.save if noBoost else O.save2))(f)
	print ('Loaded' if load else 'Saved '),('woo ' if noBoost else 'boost'),'%-7s '%ext,'%7s'%sizeof_fmt(os.path.getsize(f)),'%.1fs'%(time.time()-t0)
for ext in ['xml','xml.bz2']:
	io(ext,False,True)
	io(ext,True,True)
for ext in ['xml','xml.gz','xml.bz2','bin','bin.gz','bin.bz2']:
	io(ext,False)
	io(ext,True)
Ejemplo n.º 3
0
"""Script that shrinks the periodic cell progressively.
It prints strain and average stress (computed from total volume force)
once in a while."""
from woo import log, timing
log.setLevel("InsertionSortCollider", log.TRACE)
O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_Dem3DofGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
    ),
    NewtonIntegrator(damping=.6, homotheticCellResize=1)
]
import random
for i in xrange(250):
    O.bodies.append(
        utils.sphere(
            Vector3(10 * random.random(), 10 * random.random(),
                    10 * random.random()), .5 + random.random()))
cubeSize = 20
# absolute positioning of the cell is not important
O.periodic = True
O.cell.refSize = (cubeSize, cubeSize, cubeSize)
O.dt = utils.PWaveTimeStep()
O.saveTmp()
from woo import qt
qt.Controller()
qt.View()
O.run(200, True)
Ejemplo n.º 4
0
# coding: utf-8
# 2009 © Václav Šmilauer <*****@*****.**>
"Test and demonstrate use of PeriTriaxController."
from woo import *
from woo import pack, log, qt

log.setLevel('PeriTriaxController', log.TRACE)
O.periodic = True
O.cell.refSize = (.1, .1, .1)
#O.cell.Hsize=Matrix3(0.1,0,0, 0,0.1,0, 0,0,0.1)
sp = pack.SpherePack()
radius = 5e-3
num = sp.makeCloud(
    Vector3.Zero, O.cell.refSize, radius, .2, 500,
    periodic=True)  # min,max,radius,rRelFuzz,spheresInCell,periodic
O.bodies.append([utils.sphere(s[0], s[1]) for s in sp])

O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()],
                          nBins=5,
                          sweepLength=.05 * radius),
    InteractionLoop([Ig2_Sphere_Sphere_Dem3DofGeom()],
                    [Ip2_FrictMat_FrictMat_FrictPhys()],
                    [Law2_Dem3DofGeom_FrictPhys_CundallStrack()]),
    PeriTriaxController(dynCell=True,
                        mass=0.2,
                        maxUnbalanced=0.01,
                        relStressTol=0.02,
                        goal=[-1e4, -1e4, 0],
                        stressMask=3,
Ejemplo n.º 5
0
		S.dt=.5*utils.pWaveDt(S)
		S.run(); S.wait()
		sp=SpherePack(); sp.fromDem(S,S.dem)
		#print 'Resulting cellSize',sp.cellSize,'proportions',sp.cellSize[1]/sp.cellSize[0],sp.cellSize[2]/sp.cellSize[0]
		# repetition to the required cell size will be done below, after memoizing the result
	else:
		raise RuntimError("Aperiodic compression not implemented.")
		assumedFinalDensity=0.6
		V=(4/3)*pi*radius**3; N=assumedFinalDensity*fullDim[0]*fullDim[1]*fullDim[2]/V;
		TriaxialTest(
			numberOfGrains=int(N),radiusMean=radius,radiusStdDev=rRelFuzz,
			# upperCorner is just size ratio, if radiusMean is specified
			upperCorner=fullDim,
			## no need to touch any the following
			noFiles=True,lowerCorner=[0,0,0],sigmaIsoCompaction=1e7,sigmaLateralConfinement=1e3,StabilityCriterion=.05,strainRate=.2,thickness=-1,maxWallVelocity=.1,wallOversizeFactor=1.5,autoUnload=True,autoCompressionActivation=False).load()
		log.setLevel('TriaxialCompressionEngine',log.WARN)
		S.run(); S.wait()
		sp=SpherePack(); sp.fromDem(S,S.dem)
	_memoizePacking(memoizeDb,sp,radius,rRelFuzz,wantPeri,fullDim)
	if wantPeri: sp.cellFill(Vector3(fullDim[0],fullDim[1],fullDim[2]))
	if orientation:
		sp.cellSize=(0,0,0); # reset periodicity to avoid warning when rotating periodic packing
		sp.rotate(*orientation.toAxisAngle())
	return filterSpherePack(predicate,sp,mat=mat,color=color)

def randomPeriPack(radius,initSize,rRelFuzz=0.0,memoizeDb=None):
	"""Generate periodic dense packing.

	A cell of initSize is stuffed with as many spheres as possible, then we run periodic compression with PeriIsoCompressor, just like with randomDensePack.

	:param radius: mean sphere radius
Ejemplo n.º 6
0
# -*- coding: utf-8 -*-
# encoding: utf-8
from __future__ import print_function
from builtins import input
from woo import utils, ymport, qt, plot

from woo import log
log.setLevel('Law2_ScGeom_WirePhys_WirePM',log.TRACE)    # must compile with debug option to get logs 

## definition of some colors for colored text output in terminal
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BLACK = '\033[0m'

#### short description of script
print(BLUE+'''
Simple test for two particles to test the contact law for the WireMat
by unsing the '''+RED+'''StepDisplacer'''+BLUE+''' with loading and unloading.
'''+BLACK)

#### define parameters for the net
# mesh opening size
mos = 80./1000.
a = mos/sqrt(3)
# wire diameter
d = 2.7/1000.
# particle radius
radius = d*5.
# define piecewise lineare stress-strain curve
Ejemplo n.º 7
0
"""Script that shrinks the periodic cell progressively.
It prints strain and average stress (computed from total volume force)
once in a while."""
from woo import log,timing
log.setLevel("InsertionSortCollider",log.TRACE)
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_Dem3DofGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
	),
	NewtonIntegrator(damping=.6,homotheticCellResize=1)
]
import random
for i in xrange(250):
	O.bodies.append(utils.sphere(Vector3(10*random.random(),10*random.random(),10*random.random()),.5+random.random()))
cubeSize=20
# absolute positioning of the cell is not important
O.periodic=True
O.cell.refSize=(cubeSize,cubeSize,cubeSize)
O.dt=utils.PWaveTimeStep()
O.saveTmp()
from woo import qt
qt.Controller(); qt.View()
O.run(200,True)
rate=-1e-3*cubeSize/(O.dt*200)*Matrix3.Identity
O.cell.velGrad=rate
for i in range(0,25):
	O.run(2000,True)
Ejemplo n.º 8
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from woo import *
from woo.core import *
from woo.dem import *
from minieigen import *
from woo import pack,log
import woo
log.setLevel('PeriIsoCompressor',log.DEBUG)

"""Simple script to create tunnel with random dense packing of spheres.
The tunnel is difference between an axis-aligned box and cylinder, or which
axis is going through the bottom wall (-z) of the box.

The tunnel hole is oriented along +y, the face is in the xz plane.

The first you run this scipt, a few minutes is neede to generate the packing. It is
saved in /tmp/triaxPackCache.sqlite and at next time it will be only loaded (fast).
"""
# set some geometry parameters: domain box size, tunnel radius, radius of particles
boxSize=Vector3(5,8,5)
tunnelRad=2
rSphere=.1
# construct spatial predicate as difference of box and cylinder:
# (see scripts/test/pack-predicates.py for details)
pred=pack.inAlignedBox((-.5*boxSize[0],-.5*boxSize[1],0),(.5*boxSize[0],.5*boxSize[1],boxSize[2])) - pack.inCylinder((-.5*boxSize[0],0,0),(.5*boxSize[0],0,0),tunnelRad)
# Use the predicate to generate sphere packing inside 
pack.randomDensePack(pred,radius=rSphere,rRelFuzz=.3,memoizeDb='/tmp/triaxPackCache.sqlite',spheresInCell=3000).toSimulation(woo.master.scene)

from woo import qt
qt.Controller()
Ejemplo n.º 9
0
import time
# change this line to load your reference simulation
O.load2('ref.boost.bin.gz')
base='~sim~'
from woo import log
log.setLevel('Omega',log.WARN)

# http://blogmag.net/blog/read/38/Print_human_readable_file_size
def sizeof_fmt(num):
    for x in ['bytes','KB','MB','GB','TB']:
        if num<1024.0: return "%3.1f%s"%(num,x)
        num/=1024.0


def io(ext,load,noBoost=False):
    t0=time.time()
    f=base+('.woo.' if noBoost else '.boost.')+ext
    ((O.load if noBoost else O.load2) if load else (O.save if noBoost else O.save2))(f)
    print(('Loaded' if load else 'Saved '),('woo ' if noBoost else 'boost'),'%-7s '%ext,'%7s'%sizeof_fmt(os.path.getsize(f)),'%.1fs'%(time.time()-t0))
for ext in ['xml','xml.bz2']:
    io(ext,False,True)
    io(ext,True,True)
for ext in ['xml','xml.gz','xml.bz2','bin','bin.gz','bin.bz2']:
    io(ext,False)
    io(ext,True)
Ejemplo n.º 10
0
# encoding: utf-8
# 2011 © Bruno Chareyre <*****@*****.**>
# Check the result of a triaxial test on a dense 100 spheres packing with position defined,
# comparing stresses at the "peak" state. The initial positions have been generated by
# internal compaction without friction, so that it is initially at equilibrium without shear forces. 
# Positions and reference results are in dataTriax folder.
from woo import pack,log,utils,export,plot
import math,os,sys
log.setLevel('TriaxialCompressionEngine',log.ERROR)

tolerance=0.01
interactive=False
errors=0
tt=TriaxialTest(internalCompaction=True,numberOfGrains=100,compactionFrictionDeg=0,sphereFrictionDeg=30,importFilename=checksPath+'/dataTriax/checkTestTriax.spheres')
tt.generate("checkTest.woo")
O.load("checkTest.woo")
O.run(2020,True)
if interactive:
    print O.engines[4].stress(0)[1],O.engines[4].stress(1)[1], O.engines[4].stress(2)[0], O.engines[4].stress(3)[0], O.engines[4].stress(4)[2], O.engines[4].stress(5)[2]
    os.system('gnuplot -e "plot \'./WallStresses\' using 1:3; replot'+checksPath+'\'/data/WallStressesCheckTest\' using 1:3; replot '+checksPath+'\'/data/WallStresses\' using 1:4; replot '+checksPath+'\'/data/WallStressesCheckTest\' using 1:4; pause -1"')

if abs((O.engines[4].stress(1)[1]-107157.2)/107157.2)>tolerance :
    print "Triaxial checkTest: difference on peak stress"
    errors+=1
if abs((O.engines[4].stress(3)[0]-50058.7)/50058.7)>tolerance :
    print "Triaxial checkTest: difference on peak stress"
    errors+=1

if (errors):
    resultStatus +=1    #Test is failed
Ejemplo n.º 11
0
# encoding: utf-8
# 2011 © Bruno Chareyre <*****@*****.**>
# Check the result of a triaxial test on a dense 100 spheres packing with position defined,
# comparing stresses at the "peak" state. The initial positions have been generated by
# internal compaction without friction, so that it is initially at equilibrium without shear forces.
# Positions and reference results are in dataTriax folder.
from woo import pack, log, utils, export, plot
import math, os, sys
log.setLevel('TriaxialCompressionEngine', log.ERROR)

tolerance = 0.01
interactive = False
errors = 0
tt = TriaxialTest(internalCompaction=True,
                  numberOfGrains=100,
                  compactionFrictionDeg=0,
                  sphereFrictionDeg=30,
                  importFilename=checksPath +
                  '/dataTriax/checkTestTriax.spheres')
tt.generate("checkTest.woo")
O.load("checkTest.woo")
O.run(2020, True)
if interactive:
    print(O.engines[4].stress(0)[1], O.engines[4].stress(1)[1],
          O.engines[4].stress(2)[0], O.engines[4].stress(3)[0],
          O.engines[4].stress(4)[2], O.engines[4].stress(5)[2])
    os.system('gnuplot -e "plot \'./WallStresses\' using 1:3; replot' +
              checksPath +
              '\'/data/WallStressesCheckTest\' using 1:3; replot ' +
              checksPath + '\'/data/WallStresses\' using 1:4; replot ' +
              checksPath +
Ejemplo n.º 12
0
O.periodic=True
O.cell.refSize=(20,20,10)
from woo import pack,log,timing
O.materials.append(FrictMat(young=30e9,density=2400))
p=pack.SpherePack()
p.makeCloud(Vector3().ZERO,O.cell.refSize,1,.5,700,True)
for sph in p:
	O.bodies.append(utils.sphere(sph[0],sph[1]))

log.setLevel("PeriIsoCompressor",log.DEBUG)
O.timingEnabled=True
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_Dem3DofGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
	),
	PeriIsoCompressor(charLen=.5,stresses=[-50e9,-1e8],doneHook="print 'FINISHED'; O.pause() ",keepProportions=True),
	NewtonIntegrator(damping=.4,homotheticCellResize=1)
]
O.dt=utils.PWaveTimeStep()
O.saveTmp()
print O.cell.refSize
from woo import qt; qt.Controller(); qt.View()
O.run()
O.wait()
timing.stats()
#while True:
#	O.step()
Ejemplo n.º 13
0
O.periodic = True
O.cell.refSize = (20, 20, 10)
from woo import pack, log, timing
O.materials.append(FrictMat(young=30e9, density=2400))
p = pack.SpherePack()
p.makeCloud(Vector3().ZERO, O.cell.refSize, 1, .5, 700, True)
for sph in p:
    O.bodies.append(utils.sphere(sph[0], sph[1]))

log.setLevel("PeriIsoCompressor", log.DEBUG)
O.timingEnabled = True
O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_Dem3DofGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
    ),
    PeriIsoCompressor(charLen=.5,
                      stresses=[-50e9, -1e8],
                      doneHook="print 'FINISHED'; O.pause() ",
                      keepProportions=True),
    NewtonIntegrator(damping=.4, homotheticCellResize=1)
]
O.dt = utils.PWaveTimeStep()
O.saveTmp()
print O.cell.refSize
from woo import qt
qt.Controller()
qt.View()
Ejemplo n.º 14
0
# coding: utf-8
# 2009 © Václav Šmilauer <*****@*****.**>
"Test and demonstrate use of PeriTriaxController."
from woo import *
from woo import pack,log,qt
log.setLevel('PeriTriaxController',log.TRACE)
O.periodic=True
O.cell.refSize=(.1,.1,.1)
#O.cell.Hsize=Matrix3(0.1,0,0, 0,0.1,0, 0,0,0.1)
sp=pack.SpherePack()
radius=5e-3
num=sp.makeCloud(Vector3().Zero,O.cell.refSize,radius,.2,500,periodic=True) # min,max,radius,rRelFuzz,spheresInCell,periodic
O.bodies.append([utils.sphere(s[0],s[1]) for s in sp])


O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb()],nBins=5,sweepLength=.05*radius),
	InteractionLoop(
		[Ig2_Sphere_Sphere_Dem3DofGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()]
	),
	#PeriTriaxController(maxUnbalanced=0.01,relStressTol=0.02,goal=[-1e4,-1e4,0],stressMask=3,globUpdate=5,maxStrainRate=[1.,1.,1.],doneHook='triaxDone()',label='triax'),
	#using cell inertia
	PeriTriaxController(dynCell=True,mass=0.2,maxUnbalanced=0.01,relStressTol=0.02,goal=(-1e4,-1e4,0),stressMask=3,globUpdate=5,maxStrainRate=(1.,1.,1.),doneHook='triaxDone()',label='triax'),
	NewtonIntegrator(damping=.2,homotheticCellResize=True),
]
O.dt=utils.PWaveTimeStep()
O.run();
qt.View()
Ejemplo n.º 15
0
qt.Controller()
qt.View()


O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_Dem3DofGeom(),Ig2_Facet_Sphere_Dem3DofGeom(),Ig2_Wall_Sphere_Dem3DofGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
    ),
    GravityEngine(gravity=[1e2,1e2,1e2]),
    NewtonIntegrator(damping=0.01),
    ]

O.dt=utils.PWaveTimeStep()
O.save('/tmp/a.xml')
O.saveTmp()

from woo import log
log.setLevel('Ig2_Wall_Sphere_Dem3DofGeom',log.TRACE)

O.run()
#O.bodies.append([
#    utils.facet([[-1,-1,0],[1,-1,0],[0,1,0]],dynamic=False,color=[1,0,0],young=1e3),
#    utils.facet([[1,-1,0],[0,1,0,],[1,.5,.5]],dynamic=False,young=1e3)
#])
#import random

Ejemplo n.º 16
0
from woo import pack, log, timing, utils
log.setLevel("SubdomainBalancer", log.INFO)
#log.setLevel("BodyContainer",log.TRACE)
utils.readParamsFromTable(noTableOk=True, num=12000)
import woo.params.table
sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (1, 1, 1),
             .03 * ((12000. / woo.params.table.num)**(1 / 3.)), .5)
sp.toSimulation()
O.bodies.append(utils.wall((0, 0, 0), axis=2))
O.bodies.append(utils.wall((0, 0, 0), axis=1))
#O.bodies.append(utils.wall((0,0,0),axis=0))
#O.bodies.append(utils.wall((0,2,0),axis=1))
#O.bodies.append(utils.wall((2,0,0),axis=0))
O.engines = ([
    SubdomainBalancer(axesOrder='xyz', colorize=True)
] if 'SubdomainBalancer' in dir() else []) + [
    ForceResetter(),
    InsertionSortCollider(
        [Bo1_Sphere_Aabb(), Bo1_Wall_Aabb()], sweepLength=.05 * .05),
    InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),
                     Ig2_Wall_Sphere_ScGeom()],
                    [Ip2_FrictMat_FrictMat_FrictPhys()],
                    [Law2_ScGeom_FrictPhys_CundallStrack()]),
    GravityEngine(gravity=(0, 0, -10)),
    NewtonIntegrator(),
    #PyRunner(iterPeriod=5000,command='O.pause(); timing.stats();')
]
O.dt = utils.PWaveTimeStep()
O.timingEnabled = True
#O.step(); #O.run(10000,True)
Ejemplo n.º 17
0
# -*- coding: utf-8 -*-
# encoding: utf-8
from __future__ import print_function
from builtins import input
from woo import utils, ymport, qt, plot

from woo import log
log.setLevel('Law2_ScGeom_WirePhys_WirePM',
             log.TRACE)  # must compile with debug option to get logs

## definition of some colors for colored text output in terminal
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BLACK = '\033[0m'

#### short description of script
print(BLUE + '''
Simple test for two particles to test the contact law for the WireMat
by unsing the ''' + RED + '''StepDisplacer''' + BLUE +
      ''' with loading and unloading.
''' + BLACK)

#### define parameters for the net
# mesh opening size
mos = 80. / 1000.
a = mos / sqrt(3)
# wire diameter
d = 2.7 / 1000.
# particle radius
Ejemplo n.º 18
0
from woo import pack,log,timing,utils
log.setLevel("SubdomainBalancer",log.INFO)
#log.setLevel("BodyContainer",log.TRACE)
utils.readParamsFromTable(noTableOk=True,num=12000)
import woo.params.table
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),.03*((12000./woo.params.table.num)**(1/3.)),.5)
sp.toSimulation()
O.bodies.append(utils.wall((0,0,0),axis=2))
O.bodies.append(utils.wall((0,0,0),axis=1))
#O.bodies.append(utils.wall((0,0,0),axis=0))
#O.bodies.append(utils.wall((0,2,0),axis=1))
#O.bodies.append(utils.wall((2,0,0),axis=0))
O.engines=([SubdomainBalancer(axesOrder='xyz',colorize=True)] if 'SubdomainBalancer' in dir() else [])+[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Wall_Aabb()],sweepLength=.05*.05),
	InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_ScGeom_FrictPhys_CundallStrack()]),
	GravityEngine(gravity=(0,0,-10)),
	NewtonIntegrator(),
	#PyRunner(iterPeriod=5000,command='O.pause(); timing.stats();')
]
O.dt=utils.PWaveTimeStep()
O.timingEnabled=True
#O.step(); #O.run(10000,True)
timing.stats()
from woo import qt
qt.View()
#O.step()
#O.run(5000,True)
Ejemplo n.º 19
0
""" Playground for tuning collider strides depending on maximum velocity. """

from woo import timing,log
import os.path
loadFrom='/tmp/triax.xml'
#if not os.path.exists(loadFrom):
TriaxialTest(numberOfGrains=2000,noFiles=True).generate(loadFrom)
O.load(loadFrom)
log.setLevel('TriaxialCompressionEngine',log.WARN) # shut up
log.setLevel('InsertionSortCollider',log.DEBUG)

collider=utils.typedEngine('InsertionSortCollider')
newton=utils.typedEngine('NewtonIntegrator')

# use striding; say "if 0:" to disable striding and compare to regular runs
if 1:
	# length by which bboxes will be made larger
	collider.sweepLength=.2*O.bodies[100].shape.radius
	# if this is enabled, bboxes will be enlarged based on velocity bin for each body
	if 1:
		collider.nBins=3
		collider.binCoeff=10
		log.setLevel('VelocityBins',log.DEBUG)

O.step() # filter out initialization
O.timingEnabled=True
totalTime=0
# run a few times 500 steps, show timings to see what is the trend
# notably, the percentage of collider time should decrease as the max velocity decreases as well
for i in range(0,5):
	O.run(1000,True)
Ejemplo n.º 20
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from woo import *
from woo.core import *
from woo.dem import *
from minieigen import *
from woo import pack, log
import woo
log.setLevel('PeriIsoCompressor', log.DEBUG)
"""Simple script to create tunnel with random dense packing of spheres.
The tunnel is difference between an axis-aligned box and cylinder, or which
axis is going through the bottom wall (-z) of the box.

The tunnel hole is oriented along +y, the face is in the xz plane.

The first you run this scipt, a few minutes is neede to generate the packing. It is
saved in /tmp/triaxPackCache.sqlite and at next time it will be only loaded (fast).
"""
# set some geometry parameters: domain box size, tunnel radius, radius of particles
boxSize = Vector3(5, 8, 5)
tunnelRad = 2
rSphere = .1
# construct spatial predicate as difference of box and cylinder:
# (see scripts/test/pack-predicates.py for details)
pred = pack.inAlignedBox(
    (-.5 * boxSize[0], -.5 * boxSize[1], 0),
    (.5 * boxSize[0], .5 * boxSize[1], boxSize[2])) - pack.inCylinder(
        (-.5 * boxSize[0], 0, 0), (.5 * boxSize[0], 0, 0), tunnelRad)
# Use the predicate to generate sphere packing inside
pack.randomDensePack(pred,
                     radius=rSphere,