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

Sundials and SecondOrderODEProblem (OrdinaryDiffEq) not compatible

Open magix2 opened this issue 4 years ago • 0 comments

To reproduce the problem:

using OrdinaryDiffEq
ω = 1
x₀ = [0.0]
dx₀ = [π/2]
tspan = (0.0, 2π)

function harmonic_oscillator(ddu,du,u,ω,t)
    ddu .= -ω^2 * u
end

prob = SecondOrderODEProblem(harmonic_oscillator, dx₀, x₀, tspan, ω)

#Tsit 5 works
sol = solve(prob, Tsit5())

using Sundials
# error using CVODE_BDF
sol = solve(prob, CVODE_BDF())

Error:

ERROR: LoadError: MethodError: Cannot `convert` an object of type Array{Float64,1} to an object of type RecursiveArrayTools.ArrayPartition{Float64,Tuple{Array{Float64,1},Array{Float64,1}}}

Current workaround: Formulate the problem as an ODEProblem

magix2 avatar Jan 27 '21 13:01 magix2