Skip to content

#946: refining a spherical mesh no longer folds cells; a missing label moves nothing (#903) - #952

Merged
lmoresi merged 9 commits into
developmentfrom
bugfix/shell-refinement-folds-946
Nov 7, 2026
Merged

lmoresi merged 9 commits into
developmentfrom
bugfix/shell-refinement-folds-946

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Refining a spherical mesh no longer folds cells (#946). A missing label no longer moves vertex 0 (#903).

The bug

gmsh meshes a sphere in its (longitude, latitude) parameter plane. Near a pole it can join four neighbouring wall nodes along the long diagonal of their quadrilateral instead of the short one, and the faceted wall then creases toward the centre.

On the inner wall of a shell (and either side of an internal surface), the pocket under such a crease lies inside the domain. The volume mesher fills it with one cell whose four vertices are all on the sphere. Regular refinement only subdivides that cell. The refinement callback then snaps the midpoint of the creased edge outward onto the sphere, past the midpoint of the cell's other diagonal, which carries no wall label and stays put, and the children between them turn inside out.

  • At cellSize 0.5, a shell folded 3 cells on macOS and 5 on Linux.
  • On the Linux mesh, every velocity multigrid solve of a rotated free-slip Stokes problem ran to its iteration cap; test_1111[shell] ran for hours on kaiju.
  • A macOS mesh with the same fold, from another gmsh seed, did the same with an LU or an SVD coarse solve and with either wall normal.
  • With the callback off, neither mesh folds.

The change

  • gmsh end: walls flipped to locally convex triangulations. meshing/_sphere_surface.py adds _generate_volume_on_convex_spheres(centre), which every generator with spherical walls calls in place of generate(3). It meshes the surfaces, then Lawson-flips every creased edge of each spherical surface until none is left, then meshes the volume.
    • The generators: SphericalShell, SphericalShellInternalBoundary, SegmentofSphere (about its centroid), CubedSphere, SegmentedSphericalShell, SegmentedSphericalBall and RegionalSphericalBox.
    • On a closed sphere the result is the convex hull of the wall nodes. On a wall made of patches each patch is locally convex, but an edge on a curve between patches stays.
    • The flips are pure Python on rank 0, about 1 s per 12,000 surface triangles.
  • Refinement end: the guard. Mesh._build_refined_hierarchy applies every refinement callback through _apply_refinement_callback.
    • Of each triangle or tetrahedron the callback turned inside out, the vertex it moved furthest goes back where refinement placed it, until none is inverted. One warning gives the total.
    • In parallel, every copy of a vertex first takes the move made on any rank that moved it. A callback moves only the vertices of the labelled facets a rank holds, so copies of a shared vertex can disagree. Before this, a refined wall vertex could end off its wall depending on the rank count, and cells could invert at np 8. Vertex flags are then shared over the coordinate DM, so every rank's copy agrees.
    • A callback that writes a non-finite coordinate raises.
    • It covers meshes that do not come from gmsh, at about 1 s on a 0.4-0.9 million cell build.
  • The segmented shell and ball labelled interior vertices as wall. Their volume group was tagged 30, Upper's value, so the Upper label took interior vertices (down to r 0.297 in the ball) and the callback dragged them onto the sphere. The volume is now 99999, as in the other generators.
  • petsc_dm_find_labeled_points_local returns [0] for a missing label; refinement callbacks then move vertex 0 #903: both copies of petsc_dm_find_labeled_points_local (Cython and Python) return no points for a missing label, where they returned [0]. A refined ball (radiusInner=0) had moved vertex 0 to the origin and then divided by its zero radius, which gave a NaN coordinate.
  • test_1111's shell is back at cellSize 0.5 (it had moved to 0.3 to avoid the fold).
    • Its answer is re-recorded on the flipped mesh: v_rms 1.7753740524 at 5 / 17 iterations.
    • A dense SVD coarse solve set by hand gives the same value and iterations, in 91 s against 10 s.
    • Its fold gate is removed: with the guard it could not fail.
  • Docs: custom-meshes.md (the guard and its warning), the gmsh integration guide (the guard, and the helper for new generators), and the CHANGELOG.

Tests

  • tests/test_0001_sphere_refinement_folds.py, 11 cases. Every one asserts an exactness property that holds on any host:

    • no creased wall edge and no all-wall coarse cell, on the shell and the internal-boundary shell;
    • no inverted cell after refinement, with the walls on their spheres;
    • a deliberately folding callback held back, with a warning, and a harmless callback applied exactly;
    • a refined ball with finite coordinates and no warning;
    • the segmented shell's and ball's wall labels holding only wall vertices, and refining with no warning.

    On development eddab70, 10 of them fail (on Linux, hyperion); all 11 pass here.

  • tests/parallel/test_0001_sphere_refinement_folds_parallel.py, tier B, 4 cases. Every vertex copy is checked against its owner's on every level of the hierarchy, not only on the cloned DM. The fourth case has one rank alone move vertices, and every copy across the partition must take the move. The first three passed at np 2 and np 4 on Linux; [round-2 rerun at np 2, 4 and 8 on hyperion].

    • On development (np 2, hyperion) the folding callback leaves 2 inverted cells and the shell 5, both with no warning, and those tests fail.
    • That run also found a hole, fixed in 2056044: the creased-shell case skipped on any missing warning, so an unguarded build could never fail it.
    • A creased shell refines with no inverted cell on any rank, and every vertex copy matches its owner's.
    • A folding callback is held back on every rank that holds the vertex.
    • The shell as built refines with no warning.
  • The files that build spherical meshes were run on hyperion (Linux, CI's conda-forge environment) on this branch and on development eddab70:

    • 21 serial files. Every one gives the same result on both builds, apart from test_0001_sphere_refinement_folds.
      • test_1064_constrained_spherical_shell_response gives 1 failed, 3 passed, 1 xfailed on both builds. The failure is the same [XPASS(strict)], on test_lu_subsolve_fieldsplit_constrained_matches_default_nitsche_response: a strict xfail that now passes on development too, so it predates this branch. The file takes over 90 minutes on hyperion.
    • Six parallel files at np 2 and np 4. They give the same counts on both builds, and the new parallel test passes 3 of 3.
  • test_1064's spherical accuracy anchors skip on both builds on Linux. Neither mesh matches the recorded fingerprint (1417 cells; development 1395, here 1386), so the flips do not change what that test asserts on this host, and nothing is re-recorded.

Issues

Issue Verdict
#946 Fixed: no inverted cell, in serial and, after round 2, in parallel. What remains is carried by #949: meshes built of wall patches have creases on the curves between patches, which the per-surface flips cannot reach. The guard keeps their cells valid but holds vertices back off the wall, with a warning: up to 61 vertices at refinement 2 (CubedSphere, a 3-segment SegmentedSphericalShell, RegionalSphericalBox). The segmented test covers refinement 1 with 6 segments only.
#903 Fixed, in both copies of the lookup.
#953 Filed here. SegmentedSphericalShell and SegmentedSphericalBall hang at np 2, on development too: gmsh2dmplex runs inside a rank-0 block that reaches a barrier. So their label fix is reached only in serial.
#949 Filed here. Five defects found and left open, each marked TODO(BUG): the CubedSphere residual, SphericalShellInternalBoundary's radius tolerance and its unsnapped Internal surface, SegmentofSphere's callback snapping about the origin, and meshVariable_mask_from_label's NameError.
#923, #931, #906, #734, #809, #690 Still live; this branch does not address them.

CI note. The new parallel file shifts the MPI phase's six-file batches by one. #951 met a hang when test_1062 came to share a process with test_1064, and the dev hub is tracking it (a suspected cross-test state leak, perhaps #950). This branch may meet the same shift.

Reviews:

#903 and #946 carry the fixed-in-PR label. A merge to development does not close issues, so they move to fixed-in-development on merge, per the repo's issue-state rule. Its finding on test_1064's spherical anchors needed no change: they skip on Linux on development already.

Underworld development team with AI support from Claude Code

…el moves nothing (#903)

Parked work in progress: the serial tests pass, and the parallel test, the PR and the
review are still to come (see the end).

gmsh meshes a sphere in a parameter plane. Near a pole it can join four neighbouring
wall nodes along the long diagonal, and a structured surface splits every
quadrilateral the same way, so the wall creases toward the centre. On an inner or
internal wall, the pocket under the crease is meshed as one cell with all four
vertices on the sphere. The refinement callback then snaps the crease midpoint
outward past the unlabelled midpoint of the other diagonal and folds the children.

- meshing/_sphere_surface.py: `_flip_creased_sphere_edges` runs Lawson flips to the
  convex hull on every gmsh surface whose nodes lie on a sphere about the centre,
  between generate(2) and generate(3). It is called by SphericalShell,
  SphericalShellInternalBoundary, SegmentofSphere, CubedSphere, the segmented
  shell and ball, and both regional boxes.
- Mesh._build_refined_hierarchy applies every refinement callback through
  `_apply_refinement_callback`. Of each cell the callback inverted, the vertex it
  moved furthest goes back where refinement placed it, until none is inverted, with
  a warning. Vertex flags are shared over the coordinate DM, so every copy agrees.
- petsc_dm_find_labeled_points_local returns an empty array for a missing label
  instead of [0] (#903). A refined ball had a NaN vertex.

Tests: tests/test_0001_sphere_refinement_folds.py has 7 cases. 6 fail on
development 1f87430 (creases, folded cells, no warning, NaN) and all pass here.
tests/parallel/test_0001_..._parallel.py has not run yet (np 2 and 4 go to kaiju).

Left to do:
- Merge origin/development (#947), and re-record test_1111's shell, whose mesh
  changes with the flips.
- Run the 24 test files that build spherical meshes, on kaiju.
- Measure the guard's cost on large meshes.
- The segmented shell and ball still warn, because their Upper (and Lower) labels
  hold vertices off the wall: Upper reaches r 0.297 on the ball and r 0.72 on the
  shell. That is a labelling bug the guard now exposes.
- CubedSphere(numElements=3) holds one vertex back: a crease on a patch-boundary
  curve, which a per-surface flip cannot reach.
- TODO(BUG) markers: the internal-boundary shell's radius tolerance, and its
  unsnapped Internal surface.

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
…11's shell goes back to 0.5 (#946)

The segmented shell and ball tagged their volume with 30, which is Upper's value,
so the DM's Upper label took interior vertices (down to r 0.297 in the ball), and
the refinement callback snapped them onto the outer sphere: 43 vertices of a
refined ball and 2 of a shell had to be held back. The volume is now 99999, as in
the other generators. New tests in test_0001 cover both meshes and fail without
the change: every vertex a wall label carries lies on that wall, and refining
leaves no cell inverted and no warning.

With the walls triangulated as convex hulls, test_1111's shell needs no detour:
- it is back at cell size 0.5, where the old mesh had folded;
- its answer is recorded on the new mesh, 1.7753740524 at 5 / 17 iterations;
- a dense SVD coarse solve set by hand gives the same value and iterations, in
  91 s against 10 s.
Its fold gate is removed. The hierarchy no longer lets a cell fold, so the gate
could not fail; test_0001 asserts that directly.

CubedSphere(simplex=True, numElements=3) still holds one vertex back: a crease
on a curve between two wall patches, which the surface-by-surface flips do not
reach. It is marked with a TODO(BUG).

Underworld development team with AI support from Claude Code
…entry

- custom-meshes.md: what the refinement-callback guard does and what its warning
  means.
- GMSH_INTEGRATION_GUIDE.md: the guard, and that a gmsh generator meshing a sphere
  calls `_flip_creased_sphere_edges` between generate(2) and generate(3).
- CHANGELOG: #946 and #903.

Underworld development team with AI support from Claude Code
…ing, both #903 lookups, collective-safe parallel test

Findings of the adversarial review of 20e352c:
- #903's second lookup, uw.discretisation.petsc_dm_find_labeled_points_local, also
  returned [0] for a missing label; it now returns an empty array too.
- The ball test could not fail on #903: the guard held the moved vertex back and
  the coordinates stayed finite. It now fails on the guard's warning.
- The eight generate-flip-generate blocks are one helper,
  _generate_volume_on_convex_spheres(centre). SegmentofSphere passes its centroid,
  which the old call ignored. RegionalGeographicBox goes back to plain
  generate(3): its walls are not spheres, so the flip never acted there.
- The guard returns its count, and the hierarchy warns once, with the second
  pass's sum. The first pass's vertices are held again by the second, so the sum
  is the total; before, one warning came from each pass.
- The parallel test reduces every flag before it asserts, so a failure fails on
  every rank instead of hanging the others. Its inversion check copes with a rank
  that has no cells. A host whose gmsh builds the creased shell with no pocket
  skips that case. It is tier C until it has run at np > 1.
- The docs and the CHANGELOG no longer claim more than was measured: which cells
  are checked, patches convex rather than the hull, the flip's cost, both lookups,
  and the CubedSphere crease that remains.
- TODO(BUG) markers for two pre-existing defects found on the way:
  SegmentofSphere's callback snaps about the origin, not the centroid; and
  meshVariable_mask_from_label raises NameError (MeshVariable is not imported).

Underworld development team with AI support from Claude Code
Hyperion ran the parallel file against development eddab70, which has no guard,
at np 2 (with a stub for the missing helper module):
- the folding callback left 2 inverted cells and no warning; the test failed;
- the shell as built left 5 inverted cells and no warning; the test failed;
- the creased-shell test skipped, because it skipped on any missing warning, and
  an unguarded build never warns.
That skip is now taken only when there is no warning and nothing is inverted (a
host whose gmsh built no pocket). Inverted cells without a warning fail. On this
branch all three pass at np 2 and 4 on Linux, so the file is tier B.

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

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

Copy link
Copy Markdown
Member Author

Adversarial review, round 1 (20e352c against development eddab70)

A separate agent reviewed the branch against docs/developer/guides/adversarial-review.md. Its checks were serial, on macOS. The fixes are in b173941.

Findings and what was done

  1. The ball test could not fail on petsc_dm_find_labeled_points_local returns [0] for a missing label; refinement callbacks then move vertex 0 #903. Restoring the old [0] return left all 11 tests passing: the refinement guard held the moved vertex back, so the coordinates stayed finite.
    • Fixed: the ball is built with UserWarning raised as an error, so the guard's warning fails the test.
  2. petsc_dm_find_labeled_points_local returns [0] for a missing label; refinement callbacks then move vertex 0 #903 was half fixed. A second copy of the lookup, uw.discretisation.petsc_dm_find_labeled_points_local in discretisation_mesh.py, still returned [0].
  3. The parallel test turned a failure into a hang. Its asserts ran on rank 0 before collectives the other ranks were waiting in.
    • Fixed: every flag is reduced across ranks before any assert.
    • Whether the "creased shell" fixture folds depends on the host's gmsh. A host that builds no pocket now skips that case instead of failing it.
  4. The parallel inversion check raised on a rank with no cells.
    • Fixed: such a rank contributes zero.
  5. test_1064's spherical accuracy anchors may go dead. The flips change both shells those anchors are gated on (macOS: 1424 → 1415 cells, and 2005 → 2004).
    • No change needed. On hyperion (Linux, CI's environment) the anchors skip on development and on this branch alike, because neither mesh matches the recorded one (1417 cells against 1395 and 1386). The flips do not change what test_1064 asserts there.
  6. The parallel file was tier B but had never run at np > 1.
    • Fixed: it was tier C until it ran. It passes 3 of 3 at np 2 and 4 on hyperion.
    • Run against development (no guard), two of its tests failed: 2 and 5 inverted cells, no warning. The third skipped, because its skip keyed on a missing warning alone, so an unguarded build could never fail it.
    • Fixed in 2056044: it now skips only when nothing is inverted. The file is tier B.
  7. The guard warned once per callback pass, so its count was not a total.
    • Fixed: the guard returns its count, and the hierarchy warns once with the sum over the second pass. That pass re-holds every vertex the first held.
  8. SegmentofSphere's flip ignored centroid.
  9. The flip call in RegionalGeographicBox did nothing. Its walls are Coons patches on an ellipsoid, not spheres.
    • Fixed: that generator goes back to a plain generate(3).
  10. The same block was pasted at 8 sites.
    • Fixed: one helper, _generate_volume_on_convex_spheres(centre).
  11. The docs claimed more than was measured.
    • "every cell" was wrong: only triangles and tetrahedra are checked.
    • "the convex hull" holds only on a closed sphere: on a wall made of patches each patch is locally convex.
    • "never triggers on a sound mesh" was contradicted by the CubedSphere case.
    • Fixed in custom-meshes.md, the gmsh guide, the CHANGELOG and the docstrings.
  12. Three TODO(BUG) markers had no issue.
  13. The flip pass's cost was not stated. It is pure Python on rank 0: 0.9 s for a 12k-triangle sphere, 3.5 s for 48k.
    • Fixed: stated in the CHANGELOG and the gmsh guide.

Attacks that failed

  • Flip validity on every generator configuration. Triangle orientation stays uniform on every flipped surface, and no curve element is lost. Every surface triangle is a face of a tetrahedron after generate(3).
  • Flip validity on 400 random spherical caps. No inverted triangle with radial noise up to 1e-6. The 1e-9 sphericity gate separates spherical surfaces (spread ≤ 7e-16) from non-spherical ones (≥ 1.6e-3).
  • Termination. Each flip strictly increases the enclosed volume, and we measured at most 2 sweeps.
  • The guard in parallel, by reading.
    • Its loop count is global, so every rank runs the same collectives.
    • An empty rank and a mixed-cell rank stay in them.
    • Held copies are restored to the same value on every rank.
  • Mutations.
    • Flips off: 3 tests fail.
    • Guard off: the fold test fails.
    • The segmented volume tag back at 30: the 4 segmented tests fail.
  • Regression. 164 tests in 18 serial files that build spherical meshes pass. None of them raised the guard's warning.

Issue verdicts

Underworld development team with AI support from Claude Code

…rallel test reads every level

Hyperion's review of 2056044 found that the guard can leave inverted cells in
parallel:
- CubedSphere(numElements=2, simplex=True, refinement=2) has 5 inverted cells at
  np 8.
- The callback moves a wall vertex only on ranks that hold a labelled facet of that
  wall, so copies of a vertex differ (by up to 0.0994).
- Each rank checked its own copy, and the owner's value won at the clone.

The fixes:
- Every copy now takes the move made on any rank that moved the vertex, before any
  cell is checked. The moved copies are averaged; they agree, as the callback is a
  function of position.
  - The reconciled coordinates are written back whether or not anything is held.
  - This also fixes, at any rank count, wall vertices that ended off their wall
    depending on the partition, which predates the branch.
- The parallel test read the clone (mesh.dm), so a rank-local mutant passed. It now
  checks every level of the hierarchy as well.
  - A new case has rank 0 alone nudge every vertex: the copies across the partition
    must take the move.
- The hold-back loop excludes held vertices, so it ends even on non-finite
  coordinates.
- A callback that writes a non-finite coordinate raises, where it was reported as a
  fold.
- The warning says its total runs over the hierarchy's levels.
- The residual is stated with measured counts. Meshes made of patches hold back up
  to 61 vertices at refinement 2. It is carried in the CHANGELOG and the CubedSphere
  TODO (#949).

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Round 2: fixes for the independent review's findings (0306f83)

Hyperion's independent review of 2056044 will post its own record. What this round changed in answer to it:

  • Inverted cells in parallel (CubedSphere, numElements 2, refinement 2: 5 at np 8).
    • A refinement callback moves a wall vertex only on ranks that hold a labelled facet of that wall. The copies of a shared vertex then disagreed, and each rank checked its own copy.
    • _apply_refinement_callback now gives every copy the move made on any rank that moved it, before any cell is checked. The moved copies are averaged; they agree, since the callback is a function of position. The reconciled coordinates are always written back.
    • This also removes a pre-existing defect: refined wall vertices ending off their wall depending on the rank count.
  • The parallel test could not see copy disagreement, because it read the cloned DM.
    • Copies are now checked on every level of the hierarchy.
    • A new case has one rank alone move vertices, and every copy across the partition must take the move.
  • The hold-back loop excludes held vertices, so it ends on non-finite coordinates.
  • A callback writing a non-finite coordinate now raises, where it was reported as a fold.
  • The warning states that its total runs over the hierarchy's levels.
  • The residual was understated. It is restated with measured counts in the CHANGELOG, the CubedSphere TODO, the body and Spherical mesh generators: five defects found while fixing #946, left open #949: up to 61 held vertices at refinement 2 on patch-built meshes.
  • The segmented generators hang at np 2, on development too. That is filed as SegmentedSphericalShell and SegmentedSphericalBall hang at np 2: gmsh2dmplex runs inside a rank-0 block that reaches a barrier #953.

The rerun at np 2, 4 and 8, with mutants of the sharing and the reconciliation, is with hyperion.

Underworld development team with AI support from Claude Code

Copies agreeing does not show that every rank that holds a vertex held it.
With the hold flagged on one rank only, hyperion found the copies still
agreed at np 8, but 31 vertices were held instead of 24 and the mesh
differed from the serial one. The new case kicks about a fifth of a box's
interior vertices far enough to turn a cell over (267 held, serially) and
compares the owned vertices with a serial child's, vertex for vertex. At
np 2 about nine kicked vertices lie on the partition interface.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Adversarial review of #952 at 2056044 against eddab70

Independent pass on hyperion (Linux, PETSc 3.25.3), np 1-8, from the diff; findings formed before reading the PR body and round 1, and none is addressed there. Probes are on hyperion in runs/2026-11-06/rev952/.

Status at 4f634b0: findings 1 to 3 and 6 to 8 addressed, with the reruns below. This record is of the pass at 2056044, kept as found.

Verdict at 2056044: not ready. The serial fix holds. The guard's parallel contract does not, and the parallel test cannot detect that. Finding 1 was reproduced separately from a fresh script: CubedSphere(radiusOuter=1, radiusInner=0.547, numElements=2, simplex=True, refinement=2, qdegree=2) gives 0 inverted at np 1 and 5 at np 8.

Findings

  1. High. The guard leaves inverted cells in parallel. That mesh at np 8: 5 inverted, 27 held; np 1-7: 0 and 24. Cause: the callback moves a wall vertex only on ranks holding a labelled wall face, so copies differ after it (2 and 4 copies, up to 0.0994). The guard (discretisation_mesh.py:388) checks each rank's local copy, a rank with the unmoved copy sees no inversion, and the owner's value wins at the clone. Syncing to the owner before the check gives 0 inverted, 24 held at np 8.
  2. High. The parallel test cannot fail on vertex sharing. With _flag_on_every_sharer made rank-local it passes 3 of 3 at np 2 and 4. _copies_disagree(mesh.dm) (test_0001_..._parallel.py:79,103,118) reads the post-clone DM: an injected rank-dependent offset shows 32 disagreeing values on dm_hierarchy[-1] and 0 on mesh.dm. "Every vertex copy matches its owner's" is untested.
  3. Medium, predates the branch. Wall vertices end off the wall depending on rank count, mostly with no warning: petsc_dm_find_labeled_points_local takes only the closure of the rank's own labelled faces. Tip: CubedSphere n=2 r=2 np 4 Upper off 0.112; n=3 r=1 np 5 Upper off 0.038; n=4 r=2 np 8 Lower 1.0e-2, Upper 4.1e-2 with held=0. Base: n=3 r=1 np 6 Lower 1.6e-2, Upper 3.9e-2; n=6 r=1 np 2 Upper 7.7e-3. A roughly 10-line reconcile where the moved copy wins gives the np 1 vertex digest at np 1, 4, 5, 8 on three meshes and removes finding 1.
  4. Medium, predates the branch, unfiled. SegmentedSphericalShell and SegmentedSphericalBall hang at np 2, tip and base: segmented.py:553,978 call gmsh2dmplex in a rank-0 block, reaching uw.mpi.barrier() at discretisation_mesh.py:169, while the others wait in _free_petsc_garbage. The branch's segmented fix cannot be reached in parallel. annulus.py:1022 and segmented.py:194 have the same pattern; not run.
  5. Medium. The residual is understated. CHANGELOG:33, spherical.py:1293, Spherical mesh generators: five defects found while fixing #946, left open #949 and the PR verdict say "one vertex at numElements=3". Held / largest Lower offset: CubedSphere n=3 r=1 and r=2, 3 and 47, 4.3e-2; n=2 r=2, 24, 1.6e-2; SegmentedSphericalShell 0.4, 6 segments, r=2, 5, 9.2e-3; 0.5, 3 segments, r=1 and r=2, 2 and 61, 4.5e-2; RegionalSphericalBox +-70 deg 3x3x2, r=1 and r=2, 4 and 32, 0.225. The warning fires on ordinary refinement=2 builds.
  6. Low. while True at discretisation_mesh.py:404 never exits if pre-callback coordinates hold a NaN. Fix: culprits &= ~held.
  7. Low. A callback that writes NaN is reported as a fold, where base leaves the NaN visible.
  8. Low. The warning's total sums over levels: 92 "of the vertices" on a mesh with 81 fine vertices.
  9. Low. The parallel test does not fail on eddab70 for its stated reason: ImportError: _sphere_surface at collection. With the import stubbed, all 3 fail with 5, 2 and 5 inverted cells.
  10. Low. test_1111[shell] skips on hyperion (4560 cells, recorded 4904), so its re-recorded asserts do not run here. Not a weakening: base misses its fingerprint here too, and convergence, null modes and the shift still assert before the skip.

Attacks that failed

  • Parallel: empty ranks down to cells [0,0,0,8,0,0,0,0], no hang; PR parallel test 3 of 3 at np 2, 3, 4, 8; rank-0 warning under -W error aborts rather than hangs.
  • Flips: 20 gmsh shells, hull symmetric difference 0, Euler characteristic 2, at most 6 sweeps; 3000 random triangulations, all 1579 valid starts terminate; cocircular lattices do not cycle; off-origin centre behaves the same.
  • Hold-back, serial: folds to 0 on every simplex mesh swept (shell 0.5 r=2 55 to 0, segmented ball 0.2 r=2 12424 to 0, CubedSphere n=4 r=2 472 to 0); long legitimate move, held 0; degree-2 coordinates fold 0; rotated FMG on held meshes converges.
  • Determinism: PYTHONHASHSEED 0, 1, 2, 77 give identical .msh; meshes regenerate on every build, so no stale cache.
  • Missing label: no caller relied on an error. Volume tag 99999: no collision found; round trip clean.
  • Tests and CI: 10 of 11 serial fail on eddab70 at the expected asserts, the 11th is a negative control killed by a mutant; both new files are in the batches.

Could not test

macOS, CI's runners, kaiju, np above 8; reading a pre-change checkpoint; solves on a mesh with the np 8 inversions; #949 items 2, 3, 5.

Issue adjudications

Merge conditions

  • Reconcile the callback's result across vertex copies before the orientation check, moved copy winning. If only the owner sync goes in, file finding 3.
  • A regression test that fails on this: CI's default is np 2 and the known fixtures need np 4-8, so an np 2 fixture or an explicit np 4 and 8 run.
  • Make the copy check read mesh.dm_hierarchy[-1], and show the rank-local mutant fails it.
  • Fix or file the segmented hang, and say which in the PR body.
  • Correct the residual with the measured counts; extend the segmented test or say it does not cover this.
  • Make the guard loop exit when no new vertex is flagged.
  • Add Closes #903. Hold Closes #946 until the first condition lands.

Underworld development team with AI support from Claude Code

Rerun at 0306f83

Fresh probe (rev952/v952b.py). Fixture: inverted 0, held 24 at np 1, 4, 5, 8. Vertex digests identical at np 1, 4, 5, 8 on CubedSphere n=2 r=2, n=3 r=1, n=4 r=2. Parallel test 4 passed at np 2, 4, 8. Serial test_0001 plus test_1111: 13 passed, 1 skipped.

Mutants: reconciliation removed fails the new case at np 2 (False, 0, 10) and np 4 (False, 0, 7). _flag_on_every_sharer made rank-local still passes 4 of 4 at np 2, 3, 4, 5, 6, 8, although the fixture at np 8 then gives held 31 and a different digest. Open: no case compares a held mesh across rank counts.

Rerun at 4f634b0

test_a_held_vertex_is_held_on_every_rank_that_holds_it added. Unmutated: 5 passed at np 2, 4, 8. Rank-local flags now fail the new case at each np: (warned, inverted, disagree, differ) = (True, 2, 6, 104), (True, 7, 14, 214), (True, 18, 48, 418). Reconciliation removed fails the copies case at each np, and the creased-shell case too at np 8. Kicked vertices on the interface here: 4, 11, 30 at np 2, 4, 8. Finding 2 closed for these two mutants.

Underworld development team with AI support from Claude Code

lmoresi added a commit that referenced this pull request Nov 6, 2026
Recorded on hyperion at np 2 with the conda-forge stack CI uses, from the
skip messages of 27df1f3: test_1063's iso, ti and raw-gauge annulus (430
cells), test_1064's annulus (612), shell (1395) and internal-boundary shell
(1991), and test_1066's datum (612). Each sits beside its macOS anchor; the
one whose fingerprint matches is used. The two shells are as development
builds them; #952's wall flips change those meshes, and a skip will then
print the values to add.

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
@lmoresi
lmoresi merged commit 15f13d0 into development Nov 7, 2026
8 checks passed
lmoresi added a commit that referenced this pull request Nov 7, 2026
…from-mesh-906

Underworld development team with AI support from Claude Code

# Conflicts:
#	docs/developer/CHANGELOG.md
#	src/underworld3/discretisation/discretisation_mesh.py
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