SciMLBase.jl icon indicating copy to clipboard operation
SciMLBase.jl copied to clipboard

Upgrade path for check_error interface conformity

Open termi-official opened this issue 11 months ago • 7 comments

Precedes #896 to provide an upgrade path for last_step_failed

termi-official avatar Dec 23 '24 15:12 termi-official

What exactly is this for?

ChrisRackauckas avatar Jan 22 '25 18:01 ChrisRackauckas

This is the first step for https://github.com/SciML/SciMLBase.jl/pull/896 (see https://github.com/SciML/SciMLBase.jl/pull/896#discussion_r1895057885). With this change I can as next step go to the downstream packages and adjust the last_step_failed function, and then I can go back to 896. (If we just merge 869 almost all CIs fail).

The larger context is to simplify the development of custom time integrators compatible which are at least partially compatible with the SciML ecosystem.

termi-official avatar Jan 22 '25 18:01 termi-official

If the steps failed and the Newton algorithm diverged, I think we'd still error out unless the system had a bool set to just continue?

ChrisRackauckas avatar Jan 22 '25 18:01 ChrisRackauckas

Right. However, this error is ~~thrown~~ handled in a different code path. This PR merely hoists the condition out of the function call. See e.g. https://github.com/SciML/OrdinaryDiffEq.jl/blob/013c00d81292d7ddce87841b7765dde030c2875e/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl#L34-L36 . This function is copy pasted across the all packages with custom integrators in SciML org.

termi-official avatar Jan 22 '25 18:01 termi-official

If the steps failed and the Newton algorithm diverged, I think we'd still error out unless the system had a bool set to just continue?

Reading over it again, maybe I misunderstood you here. Right now in OrdinaryDiffEqCore the integrator has do_error_check, which is set to true in each iteration header. I cannot find the mentioned code path in your comment. I.e. I do not see how the Newton convergence failure for adaptive time integration algorithms results in the ConvergenceFailure flag being set for the integrator.

https://github.com/search?q=org%3ASciML%20ConvergenceFailure&type=code

termi-official avatar Jan 22 '25 18:01 termi-official

I still don't understand what this is for. @oscardssmith should we talk about this? Is there a test that should go with this?

ChrisRackauckas avatar May 06 '25 15:05 ChrisRackauckas

The preceding comment why I hoisted this out is here https://github.com/SciML/SciMLBase.jl/pull/896#discussion_r1895057885

termi-official avatar May 06 '25 19:05 termi-official