feat(evaluate): measured point-location capability + NaN/RBF fallback ladder#394
Closed
lmoresi wants to merge 3 commits into
Closed
feat(evaluate): measured point-location capability + NaN/RBF fallback ladder#394lmoresi wants to merge 3 commits into
lmoresi wants to merge 3 commits into
Conversation
… ladder (#392) The cell-wall estimator's authority is now a MEASURED mesh property, not an isSimplex() type flag. Mesh._location_capability() audits face planarity (sagitta) and cell convexity per mesh, cached against the mesh/topology version so deform() and adaptation refresh it: - "exact" — simplex, manifold, and any quad/hex mesh with planar faces and convex cells at machine level. This graduates ALL valid 2-D quad meshes (deformed included — straight edges are always planar, convexity is equivalent to an untangled mesh) and rectilinear/affine hex boxes to simplex-grade authoritative location: the hint bypasses DMLocatePoints. - "continuous" — warped hexes within a 5% sagitta tolerance (cubed-sphere class). Authoritative for continuous fields only: a misclassified point lands in the face-adjacent neighbour, where continuous FE interpolants agree to O(sagitta x gradient); a face-aligned jump would see O(jump) errors. - "none" — badly warped or non-convex cells: no authority. Evaluations that are NOT authoritative (capability "none", or "continuous" with a discontinuous variable in the mix) run DMLocatePoints, and points it drops — e.g. queries exactly on the domain's closed upper faces, the #390 class — are NaN-filled (never zeros), reported via a new unlocated mask, and filled per-variable through the RBF interpolant: bounded, topology-free, honest. NaN can only survive if that plumbing is bypassed, which is exactly when it should be visible. The policy lives in one place (Mesh._hint_is_authoritative) and joins the DMInterpolation cache key, since the same coords with a different field-continuity mix legitimately need different structures. Design record: issue #392 and docs/developer/design/point-location-capability.md. Validation: test_0503 11/11 (three new tests: capability grading, deformed- quad exactness, warped-hex RBF rung), test_1052 5/5, level_1+tier_a gate 440 passed, np2 parallel suite unchanged from baseline. Underworld development team with AI support from Claude Code
… crash The test job dies with zero pytest output ~2s into each batch — a hard crash during import underworld3 on the linux runner, before pytest's first stdout flush. Reproduce attempts on macOS (custom PETSc 3.25.0 and conda PETSc 3.25.3 dev env) all pass, so surface the crash point in CI with faulthandler. This commit will be reverted once the cause is fixed. Underworld development team with AI support from Claude Code
The PR #394 'failure' turned out to be a runner-side flake: pytest died during import underworld3 before its first stdout flush, so all eight serial batches failed with zero output — undiagnosable from the log. The identical code passed once re-run. Keep the 5-second faulthandler import step so any future import-time crash is loud and localised instead of silent. Underworld development team with AI support from Claude Code
Member
Author
|
CI resolved — the failure was a runner-side flake, not the code. The failing run died during |
lmoresi
added a commit
that referenced
this pull request
Jul 23, 2026
… ladder (#392) (#395) * fix(evaluate): recover boundary-face query points dropped by DMLocatePoints on quad/hex meshes (#390) PETSc's point location uses a half-open cell convention: a query point sitting exactly on the domain's closed upper face (e.g. y = y_max on a StructuredQuadBox) belongs to the cell "above", which doesn't exist, so DMLocatePoints silently drops it and the evaluator zero-fills the result. Semi-Lagrangian stress-history trace-backs slide departure points along the top boundary of the shear box, so every step read psi* = 0 there instead of the true history. The BDF history update then amplified that boundary corruption exponentially — the test_1052 VEP "blow-up" (max|err| = 240 vs threshold 0.10). With this fix the run returns max|err| = 0.063, matching the value recorded when the test was written. This was a UW3 regression, not a PETSc 3.25 change: before 17a5a8d the kd-tree cell hint was always passed to DMInterpolationSetUp_UW and prefilled the dropped-point recovery map. When the hint pointer became the bypass switch (simplex/manifold only), quad/hex meshes lost the recovery. PETSc's plexgeometry.c is unchanged between 3.24.2 and 3.25.0. The fix separates the two roles with an explicit hintAuthoritative flag: - simplex / manifold meshes: hint is authoritative, DMLocatePoints is bypassed (unchanged behaviour); - quad / hex volume meshes: DMLocatePoints remains authoritative, but the hint again rescues points it drops, evaluated in the adjacent cell with reference-coordinate clamping (restored behaviour). Adds a level_1/tier_a regression test evaluating a linear field at points on every closed face of quad and simplex boxes. Underworld development team with AI support from Claude Code * feat(evaluate): measured point-location capability + NaN/RBF fallback ladder (#392) The cell-wall estimator's authority is now a MEASURED mesh property, not an isSimplex() type flag. Mesh._location_capability() audits face planarity (sagitta) and cell convexity per mesh, cached against the mesh/topology version so deform() and adaptation refresh it: - "exact" — simplex, manifold, and any quad/hex mesh with planar faces and convex cells at machine level. This graduates ALL valid 2-D quad meshes (deformed included — straight edges are always planar, convexity is equivalent to an untangled mesh) and rectilinear/affine hex boxes to simplex-grade authoritative location: the hint bypasses DMLocatePoints. - "continuous" — warped hexes within a 5% sagitta tolerance (cubed-sphere class). Authoritative for continuous fields only: a misclassified point lands in the face-adjacent neighbour, where continuous FE interpolants agree to O(sagitta x gradient); a face-aligned jump would see O(jump) errors. - "none" — badly warped or non-convex cells: no authority. Evaluations that are NOT authoritative (capability "none", or "continuous" with a discontinuous variable in the mix) run DMLocatePoints, and points it drops — e.g. queries exactly on the domain's closed upper faces, the #390 class — are NaN-filled (never zeros), reported via a new unlocated mask, and filled per-variable through the RBF interpolant: bounded, topology-free, honest. NaN can only survive if that plumbing is bypassed, which is exactly when it should be visible. The policy lives in one place (Mesh._hint_is_authoritative) and joins the DMInterpolation cache key, since the same coords with a different field-continuity mix legitimately need different structures. Design record: issue #392 and docs/developer/design/point-location-capability.md. Validation: test_0503 11/11 (three new tests: capability grading, deformed- quad exactness, warped-hex RBF rung), test_1052 5/5, level_1+tier_a gate 440 passed, np2 parallel suite unchanged from baseline. Underworld development team with AI support from Claude Code * ci: TEMPORARY faulthandler import smoke test to surface the silent CI crash The test job dies with zero pytest output ~2s into each batch — a hard crash during import underworld3 on the linux runner, before pytest's first stdout flush. Reproduce attempts on macOS (custom PETSc 3.25.0 and conda PETSc 3.25.3 dev env) all pass, so surface the crash point in CI with faulthandler. This commit will be reverted once the cause is fixed. Underworld development team with AI support from Claude Code * ci: keep the import smoke test as a permanent guard The PR #394 'failure' turned out to be a runner-side flake: pytest died during import underworld3 before its first stdout flush, so all eight serial batches failed with zero output — undiagnosable from the log. The identical code passed once re-run. Keep the 5-second faulthandler import step so any future import-time crash is loud and localised instead of silent. Underworld development team with AI support from Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #392 (stacked on #391 — retarget to
developmentonce that merges; the diff shown here is the capability-ladder work only).What this does
Makes the cell locator's authority (i.e. is it authoritative or an estimator) a measured mesh property instead of an
isSimplex()type flag, and completes the fallback ladder agreed on #392 so quad/hex meshes keep working with a fallback that simplex meshes don't need.Mesh._location_capability()audits face planarity (sagitta) and cell convexity, cached against(_mesh_version, _topology_version)sodeform()and adaptation refresh it automatically:exact— simplex, manifold, and any quad/hex mesh whose faces are planar and cells convex at machine level. This graduates all valid 2-D quad meshes, deformed included (straight edges are always planar; convexity is equivalent to an untangled mesh — verified 4000/4000 against exact polygon containment on a deformed box) and rectilinear/affine hex boxes to simplex-grade location: the hint bypassesDMLocatePoints.continuous— warped hexes within a 5% sagitta tolerance (cubed-sphere class: 64% of faces exactly planar, spherical faces ≤ 1e-2). Authoritative for continuous fields only — a misclassified point lands in the face-adjacent neighbour where continuous FE interpolants agree to O(sagitta × gradient); a face-aligned jump (layered viscosity on a spherical shell) would see O(jump) errors.none— badly warped / non-convex cells: no authority.The ladder: non-authoritative evaluations (capability
none, orcontinuouswith a discontinuous variable in the mix) runDMLocatePoints; points it drops (the #390 class — queries exactly on the domain's closed upper faces) are NaN-filled — never zeros — reported via a new unlocated mask, and filled per-variable throughrbf_interpolate: bounded, topology-free, honest. NaN survives only if the plumbing is bypassed, which is exactly when it should be visible.The policy lives in one place (
Mesh._hint_is_authoritative) and joins the DMInterpolation cache key (same coords with a different field-continuity mix legitimately need different structures).Testing
test_1052VEP stability: 5/5 (the shear box now takes the authoritative bypass).test_0765_deform_mesh-guard issue with its own TODO).Design record: issue #392 and
docs/developer/design/point-location-capability.md.Underworld development team with AI support from Claude Code