can't get O.stopAtTime to work

Asked by Daniel Kiracofe on 2020-05-20

I am having trouble getting O.stopAtTime to work. I tried this little script. From my understanding, this would run until either 400 iterations, or 20 seconds, whichever comes first. Actual result, runs for 400 iterations = 320 seconds. Went way past the intended stop time.

O.stopAtTime = 20.0
O.stopAtIter = 400
O.run(-1, True)
print(O.time)
print(O.iter)

So maybe it's not whichever comes first, it's whichever comes last. So then I tried this

O.stopAtTime = 20.0
O.stopAtIter = 4
O.run(-1, True)
print(O.time)
print(O.iter)

That runs for 4 iterations = 3.2 seconds. So it appears to be always using the value of O.stopAtIter, and O.stopAtTime is ignored. So then let's try this:

O.stopAtTime = 20.0
O.run(-1, True)
print(O.time)
print(O.iter)

This runs forever.

I found this thread from 2014: https://answers.launchpad.net/yade/+question/246284 but the syntax suggested there O._sceneObj().stopAtTime no longer works.

Running single threaded job with a recent daily build (Yade 20200511-3819~5bf8512~buster1)

As a workaround, I can definitely put in a little PyRunner to periodically check O.time and pause when it hits a certain value, but it seems like that shouldn't be necessary.

What am I missing?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Daniel Kiracofe
Solved:
2020-05-21
Last query:
2020-05-21
Last reply:
2020-05-20
Jan Stránský (honzik) said : #1

Hello,
it is a bug, thanks for finding it :-) please open an issue on gitlab.
probably nobody was using it..
The problem is that for stop, O.time must be precisely equal to O.stopAtTime [1], which is very unlikely (contrary to stopAtIter).
cheers
Jan

[1] https://gitlab.com/yade-dev/trunk/-/blob/master/core/SimulationFlow.cpp#L30

Daniel Kiracofe (kiracodl) said : #2

Got it, thanks. I opened an issue.

Daniel