Skip to content

Using saveat with IDA results in derivatives with sharp discontinuities #452

@topolarity

Description

@topolarity

Describe the bug 🐞

If saveat is provided to solve() when using IDA, the resulting derivative values appear to have strong discontinuities.

Minimal Reproducible Example 👇

julia> using OrdinaryDiffEq, Sundials, Plots
julia> dae_f(du, u, _, t) = [du[1] - u[2], u[2] - sin(t)]
julia> prob = DAEProblem(DAEFunction(dae_f), [0.0, 0.0], [0.0, 0.0], (0., 2π), nothing,
                         differential_vars=[true,false], abstol=1e-6, reltol=1e-1)
julia> sol = solve(prob, IDA(), saveat=.01)
julia> plot(sol(sol.t, Val{1}))
image

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
  [459566f4] DiffEqCallbacks v2.36.1
⌃ [1dea7af3] OrdinaryDiffEq v6.70.0
  [c3572dad] Sundials v4.23.2

Additional context

Kudos to @oscardssmith for finding this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions