Skip to content

Rebuild the linear W whenever gamma dt changes on fixed steps - #4401

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
singhharsh1708:fix-linear-W-cutoff
Aug 30, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
singhharsh1708:fix-linear-W-cutoff

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

On fixed steps the linear-operator path kept a stale W = M - γ dt J whenever dt drifted by less than new_W_dt_cutoff, so adaptive = false solves reused W across step-size changes; the cutoff is now zero unless the solve is adaptive. Comparing γ dt rather than forcing a rebuild halves the factorisations, because the two stages of a step share one W, and njacs stays 0 on the linear path.
On the issue's problem with dt alternating against 1.15 dt, exact W converges at second order (0.0159, 0.00443, 0.00117 over three halvings) while the default cutoff stalled near 6.5e-3; after the change both cutoffs give identical results.
The test steps a MatrixOperator problem with alternating fixed steps, in stale_w_linear_operator_tests.jl, which already covers the sibling stale-W bug #3933. The adaptive half of #4370, where a carried-over η lets Newton stop early against a stale W, is separate.
Fixes the fixed-step half of #4370.
With LHLFactorization the W stays split and LHL absorbs each new γdt from W.gamma on every solve, but inside the cutoff W_γdt was left at the old value, so the Newton step's dz rescale in compute_step! corrected for a staleness that was not there; the cutoff is now zero for a split W on adaptive steps as well, which keeps W_γdt equal to γdt and drops the rescale. The new test checks cutoff 0.2 and 0 give identical results with LHL, adaptive and fixed-step; on master the end states differ.
AI Disclosure: Claude assisted with this change.

@ChrisRackauckas

Copy link
Copy Markdown
Member

This should get updated for LHL

@singhharsh1708

singhharsh1708 commented Aug 30, 2026 •

Copy link
Copy Markdown
Member Author

Updated: with LHL the cutoff is now zero on adaptive steps too. Correction to what I wrote first: LHL already read the new γdt from W.gamma each solve; what lagged inside the cutoff was W_γdt, so the dz rescale in compute_step! was correcting for a staleness that was not there. Test added, fails on master.

@ChrisRackauckas
ChrisRackauckas merged commit 1b9ba9a into SciML:master Aug 30, 2026
183 of 184 checks passed
@singhharsh1708
singhharsh1708 deleted the fix-linear-W-cutoff branch August 30, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants