← Back to team overview

yade-users team mailing list archive

[Question #702412]: O.interactions[0, 1] is unable to detect the interactions between sphere and wall, throwing an error stating "No such interaction"

 

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

Hi everyone,
I was doing a simulation of a sphere hitting on a wall at some distance in an acceleration field. My code is given bellow:

## code starts here
## SCRIPT TO TEST IMPACT BETWEEN A SPHERE AND A WALL (MINDLIN - nonlinear elastic model)

## list of engines
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Wall_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_MindlinPhys()],
		[Law2_ScGeom_MindlinPhys_Mindlin()]
	),
	NewtonIntegrator(damping=0.0,gravity=(10,0,0)),
	###
	### NOTE this extra engine:
	###
	PyRunner(iterPeriod=1,command='myAddPlotData()')
]

## define and append material
mat=FrictMat(young=7.0e10,poisson=0.3,density=2699,frictionAngle=radians(0),label='Al.alloy')
O.materials.append(mat)

## create a sphere and a wall and append them

s0=sphere([0,0,0],0.1,color=[0,1,0],fixed=False,wire=False,material='Al.alloy')
w=wall([0.2,0,0],axis=0,sense=0,color=[1,0,0])
O.bodies.append(s0)
O.bodies.append(w)

## time step
O.dt=.2*PWaveTimeStep()
O.saveTmp('Mindlin')

from yade import qt
qt.View()
qt.Controller()

############################################
##### now the part pertaining to plots #####
############################################

from yade import plot

def myAddPlotData():
	if O.interactions[0,1].isReal:
		i=O.interactions[0,1]
		## O.interactions[0,1] is not able to detect the interactions between sphere and wall
		## error is throwing here stating "No such interaction" 
		## but while running the test, it is clearly visible that the sphere is colliding with wall and bouncing back
		## rest of the code is working good. PLEASE HELP!!!
		plot.addData(fn=i.phys.normalForce[0],step=O.iter,un=s0.shape.radius-w.state.pos[0]+s0.state.pos[0],kn=i.phys.kn)	

O.run(100,True)

## make one plot: step as function of fn

plot.plots={'un':('fn')}

## this function is called by plotDataCollector
## it should add data with the labels that we will plot
## if a datum is not specified (but exists), it will be NaN and will not be plotted

plot.plot()
## code ends here

In the above code, an error is throwing in the 46th line. The error message is given below:
IndexError                                Traceback (most recent call last)
/usr/bin/yade in <module>

/usr/bin/yade in myAddPlotData()
     44 
     45 def myAddPlotData():
---> 46         if O.interactions[0,1].isReal:
     47                 i=O.interactions[0,1]
     48                 ## O.interactions[0,1] is not able to detect the interactions between sphere and wall

IndexError: No such interaction

The exact same code runs good when I am trying with two spheres instead of sphere and a wall.
Please help me to figure this out. I have to track contact forces while they are impacting.
Please also tell me if there is any other way to track contact force rather using O.interactions[0,1].

Thanks in advance.

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