Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
topolarity opened this issue Feb 5, 2024 · 2 comments
Labels

Comments

@topolarity
Copy link

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.

@topolarity topolarity added the bug label Feb 5, 2024
@topolarity
Copy link
Author

Without saveat the interpolation is also quite cursed:

julia> sol = solve(prob, IDA())
julia> t′ = 0.0:1e-3:2π
julia> plot(sol(t′, Val{1}))
image

@ChrisRackauckas
Copy link
Member

This seems pretty inherent to Sundials since we don't (can't?) recreate its internal polynomial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants