# yade-users team mailing list archive

## [Question #670501]: gravity deposition of clumps

```New question #670501 on Yade:

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?

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

# create rectangular box from facets

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
]
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
# 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

# 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()

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()

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:
qt.View()
except:
pass

--