[petsc-users] How to stop a TS early

Thibault Bridel-Bertomeu thibault.bridelbertomeu at gmail.com
Tue Jul 23 01:24:59 CDT 2019


Thank you very much for the info Lisandro.

Thibault Bridel-Bertomeu


Le ven. 19 juil. 2019 à 17:33, Lisandro Dalcin <dalcinl at gmail.com> a écrit :

>
> 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/20190723/f70537b9/attachment.html>


More information about the petsc-users mailing list