Example #1
0
O.materials.append(
    FrictMat(young=6e6,
             poisson=.4,
             frictionAngle=0,
             density=2600,
             label='frictionless'))

d = 8

# clumps
for xyz in itertools.product(arange(0, d), arange(0, d), arange(0, d)):
    ids_spheres = O.bodies.appendClumped(
        pack.regularHexa(
            pack.inEllipsoid(
                (mn[0] + xyz[0] * (mx[0] - mn[0]) / d, mn[0] + xyz[1] *
                 (mx[1] - mn[1]) / d, mn[2] + xyz[2] * (mx[2] - mn[2]) / d),
                (0.45 + random.random() * 0.1, 0.45 + random.random() * 0.1,
                 0.45 + random.random() * 0.1)),
            radius=0.15 + random.random() * 0.05,
            gap=0,
            color=[random.random(),
                   random.random(),
                   random.random()]))

## create walls around the packing
walls = aabbWalls(material='frictionless')
wallIds = O.bodies.append(walls)

from yade import qt

qt.Controller()
Example #2
0
import itertools
import random
import yade.plot

## corners of the initial packing
mn,mx=Vector3(0,0,0),Vector3(10,10,10)

## create material #0, which will be used as default
O.materials.append(FrictMat(young=6e6,poisson=.4,frictionAngle=radians(5),density=2600))
O.materials.append(FrictMat(young=6e6,poisson=.4,frictionAngle=0,density=2600,label='frictionless'))

d=8

# clumps
for xyz in itertools.product(arange(0,d),arange(0,d),arange(0,d)):
	ids_spheres=O.bodies.appendClumped(pack.regularHexa(pack.inEllipsoid((mn[0]+xyz[0]*(mx[0]-mn[0])/d,mn[0]+xyz[1]*(mx[1]-mn[1])/d,mn[2]+xyz[2]*(mx[2]-mn[2])/d),(0.45+random.random()*0.1,0.45+random.random()*0.1,0.45+random.random()*0.1)),radius=0.15+random.random()*0.05,gap=0,color=[random.random(),random.random(),random.random()]))

## create walls around the packing
walls=aabbWalls(material='frictionless')
wallIds=O.bodies.append(walls)

from yade import qt
qt.Controller()
qt.View()


## hope that we got the ids right?!
triax=TriaxialCompressionEngine(
	wall_bottom_id=wallIds[2],
	wall_top_id=wallIds[3],
	wall_left_id=wallIds[0],
mn, mx = Vector3(0, 0, 0), Vector3(10, 10, 10)

## create material #0, which will be used as default
O.materials.append(FrictMat(young=6e6, poisson=0.4, frictionAngle=radians(5), density=2600))
O.materials.append(FrictMat(young=6e6, poisson=0.4, frictionAngle=0, density=2600, label="frictionless"))

d = 8

# clumps
for xyz in itertools.product(arange(0, d), arange(0, d), arange(0, d)):
    ids_spheres = O.bodies.appendClumped(
        pack.regularHexa(
            pack.inEllipsoid(
                (
                    mn[0] + xyz[0] * (mx[0] - mn[0]) / d,
                    mn[0] + xyz[1] * (mx[1] - mn[1]) / d,
                    mn[2] + xyz[2] * (mx[2] - mn[2]) / d,
                ),
                (0.45 + random.random() * 0.1, 0.45 + random.random() * 0.1, 0.45 + random.random() * 0.1),
            ),
            radius=0.15 + random.random() * 0.05,
            gap=0,
            color=[random.random(), random.random(), random.random()],
        )
    )

## create walls around the packing
walls = utils.aabbWalls(material="frictionless")
wallIds = O.bodies.append(walls)

from yade import qt
Example #4
0
                  color=(1, 1, 1),
                  wire=False))

### Creating the material for buldozer
colorsph1 = Vector3(120, 234, 150)
colorsph2 = Vector3(1, 1, 0)

colorsph1.normalize()
colorsph2.normalize()
colorSph = colorsph1
for xyz in itertools.product(arange(0, numBoxes[0]), arange(0, numBoxes[1]),
                             arange(0, numBoxes[2])):
    ids_spheres = O.bodies.appendClumped(
        pack.regularHexa(pack.inEllipsoid(
            (xyz[0] * (sizeBox + gapBetweenBoxes), xyz[1] *
             (sizeBox + gapBetweenBoxes) + sizeBox * 0.5, xyz[2] *
             (sizeBox + gapBetweenBoxes) - radiusKnife + sizeBox * 0.6),
            (sizeBox / 2, sizeBox / 2, sizeBox / 2)),
                         radius=radiusSph,
                         gap=0,
                         color=colorSph))
    if (colorSph == colorsph1):
        colorSph = colorsph2
    else:
        colorSph = colorsph1

from yade import qt

O.dt = 2 * utils.PWaveTimeStep()  # We do not need now a high accuracy
O.engines = [
    ForceResetter(),
Example #5
0
groundId = O.bodies.append(
    utils.facet([(12, 0, -6), (
        0,
        12,
        -6,
    ), (-12, -12, -6)], dynamic=False))  # ground

for part in [
        pack.regularHexa(pack.inAlignedBox(
            (-2, -2, -2), (2, 2, 2)) - pack.inCylinder((0, -2, 0),
                                                       (0, 2, 0), 1),
                         radius=1.5 * rad,
                         gap=2 * gap,
                         color=(1, 0, 1),
                         **kw),  # body,
        pack.regularOrtho(pack.inEllipsoid((-1, 0, -4), (1, 1, 2)),
                          radius=rad,
                          gap=0,
                          color=(0, 1, 1),
                          **kw),  # left leg
        pack.regularHexa(pack.inCylinder((+1, 1, -2.5), (0, 3, -5), 1),
                         radius=rad,
                         gap=gap,
                         color=(0, 1, 1),
                         **kw),  # right leg
        pack.regularHexa(pack.inHyperboloid((+2, 0, 1), (+6, 0, 0), 1, .5),
                         radius=rad,
                         gap=gap,
                         color=(0, 0, 1),
                         **kw),  # right hand
        pack.regularOrtho(pack.inCylinder((-2, 0, 2), (-5, 0, 4), 1),
Example #6
0
kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0}

O.bodies.append(
	pack.regularHexa(
		(pack.inSphere((0,0,4),2)-pack.inSphere((0,-2,5),2)) & pack.notInNotch(centerPoint=(0,0,4),edge=(0,1,0),normal=(-1,1,-1),aperture=.2)
		,radius=rad,gap=gap,color=(0,1,0),material=0) # head
	+[utils.sphere((.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((-.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((0,2.4,4),radius=.4,color=(1,0,0),material=0)] # eyes and nose
	+pack.regularHexa(pack.inCylinder((-1,2.2,3.3),(1,2.2,3.3),2*rad),radius=rad,gap=gap/3,color=(0.929,0.412,0.412),material=0) #mouth
)
groundId=O.bodies.append(utils.facet([(12,0,-6),(0,12,-6,),(-12,-12,-6)],dynamic=False)) # ground

for part in [
	pack.regularHexa (
		pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1),
		radius=1.5*rad,gap=2*gap,color=(1,0,1),**kw), # body,
	pack.regularOrtho(pack.inEllipsoid((-1,0,-4),(1,1,2)),radius=rad,gap=0,color=(0,1,1),**kw), # left leg
	pack.regularHexa (pack.inCylinder((+1,1,-2.5),(0,3,-5),1),radius=rad,gap=gap,color=(0,1,1),**kw), # right leg
	pack.regularHexa (pack.inHyperboloid((+2,0,1),(+6,0,0),1,.5),radius=rad,gap=gap,color=(0,0,1),**kw), # right hand
	pack.regularOrtho(pack.inCylinder((-2,0,2),(-5,0,4),1),radius=rad,gap=gap,color=(0,0,1),**kw) # left hand
	]: O.bodies.appendClumped(part)


# Example of geom.facetBox usage 
oriBody = Quaternion(Vector3(0,0,1),(math.pi/3))
O.bodies.append(geom.facetBox((12,0,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))

oriBody = Quaternion(Vector3(0,0,1),(math.pi/2))
O.bodies.append(geom.facetBox((0,12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))

oriBody = Quaternion(Vector3(0,0,1),(math.pi))
O.bodies.append(geom.facetBox((-12,-12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))
Example #7
0

O.bodies.append(geom.facetBox((0,lengthKnife/2,radiusKnife),(lengthKnife*4,lengthKnife*4,lengthKnife),wallMask=16,color=(1,1,1),wire=False))




### Creating the material for buldozer
colorsph1=Vector3(120,234,150);
colorsph2=Vector3(1,1,0);

colorsph1.normalize();
colorsph2.normalize();
colorSph=colorsph1
for xyz in itertools.product(arange(0,numBoxes[0]),arange(0,numBoxes[1]),arange(0,numBoxes[2])):
	ids_spheres=O.bodies.appendClumped(pack.regularHexa(pack.inEllipsoid((xyz[0]*(sizeBox+gapBetweenBoxes),xyz[1]*(sizeBox+gapBetweenBoxes)+sizeBox*0.5,xyz[2]*(sizeBox+gapBetweenBoxes)-radiusKnife+sizeBox*0.6),(sizeBox/2,sizeBox/2,sizeBox/2)),radius=radiusSph,gap=0,color=colorSph))
	if (colorSph==colorsph1):
		colorSph=colorsph2
	else:
		colorSph=colorsph1


from yade import qt

O.dt=2*PWaveTimeStep() # We do not need now a high accuracy
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
Example #8
0
KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife,lengthKnife/2,-radiusKnife+buldozerHeight/2),(lengthKnife/2,lengthKnife/2,buldozerHeight/2.),wallMask=47,color=(0,1,0),wire=False))

KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife-lengthKnife/4.,lengthKnife/2,-radiusKnife+buldozerHeight*3./2.-buldozerHeight/4.),(lengthKnife/4.,lengthKnife/3.,buldozerHeight/4.),wallMask=47,color=(0,0,1),wire=False))

O.bodies.append(geom.facetBox((0,0,radiusKnife),(lengthKnife*3,lengthKnife*3,lengthKnife),wallMask=16,color=(1,1,1),wire=False,material=facetMat))


### Creating the material for buldozer
colorsph1=Vector3(120,234,150);
colorsph2=Vector3(0,0,1);

colorsph1.normalize();
colorsph2.normalize();
colorSph=colorsph1
for xyz in itertools.product(arange(0,numBoxes[0]),arange(0,numBoxes[1]),arange(0,numBoxes[2])):
	ids_spheres=O.bodies.appendClumped(pack.regularHexa(pack.inEllipsoid((xyz[0]*(sizeBox+gapBetweenBoxes),xyz[1]*(sizeBox+gapBetweenBoxes)+sizeBox*0.5,xyz[2]*(sizeBox+gapBetweenBoxes)-radiusKnife+sizeBox*0.6),(sizeBox/2,sizeBox/2,sizeBox/2)),radius=radiusSph,gap=0,color=colorSph,material=sphereMat))
	if (colorSph==colorsph1):
		colorSph=colorsph2
	else:
		colorSph=colorsph1

O.dt=.2*tc

O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
		[Law2_ScGeom_ViscElPhys_Basic()],
	),
Example #9
0
kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0}

O.bodies.append(
	pack.regularHexa(
		(pack.inSphere((0,0,4),2)-pack.inSphere((0,-2,5),2)) & pack.notInNotch(centerPoint=(0,0,4),edge=(0,1,0),normal=(-1,1,-1),aperture=.2)
		,radius=rad,gap=gap,color=(0,1,0),material=0) # head
	+[sphere((.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),sphere((-.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),sphere((0,2.4,4),radius=.4,color=(1,0,0),material=0)] # eyes and nose
	+pack.regularHexa(pack.inCylinder((-1,2.2,3.3),(1,2.2,3.3),2*rad),radius=rad,gap=gap/3,color=(0.929,0.412,0.412),material=0) #mouth
)
groundId=O.bodies.append(facet([(12,0,-6),(0,12,-6,),(-12,-12,-6)],dynamic=False)) # ground

for part in [
	pack.regularHexa (
		pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1),
		radius=1.5*rad,gap=2*gap,color=(1,0,1),**kw), # body,
	pack.regularOrtho(pack.inEllipsoid((-1,0,-4),(1,1,2)),radius=rad,gap=0,color=(0,1,1),**kw), # left leg
	pack.regularHexa (pack.inCylinder((+1,1,-2.5),(0,3,-5),1),radius=rad,gap=gap,color=(0,1,1),**kw), # right leg
	pack.regularHexa (pack.inHyperboloid((+2,0,1),(+6,0,0),1,.5),radius=rad,gap=gap,color=(0,0,1),**kw), # right hand
	pack.regularOrtho(pack.inCylinder((-2,0,2),(-5,0,4),1),radius=rad,gap=gap,color=(0,0,1),**kw) # left hand
	]: O.bodies.appendClumped(part)


# Example of geom.facetBox usage 
oriBody = Quaternion(Vector3(0,0,1),(pi/3))
O.bodies.append(geom.facetBox((12,0,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))

oriBody = Quaternion(Vector3(0,0,1),(pi/2))
O.bodies.append(geom.facetBox((0,12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))

oriBody = Quaternion(Vector3(0,0,1),(pi))
O.bodies.append(geom.facetBox((-12,-12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))