Commit ba0dfa2
DelayDiffEq: don't rewrite sol.t[end] in shift_past_discontinuity! (#3437)
PR #3427 made `shift_past_discontinuity!` bump `ode_integrator.sol.t[end]`
by one ULP along with `integrator.t`, on the theory that keeping the
invariant `integrator.t == ode_integrator.sol.t[end]` would let the
equality check in `advance_ode_integrator!` stay strict. The commit
message claimed bit-identical equivalence to the pre-#3427 behavior, but
that verification only checked `sol.u` and `sol(t)` queries, not
`sol.t` equality between the outer DDE solution and the inner ODE
sub-integrator solution.
That invariant is the wrong thing to enforce. The step completed at the
pre-shift time and that is what should appear in the saved history; the
shift is an integration-state nudge to cross a propagated discontinuity,
not a retroactive rewrite of the step that just finished.
Rewriting `ode.sol.t[end]` breaks `lib/DelayDiffEq/test/interface/saveat.jl`
lines 18/46/75 (outer DDE `sol.t == dde_int.integrator.sol.t` for the
default every-step `saveat`). Rewriting the outer DDE `sol.t[end]` as
well (which would restore that equality) breaks the `#190` testset in
`discontinuities.jl` (integer discontinuity times are expected to appear
exactly in user-visible `sol.t`), and is also semantically wrong for
sparse user `saveat` where `sol.t[end]` is an older user-requested time.
Revert to the pre-#3427 approach: shift only `integrator.t` and the ODE
sub-integrator's `t`, leave both `sol.t[end]` values untouched, and
restore the `abs(t - sol.t[end]) > eps(t)` tolerance in
`advance_ode_integrator!`. Both `saveat.jl` and `discontinuities.jl`
pass (verified locally along with Interface, Integrators, Regression
test groups), and the `constant-lag shift past discontinuity (#3426)`
regression test added in #3427 continues to pass since the shift still
crosses the discontinuity — only the saved history is left alone.
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5020ff5 commit ba0dfa2
1 file changed
Lines changed: 12 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
244 | | - | |
245 | | - | |
246 | | - | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
0 commit comments