Example #1
0
rad,gap=.15,.02

#Add material
O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3))

#Parameters, which will be passed into spheres and facets creators
kw={'material':0}
kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':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 
Example #2
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),
Example #3
0
	runInGui = True,
)
from yade.params.table import *
assert testType in ['cyl','cube']

# materials
concMat = O.materials.append(CpmMat(
	young=young,frictionAngle=frictionAngle,poisson=poisson,sigmaT=sigmaT,
	epsCrackOnset=epsCrackOnset,relDuctility=relDuctility
))
frictMat = O.materials.append(FrictMat(
	young=young,poisson=poisson,frictionAngle=frictionAngle
))

# spheres
pred = pack.inCylinder((0,0,0),(0,0,height),.5*width) if testType=='cyl' else pack.inAlignedBox((-.5*width,-.5*width,0),(.5*width,.5*width,height)) if testType=='cube' else None
sp=SpherePack()
sp = pack.randomDensePack(pred,spheresInCell=2000,radius=rParticle,memoizeDb='/tmp/triaxTestOnCylinder.sqlite',returnSpherePack=True)
spheres=sp.toSimulation(color=(0,1,1),material=concMat)

# bottom and top of specimen. Will have prescribed velocity
bot = [O.bodies[s] for s in spheres if O.bodies[s].state.pos[2]<rParticle*bcCoeff]
top = [O.bodies[s] for s in spheres if O.bodies[s].state.pos[2]>height-rParticle*bcCoeff]
vel = strainRate*(height-rParticle*2*bcCoeff)
for s in bot:
	s.shape.color = (1,0,0)
	s.state.blockedDOFs = 'xyzXYZ'
	s.state.vel = (0,0,-vel)
for s in top:
	s.shape.color = Vector3(0,1,0)
	s.state.blockedDOFs = 'xyzXYZ'
Example #4
0
assert testType in ['cyl', 'cube']

# materials
concMat = O.materials.append(
    CpmMat(young=young,
           frictionAngle=frictionAngle,
           poisson=poisson,
           sigmaT=sigmaT,
           epsCrackOnset=epsCrackOnset,
           relDuctility=relDuctility))
frictMat = O.materials.append(
    FrictMat(young=young, poisson=poisson, frictionAngle=frictionAngle))

# spheres
pred = pack.inCylinder(
    (0, 0, 0),
    (0, 0, height), .5 * width) if testType == 'cyl' else pack.inAlignedBox(
        (-.5 * width, -.5 * width, 0),
        (.5 * width, .5 * width, height)) if testType == 'cube' else None
sp = SpherePack()
sp = pack.randomDensePack(pred,
                          spheresInCell=2000,
                          radius=rParticle,
                          memoizeDb='/tmp/triaxTestOnCylinder.sqlite',
                          returnSpherePack=True)
spheres = sp.toSimulation(color=(0, 1, 1), material=concMat)

# bottom and top of specimen. Will have prescribed velocity
bot = [
    O.bodies[s] for s in spheres
    if O.bodies[s].state.pos[2] < rParticle * bcCoeff
Example #5
0
rad,gap=.15,.02

#Add material
O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3))

#Parameters, which will be passed into spheres and facets creators
kw={'material':0}
kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':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 
Example #6
0
)
from yade.params.table import *

# material
concreteId = O.materials.append(
    CpmMat(
        young=young,
        poisson=poisson,
        frictionAngle=frictionAngle,
        epsCrackOnset=epsCrackOnset,
        relDuctility=relDuctility,
        sigmaT=sigmaT,
    ))

# spheres
sp = pack.randomDensePack(pack.inCylinder((0, 0, 0), (specimenLength, 0, 0),
                                          specimenRadius),
                          radius=sphereRadius,
                          spheresInCell=500,
                          memoizeDb='/tmp/packing-brazilian.db',
                          returnSpherePack=True)
sp.toSimulation()

# walls
zMin, zMax = [pt[2] for pt in aabbExtrema()]
wallIDs = O.bodies.append([wall((0, 0, z), 2) for z in (zMin, zMax)])
walls = wallMin, wallMax = [O.bodies[i] for i in wallIDs]
v = strainRate * 2 * specimenRadius
wallMin.state.vel = (0, 0, +v)
wallMax.state.vel = (0, 0, -v)

# engines
Example #7
0
from yade import pack

"""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)
#
# http://beta.arcig.cz/~eudoxos/yade/epydoc/yade._packPredicates.inAlignedBox-class.html
# http://beta.arcig.cz/~eudoxos/yade/epydoc/yade._packPredicates.inCylinder-class.html

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 
#
# http://beta.arcig.cz/~eudoxos/yade/epydoc/yade.pack-module.html#randomDensePack
O.bodies.append(pack.randomDensePack(pred,radius=rSphere,rRelFuzz=.3,memoizeDb='/tmp/triaxPackCache.sqlite',spheresInCell=3000))

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