Skip to content

Sundials CVODE_BDF does not support ComponentArrays #332

@ChrisRackauckas-Claude

Description

@ChrisRackauckas-Claude

Description

The Sundials CVODE_BDF solver does not support ComponentVector inputs directly. When trying to solve an ODE with a ComponentVector initial condition using CVODE_BDF, it fails with:

MethodError: no method matching Sundials.NVector(::ComponentVector{Float64, ...}, ::Ptr{Nothing})

The NVector constructor in Sundials only accepts Vector{Float64}, not ComponentVector.

Reproduction

using ComponentArrays, DifferentialEquations, Sundials

x0 = ComponentArray(x = ones(10))
prob = ODEProblem((u, p, t) -> u, x0, (0.0, 1.0))
sol = solve(prob, CVODE_BDF(linear_solver = :BCG), reltol = 1.0e-15, abstol = 1.0e-15)
# MethodError: no method matching Sundials.NVector(::ComponentVector{...}, ::Ptr{Nothing})

Current Status

The test in test/downstream/diffeq_tests.jl (Issue 53 test) has been marked as @test_broken in #332.

This likely needs a fix in either Sundials.jl (to accept AbstractVector in NVector) or in ComponentArrays (to provide a conversion method).

Context

Originally from #53. This test was previously in a dead test directory (test/diffeq_test/) that was not wired up to CI. Now that downstream tests are running in CI, this incompatibility is visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions