예제 #1
0
    utils.sphere([0,0,2],.5,color=(0,1,0))
])
O.bodies[1].state['vel']=Vector3(0,0,-1)
O.dt=utils.PWaveTimeStep()

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()],label='isc'),
    InteractionLoop(
        [Ig2_Facet_Sphere_Dem3DofGeom(),Ig2_Sphere_Sphere_Dem3DofGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
    ),
    GravityEngine(gravity=[0,0,-100]),
    NewtonIntegrator(damping=0)
]

from woo import timing,qt,log
try:
    renderer=qt.Renderer()
    renderer['Body_bounding_volume']=True
    qt.Controller(); qt.View()
except ImportError: pass

O.timingEnabled=True
isc['sweepLength']=.1
isc['nBins']=5
#log.setLevel('InsertionSortCollider',log.DEBUG)
O.saveTmp()
O.step()
예제 #2
0
             random.gauss(0, 1),
             random.uniform(1, 2)],
            random.uniform(.02, .05),
            velocity=[
                random.gauss(0, .1),
                random.gauss(0, .1),
                random.gauss(0, .1)
            ]))


for i in range(0, 100):
    addRandomSphere()

O.dt = 1e-4
#O.run()
O.saveTmp('init')
from woo import qt
qt.Controller()
qt.View()
if 1:
    for i in range(0, 1000):
        O.run(50, True)
        if random.choice([True, False]):
            idOld = random.randint(2, len(O.bodies) - 1)
            O.bodies.erase(idOld)
            print "-%d" % idOld,
        else:
            idNew = addRandomSphere()
            print "+%d" % idNew,
        sys.stdout.flush()
예제 #3
0
	#	(-.02,.1,.1),(-.02,-.1,.1),(-.02,-.1,-.1),(-.02,.1,-.1),(-.02,.1,.1), # go in square in the shear plane without changing normal deformation
	#	(-1e-4,0,0) # back to the origin, but keep some overlap to not delete the interaction
	#	],pathSteps=[100],doneHook='tester.dead=True; O.pause()',label='tester',rotWeight=.2,idWeight=.2),
	NewtonIntegrator(),
	PyRunner(iterPeriod=1,command='addPlotData()'),
]

def addPlotData():
	i=O.interactions[0,1]
	plot.addData(
		un=tester.uTest[0],us1=tester.uTest[1],us2=tester.uTest[2],
		ung=tester.uGeom[0],us1g=tester.uGeom[1],us2g=tester.uGeom[2],
		phiX=tester.uTest[3],phiY=tester.uTest[4],phiZ=tester.uTest[5],
		phiXg=tester.uGeom[3],phiYg=tester.uGeom[4],phiZg=tester.uGeom[5],
		i=O.iter,Fs=i.phys.shearForce.norm(),Fn=i.phys.normalForce.norm(),Tx=O.forces.t(0)[0],Tyz=sqrt(O.forces.t(0)[1]**2+O.forces.t(0)[2]**2)
	)
plot.plots={'us1':('us2',),'Fn':('Fs',),'i':('un','us1','us2'),' i':('Fs','Fn','Tx','Tyz'),'  i':('ung','us1g','us2g'),'i  ':('phiX','phiXg','phiY','phiYg','phiZ','phiZg')}  #'ung','us1g','us2g'
plot.plot(subPlots=True)

try:
	from woo import qt
	qt.Controller(); v=qt.View()
	rr=qt.Renderer()
	rr.extraDrawers=[GlExtra_LawTester()]
	rr.intrGeom=True
except ImportError: pass
O.dt=1

O.saveTmp()
#O.run()