Skip to content

#892: FAC patch blocks run the configured LU on the rotated route - #912

Merged
lmoresi merged 6 commits into
developmentfrom
bugfix/fac-live-block-solver
Oct 31, 2026
Merged

lmoresi merged 6 commits into
developmentfrom
bugfix/fac-live-block-solver

Conversation

@lmoresi

@lmoresi lmoresi commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

On the rotated route, the FAC patch blocks ran PCASM's default unshifted ILU(0) where LU was configured. That held for the saddle-point solve and the thin sheet alike. This PR makes them run the LU.

Closes #892

What was wrong

_configure_pcmg writes the FAC block solver into the options database: LU with a nonzero shift. In the composite FAC form, the default since 891c9bb, the patch ASM is the composite's second member, and it sets up at its first application. Both rotated call sites set up only the level smoother, then dropped their per-solve keys. The blocks then took PCASM's default. The non-rotated installs always read the LU, because their keys are never dropped.

The fix

custom_mg._set_up_fac_smoothers runs after the PCMG set-up, while the keys are still there. It replaces the two rotated loops and is also called by the velocity-block install. It sets up each FAC level's smoother and its ASM. It then sets the block PC type and factor shift on the live block KSPs, so the blocks run the configured solver even where the ASM had already set up.

Measured

UWTN 2026-022's linear fault fixture, all-application velocity iterations:

band ratio h_b/S 6 12 24
ILU blocks (development) 180 259 344
LU blocks (this PR) 66 65 67

On the box: 7 velocity iterations per Newton increment at band ratios 8, 16 and 25. The fixed build reproduces the earlier LU-block measurements exactly.

Tests

  • test_1090 reads the live PC objects after the solve, not the options database, which held the right keys all along. It covers the rotated saddle-point, rotated thin-sheet, standard velocity-block and scalar top-level installs, each in the composite and the plain ASM FAC form.
    • Against 799ef02 it fails the two rotated composite cases, in serial and at np 2.
    • On this branch it passes in serial and at np 2 and 4.
  • A tier C characterisation pins which levels carry a FAC patch per install, on test_1022's composed stack. The standard install patches levels 2 and 3. The rotated path clears every coarse level's rows after the orphan restriction, so it patches level 3 only. That rule has not been ruled on, and the test makes a change to it deliberate.

Docs

faults-in-convection.md now says its hierarchy counts were measured while the blocks ran ILU(0). They are to be re-measured after this merges (step 5 of #892's plan). Design note rule 3 ("SOR subdomain solves are the safe default") is marked superseded by 891c9bb's LU default.

Review

The adversarial review (a998181) is in the first comment.

Issues

Underworld development team with AI support from Claude Code

…was configured with

The test reads the live PC objects after the solve, not the options database,
because the database held the right keys all along. It covers four paths:

- the rotated saddle-point solve;
- the rotated thin-sheet solve;
- the standard Stokes velocity-block install;
- a scalar top-level install.

Each path runs in the composite and in the plain ASM FAC form. The fixture is a
fault split in place over a welded base hierarchy.

Every level is checked against what _configure_pcmg and the robust geometric
bundle write:
- the coarse level: preonly + redundant LU;
- every other level: gmres/4 with no norm, SOR;
- the FAC level: composite SOR + ASM (or the ASM alone), basic restriction, one
  overlap layer, and blocks solved by preonly + LU with the nonzero shift.

The file has no min_size mark, so it also runs in the serial batch.

Against 799ef02 it fails on the two rotated paths in the composite form, in
serial and at np 2, and passes the other six cases. The FAC blocks there run
ILU(0) with no shift where LU is configured.

Underworld development team with AI support from Claude Code
_configure_pcmg writes the FAC block solver into the options database: LU
with a nonzero shift. The block KSPs read those keys when the patch's ASM
sets up.

In the composite form, the default since 891c9bb, the ASM is the composite's
second member, and it sets up at its first application. Both rotated call
sites (the saddle-point solve and the thin sheet) set up only the level
smoother and then drop their per-solve keys. The blocks then took PCASM's
default, unshifted ILU(0). On UWTN 2026-022's linear fault fixture at band
ratio 24 that is 344 velocity iterations against 67.

The fix is one helper, custom_mg._set_up_fac_smoothers, called after the
PCMG set-up while the keys are still there. It replaces the two rotated
loops and is also called by the velocity-block install. It sets up each FAC
level's smoother and its ASM, then sets the block PC type and factor shift
from the database on the live block KSPs, so the block solver no longer
depends on when the database is read or cleaned.

The scalar top-level install does not call it: that PC sets up at the first
solve, and its keys are never dropped.

The comment above the block configuration now states the intent: FAC blocks
are LU, and ILU there is a regression. It replaces the August note that the
blocks were SOR.

test_1090 passes in serial and at np 2 and 4 (8 of 8 on every rank). Before
this change it failed the two rotated composite cases.

Underworld development team with AI support from Claude Code
The live-configuration check is now one helper. It checks every level and
returns the FAC levels.

A second, serial test runs test_1022's composed stack, where the unsplit mid
ribbon gets a coarse patch. It pins that the two installs disagree on keeping
it:
- the standard install keeps the rows of a level the orphan restriction
  leaves whole, so it patches levels 2 and 3;
- the rotated path clears every coarse level's rows after the restriction
  (B's drop_orphans block in rotated_bc), so it patches level 3 only.

The rule is not ruled on. The test makes a change to it deliberate.

The rotated path rewrites the hierarchy's level_patch_rows in place. Measured
on the same stack, that does not reach another solver given the same
hierarchy: its build recomputes the rows, and it patches levels 2 and 3.

Underworld development team with AI support from Claude Code
…haracterisation

From the adversarial review.

_set_up_fac_smoothers reads the block solver from the options database. The
docstring said the live set made the blocks independent of when the database
is read or cleaned, which it does not. It now says what the live set does: the
blocks run the configured solver even where the ASM had already set up, and
the keys must still be present when the helper runs.

The guard for a FAC level whose patch PC is not an ASM is removed. Every
configuration, UW_FAC_WHOLE included, leaves an ASM there.

test_which_levels_carry_a_fac_patch records a rule that has not been ruled
on (B's orphan rule on the rotated path), so it is tier C, a characterisation
that reports without gating. The kept-against-dropped measurement it rests
on is in its docstring. The tiers now sit on the tests and the level on the
module.

Design note rule 3 ("SOR subdomain solves are the safe default") is marked
superseded by 891c9bb's LU default.

Underworld development team with AI support from Claude Code
Development now carries #863's sharded CI, and #882, #889 and #890 (this
branch's base). The one conflict was scripts/test.sh: test_1090's serial
entry now takes the batch form, on shard 4 beside test_1069. All 382 test
files are reachable (check_test_coverage).

Underworld development team with AI support from Claude Code
The hierarchy counts in faults-in-convection.md were measured while the
FAC patch blocks ran ILU(0) instead of the configured LU. Say so beside
them, and point at the re-measurement (step 5 of #892's plan).

Underworld development team with AI support from Claude Code

lmoresi commented Oct 31, 2026 •

Copy link
Copy Markdown
Member Author

Adversarial review (fixes in a998181)

Reviewed by a separate agent against docs/developer/guides/adversarial-review.md.

Findings and what was done

  1. The helper's docstring overclaimed. _set_up_fac_smoothers reads the block solver from the options database. The docstring said the live set made the blocks independent of when the database is read or cleaned, which it does not.
    Resolution: it now says what the live set does: the blocks run the configured solver even where the ASM had already set up, and the keys must still be present when the helper runs.
  2. A dead guard. The guard for a FAC level whose patch PC is not an ASM could not fire: every configuration, UW_FAC_WHOLE included, leaves an ASM there.
    Resolution: removed.
  3. A pin on a rule nobody had ruled on. test_which_levels_carry_a_fac_patch records the rotated path's orphan rule (it patches level 3 only).
    Resolution: it is tier C, a characterisation that reports without gating, and its docstring carries the kept-against-dropped measurement it rests on. The tiers sit on the tests and the level on the module.
  4. A stale design rule. Design note rule 3 ("SOR subdomain solves are the safe default") contradicted 891c9bb's LU default.
    Resolution: marked superseded.

After the merge of development (fc67b65, CI and test-script changes only), faults-in-convection.md says its hierarchy counts were measured while the blocks ran ILU(0) (24e754f).

Issue verdicts

Underworld development team with AI support from Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Maintainer review is needed because the live PETSc ILU-to-LU change still lacks completed solver/MPI regression checks and verified 3-D factorization and memory costs.

No open issues 🎉

What changed in this PR

Fixes #892 by ensuring FAC patch blocks use the configured LU solver with a nonzero factor shift on rotated solve paths, rather than falling back to unshifted ILU(0).

Changes:

  • Adds shared FAC setup logic and applies it before rotated paths remove their temporary options.
  • Adds live solver-configuration tests covering four installation paths in composite and plain ASM modes, plus serial test-runner integration.
  • Clarifies that earlier benchmark counts used ILU(0) and marks the old SOR-default guidance as superseded.
File Description
tests/​parallel/​test_1090_mg_live_configuration_parallel.py Checks live multigrid settings and records FAC patch-level placement.
src/​underworld3/​utilities/​rotated_bc.py Sets up FAC blocks before temporary options are removed.
src/​underworld3/​utilities/​custom_mg.py Adds shared FAC setup and applies configured block solver settings.
scripts/​test.sh Includes the new regression tests in serial runs.
docs/​developer/​guides/​faults-in-convection.md Qualifies earlier iteration counts as ILU-based measurements.
docs/​developer/​design/​fault-patch-multigrid-2026-08.md Marks SOR-default guidance as superseded by shifted LU.

Review effort: Balanced

@lmoresi
lmoresi merged commit cc83942 into development Oct 31, 2026
9 checks passed
lmoresi pushed a commit that referenced this pull request Oct 31, 2026
…ilure

D (#892) and the #894 fix both changed rotated_bc.py after this branch's CI
ran. Clean merge; CI re-runs on the combination before #916 merges.

Underworld development team with AI support from Claude Code
lmoresi added a commit that referenced this pull request Oct 31, 2026
Development now carries D (#912) and the #894 fix (#913). The only
conflict was scripts/test.sh, where both branches add a tests/parallel
file to batch 4; both are kept.

Underworld development team with AI support from Claude Code
lmoresi added a commit that referenced this pull request Oct 31, 2026
…patch on the split finest level (ruling of 2026-11-01)

The fault-multigrid guide drops the chain as what production runs and
states the ruled tail with its counts from the tail sweep on #912's
build; its configuration rule on the blocks now says FAC blocks are LU
and records that the rotated path ran them as ILU(0) from 2026-09-03
until #912 (#892). The split-level section says the library merged
(#889, #890) and keeps the chain as the measured alternative.
Mesh.multigrid_levels (#915) replaces the private accessor.

The faults-in-convection guide's hierarchy section, code and table are
rewritten to the welded tail, with the chain labelled as the alternative
and the ILU-era table retired to the journal. The guide is added to the
developer toctree it was missing from.

Underworld development team with AI support from Claude Code
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