Skip to content

Stokes.pressure_split: a prescribed interface pressure jump on fitted facets (opt-in, from #1033) - #1116

Merged
lmoresi merged 6 commits into
developmentfrom
feature/pressure-split
Nov 13, 2026
Merged

lmoresi merged 6 commits into
developmentfrom
feature/pressure-split

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Stokes.pressure_split writes a prescribed pressure jump across named, fitted interior facets as p = q + p_J, so the solver's continuous pressure never has to represent the discontinuity. It works on triangles and tetrahedra and needs nothing about the shape of any wall. This is @gthyagi's work from #1033, cut out of #1110 on its own as the review there asked.

What is added (gthyagi, one commit, authorship kept)

  • Stokes.pressure_split(jumps=, normals=) and utilities/_pressure_split.py: a DG P1 lift of the jump on the vertex stars of the interface, the regular body force that replaces the sheet load, and the correction to an exterior natural datum.
  • Tests test_1184_general_pressure_split.py and test_1185_tetrahedral_pressure_split.py (1099 is taken on development). development is merged at ba68af0; the test_118* decade line in scripts/test.sh covers both files.
  • The guide page docs/advanced/prescribed-pressure-jumps.md.

What we changed, and why

  • A parallel run in CI. The split tells ranks that share an interface vertex but hold none of its facets about the interface, through the point SF. No CI run exercised that. With the exchange skipped, test_1184 passes serially and at two ranks and fails at four (test_incompatible_junction_or_tip_is_rejected[True], on every rank). scripts/test.sh now runs test_1184 at four ranks in the parallel phase, the way it runs test_1084 at three. It takes 24 s on the workstation named below.
  • A solve warns about a stale split. The lift and its force are built once from the mesh geometry. pressure_split now records the mesh geometry version on the solver, and the Stokes solve notes (which already carry the formulation warnings) add one for each split built before the geometry last changed, naming its interfaces. It is a warning, not a refusal. The test, written first, fails without it: the first solve is silent and returns u = 0; after mesh.deform the next solve warns once.
  • Guide trimmed to this change (the paragraph on cylindrical_pressure_lifting is gone, since that method is not here), linked from the advanced index, and marked experimental in the page and the docstring.

Opt-in

The solver file gains this method and nine lines in the Stokes solve notes for the warning above; no existing line changes. A solver on which pressure_split was never called has no record, so the notes loop does nothing. The module is imported only inside the method.

Verification (a 96-thread Linux workstation, single system image, Intel Xeon Gold 6240R, MPICH 5.0.1, PETSc int32; head 378f7e5)

check result
tests 1184 and 1185, serial 19 passed
the same at np 2 and np 4 19 passed on every rank
the stale-split test before the change fails: no warning after mesh.deform
solver description contract, solve report, collective-guard scan; style gate 22 passed; gate passes
point-SF exchange skipped: np 2 / np 4 (at 0be5468) 18 passed / 1 failed, 17 passed
review of #1110 at 14627f5 (independent desk): constant jump 0.7 on a fitted box, np 1, 2, 4 jump 0.70000000 to 1e-11, max velocity 1e-13
scripts/check_test_coverage.py all 445 test files reachable

Known gaps

Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)

  • I have read the Style Charter and followed it over the surrounding code (S2)
  • No drive-by refactors, renames, or "while I was here" cleanups (S9)
  • Bug fixes ship the regression test, written first, with level_* and tier_* markers (S8)
  • No hedging names (maybe_ / try_ / do_) and no commented-out code (S3, S4)
  • Every exception swallow states its sanctioned failure mode in a comment (S4)
  • New data access uses .array / mesh.X.coords — no with ....access(...), no mesh.data (S7)
  • Parallel safety considered — np2/np4 checked where swarm/mesh/solver dispatch is touched (S11)
  • No pixi.toml / pixi.lock or other dependency changes riding in an unrelated PR
  • AI-assisted work carries the attribution line below

Underworld development team with AI support from Claude Code

gthyagi and others added 3 commits November 13, 2026 08:21
…= q + p_J on fitted facets

Cut from #1033 (gthyagi/underworld3 feature/cylindrical-wall-boundaries_sph at
1b74046), unchanged apart from test file numbers: the pressure_split method,
utilities/_pressure_split.py, its triangle and tetrahedron tests (1184, 1185;
1099 is taken on development) and the guide page. The jump is prescribed on
named, fitted interior facets; nothing here needs to know the shape of a wall.

Underworld development team with AI support from Claude Code
…entry and CI line

The guide page loses the paragraph on cylindrical_pressure_lifting, which is
not part of this change, and gains a note that the split is experimental and is
built once from the mesh geometry. The page is linked from the advanced index,
and scripts/test.sh gains the batch line for tests 1184 and 1185.

Underworld development team with AI support from Claude Code
The split marks interface vertices on ranks that share a vertex and hold none
of the interface's facets, through the point SF. No CI run exercised that: the
split's tests are serial files. With the exchange skipped, test_1184 passes
serially and at two ranks and fails at four
(test_incompatible_junction_or_tip_is_rejected[True]). scripts/test.sh now
runs test_1184 at four ranks in the parallel phase, as it runs test_1084 at
three.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 12, 2026 21: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 12, 2026

Copy link
Copy Markdown
Member Author

Re-check of #1116 (H3, second review desk): the pressure split cut out of #1110

Verdict: READY at 0be5468 once a moved mesh is refused (one small change, below). The cut and the np 4 run meet the condition from our #1110 review.

The cut

The np 4 run

The mesh-move gap: not acceptable silently

  • The problem: the split is built once, from the geometry at call time. It gives a DG P1 lift on the facets as they were, and a force field from those cells' gradients. After deform or a mover, those fields describe the old facets, and the solve uses them with no error.
  • The rule: Louis's rule for this work is that a mover invalidates what depended on the old geometry. A silent wrong answer after a move is what it forbids, and being opt-in and experimental doesn't change that.
  • The change we'd ask for: store mesh._geometry_version with the split when it is built. Refuse, collectively, when the solver assembles with a split whose version differs, with a message that says to call pressure_split again after moving the mesh. A warning would be the minimum; a refusal is cheaper than a wrong run.
  • A test: build the split, deform the mesh slightly, and solve. It should refuse on every rank.

Unchanged from #1110, stated in the body

  • The orientation-conflict check on shared facets has no test that fails without it.
  • The rank-local "simplex cells" raise is unreachable.

Underworld development team with AI support from Claude Code

One conflict, in scripts/test.sh: #1114 replaced the per-file batch lines with
one line per decade. Development's side is taken, so the batch line for tests
1184 and 1185 is gone (the test_118* decade covers them); the np 4 line for
test_1184 in the parallel phase is kept.

Underworld development team with AI support from Claude Code
…lit was built

Fails before the change that follows: the first solve is silent and returns
u = 0, and after mesh.deform the next solve says nothing about the split.

Underworld development team with AI support from Claude Code
…it was built

pressure_split records the mesh geometry version it was built at, on the
solver. The Stokes solve notes, which already carry the formulation warnings,
gain one for each split whose version is no longer the mesh's: it names the
interfaces and says to build the split again. A warning, not a refusal. Users
who never call pressure_split have no record and get no note.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Re-check of #1116 at 378f7e5

From H3, the second review desk, running on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).

Verdict: READY at 378f7e5, on green CI (one job green and five running when checked).

The cut

Against development, the diff is still the pressure split alone: 7 files, 895 lines added and none removed. Those are the method, _pressure_split.py, tests 1184 and 1185, the guide page, the index entry and the scripts/test.sh lines. The discretisation_mesh.py changes in the branch history come from development itself, through the merge (#1086, #1082), not from this PR.

The np 4 run

tests/test_1184_general_pressure_split.py under mpirun -n 4: 11 passed on each of the four ranks, the new test included. Serially, test_1184 and test_1185 give 19 passed.

The mesh-move warning

  • Where it lives: in SNES_Stokes_SaddlePt._snapshot_model_facts, which reads self._pressure_split_geometry.
  • It can't fire for a solver that never called pressure_split. That record is created only inside the split's builder: one entry per call, keyed by interface names, holding the mesh's _geometry_version at build time. The lookup is getattr(self, "_pressure_split_geometry", {}), so a solver without a split iterates over nothing.
  • It is rank-consistent. _geometry_version changes only through a collective move, and _emit_solve_notes warns on every rank with no rank test. Under -W error, every rank raises together.
  • The test is right. test_a_solve_warns_when_the_mesh_has_moved_since_the_split_was_built asserts a silent first solve (u below 1e-9 for the exact constant jump), then a 1e-3 interior deform, then exactly one warning naming the interface. H6 showed it failing before the guard; we did not rerun that mutant.
  • Warning or refusal: a warning rather than the refusal we suggested is acceptable for an opt-in, experimental method, since it is said on every solve until the split is rebuilt.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit 7fa3bc0 into development Nov 13, 2026
10 checks passed
lmoresi pushed a commit that referenced this pull request Nov 16, 2026
pressure_split came to development in #1116: its module, test and docstring
note are taken from development. The guide page keeps development's split text
and this branch's section on the circular benchmark.

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.

4 participants