InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()] ), TriaxialStressController( thickness = 0, stressMask = 7, internalCompaction = False, label = 'compressor', ), NewtonIntegrator(damping=.6), ] O.dt = PWaveTimeStep() # compress the sample compressor.goal1 = compressor.goal2 = compressor.goal3 = -1e-7 O.run(50000,True) compressor.goal1 = compressor.goal2 = compressor.goal3 = -1e-5 O.run(30000,True) # save the result, including information of agglomerates which the particle belongs to export.textExt('/tmp/compressed.txt','x_y_z_r_attrs',attrs=['b.agglomerate']) try: from yade import qt qt.View() except: pass
def savedata(): export.textExt('3d-yade-deposted-result.txt', 'x_y_z_r')
O.bodies[n.id1].state.jointNormal1=-jointNormalRef #### for visualization: #bj=0 #vert=(0.,1.,0.) #hor=(0.,1.,1.) #for o in O.bodies: #if o.state.onJoint==True : # or o.shape.name=='Facet': ##if o.shape.name=='Facet': ##o.shape.wire=True ##o.state.pos+=(0,50,0) ##bj+=1 #if o.state.jointNormal1.dot(hor)>0 : ##o.state.pos+=(0,50,0) #o.shape.color=jointcolor1 #elif o.state.jointNormal1.dot(hor)<0 : ##o.state.pos+=(0,55,0) #o.shape.color=jointcolor2 #if o.mat.type>2 : #bj+=1 #o.shape.color=jointcolor5 ##print o.state.jointNormal.dot(vert) #### Save text file with informations on each sphere export.text(packing+'_'+DFN+'.spheres') export.textExt(packing+'_'+DFN+'_jointedPM.spheres',format='jointedPM') O.wait()
###################################################################### 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']) try: from yade import qt qt.View() except: pass
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 :-)
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))
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 zinf = dim[0][2] zsup = dim[1][2] Z = zsup - zinf r = X / 15. O.reset()