sundials icon indicating copy to clipboard operation
sundials copied to clipboard

CVODES returns at wrong time when integrating backwards

Open balos1 opened this issue 1 year ago • 2 comments

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.

balos1 avatar Feb 05 '24 16:02 balos1

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.

balos1 avatar Feb 05 '24 16:02 balos1

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.

gardner48 avatar Feb 20 '24 17:02 gardner48

Closed as a duplicate

balos1 avatar Mar 29 '24 21:03 balos1