How to stop the current calculation and jump to the next one in the batch mode on the condition that the current calculation takes too much time?

Asked by jasperb on 2020-03-07

Hi everyone,

I am using the batch mode andit will take much longer time than expected sometimes for one single simulation in case the input parameters are not proper.
So I want to make a function activated when the calculation time is larger than a threshold. This function will make Yade jump to the next calculation. Like "continue" in "for" loop in C language.

Cheers

Jasper

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
2020-03-16
Last query:
2020-03-16
Last reply:
2020-03-09
Robert Caulk (rcaulk) said : #1

Does:

if O.realtime>someValue: sys.exit(0)

work?

Hi,
There is nothing batch-specific in the question.
It is up to you to run iterations or not, based on a condition.
Either "while condition: O.run(N,True)" or "if !condition: O.pause()".
If you don't run iterations the simulation stops, and if batch it will move to next one.
Bruno

Jan Stránský (honzik) said : #3

Hi,
to complete the above answers, you can use runningInBatch() function [1] to distinguish between "normal" and batch mode
cheers
Jan

[1] https://yade-dem.org/doc/yade.utils.html#yade.utils.runningInBatch

jasperb (jasperb) said : #4

Thanks Bruno Chareyre, that solved my question.