Fix wrong interpolation coefficients for Rodas3, ROS34PW3#3276
Merged
ChrisRackauckas merged 3 commits intoSciML:masterfrom Mar 30, 2026
Merged
Conversation
The Rosenbrock consolidation PR (SciML#3102) added a Hermite fallback in _ode_addsteps! for methods with empty H matrices that computed: k₁ = dt*f₀ - (u - uprev) k₂ = 2*(u - uprev) - dt*(f₀ + f₁) But hermite_interpolant in generic_dense.jl expects k[1] = f₀ and k[2] = f₁ (raw derivative values at endpoints). The mismatch produced wildly wrong interpolated values at saveat points (e.g. u(0.15) = 3.97 vs correct 3.28 for the test ODE du/dt = u*p). Remove the incorrect fallback. Methods with empty H now fall through to the generic _ode_addsteps! which correctly stores f₀ and f₁ for standard Hermite interpolation. Fixes SciML/SciMLSensitivity.jl#1398 (Core2 stiff_adjoints failures). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test that sol(t) at intermediate points matches the exact solution for Rodas3, ROS3P, ROS34PW1a, ROS34PW1b, ROS34PW2, ROS34PW3 — all methods with empty H matrices that use generic Hermite interpolation. Tests both OOP and IIP, plus saveat consistency. Uses exponential decay (du/dt = λ*u) with known exact solution. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- ode_rosenbrock_tests.jl: Add dense_errors=true to convergence tests for Rodas3, ROS3P, ROS34PW1a, ROS34PW1b, ROS34PW2, ROS34PW3. These methods use generic Hermite interpolation (no H matrix), so dense L2 convergence order is 3 (cubic). Ensures the interpolation coefficients stored by _ode_addsteps! are correct. - event_dae_addsteps.jl: Add Rodas3 and ROS34PW3 to the DAE callback test that verifies sol(t) accuracy during continuous callback events. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fa725fa to
c4d0cc8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Rosenbrock consolidation PR (#3102) added a Hermite fallback in
_ode_addsteps!for methods with emptyHmatrices (Rodas3, ROS34PW3, ROS3P, etc.) that computed:But
hermite_interpolantingeneric_dense.jlexpectsk[1] = f₀andk[2] = f₁(raw derivative values at endpoints):The mismatch produced wildly wrong interpolated values at
saveatpoints. For example, withdu/dt = u*pand Rodas3:u(0.15)≈3.28(linear and exact agree)u(0.15)=3.97This caused wrong
saveatvalues → wrong loss → wrong gradients in SciMLSensitivity stiff adjoint tests (Core2 intermittent failures since March 23).Fix: Remove the incorrect fallback. Methods with empty
Hfall through to the generic_ode_addsteps!ingeneric_dense.jlwhich correctly storesf₀andf₁.Test plan
🤖 Generated with Claude Code