fix(evaluate): recover boundary-face query points dropped by DMLocatePoints on quad/hex meshes (#390)#391
Open
lmoresi wants to merge 1 commit into
Open
fix(evaluate): recover boundary-face query points dropped by DMLocatePoints on quad/hex meshes (#390)#391lmoresi wants to merge 1 commit into
lmoresi wants to merge 1 commit into
Conversation
…Points 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
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.
What this fixes
Closes #390 (the test_1052 VEP stability failures) — but the root cause is not PETSc 3.25.
uw.function.evaluatewas returning silent zeros for query points sitting exactly on the domain's closed upper boundary faces of quad/hex meshes (e.g. y = y_max on aStructuredQuadBox). PETSc's point location uses a half-open cell convention, so a point exactly on the top face belongs to the nonexistent cell "above" and gets dropped; the dropped point was then zero-filled by the evaluator.Semi-Lagrangian stress-history trace-backs slide departure points along the top boundary of the VEP shear box, so every step read ψ* = 0 there instead of the true history. The BDF history update amplified that boundary corruption exponentially: max|err| = 240 against a threshold of 0.10. With this fix the same run gives max|err| = 0.063 — the value recorded in the test docstring when it was written.
Why this is a UW3 regression, not a PETSc one
DMInterpolationSetUp_UW, and it prefilled the dropped-point recovery map — points PETSc dropped were evaluated in the adjacent hinted cell (with reference-coordinate clamping). When the hint pointer became the DMLocatePoints-bypass switch (simplex/manifold only), quad/hex volume meshes lost the recovery.plexgeometry.c(point location, grid hash) has only cosmetic changes between v3.24.2 and v3.25.0.The fix
DMInterpolationSetUp_UWgains an explicithintAuthoritativeflag, separating the hint's two roles:For located points nothing changes: DMLocatePoints results always overwrite the hint. The evaluator's wrapper (
_dminterp_wrapper.pyx) now always passes the hint and only varies the flag.Testing
tests/test_1052_VEP_stability_regression.py: 5/5 pass (was 3 failing).mpirun -np 2): 92 passed; the single failure (test_0765deformed-shell) is pre-existing and carries its ownTODO(BUG)note about the PR fix: medium Track-0 misc — parallel BoxInternalBoundary, SL theta restore, viewer crash, projection double-count, units-boundary honesty (BF-10a/12/13/15/18, D9) #326_deform_meshguard.Underworld development team with AI support from Claude Code