<div dir="ltr"><div><br></div><div>PetscErrorCode YourPostStepCallback(...) {</div><div>...</div>ierr = TSSetConvergedReason(ts,TS_CONVERGED_USER);CHKERRQ(ierr);<div>...<br><div>}</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 19 Jul 2019 at 18:21, Thibault Bridel-Bertomeu via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear Petsc users, <br></div><div><br></div><div>I am facing the following situation.</div><div>I run a code that uses a Petsc TimeStepper on a supercomputer that has a given walltime. In real time, I am able to get the remaining time, and when I have only a few minutes left I want to stop the code in a clean fashion, rather than an abrupt out-of-time. I set-up all the machinery to check the remaining time already in the TSPostStep so the code checks after each iteration, and sets a flag to 1 when it got to stop.<br></div><div><br></div><div>Now what I would like to know, is how to tell TSSolve to stop iterating when that flag is set to 1 in the TSPostStep ? <br></div><div><br></div><div>Any clues would be much appreciated !</div><div><br></div><div>Best regards,<br></div><div><br></div><div><div><div dir="ltr" class="gmail-m_6752832420955780483gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div><div><div><div>Thibault Bridel-Bertomeu</div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Lisandro Dalcin<br>============<br>Research Scientist<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br></div></div></div>