if os.path.exists('moments_.txt'): os.remove('moments_.txt') jCFmat = O.materials.append( JCFpmMat(young=65e9, cohesion=40e6, density=5000, frictionAngle=radians(19), tensileStrength=6e6, poisson=0.3, label='JCFmat')) sp = O.bodies.append( ymport.textExt(checksPath + '/data/checkJCFpm.spheres', 'x_y_z_r', material='JCFmat')) bb = uniaxialTestFeatures() negIds, posIds, axis, crossSectionArea = bb['negIds'], bb['posIds'], bb[ 'axis'], bb['area'] O.dt = 0.7 * PWaveTimeStep() mm, mx = [pt[axis] for pt in aabbExtrema()] coord_25, coord_50, coord_75 = mm + .25 * (mx - mm), mm + .5 * ( mx - mm), mm + .75 * (mx - mm) area_25, area_50, area_75 = approxSectionArea( coord_25, axis), approxSectionArea(coord_50, axis), approxSectionArea(coord_75, axis)
###################################################################### from builtins import zip from builtins import range from yade import export,ymport import random random.seed(1) # add walls first dim = (15,15,15) walls = aabbWalls(((0,0,0),(dim))) wallIds = O.bodies.append(walls) # load spheres from file, including information of their agglomerates ids attrs = [] print("\nPlease see README if you have errors when running this example.\n") sp = ymport.textExt('/tmp/divided.txt',format='x_y_z_r_attrs',attrs=attrs) n = max(int(a[0]) for a in attrs)+1 colors = [randomColor() for _ in range(n)] agglomerates = [[] for _ in range(n)] for s,a in zip(sp,attrs): aa = int(a[0]) s.agglomerate = aa s.shape.color = colors[aa] agglomerates[aa].append(s) for a in agglomerates: O.bodies.appendClumped(a) O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]), InteractionLoop(
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) sp = O.bodies.append( ymport.textExt('5cmEdge_1mm.spheres', 'x_y_z_r', color=(0.1, 0.1, 0.9), material='spheres')) print('num bodies ', len(O.bodies)) triax = TriaxialStressController( maxMultiplier=1. + 2e4 / young, finalMaxMultiplier=1. + 2e3 / young, thickness=0, stressMask=7, internalCompaction=True, ) ThermalEngine = ThermalEngine(dead=1, label='thermal') newton = NewtonIntegrator(damping=0.2)
# 1.245 gives K=10 for 111_10k sample #### no need to go further down #### #### material definition DENS=4000 YOUNG=30e9 ALPHA=0.2 TENS=40e5 COH=40e6 FRICT=18 def sphereMat(): return JCFpmMat(type=1,density=DENS,young=YOUNG,poisson=ALPHA,frictionAngle=radians(FRICT),tensileStrength=TENS,cohesion=COH) #### import sphere packing O.bodies.append(ymport.textExt(PACKING+'.spheres',scale=1,material=sphereMat)) R=0 Rmax=0 numSpheres=0. for o in O.bodies: if isinstance(o.shape,Sphere): o.shape.color=(0.7,0.5,0.3) numSpheres+=1 R+=o.shape.radius if o.shape.radius>Rmax: Rmax=o.shape.radius Rmean=R/numSpheres print 'Rmean=', Rmean
# agglomerates # # Using CpmMat, but the same procedure can be used with any material ###################################################################### from builtins import zip from builtins import range from yade import ymport wall = O.bodies.append(wall((0, 0, 3), 2)) O.materials.append(CpmMat(neverDamage=True, frictionAngle=0)) # load spheres from file, including information of their agglomerates ids attrs = [] print("\nPlease see README if you have errors when running this example.\n") sp = ymport.textExt('/tmp/compressed.txt', format='x_y_z_r_attrs', attrs=attrs) n = max(int(a[0]) for a in attrs) + 1 colors = [randomColor() for _ in range(n)] for s, a in zip(sp, attrs): aa = int(a[0]) s.agglomerate = aa s.shape.color = colors[aa] O.bodies.append(sp) factor = 1.5 O.engines = [ ForceResetter(), InsertionSortCollider([ Bo1_Sphere_Aabb(aabbEnlargeFactor=factor, label='bo1aabbs'), Bo1_Wall_Aabb() ]),
# gravity deposition in box, showing how to plot and save history of data, # and how to control the simulation while it is running by calling # python functions from within the simulation loop # import yade modules that we will use below from yade import pack, plot, ymport, export # create rectangular box from facets O.bodies.append(geom.facetBox((20, 20, 20), (20, 20, 20), wallMask=31)) # import the particle packing generated by the algorithm O.bodies.append( ymport.textExt('3d-yade-deposted-result.txt', format='x_y_z_r', shift=Vector3(0, 0, 0), scale=1.0)) # define the particle physical charactors idSilica = O.materials.append( CohFrictMat(young=3e8, poisson=.35, isCohesive=False, frictionAngle=.6, label="silica", density=2650)) O.materials[idSilica] # export data after the model deposition process finishes def savedata(): export.textExt('3d-yade-deposted-result.txt', 'x_y_z_r')
# gravity deposition in box, showing how to plot and save history of data, # and how to control the simulation while it is running by calling # python functions from within the simulation loop # import yade modules that we will use below from yade import pack, plot, ymport, export # create rectangular box from facets O.bodies.append(geom.facetBox((20, 20, 20), (20, 20, 20), wallMask=31)) # import the particle packing generated by the algorithm particles = ymport.textExt('2d-yade-deposted.txt', format='x_y_z_r', shift=Vector3(0, 0, 0), scale=1.0) # restrict the particle freedom of X axis for i in range(len(particles)): particles[i].state.blockedDOFs = 'xYZ' O.bodies.append(particles) # define the particle physical charactors idSilica = O.materials.append( FrictMat(young=1e7, poisson=.3, frictionAngle=.8, label="silica")) O.materials[idSilica] # when the deposition process finishes, export the data def savedata(): export.textExt('2d-yade-deposted-result.txt', 'x_y_z_r')
os.mkdir('VTK'+timeStr+identifier) if not os.path.exists('txt'+timeStr+identifier): os.mkdir('txt'+timeStr+identifier) else: shutil.rmtree('txt'+timeStr+identifier) os.mkdir('txt'+timeStr+identifier) shutil.copyfile(sys.argv[0],'txt'+timeStr+identifier+'/'+sys.argv[0]) O.materials.append(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) sp = O.bodies.append(ymport.textExt('5cmEdge_1mm.spheres', 'x_y_z_r',color=(0.1,0.1,0.9), material='spheres')) print('num bodies ', len(O.bodies)) triax=TriaxialStressController( maxMultiplier=1.+2e4/young, finalMaxMultiplier=1.+2e3/young, thickness = 0, stressMask = 7, internalCompaction=True, ) ThermalEngine = ThermalEngine(dead=1,label='thermal'); newton=NewtonIntegrator(damping=0.2) intRadius = 1
Check test for JCFpm acoustic emission module """ if((opts.threads != None and opts.threads != 1) or (opts.cores != None and opts.cores != '1')): raise YadeCheckError("This test will only work on single core, because it must be fully reproducible, but -j "+str(opts.threads)+" or --cores "+str(opts.cores)+" is used.") if os.path.exists('cracks_.txt'): os.remove('cracks_.txt') if os.path.exists('moments_.txt'): os.remove('moments_.txt') jCFmat = O.materials.append(JCFpmMat(young=65e9, cohesion=40e6, density=5000, frictionAngle=radians(19), tensileStrength=6e6, poisson=0.3, label='JCFmat')) sp = O.bodies.append(ymport.textExt(checksPath+'/data/checkJCFpm.spheres','x_y_z_r',material='JCFmat')) bb=uniaxialTestFeatures() negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area'] O.dt=0.7*PWaveTimeStep() mm,mx=[pt[axis] for pt in aabbExtrema()] coord_25,coord_50,coord_75=mm+.25*(mx-mm),mm+.5*(mx-mm),mm+.75*(mx-mm) area_25,area_50,area_75=approxSectionArea(coord_25,axis),approxSectionArea(coord_50,axis),approxSectionArea(coord_75,axis) O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.329,label='is2aabb'),],verletDist=.05*0.001), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=1.329,label='ss2sc')], [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1, label='jcf')],
p0 = O.bodies[piston[0]].state.pos[1] JCFmat = O.materials.append( JCFpmMat(young=young, cohesion=cohesion, density=density, frictionAngle=radians(finalFricDegree), tensileStrength=sigmaT, poisson=poisson, label='JCFmat')) # Specimen beam = O.bodies.append( ymport.textExt('240x80mmBeam_1.5mmrad.spheres', 'x_y_z_r', color=(0, 0.2, 0.7), material='JCFmat')) AEfile = 'AEcounts_' + identifier + '.txt' f = open('txt/' + AEfile, 'w') f.write('time iteration AEcount P deflection pistonDisp\n') f.close # remove rigid block DOFs for i in block1: O.bodies[i].state.blockedDOFs = 'xyzXYZ' for i in block2: O.bodies[i].state.blockedDOFs = 'xyzXYZ'
# agglomerates # # Using CpmMat, but the same procedure can be used with any material ###################################################################### from builtins import zip from builtins import range from yade import ymport wall = O.bodies.append(wall((0,0,3),2)) O.materials.append(CpmMat(neverDamage=True,frictionAngle=0)) # load spheres from file, including information of their agglomerates ids attrs = [] print("\nPlease see README if you have errors when running this example.\n") sp = ymport.textExt('/tmp/compressed.txt',format='x_y_z_r_attrs',attrs=attrs) n = max(int(a[0]) for a in attrs)+1 colors = [randomColor() for _ in range(n)] for s,a in zip(sp,attrs): aa = int(a[0]) s.agglomerate = aa s.shape.color = colors[aa] O.bodies.append(sp) factor=1.5 O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=factor,label='bo1aabbs'),Bo1_Wall_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=factor,label='ig2sss'),Ig2_Wall_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CpmMat_CpmMat_CpmPhys(cohesiveThresholdIter=1)],