Esempio n. 1
0
def Step():
    from yade import polyhedra_utils, export
    global stepnum
    vim = min(
        [b.state.vel[2] for b in O.bodies if isinstance(b.shape, Polyhedra)])
    if O.iter < 500: return
    if vim < -0.05: return
    if stepnum == 1:
        pmax = max([
            b.state.pos[2] for b in O.bodies if isinstance(b.shape, Polyhedra)
        ]) + 0.036
        lp = polyhedra_utils.polyhedra(
            matP,
            v=((0.175, 0.175, pmax), (0.395, 0.175, pmax),
               (0.395, 0.395, pmax), (0.175, 0.395, pmax),
               (0.175, 0.175, pmax + 0.02), (0.395, 0.175, pmax + 0.02),
               (0.395, 0.395, pmax + 0.02), (0.175, 0.395, pmax + 0.02)),
            fixed=False,
            color=(0.6, 0.6, 0.6))
        O.bodies.append(lp)
        lpnum = O.bodies[-1].id
        O.bodies[lpnum].state.blockedDOFs = 'xyXYZ'
        O.bodies[lpnum].state.vel = (0, 0, -0.01)
        stepnum = stepnum + 1
    elif stepnum == 2:
        lpnum = O.bodies[-1].id
        plateforce = O.forces.f(lpnum)[2]
        if plateforce < 1: return
        O.bodies[lpnum].state.vel = (0, 0, 0)
        export.textPolyhedra('/tmp/surf7-polyhedra.dat')
        O.pause()
Esempio n. 2
0
def textPolyhedra(fileName,
                  material,
                  shift=Vector3.Zero,
                  scale=1.0,
                  orientation=Quaternion((0, 1, 0), 0.0),
                  **kw):
    from yade import polyhedra_utils
    """Load polyhedra from a text file.
	
	:param str filename: file name
	:param [float,float,float] shift: [X,Y,Z] parameter moves the specimen.
	:param float scale: factor scales the given data.
	:param quaternion orientation:  orientation of the imported polyhedra
	:param \*\*kw: (unused keyword arguments) is passed to :yref:`yade.polyhedra_utils.polyhedra`
	:returns: list of polyhedras.

	Lines starting with # are skipped
	"""
    infile = open(fileName, "r")
    lines = infile.readlines()
    infile.close()
    ret = []
    i = -1
    while (i < (len(lines) - 1)):
        i += 1
        line = lines[i]
        data = line.split()
        if (data[0][0] == "#"): continue

        if (len(data) != 3):
            raise RuntimeError(
                "Check polyhedra input file! Number of parameters in the first line is not 3!"
            )
        else:
            vertLoad = []
            ids = int(data[0])
            verts = int(data[1])
            surfs = int(data[2])
            i += 1
            for d in range(verts):
                dataV = lines[i].split()
                pos = orientation * Vector3(
                    float(dataV[0]) * scale,
                    float(dataV[1]) * scale,
                    float(dataV[2]) * scale) + shift
                vertLoad.append(pos)
                i += 1
            polR = polyhedra_utils.polyhedra(material=material,
                                             v=vertLoad,
                                             **kw)
            if (polR != -1):
                ret.append(polR)
            i = i + surfs - 1
    return ret
Esempio n. 3
0
File: ymport.py Progetto: yade/trunk
def textPolyhedra(fileName,material,shift=Vector3.Zero,scale=1.0,orientation=Quaternion((0,1,0),0.0),**kw):
	from yade import polyhedra_utils
	"""Load polyhedra from a text file.
	
	:param str filename: file name
	:param [float,float,float] shift: [X,Y,Z] parameter moves the specimen.
	:param float scale: factor scales the given data.
	:param quaternion orientation:  orientation of the imported polyhedra
	:param \*\*kw: (unused keyword arguments) is passed to :yref:`yade.polyhedra_utils.polyhedra`
	:returns: list of polyhedras.

	Lines starting with # are skipped
	"""
	infile = open(fileName,"r")
	lines = infile.readlines()
	infile.close()
	ret=[]
	i=-1
	while (i < (len(lines)-1)):
		i+=1
		line = lines[i]
		data = line.split()
		if (data[0][0] == "#"): continue
		
		if (len(data)!=3):
			raise RuntimeError("Check polyhedra input file! Number of parameters in the first line is not 3!");
		else:
			vertLoad = []
			ids = int(data[0])
			verts = int(data[1])
			surfs = int(data[2])
			i+=1
			for d in range(verts):
				dataV = lines[i].split()
				pos = orientation*Vector3(float(dataV[0])*scale,float(dataV[1])*scale,float(dataV[2])*scale)+shift
				vertLoad.append(pos)
				i+=1
			polR = polyhedra_utils.polyhedra(material=material,v=vertLoad,**kw)
			if (polR != -1):
				ret.append(polR)
			i= i + surfs - 1
	return ret
Esempio n. 4
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()

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')])
Esempio n. 5
0
topmesh = O.bodies.append(
    geom.facetBox((0., 0., startPos), (sizeB / 2.0, sizeB / 2.0, 0.),
                  material=mat1))
leftmesh = O.bodies.append(
    geom.facetBox((0., sizeB / 2.0, sizeB / 2.0),
                  (sizeB / 2.0, 0., sizeB / 2.0),
                  material=mat1))
backmesh = O.bodies.append(
    geom.facetBox((sizeB / 2.0, 0., sizeB / 2.0),
                  (0., sizeB / 2.0, sizeB / 2.0),
                  material=mat1))

vertices = [[0, 0, 0], [sizeB, 0, 0], [sizeB, sizeB, 0], [sizeB, sizeB, sizeB],
            [0, sizeB, 0], [0, sizeB, sizeB], [0, 0, sizeB], [sizeB, 0, sizeB]]
t = polyhedra_utils.polyhedra(mat1, v=vertices, fixed=True)
t.state.pos = (0, 0, sizeB / 2)
O.bodies.append(t)
"""
i1 = ymport.textPolyhedra('new2.poly',shift=[0.012, 0.018, 0.0],material=mat1)
importedStones = O.bodies.append(i1[1])
"""

O.engines = [
    ForceResetter(),
    InsertionSortCollider(
        [Bo1_Polyhedra_Aabb(),
         Bo1_Wall_Aabb(),
         Bo1_Facet_Aabb()],
        verletDist=.05 * sizeB),
    InteractionLoop([
Esempio n. 6
0
gravel.Kn = 1E7 #Pa
gravel.frictionAngle = 0.5 #rad

steel = PolyhedraMat()
steel.density = 7850 #kg/m^3 
steel.Ks = 10*gravel.Ks
steel.Kn = 10*gravel.Kn
steel.frictionAngle = 0.4 #rad

rubber = PolyhedraMat()
rubber.density = 1000 #kg/m^3 
rubber.Ks = gravel.Ks/10
rubber.Kn = gravel.Kn/10
rubber.frictionAngle = 0.7 #rad

O.bodies.append(polyhedra_utils.polyhedra(gravel,v=((0,0,-0.05),(0.3,0,-0.05),(0.3,0.3,-0.05),(0,0.3,-0.05),(0,0,0),(0.3,0,0),(0.3,0.3,0),(0,0.3,0)),fixed=True, color=(0.35,0.35,0.35)))
#O.bodies.append(utils.wall(0,axis=1,sense=1, material = gravel))
#O.bodies.append(utils.wall(0,axis=0,sense=1, material = gravel))
#O.bodies.append(utils.wall(0.3,axis=1,sense=-1, material = gravel))
#O.bodies.append(utils.wall(0.3,axis=0,sense=-1, material = gravel))

polyhedra_utils.fillBox((0,0,0), (0.3,0.3,0.3),gravel,sizemin=[0.025,0.025,0.025],sizemax=[0.05,0.05,0.05],seed=4)

def checkUnbalancedI():   
    print "iter %d, time elapsed %f,  time step %.5e, unbalanced forces = %.5f"%(O.iter, O.realtime, O.dt, utils.unbalancedForce())		

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()], 
Esempio n. 7
0
from yade import plot, polyhedra_utils
from yade import qt

m = PolyhedraMat()
O.materials.append(m)

t1,t2 = [polyhedra_utils.polyhedra(m,size=(1,1,1),seed=i) for i in (5,6)]
O.bodies.append((t1,t2))
t2.state.pos = (3,0,0)
t2.state.vel = (-1,0,0)

factor = 2
O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor)]),
   InteractionLoop(
      [Ig2_Polyhedra_Polyhedra_PolyhedraGeom(interactionDetectionFactor=factor)],
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
      [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]
   ),
   NewtonIntegrator(),
]

O.dt=0.00001

try: qt.View()
except: pass
Esempio n. 8
0
#


# create box with free top, and ceate loose packing inside the box
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

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

t = polyhedra_utils.polyhedra(m,size = (0.06,0.06,0.06),seed = 5)
t.state.pos = (0.,0.,0.5)
O.bodies.append(t)

def checkUnbalanced():   
   # at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing is stable
   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"
Esempio n. 9
0
# $ yade-batch --job-threads=1 03-oedometric-test.table 03-oedometric-test.py
#

# create box with free top, and ceate loose packing inside the box
from yade import plot, polyhedra_utils
from yade import qt

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

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

t = polyhedra_utils.polyhedra(m, size=(0.06, 0.06, 0.06), seed=5)
t.state.pos = (0., 0., 0.5)
O.bodies.append(t)


def checkUnbalanced():
    # at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing is stable
    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(),
from yade import plot, polyhedra_utils
from yade import qt

m = PolyhedraMat()
O.materials.append(m)

t1, t2 = [polyhedra_utils.polyhedra(m, size=(1, 1, 1), seed=i) for i in (5, 6)]
O.bodies.append((t1, t2))
t2.state.pos = (3, 0, 0)
t2.state.vel = (-1, 0, 0)

factor = 2
O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor)]),
    InteractionLoop([
        Ig2_Polyhedra_Polyhedra_PolyhedraGeom(
            interactionDetectionFactor=factor)
    ], [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
                    [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]),
    NewtonIntegrator(),
]

O.dt = 0.00001

try:
    qt.View()
except:
    pass
Esempio n. 11
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()
Esempio n. 12
0
from yade import polyhedra_utils
import random

polyMat = PolyhedraMat(young=1e10, poisson=.05)
frictMat = FrictMat(young=1e9, poisson=.2)

O.materials.append((polyMat, frictMat))

poly = polyhedra_utils.polyhedra(polyMat, (1, 2, 3))
poly.wire = False
sph1 = sphere((2, 2, 2), .5, material=frictMat)
sph2 = sphere((-2, 0, 0), .5, material=frictMat)
sph3 = sphere((0, -2, 0), .5, material=frictMat)
O.bodies.append((poly, sph1, sph2, sph3))

O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Polyhedra_Aabb(),
                           Bo1_Sphere_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Polyhedra_ScGeom()],
        [Ip2_FrictMat_PolyhedraMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()],
    ),
    NewtonIntegrator(),
]

O.dt = 1e-7
O.step()

poly.state.blockedDOFs = 'xyzXYZ'
Esempio n. 13
0
from yade import polyhedra_utils
import random

polyMat  = PolyhedraMat(young=1e10,poisson=.05)
frictMat = FrictMat(young=1e9,poisson=.2)

O.materials.append((polyMat,frictMat))

poly = polyhedra_utils.polyhedra(polyMat,(1,2,3)); poly.wire=False
sph1 = sphere((2,2,2),.5,material=frictMat)
sph2 = sphere((-2,0,0),.5,material=frictMat)
sph3 = sphere((0,-2,0),.5,material=frictMat)
O.bodies.append((
	poly,
	sph1,
	sph2,
	sph3
))
	
O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Sphere_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Polyhedra_ScGeom()], 
      [Ip2_FrictMat_PolyhedraMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()],
   ),
   NewtonIntegrator(),
]

O.dt = 1e-7
Esempio n. 14
0
gravel1 = PolyhedraMat()
gravel1.IsSplitable = True
gravel1.strength = 1e0
gravel2 = PolyhedraMat()
gravel2.IsSplitable = True
gravel2.strength = 2e0
gravel3 = PolyhedraMat()
gravel3.IsSplitable = True
gravel3.strength = 4e0

steel = PolyhedraMat()
steel.young = 1e10

d = 0.05
p1 = polyhedra_utils.polyhedra(gravel1, size=(d, d, d), seed=1)
p2 = polyhedra_utils.polyhedra(gravel2, size=(d, d, d), seed=1)
p3 = polyhedra_utils.polyhedra(gravel3, size=(d, d, d), seed=1)
p2.state.pos = (2 * d, 0, 0)
p3.state.pos = (4 * d, 0, 0)
p2.state.ori = p3.state.ori = p1.state.ori

d = 0.035
w1 = utils.wall(+d, axis=1, sense=-1, material=steel)
w2 = utils.wall(-d, axis=1, sense=+1, material=steel)
v = 5e-1
w1.state.vel = (0, -v, 0)
w2.state.vel = (0, +v, 0)
O.bodies.append((p1, p2, p3, w1, w2))

O.engines = [
Esempio n. 15
0
import numpy as np
import random
from yade import polyhedra_utils

m = PolyhedraMat()
m.density = 1000  
m.Ks = 5E6
m.Kn = 5E8 
m.frictionAngle = 0.7 

size = 0.1;
vertices = [[0,0,0],[size,0,0],[size,size,0],[size,size,size],[0,size,0],[0,size,size],[0,0,size],[size,0,size]]

for i in range(0,10):	
	for j in range(0,10):
		t = polyhedra_utils.polyhedra(m,v=vertices)
		t.state.pos = (0,(i+0.5)*size-5*size,(j+0.5)*size*1)
		O.bodies.append(t)
	
	

qt.Controller()
V = qt.View()
V.screenSize = (750,550)
V.sceneRadius = 1
V.eyePosition = (-1.5,1.5,0.5)
V.lookAt = (0,-0.5,0)
V.upVector = (0,0,1)


O.bodies.append(utils.wall(0,axis=2,sense=1,material=m))
Esempio n. 16
0
steel = PolyhedraMat()
steel.density = 7850  #kg/m^3
steel.young = 10 * gravel.young
steel.poisson = gravel.poisson
steel.frictionAngle = 0.4  #rad

rubber = PolyhedraMat()
rubber.density = 1000  #kg/m^3
rubber.young = gravel.young / 10
rubber.poisson = gravel.poisson
rubber.frictionAngle = 0.7  #rad

O.bodies.append(
    polyhedra_utils.polyhedra(gravel,
                              v=((0, 0, -0.05), (0.3, 0, -0.05),
                                 (0.3, 0.3, -0.05), (0, 0.3, -0.05), (0, 0, 0),
                                 (0.3, 0, 0), (0.3, 0.3, 0), (0, 0.3, 0)),
                              fixed=True,
                              color=(0.35, 0.35, 0.35)))
#O.bodies.append(utils.wall(0,axis=1,sense=1, material = gravel))
#O.bodies.append(utils.wall(0,axis=0,sense=1, material = gravel))
#O.bodies.append(utils.wall(0.3,axis=1,sense=-1, material = gravel))
#O.bodies.append(utils.wall(0.3,axis=0,sense=-1, material = gravel))

polyhedra_utils.fillBox((0, 0, 0), (0.3, 0.3, 0.3),
                        gravel,
                        sizemin=[0.025, 0.025, 0.025],
                        sizemax=[0.05, 0.05, 0.05],
                        seed=4)


def checkUnbalancedI():
Esempio n. 17
0
   Wei_m=Wei_m, Wei_S0 = Wei_S0, Wei_V0=Wei_V0, Wei_P=Wei_P)

#O.bodies.append(utils.wall(0,axis=2,sense=1,        color=[0,1,1], material = mat1))
#O.bodies.append(utils.wall(-sizeB/2,axis=1,sense=1, color=[0,1,1], material = mat1))
#O.bodies.append(utils.wall(-sizeB/2,axis=0,sense=1, color=[0,1,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/2.0,sizeB/2.0,0.),material=mat1))
leftmesh = O.bodies.append(geom.facetBox((0.,sizeB/2.0,sizeB/2.0),(sizeB/2.0,0.,sizeB/2.0),material=mat1))
backmesh = O.bodies.append(geom.facetBox((sizeB/2.0,0.,sizeB/2.0),(0.,sizeB/2.0,sizeB/2.0),material=mat1))

vertices = [[0,0,0],[sizeB,0,0],[sizeB,sizeB,0],[sizeB,sizeB,sizeB],[0,sizeB,0],[0,sizeB,sizeB],[0,0,sizeB],[sizeB,0,sizeB]]
t = polyhedra_utils.polyhedra(mat1,v=vertices, fixed=True)
t.state.pos = (0,0,sizeB/2)
O.bodies.append(t)

"""
i1 = ymport.textPolyhedra('new2.poly',shift=[0.012, 0.018, 0.0],material=mat1)
importedStones = O.bodies.append(i1[1])
"""

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),
                          Bo1_Wall_Aabb(),
                          Bo1_Facet_Aabb()],
                          verletDist=.05*sizeB),
   InteractionLoop(
Esempio n. 18
0
gravel1 = PolyhedraMat()
gravel1.IsSplitable = True
gravel1.strength = 1e0
gravel2 = PolyhedraMat()
gravel2.IsSplitable = True
gravel2.strength = 2e0
gravel3 = PolyhedraMat()
gravel3.IsSplitable = True
gravel3.strength = 4e0

steel = PolyhedraMat()
steel.young = 1e10

d = .05
p1 = polyhedra_utils.polyhedra(gravel1, size=(d, d, d), seed=1)
p2 = polyhedra_utils.polyhedra(gravel2, size=(d, d, d), seed=1)
p3 = polyhedra_utils.polyhedra(gravel3, size=(d, d, d), seed=1)
p2.state.pos = (2 * d, 0, 0)
p3.state.pos = (4 * d, 0, 0)
p2.state.ori = p3.state.ori = p1.state.ori

d = .035
w1 = utils.wall(+d, axis=1, sense=-1, material=steel)
w2 = utils.wall(-d, axis=1, sense=+1, material=steel)
v = 5e-1
w1.state.vel = (0, -v, 0)
w2.state.vel = (0, +v, 0)
O.bodies.append((p1, p2, p3, w1, w2))

O.engines = [
Esempio n. 19
0
        resultStatus += 1
    else:
        printSuccess()


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))

vertices = [[0, 0, 0], [sizeB, 0, 0], [sizeB, sizeB, 0], [sizeB, sizeB, sizeB],
            [0, sizeB, 0], [0, sizeB, sizeB], [0, 0, sizeB], [sizeB, 0, sizeB]]
t = polyhedra_utils.polyhedra(mat1, v=vertices)
t.state.pos = (0, 0, sizeB / 2)
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(),
Esempio n. 20
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")])