New question #678308 on Yade: https://answers.launchpad.net/yade/+question/678308
hi every one , i am trying to save properties of spheres (id,x,y,z,r,force) in file during simulation each second (period=1 s) and add iteration number to base name each 1s. the simulation is about filling a cylinder by pouring spheres under vertical vibration . and this is what i obtain : ArgumentError Traceback (most recent call last) /usr/bin/yade in <module>() /usr/bin/yade in myaddData() 43 def myaddData(): 44 for b in bodies2: ---> 45 idt,rad=O.bodies[b].id,O.bodies[b].radius 46 x,y,z=O.bodies[b].state.pos[0],O.bodies[b].state.pos[1],O.bodies[b].state.pos[2] 47 veloc,force=O.bodies[b].vel[2],O.forces.f(O.bodies[b].id) and i have error in : File "save.py", line 51, in <module> yade.wrapper.Recorder(addIternNum=True,file=fil) AttributeError: No such attribute: addIternNum. my script is : #!/usr/bin/python # coding: utf-8 from yade import pack,plot,export #material of cylinder Mat1 = O.materials.append(ViscElMat(kn=10.0e4,ks=10.0e4,frictionAngle=0.455,density=2650.0)) # create Cylinder Cylinder=O.bodies.append(geom.facetCylinder((0,0,1.5),2.0,height=3.0,wallMask=6,segmentsNumber=64,material=Mat1)) # create sphere packing sp=pack.SpherePack() sp.makeCloud((-1.2,-1.2,1.5),(1.2,1.2,8.0),rMean=.2,rRelFuzz=.1,num=128) sp.toSimulation(color=(0,1,0)) O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()] ), NewtonIntegrator(gravity=(0,0,-9.81),damping=0.3), HarmonicMotionEngine(A=[0,0,0.5], f=[0,0,1.0], fi = [0.0,0.0,pi],ids =Cylinder),# vertical vibration # HarmonicMotionEngine(A = (0,0.002,0),f = (0,50,0),fi = (0,-0.5*math.pi,0),ids =Cylinder), horizontal vibration PyRunner(command='myaddData()',realPeriod=1,initRun=True), #call def fonction every second ] O.dt=utils.PWaveTimeStep() #to slow down the motion O.dt=.9*PWaveTimeStep() O.resetTime() # open file fil=open("vibrations.txt","a+") fil.write ('id \t x \t y \t z \t velocity \t radius \t force \n') bodies2 = [b for b in O.bodies if isinstance(b.shape,Sphere)] print 'number of particles2 :', len(bodies2) #saving parameters of spheres in file def myaddData(): for b in bodies2: idt,rad=O.bodies[b].id,O.bodies[b].radius x,y,z=O.bodies[b].state.pos[0],O.bodies[b].state.pos[1],O.bodies[b].state.pos[2] veloc,force=O.bodies[b].vel[2],O.forces.f(O.bodies[b].id) fil.write("{:e} {:e} {:e} {:e} {:e} {:e} {:e}\n".format(idt,x,y,z,veloc,rad,force)) # ( .format = % ) # add iteration number to basename yade.wrapper.Recorder(addIternNum=True,file=fil) O.saveTmp() fil.close() Any ideas ? Thanks in advance. -- 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