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

FBDF provides bad interpolant for dy/dt in dy ~ sin(t) #2133

Open
topolarity opened this issue Feb 5, 2024 · 1 comment
Open

FBDF provides bad interpolant for dy/dt in dy ~ sin(t) #2133

topolarity opened this issue Feb 5, 2024 · 1 comment
Labels

Comments

@topolarity
Copy link

Describe the bug 🐞

FBDF gives a very bad interpolant for sol(t, Val{1}) of a simple ODE system dy ~ sin(t)

Minimal Reproducible Example 👇

julia> using OrdinaryDiffEq, Plots, LinearAlgebra
julia> ode_f1(u, _, t) = sin(t)
julia> ode_f2(u, _, t) = [u[2], u[2] - sin(t)]
julia> mass_matrix = Diagonal([1.0,0.0])
julia> prob1 = ODEProblem(ode_f1, 0.0, (0., 2π), nothing, abstol=1e-6, reltol=5e-2);
julia> prob2 = ODEProblem(ODEFunction(ode_f2; mass_matrix), [0.0, 0.0], (0., 2π), nothing, abstol=1e-6, reltol=5e-2);
julia> sol1 = solve(prob1, FBDF());
julia> sol2 = solve(prob2, FBDF());

julia> t′ = 0.0:1e-3:2π
julia> plot(t′, [u[1] for u in sol1(t′, Val{1}; idxs=1)]; title="FBDF (ODE)", label="sol1(t, Val{1})")
julia> plot(t′, hcat([[sol2(t, Val{1}; idxs=1), sol2(t, Val{0}; idxs=2)] for t in t′]...)'; label=["sol2(t, Val{1})" "sol2(t, Val{0}) (dy = x)"], title="FBDF (DAE)")
image image

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
(tmp) pkg> status
Status `~/repos/tmp/tmp/Project.toml`
  [459566f4] DiffEqCallbacks v2.36.1
  [1dea7af3] OrdinaryDiffEq v6.70.0
  [c3572dad] Sundials v4.23.2
@topolarity topolarity added the bug label Feb 5, 2024
@ChrisRackauckas
Copy link
Member

It's essentially the same problem as SciML/Sundials.jl#452, though in this case we do actually have the possibility to define the corrected interpolation function. This is what I discussed in one of the chats as a good next direction with the BDFs.

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