[petsc-users] How to stop a TS early

Lisandro Dalcin dalcinl at gmail.com
Fri Jul 19 10:33:31 CDT 2019


PetscErrorCode YourPostStepCallback(...) {
...
ierr = TSSetConvergedReason(ts,TS_CONVERGED_USER);CHKERRQ(ierr);
...
}

On Fri, 19 Jul 2019 at 18:21, Thibault Bridel-Bertomeu via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Dear Petsc users,
>
> I am facing the following situation.
> 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.
>
> 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 ?
>
> Any clues would be much appreciated !
>
> Best regards,
>
> Thibault Bridel-Bertomeu
>


-- 
Lisandro Dalcin
============
Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190719/8ad572bb/attachment.html>


More information about the petsc-users mailing list