← Back to team overview

yade-users team mailing list archive

Re: Simulation stops unexpectedly

 

Hi Anton,

read https://www.yade-dem.org/sphinx/user.html#checkpoints -- although it
talks about loadTmp, the same applies to O.pause() etc. Calling O.pause()
from inside the engine will (though it might depend on exact timing between
python and computation threads, and that is probably the reason why you
sometimes get the simulation paused and sometimes not) have no effect,
modifying engines from inside the loop might lead (I would guess) to crash
and calling O.run() will have no effect either.

Currently we have no proper method for modifying engines on the fly, from
inside, although I thought a few times about something like O.postIterHook
that could be used to postpone python code execution after the current
iteration (if non-empty); that code could modify O.engines safely.

Now, you can solve your problem with something like:

def feedIsFinished():
   if condition: O.stopAtIter=O.iter+1 # stop exactly after this
simulation

O.run() 
O.wait() # will block until the simulation is stopped from inside
feedIsFinished
# modify engines here as you want
O.run() # continue with modified engines sequence

OR, you can set zero translation for the translation engine; deleting the
bodies is safe without pausing the simulation.

HTH, v.


> I pause simulation for a while, delete some engines, delete some bodies
and
> then start the simulation again.
> In this step simulation sometimes terminates, not always, but it
happens.
> 
> What do I do wrong?




Follow ups

References