Example #1
0
# encoding: utf-8

# example of use JCFpm classes : Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM...
# a cubic rock massif, containing a rock joint with ~ 31 deg. dip angle. At one time, the mechanical properties of the joint are degraded, triggering a smooth sliding


# definition of a predicate for use of randomDensePack() function

from __future__ import print_function
from past.builtins import execfile
from yade import pack
dimModele = 10.0
pred = pack.inAlignedBox((0,0,0),(dimModele,dimModele,dimModele))


# the packing of spheres :

def mat(): return JCFpmMat(type=1,young=1e8,poisson=0.3,frictionAngle=radians(30),density=3000,tensileStrength=1e6,cohesion=1e6,jointNormalStiffness=1e7,jointShearStiffness=1e7,jointCohesion=1e6,jointFrictionAngle=radians(20),jointDilationAngle=0.0)
nSpheres = 3000.0
poros=0.13
rMeanSpheres = dimModele * pow(3.0/4.0*(1-poros)/(pi*nSpheres),1.0/3.0)
print('')
print('Creating a cubic sample of spheres (may take some time and cause warnings)')
print('')
sp = pack.randomDensePack(pred,radius=rMeanSpheres,rRelFuzz=0.3,memoizeDb='/tmp/gts-triax-packings.sqlite',returnSpherePack=True)
sp.toSimulation(color=(0.9,0.8,0.6),wire=False,material=mat)
print('')
print('Sample created !')


# Definition of the facets for joint's geometry
Example #2
0
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 
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))
Example #3
0
        sys.argv
) > 1:  #we then assume N,M are provided as 1st and 2nd cmd line arguments
    N = int(sys.argv[1])
    M = int(sys.argv[2])

############  Build a scene (we use Yade's pre-filled scene)  ############

# sequential grain colors
import colorsys
from yade import pack
colorScale = (Vector3(colorsys.hsv_to_rgb(value * 1.0 / numThreads, 1, 1))
              for value in range(0, numThreads))

#generate packing
mn, mx = Vector3(0, 2, 0), Vector3(50, 180, 90)
pred = pack.inAlignedBox(mn, mx)
O.bodies.append(pack.regularHexa(
    pred, radius=1.20,
    gap=0))  #change radius for more spheres, r=0.45 --> ~1.5M particles
nspheres = len(O.bodies)
for b in O.bodies:
    b.material.frictionAngle = 0.05
#print "len  = ", nspheres
wallIds = aabbWalls([Vector3(0, -1, -0), Vector3(80, 360, 200)], thickness=0)
O.bodies.append(wallIds)
WALL_ID = wallIds[2]

#print "len of bodies = ", len(O.bodies)

collider.verletDist = 0.4
collider.targetInterv = 200
Example #4
0
from yade import pack, plot
from yade import export, ymport
from yade import utils
from yade import qt
from yade import plot
import sys,time

#####################
####### OBJ #######
#####################

O.materials.append(CohFrictMat(young=30000e6,poisson=0.3,density=3600,frictionAngle=radians(30),isCohesive=True,normalCohesion=1e100000000,shearCohesion=1e10000000,momentRotationLaw=True,etaRoll=0.1,label='spheres'))

pred=pack.inAlignedBox((0.05,-0.5,-0.05),(0.1,0.5,0.05))
spheres=pack.regularHexa(pred,radius=0.01,gap=0)
O.bodies.append(spheres)

for b in O.bodies:
   b.state.vel=(-18,0,0)

################
##box2 material##
################

idCA=FrictMat(density=2227,frictionAngle=radians(0.5),label='CA',young=30e9,poisson=0.15)
O.materials.append(idCA)

############################
####### BOX 2 ##############
############################
Example #5
0
maxCorner = (10, 10, 10)
center = (5, 5, 5)
normal = (1, 1, 1)

from yade import pack, export
pred = pack.inAlignedBox(Vector3.Zero, maxCorner)
O.bodies.append(
    pack.randomDensePack(pred, radius=1., rRelFuzz=.5, spheresInCell=500))

export.text('/tmp/test.txt')
# text2vtk and text2vtkSection function can be copy-pasted from yade/py/export.py into separate py file to avoid executing yade or to use pure python
export.text2vtk('/tmp/test.txt', '/tmp/test.vtk')
export.text2vtkSection('/tmp/test.txt',
                       '/tmp/testSection.vtk',
                       point=center,
                       normal=normal)

# now open paraview, click "Tools" menu -> "Python Shell", click "Run Script", choose "pv_section.py" from this directiory
# or just run python pv_section.py
# and enjoy :-)
Example #6
0
                    jointNormalStiffness=5.e7,
                    jointShearStiffness=2.5e7,
                    jointCohesion=0.,
                    jointTensileStrength=0.,
                    jointFrictionAngle=radians(35.),
                    jointDilationAngle=0.0)


# --- Creating a sample of spheres

# definition of a predicate
from yade import pack
Lx = 10
Ly = 10
Lz = 6
pred = pack.inAlignedBox((0, 0, 0), (Lx, Ly, Lz))
# use of randomDensePack() function
nSpheres = 1500.0
poros = 0.13  # apparently the value of porosity of samples generated by pack.randomDensePack
rMeanSpheres = pow(Lx * Ly * Lz * 3.0 / 4.0 * (1 - poros) / (pi * nSpheres),
                   1.0 / 3.0)
print('\nGenerating sphere sample, be patient')
sp = pack.randomDensePack(pred,
                          radius=rMeanSpheres,
                          rRelFuzz=0.3,
                          memoizeDb='/tmp/gts-triax-packings.sqlite',
                          returnSpherePack=True)
sp.toSimulation(color=(0.9, 0.8, 0.6), wire=False, material=mat)
print('Sphere sample generated !')

# --- The joint surface : half of the height
R=D/2.
H=2.*h
mn,mx=Vector3(0,0,0),Vector3(1.01*D,1.01*D,1.3*H)
young=1e6 #1e9
angfric = 30  

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(angfric),density=2600,label='sph'))

walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

vect=[0, 1, 1.25, 2.25, 2.5, 3.5, 3.75, 4.75, 5., 6., 6.25, 7.25, 7.5]
vect=1/7.25*numpy.array(vect)

cuadr1=pack.inAlignedBox((0,0,H*vect[0]),(D,D,H*vect[1])) #grueso
cuadr2=pack.inAlignedBox((0,0,H*vect[1]),(D,D,H*vect[2])) #fino
cuadr3=pack.inAlignedBox((0,0,H*vect[2]),(D,D,H*vect[3])) #grueso
cuadr4=pack.inAlignedBox((0,0,H*vect[3]),(D,D,H*vect[4])) #fino
cuadr5=pack.inAlignedBox((0,0,H*vect[4]),(D,D,H*vect[5])) #grueso
cuadr6=pack.inAlignedBox((0,0,H*vect[5]),(D,D,H*vect[6])) #fino
cuadr7=pack.inAlignedBox((0,0,H*vect[6]),(D,D,H*vect[7])) #grueso
cuadr8=pack.inAlignedBox((0,0,H*vect[7]),(D,D,H*vect[8])) #fino
cuadr9=pack.inAlignedBox((0,0,H*vect[8]),(D,D,H*vect[9])) #grueso
cuadr10=pack.inAlignedBox((0,0,H*vect[9]),(D,D,H*vect[10])) #fino
cuadr11=pack.inAlignedBox((0,0,H*vect[10]),(D,D,H*vect[11])) #grueso
cuadr12=pack.inAlignedBox((0,0,H*vect[11]),(D,D,H*vect[12])) #fino

sph1=pack.randomDensePack(cuadr1,spheresInCell=1000,radius=rmean,rRelFuzz=Sd,returnSpherePack=True)
sph2=pack.randomDensePack(cuadr2,spheresInCell=2000,radius=rmean/R1,rRelFuzz=Sd,returnSpherePack=True)
sph3=pack.randomDensePack(cuadr3,spheresInCell=1000,radius=rmean,rRelFuzz=Sd,returnSpherePack=True)
Example #8
0

# Mechanical properties of rock matrix and rock joint :
from __future__ import print_function
from past.builtins import execfile
def mat(): return JCFpmMat(type=1,young=15.e9,frictionAngle=radians(35),density=3000,poisson=0.35,tensileStrength=4.5e6,cohesion=45.e6,jointNormalStiffness=5.e7,jointShearStiffness=2.5e7,jointCohesion=0.,jointTensileStrength=0.,jointFrictionAngle=radians(35.),jointDilationAngle=0.0)


# --- Creating a sample of spheres

# definition of a predicate 
from yade import pack
Lx = 10
Ly = 10
Lz = 6
pred = pack.inAlignedBox((0,0,0),(Lx,Ly,Lz))
# use of randomDensePack() function
nSpheres = 1500.0
poros=0.13 # apparently the value of porosity of samples generated by pack.randomDensePack
rMeanSpheres = pow(Lx*Ly*Lz*3.0/4.0*(1-poros)/(pi*nSpheres),1.0/3.0)
print('\nGenerating sphere sample, be patient')
sp = pack.randomDensePack(pred,radius=rMeanSpheres,rRelFuzz=0.3,memoizeDb='/tmp/gts-triax-packings.sqlite',returnSpherePack=True)
sp.toSimulation(color=(0.9,0.8,0.6),wire=False,material=mat)
print('Sphere sample generated !')


# --- The joint surface : half of the height
import gts
v1 = gts.Vertex(0 , 0 , Lz/2.0)
v2 = gts.Vertex(Lx, 0 , Lz/2.0)
v3 = gts.Vertex(Lx, Ly, Lz/2.0)
Example #9
0
maxCorner = (10,10,10)
center = (5,5,5)
normal = (1,1,1)

from yade import pack, export
pred = pack.inAlignedBox(Vector3.Zero,maxCorner)
O.bodies.append(pack.randomDensePack(pred,radius=1.,rRelFuzz=.5,spheresInCell=500))

export.text('/tmp/test.txt')
# text2vtk and text2vtkSection function can be copy-pasted from yade/py/export.py into separate py file to avoid executing yade or to use pure python
export.text2vtk('/tmp/test.txt','/tmp/test.vtk')
export.text2vtkSection('/tmp/test.txt','/tmp/testSection.vtk',point=center,normal=normal)

# now open paraview, click "Tools" menu -> "Python Shell", click "Run Script", choose "pv_section.py" from this directiory
# or just run python pv_section.py
# and enjoy :-)
Example #10
0
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 
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))
O.cell.refSize = (2, 2, 2)

from yade import pack, plot

# the "if 0:" block will be never executed, therefore the "else:" block will be
# to use cloud instead of regular packing, change to "if 1:" or something similar
if 0:
    # create cloud of spheres and insert them into the simulation
    # we give corners, mean radius, radius variation
    sp = pack.SpherePack()
    sp.makeCloud((0, 0, 0), (2, 2, 2), rMean=0.1, rRelFuzz=0.6, periodic=True)
    # insert the packing into the simulation
    sp.toSimulation(color=(0, 0, 1))  # pure blue
else:
    # in this case, add dense packing
    O.bodies.append(pack.regularHexa(pack.inAlignedBox((0, 0, 0), (2, 2, 2)), radius=0.1, gap=0, color=(0, 0, 1)))

# create "dense" packing by setting friction to zero initially
O.materials[0].frictionAngle = 0

# simulation loop (will be run at every step)
O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_L3Geom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_L3Geom_FrictPhys_ElPerfPl()]
    ),
    NewtonIntegrator(damping=0.4),
    # run checkStress function (defined below) every second
    # the label is arbitrary, and is used later to refer to this engine
    PyRunner(command="checkStress()", realPeriod=1, label="checker"),
Example #12
0
    FrictMat(young=young,
             poisson=0.5,
             frictionAngle=radians(3),
             density=2600,
             label='spheres'))
O.materials.append(
    FrictMat(young=young,
             poisson=0.5,
             frictionAngle=0,
             density=0,
             label='walls'))
walls = aabbWalls([mn, mx], thickness=0, material='walls')
wallIds = O.bodies.append(walls)

O.bodies.append(
    pack.regularOrtho(pack.inAlignedBox(mn, mx),
                      radius=rad,
                      gap=-1e-8,
                      material='spheres'))

print('num bodies ', len(O.bodies))

ThermalEngine = ThermalEngine(dead=1, label='thermal')

newton = NewtonIntegrator(damping=0.2)
intRadius = 1
O.engines = [
    ForceResetter(),
    InsertionSortCollider(
        [Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),
         Bo1_Box_Aabb()]),
Example #13
0
             density=7000,
             label='frictionlessWalls'))

JCFmat = O.materials.append(
    JCFpmMat(young=young,
             cohesion=cohesion,
             density=density,
             frictionAngle=radians(finalFricDegree),
             tensileStrength=sigmaT,
             poisson=poisson,
             label='JCFmat'))

#### preprocessing to get dimensions
numSpheres = 10000

pred = pack.inAlignedBox(
    mn, mx)  #- pack.inCylinder((0, -.01, 0), (0, .01, 0), 0.04)
sp = pack.randomDensePack(pred,
                          radius=0.0015,
                          spheresInCell=numSpheres,
                          rRelFuzz=0.25,
                          returnSpherePack=True)
sp.toSimulation()
export.textExt('240x80mmBeam_1.5mmrad.spheres', 'x_y_z_r')

dim = utils.aabbExtrema()
xinf = dim[0][0]
xsup = dim[1][0]
X = xsup - xinf
yinf = dim[0][1]
ysup = dim[1][1]
Y = ysup - yinf
Example #14
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
from yade import pack, export
pred = pack.inAlignedBox((0, 0, 0), (10, 10, 10))
O.bodies.append(
    pack.randomDensePack(pred,
                         radius=1.,
                         rRelFuzz=.5,
                         spheresInCell=500,
                         memoizeDb='/tmp/pack.db'))

export.textExt('/tmp/test.txt',
               format='x_y_z_r_attrs',
               attrs=('b.state.pos.norm()', 'b.state.pos'),
               comment='dstN dstV_x dstV_y dstV_z')
# text2vtk and text2vtkSection function can be copy-pasted from yade/py/export.py into separate py file to avoid executing yade or to use pure python
export.text2vtk('/tmp/test.txt', '/tmp/test.vtk')
export.text2vtkSection('/tmp/test.txt',
                       '/tmp/testSection.vtk',
                       point=(5, 5, 5),
                       normal=(1, 1, 1))
from yade import pack, plot

# the "if 0:" block will be never executed, therefore the "else:" block will be
# to use cloud instead of regular packing, change to "if 1:" or something similar
if 0:
    # create cloud of spheres and insert them into the simulation
    # we give corners, mean radius, radius variation
    sp = pack.SpherePack()
    sp.makeCloud((0, 0, 0), (2, 2, 2), rMean=.1, rRelFuzz=.6, periodic=True)
    # insert the packing into the simulation
    sp.toSimulation(color=(0, 0, 1))  # pure blue
else:
    # in this case, add dense packing
    O.bodies.append(
        pack.regularHexa(pack.inAlignedBox((0, 0, 0), (2, 2, 2)),
                         radius=.1,
                         gap=0,
                         color=(0, 0, 1)))

# create "dense" packing by setting friction to zero initially
O.materials[0].frictionAngle = 0

# simulation loop (will be run at every step)
O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()]),
    InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],
                    [Ip2_FrictMat_FrictMat_FrictPhys()],
                    [Law2_ScGeom_FrictPhys_CundallStrack()]),
    NewtonIntegrator(damping=.4),
Example #17
0
from yade import pack, export
pred = pack.inAlignedBox((0,0,0),(10,10,10))
O.bodies.append(pack.randomDensePack(pred,radius=1.,rRelFuzz=.5,spheresInCell=500,memoizeDb='/tmp/pack.db'))

export.textExt('/tmp/test.txt',format='x_y_z_r_attrs',attrs=('b.state.pos.norm()','b.state.pos'),comment='dstN dstV_x dstV_y dstV_z')
# text2vtk and text2vtkSection function can be copy-pasted from yade/py/export.py into separate py file to avoid executing yade or to use pure python
export.text2vtk('/tmp/test.txt','/tmp/test.vtk')
export.text2vtkSection('/tmp/test.txt','/tmp/testSection.vtk',point=(5,5,5),normal=(1,1,1))

# now open paraview, click "Tools" menu -> "Python Shell", click "Run Script", choose "pv_section.py" from this directiory
# or just run python pv_section.py
# and enjoy :-)
Example #18
0
# encoding: utf-8

# example of use JCFpm classes : Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM...
# a cubic rock massif, containing a rock joint with ~ 31 deg. dip angle. At one time, the mechanical properties of the joint are degraded, triggering a smooth sliding

# definition of a predicate for use of randomDensePack() function

from __future__ import print_function
from past.builtins import execfile
from yade import pack
dimModele = 10.0
pred = pack.inAlignedBox((0, 0, 0), (dimModele, dimModele, dimModele))

# the packing of spheres :


def mat():
    return JCFpmMat(type=1,
                    young=1e8,
                    poisson=0.3,
                    frictionAngle=radians(30),
                    density=3000,
                    tensileStrength=1e6,
                    cohesion=1e6,
                    jointNormalStiffness=1e7,
                    jointShearStiffness=1e7,
                    jointCohesion=1e6,
                    jointFrictionAngle=radians(20),
                    jointDilationAngle=0.0)

Example #19
0
# 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 = [
Example #20
0
# this script demonstrates how to benchmark using timingEnabled: how to measure how much time each module takes.
from yade import pack, timing
#O.bodies.append([	sphere((0.2,0,0),.5,fixed=True), sphere((0.2,0.0,1.01),.5), ])
O.bodies.append(
    pack.regularHexa(pack.inAlignedBox((0, 0, 0), (10, 10, 1)),
                     radius=.5,
                     gap=0,
                     fixed=True))
O.bodies.append(
    pack.regularOrtho(pack.inAlignedBox((3, 3, 3), (7, 7, 4)),
                      radius=.05,
                      gap=0))
O.engines = [
    ForceResetter(),
    FlatGridCollider(step=.2,
                     aabbMin=(0, 0, 0),
                     aabbMax=(10, 10, 5),
                     verletDist=0.005),
    # InsertionSortCollider([Bo1_Sphere_Aabb()],sweepLength=0.005),
    InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()],
    ),
    NewtonIntegrator(damping=0.4, gravity=[0, 0, -10]),
]
O.dt = .6 * PWaveTimeStep()
O.saveTmp()
#O.step()
#while True:
#	O.step()
Example #21
0
R=D/2.
H=2.*h
mn,mx=Vector3(0,0,0),Vector3(1.01*D,1.01*D,1.3*H)
young=1e6 #1e9
angfric = 30  

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(angfric),density=2600,label='sph'))

walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

vect=[0, 1, 1.25, 2.25, 2.5, 3.5, 3.75]
vect=1/3.75*numpy.array(vect)

cuadr1=pack.inAlignedBox((0,0,H*vect[0]),(D,D,H*vect[1])) #grueso
cuadr2=pack.inAlignedBox((0,0,H*vect[1]),(D,D,H*vect[2])) #fino
cuadr3=pack.inAlignedBox((0,0,H*vect[2]),(D,D,H*vect[3])) #grueso
cuadr4=pack.inAlignedBox((0,0,H*vect[3]),(D,D,H*vect[4])) #fino
cuadr5=pack.inAlignedBox((0,0,H*vect[4]),(D,D,H*vect[5])) #grueso
cuadr6=pack.inAlignedBox((0,0,H*vect[5]),(D,D,H*vect[6])) #fino

sph1=pack.randomDensePack(cuadr1,spheresInCell=1000,radius=rmean,rRelFuzz=Sd,returnSpherePack=True)
sph2=pack.randomDensePack(cuadr2,spheresInCell=2000,radius=rmean/R1,rRelFuzz=Sd,returnSpherePack=True)
sph3=pack.randomDensePack(cuadr3,spheresInCell=1000,radius=rmean,rRelFuzz=Sd,returnSpherePack=True)
sph4=pack.randomDensePack(cuadr4,spheresInCell=2000,radius=rmean/R1,rRelFuzz=Sd,returnSpherePack=True)
sph5=pack.randomDensePack(cuadr5,spheresInCell=1000,radius=rmean,rRelFuzz=Sd,returnSpherePack=True)
sph6=pack.randomDensePack(cuadr6,spheresInCell=2000,radius=rmean/R1,rRelFuzz=Sd,returnSpherePack=True)

sph1.toSimulation(material='sph')
sph2.toSimulation(material='sph')
Example #22
0
from yade import utils,pack,timing
#O.bodies.append([	utils.sphere((0.2,0,0),.5,fixed=True), utils.sphere((0.2,0.0,1.01),.5), ])
O.bodies.append(pack.regularHexa(pack.inAlignedBox((0,0,0),(10,10,1)),radius=.5,gap=0,fixed=True))
O.bodies.append(pack.regularOrtho(pack.inAlignedBox((3,3,3),(7,7,4)),radius=.05,gap=0))
O.engines=[
	ForceResetter(),
	FlatGridCollider(step=.2,aabbMin=(0,0,0),aabbMax=(10,10,5),verletDist=0.005),
	# InsertionSortCollider([Bo1_Sphere_Aabb()],sweepLength=0.005),
	InteractionLoop(
		[Ig2_Sphere_Sphere_Dem3DofGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
	),
	NewtonIntegrator(damping=0.4,gravity=[0,0,-10]),
]
O.dt=.6*utils.PWaveTimeStep()
O.saveTmp()
#O.step()
#while True:
#	O.step()
#	if len(O.interactions)>0 or O.bodies[1].state.pos[2]<.97: break
print('This will take a while, drink a coffee ;)')
O.timingEnabled=True
O.run(5000,True)
timing.stats()
import sys
#sys.exit(0)
Example #23
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 #24
0
from yade import pack,plot

# the "if 0:" block will be never executed, therefore the "else:" block will be
# to use cloud instead of regular packing, change to "if 1:" or something similar
if 0:
	# create cloud of spheres and insert them into the simulation
	# we give corners, mean radius, radius variation
	sp=pack.SpherePack()
	sp.makeCloud((0,0,0),(2,2,2),rMean=.1,rRelFuzz=.6,periodic=True)
	# insert the packing into the simulation
	sp.toSimulation(color=(0,0,1)) # pure blue
else:
	# in this case, add dense packing
	O.bodies.append(
		pack.regularHexa(pack.inAlignedBox((0,0,0),(2,2,2)),radius=.1,gap=0,color=(0,0,1))
	)

# create "dense" packing by setting friction to zero initially
O.materials[0].frictionAngle=0

# simulation loop (will be run at every step)
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_ScGeom_FrictPhys_CundallStrack()]
	),
	NewtonIntegrator(damping=.4),
Example #25
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()