detachment = O.materials.append( CpmMat(young=dyoung, poisson=dpoisson, frictionAngle=dfrictAng, epsCrackOnset=dreps, density=dden, relDuctility=0)) #basic parameters v = -1 n_layer = 9 case = 4 #adding deposit ----- sample = ymport.text('./sample.txt') spheres = O.bodies.append(sample) #building boxes ----- box_length = 1000.0 box_height = 100.0 box_depth = 5 #wallMask #determines which walls will be created, in the order #-x(1), +x (2), -y (4), +y (8), -z (16), +z (32). The numbers are ANDed; the #default 63 means to create all walls #parameter1:center #parameter2:size box = geom.facetBox((box_length / 2, box_height / 2, 0), (box_length / 2, box_height / 2, box_depth / 2),
dOutput=3.0, hBunker=11.0, hOutput=1.5, hPipe=0.8, wallMask=5, segmentsNumber=20, **kwMeshes)) # spheresToFile saves coordinates and radii of all spheres of the simulation into the text file, works but disabled. Please, uncomment it, if you need #print "Saved into the OutFile " + str (export.text("OutFile")) + " spheres"; # spheresFromFile function imports coordinates and radii of all spheres of the simulation into the text file O.bodies.append( ymport.text('foo.spheres', shift=Vector3(6.0, 6.0, -2.9), scale=0.7, color=(1, 1, 1), **kw)) #Demonstration of HarmonicRotationEngine O.bodies.append( pack.regularHexa(pack.inSphere((-15, 5, -5), 1.5), radius=rad * 2.0, gap=rad / 3.0, color=(0.5, 0.5, 0.1), material=0)) O.bodies.append(geom.facetBox((-15, 5, -5), (2, 2, 2), wallMask=15, **kwMeshes)) vibrationRotationPlate = O.bodies.append( geom.facetBox((-15, 5, -5), (2, 2, 2), wallMask=16, **kwBoxes))
KFluid = 2.2e11 # bulk modulus of the fluid (1/compressibility) visc = 1 # viscosity of the fluid pFactor = 1.8e-11 # to scale the permeability of the rock matrix: useless if lines 133-136 are not commented (impermeable matrix) -> cf. permeametre.py: 1.8e-11 gives a permeability of 1e-16 m2 for 111_10k slotAperture = 1e-3 # initial aperture of pre-existing fracture where the injection is done ### hydraulic loading flowRate = 1e-5 # injection flow rate ### Simulation Control saveData = 10 # data record interval iterMax = 14e3 saveVTK = 10 # number of Vtk files OUT = FOLDER + PACK + NAME ### preprocessing to get dimensions O.bodies.append(ymport.text(PACK + '.spheres')) 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 zinf = dim[0][2] zsup = dim[1][2] Z = zsup - zinf R = 0 Rmax = 0 numSpheres = 0.
jointShearStiffness=1e9, jointFrictionAngle=radians(0)) def wallMat(): return JCFpmMat(type=0, density=DENS, young=YOUNG, frictionAngle=radians(0), label='wallMat') ### preprocessing to get dimensions O.bodies.append( ymport.text(PACKING + '.spheres', scale=1., shift=Vector3(0, 0, 0), material=sphereMat)) 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 zinf = dim[0][2] zsup = dim[1][2] Z = zsup - zinf R = 0 Rmax = 0
hat_upper=O.bodies.append(bodiesHandling.spheresModify(hat,shift=(0.0,0.0,1.4),scale=0.7,orientation=oriBody,copy=True)) #Duplicate the "heart", shifting, scaling and rotating it #change the color of upper part of the hat for hatTmp in hat_upper: O.bodies[hatTmp].shape.color=(0.9,0.5,0.59) #facetBunker Demonstration #Demonstration of HarmonicMotionEngine vibrationPlate = O.bodies.append(geom.facetBunker((-7.0,-7.0,-3.0),dBunker=geometryParameters['extends'][0]*1.1,dOutput=3.0,hBunker=11.0,hOutput=1.5,hPipe=0.8,wallMask=5,segmentsNumber=20,**kwMeshes)) # spheresToFile saves coordinates and radii of all spheres of the simulation into the text file, works but disabled. Please, uncomment it, if you need #print "Saved into the OutFile " + str (export.text("OutFile")) + " spheres"; # spheresFromFile function imports coordinates and radii of all spheres of the simulation into the text file O.bodies.append(ymport.text('foo.spheres',shift=Vector3(6.0,6.0,-2.9),scale=0.7,color=(1,1,1),**kw)) #Demonstration of HarmonicRotationEngine O.bodies.append(pack.regularHexa(pack.inSphere((-15,5,-5),1.5),radius=rad*2.0,gap=rad/3.0,color=(0.5,0.5,0.1),material=0)) O.bodies.append(geom.facetBox((-15,5,-5),(2,2,2),wallMask=15,**kwMeshes)) vibrationRotationPlate = O.bodies.append(geom.facetBox((-15,5,-5),(2,2,2),wallMask=16,**kwBoxes)) O.bodies.append(utils.wall((0,0,-10),axis=2)) try: from yade import qt qt.Controller() qt.View() except ImportError: pass O.engines=[
rho_Salt = 3.0*1e-9 * massScaling# t/mm3 # O.materials.append(CohFrictMat(young=E_Salt,poisson=nu_Salt,\ frictionAngle=fric_Salt,density=rho_Salt,\ momentRotationLaw=False,alphaKr=2., alphaKtw=2.,\ normalCohesion=1000000., shearCohesion=100000000.,\ label='spheres')) ''' sp=pack.SpherePack() sp.makeCloud(mn,mx,-1,0.3333,num_spheres,False, 0.3,seed=1) #"seed" make the "random" generation always the same sphBodies=sp.toSimulation(material='spheres') ''' b=ymport.text('base_geom_100') sphBodies=O.bodies.append(b) #print sphBodies bodyHeat.heatBodies= sphBodies bodyHeat.heatBodies.extend([4,5]) # adding lower wall bodyHeat.isoThermalList.extend([4,5]) bodyHeat.initHeatPropsList(bodyHeat.heatBodies, 303., 430.0*1e6 / massScaling, 0.480) # changing properties of lower and upper walls bodyHeat.listCp[-1] = 900.0*1e6 / massScaling bodyHeat.listHeatCond[-1] = 220. # bodyHeat.listCp[-2] = 900.0*1e6 / massScaling
box = geom.facetBox((box_length / 2, box_height / 2, 0), (box_length / 2, box_height / 2, box_depth / 2), wallMask=0, material=m_wall) #push plane wall_right = utils.wall(box_length, axis=0, material=m_wall) wall_left = utils.wall(0, axis=0, material=m_wall) wall_bottom = utils.wall(0, axis=1, material=m_wall) O.bodies.append(wall_left) O.bodies.append(wall_right) O.bodies.append(wall_bottom) #adding deposit ----- spheres = ymport.text('./sample.txt') #list object id_spheres = O.bodies.append(spheres) #2017-08-05 lichangsheng #change to a real 2D simulation # fix spin in y z # fix x-postion for i in id_spheres: #a sphere can be made to move only in the yz plane and fix spin in Y Z by saying: O.bodies[i].state.blockedDOFs = 'XYz' #defining engines -----
frictionAngle=radians(1), density=1, poisson=1, tensileStrength=1e6, cohesion=1e6, jointNormalStiffness=1, jointShearStiffness=1, jointTensileStrength=1e6, jointCohesion=1e6, jointFrictionAngle=1) ############################ Import of the sphere assembly O.bodies.append( ymport.text(packing + '.spheres', scale=1, shift=Vector3(0, 0, 0), material=sphereMat)) #(-3,-4,-8) #### some preprocessing (not mandatory) dim = utils.aabbExtrema() xinf = dim[0][0] xsup = dim[1][0] yinf = dim[0][1] ysup = dim[1][1] zinf = dim[0][2] zsup = dim[1][2] R = 0 Rmax = 0 numSpheres = 0. for o in O.bodies:
from yade.pack import * import numpy as np #import heat import os O.materials.append(FrictMat(young=70e3,poisson=0.3,frictionAngle=0.3,density=1.9,label='material')) sList=[] r=1 ratio=0.85 N=10 #create a column of N spheres b=ymport.text('pack') O.bodies.append(b) heat.heatBodies= b heat.initHeatProps(O.bodies, 273., 0.01, 1000.) #change initial temperature of one sphere for i in range(0,len(b),50): heat.bodyTemp[i] =500. O.engines=[ ForceResetter(),
O.tags['description']='triaxial_rm_'+str(rm)+'_Emem_'+str(Emem) O.materials.append(CohFrictMat(young=Emem,poisson=poisson,density=density_mem,frictionAngle=0,normalCohesion=1e19,shearCohesion=1e19,momentRotationLaw=False,alphaKr=0,label='NodeMat')) O.materials.append(FrictMat(young=Emem,poisson=poisson,density=density_mem,frictionAngle=0,label='memMat')) O.materials.append(FrictMat(young=E,poisson=poisson,density=density,frictionAngle=frictionAngleW,label='Wallmat')) O.materials.append(FrictMat(young=E,poisson=poisson,density=density,frictionAngle=frictionAngle,label='Smat')) ############################## ### SAMPLE GENERATION ### ############################## kw={'color':[0.8,0.8,0.8],'wire':False,'dynamic':True,'material':3} pile=ymport.text('spheres_7.5e-03.txt',**kw) pile2=O.bodies.append(pile) L=hMax(2) ################################# #### MEMBRANE GENERATION ### ################################# #Create all nodes first : for i in range(0,nbL+1): for j in range(0,nbl): z=i*L/float(nbL) y=(l+r)*sin(2*pi*j/float(nbl)) x=(l+r)*cos(2*pi*j/float(nbl)) nodesIds.append( O.bodies.append(gridNode([x,y,z],r,wire=False,fixed=False,material='NodeMat',color=color)) ) ##Create connection between the nodes
for i in O.interactions: if((O.bodies[i.id1].isClumpMember==False) and (O.bodies[i.id2].isClumpMember==False) and (type(O.bodies[i.id1].shape)==Sphere) and (type(O.bodies[i.id2].shape)==Sphere)): O.bodies[i.id1].shape.color=O.bodies[i.id2].shape.color O.interactions.erase(i.id1,i.id2) O.bodies.clump([i.id1,i.id2]) ############################ ### DEFINING MATERIAL ### ############################ n=1960 blocMat = O.materials.append(FrictMat(young=Kn ,poisson=Ks/Kn,frictionAngle=radians(30),density=44.5/(4./3.*pi*0.02**3*n),label='block')) ############################### ### LOADING OF THE BLOCK ### ############################### bloc=ymport.text('block.spheres',scale=1,shift=startxyz,mask=2,wire=False,highlight=False,color=[1,0,0],material=blocMat) ### rotate block p0=startxyz rot=Quaternion((0,0,1),radians(40)) for b in bloc: b.state.pos=p0+rot*(b.state.pos-p0) clump,clumpspheres=O.bodies.appendClumped(bloc) ############################# ### IMPACT PARAMETERS ### ############################# ###test 1 #x=0
return JCFpmMat(type=1, density=DENS, young=YOUNG, poisson=ALPHA, frictionAngle=radians(FRICT), tensileStrength=TENS, cohesion=COH, jointNormalStiffness=1e9, jointShearStiffness=1e9, jointFrictionAngle=radians(0)) ### preprocessing to get dimensions O.bodies.append( ymport.text(PACKING + '.spheres', scale=1., shift=Vector3(0, 0, 0), material=sphereMat)) dim = utils.aabbExtrema() xinf = dim[0][0] X = aabbDim()[0] yinf = dim[0][1] Y = aabbDim()[1] zinf = dim[0][2] Z = aabbDim()[2] print 'X=', X, ' | Y=', Y, ' | Z=', Z R = 0 Rmax = 0 numSpheres = 0.
frictionAngle=math.radians(wallFrictAng), )) #particle parameters ----- sphere_mat = O.materials.append( JCFpmMat( young=5e9, poisson=1.0 / 3, frictionAngle=math.radians(18), density=4800, tensileStrength=TENSILESTRENGTH, cohesion=COHESION, )) s = ymport.text('dens2691Young5.0GPaL600H45.txt') spheres = O.bodies.append(s) for i in spheres: O.bodies[i].material = O.materials[sphere_mat] #engines ----- O.engines = [ ForceResetter(), InsertionSortCollider([ Bo1_Box_Aabb(), Bo1_Facet_Aabb(), Bo1_Sphere_Aabb(aabbEnlargeFactor=Enlarge, label='EF') ]), InteractionLoop([ Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=Enlarge,
E=2*7.9e10*(1+poisson) density=7.8e10 Et=0 frictionAngle=0.096 frictionAngleW=0.228 O.materials.append(CohFrictMat(young=E*0.1,poisson=poisson,density=density,frictionAngle=frictionAngle,normalCohesion=1e19,shearCohesion=1e19,momentRotationLaw=False,alphaKr=0,label='NodeMat')) O.materials.append(FrictMat(young=E*0.1,poisson=poisson,density=density,frictionAngle=frictionAngle,label='Pmat')) O.materials.append(FrictMat(young=E,poisson=poisson,density=density,frictionAngle=frictionAngle,label='Smat')) ############################## ### SAMPLE GENERATION ### ############################## kw={'color':[1,1,1],'wire':False,'dynamic':True,'material':2} pile=ymport.text('spheres.txt',**kw) pile2=O.bodies.append(pile) #sup() print hMin(2), hMax(2) zmin=hMin(2) zmax=hMax(2) #L=hMax(2) ################################# #### MEMBRANE GENERATION ### ################################# #mesh=2 #if(mesh==1): ##Create all nodes first : #for i in range(0,nbL+1): #for j in range(0,nbl):
# -*- coding: utf-8 -*- from __future__ import print_function from yade import pack, utils, ymport, export packing='parallellepiped_10' DFN='persistentPlane30Deg' ############################ material definition facetMat = O.materials.append(JCFpmMat(type=0,young=1,frictionAngle=radians(1),poisson=0.4,density=1)) def sphereMat(): return JCFpmMat(type=1,young=1,frictionAngle=radians(1),density=1,poisson=1,tensileStrength=1e6,cohesion=1e6,jointNormalStiffness=1,jointShearStiffness=1,jointTensileStrength=1e6,jointCohesion=1e6,jointFrictionAngle=1) ############################ Import of the sphere assembly print("\n In case of errors please look at README about generating parallellepiped_10.spheres file\n") O.bodies.append(ymport.text(packing+'.spheres',scale=1,shift=Vector3(0,0,0),material=sphereMat)) #(-3,-4,-8) #### some preprocessing (not mandatory) dim=utils.aabbExtrema() xinf=dim[0][0] xsup=dim[1][0] yinf=dim[0][1] ysup=dim[1][1] zinf=dim[0][2] zsup=dim[1][2] R=0 Rmax=0 numSpheres=0. for o in O.bodies: if isinstance(o.shape,Sphere): o.shape.color=(0,0,1)
###################################################################### # A script for subdivision of macro perticles into a dense packing of # smaller particles # # Each aggragate is a dense packing, but macroscopically the packing # is loose ###################################################################### from yade import export,ymport import random random.seed(1) # to make colors always the same # load macroparticles sp = ymport.text('/tmp/cloud.txt') colors = [randomColor() for s in sp] # each macroparticle is filled randomDensePack for si,s in enumerate(sp): sphere = pack.inSphere(s.state.pos, s.shape.radius) sp1 = pack.randomDensePack( sphere, spheresInCell = 500, radius = .2, memoizeDb = '/tmp/agglomeratepackaux.db', returnSpherePack = True, ) ids = sp1.toSimulation(color=colors[si]) # add the result to simulation with uniform color for i in ids: O.bodies[i].agglomerate = si # tell each particle who is its agglomerate # save the result, including information of agglomerates which the particle belongs to export.textExt('/tmp/divided.txt','x_y_z_r_attrs',attrs=['b.agglomerate'])
nu_Salt = 0.3 rho_Salt = 3.0 * 1e-9 * massScaling # t/mm3 # O.materials.append(CohFrictMat(young=E_Salt,poisson=nu_Salt,\ frictionAngle=fric_Salt,density=rho_Salt,\ momentRotationLaw=False,alphaKr=2., alphaKtw=2.,\ normalCohesion=1000000., shearCohesion=100000000.,\ label='spheres')) ''' sp=pack.SpherePack() sp.makeCloud(mn,mx,-1,0.3333,num_spheres,False, 0.3,seed=1) #"seed" make the "random" generation always the same sphBodies=sp.toSimulation(material='spheres') ''' b = ymport.text('base_geom_100') sphBodies = O.bodies.append(b) #print sphBodies bodyHeat.heatBodies = sphBodies #bodyHeat.heatBodies.extend([4,5]) # adding upper and lower wall bodyHeat.initHeatPropsList(bodyHeat.heatBodies, 500., 430.0 * 1e6 / massScaling, 0.480) #print heat.incTemp # # Simulation parameters #---------------------- #
#### controling parameters packing = "parallellepiped_10_persistentPlane30Deg" smoothContact = True jointFrict = radians(20) jointDil = radians(0) output = "jointDip30_jointFrict20" maxIter = 10000 #### Import of the sphere assembly def sphereMat(): return JCFpmMat( type=1, young=1e8, frictionAngle=radians(30), density=3000 ) ## Rq: density needs to be adapted as porosity of real rock is different to granular assembly due to difference in porosity (utils.sumForces(baseBodies,(0,1,0))/(Z*X) should be equal to Gamma*g*h with h=Y, g=9.82 and Gamma=2700 kg/m3 O.bodies.append(ymport.text(packing + ".spheres", scale=1.0, shift=Vector3(0, 0, 0), material=sphereMat)) ## preprocessing to get dimensions of the packing dim = utils.aabbExtrema() 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 zinf = dim[0][2] zsup = dim[1][2] Z = zsup - zinf ## preprocessing to get spheres dimensions
O=Omega() from yade import plot, pack,utils,ymport #### controling parameters packing='parallellepiped_10_persistentPlane30Deg' smoothContact=True jointFrict=radians(20) jointDil=radians(0) output='jointDip30_jointFrict20' maxIter=10000 #### Import of the sphere assembly def sphereMat(): return JCFpmMat(type=1,young=1e8,frictionAngle=radians(30),density=3000,poisson=0.3,tensileStrength=1e6,cohesion=1e6,jointNormalStiffness=1e7,jointShearStiffness=1e7,jointCohesion=1e6,jointFrictionAngle=jointFrict,jointDilationAngle=jointDil) ## Rq: density needs to be adapted as porosity of real rock is different to granular assembly due to difference in porosity (utils.sumForces(baseBodies,(0,1,0))/(Z*X) should be equal to Gamma*g*h with h=Y, g=9.82 and Gamma=2700 kg/m3 print "\n In case of errors please look at README about generating parallellepiped_10_persistentPlane30Deg.spheres file\n" O.bodies.append(ymport.text(packing+'.spheres',scale=1.,shift=Vector3(0,0,0),material=sphereMat)) ## preprocessing to get dimensions of the packing dim=utils.aabbExtrema() 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 zinf=dim[0][2] zsup=dim[1][2] Z=zsup-zinf ## preprocessing to get spheres dimensions
KFluid = 2.2e11 # bulk modulus of the fluid (1/compressibility) visc = 1 # viscosity of the fluid pFactor = 1.8e-11 # to scale the permeability of the rock matrix: useless if lines 133-136 are not commented (impermeable matrix) -> cf. permeametre.py: 1.8e-11 gives a permeability of 1e-16 m2 for 111_10k slotAperture = 1e-3 # initial aperture of pre-existing fracture where the injection is done ### hydraulic loading #flowRate=injectionf # injection flow rate ### Simulation Control saveData = 10 # data record interval #iterMax=20e3 saveVTK = 20 # number of Vtk files OUT = PACK + NAME ### preprocessing to get dimensions O.bodies.append(ymport.text(fPACK + PACK + '.spheres', scale=sc)) 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 zinf = dim[0][2] zsup = dim[1][2] Z = zsup - zinf R = 0 Rmax = 0 numSpheres = 0.