ODE Sundials not recognizing `maxiters` argument

I am using OrdinaryDiffEq with Sundials.
While other options such as

  • stability_limit_detect
  • max_hnil_warns
  • max_error_test_failures

seem to be working, the option maxiters doesn’t seem to stop iteration at all; The iteration even exceeds the default limits which are 500 for sundials and 1e5 for the Julia interface.

I have made an example:

using OrdinaryDiffEq, Sundials
function osc(du,u,p,t)
 du[1] = u[2]
 du[2] = -u[1]
end
u0 = [1.0;0.0]
tspan = (0.0,1e8)
prob = ODEProblem(osc,u0,tspan)
sol = solve(prob,CVODE_BDF(), maxiters=10)
sol.t|>length

this returns
2086564 (>1e5)
on my PC.

the version of packages are
Sundials v4.2.3
OrdinaryDiffEq v5.40.0
on
Julia v"1.4.2"

I know there is a similar issue without a solution yet. I wonder if there is a work-around for this problem because my original problem takes too much time using other solvers.
https://github.com/SciML/Sundials.jl/issues/269

https://github.com/SciML/Sundials.jl/pull/270 This PR should fix it. I will release a new version when it’s merged.

2 Likes

Thank you for such a quick fix, YingboMa.
I have confirmed that maxiters is working both for the given example and my original problem.