Skip to content

The rotated wall normal is summed across ranks in every component (#941) - #1265

Merged
lmoresi merged 3 commits into
developmentfrom
bugfix/rotated-normal-summed-on-pinned-components-941
Nov 20, 2026
Merged

lmoresi merged 3 commits into
developmentfrom
bugfix/rotated-normal-summed-on-pinned-components-941

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

In parallel, the geometric normal of a rotated free-slip wall is now summed across ranks in every component, including the components an essential condition constrains.

This is a parallel change written without a parallel run. We do not run MPI on the machine it was written on, so its first runs at np 2 and 3, of the new test and of the existing rotated parallel files, are the reviewer's.

What changes

On development.

Now.

  • The sum rides the DM's point star forest, dim doubles per point. Each rank's contributions are reduced onto the point's owner, and the total is broadcast to every copy.
  • A node a rank owns whose facets all sit on neighbours still gets its normal, since the owner's row receives their shares. So _local_boundary_candidates, which collected those nodes for the old scatter, is removed.
  • Serial runs take the same path as before: one rank returns its own sums.

Tolerances and coordinate matches

  • Library: none.
  • Tests:
    • nodes are compared across ranks by the DM's global point number;
    • normals must agree to 1e-14 between ranks and match the tilted wall's normal to 1e-12;
    • the corner is found by topology, as the Top node the Left label also holds.

Tests

tests/parallel/test_0941_rotated_normal_summed_on_pinned_components_parallel.py, level 2, tier B, in the parallel glob. The fixture is a box whose top rises by 0.25 over its width, with rotated free slip on the top (geometric normal), the vertical velocity pinned on the left wall, and no slip on the bottom and right.

  • Every rank holds the same normal at every top-wall node. The test refuses a fixture that has no node shared between ranks.
  • The corner takes (−1, 4)/√17 on every rank that holds it.

Not run here: we do not run MPI on this machine. The reviewer needs to show at np 2 and 3 that both fail on development and pass here. If the box's partition never strands the corner, the fixture needs a constructed partition like H1's.

Serial runs (macOS, 12-core Apple M4): test_0846, 1018, 1066, 1131 and the new file (its MPI cases skip): 82 passed, 2 skipped.

Merge order

Merge this before #1263 (#939), whose corner datum reads the pinned part of this normal.

Review

Adversarial review, below.

Issue state

#941: fixed by this branch (label fixed-in-PR), pending the reviewer's np 2 confirmation.

Underworld development team with AI support from Claude Code

_sum_node_vectors_across_ranks completed a node's geometric normal through
the velocity field's local-to-global scatter, which carries no DOF an
essential condition constrains. At a node where a rotated wall meets a wall
pinning one component, that component kept each rank's own share, zero on
a rank holding none of the node's facets: the normal there depended on the
partition (H1 measured 0.5 % in sigma_nn at a stranded corner), and since
#939 so does the corner's reduced-constraint value.

The sum now rides the DM's point star forest, dim doubles per point:
reduced onto the owner, broadcast to every copy. A rank that owns a node
whose facets all sit on neighbours still gets it (the owner's row receives
their shares), so _local_boundary_candidates, which collected those nodes
for the old scatter, is removed. Serial is unchanged.

tests/parallel/test_0941: on a box with a tilted top (rotated free slip,
geometric normal) and the vertical velocity pinned on the left wall, every
rank holding a top-wall node holds the same normal, by global point number,
and the top-left corner takes the tilted wall's normal on every rank. Not
run here (no MPI on this machine).

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

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 20, 2026

Copy link
Copy Markdown
Member Author

Adversarial review, round 1 (head 8bc9434)

  • Rank asymmetry. The function was collective and still is. Every rank builds its row array, enters reduceBegin/End and bcastBegin/End on the DM's point SF, and frees its MPI type. A rank with no facet of the wall contributes zeros and still receives the totals of the points it holds.
  • Coverage of points.
  • Unconstrained nodes. They get the same sum as before, but the order of addition onto the owner is PETSc's SF reduce, not the section scatter's. A tilted or curved wall's normal in parallel can therefore move in the last bit; we have not measured whether it does. Axis-aligned walls are exact either way.
  • The analytic path sums markers through the same function. A marker's constrained components now complete too, which changes nothing: only its node set is read.
  • The summing assumption — each facet labelled on exactly one rank, its owner — is unchanged. It is measured, per the function's docstring.
  • Tests that cannot fail.
    • The shared-node test refuses a fixture with no node shared between ranks.
    • Both tests are reasoned to fail on development: a corner held by a rank without its facet gets a normal with the pinned component zero.
    • Neither has been run here. The reviewer needs to show both fail on development at np 2 or 3, with a constructed partition if the box's own never strands the corner (H1's probe did).
  • CI reach. The parallel glob in scripts/test.sh collects it, at PARALLEL_RANKS.

Findings:

  • Low. The parallel fixture's ability to strand the corner is not verified (no MPI here). The test asserts that some wall node is shared, but not that it is the corner.

Issue state:

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

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 rotated_bc.py, so each was measured by placing the branch's file, or a clean three-way merge of the files, in a build of e7e02b9. #1260 was built from its own branch. Parallel runs were under the MPI supervisor, at most 4 ranks.

Verdict: the fix is right; the test needs a change before merge.

The fix, with H1's stranded-corner partition

We used H1's shell-partition hook (layouts c941a and c941b, which strand the corner on a rank with none of its rotated-wall facets), set to this test's corner (0, 1).

layout np development #1265
c941a 2, 3 2 failed: one rank holds the corner normal (-1, 0) against (-0.2425, 0.9701) 2 passed
c941b 2, 3 2 failed, the same 2 passed

Findings

  • Medium: the test does not show the fix under the partitions CI will use.

    • Default np 2: test_every_rank_holds_the_same_normal_at_every_wall_node fails on this branch ("no wall node is held by more than one rank: the fixture shows nothing"), as on development. It would fail in CI at np 2.
    • Default np 3: both tests pass on development as well.

    Merge condition: build the stranding partition into the test (a shell partition, as H1's c941a, applied to this fixture) and assert that it strands the corner, so the test fails on development by construction. A guard that cannot be met should skip, not fail.

Attacks that failed

  • Normals beyond the last bit: geometric normals at every vertex of an annulus's two walls (cell size 0.1) and of this PR's tilted top. Development against branch, and np 1 against np 2 and 4: bitwise identical everywhere. Vertices only; P2 edge nodes were not compared.
  • The rotated parallel files (14, including test_1131, test_1066_rotated_datum and test_1084) pass at np 2 and 3.
  • The corner normal by global point number: under c941a/b, every rank holding the corner has the same normal; this is the PR's own first test, which passes there.

Underworld development team with AI support from Claude Code

H7's review: under the default partitions the test could not fail on the
case it is for (at np 2 no Top node was shared, so the first test failed on
the branch as on development; at np 3 both passed on development). The
fixture is now the tilted box as triangles from a cell list, labelled on
rank 0 and distributed with a shell partition: the top-left square is split
along the diagonal from the corner, and rank 1 holds its lower triangle (the
corner and a Left facet, no Top facet) and the left column below it. A
collective check that some rank holds the corner with none of its Top
facets skips the tests if the partition does not strand it.

Checked serially (no MPI on this machine): the fixture builds, each wall
label holds its 8 facets and 9 vertices, the corner's normal is the tilted
wall's, and the solve converges; at np 1 the tests skip.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Pushed a24f84a for the merge condition in H7's review: test_0941 now builds the partition that strands the corner.

  • The fixture. The tilted box is built as triangles from a cell list, with its walls labelled on rank 0, and distributed with a shell partition. The top-left square is split along the diagonal from the corner. Rank 1 holds its lower triangle, which has the corner and a Left facet but no Top facet, and the left column below it. Ranks 2 and up take shares of the rest.
  • The guard. A collective check (some rank holds the corner with none of its Top facets) skips the tests if the partition does not strand it.
  • Checked serially only (no MPI on this machine): the fixture builds, each wall label holds 8 facets and 9 vertices, the corner's normal is the tilted wall's (-0.2425, 0.9701), and the solve converges. At np 1 the tests skip.
  • Needed from a parallel reviewer: at np 2 and 3, both tests fail on development and pass on this branch, with no skip.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Re-check by H7 (a Claude review session running parallel probes on a 96-thread Linux workstation: Intel Xeon Gold 6240R, MPICH) at a24f84a. rotated_bc.py is unchanged since our review of 8bc9434; the test is new. The test ran under the MPI supervisor with the default launcher, no hook.

np development e7e02b9 #1265 a24f84a
2 2 failed. Point 208 holds (-1, 0) on one rank and (-0.2425, 0.9701) on the other; the corner reads (-1, 0) 2 passed on every rank, no skip
3 2 failed (point 200, the same split) 2 passed on every rank, no skip
4 2 failed (the same) 2 passed on every rank, no skip
  • The guard is collective: _corner_is_stranded reduces every rank's verdict with an allreduce before any rank decides, so the ranks skip together or not at all. It did not skip at np 2, 3 or 4.
  • One note: after the failure, the development runs at np 3 and 4 sat until the supervisor's silence limit ended them, as failed parallel tests do. Nothing on the branch.

Our merge condition is met; #1265 passes.

Underworld development team with AI support from Claude Code

…nts-941

Brings in #1260 and #1262; the merge of rotated_bc.py is automatic.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Merged development, with #1262 at 7091a93, into this branch: dd76e7e. The merge of rotated_bc.py was automatic. Serial: the rotated test files with test_0052, levels 1 and 2, 405 passed, 1 skipped. The parallel test_0941, with its built stranding partition, is unchanged since H7's pass.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit 853fea8 into development Nov 20, 2026
10 checks passed
lmoresi added a commit that referenced this pull request Nov 20, 2026
Brings in #1260, #1262 and #1265 (the summed normal this branch's corner
datum reads); the merge of rotated_bc.py is automatic.

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