Repository navigation
The rotated free-slip solve counts and warns on capped sub-solves (#625) - #1260
Conversation
The rotated loop solves its own fieldsplit-Schur KSP, so the native path's count and warning (#585, #1062) never saw it. It read the last velocity and pressure application only, and never read the pressure sub-solve's reason. Each sub-KSP now has a post-solve hook that counts the applications that stopped at their cap (DIVERGED_MAX_IT) over the whole solve, reset when a solve starts on a cached context. The count is in _rotated_freeslip_info["sub_capped"] (None without sub-KSPs), and the solver warns once per capped block, attributed to the user's solve() line, as the native path does. The reason is global to the KSP, so the counts agree on every rank; rank 0 warns. test_0207: a pressure tolerance the sub-solve cannot reach caps every application, counted and warned; at the default tolerance the counts are zero and nothing is said. Both fail on development (no count). Underworld development team with AI support from Claude Code
|
Adversarial review, round 1 (head 5ac6537)
No findings. Issue state:
Underworld development team with AI support from Claude Code |
|
Second-desk review by H7 (a Claude review session running parallel probes on a 96-thread Linux workstation: Intel Xeon Gold 6240R, AVX-512, MPICH). The base is development e7e02b9, the merge base of the rotated batch (#1260, #1261, #1262, #1265, #1263). #1261, #1262, #1265 and #1263 change only Verdict: passes. It is independent of the others in the batch. Checked
Findings
Underworld development team with AI support from Claude Code |
The conflict in petsc_generic_snes_solvers.pyx is two methods added at the same place: this branch's _warn_on_capped_rotated_sub_solves (#625) and #1255's _refuse_unfactorable_pressure_preconditioner (#1059). Both are kept, with their call sites (the rotated solve's sub_capped warning, and the post-solve refusal with its forced setup after a PC failure). Underworld development team with AI support from Claude Code
|
Merged development into this branch: c3332a6. The conflict. It was in
Serial runs on the merge (macOS, 12-core Apple M4):
Underworld development team with AI support from Claude Code |
Brings in #1260 (rotated sub-solve caps); the merge of rotated_bc.py is automatic. Underworld development team with AI support from Claude Code
A rotated free-slip solve now counts the sub-solves that stopped at their iteration cap and warns once per capped block, as the native Stokes path does since #1062. This is part of #625, which stays open.
What changes
On development.
rotated_bc) solves its own fieldsplit-Schur KSP, so the native path's count (solve_report.sub[...].capped) and its warning never saw it.Now.
DIVERGED_MAX_IT) over the whole solve, and the counts reset when a solve starts on a cached context._rotated_freeslip_info["sub_capped"]as{"velocity": n, "pressure": n}. They areNonewhere there are no sub-KSPs (the direct-LU path, the sheet's single KSP).RuntimeWarningattributed to the user'ssolve()line, in the native warning's words.Cost of the hooks
The probe runs the same rotated annulus solve with the hooks on, and with
KSP.setPostSolvereplaced by a no-op so that none is installed. Serial, macOS (12-core Apple M4); wall time of the solve, median of 3:In all 18 runs the velocity, the pressure, and the outer and sub-solve iteration counts are bitwise identical with and without the hooks. Wall time on this machine moves by a few percent from run to run, so the ratios bound the overhead rather than measure it. I timed this annulus in place of test_0022.
A fixture with two or more capped applications per increment. I didn't find a cheap one. With a viscosity contrast of 1e4, the capped solve still takes one outer iteration. At 1e6 it takes 300 outer iterations (62,298 velocity applications) and does not converge, which is too slow for a test.
Left open on #625
petsc_generic_snes_solvers.pyx: a pressure preconditioner that never reaches the cap, or an inexactness made deliberate and cheap.petsc_optionsstill do not reach the rotated loop, whose options live under its own prefix. Whether they should is a design question and is not taken here.Tolerances and coordinate matches
None.
Tests
tests/test_0207_rotated_subsolve_cap_detection.py, level 2, tier B. It is an annulus with rotated free slip on both walls._rotated_pres_rtol = 1e-30, a tolerance the pressure sub-solve cannot reach:Both fail on development (
KeyError: 'sub_capped').What the test does not show. The fixture has one pressure application per Newton increment. It therefore does not tell the count over every application from a last-application readout, and no case caps the velocity block. Those rest on PETSc running the post-solve hook after every
KSPSolveof the sub-KSP. Measured on the capped fixture: the velocity sub-KSP's hook ran 208 times in one solve (200 pressure iterations, each a Schur product through the velocity solve, plus the factorization's own velocity solves), and the pressure hook once. So the hook sees the inner Schur solves. A nonlinear viscosity gave four increments and a pressure count of 4, one per increment, so it does not separate them either.Serial runs (macOS, 12-core Apple M4): test_0205, 0206, 0207, 0022, 1084, 1131, 1142, 1188 → 98 passed, 1 skipped (an x86-only case).
Review
Adversarial review, below.
Issue state
#625: partly addressed. The rotated path's detection is fixed here; the caps and the user-cap question stay open. No fixed-in label.
Underworld development team with AI support from Claude Code