Repository navigation
pull_vertex_onto: a target inside the mesh never takes a boundary vertex (#1089, partly) - #1128
Conversation
pull_vertex_onto moved the nearest corner of the face holding a target, with no test for the domain boundary. A target inside the mesh whose nearest corner was a boundary vertex pulled that vertex inward: the domain was dented, and a fault tip clear of the boundary became a boundary vertex, which the split then refused as "touches the domain boundary". Without a split the dent was accepted (unit box area 0.99875). A boundary vertex now moves only along the boundary. A target on a boundary edge or vertex takes that face's vertices as before; a target inside the mesh takes an interior corner of its face; when the face has no interior corner the refusal is a ValueError raised on every rank (the flag leads the MIN reduction). Tests: test_0844 (wall bitwise unchanged on a box and an annulus, the boundary slide kept, the two refusals), test_0847 (a tip under a wall vertex is placed and split), ptest_0844 (the same at any partition, and the refusal collective; not run on the serial host). Not fixed, marked TODO(BUG): a box corner still slides off one wall when it is the nearer end of the boundary edge holding the target. Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
…on order Review of the boundary rule (a target inside the mesh never takes a boundary vertex) found that the interior corner it takes instead can be dragged up against the boundary with nothing said: a target 1e-8 under a wall left a cell of quality 2.5e-7, and a point of the true circle over a chord of a concave wall left one at 0.057. An interior corner that stands in for a strictly nearer boundary corner is now taken only when the cells around it stay above min_quality (0.1 by default, None disables), with the cut's own veto: refuse an inverted cell, or one below min(min_quality, its present quality). The refusal is a collective ValueError. The nearest corner itself is taken with no test, as before, so every pull that does not involve the boundary rule is unchanged. The reduction's flags are reordered so that a rank reading the target inside a cell with an interior corner is believed over a rank reading it, within the containment tolerance, on a face with none. The docstring, the error text and the subsystem page now state what the rule does not cover: a target outside the mesh, a box corner sliding along one wall, the cut's snap (issue #1089 stays open for those two), and two targets of one call taking the same vertex (issue #559, easier to reach beside a boundary). Tests: the refusal and its floor on the box and the annulus (fails before this commit); a target outside the mesh. Parallel: the ten-target test collided on shared corners and failed its own assertion, and is rebuilt on the regular box with targets two cells apart; the quality refusal is collective; an interior edge on a partition seam between two boundary vertices is not read as a boundary edge. Underworld development team with AI support from Claude Code
…uses (#1089) An interior corner that stands in for a nearer boundary corner was refused when it would leave a cell below min_quality, and only the nearest interior corner was tried. A target close to an edge of its own cell and well clear of the boundary was refused on that ground though the other interior corner takes it soundly. The corners are now proposed in distance order, each refusal reduced on every rank, and the call refuses only when none passes. The refusal names the welded transverse-isotropic fault zone as the route for a fault that has to end close under the boundary. Docstring, documentation and tests for this follow in the next commits. Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
… and the measured limits Tests (tests/test_0844_line_cut.py), on a hand grid of 18 triangles with one cell touching the wall at a single corner, listed both ways round: the next interior corner takes a target the nearest would flatten; a target no interior corner can take is refused with their count and the worst quality; a cell already below the floor does not refuse a pull that improves it; a later target is tested on the mesh the earlier ones left; a target on a vertex moves nothing. The too-close test now checks the quality the refusal reports against the mesh min_quality=None gives. Each new test fails under an in-memory mutant of the clause it covers. The retry loop's exit read names copied out of the reduced tuple, which tests/test_0052_collective_guard_scan.py cannot follow, so the scan failed on it. The reduction is now unpacked directly and the min_quality=None exit stands on its own line; the behaviour is the same. Docstring and docs carry numbers measured at this head: a cell with an edge on the boundary refuses a target closer than 0.044 to 0.088 of its height; a cell with one boundary corner refuses only within 0.16 of the shorter edge from that corner; a concave-wall point of an annulus of inner radius 0.5 is refused at cell size 0.15 and finer and placed at 0.2 and coarser. The floor applies to an interior corner standing in for a nearer boundary corner and to nothing else: on a regular 1/12 box 14 of 2822 accepted pulls left a cell below 0.1, each by the nearest corner. The docs page now covers two targets taking one vertex beside a boundary (#559) and the welded transverse-isotropic zone where a split is refused. Serial, macOS (12-core Apple M4): 45 fault and placement files, 425 passed, 1 skipped. The parallel file has not been run at this head. Underworld development team with AI support from Claude Code
The third review round found behaviour that was neither stated nor tested. - A fault side already split into the mesh is boundary; the refusal now names it as the other possibility beside the domain boundary. - The last entry of the reduced tuple says "this corner is the nearest of its face", so two ranks reading a face differently within the containment tolerance reduce to "test it". The same decision on one rank. - The winding of each cell is read once from the mesh as given, so a cell an earlier target of the call inverted is not read as wound the other way. - Docstring and docs: the cell with two boundary corners and no boundary edge, the 1e-9 containment tolerance under a boundary edge, curved concave walls (a point of the true curve is refused; a point on a chord moves the wall), the replay onto coarse levels, the untested tie, and the measured rate of two targets taking one vertex (#559, more frequent beside a boundary than before). - Four tests: the corner cell, two targets that choose one vertex (#559 as it is), a target on a chord of a curved wall, a fault ending beside an earlier split fault. Serial: test_0844 and test_0847 70 passed; 42 fault, placement and multigrid files 412 passed, 1 skipped. Not run on more than one rank. Underworld development team with AI support from Claude Code
Review record (before the PR opened)Three rounds of adversarial review by fresh agents, each on the head of the time, the third on f60a935 against The main claim held in every serial probe of the review: over about 27 000 random single targets on a regular 1/12 box, an irregular 1/12 box and an annulus (inner radius 0.5, cell size 0.1), no accepted pull of a target inside the mesh moved a boundary vertex or inverted a cell. Findings and outcome
8a and 8b are logic changes made after the review, so they have had no reviewer other than us. Both are for the cross-review to read: MutantsIn memory (one string of the installed
Each of the four new tests is failed by at least one mutant. What stays unpinned
Runs at this head
Issue verdicts
Underworld development team with AI support from Claude Code |
|
READY with conditions at 3584702. The new rule holds on 2 to 5 ranks, the seam clause is pinned by the parallel test, and no rank asymmetry was found in the two changes made after the third review round. The conditions are corrections to the PR text and one stated limit, listed at the end. Parallel review of #1128The runs were made by H1 (review and parallel test runs on a 96-thread Linux workstation: Intel Xeon Gold 6240R, AVX-512; MPICH). They use 1. The parallel test file, and the seam mutant
The PR body calls this file new. It is not. It exists on The seam case is exercised at every rank count. The test sends the corner cell to The mutant was applied in memory by a pytest plugin that re-executes the module with
The seam clause is pinned, and nothing else in the file depends on it. 2.
|
The boundary is read from the edges that have one cell and are held by one rank. In an overlap a boundary edge is held by two ranks and reads as interior, so a target inside the mesh could take a boundary vertex: on two ranks with an overlap of one cell, 91 of 2376 interior targets did (cross-review of PR #1128), where none did on one rank. The call now raises ValueError on every rank when any cell is held by more than one rank. Mesh.dm has no overlap, so add_fault is unaffected. One reduction is added, made on every rank before the first target. tests/parallel/ptest_0844_line_cut_parallel.py gains test_a_mesh_with_overlap_is_refused_on_every_rank. It has not been run on more than one rank at this commit. Underworld development team with AI support from Claude Code
After the cross-review: b68e8ebThe cross-review at 3584702 (the comment above) cleared the branch with three conditions. What we did with each.
The follow-up that replaces the three coordinate matches by a vertex number is described in the body with the cross-review's two findings: the number has to carry the twin of a vertex on a split fault, and an exact tie in distance is settled differently at different partitions today (52 of 10,686 targets, the same on Runs at b68e8ebOn macOS (12-core Apple M4), serial only.
Review record row 8c ("overlap: not checked") is superseded by condition 2 above. Underworld development team with AI support from Claude Code |
|
Re-check at b68e8eb: READY. All three conditions are met. The new overlap refusal is exercised in parallel and fires on every rank with the same message. It does not fire on a mesh without overlap. Measured by H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)), on development 01dec8d with this branch's
The refusal itself, probed directly on the same regular box at np 2 and 4:
The fault path in parallel, at np 2, branch against 3584702:
None of them is refused, which agrees with W1's reading that Serial runs: test_0844 and test_0847 give 70 passed. Conditions:
Attribution: every commit since 01dec8d ends with the repository line. There is no Co-Authored-By trailer, no model name and no emoji in the commits or the body. The non-blocking follow-ups from the first review still stand: a local tie-break on coordinates at exact distance ties, and carrying the split-vertex twin if a global vertex number replaces the coordinate match. Underworld development team with AI support from Claude Code |
line_cut.py met #1128's pull_vertex_onto, which reads each cell's winding from the mesh as given and tests quality before and after each move. One convention now serves both: the surface-mesh winding is voted once per call over every rank (_global_flip) and passed to every _cell_quality reading, in pull_vertex_onto as in the snapping loop; #1128's per-cell baseline is read under it. Underworld development team with AI support from Claude Code
What this does
pull_vertex_ontomoves a mesh vertex onto each target it is given;Mesh.add_faultcalls it for every control point of a fault before the cut. It took the nearest corner of the cell holding the target, with no test for the mesh boundary. A fault tip inside a boundary cell and nearest to its wall corner pulled that corner inward: the domain was dented (unit box area 0.99875), and the tip became a boundary vertex, which the split then refused as "touches the domain boundary".With this change a target inside the mesh never takes a vertex of the mesh boundary.
min_quality(0.1 by default,Nonedisables). A corner that fails is passed over and the next nearest interior corner is tried.ValueErroron every rank. The message says what to do, and names the welded fault zone with a transverse-isotropic rheology as the route for a fault that has to end close under the boundary.Mesh.dmhas no overlap, soadd_faultis not affected.This does not close #1089. The parts that stay are listed below.
The refusal is a geometric stand-in
A precise test would ask whether the move makes an element with inconsistent constraints, or one whose nodes are all constrained. That test is not built here. The rule above (no boundary vertex, and a quality floor on the cells around the vertex taken) stands in for it, and it refuses some placements a constraint test would allow. Where it refuses:
Curved concave walls. The boundary is the mesh's own chords, so a point of the true curve on a concave wall is an interior target a sagitta from the boundary. On an annulus of inner radius 0.5 and cell size 0.1, a fault ending on the true inner circle between two wall vertices was refused in 96 of 96 cases.
developmentplaced all 96 by moving a wall vertex onto the tip, with the area changing by 9.4e-6 to 2.35e-4. At cell size 0.15 and finer every such point is refused; at 0.175 to 0.25 the point over the middle of a chord is placed and those over its quarter points are refused; at 0.3 the quarter points are placed too.Tolerances and coordinate matches
Every tolerance and every match by coordinates in
pull_vertex_ontoafter this change, what it bounds, and whether the mesh's own connectivity could have answered instead._minimal_face_vertices)1e-12 xthe mesh extent, on the distance between coordinates1e-12 xthe mesh extent1e-12 xthe mesh extent, on a difference of two distancesmin_qualitymin_qualityThe choice among candidates is by distance to the target and has no tolerance; ties fall to coordinate order in the reduction, as before.
Three of these rows identify a vertex by where it is. One change would retire all three: reduce a vertex number in place of the coordinates. We have not made it here; it is a follow-up, with two things the cross-review found that it has to respect.
development. A DMPlex global number depends on the partition too, so it would not settle a tie the same way at every rank count. We would break ties by coordinate order, lexicographically, which is what the reduction does now but applied to the same candidate set on every rank; a number from the mesh before it was distributed would also do, if the mesh carried one, and it does not today.The cross-review also found that the three coordinate rows cannot pick different vertices on different ranks today (ghost coordinates were bitwise equal in 10,803 reductions), so the follow-up is not urgent.
Measurements
Serial, on macOS (12-core Apple M4).
add_faultwith a tip under the top wall of an irregular 1/12 box (cell height about 0.072), nine tips at each depth:developmentThe repro of the issue (tip at (0.504, 0.985), trace to (0.5, 0.6)) is placed with area 1, thirteen vertices on the top wall as before, and a worst cell quality of 0.252.
A second
add_faultwhose tip is beside an earlier split fault (irregular 1/12 box): at 0.25 and 0.1 of a cell height above the first fault it is placed with the first fault's vertices in place; at 0.03 the pull refuses it.developmentraised "adding ['Two'] would change the fault(s) already split into this mesh" at all three.On a mesh with add-on levels the fault is also replayed onto each level of the multigrid tail, where the cells are larger. A level whose pull is refused is left welded with a warning, and the finest level is still split:
developmentmin_qualityValueError, nothing placedWhat this does not fix
cut_along_lineswithsnap_frac=0.1still moves a boundary vertex onto the line (unit box area 0.99952, the same as ondevelopment).development. Of 1375 calls whose targets were further apart than the longest edge of the cells holding them, none did. A test holds the present behaviour. A fix has to deal first with the replay onto coarse levels, which sees the fine trace at 0.25 to 0.5 of a cell spacing.pull_vertex_onto, before or after.Parallel runs
By the cross-review (H1, a second session of ours on a 96-thread Linux workstation, MPICH), at 3584702; its record is in the comments.
tests/parallel/ptest_0844_line_cut_parallel.py: 20 of 20 pass on 2, 3, 4 and 5 ranks. The file is ondevelopmentwith 16 tests; this branch adds 4 for the boundary rule, and those 4 fail withdevelopment'sline_cut.py.not sharedclause of the boundary-edge test removed in memory, only the seam test fails, on 2 and 4 ranks.test_a_mesh_with_overlap_is_refused_on_every_rank). That test and the refusal have not been run on more than one rank by us; the cross-review reruns them.Not run by the cross-review: the 42 serial files,
test_0052, and anything in 3-D.Issues
Tests
Serial, on macOS (12-core Apple M4).
tests/test_0844_line_cut.pyandtests/test_0847_fault_api.py: 70 passed. Four tests are new in the last commit: the cell with two boundary corners and no boundary edge, two targets that choose one vertex (pull_vertex_onto: two control points can claim the same vertex, silently unplacing the first #559 as it is), a target on a chord of a curved wall, and a fault ending beside an earlier split fault.tests/test_0052_collective_guard_scan.pypasses with the new reductions.development'sline_cut.pyfails 19 of the 70; each of the four new tests is failed by at least one mutant; two clauses (after <= 0, the count restricted to the cells of the moved vertex) are killed by none.scripts/check_test_coverage.py: all 446 files reachable. The docs page builds clean.test_0052passes with its reduction; the new parallel test compiles and has not been run here.tests/parallel/ptest_0844_line_cut_parallel.pyis run by the cross-review; see "Parallel runs".Underworld development team with AI support from Claude Code