sundials
sundials copied to clipboard
CVODES returns at wrong time when integrating backwards
I believe this change (specifically line 3068 in cvodes.c) is the culprit. It is an issue in all packages but CVODES and IDAS are the only that do backwards integration right now so those are the only places one would notice it. Further context: https://groups.google.com/g/sundials-users/c/hSEyY0dF5CM.
From a brief look, I think what is happening is that CVODES sets the stop time when integrating backwards, but the tstop interp check is guarded by (tout - cv_mem->cv_tstop) * cv_mem->cv_h >= ZERO
to ensure tout >= tstop
which is obviously false when tout < tstop
as it may be when integrating backwards.
I believe this is a duplicate of #339 and should be fixed by #349 in v6.7.0 (the reporter is using v6.6.2). I've asked them to try v6.7.0 and let us know if the problem persists.
The check (tout - cv_mem->cv_tstop) * cv_mem->cv_h >= ZERO
is correct as the multiplication by cv_h
accounts for the direction of integration.
Closed as a duplicate