Skip to content

Probe-pass batch: SurfaceCollection in 2-D (#540), complete chains for close lines (#494), cuts spare internal boundaries (#595), #429's test - #1126

Merged
lmoresi merged 4 commits into
developmentfrom
bugfix/h5-probe-batch-540-429
Nov 13, 2026
Merged

lmoresi merged 4 commits into
developmentfrom
bugfix/h5-probe-batch-540-429

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

The probe-pass batch for one desk: four small fixes, each with a test shown failing on development (01dec8d), in one PR. Review: H1 (review and parallel test runs on a 96-thread Linux workstation).

Fixes #540, #494 and #595, and the test half of #429.

#540: SurfaceCollection works in 2-D

In 2-D a Surface is a polyline, and the collection's nearest-surface director failed in three places.

  • Face normals and centres. Surface.face_normals raised KeyError, because pyvista has no cell normals for lines. face_normals and face_centers are now defined per polyline segment: the normal is the tangent turned a quarter turn, with z = 0.
  • Transferred normals. transfer_normals made a 3-component variable, which a 2-D mesh refuses; it now has mesh.cdim components. It also takes each point's nearest surface by exact distance, then that surface's nearest face. Taking the nearest face centre over all surfaces at once gave a point near one trace's end the other trace's normal.
  • Distance field. compute_distance_field handed 2-D points to pyvista; it now uses each surface's own exact distance (the polyline routine in 2-D, pyvista's implicit distance in 3-D as before).

Test: tests/test_0540_surface_collection_2d.py has two traces whose normals differ, and an analytic oracle for the normals and the distance. On development all 3 tests fail; on this branch they pass.

#494: two lines cut within an edge of each other keep complete chains

cut_along_lines skipped every edge with an endpoint on any line. So where two lines ran within an edge of each other, line B's crossing of an edge touching line A was never split, and B's chain had gaps, silently. "Already on a line" is now per line, and a vertex on both lines (a junction) counts for both.

Test: tests/test_0494_two_lines_complete_chains.py. Two lines 0.7 h and 0.9 h apart, in one call and in two sequential calls, must each give a complete chain. On development the one-call cases fail (3 gaps per chain at 0.7 h, 1 at 0.9 h); the sequential cases pass there and stay as guards.

#595: a cut does not snap a vertex of a labelled internal boundary

Cutting along the centre of a placed thin band, the cut could snap a vertex of the band's skin onto the line and pinch the band shut, with nothing refused. On a 0.02-wide band, 2 to 19 of its 38 skin vertices moved, depending on where the cut fell.

Such a vertex now keeps its place, its crossing is split instead, and the cut warns how many were spared. An internal boundary here is a label stratum holding facets only, not on the domain boundary. A label that holds cells on any rank is a region and is ignored, which is how gmsh's Elements label is left alone; the verdict is agreed over the ranks, and the protected set is reduced over the ranks sharing each vertex.

add_fault now passes snap_frac, snap_quality and snap_dist to the 2-D cut, only when given. A call without them makes the same cut as before: test_1176's fixture has 841 vertices with the same coordinates as on development.

Test: tests/test_0595_cut_spares_internal_boundaries.py. It checks:

  • the skin keeps its shape at two cut positions, with the warning;
  • add_fault with no snap options matches the defaults written out;
  • a snap option reaches the cut.

All 3 fail on development.

#429: the RBF multigrid test tests the builder

test_custom_mg_rbf_drives_solver asserted only that the solve converged. It now also asserts:

  • the nested-FMG solution, to 1e-4;
  • a competitive iteration count.

A new test checks that rbf_prolongation is sparse and linear-exact, with duplicated and nearly duplicated coarse points. The builder was already fixed, so these pass on development. The direct test fails for a builder that is exact only for constants; I checked that with an overlaid mutant.

Regressions

  • Serial: the 44 test files that cut, place or split give 393 passed and 1 skipped; test_0850 (surfaces and faults) passes; test_1015 passes.
  • Parallel: the cut, placement and split ptests (0843, 0844 twice, 0845, 0852, 0853) give 31 passed at np 2. At np 3, ptest_0844_reconnect_parallel::test_adapt_with_repair_runs_in_parallel fails, and it fails identically on development; it is not this PR.

Checklist

  • Style Charter followed (S2)
  • No drive-by changes (S9)
  • Regression tests written first, shown failing, with level_1 / tier_b markers (S8)
  • No hedging names or commented-out code (S3, S4)
  • No exception swallows
  • Data access unchanged
  • Parallel: the guard is collective and reduced over the ranks; ptests at np 2 and 3 (S11)
  • No dependency changes
  • AI attribution below

Underworld development team with AI support from Claude Code

#540. SurfaceCollection in 2-D: Surface.face_normals and face_centers are
per polyline segment (pyvista has no cell normals for lines);
transfer_normals makes a mesh.cdim-component variable and takes each
point's nearest SURFACE by exact distance, then that surface's nearest face
(the nearest face centre over all surfaces gave a point near one trace's
end the other trace's normal); compute_distance_field uses each surface's
own exact distance (pyvista wants 3-D points).

#494. cut_along_lines skipped any edge with an endpoint on ANY line, so a
line's crossing of an edge touching another line within an edge of it was
never split: gaps in the chain, silently (3 per chain at 0.7 h, 1 at 0.9 h).
"Already on a line" is now per line.

#595. A vertex on a labelled internal boundary (a stratum holding facets
only, not on the domain boundary: a placed band's skin) is never snapped
onto the cut; its crossing is split instead, and the cut warns how many
were spared. 2 to 19 of a 0.02 band's 38 skin vertices used to move.
add_fault passes snap_frac, snap_quality and snap_dist to the 2-D cut when
given; without them the cut is unchanged (test_1176's fixture: 841
vertices, same coordinates as development).

#429. test_custom_mg_rbf_drives_solver now asserts the nested-FMG solution
and a competitive iteration count, and a direct test checks that
rbf_prolongation is sparse and linear-exact with duplicated coarse points.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 03:30

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.

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.

3 participants