Beispiel #1
0
def AddBall():
    ball = polyhedra_utils.polyhedralBall(size * 1,
                                          40,
                                          m, (-size * 2.5, 0, size * 7),
                                          mask=1)
    ball.shape.color = (0, 0, 0.9)
    ball.state.vel = (15, 0, 0)
    O.bodies.append(ball)
    checker.dead = True
from yade import export,polyhedra_utils
mat = PolyhedraMat()

O.bodies.append([
	sphere((0,0,0),1),
	sphere((0,3,0),1),
	sphere((0,2,4),2),
	sphere((0,5,2),1.5),
	facet([Vector3(0,-3,-1),Vector3(0,-2,5),Vector3(5,4,0)]),
	facet([Vector3(0,-3,-1),Vector3(0,-2,5),Vector3(-5,4,0)]),
	polyhedra_utils.polyhedra(mat,(1,2,3),0),
	polyhedra_utils.polyhedralBall(2,20,mat,(-2,-2,4)),
])
O.bodies[-1].state.pos = (-2,-2,-2)
O.bodies[-1].state.ori = Quaternion((1,1,2),1)
O.bodies[-2].state.pos = (-2,-2,3)
O.bodies[-2].state.ori = Quaternion((1,2,0),1)

createInteraction(0,1)
createInteraction(0,2)
createInteraction(0,3)
createInteraction(1,2)
createInteraction(1,3)
createInteraction(2,3)

O.step()

vtkExporter = export.VTKExporter('vtkExporterTesting')
vtkExporter.exportSpheres(what=[('dist','b.state.pos.norm()')])
vtkExporter.exportFacets(what=[('pos','b.state.pos')])
vtkExporter.exportInteractions(what=[('kn','i.phys.kn')])
Beispiel #3
0
def AddBall():
	ball = polyhedra_utils.polyhedralBall(size*1, 40, m, (-size*2.5,0,size*7),mask=1)
	ball.shape.color = (0,0,0.9)
	ball.state.vel = (15,0,0)
	O.bodies.append(ball)
	checker.dead = True
Beispiel #4
0
from yade import plot, polyhedra_utils
from yade import qt

m = PolyhedraMat()
m.density = 2600 #kg/m^3 
m.young = 1E6 #Pa
m.poisson = 20000/1E6
m.frictionAngle = 0.6 #rad

maxLoad = 3E6
minLoad = 1E3

O.bodies.append(utils.wall(0,axis=2,sense=1, material = m))

t = polyhedra_utils.polyhedralBall(0.025, 100, m, (0,0,0))
t.state.pos = (0,0,0.5)
O.bodies.append(t)

def checkUnbalanced():   
  print "unbalanced forces = %.5f, position %f, %f, %f"%(utils.unbalancedForce(), t.state.pos[0], t.state.pos[1], t.state.pos[2])
    	
   

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()], 
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], # collision "physics"
      [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]   # contact law -- apply forces
   ),
Beispiel #5
0
from yade import export, polyhedra_utils
mat = PolyhedraMat()

O.bodies.append([
    sphere((0, 0, 0), 1),
    sphere((0, 3, 0), 1),
    sphere((0, 2, 4), 2),
    sphere((0, 5, 2), 1.5),
    facet([Vector3(0, -3, -1),
           Vector3(0, -2, 5),
           Vector3(5, 4, 0)]),
    facet([Vector3(0, -3, -1),
           Vector3(0, -2, 5),
           Vector3(-5, 4, 0)]),
    polyhedra_utils.polyhedra(mat, (1, 2, 3), 0),
    polyhedra_utils.polyhedralBall(2, 20, mat, (-2, -2, 4)),
])
O.bodies[-1].state.pos = (-2, -2, -2)
O.bodies[-1].state.ori = Quaternion((1, 1, 2), 1)
O.bodies[-2].state.pos = (-2, -2, 3)
O.bodies[-2].state.ori = Quaternion((1, 2, 0), 1)

createInteraction(0, 1)
createInteraction(0, 2)
createInteraction(0, 3)
createInteraction(1, 2)
createInteraction(1, 3)
createInteraction(2, 3)

O.step()
Beispiel #6
0
from __future__ import print_function
from yade import plot, polyhedra_utils
from yade import qt

m = PolyhedraMat()
m.density = 2600  #kg/m^3
m.young = 1E6  #Pa
m.poisson = 20000 / 1E6
m.frictionAngle = 0.6  #rad

maxLoad = 3E6
minLoad = 1E3

O.bodies.append(utils.wall(0, axis=2, sense=1, material=m))

t = polyhedra_utils.polyhedralBall(0.025, 100, m, (0, 0, 0))
t.state.pos = (0, 0, 0.5)
O.bodies.append(t)


def checkUnbalanced():
    print("unbalanced forces = %.5f, position %f, %f, %f" %
          (utils.unbalancedForce(), t.state.pos[0], t.state.pos[1],
           t.state.pos[2]))


O.engines = [
    ForceResetter(),
    InsertionSortCollider(
        [Bo1_Polyhedra_Aabb(),
         Bo1_Wall_Aabb(),
vtkP = 100
maxIter = 1e5
vel=0.01
tolerance = 0.05
startPos = 2*sizeB

def printWarning (f_awaited, f_real, n_awaited, n_real):
   print ("The awaited force is %.4f, but obtained force is %.4f; number of bodies: %d vs %d! Iteration %d"%(f_awaited, f_real, n_awaited, n_real, O.iter))

def printSuccess ():
   print ("Checkpoint: force values are OK! Iteration %d"%(O.iter))

mat1 = PolyhedraMat(density=densityIn, young=youngIn,poisson=poissonIn, frictionAngle=frictionIn,IsSplitable=True,strength=1)
O.bodies.append(utils.wall(0,axis=2,sense=1, material = mat1))

t = polyhedra_utils.polyhedralBall(sizeB, 50, mat1, (0,0,0))
t.state.pos = (0.,0.,0.020)
O.bodies.append(t)

topmesh=O.bodies.append(geom.facetBox((0.,0.,startPos),(sizeB,sizeB,0.), material=mat1))

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),
                          Bo1_Wall_Aabb(),
                          Bo1_Facet_Aabb()],
                          verletDist=.05*sizeB),
   InteractionLoop(
      [Ig2_Facet_Polyhedra_PolyhedraGeom(),
       Ig2_Wall_Polyhedra_PolyhedraGeom(),
       Ig2_Polyhedra_Polyhedra_PolyhedraGeom()], 
Beispiel #8
0
from yade import export, polyhedra_utils

mat = PolyhedraMat()

O.bodies.append((polyhedra_utils.polyhedra(mat, (1, 2, 3), 0), polyhedra_utils.polyhedralBall(2, 20, mat, (-2, -2, 4))))
O.bodies[-1].state.pos = (-2, -2, -2)
O.bodies[-1].state.ori = Quaternion((1, 1, 2), 1)
O.bodies[-2].state.pos = (-2, -2, 3)
O.bodies[-2].state.ori = Quaternion((1, 2, 0), 1)

O.step()

O.bodies.append(
    (
        sphere((0, 0, 0), 1),
        sphere((0, 3, 0), 1),
        sphere((0, 2, 4), 2),
        sphere((0, 5, 2), 1.5),
        facet([Vector3(0, -3, -1), Vector3(0, -2, 5), Vector3(5, 4, 0)]),
        facet([Vector3(0, -3, -1), Vector3(0, -2, 5), Vector3(-5, 4, 0)]),
    )
)

for i, j in ((0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)):
    createInteraction(i + 2, j + 2)

vtkExporter = export.VTKExporter("/tmp/vtkExporterTesting")
vtkExporter.exportSpheres(what=[("dist", "b.state.pos.norm()")])
vtkExporter.exportFacets(what=[("pos", "b.state.pos")])
vtkExporter.exportInteractions(what=[("kn", "i.phys.kn")])
vtkExporter.exportContactPoints(what=[("nn", "i.geom.normal")])