Skip to content

Rotated free slip, direct LU: one pressure pin over all ranks, kept in the operator's pattern, zeroed after the gauge projection (#348, #899) - #1054

Merged
lmoresi merged 7 commits into
developmentfrom
bugfix/rotated-lu-pressure-pin-348
Nov 11, 2026
Merged

lmoresi merged 7 commits into
developmentfrom
bugfix/rotated-lu-pressure-pin-348

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member

The opt-in direct-LU rotated path (solver._rotated_use_lu = True) fixes the pressure gauge by pinning one pressure row. This branch fixes three bugs in that pin.

One pin, not one per rank (#348). Each rank pinned the first pressure DOF of its own chart, so at np > 1 the gauge was over-constrained and the answer depended on the partition. _global_pressure_pin takes the lowest global pressure row over all ranks (one allreduce). The owner gets the row, and every rank gets the same pinned flag, so the collective zeroRows is called by all ranks or by none. A pressure Dirichlet condition already fixes the gauge, so then nothing is pinned. The adjoint pins the same row as the forward solve.

The pinned row keeps its pattern. zeroRows compressed the pinned row out of the rotated operator's pattern, and the next increment's in-place ptap(result=Ahat) wrote into it. That was a malloc error on the owning rank at np ≥ 2, with the other ranks waiting in a collective. It hit any direct solve with a second Newton increment, not only an LU → iterative → LU switch. KEEP_NONZERO_PATTERN is set before the pin.

The pinned row is zeroed after the pressure-mean projection (#899). The residual zeroed the pinned row and then subtracted the pressure-residual mean, so the pinned row's residual became a shift on every other pressure equation. An interior pin has no residual to spread. A pin beside a Dirichlet wall does, because the lifted velocity has divergence there, and on test_1088's fault box the lowest pressure row is a wall corner. Constant pressure is an exact null mode of that operator (left and right to 1e-17; one singular value at 1.4e-14, the next at 2.9e-5), so the pin itself is valid there.

fault box, serial, linear law converged increments velocity vs multigrid
development (pin = row 0, wall corner) no 50 5.8e-2
pin = pressure row 40 or 100, old order yes 1 1.0e-12
this branch yes 1 1.0e-12

Also from #1053's review: the iterative wrong-given-normal test asserts exactly one warning, and with one declared mode the warning reads "The declared rotation mode is not removed".

Tests

  • tests/parallel/test_1156_rotated_lu_pressure_pin_parallel.py (new, tier B):
    • exactly one row is pinned at any np;
    • it is the lowest pressure row (an off-by-one pin, which is an eliminated velocity row, fails it);
    • LU matches the iterative solve in velocity and in mean-free pressure to 1e-6;
    • a nonlinear direct solve takes a second increment and matches the iterative one;
    • under a pressure Dirichlet condition nothing is pinned, and LU matches the iterative solve (a pin there is 0.86 % off);
    • a pin beside a Dirichlet wall solves the same problem as the iterative path (the old order is 10.6 % off).
    • On development it fails at np 2 and 4.
  • tests/parallel/test_1088_rotated_interface_operator_parallel.py: the direct-LU fault case loses its Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 xfail and asserts convergence. With the old order it fails at that assertion.
  • tests/test_1131_rotated_nullspace_from_mesh.py: N3 and the wording.
  • Serial on this branch: test_1131, 1018, 1066, 1088, 1156 and 1013 pass (75 at 660e35b; 1131, 1156 and 1088 give 46 at the head).
  • np 1, 2 and 4: H1's review records, three rounds (posted below). test_1156 passes at np 1, 2 and 4. test_1088 gives 13 passed at np 1, 2 and 4. Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899's linear and nonlinear cases converge in 1 increment to the multigrid slip at np 1 and 2. 206 serial passed. The parallel files pass at np 2.

Issues

Underworld development team with AI support from Claude Code

The opt-in direct path (solver._rotated_use_lu) has no null space and
fixes the pressure gauge by pinning one pressure DOF. _naive_pressure_pin
took the first pressure DOF of each rank's own chart, so at np > 1 every
rank pinned one: the gauge was over-constrained and the answer depended
on the partition.

_global_pressure_pin offers each rank's lowest owned pressure row and
takes the minimum over the ranks: exactly one row, at any rank count. It
returns the row on its owner and None elsewhere, with a pinned flag that
is the same on every rank, so the collective zeroRows (forward solve and
rotated adjoint) is called by every rank or by none; before, a rank with
no pin would have skipped it. The doc's "serial diagnostic, TODO(BUG)"
note is replaced.

tests/parallel/test_1156 (np > 1 in CI's MPI phase, and serial): exactly
one row pinned across the ranks; the direct solve matches the iterative
one in velocity and in pressure up to its constant. Serial: test_1156 2
passed; the LU-route and rotated-adjoint files 88 passed.

Underworld development team with AI support from Claude Code
…essure row

- The pin's zeroRows compressed the pinned row out of the rotated operator's
  pattern, and the next Newton increment's in-place PtAP wrote into it: a
  malloc error on the owning rank at np > 1 while the others waited in a
  collective. KEEP_NONZERO_PATTERN is set before the pin.
- The pin candidates skip constrained pressure DOFs, which have no row.
- test_1156 asserts the pinned row is the lowest pressure row (an off-by-one
  pin, an eliminated velocity row, passed before), and that a nonlinear direct
  solve takes a second increment and matches the iterative one.
- The docstring and the subsystem doc say the pin is a valid gauge only where
  constant pressure is an exact null mode (#899).

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
…se reads as one

- The iterative wrong-given-normal test asserts exactly one warning, as the LU
  route's test does (H1's #1053 review, N3).
- With one declared mode the warning says "The declared rotation mode is not
  removed", not "1 of the 1 declared rotation modes are not removed".

Underworld development team with AI support from Claude Code
…projection (#899)

The residual zeroed the pinned pressure row and then projected out the
pressure mean, so the mean of the pinned row's residual was spread over every
other pressure row and the direct solve solved a shifted problem. An interior
pin has no residual to spread; a pin beside a Dirichlet wall does, because the
lifted velocity has divergence there. That is #899: on test_1088's fault box
the lowest pressure row is a wall corner, and the solve stalled at 2e-5 with
the slip 4-6 % off. Pinning pressure rows 40 or 100 instead converged in one
increment; zeroing after the projection converges in one increment at any pin,
to the multigrid slip to 1e-12.

Constant pressure is an exact null mode of that operator (left and right, to
1e-17 with the interface tangent; dense SVD: one singular value at 1e-14, the
next at 2.9e-5), so the split fault is not a case where the pin replaces a real
equation. The docstring and the subsystem doc no longer say it is.

test_1088's direct-LU case loses its xfail and asserts convergence; with the
old order it fails at that assertion.

Underworld development team with AI support from Claude Code
…ollectives before asserts

- A pressure Dirichlet condition already fixes the gauge. With round 1's
  filter on constrained DOFs, the pin moved onto a real pressure row and the
  direct solve was 0.9-3.6 % off in velocity (N4). Before round 1 it landed on
  a constrained DOF and was right by luck. Now nothing is pinned when any
  pressure DOF is constrained. test_1156 adds the case: velocity and pressure
  match the iterative solve to 1e-6. With the pin restored it fails at 0.86 %.
- test_1156's pin assertions run their collectives first, so a pin that fails
  on one rank fails the test instead of hanging the others (N3).

Underworld development team with AI support from Claude Code
… wording

- test_1156 adds a pin beside a Dirichlet wall: a box with the lifted wall
  velocity (y - 1/2, 0) on three sides and rotated free slip on the fourth.
  With the old order (pin zeroed before the pressure-mean projection) the
  direct solve is 10.6 % off in velocity and the test fails. Before this,
  only test_1088's fault case guarded the order.
- With one rejected mode the warning ends "keeps that rotation".

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 11, 2026 03:35

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Review record, round 1 of 3: 26c11aa (pre-PR)

Its F2 conclusion, that the pin causes #899, was narrowed in round 2: #899 was the residual ordering, fixed at dccb83d. Paths under review/ are on hyperion, in runs/2026-11-11-348/.


Pre-PR review: #348, one global pressure pin on the rotated direct-LU route

Branch bugfix/rotated-lu-pressure-pin-348, head 26c11aa, on development 36bb3ae. Reviewed on hyperion, 2026-11-11.

Verdict. Mergeable with conditions. The change does what it says. It pins exactly one pressure row at any rank count. On a closed box, the LU answer at np 2 and 4 matches serial to 1e-15 in velocity, where development's was 1.2-1.6% off and still reported itself converged. The adjoint now matches serial at np 2. But there are three problems:

Method

  • Build. I used the branch build at wt-348. To get development's behaviour, I loaded development's rotated_bc.py (git show 36bb3aef:...) at runtime by exec'ing it over the underworld3.utilities.rotated_bc module dict before first use (probes/swapsrc.py, enabled by SWAP_SRC). All callers import from that module lazily, at call time. Each run prints a check that the swap took effect, such as naive=True global=False. Nothing was written to the worktree or to site-packages.
  • Mutants and probe variants use the same mechanism, in probes/rb_*.py:
    • M1: every rank pins its own lowest row.
    • M2: zeroRows only on the owning rank.
    • M3: the pinned row is row + 1.
    • rb_pinvar.py: PIN_MODE=min|max|none.
    • rb_fixB_keeppattern.py: a candidate fix for check B.
  • Tests ran from git archive copies (tests-branch/, tests-dev/) with PYTHONDONTWRITEBYTECODE=1 and -p no:cacheprovider. Every MPI run went through mpi_supervisor.py.
  • Core use stayed at 8 or fewer.
  • Software. PETSc 3.25.3 with MUMPS (hasExternalPackage('mumps') is True). The LU route calls setFactorSolverType("mumps").
  • Comparisons across rank counts gather values with their coordinates, drop ghost duplicates and sort lexicographically (probes/p1_box.py, probes/cmp.py).

All paths below are relative to runs/2026-11-11-348/review/.

Check 1: does test_1156 guard the fix?

test_1156 (logs/t1156_*):

build np 1 np 2 np 4
branch 2 passed 2 passed 2 passed
development rotated_bc 1 failed (AttributeError), 1 passed 2 failed 2 failed
M1 every rank pins 2 passed 2 failed (2 == 1) 2 failed
M2 owner-only zeroRows 2 passed hang, killed by the supervisor at 600 s (rc 124) hang (rc 124)
M3 off-by-one row 2 passed 2 passed 2 passed

On development, the first test fails with an AttributeError, because _global_pressure_pin does not exist there. That is not a behavioural check. The second test is the real guard. On development at np 2 the velocity error is |dv| = 4.9e-3 against a bound of 4.2e-7.

The test's own timeout did not fire. It has timeout(300, method="thread"), but the M2 hang lasted until the supervisor killed it at 600 s. A collective hang in this test is caught only by an external supervisor.

Box probe, LU against iterative (probes/p1_box.py; the fixture is test_1156's box):

build np rows pinned (global) LU rnorm rel. velocity error, LU vs iterative rel. pressure error, LU vs iterative (mean removed) LU pressure mean
branch 1 [2] 6.5e-16 6.8e-13 1.1e-11 +0.162
branch 2 [2] 6.5e-16 8.8e-13 1.1e-11 +0.162
branch 4 [2] 6.8e-16 8.5e-13 1.1e-11 -0.161
dev 1 [2] 6.5e-16 6.8e-13 1.1e-11 +0.162
dev 2 [2, 560] 6.4e-16 1.19e-2 2.25e-1 2.6e-4
dev 4 [2, 261, 555, 855] 6.5e-16 1.65e-2 3.18e-1 1.3e-4

Against serial (the branch at np 1 is the reference):

build np LU, rel. velocity error LU, rel. pressure error (raw) LU, rel. pressure error (mean removed)
branch 2 1.2e-15 2.5e-14 6.5e-15
branch 4 1.2e-15 3.66 (gauge only) 8.1e-15
dev 2 1.19e-2 1.85 2.25e-1
dev 4 1.65e-2 1.86 3.18e-1

What these show:

  • Development over-pins silently. It pins one row per rank, gives a different problem, and reports converged=True with rnorm 6e-16, because the residual excludes each rank's own pinned row.
  • The branch fixes the velocity. Its pressure gauge, however, still depends on the partition. Global row 2 is a different physical vertex at np 4, and the pressure mean flips from +0.162 to -0.161. This is harmless where the constant is a true null mode. It is not harmless otherwise; see check A.

Check 2: is the pinned row correct?

Global section offsets. The pin is read with getFieldOffset on the global section.

  • I audited every point with a pressure DOF (probes/p2_offsets.py). At np 1 and np 4 on the box, no owned field offset is ever offered for an unowned point (0 cases).
  • Without pressure essential BCs, every offered row is in the pressure IS that createFieldDecomposition returns (0 offered rows outside it).
  • The chosen row equals the global minimum of the pressure IS in every case without pressure BCs. For a P1 pressure that is row 2; for a discontinuous P1 pressure it is row 0.
  • Unowned points carry a negative offset, and the offset >= 0 filter drops them.

Edge cases:

case np owned pressure points per rank rows offered that are not pressure pin pin in pressure IS LU vs iterative, rel. velocity / pressure error
box, P2/P1 4 29, 34, 36, 43 0 [2] yes 8.5e-13 / 1.1e-11
box, coarse (cell 0.5 and 0.7) 4 1, 2, 3, 6 0 [2] yes 2.5e-13 / 3.1e-13
discontinuous P1 pressure 1 and 4 57-63 at np 4 0 [0] yes 6.1e-10 / 1.7e-7
pressure Dirichlet on Bottom 1 142 11 [2] no (pressure IS minimum is 6) 2.6e-12 / 1.1e-12
pressure Dirichlet on Left 1 142 11 [2] no (minimum is 4) 6.0e-13 / 2.6e-12
pressure Dirichlet on Top 1 / 4 11 [2] yes 1.8e-2 / 6.2e-2 (np 1); 3.5e-2 / 1.2e-1 (np 4)
pressure Dirichlet on Right 1 11 [2] yes 4.5e-2 / 7.9e-2
open top (natural BC, no pressure null space) 1 / 4 0 [2] yes 5.2e-3 / 1.8e-1

What these show:

  1. Constrained pressure points still report a non-negative global field offset. That offset is not a pressure row; it points to the next unconstrained DOF. This happened at 11 points in each case with pressure Dirichlet BCs. If such a point holds the lowest offset, the pin lands on a non-pressure row. In the Bottom and Left cases that happened (row 2 is not a pressure row). It was harmless only because row 2 there is an already-eliminated rotated velocity row. This is the same on development. A filter would close it: gsec.getFieldDof(q,P) - gsec.getFieldConstraintDof(q,P) > 0, or a lookup of the candidate in the pressure IS. [suggestion, not tested]
  2. The pin is applied unconditionally (use_lu and "pressure" in solver._subdict). Where the gauge is already fixed, by a pressure Dirichlet BC or an open boundary, the pin replaces a real continuity equation. The answer is then wrong by 0.5-4.5% in velocity, and the run still reports converged=True. This predates the branch, but the branch does not touch it, and its docs now read as if the gauge were always a pure null mode.
  3. A rank with no owned pressure DOFs, and no rank offering a row, could not be produced from a real mesh within 8 cores. Every coarse box gave each rank at least one owned vertex. A cell-1.0 box at np 4 left ranks with no cells and hung in computeJacobian/ptap at the first assembly (rotated_bc.py:1684/1686). That is before the pin and not caused by this change; it is a separate degenerate-partition issue. I tested the selection logic instead against a mock section at np 2 (probes/p2_mock.py):
mock case result per rank
rank 1 owns no pressure DOF [(5, True), (None, True)]
no rank owns any [(None, False), (None, False)], so no zeroRows anywhere
lowest row owned by rank 1, a ghost on rank 0 [(None, True), (3, True)]

Check 3: collectives

[read] Both call sites gate zeroRows on pinned, which comes from the allreduce and is identical on every rank. Every rank then calls it, the non-owners with []. _global_pressure_pin is reached on every rank: the forward solve calls it once, ahead of the loop and gated only on use_lu and the solver's fields, and the adjoint calls it when use_lu. MUMPS factorisation is collective in any case.

Measured: the M2 mutant (owner-only zeroRows) hangs at np 2 and 4, with the supervisor showing ranks split between Allreduce and Allgather. So the collective call is necessary, and the branch provides it.

Residual exclusion. lu_pin is non-None only on the owner, and that owner owns the row, because offset >= 0 in its own global section. _zero_rows_local then maps through the vector's ownership range, so it zeroes exactly the pinned row on the owner and nothing elsewhere [read]. This is consistent with the operator, and the LU rnorm of 6e-16 at np 2 and 4 agrees.

Check 4: the adjoint on the LU route

Closed box, all walls rotated free slip, viscosity 1 + eta*x*(1-y), gradient with respect to eta at 0.3, central finite difference with h = 1e-4 (probes/p4_adjoint.py):

build route np forward pin per rank adjoint pin per rank adjoint gradient rel. error vs FD
branch LU 1 (2, True) (2, True) 6.0130997633e-06 1.1e-8
branch LU 2 (2, T), (None, T) (2, T), (None, T) 6.0130997633e-06 1.1e-8
branch iterative 1 and 2 n/a n/a 6.0130997633e-06 1.1e-8
dev iterative 1 n/a n/a 6.0130997633e-06 1.1e-8
dev LU 2 2 / 560 2 / 560 6.0206018178e-06 1.1e-8

What these show:

  • On the branch, the forward and adjoint solves pin the same row, and the gradient at np 2 matches serial and the iterative route to all 11 digits.
  • Development at np 2 is self-consistent but solves the wrong problem. Its misfit J is 8.2334e-7 against the correct 8.2231e-7, and its gradient is 0.12% off.

Check 5: #899 and test_1088

test_1088:

build np 1 np 2
branch 12 passed, 1 xfailed 12 passed, 1 xfailed
dev 12 passed, 1 xfailed 12 passed, 1 xfailed
branch + PIN_MODE=none (no pin), LU test only 1 passed 1 passed

#899 fixture (probes/p5_899.py; linear viscous fault law, tolerance 1e-8):

variant np pins converged increments rnorm peak slip
multigrid 1 n/a yes 1 3.4e-10 0.1376218292
LU, branch 1 [0] no 50 2.30e-5 0.1323867383
LU, branch 2 [0] no 50 2.30e-5 0.1323867383
LU, dev 1 [0] no 50 2.30e-5 0.1323867383
LU, dev 2 [0, 1204] no 50 2.85e-5 0.1351739424
LU, no pin 1 none yes 1 1.1e-13 0.1376218292

The pinmode=none label in the 899_lu_{branch,dev}_* logs is a leftover environment variable. Those runs used the real branch or development code, as the per-rank pin values show.

Diagnosis. #899 is caused by the pressure pin.

  • With no pin, MUMPS solves the fault system in one increment and gives the multigrid slip to 10 digits. The strict-xfail test then passes at np 1 and 2.
  • The split fault with its rotated contact rows leaves the constant pressure without an exact null mode. The pin therefore deletes a real continuity equation, and the Newton loop stalls at about 2.6e-5.
  • The branch makes Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 reproducible across rank counts: np 2 now equals np 1. It does not fix it, and test_1088 does not XPASS.
  • [not isolated] Exactly why the stall sits at 2.6e-5 rather than converging to a different answer probably involves the pressure-gauge projection of the residual (use_pnull) acting on a non-null mode. I did not trace it further.

Same mechanism on the closed box. There, removing the pin changes nothing: velocity matches the iterative solve to 6.8e-13 and the pressure differs only by a constant. M3, the off-by-one mutant, behaves identically to no pin, because row 3 is an already-eliminated normal row. That is why M3 survives test_1156.

Check 6: regressions

Parallel, np 2, branch (logs/regress_par_summary.txt): 1064 (7 passed, 2 skipped), 1066 (2), 1068 (2), 1086 (2), 1112 (1), 1116 (1), 1131 (5), 1140 (12), 1142 (1) and 1144 (1). All passed. test_1088 and test_1156 are covered above.

Serial, branch. No regressions in the rotated, LU and adjoint files.

  • First run. 0018 adjoint support, 0019 adjoint solve, 0021, both 0022 files, 0023 solver gradient, 0024 adjoint boundary, 0026, 0062, all three 1018 files, and 1060 Nitsche: 103 tests, all passed (logs/regress_serial_branch.log).
  • Second run (logs/regress_serial_branch_part2.log): 1060 Nitsche, 1061, 1065 rotation gauge, 1066 rotated meets essential, 1085, 1111, 1113, 1115, 1131, 1136, 1141, 1142, 1143 and 1145. Result: 102 passed and 1 skipped. The skip is 1111, because this host's gmsh builds a different mesh.
  • Not regressions. My first file glob also picked up unrelated files with the same numbers.
    • test_0023_field_realness_and_derivatives::test_no_solver_differentiates_with_plain_sympy_diff failed with FileNotFoundError on src/.../petsc_generic_snes_solvers.pyx. The test reads the source tree next to tests/, which a git archive copy of tests does not have. That is an artefact of running from an archive copy.
    • test_1060_stress_store_smoothing ran for more than 30 minutes at 86% CPU. I killed it by PID; it is unrelated to rotated_bc.

Mutants:

mutant caught by test_1156?
M1 every rank pins (development's behaviour) yes, at np 2 and 4 (count assertion and velocity)
M2 owner-only zeroRows yes, as a hang, but only through the external supervisor; the test's own 300 s thread timeout did not fire
M3 off-by-one row no, at any np. It pins a non-pressure, already-eliminated row, which on this fixture is the same as no pin.

Check A (#968 round 3): rotation left in the answer on the LU route

Slid annulus, Lower given and tilted by 1e-2, Upper default (probes/r3.py, copied from the #968 review and patched to report the pressure gauge and the pins). The table gives the rotation left in the answer as |omega|/v_rms.

build np pins LU rotation LU v_rms LU pressure mean iterative rotation
branch 1 [2] 5.45e-3 4.970e-3 +0.161 5.40e-3
dev 1 [2] 5.45e-3 4.970e-3 +0.161 5.40e-3
branch 2 [2] 5.25e-3 5.034e-3 -0.107 5.29e-3
dev 2 [2, 370] 4.82e-3 5.099e-3 +0.029 5.48e-3
branch 4 [2] 2.49e-1 5.133e-3 -0.089 5.31e-3
dev 4 [2, 183, 375, 553] 8.42e-1 6.967e-3 +0.011 5.39e-3

Pin location against MUMPS ordering:

variant np pin LU rotation v_rms pressure mean
lowest row 1 [2] 5.45e-3 4.970e-3 +0.161
highest row 1 [287] 1.160e-1 5.029e-3 -0.010
highest row 4 [637] 1.160e-1 5.029e-3 -0.010
no pin 1, 2, 4 none 6.573e-3 (identical at all three) 4.515e-3 +3.40
lowest row, MUMPS ICNTL(7) = 0, 2, 5 1 [2] 5.453e-3 (all three) 4.970e-3 +0.161

The ICNTL(7) runs set the option through PETSC_OPTIONS. I did not confirm that MUMPS read it.

Verdict on A.

  • The single global pin changes the np 4 value, from 0.842 to 0.249, but does not remove the partition dependence.
  • The cause is the pin's location, not MUMPS choosing a different member of a null space:
    • Without a pin the system is non-singular, and np 1, 2 and 4 agree to four digits.
    • A pin at the highest row gives the same 0.116 at np 1 and np 4, which is consistent with the same physical vertex.
    • Changing the MUMPS ordering changes nothing.
  • With the tilted given normal, constant pressure is not an exact null mode. Pinning therefore replaces a real equation, and the answer depends on which vertex is pinned.
  • "Lowest global row" maps to a different vertex at each rank count, so the branch is still partition-dependent here.
  • The pressure gauge is partition-dependent on the branch even on the closed box (+0.162 at np 1 and 2, -0.161 at np 4).
  • Over-pinning, as development does it, makes this worse but is not the only cause.

Check B (#968 round 3): malloc crash on lu, it, lu

run np result
lu, it, lu, branch 1 all 3 solves complete
lu, it, lu, branch 2 solve 3: New nonzero at (2,0) caused a malloc, rank 0 only; rank 1 then hits an MPI truncation error (rc 142)
lu, it, lu, dev 2 the same error on both ranks (rc 1)
LU only, nonlinear box, no switching, branch 1 converges, 3 increments, rnorm 5.4e-14
LU only, nonlinear box, branch 2 the same malloc crash, rank 0 only (rc 142)
LU only, nonlinear box, dev 2 the same crash on both ranks
rb_fixB_keeppattern: LU nonlinear box / lu, it, lu 2 converges, 3 increments, rnorm 5.39e-14, equal to serial / all 3 solves complete

Where it comes from. The failing call is J.ptap(Qt, result=Ahat), the in-place refresh at rotated_bc.py:1688 on the branch and 1675 on development, at the second Newton increment of an LU solve.

  • At the first increment, the LU branch calls Aop.zeroRows([pin], diag=1.0) on Aop, which is Ahat when there is no interface law. Without MAT_KEEP_NONZERO_PATTERN, MPIAIJ zeroRows compresses the pinned row to its diagonal.
  • The next in-place PtAP writes the velocity coupling (column 0) back into global row 2, the pinned row, and fails.
  • The error appears only on the owning rank on the branch and on both ranks on development, which matches the per-rank pins.
  • Serial survives, presumably because the SeqAIJ PtAP numeric writes into the preallocated arrays [hypothesis].
  • Route switching only matters because solve 3 is a warm start that needs a second increment.
  • It is not the cached LU context and not the workspace cache: cache_allowed is False on LU, and that cache is destroyed at entry.
  • The interface-law path already avoids it by taking a fresh Atot copy at every iterate (the comment near line 1705 says so).

Fix, in rotated_bc's LU branch. Set Aop.setOption(PETSc.Mat.Option.KEEP_NONZERO_PATTERN, True) before zeroRows, or take a fresh PtAP at every iterate when use_lu. I measured the first: correct at np 2 and equal to serial. It belongs in the #348 branch, because the branch makes the failure worse: one rank raises while the others continue into a collective, and the ranks desynchronise rather than fail cleanly.

Findings, by severity

  • F1 (high; makes the existing failure worse). The LU route crashes at np >= 2 on any second Newton increment without an interface law: nonlinear rheology, or a warm start such as lu, it, lu. The cause is an in-place PtAP into an Ahat whose pinned row zeroRows compressed. Development fails on every rank. The branch fails on the owner only, and the other ranks run on into a collective (MPI truncation, rc 142; a hang is possible). Fix: KEEP_NONZERO_PATTERN before zeroRows, measured to work.

  • F2 (high, pre-existing; the root cause of Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 and Rotated free slip: a mesh whose walls mix given and default normals keeps a rigid rotation in its answer #968-A). The pin is applied whether or not constant pressure is an exact null mode. With a split fault, a tilted given normal, an open boundary or a pressure Dirichlet BC, it replaces a real equation:

    This needs its own issue, or a widening of rotated_bc opt-in LU path: pressure-datum pin is partition-dependent at np>1 #348. The candidate fixes are: no pin at all (MUMPS handled the singular closed box correctly here); MUMPS null-pivot detection (ICNTL(24)); or a pin only when the iterative path would attach a pressure null space and the mode is verified as null.

  • F3 (medium). The pin location, and so the pressure gauge, is partition-dependent: lowest global row means a different vertex at each np. On closed domains this is gauge only (the pressure mean flips sign at np 4). Where F2 applies, it is the remaining partition dependence. A coordinate-based choice would be reproducible across np, for example the pressure vertex nearest a fixed point with ties broken globally.

  • F4 (medium; a gap in the test).

    • test_1156 does not catch an off-by-one pin (M3).
    • Its first test fails on development only by AttributeError.
    • Its hang guard (timeout(300, method="thread")) did not fire on M2.

    Fix: assert that the pinned row lies in the pressure IS and is its global minimum, through createFieldDecomposition; check the gauge, for example that the pressure is zero at the pinned row; and keep the velocity comparison.

  • F5 (low, pre-existing). Constrained pressure points report a non-negative global field offset that is not a pressure row. With a pressure Dirichlet BC on the wall holding the lowest vertex, the pin lands on a non-pressure row (Bottom and Left cases). It was harmless here only by luck. Filter on unconstrained field DOFs.

  • F6 (low, docs). rotated-freeslip.md now says the gauge is fixed by pinning one DOF chosen over all ranks. It should say the pin is valid only where constant pressure is a null mode, and that the gauge constant depends on the partition.

Merge conditions

  1. Fix F1 in this branch, with KEEP_NONZERO_PATTERN before both zeroRows calls or a fresh PtAP per LU iterate. Add an np 2 test of a nonlinear LU solve with at least 2 increments.
  2. Strengthen test_1156 (F4): assert that the pin is in the pressure IS and is its global minimum.
  3. Correct the docs (F6). File F2 as a new issue, or re-scope rotated_bc opt-in LU path: pressure-datum pin is partition-dependent at np>1 #348 and Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 to it. Link Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 to this diagnosis: no pin, one increment, the multigrid slip to 10 digits.
  4. Optional: F3 (a coordinate-based pin), and F5 (filter constrained points).

Issue verdicts

What I could not test

  • A real mesh where a rank owns no pressure DOFs. Within 8 cores, every coarse mesh gave each rank at least one vertex, and a box with cell size 1.0 hung earlier, in assembly, with empty ranks; that is unrelated to this change. I covered it with a mock section instead.
  • np > 4. 3D. A P0 pressure: I did not try degree 0, and a discontinuous P1 pressure was the substitute.
  • Whether the ICNTL(7) ordering option reached MUMPS. I did not confirm it.
  • The exact mechanism of the 2.6e-5 stall in Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 (marked [not isolated]).
  • A development-build baseline for the serial regression set. Only the branch ran; failures are attributed below.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Review record, round 2 of 3: 4263cc6

Paths under review2/ are on hyperion, in runs/2026-11-11-348/.


#348 review, round 2: 4263cc6

Branch bugfix/rotated-lu-pressure-pin-348, head 4263cc6; round 1 reviewed 26c11aa. Run on hyperion, 2026-11-11, with at most 12 cores.

Verdict. F1 and F5 are fixed. F4 is half fixed. F2, re-scoped onto #348 and #899, still stands, and is larger than round 1 said.

  • Fixed here. The second-increment malloc crash is gone at np 2 and 4, and the new test catches it when the option is removed. The pin now always lands in the pressure IS.
  • Still open.

So the pin is safe only on straight-walled closed domains. Removing the pin and letting MUMPS factor, or keeping it only where the null mode is verified exact, is the policy question for Louis. The MUMPS section below gives the evidence.

Method

As in round 1.

  • Build. I used the wt-348 build at 4263cc6; the installed rotated_bc.py is byte-identical to the commit. Variants are exec'd over the module at runtime (probes/swapsrc.py, SWAP_SRC), and each run prints a check that the swap took effect. Nothing in the worktree or site-packages was touched.
  • Variants (probes/rb_*.py):
variant what it does
rb_new 4263cc6 as committed
rb_noKeep the setOption line removed
rb_M1 every rank pins its own lowest row
rb_M3 the pinned row is row + 1
rb_oldfilter round 1's global-section filter
rb_pinvar PIN_MODE=none disables the pin
rb_pinafter zeroes the pinned row after the pressure-mean projection, which is W1's dccb83d fix as I understand it
rb_mumps, rb_mumps2 instrumented: the null-mode residual, MUMPS ICNTL, INFO, INFOG and RINFOG, the determinant, and the right-hand side's gauge component
  • Tests ran from a git archive 4263cc6a tests copy with PYTHONDONTWRITEBYTECODE=1 and -p no:cacheprovider, every MPI run under mpi_supervisor.py.

F1: the KEEP_NONZERO_PATTERN fix

test_1156 (logs/t1156_summary.txt):

source np 1 np 2 np 4
4263cc6 3 passed 3 passed 3 passed
without setOption 3 passed nonlinear test fails (malloc on the owner, rc 142) nonlinear test fails (rc 142)
M1 every rank pins 3 passed 3 failed 3 failed
M3 row + 1 pin-row test fails hang, rc 124 hang, rc 124

The new test passes with the option and fails without it at np 2 and 4.

The adjoint. [read] solve_rotated_adjoint builds Ahat = J.ptap(Qt) fresh, pins it, transposes it and destroys it, with no in-place refresh, so it cannot hit the malloc. Measured: a nonlinear forward solve (viscosity times (1 + 50|v|²), consistent Jacobian, 3 Newton increments) followed by an adjoint on LU (logs/adj_*):

route np gradient FD relative error pins, forward and adjoint
LU 1 5.5941603812e-06 5.5941603207e-06 1.08e-8 the same
LU 2 5.5941603812e-06 5.5941603206e-06 1.08e-8 the same
iterative 2 5.5941603812e-06 5.5941603206e-06 1.08e-8 n/a

The linear LU adjoint at np 2 is unchanged from round 1 (6.0130997633e-06).

Reruns:

run result
nonlinear box, np 2 converges, 3 increments, rnorm 5.387e-14, the same as serial
nonlinear box, np 4 converges, 3 increments, rnorm 5.388e-14
lu, it, lu, np 2 no malloc, but solve 3 does not converge (50 increments); see N1

F4: test strength

  • M1 is still caught at np 2 and 4 (all 3 tests fail).
  • M3 fails cleanly at np 1 but hangs at np 2 and 4. The supervisor killed both at 300 s of silence; pytest-timeout's thread method then printed a timeout on the waiting rank.

The cause is at test_1156:73-75:

if row is not None:
    assert row in owned          # raises on the owner only
assert uw.mpi.comm.allreduce(...) == lowest   # the other ranks wait here

Fix: reduce first and assert after, for example ok = uw.mpi.comm.allreduce(int(row is None or row in owned), op=MPI.MIN), then assert ok after the second allreduce. With that change M3 should fail cleanly; I have not tested it.

F5: skipping constrained pressure DOFs

  • Is the filter right? [read + measured] The local section carries the constraint count for essential BCs: getFieldConstraintDof is 1 at 11 owned points for a pressure Dirichlet BC on a wall, as measured in round 1. dof - cdof > 0 is therefore right for owned points.
  • Ghosts. Ghost points can pass the local-section filter, but the unchanged gsec.getFieldOffset(...) >= 0 test still drops them. At np 4 no owned field offset was found on an unowned point (0 cases).

Pressure Dirichlet cases (logs/F5_*):

pressure Dirichlet on np filter pin in pressure IS LU vs iterative, rel. velocity / pressure error
Bottom 1 old (global section) 2 no (minimum is 6) 2.6e-12 / 1.1e-12
Bottom 1 new 6 yes 3.6e-2 / 1.2e-1
Bottom 4 new 14 (one row) yes 3.5e-2 / 1.3e-1
Left 1 old 2 no (minimum is 4) 6.0e-13 / 2.6e-12
Left 1 new 4 yes 8.8e-3 / 1.8e-1

The filter now does exactly what it says. But in these two cases the round-1 code was right by luck: it pinned an already-eliminated velocity row, which was in effect no pin. The fixed code pins a real pressure row in a problem whose gauge the Dirichlet BC already fixes, so the answer is now 1-4% wrong in velocity. That is F2 (pin unconditionally); F5's fix only exposes it. Nothing on development or the branch guards pressure-Dirichlet plus LU.

MUMPS: does the no-pin system look singular to MUMPS?

How I measured it. The rb_mumps hooks run inside the LU branch:

  • Null mode. Before the pin, they evaluate the constant-pressure vector e_p on the constraint-eliminated rotated operator, |A·e_p| and |Aᵀ·e_p| over |A|_F·|e_p|.
  • MUMPS state. After the factorisation they read back ICNTL(7, 13, 14, 24, 33), INFO(1,2), INFOG(1,2), INFOG(28) and the determinant (ICNTL(33)=1, RINFOG(12)·2^INFOG(34)).

All runs are serial (logs/mumps_*, logs/proj_*). PETSc options were passed through PETSC_OPTIONS and confirmed by the ICNTL read-back.

case null-mode residual, relative null mode exact? config INFOG(1) / INFO(1) INFOG(28) log10 det, no pin log10 det, pinned outcome, no pin
closed box (test_1156) 9.4e-20 yes defaults (ICNTL(24)=0) 0 / 0, no warning 0 307.43 325.09 velocity correct (6.8e-13 vs iterative); pressure gauge arbitrary (mean 0.475, or 0.051 with ICNTL(24)=1)
ICNTL(24)=1 0 / 0 1 325.09 (null pivot set aside) 325.09
#899 fault box 4.2e-20 yes defaults 0 / 0 0 583.28 601.52 converges, 1 increment, the multigrid slip to 10 digits
ICNTL(24)=1 0 / 0 1 601.52 601.52 the same
slid annulus, Lower tilted by 1e-2 (check A) 3.7e-6 no defaults 0 / 0 0 235.17 239.66 rotation/v_rms 6.57e-3, the same at np 1, 2 and 4
ICNTL(24)=1 0 / 0 0 235.17 239.66
slid annulus, Lower radial 3.0e-6 no ICNTL(24)=1 0 / 0 0 234.80 239.57 velocity agrees with iterative to 4.6e-5

In every case:

  • ICNTL(24) is 0 by default (read back).
  • INFO(1) and INFOG(1) are 0; MUMPS never warns, singular or not.
  • The right-hand side is compatible. Its component along the constant pressure, |b_p·1|/√nP, is at most 2e-18.

Answer for W1 and Louis.

  • Exact null mode (closed straight-walled box, Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899's fault box). MUMPS factored a singular matrix silently. There is no warning; INFOG(28) stays 0 unless ICNTL(24)=1, in which case it reports exactly 1 null pivot. The no-pin determinant is about 18 orders of magnitude below the pinned one, so the singular pivot is at round-off. MUMPS coped because the right-hand side is compatible: the velocity is correct and the pressure constant is whatever round-off chose. That is reproducible across ranks for velocity but not for the gauge. It works, but it relies on round-off. ICNTL(24)=1 makes it deliberate: one null pivot detected, and the same velocity.
  • Not an exact null mode (curved walls). The system is non-singular: INFOG(28)=0 even with null-pivot detection on, and the no-pin/pinned determinant ratio is only 10^-4.5. MUMPS solves it as an ordinary system. This is the only route that is partition-independent here (np 1, 2 and 4 identical in check A).

On #899, narrowing round 1. My data agree with W1. #899's operator has an exact null mode and a compatible right-hand side, so the pin there is a legitimate gauge; "the pin replaces a real equation" was wrong for #899. The stall comes from where the pinned row is zeroed:

#899 fixture, serial converged increments rnorm peak slip
4263cc6 (zeroes the pin row before the mean projection), linear no 50 2.30e-5 0.1323867383
rb_pinafter (zeroes the pin row after the projection), linear yes 1 1.8e-14 0.1376218292 (equal to multigrid)
rb_pinafter, nonlinear yes 6 3.8e-11 0.2206451153
multigrid, nonlinear yes 6 3.9e-11 0.2206451153
no pin, linear yes 1 1.1e-13 0.1376218292
  • Under rb_pinafter, test_1088 gives 13 passed at np 1; the strict xfail now passes.
  • Under rb_pinafter, test_1156 still gives 3 passed at np 2.
  • Did the no-pin run converge because there was nothing to spread? Yes, that is consistent. With no pin, nothing is zeroed before the projection, so the projection subtracts only the true mean of a compatible residual, which is about 0.
  • Why the box escapes on 4263cc6. The pinned row's residual is 0 at the first increment there: homogeneous data, and a linear solve that finishes in one increment. In the Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 box the pin vertex (point 664, global row 0) sits on a Dirichlet wall, whose datum gives it a nonzero continuity residual.

Round 1's F2 still holds for the curved-wall case. There the null mode is not exact, and moving the zeroing does not help:

slid annulus, tolerance 1e-10, fresh solvers rel. velocity error, LU vs iterative rotation component of that error LU increments, rnorm
Lower radial, 4263cc6 4.07e-1 2e-14 1, 1.8e-16
Lower radial, rb_pinafter 4.09e-1 2e-14 4, 2.4e-14
Lower radial, no pin 4.6e-5 2e-19 1, 3.9e-15
Lower tilted by 1e-2, 4263cc6 2.99e-1 3e-6 1, 1.8e-16
Lower tilted by 1e-2, rb_pinafter 2.98e-1 3e-6 4, 1.3e-11
Lower tilted by 1e-2, no pin 2.0e-12 1e-14 1, 2.1e-15

On the annulus the forcing is mostly balanced by pressure (v_rms 5e-3 against |p| about 1.7). A 3e-6 inconsistency at the pinned continuity row is therefore a 30-40% error in the small velocity, and the run reports converged because that row is excluded from the residual.

New findings

  • N1 (high, on 4263cc6 and development; serial too). A warm-started LU solve does not converge.
    • lu, it, lu on the slid annulus: solve 3 takes 50 increments, not converged, at np 1 and np 2, with a radial or a tilted Lower.
    • Same mechanism as Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899: a warm start gives the pin row a nonzero residual, which the projection then spreads.
    • Under rb_pinafter, all three solves converge at np 1 and 2, and solves 2 and 3 start already converged (0 increments).
    • Expected fixed by dccb83d; to be confirmed in round 3.
  • N2 (high, already on development). On curved closed free-slip domains, the pinned LU velocity is 30-40% wrong and reports converged.
    • This is the annulus case: the null mode is inexact because the nodal normals differ from the facet normals.
    • It is not the ordering bug; rb_pinafter does not fix it.
    • No pin, or a pin used only after an exactness check on |A·e_p|, fixes it.
    • This widens F2: the most common closed geometry is affected, not only special configurations.
  • N3 (medium). The F4 assertion hangs instead of failing at np > 1 (above).
  • N4 (medium). The F5 fix turns pressure-Dirichlet plus LU from right-by-luck into a consistent 1-4% velocity error, because of the unconditional pin (F2).

Status

item status
F1 malloc on the second increment fixed. Guarded by the new test; adjoint unaffected (fresh PtAP), measured.
F2 pin where the gauge is not a null mode open, wider. #899 is the residual-ordering bug (W1 is right; dccb83d targets it); curved walls are inexact null modes (N2); pressure Dirichlet (N4).
F3 partition-dependent pin location not addressed. Gauge only where the null mode is exact; it is the visible partition dependence in N2-type cases.
F4 test strength partly. M3 caught at np 1, a hang at np 2 and 4 (N3); M1 caught.
F5 constrained pressure DOFs fixed as specified; exposes N4.
F6 docs updated (the docstring now states the null-mode condition) [read].

Regressions (4263cc6)

For round 3 (dccb83d)

  1. N1 and Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899: does the zeroing move fix lu, it, lu and the Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 fixture (linear and nonlinear), and does test_1088 then XPASS?
  2. N2: the annulus LU-vs-iterative comparison (probes/p6_annulus.py). Expect it to stay about 30-40% wrong unless the pin policy changes.
  3. N3: the F4 assertion order.

Could not test

  • W1's SVD claim directly. My exactness measure is the null-mode residual plus MUMPS's null-pivot count and the determinant; it agrees with W1.
  • Condition-number estimates beyond the determinant ratio; RINFOG(10)/(11), the error-analysis estimates, were not enabled.
  • np > 4.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Review record, round 3 of 3: 660e35b

7f13db3's new test is checked in a separate comment. Paths under review3/ are on hyperion, in runs/2026-11-11-348/.


#348 review, round 3: 660e35b

Branch bugfix/rotated-lu-pressure-pin-348. I measured on two builds on hyperion, 2026-11-11, with at most 12 cores:

Between the two heads, rotated_bc.py changes only inside _global_pressure_pin. That is my assumption; I did not check it with git diff -- src. For the configurations the dccb83d runs use, the change is inert: none constrains a pressure DOF, so the new early return never fires. I therefore treat the dccb83d results as covering 660e35b too. As a spot check, the #899 fixture on 660e35b gives the same result as on dccb83d (1 increment, slip 0.1376218292). In both worktrees the installed rotated_bc.py is byte-identical to its commit.

Verdict. This PR is mergeable. F1, F4, F5, F6, N1, N3, N4 and #899 are fixed and guarded. Two items stay open and are not part of this PR:

  • F3: where the pin sits depends on the partition.
  • N2: on curved closed walls, the pinned LU answer is 30-40% wrong while reporting itself converged.

Both belong to the verified-pin policy PR for Louis.

Method

As in rounds 1 and 2. Variants are exec'd over the module at runtime (probes/swapsrc.py), and each run prints a check that the swap took effect. Nothing was built or edited. Tests ran from git archive copies, every MPI run under mpi_supervisor.py.

Variants on dccb83d (probes/):

variant what it does
rb_oldorder the pinned row zeroed before the mean projection again
rb_pinvar PIN_MODE=none for no pin; rowN forces global row N
rb_oldorder_pinvar both of the above
rb_M3 off-by-one pin
warn_both #968's mutant, which warns on both routes

Variants on 660e35b (b660/probes/):

variant what it does
rb_M1 every rank pins
rb_M3 off-by-one pin
rb_forcepin the constraint check removed, so it pins even with a pressure Dirichlet BC, as 4263cc6 did

Is dccb83d's ordering change my round-2 rb_pinafter? Yes. Diffed against rb_pinafter, the only difference in solve_rotated_freeslip is the comment. The _zero_rows_local(Fh, [lu_pin]) block moves from before the use_pnull projection to after it.

660e35b checks

test_1156, 4 tests (b660/logs/summary.txt):

source np 1 np 2 np 4
660e35b 4 passed 4 passed 4 passed
M3, row + 1 fails cleanly: pin-row test, rc 1, 5.6 s fails cleanly: rc 1
M1, every rank pins 3 failed 3 failed
forced pin (pins despite a pressure Dirichlet BC) the Dirichlet test fails the Dirichlet test fails

On dccb83d, before the N3 fix, M3 at np 2 still hung (rc 124). The new ordering, both allreduces before any assert, fixes it.

Pressure Dirichlet cases on 660e35b (b660/logs/pbc*):

p Dirichlet on np pinned LU vs iterative, rel. velocity / pressure error 4263cc6, for comparison
Top 1 no 2.9e-12 / 4.7e-12 1.8e-2 / 6.2e-2 (round 1)
Bottom 1 no 2.6e-12 / 1.1e-12 3.6e-2 / 1.2e-1
Bottom 4 no 5.4e-12 / 2.8e-12 3.5e-2 / 1.3e-1
Left 1 no 6.0e-13 / 2.6e-12 8.8e-3 / 1.8e-1
Right 1 no 5.6e-12 / 1.5e-12 4.5e-2 / 7.9e-2 (round 1)
closed box, control 4 yes, [2] 8.5e-13 / 1.1e-11

Is the constraint-count allreduce reached on every rank? [read] Yes. The loop over the chart runs on every rank, including ranks with no pressure DOFs (their count stays 0), and the allreduce follows unconditionally. The mock cases from round 1 cover empty ranks for the second allreduce.

Can a pressure constraint exist that does not fix the gauge, so the pin is wrongly skipped? [read, brief] I found no source of one.

  • The only route to a pressure section constraint is a pressure Dirichlet BC (add_condition(1, "dirichlet", ...)), and any Dirichlet value fixes the constant.
  • The other section-constraint injection in the solvers, _constrain_interior_multipliers_in_section, constrains the multiplier field h of block-constrained Stokes, not pressure.
  • On the Direct-LU rotated path does not converge on a split-fault contact solve (slip 4-5% off) #899 fault box (split mesh) there are no pressure constraints and the pin is kept: (0, True).
  • A Dirichlet BC on an empty label adds no constraint, so the pin stays, which is correct.
  • Residual risk: a pressure Dirichlet BC together with petsc_use_pressure_nullspace = True. That is user misconfiguration and outside this change.

N1 and #899 on the real commit (dccb83d)

#899 fixture (logs/899*):

case np increments rnorm peak slip
LU, linear 1 1 1.8e-14 0.1376218292
LU, linear 2 1 1.8e-14 0.1376218292
multigrid, linear 1 1 3.4e-10 0.1376218292
LU, nonlinear 1 6 3.8e-11 0.2206451153
LU, nonlinear 2 6 3.8e-11 0.2206451153
multigrid, nonlinear 1 6 3.9e-11 0.2206451153

test_1088, with the xfail removed: 13 passed at np 1, 2 and 4.

lu, it, lu on the slid annulus, tilted:

  • np 1: all three solves converge; solve 1 takes 3 increments, and solves 2 and 3 start already converged (0 increments).
  • np 2: the same.
  • On 4263cc6, solve 3 took 50 increments.

The old-order mutant (rb_oldorder) is caught only by test_1088's LU test, at np 1 and 2 (1 failed, 12 passed). It is not caught by:

  • test_1156 at np 2 (3 passed);
  • the serial set test_1018_rotated_freeslip, test_1066, test_1131 and test_0022_rotated_adjoint (64 passed).

The ordering is guarded, but by one test on one fixture. A cheap second guard would be a warm-started or Dirichlet-walled LU solve in test_1156 (suggestion).

Pin-row sweep on the #899 fixture (linear, LU)

W1's rows 0, 5, 40, 100 and 200 are indices into the pressure IS. In global numbering they are rows 0, 5, 58, 238 and 522. Global row 200 is a velocity row, so I ran it as a "wrong row" control and also ran the five pressure rows.

pin kind dccb83d, np 1 dccb83d, np 2 old order, np 1
row 0 (IS 0) pressure 1 increment, slip 0.1376218292 1 increment, 0.1376218292 50 increments, 2.3e-5, 0.13239
row 5 (IS 5) pressure 1, 0.1376218292 1, 0.1376218292 50, 1.1e-6, 0.13790
row 58 (IS 40) pressure 1, 0.1376218292 not run 1, 0.1376218292
row 238 (IS 100) pressure 1, 0.1376218292 not run 1, 0.1376218292
row 522 (IS 200) pressure 1, 0.1376218292 not run 50, 2.3e-5, 0.13342
global row 40 pressure 1, 0.1376218292 1, 0.1376218292
global row 100 pressure 1, 0.1376218292 1, 0.1376218292
global row 200 velocity (control) 1, but slip 0.14012 1, slip 0.13697

What this shows:

  • The old order reproduces W1's pattern: IS 0, 5 and 200 stall; 40 and 100 converge.
  • On dccb83d, every pressure-row pin converges in 1 increment to the multigrid slip, at np 1 and 2.
  • The velocity-row control converges to a wrong slip, as a pin on a non-pressure row should. That is exactly the case the F4 assertion now guards against.

N2 and W1's question about the check-A residue (dccb83d)

Slid annulus, fresh solvers, tolerance 1e-10 (probes/p6_annulus.py, probes/ann_rot.py):

Lower normal route rotation |omega|/v_rms v_rms rel. velocity error vs iterative
tilted by 1e-2 iterative 6.573e-3 4.515e-3 n/a
tilted by 1e-2 LU, no pin 6.573e-3 4.515e-3 2.0e-12
tilted by 1e-2 LU, pinned (dccb83d) 5.383e-3 4.980e-3 2.98e-1
radial iterative 1.1e-11 3.836e-3 n/a
radial LU, no pin 1.1e-11 3.836e-3 4.6e-5
radial LU, pinned (dccb83d) 3.7e-12 4.980e-3 4.09e-1

The answer to W1, plainly. The no-pin rotation of 6.6e-3 v_rms is genuine to the discrete problem. It is not an artefact of the ordering bug. The iterative route, converged to 1e-10 from a cold start, gives the same 6.573e-3 and agrees with no-pin LU to 2e-12 in velocity. The tilted given normal makes rotation not a null mode, and the warning says so, so the answer legitimately keeps some rotation.

Why round 1's "iterative 5.40e-3" was misleading. That figure came from a solve at tolerance 1e-6, warm-started from the pinned-LU answer, which it accepted in 0-1 increments. The pinned answer's residual sits below the 1e-6 test even though its velocity is 30% off: the operator is ill-conditioned along the near-null constant-pressure mode, whose relative residual is 3e-6.

What the ordering fix did and did not do. It changed the pinned value from 5.45e-3 to 5.38e-3, but the pinned LU is still 30-40% off. N2 is the pin on an inexact null mode, not the ordering, and is unchanged on dccb83d.

61bd202 (#1053 follow-ups), on dccb83d

  • test_1131: serial 28 passed; parallel twin 5 passed at np 2 and 5 passed at np 4.
  • The warn_both mutant (Rotated free slip: a mesh whose walls mix given and default normals keeps a rigid rotation in its answer #968 round 3) is now caught: test_a_wrong_given_normal_beside_a_default_wall_rejects_the_rotation fails (1 failed, 27 passed).
  • Warning counts. With the routes it, lu, it on the tilted annulus, there is exactly one warning per solve on the first iterative solve and on the LU solve. It appears on rank 0 only ([1, 0] at np 2). The third, cached iterative solve gives 0 warnings.
  • Wording: "The declared rotation mode is not removed: the rotated walls ['Lower'] take a given normal that a rotation about the mesh's centre is not tangent to (violation up to 0.0013 against 1e-08), so the answer keeps those rotations. ..."
  • Nit: the singular case still ends "keeps those rotations", plural.

Regressions (dccb83d)

  • Serial LU, adjoint and rotated set (26 files): 206 passed and 1 skipped (test_1111, because this host's gmsh builds a different mesh), rc 0.
  • Parallel, np 2: 1064 (7 passed, 2 skipped), 1066 (2), 1068 (2), 1086 (2), 1112 (1), 1116 (1), 1131 (5), 1140 (12), 1142 (1) and 1144 (1), all passed.
  • test_1088: 13 passed at np 1, 2 and 4.
  • test_1156: 3 passed at np 1, 2 and 4 on dccb83d, and 4 passed at np 1, 2 and 4 on 660e35b.

Status

item status at 660e35b
F1 malloc on the second LU increment at np > 1 fixed, guarded by the nonlinear test
F2 pin where the gauge is not a null mode split. #899 was the ordering bug (fixed, N1). Pressure Dirichlet is fixed (N4). Curved walls (N2) and the open boundary remain, and belong to the policy PR.
F3 partition-dependent pin location open, policy PR. Gauge only where the null mode is exact; real where it is not.
F4 test strength fixed: M1, M3 and the forced pin are all caught cleanly at np 2 and 4
F5 constrained pressure DOFs offered as pins fixed, now moot when any pressure DOF is constrained, since nothing is pinned
F6 docs updated [read]
N1 warm-started LU never converges; #899 stall fixed (dccb83d), guarded by test_1088 only
N2 curved closed walls, pinned LU 30-40% wrong but reports converged open, policy PR. Unchanged by dccb83d.
N3 F4 assertion hangs at np > 1 fixed (660e35b)
N4 pin plus pressure Dirichlet, 1-4% wrong fixed (660e35b), guarded by the new test

Merge conditions

This PR (#348), merge as it stands. Optional before merge:

  • a second guard on the residual ordering that does not depend on the fault fixture, for example lu, it, lu or a box with nonzero Dirichlet walls in test_1156;
  • the wording nit.

Verified-pin policy PR (Louis). Separate, and carrying N2, F3 and the open-boundary case. The round-2 MUMPS evidence holds:

The policy options are:

  1. no pin, with ICNTL(24)=1;
  2. pin only after measuring |A·e_p| as exact;
  3. a coordinate-based pin.

Each needs an annulus test such as p6_annulus, LU against iterative at 1e-10, because the existing tests are all on straight-walled boxes. There is also a convergence-test question: a 1e-6 residual accepted a 30%-wrong velocity (above).

Could not test

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Check of 7f13db3

The new residual-order guard works.

  • Head (7f13db3): test_1156 passes 5 of 5 at np 1, 2 and 4.
  • Old-order mutant: 7f13db3's rotated_bc.py with the pinned row zeroed before the pressure-mean projection again, swapped in at runtime. With it, test_a_pin_beside_a_dirichlet_wall_solves_the_same_problem fails at np 1, 2 and 4, on every rank, with rc 1 and no hang. The other 4 tests pass.

Before this commit, only test_1088's LU test caught that mutant. The src change since 660e35b is the singular-wording line only.

The logs and the mutant source are on hyperion, in runs/2026-11-11-348/review4/.

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