timestepper exception

Summary

if dt > end_time - out.time it is set to end_time - out.time:

https://gitlab.dune-project.org/copasi/dune-copasi/-/blob/master/dune/copasi/common/stepper.hh#L112

but if this is less than the minimum allowed timestep do_step throws:

https://gitlab.dune-project.org/copasi/dune-copasi/-/blob/master/dune/copasi/common/stepper.hh#L460

it should not be an error if the last step (to get to the correct end time) is smaller than the minimum allowed step size

Steps to reproduce

It came up for me when I was trying to do a fixed timestep by setting dt, min step and max step all to 0.001, at some point by rounding error dt compares less than end_time - out.time and is adjusted down (by 1e-15 or so), causing the exception

But there are real use cases where this could occur.

What is the current bug behaviour?

Throws

What is the expected correct behaviour?

Don't throw

Ideas how to fix this?

One simple fix would be to move this check (and the similar one below checking for too large) to the constructor of SimpleAdaptiveStepper - this is the only place where the user is controlling directly what dt is.

Subsequently the stepper is setting dt: it doesn't set it larger than the max value, and if it sets it smaller than the smallest allowed value it also throws at that point, so the checks are redundant.

Edited by Liam Keegan