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

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:
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :
#1

Does:

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

work?

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

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

Revision history for this message
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

Revision history for this message
jasperb (jasperb) said :
#4

Thanks Bruno Chareyre, that solved my question.