[petsc-users] TSAdapt minimum step and exact final time

Matthew Knepley knepley at gmail.com
Wed Apr 20 16:22:29 CDT 2022

On Wed, Apr 20, 2022 at 5:13 PM Phlipot, Greg <Greg.Phlipot at jhuapl.edu>

> Hello,
> When using TS with the option TS_EXACT_FINALTIME_MATCHSTEP to force TS
> to stop at the final time, I'm seeing the adaptive step controller
> choose smaller time steps than the minimum time step that is set with
> TSAdaptGetStepLimits. For my problems, this leads to solutions that
> won't converge due to numerical issues.
> It seems like this might be due to the fact that TSAdaptChoose (
> https://petsc.org/main/src/ts/adapt/interface/tsadapt.c.html#TSAdaptChoose
> ) uses a tolerance of 10*PETSC_MACHINE_EPSILON to compare whether the
> candidate time step is close to the final time. For me,
> 10*PETSC_MACHINE_EPSILON is much smaller than my smallest time step so
> the adaptation scheme occasionally chooses a time step that results in
> a time much closer to the max time than the minimum time step. The
> subsequent time step is therefore forced to be smaller than the minimum
> time step.
> Does anyone have an idea of a workaround (without changing the source
> code) where I would be able to modify this logic to use the minimum
> time step instead of 10*PETSC_MACHINE_EPSILON? E.g. with Pre/Post stage
> callbacks and manually modifying the time step?

It seems that if you want to disallow small timesteps, but also match
accurately a final time,
then the best choice is interpolation (TS_EXACTFINALTIME_INTERPOLATE). If
you only
want to be as accurate as your timestep, shouldn't you just let it step



> Thank you,
> Greg

What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220420/e96b62a7/attachment.html>

More information about the petsc-users mailing list