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

Hi All,

I am simulating a particle impact on a flat surface and would like to track the 
position and kinetic energy of the particle. 
I am using yade 1.07 version on Ubuntu 14.04 LTS.

I encountered a problem with the "PyRunner" in my script while executing a 
function meant for saving data after every N iteration. 


The script is given below:

from yade import qt
from yade import plot,pack,geom

#define material properties:

rho = 2500 #density
fric = 0.5 #friction coefficient
fric_angle = atan(fric) #friction angle in radian
stiff_n = 1e8
stiff_s = 1e8
c_n = 0.1 #normal viscous damping
c_s = 0.1 #shear viscous damping
l_d = 0.2 #local damping

#define a material:

Mat = O.materials.append(ViscElMat(kn=stiff_n, ks=stiff_s, \
cn=c_n, cs=c_s, density=rho, frictionAngle=fric_angle))

#create a sphere:

b1 = utils.sphere(center=(0,0.0,1),radius=0.05,fixed=False,material=Mat)
O.bodies.append(b1)

#O.bodies.append(utils.sphere(center=(0,0,1), radius=0.05, material=Mat))

#create a plane facet:

O.bodies.append(geom.facetBox(center=(0,0,0), extents=(0.5,0.5,0), fixed=True, 
material=MyMaterial))

#define engines:

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), #Axis-aligned 
bounding box
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom()], #Interaction 
geometry
  [Ip2_ViscElMat_ViscElMat_ViscElPhys()], #Interaction physics
  [Law2_ScGeom_ViscElPhys_Basic()], #Contact law
 ),
 GravityEngine(gravity=(0,0,-9.81)),
 NewtonIntegrator(damping=l_d),

 
qt.SnapshotEngine(fileBase='/home/subhasish/YADE/tutorials/image/',label='snapper',iterPeriod=100),
 PyRunner(iterPeriod=5,command='plotAddData()')
]

O.run(50000)

#show geometry:

v=qt.View(); v.axes=True
v.viewDir=Vector3(0,1,-.05)
v.eyePosition=Vector3(0,-5,.5)

O.dt = 1e-4

#O.dt=.5*utils.PWaveTimeStep()

def plotAddData():
 pos = b1.state.pos
 Intrs = len( b1.intrs())
 plot.addData(i=O.iter,t=O.time,x=pos[0], y=pos[1], z=pos[2], 
Ek=utils.kineticEnergy(), nIntrs=nIntrs)
 plot.saveDataTxt('file2.txt.bz2')

The error appeared on the terminal as "NameError: name 'plotAddDatan' is not 
defined". I came across similar problem in this forum but none seems to work. 
Any help would be appreciated.

Regards,

Subha


-- 
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     : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to