← Back to team overview

yade-users team mailing list archive

[Question #676672]: list index out of range for plot.saveDataTxt ?

 

New question #676672 on Yade:
https://answers.launchpad.net/yade/+question/676672

I am trying to setup a double set of loose packing on on top of the other as prelimnary condition for simulations.
Os I have made a first program to make the fixed first packing and save the xyzr coodinates thne generate a second one on top which fall down on the first one without ny problem ... but the command plot.saveDataTxt generate an error message "list index out of range"

i don't understand why?

%%%%%%%%%%%%%%%%%%
here the output of the code :
Running script gravity-2-3rd-step-2packs.py
len-load-O.bodies =  7649
len-O.bodies =  7649
nombre_moving= 282
len-tot-O.bodies =  7931

then  part of my code :
%%%%%%%%%%%%%%%%%%%%%%%%%
O.load("1st-step.yade")
print "len-load-O.bodies = ",len(O.bodies)

O.materials[0].frictionAngle=radians(15.0)

sp=pack.SpherePack()

for c,r in sp: 
	O.bodies.append(sphere(c,r,fixed=True))
	O.bodies[0].mask = 0b01 # 1
num_small = len(O.bodies)	
print "len-O.bodies = ",num_small

sp.toSimulation()

		
nombre_moving = int(cover_pack_fraction*(box_size*box_size)/(ratio*rayon*ratio*rayon*3.14159) )
print "nombre_moving=", nombre_moving
# generate randomly spheres with uniform radius distribution
sp.makeCloud((0,0,2.2*rayon),(box_size,box_size,(3.2+.2)*rayon*ratio),rMean=rayon*ratio,rRelFuzz=.005*ratio,num= nombre_moving)
for c,r in sp: 
	if 	O.bodies[0].mask == 0b01:  continue # 1
	O.bodies[0].mask == 0b10				# 2
# add the sphere pack to the simulation
sp.toSimulation()

num_tot = len(O.bodies)	
print "len-tot-O.bodies = ",num_tot
collider.avoidSelfInteractionMask = 0b10


# simulation loop 
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
	InteractionLoop(
		# handle sphere+sphere and facet+sphere collisions
		[Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
		[Ip2_FrictMat_FrictMat_FrictPhys(frictAngle=0.0)],
		[Law2_L3Geom_FrictPhys_ElPerfPl()]
	),
#	GravityEngine(gravity=(0,0,-9.81)),
#	NewtonIntegrator(damping=0.4),
# 
	NewtonIntegrator(damping=0.4,gravity=(0,-gravity_y,-gravity_z),label='Newton_integrator'),
	# call the checkUnbalanced function (defined below) every 2 seconds
	PyRunner(command='checkUnbalanced()',realPeriod=2,label='checker'),
]
    
#without friction 
O.materials[0].frictionAngle=0

# timesteps
O.dt=.5*utils.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


def checkUnbalanced():
 global converg_min,iter_max,step1
# if step1>0: PyRunner(command='add_moving_sphere()')
 if utils.unbalancedForce()<converg_min:
		O.pause()
		plot.saveDataTxt('bbb.txt.bz2')

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.