← Back to team overview

yade-users team mailing list archive

[Question #407624]: about the PyRunner

 

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

I have a question in :https://answers.launchpad.net/yade/+question/407567
In the above question, I do not clear it.Then I write a script like this:
------------------------------------------------------------------------------------------------------------------------------------------
z=[1]
az=[1]
globals()['z']=locals()['z']
globals()['az']=locals()['az']

from yade import pack
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=.8)
sp.toSimulation()

O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=63))
Q=len(O.bodies)

def fu(): 
global z
z=[2]
print O.iter
print z

globals()['fu']=locals()['fu']


O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_L3Geom_FrictPhys_ElPerfPl()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
PyRunner(command='fu()',iterPeriod=1),
PyRunner(command='az=[11]',iterPeriod=1),
PyRunner(command='print az',iterPeriod=1),
]
O.dt=0.05*PWaveTimeStep()
--------------------------------------------------------------------------------------------------------------------------------------------
I type " O.run(3)", and then I get result like this:
------------------------------
Yade [86]: 1
[2]
[11]
2
[2]
[11]
---------------------------
After the work, I type "z" and "az", the result is like this:
----------------------------------
Yade [86]: z
 ->  [86]: [1]

Yade [87]: az
 ->  [87]: [1]
--------------------------------------------
I want to change "z" and "az", but it seems that the PyRunner can not work as I desire.
Can you help me?
Thanks very much.



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