← Back to team overview

yade-users team mailing list archive

Re: [Question #699471]: Load and run new simulation

 

Question #699471 on Yade changed:
https://answers.launchpad.net/yade/+question/699471

    Status: Open => Answered

Jan Stránský proposed the following answer:
Sherlock Holmes approach:
If you have suspicion about realPeriod=1, focus on this and what is going on there.
It is used here: PyRunner(command='checkForce()', realPeriod=1, label="fCheck"),
It calls checkForce. In checkforce: fCheck.command = 'unloadPlate()'
in unloadPlate: fCheck.command = 'stopUnloading()'
in stopUnloading: fCheck.command = 'Savecheck()'
in SaveCheck: o.engines = o.engines+[PyRunner(command='ParticleSwelling()', iterPeriod=10000)]
Still done every 1 real second.

So every 1 real second you add a NEW PyRunner with command='ParticleSwelling()' and iterPeriod=10000.
Now, if you add a new PyRunner in the middle of simulation and O.iter > iterPeriod, it is called immediately the next iteration. Just then it would wait 10000 iteration for next call.

So your PyRunner works as expected, calling ParticleSwelling() every
10000 iteration. Just there is many of them..

To fix it, you can do e.g.:
###
def Savecheck():
    ...
    if save==0:
        o.engines = o.engines+[PyRunner(command='ParticleSwelling()', iterPeriod=10000)]
        fCheck.dead = True # (!!!)
###

Cheers
Jan

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