about growParticle()

Asked by xjin

I try to change the particle's radius in simulation.and I write code like this:
-----------------------------------------------------------------------------------------------------------------------------
O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=15))
O.bodies.append(facet([(0,0,0),(1,1,0),(1,0,0)]))
O.bodies.append(facet([(0,0,0),(1,1,0),(0,1,0)]))
O.bodies.append(sphere([0.5,0.5,0.5],0.08))

O.bodies[8].state.vel=(0,0,0.01)
O.bodies[9].state.vel=(0,0,0.01)

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(iterPeriod=100,command='pengzhang()'),

]
O.dt=0.0005*PWaveTimeStep()

Ql=[]
globals()['Ql']=locals()['Ql']
Ql=Ql+[O.bodies[-1]]
def pengzhang():
    for i in Ql:
           growParticle(i.id,1.5,updateMass=True)

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

O.run(202)
--------------------------------------------------------------------------------------------
When simulation is completed, the particle's radius does not change.

but if I change pengzhang() like this:
------------------------------------------------------------------------------------------------
def pengzhang():
      growParticle(O.bodies[-1].id,1.5,updateMass=True)
-----------------------------------------------------------------------------------------------
the particle's radius changes.
Can you give me suggestion?
I need to use---
  for i in Ql:
           growParticle(i.id,1.5,updateMass=True)
---------------------------to do future work.
Thanks very much!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Hi,
I ran your script without changing anything and the sphere is growing. Are you really sure it is not growing on your side?
Note that manipulating locals() and globals() is really not needed. I could comment out those lines without altering the behavior. I would thus suggest to avoid such thing unless there is a good reason.
Bruno

Revision history for this message
xjin (jpeng22) said :
#2

Thanks for Bruno.
if i do not use locals() and globals() , I get message: The pengzhang does not define.
And I run the simulation again, the Particle's radius still has no change.
I install my yade in a Ubuntu16.04 which is installed in VMware Workstation Pro,my yade version is 2017.01a. And my ubuntu is Chinese version. May these influence it ?
Thanks!

Revision history for this message
Best Bruno Chareyre (bruno-chareyre) said :
#3

How do you execute this script? Are you copy-pasting from the text file
to the terminal or something?
No no, I dont think langage selection at the installation of ubuntu can
have an influence on such thing.
And as far as I know nobody introduced anti-chinese features in Yade up
to now. ;)
Bruno

Revision history for this message
xjin (jpeng22) said :
#4

Icopy-pasting from the text file to the terminal or something......
Now, I try to not use this method.
Thanks for Bruno!

Revision history for this message
xjin (jpeng22) said :
#5

Thanks Bruno Chareyre, that solved my question.