# Error with ODE Tableaus by DiffEqDevTools

**URL:** <https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448>\
**Category:** Modelling & Simulations\
**Tags:** diffeq, sciml\
**Created:** [September 1, 2023, 4:10pm UTC](https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448 "2023-09-01T16:10:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon79](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@simon79](https://discourse.julialang.org/u/simon79)\
**Post date:** [September 1, 2023, 4:10pm UTC](https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448/1 "2023-09-01T16:10:33Z")

</div>

I am having errors with the **tableau methods** for `explicitRK` using `DiffEqDevTools` listed in  
[tableau-methods-list](https://docs.sciml.ai/DiffEqDevDocs/stable/internals/tableaus/#Explicit-Runge-Kutta-Methods)

The code

```julia
using DiffEqBase
using DiffEqDevTools
using OrdinaryDiffEq
using ODEInterfaceDiffEq
using SciMLBase

tspan = (0.0, 1.0)
prob = ODEProblem(f!, u, tspan);

alg = ExplicitRK(tableau = constructEuler())
solution = solve(prob, alg, dt=0.2)

```

EXCEPT for the default tableau method `constructDormandPrince()`, all of the other explicit tableau methods listed in [Tableau-methods](https://docs.sciml.ai/DiffEqDevDocs/stable/internals/tableaus/#Explicit-Runge-Kutta-Methods) break with the bound error below:

```julia
   inputs[:ode_solver] = ExplicitRK(; tableau = DiffEqBase.ExplicitRKTableau{Matrix{Float64}, Vector{Float64}, Float64}([0.0;;], [0.0], [1.0], Float64[], Float64[], 1, 1, 0, false, 2.0),)
│ inputs[:tinit] = 0.0
│ inputs[:tend] = 150
└ inputs[:Δt] = 0.3
ERROR: LoadError: BoundsError: attempt to access 0-element Vector{Float64} at index [1]
Stacktrace:
  [1] getindex
    @ ./array.jl:924 [inlined]
  [2] maybeview
    @ ./views.jl:147 [inlined]
  [3] dotview
    @ ./broadcast.jl:1201 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/OrdinaryDiffEq/Kxv5a/src/perform_step/explicit_rk_perform_step.jl:0 [inlined]
  [5] accumulate_EEst!
    @ ~/.julia/packages/OrdinaryDiffEq/Kxv5a/src/perform_step/explicit_rk_perform_step.jl:106 [inlined]
  [6] runtime_split_EEst!(tmp::Vector{Float64}, αEEst::Vector{Float64}, utilde::Vector{Float64}, kk::Vector{Vector{Float64}}, dt::Float64, stages::Int64)
    @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/Kxv5a/src/perform_step/explicit_rk_perform_step.jl:199

```

Notice that the standard ODE solvers listed in [SCIML explicit solvers](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/#Explicit-Runge-Kutta-Methods) work correctly (for example `Tsit5()`, `SSPRK54()`, etc.)

Are there specific data structure requirements on `u` and `f` to use the tableau methods that cause the bound error?

Notice: f! is the function that build the RHS of du/dt = RHS and if built elsewhere.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [September 2, 2023, 11:05am UTC](https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448/2 "2023-09-02T11:05:53Z")

</div>

I just tested master and it seems to run fine: [Test master by ChrisRackauckas · Pull Request #112 · SciML/DiffEqDevTools.jl · GitHub](https://github.com/SciML/DiffEqDevTools.jl/pull/112)

What version of DiffEqDevTools are you running with what OrdinaryDiffEq?

---

<div class="post-metadata">

**Author:** ![simon79](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@simon79](https://discourse.julialang.org/u/simon79)\
**Post date:** [September 2, 2023, 12:15pm UTC](https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448/3 "2023-09-02T12:15:09Z")

</div>

hello @ChrisRackauckas thanks for looking into this.

DiffEqDevTools v2.35.0  
OrdinaryDiffEq v6.54.0

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [September 2, 2023, 1:17pm UTC](https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448/4 "2023-09-02T13:17:43Z")

</div>

Does running the DiffEqDevTools test work for you?

What happens if you manually set `adaptive=false` in `solve`?

---

<div class="post-metadata">

**Author:** ![simon79](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@simon79](https://discourse.julialang.org/u/simon79)\
**Post date:** [September 2, 2023, 6:50pm UTC](https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448/5 "2023-09-02T18:50:10Z")

</div>

@ChrisRackauckas  
setting `adaptive=false` in `solve` solved the problem. Fantastic, thank you!

FYI: this is the setup that works correctly:  
` ExplicitRK(; tableau = DiffEqBase.ExplicitRKTableau{Matrix{Float64}, Vector{Float64}, Float64}([0.0;;], [0.0], [1.0], Float64[], Float64[], 1, 1, 0, false, 2.0),)`

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [September 2, 2023, 10:46pm UTC](https://discourse.julialang.org/t/error-with-ode-tableaus-by-diffeqdevtools/103448/6 "2023-09-02T22:46:16Z")

</div>

Yeah I see, after a recent update it’s not flipping `adaptive=false` automatically on non-adaptive tableaus. I can look into that.
