Repository navigation
evaluate uses the cell that contains a point before any face tolerance (#1115) - #1117
Conversation
#1115) _robust_owning_cells accepted the first cell it tried (the nearest control point's) whenever the point was within the 1e-2 face tolerance of it. A point just inside the NEIGHBOURING cell, within that tolerance of the face they share, was then evaluated in the wrong cell, and the box clamp in DMInterpolationEvaluate_UW put it on the shared face: an error of about |grad f| times its distance from the face, for any field, the ones the element represents exactly included. On a 1/16 simplex box: 4e-6 at 1e-6 from an edge or vertex, 4.4e-5 at 1e-5; 5 of 20,000 random points. The locator now takes two passes: a cell that contains the point to rounding (_EVAL_CONTAIN_TOL, 1e-10, face-relative), and the 1e-2 face tolerance only for points no local cell contains. The set of points a rank claims is unchanged, so ownership and migration are untouched; only which of a rank's cells evaluates a point changes. The face tolerance dates from 2026-05-28 (c52201b, parallel locator hardening); #1014 (register row 6) did not touch this path. test_0511 (tier B): 2-D and 3-D simplices, P1 and P2, points on and at 1e-8..1e-3 from vertices and edges, exact to rounding; quads as control. The four simplex cases fail on development. Underworld development team with AI support from Claude Code
|
READY at a8e3a2f, on the merge conditions below. They are corrections to the PR text and register row, plus one follow-up issue. No code change is required. Review of #1117 (fix for #1115): independent, adversarialReviewer: H1 (review and parallel test runs on a 96-thread Linux workstation: Intel Xeon Gold 6240R, AVX-512, MPICH 5.0.1). Head a8e3a2f is compared with base development 8a388dd, using a build of each. #1107 is in neither build. Every number below was measured unless it is marked [read]. Tests ran from Summary
Findings by severity1. Medium. Cost for points near vertices is 3× in parallel 3-D, not "no measurable change" (H3's item 4)Method. Times are best of 3, with fresh coordinates on each repetition. Each rank queries N/np points spread over the whole box, so in parallel most points are foreign to the querying rank. The meshes are a 2-D simplex box at h = 1/32 and a 3-D box at h = 1/12.
2. Medium. The seam residual is not #1107's territory: #1107 leaves it exactly unchanged (H3's item 3)Method.
3. Medium, pre-existing and not caused by this PR. On strongly sheared 3-D meshes, the 50-neighbour walk misses the containing cell (H3's item 2)The mesh is a 3-D simplex box mapped by A = [[1, 1.2, 0.3], [0.1, 0.7, 0.5], [0, 0.2, 0.5]], plus a sinusoidal displacement of amplitude 0.03.
4. Low. 1e-10 is an absolute tolerance (1e-13 model units), not relative to the cell size[read]
Measured:
Merge condition: in the PR text, describe the tolerance as an absolute 1e-13 in model units, not "face-relative like the old tolerance". 5. Low. test_0511 coverage
6. Information. Callers that use the cell index now get the containing cell [read]
Evidence for the PR's main claimsSerial exactnessH1's repro script, h = 1/16, max |error|:
These match the PR's table. Other meshes, branch worst-case max |error| over vertices, edges, faces (3-D) and cell centroids, each exactly on the entity and at δ = 1e-13 … 1e-4 (development in brackets):
test_0511Development: 4 failed (all simplex), 4 passed (quads). Branch: 8 passed. Ownership unchanged (H3's item 1)The point sets are those of finding 2. At np 2, 3 and 4, in 2-D and 3-D, branch and development give bit-identical results for:
Only the local cell index changes: 1,876–1,913 (point, rank) pairs in 2-D and 6,194–6,336 in 3-D. [read] This is guaranteed by construction. Both passes use the same nearest-control-point start, reach filter and centroid order. A cell that passes at 1e-10 passes at 1e-2, and the second pass is the old call restricted to the lost points, which is batch-independent. So the claimed set is the same. Regressions
Merge conditions
Underworld development team with AI support from Claude Code |
#1117 at a8e3a2f: the cost on one MMPDE mover call (2-D annulus)Measured by H1 (review and parallel test runs on a 96-thread Linux workstation: Intel Xeon Gold 6240R, AVX-512; MPICH). The machine's load average was about 30 from other jobs, so single timings carry roughly ±15 % noise. Case. The annulus (r_o 2.2222, r_i 1.2222, cellSize 0.5) at refinement 4, which is 31,744 cells. One call of
The development build is 8a388dd; #1117 is a8e3a2f on that base.
* The first development sympy run was a load outlier; its repeat is 12.55 s.
Underworld development team with AI support from Claude Code |
|
Determinism check: #1117 does not introduce the launch-to-launch differences in the mover runs. They are on development too. Measured by H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)), np 4, at ec4e30e. Setup. The mesh-mover timing script from the earlier timing check:
Every top-level What differs between launches.
Verdict for #1117 on determinism: no objection. The nondeterminism is older than this PR and comes from the metric (items 1 and 2). #1117 changes which cell evaluates a point, so the same rounding difference reaches the mesh more often. It does not create one. Follow-up (not for this PR). I will file this as its own issue: the percentile map is discontinuous at ties between copies of a shared node, and the gradient projection is not bit-reproducible between launches.
Logs, probes and saved arrays are kept by the reviewer. Underworld development team with AI support from Claude Code |
evaluateis exact near edges and vertices on simplex meshes. Fixes #1115.This changes what
evaluatereturns near edges and vertices, so it needs a register row, and Louis's sign-off on the table below, before it merges.What was wrong
Mesh._robust_owning_cellsgave each point the first cell it tried, the one of its nearest control point, whenever the point was within the 1e-2 face tolerance of that cell. A point just inside the neighbouring cell, within that tolerance of the face they share, was therefore evaluated in the wrong cell. The box clamp inDMInterpolationEvaluate_UWthen put it on the shared face.The error is about |∇f|·δ for a point at distance δ, for any field, including fields the element represents exactly.
History. The face tolerance and this acceptance date from 2026-05-28 (c52201b, "parallel locator hardening", and 1419c4f). The tolerance was chosen so that a rank admits genuinely-on-face and partition-seam points without claiming points other ranks own. #1014 (register row 6, "reasonable tolerance") did not touch this path, so the defect predates that row.
The change
_robust_owning_cellsnow locates in two passes:_EVAL_CONTAIN_TOL = 1e-10multiplies the containment test's fixed 1e-3 offset, so in effect it admits points up to 1e-13 model units outside a face, independent of the cell size._EVAL_FACE_TOL = 1e-2works out the same way: 1e-5 model units outside a face, whatever the cell size.So the set of points a rank claims is unchanged. Point ownership,
points_in_domainand swarm migration are untouched (#1107 is not undone). Only which of a rank's own cells evaluates a point changes.Before and after
The case is from H1's report on #1115 (H1 is the worker session, running on a 96-thread Linux workstation: single system image, Intel Xeon Gold 6240R, AVX-512, MPICH). It uses a 1/16 simplex box and exact P1 linear and P2 quadratic fields, run serially.
Parallel (
global_evaluatenear the 276 interior vertices, a P2 exact field, points spread over all ranks), counting points wrong by more than 1e-9:The parallel residual is on partition seams, and #1107 does not change it.
Who holds these points: in each case some rank contains the point, while another rank, usually the one it starts on, admits it only within the face slab and keeps it. Migration never moves such a point, so it is evaluated there with the clamp.
The size of it: H1 (the worker session, on the same Linux workstation) measured a larger sample, every interior vertex, edge midpoint and face centroid at δ = 0 to 1e-4, plus random points:
Swarm.migrate offers a point to every nearby domain before giving up (#1093) #1107's migration change leaves these counts exactly as they are. The largest residual error in 3-D at np 4 is 6.5e-5, against 1.4e-4 on development.
What would fix it: an ownership change, preferring a rank that contains the point over one that only admits it within the slab. That is a separate change, with its own issue.
Tests
tests/test_0511_evaluate_exact_near_edges_and_vertices.py(tier B) covers 2-D and 3-D simplices, P1 and P2, points on vertices and edges and at δ = 1e-8, 1e-6, 1e-5, 1e-4 and 1e-3 from them, with an error at rounding (< 1e-12). It also runs 2-D and 3-D quads as a control. On development the four simplex cases fail and the quads pass; here all 8 pass.test_1052 VEP stability tests fail under PETSc 3.25 (variable-dt pure-VE blow-up), pass in level_1 gate #390 and uw.function.evaluate returns wrong values for P1 fields at points exactly on cell edges (3D) #432 (O(1) errors on 3-D edges):
test_0503_evaluate.pyandtest_0761_point_locator.pygive 34 passed and 2 skipped.Parallel, at np 2 and 3: the evaluate, migration and seam files give 50–51 passed on every rank. That covers test_0756, 0760, 0765, 0774, 0777, 0783, 0785, 0796, 1076 and test_1107_interpolation_rank_owning_nothing.
175 serial files that use
evaluate,global_evaluateor the locator, at -n 5: 1469 passed and 3 failed. All three are long tests that failed under load:test_1092's Maxwell case timed out at 1500 s, and passes alone on this branch (35 min);test_1060timed out, as it stalls on development under load;test_1064's constrained case hit PETSc error 101 under load, and has passed alone before.Cost. Random interior points are unchanged within noise. Points near a vertex, the population this fix is for, pay for the containing cell. On development the first cell tried admitted them within its slab; here a point the first cell does not contain walks its neighbours until one does. H1 measured, on a 3-D box at h = 1/12:
evaluate, same points, serialglobal_evaluate, 1e5 near-vertex points, np 2global_evaluate, 1e6 near-vertex points, np 4global_evaluate, 1e6 random interior points, np 4Points foreign to a rank (most points in parallel) and exterior points fail the walk twice, which roughly doubles the locator for them.
Not in this PR
Checklist (UW3 Style Charter)
level_*andtier_*markersUnderworld development team with AI support from Claude Code