docs: use AlgebraicMultigrid's automatic (SPQR) coarse solver#871
Merged
ChrisRackauckas merged 1 commit intoJun 16, 2026
Merged
Conversation
Now that AMG v2.0 is installable alongside the OrdinaryDiffEq v7 stack (LinearSolve >= 3.85.2 allows AlgebraicMultigrid v2), drop the `coarse_solver = LinearSolveWrapper(UMFPACKFactorization())` override from the AMG preconditioner examples and use `ruge_stuben`'s default coarse solver. AMG 2.0's default coarse solver is `QRSolver` (SuiteSparse SPQR for sparse matrices), which handles the non-SPD `W = I - γJ` coarse-grid matrix robustly. The UMFPACK (LU) override was only a workaround for AMG 1.x's default `Pinv` coarse solver, which forms a dense SVD pseudo-inverse and errored (`gesdd!`) on that matrix — and LU is itself less robust than QR on rank-deficient coarse operators. The default is cleaner and the idiomatic AMG usage. Because the examples now rely on AMG 2.0's default coarse solver (AMG 1.x's `Pinv` would crash on the non-SPD W, and the Sundials AMG example here already uses the default coarse solver), bump the docs `[compat]` floor to `AlgebraicMultigrid = "2"` so the build is guaranteed to resolve AMG 2.0 rather than silently falling back to a 1.x that would error. Verified locally on the released stack (AlgebraicMultigrid 2.0.0 + LinearSolve 3.85.2 + OrdinaryDiffEqSDIRK): KenCarp47 + KrylovJL_GMRES with `ruge_stuben` precs (default coarse solver, and with Jacobi smoothers) solves the brusselator problem successfully, no override needed. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
e4d9a9a to
0b16de7
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.
Note
Please ignore until reviewed by @ChrisRackauckas. Opened as a draft.
Follow-up to #869/#870. Now that AMG v2.0 is installable alongside the OrdinaryDiffEq v7 stack (via SciML/LinearSolve.jl#1047, released as LinearSolve 3.85.2, which bumps the AMG-extension weak compat to
"1, 2"), this drops thecoarse_solver = LinearSolveWrapper(UMFPACKFactorization())override from the AMG preconditioner examples inadvanced_ode_example.mdand usesruge_stuben's default coarse solver.Why
The UMFPACK (LU) override was a workaround for AMG 1.x's default
Pinvcoarse solver, which forms a dense SVD pseudo-inverse and errored (gesdd!"invalid argument") on the non-SPDW = I - γJcoarse-grid matrix.AMG 2.0's default coarse solver is
QRSolver(qr()→ SuiteSparse SPQR for sparse matrices), which handles the non-SPD / rank-deficient coarse operator robustly with no override. LU is itself the wrong tool here (less robust than QR on near-singular coarse matrices), so the default is both cleaner and more correct.Because
docs/Manifest.tomlis resolved fresh on each build (it is git-ignored) anddocs/Project.tomlallowsAlgebraicMultigrid = "0.5, 0.6, 1, 2"+LinearSolve = "2, 3", the build now resolves LinearSolve 3.85.2 → AlgebraicMultigrid 2.0.0 automatically.Verification (local, released stack)
OrdinaryDiffEq 7.0.0 + LinearSolve 3.85.2 + AlgebraicMultigrid 2.0.0.KenCarp47(linsolve = KrylovJL_GMRES(precs = ...), concrete_jac = true)on the brusselator solves successfully withruge_stubenusing the default coarse solver — both the plain and Jacobi-smoothed variants — on AMG 2.0.0. Nogesdd!, no override.🤖 Generated with Claude Code