# ODE Sundials not recognizing \`maxiters\` argument

**URL:** https://discourse.julialang.org/t/ode-sundials-not-recognizing-maxiters-argument/42377
**Category:** Modelling & Simulations
**Tags:** question, package, diffeq
**Created:** [July 1, 2020, 3:21pm UTC](https://discourse.julialang.org/t/ode-sundials-not-recognizing-maxiters-argument/42377 "2020-07-01T15:21:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Yuki-Kanai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuki-kanai/32/16097_2.png) [@Yuki-Kanai](https://discourse.julialang.org/u/Yuki-Kanai)
#### Post date: [July 1, 2020, 3:21pm UTC](https://discourse.julialang.org/t/ode-sundials-not-recognizing-maxiters-argument/42377/1 "2020-07-01T15:21:45Z")

</div>

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:

```julia
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/issues/269)

---

<div class="post-metadata">

### Author: ![YingboMa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yingboma/32/2181_2.png) [@YingboMa](https://discourse.julialang.org/u/YingboMa)
#### Post date: [July 1, 2020, 9:29pm UTC](https://discourse.julialang.org/t/ode-sundials-not-recognizing-maxiters-argument/42377/2 "2020-07-01T21:29:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Yuki-Kanai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuki-kanai/32/16097_2.png) [@Yuki-Kanai](https://discourse.julialang.org/u/Yuki-Kanai)
#### Post date: [July 2, 2020, 6:18am UTC](https://discourse.julialang.org/t/ode-sundials-not-recognizing-maxiters-argument/42377/3 "2020-07-02T06:18:18Z")

</div>

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