Skip to content

Rotated free slip with an analytic normal, and the free surface, find every owned wall node (#935) - #938

Merged
lmoresi merged 8 commits into
developmentfrom
bugfix/analytic-normal-wall-nodes-935
Nov 4, 2026
Merged

lmoresi merged 8 commits into
developmentfrom
bugfix/analytic-normal-wall-nodes-935

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 4, 2026

Copy link
Copy Markdown
Member

Each boundary facet is labelled on one rank, so a rank can own a wall node whose labelled facets all sit on neighbours. Two node lists were built only from the facets labelled on the rank, and both missed such a node:

The change

  • rotated_bc. The facet loop sums the geometric normal, or a marker on the analytic path. One cross-rank sum completes either; the function is now _sum_node_vectors_across_ranks, renamed from _sum_facet_normals_across_ranks.
    • The analytic normal is then evaluated once per node, so every rank holding a node gives it the same normal.
    • In 2-D the normals are unchanged to the bit. In 3-D a node on three or more facets moves by at most one ulp (serially, 14 of 101 nodes on a box wall).
    • The analytic path is now collective, as the geometric path already was. Every caller (build_rotation, fault_mg's coarse levels, the traction readers) reaches it on every rank.
  • free_surface. A marker is reduced onto each vertex's owner over the plex's point SF and broadcast back. Serial order and results are unchanged.
  • _unit_normal replaces three pasted copies of the evaluate-and-normalise step.
  • rotated-freeslip.md says that both normals constrain the same nodes in parallel, what happened before, and which readers share the node list.

Measured on a production annulus

The zg95 annulus: TAc from checkpoint 20, refinement 5, normal=unit_r on both walls, np 32, one step (kaiju, Linux, PETSc 3.25.0, ParMETIS).

development 60dbf0e this branch
owned wall nodes with no constraint row 3 (1 outer, 2 inner) 0, on every multigrid level
largest wall-normal velocity, |v·n| 1.2e4 (with |v| 1.2e4) 3.4e-13
step time 964 s 280 s
next time step 2.66e-6 4.44e-6
Newton iterations 5 5

The unconstrained nodes slowed every linear solve and limited the time step. On a same-day control, none of the three missed nodes has a labelled facet on its owner. #935's analysis listed two of them as having one, but those two carry only a vertex label there, so there is no second mechanism.

Tests

tests/parallel/test_1140_rotated_analytic_normal_wall_nodes_parallel.py (level 2, tier B, mpi(min_size=2); CI's MPI phase runs it at np 2). It uses two coarse boxes. On each, at np 2, one rank owns a corner with no facet of either wall beside it (Linux, PETSc 3.25, ParMETIS). It checks four things:

  • The analytic node sets equal the geometric ones on every rank, with constant and with sympy normals.
  • Each fixture holds the case at the rank counts it was measured at (HOLDS_AT): both at np 2, and the unstructured box at np 4. The check skips, with the reason, elsewhere.
  • A rotated free-slip solve leaves no normal flow above 1e-13 of max |v| at any wall node. Serially the normal flow is exactly 0; without the fix it was 1.3e-10 to 0.67 of max |v|.
  • The free surface's vertex list holds every local vertex of each wall.

On kaiju:

The round 2 fixes (2d1ab8a, 7621953) were checked serially here; kaiju's np 2 and 4 run of the final test file, and its run against development, follow as a comment.

Closes #935. Left open in this territory:

Verdicts are in the review comment.

Underworld development team with AI support from Claude Code

… wall node (#935)

An analytic or constant normal takes a rank's wall nodes from the facets labelled
on that rank, so a rank that owns a wall node whose facets all sit on neighbours
gives it no constraint row. Kaiju found it on coarse boxes at np 2 (a corner owned
by rank 1 with no facet of either wall beside it), and on the zg95 annulus at np
24-52.

tests/parallel/test_1140 checks, at np 2 and 4:
- the analytic normal finds the geometric path's wall nodes on every rank;
- the fixtures hold an owned wall node that no local facet reaches, so the file
  can see the defect;
- a rotated free-slip solve with the constant wall normals leaves no normal flow
  at any wall node. Serially, dropping the Top-Left corner from the Top and Left
  node sets makes this fail with normal flow equal to max |v|.

Underworld development team with AI support from Claude Code
…#935)

_boundary_velocity_nodes took the analytic path's nodes from the facets
labelled on the rank. The geometric path completes its node set through the
point-SF scatter that sums the normal (#560); the analytic path now sums a
marker through the same scatter, and a node found only that way takes the
normal at its coordinate, as a node with one local facet does. Nodes found
locally keep their normals bit for bit (test_1018 passes serially). The
analytic path is now collective, as the geometric one already was; every
caller (build_rotation, fault_mg's coarse levels, the traction readers)
reaches it on every rank.

rotated-freeslip.md says both normals constrain the same nodes in parallel,
and what happened before.

Underworld development team with AI support from Claude Code
…w, free surface

From the pre-PR review:
- the analytic and geometric node sets must be equal, so an analytic path that
  over-collected (interior seam nodes pinned to the wall normal) fails too;
- the power check runs per fixture, so neither fixture can lose its partition
  case while its other tests pass without seeing the defect;
- no normal flow above 1e-13 of max |v|: exactly 0 serially, and the review
  found the 1e-10 bound blind when only one wall's row at a corner is lost
  (6.6e-11 to 9.5e-11 serially);
- the docstring names no campaign, host or probe outside the repository.

New: FreeSurface._surface_node_coords took its vertices from the facets
labelled on the rank, as the analytic path did, so every surface row it
matches (the mesh deformation, h_inf, the consistent solve's datum) missed a
vertex whose facets all sit on neighbours. With the rotated fix alone that
vertex gets a constraint row whose datum the free surface never writes on its
owner (0). The new test asks for every local vertex on Top; it fails at np 2
until the next commit.

Underworld development team with AI support from Claude Code
…935)

FreeSurface._surface_node_coords took its vertices from the closures of the
surface facets labelled on the rank. A rank can hold a surface vertex whose
facets all sit on neighbours, so on its owner that vertex had no row in any
surface field matched from these coordinates: the mesh deformation did not move
it, and with the rotated fix the consistent solve's constraint row there read a
datum the free surface never wrote (0).

A marker summed over the point SF through the coordinate DM's local-to-global
scatter completes the set; every rank takes part, a rank with no surface facet
included. Serially nothing changes but the order, now sorted by point; the
plume test (test_1070) passes serially.

Underworld development team with AI support from Claude Code
…r the set is complete

The facet loop now only collects: the geometric normal sums |f| n_f per node,
the analytic path a marker. One cross-rank sum completes either, and the
analytic normal is then evaluated once per node. Before, a node found through k
local facets took normalize(sum_k normalize(n(x))) and a node found only through
the scatter normalize(normalize(n(x))). These agree to the bit for k <= 2, so 2-D
is unchanged (test_1018's analytic comparison passes), but they differ by an
ulp in 3-D, so a node's normal depended on how many of its facets the rank held.
Serially, on a 3-D box with the constant normal (0.3, 0.1, 1) on Top: the same
101 nodes; 14 move by 1 ulp, all on 3 or more facets.

- _unit_normal replaces the pasted evaluate-and-normalise in
  _manifold_velocity_nodes, the sheet datum and here.
- _sum_facet_normals_across_ranks is now _sum_node_vectors_across_ranks: it sums
  markers too.
- rotated-freeslip.md: what the analytic path sums, that the traction readers
  and the dynamic topography field take the same node list, and that the free
  surface completes its vertex set the same way; no campaign names.

Underworld development team with AI support from Claude Code
…measured at

On kaiju at np 4 the regular box (cellSize 0.4) holds no owned wall node that
only a neighbour's facets reach, so its power check failed there; the
unstructured box (0.5) holds one at np 2 and 4, and both at np 2, CI's count.
HOLDS_AT records this, and the check skips, with the reason, at a rank count a
fixture was not measured to hold the case.

Underworld development team with AI support from Claude Code
…all, facets only

- Every normal check also runs with the normals as sympy matrices, which the
  library lambdifies and evaluates at each node's coordinate (as for unit_r), so
  the lambdified path of a node found only through the scatter is covered.
- The free-surface check runs on all four walls, as the rotated checks do,
  so it keeps its power if a partition moves the case off Top.
- _reached_by_local_facets takes facets only: the label also carries vertices.
- Wall nodes are picked by exact coordinate; no host name in the comments.

Underworld development team with AI support from Claude Code
…F; comments

- FreeSurface._surface_node_coords reduces its marker onto each vertex's
  owner over dm.getPointSF() and broadcasts it back. The coordinate DM's
  scatter it used depends on that DM's SF, which DMSetPointSF does not
  propagate; a rebuild that left it stale would bring back the label-local set
  without an error.
- The vertices keep their old order (no sort), so a 3-D surface's x-sorted
  rows, and the order of the sums over them, are unchanged serially.
- rotated_bc: the null-IS comment says a rank with no facet can still return
  nodes; the essential-corner comment cites #936 and says what the marker keeps.

Serially: test_1018, test_1074 and the test_1140 bodies pass.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 4, 2026 06:48
@lmoresi

lmoresi commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Pre-PR adversarial review

Two rounds by independent reviewers, each followed by fixes. Round 1 ran on c382bd0, the first fix. Round 2 ran on 30daa32, after round 1's fixes. The reviewers' checks were serial; kaiju ran every parallel case afterwards; the run of the final tip's test file follows as a comment.

Round 1 (c382bd0: the analytic path sums a marker across ranks)

Round 2 (30daa32)

Attacks that failed

  • Collective hang. Every caller reaches the cross-rank sum on every rank in the same order: build_rotation, the traction readers, fault_mg.level_wall_rotation, and the free surface's constructor.
  • Serial behaviour. Unchanged to the bit in 2-D: the scatter returns early at np 1 (test_1018's analytic comparison passes). The geometric path is bit-identical on 2-D and 3-D fixtures.
  • Aliasing of the shared marker. Each addition makes a new array.
  • The free-surface trace-mass conservation check. Added vertices carry weight 0, and the ring gather drops duplicate copies.
  • The coarse-level proxy DM in fault_mg. The geometric path already runs the same scatter there.
  • Rank-consistent skips. HOLDS_AT is decided on uw.mpi.size.
  • CI reach. check_test_coverage.py passes; the MPI phase picks the file up at np 2.

Issues in this territory

Issue Verdict
#935 Fixed by this branch: test_1140 at np 2 and 4, and the zg95 annulus at np 32 (0 missing points, wall-normal velocity 3.4e-13).
#936 Still live, filed by this review. The branch does not change the constrained nodes' reads; the note on partially pinned corners is on the issue.
#931 Still live. test_1064's spherical case fails at np 2 identically on this branch and on development (posted on #931).
#906 Still live. It concerns the geometric normal, which this branch leaves unchanged.
#608 Still live. Corner handling is unchanged.
#923 The test_1064 spherical part has the same verdict as #931.

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

The partition-sensitive switch to the plex point SF for free-surface membership completion still needs final-commit MPI regression results at np=2 and np=4 before approval.

No open issues 🎉

What changed in this PR

Fixes missing wall nodes in parallel rotated free-slip and free-surface handling for #935. Nodes whose labelled boundary facets exist only on neighbouring ranks are now included, preserving velocity constraints and surface-field updates.

Changes:

  • Completes analytic-normal node sets across ranks and centralises normal evaluation.
  • Completes free-surface vertex sets through owner reduction and broadcast.
  • Adds parallel regression tests and documents the shared-node behaviour.
File Description
tests/​parallel/​test_1140_rotated_analytic_normal_wall_nodes_parallel.py Adds checks for node completeness, fixture validity, wall-normal flow and surface vertices.
src/​underworld3/​utilities/​rotated_bc.py Completes analytic-normal node sets across ranks and extracts a shared normalisation helper.
src/​underworld3/​utilities/​boundary_flux.py Updates a comment to reference the renamed reduction helper.
src/​underworld3/​systems/​free_surface.py Includes surface vertices reached only through neighbouring ranks.
docs/​developer/​subsystems/​rotated-freeslip.md Explains parallel node completion and the affected traction and topography readers.

Review effort: Balanced

@lmoresi

lmoresi commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Kaiju's run of the final tip, 7621953 (Linux, PETSc 3.25.0, ParMETIS, OMP_NUM_THREADS=1):

run np result
test_1140 at 7621953 2 12 passed
test_1140 at 7621953 4 11 passed, 1 skipped: the [True-0.4] power check, "not measured to hold the case at np 4"
the same test file on development 60dbf0e 2 10 failed, 2 passed

On development, both power checks pass. Every analytic-node, no-normal-flow and free-surface case fails, with constant and with sympy normals:

  • Node sets: each rank misses a corner (wall, missed point).
  • Normal flow: 1.35e-2 and 2.52e-2 against max |v| of 3.6e-2 and 3.7e-2.
  • Free surface: every wall misses a corner vertex on one rank.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit f631ce4 into development Nov 4, 2026
9 checks passed
lmoresi added a commit that referenced this pull request Nov 4, 2026
…ned-node-936

#938's branch, which this one was stacked on, is now in development; clean merge.

Underworld development team with AI support from Claude Code
lmoresi pushed a commit that referenced this pull request Nov 4, 2026
The branch had merged #938's branch tip rather than development's merge commit,
which left two merge bases; GitHub's merge then reported a conflict in rotated_bc.py.

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