SciML / SciML/ODEInterfaceDiffEq.jl

Incorrect behavior with `save_everystep` and `saveat` set

Open
#29 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
8
Forks
20
Avg merge
4h 53m
Merged PRs (30d)
9

Description

Here's an MWE:

using OrdinaryDiffEq
using ODEInterfaceDiffEq

function lorenz(rhs, z, p, t)
  rhs[1] = p.sigma * (z[2] - z[1])
  rhs[2] = z[1] * (p.rho - z[3]) - z[2]
  rhs[3] = z[1] * z[2] - p.beta * z[3]
end
struct LorenzParameters
  sigma::Float64
  beta::Float64
  rho::Float64
end

z0 = [1; 0; 0]
z0 = Float64.(z0)
p = LorenzParameters(10, 8/3, 28)
pb = ODEProblem(lorenz, z0, (0.0, 4.0), p)
sol = solve(pb, dop853(); saveat = 1e-3, save_everystep = true)
println(issorted(sol.t))

Outputs false. As a result, here's what you get if you plot one of the variables:
julia_failed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the Julia MWE with ODEInterfaceDiffEq, focusing on the solve call using dop853 with both saveat and save_everystep enabled. Trace how those options produce sol.t and verify the behavior against issorted(sol.t) and the plotted output; done means the saved times are ordered and the plot no longer shows the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.