Skip to content

Add Python-side Stokes PC fallback recorder - #750

Open
ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-stokes-pc-fallback-recorder
Open

ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-stokes-pc-fallback-recorder

Conversation

@ss2098

@ss2098 ss2098 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This PR fixes an AttributeError in the Python-side Stokes preconditioner fallback check.

_check_velocity_preconditioner() records when the velocity block falls back from the intended multigrid preconditioner, but the Python-side Stokes object did not have _record_pc_fallback(). A normal Stokes solve could therefore fail with:

AttributeError: 'SNES_Stokes' object has no attribute '_record_pc_fallback'

This adds a small Python-side fallback recorder and pc_fallbacks property so the fallback is recorded and the warning path can complete.

This does not change solver setup or preconditioner selection.

Validation:

  • python -m py_compile src/underworld3/systems/solvers.py
  • pixi run python docs/examples/Tutorial_Thermal_Convection_Units.py

The units tutorial now completes successfully. The remaining GAMG message is the intended runtime warning, not a crash.

@ss2098
ss2098 requested a review from lmoresi as a code owner September 16, 2026 06:12
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.

1 participant