New question #670501 on Yade: https://answers.launchpad.net/yade/+question/670501
Hi, I am trying to use gravity (based on the gravity deposition example) to fill a volume with clumps and have them fall. I have several issues at the moment however. When I use makeClumpCloud to add clumps to the simulation only a few clumps are added. Sometimes only 1 clump other times 20 or so, even though the volume is quite large (error: Exceeded 200 attempts to place non-overlapping clump. Only 22 clumps were added, although you requested 1000) Then once the clumps have been added to the simulation I try to run the gravity deposition but end up with error UserWarning: No labelled objects found. Use label='...' kwarg on individual plots. This error also appears when running the gravity_deposition example from https://yade-dem.org/doc/tutorial-examples.html is there a matplotlib work around for this? many thanks in advance Jesse code is pasted below ###################################################################### # A script for creating a dense packing of clumps # # Each aggragate is a dense packing, but macroscopically the packing # is loose ###################################################################### def getClumpInfo(): c = [] for b in O.bodies: #print(b.isClump) if b.isClump: c.append(b) #print(b.shape) print('Clump ',b.id,' has following members:') keys = b.shape.members.keys() for ii in range(0,len(keys)): print('- Body ',keys[ii]) #print(c) return c def setClumpInfo(disp=False): c = [] aggNum = -1 for b in O.bodies: #print(b.isClump) if b.isClump: aggNum+=1 c.append(b) #print(b.shape) if disp: print('Clump ',b.id,' has following members:') keys = b.shape.members.keys() for ii in range(0,len(keys)): if disp: print('- Body ',keys[ii]) #O.bodies[keys[ii]].agglomerate = b.id # tell each particle who is its agglomerate O.bodies[keys[ii]].agglomerate = aggNum # tell each particle who is its agglomerate print(str(len(c))+ ' ' + str(aggNum)) return len(c) #number of clumps def gravityDeposition(): # 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 # create rectangular box from facets O.bodies.append(geom.facetBox(center,extend,wallMask=31)) O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( # handle sphere+sphere and facet+sphere collisions [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()] ), NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4), # call the checkUnbalanced function (defined below) every 2 seconds # PyRunner(command='checkUnbalanced()',realPeriod=2), # call the addPlotData function every 200 steps # PyRunner(command='addPlotData()',iterPeriod=100) ] O.dt=.5*PWaveTimeStep() # enable energy tracking; any simulation parts supporting it # can create and update arbitrary energy types, which can be # accessed as O.energy['energyName'] subsequently O.trackEnergy=True O.run(500,True) raw_input('test') # if the unbalanced forces goes below .05, the packing # is considered stabilized, therefore we stop collected # data history and stop def checkUnbalanced(): if unbalancedForce()<.05: O.pause() plot.saveDataTxt('bbb.txt.bz2') # plot.saveGnuplot('bbb') is also possible # collect history of data which will be plotted def addPlotData(): # each item is given a names, by which it can be the unsed in plot.plots # the **O.energy converts dictionary-like O.energy to plot.addData arguments plot.addData(i=O.iter,unbalanced=unbalancedForce(),**O.energy) # define how to plot data: 'i' (step number) on the x-axis, unbalanced force # on the left y-axis, all energies on the right y-axis # (O.energy.keys is function which will be called to get all defined energies) # None separates left and right y-axis plot.plots={'i':('unbalanced',None,O.energy.keys)} # show the plot on the screen, and update while the simulation runs plot.plot() from yade import pack,export,ymport import random random.seed(1) # to make colors always the same numClumps = 2 minCorner = (0,0,0) maxCorner = (7e-7,7e-7,7e-7) #O.periodic=True sp = pack.SpherePack() # load clumps ymport.textClumps('/tmp/clump0.txt') c0 = pack.SpherePack() c0.fromSimulation() ymport.textClumps('/tmp/clump1.txt') #c1 = getClumpInfo() c1 = pack.SpherePack() c1.fromSimulation() O.switchScene(); O.resetThisScene() #####!!!!!!! print('Creating Clump Cloud') test = sp.makeClumpCloud(minCorner, maxCorner, [c0,c1], periodic=True, num = 1000)#, periodic=True, num=-1, seed=1) print(test) sp.toSimulation() dim=utils.aabbExtrema() dim=utils.aabbExtrema() xinf=dim[0][0] xsup=dim[1][0] xdim = xsup-xinf X=xinf+(xdim)/2. yinf=dim[0][1] ysup=dim[1][1] ydim = ysup-yinf Y=yinf+(ydim)/2. zinf=dim[0][2] zsup=dim[1][2] zdim = zsup-zinf Z=zinf+(zdim)/2. center = Vector3(X,Y,Z) #center of the packing extend = Vector3(xdim,ydim,zdim) #extends of the packing raw_input('Before gravity') gravityDeposition() raw_input('After gravity') quit() setClumpInfo() #print(enumerate(sp)) # 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']) print('Number of particles = ' , len(O.bodies)) try: from yade import qt qt.View() except: pass -- You received this question notification because your team yade-users is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp

