Commit 615ebb2
committed
Narrow range expansion to avoid new regressions
CI surfaced three cases where the unconditional range expansion broke:
1. `inf_handling.jl`: `tspan = (0.0, Inf)` with `adaptive=false, dt=0.1`
tripped `InexactError(Int64, Inf)` when constructing
`(0.0 + 0.1):0.1:Inf`. Gate on `all(isfinite, tspan)`.
2. `integrator_interface_tests.jl` (`set_proposed_dt!`): the test sets
`dt=0.1, adaptive=false` and later changes dt to 0.5 from a discrete
callback. With the range tstops committed at init, every subsequent
step gets clipped to 0.1 and diff(sol.t)[13] stays 0.1 instead of the
expected 0.5. Gate on `callback === nothing`.
3. `linear_nonlinear_krylov_tests.jl` (LawsonEuler etc.): exponential RK
algorithms report `isdtchangeable(alg) == false`. The range tstops
have sub-ulp gaps (e.g. `diff(0.0:0.01:1.0)` is not uniform), so
`handle_tstop!` interpolates back whenever `ttmp` overshoots, which
resets `integrator.dt` and trips `apply_step!`'s
"setup does not allow for changing dt" guard. Gate on
`isdtchangeable(_alg)`.
Verified locally:
- Original bug case: `solve(prob, Euler(); dt = 0.1)` → 11 steps,
sol.t == 0.0:0.1:1.0.
- `tspan=(0, Inf)` with `adaptive=false`: returns
`ReturnCode.Unstable` as expected.
- `set_proposed_dt!` test: diff(sol.t)[13] == 0.5.
- LawsonEuler convergence run completes.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>1 parent c1879d3 commit 615ebb2
1 file changed
Lines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
412 | 414 | | |
413 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
414 | 418 | | |
415 | 419 | | |
416 | 420 | | |
| |||
0 commit comments