Repository navigation
Description
Summary
The vertex-level nested MG prolongation recorded by mesh.adapt (landed in #433) produces O(1) wrong values at 1–2 fine vertices per refinement pass in 3D. The affected vertices lie on no coarse edge, which is exactly the set tests/test_0753_nested_mg_prolongation.py::test_reproduces_an_arbitrary_coarse_field skips — so it merged undetected.
Root cause
underworld3/utilities/nvb.py::nested_prolongation_from_dms resolves in rounds:
- exact match against coarse vertices and coarse edge midpoints;
- rounds 2+: any still-unresolved fine vertex equal to the average of two already-resolved fine neighbours takes the average of their weights.
Round 2 is inference, not topology — the function's own comment says so ("being fine-mesh neighbours does not by itself make the segment an edge of the refinement tree").
In 3D the Maubach split bisects (tuple[0], tuple[tag]) and creates edges from the new midpoint m to the two off-refedge vertices. Those edges run through the coarse tet's interior, so their midpoints are not at any coarse edge midpoint and are not matched in round 1. Round 2 then assigns them 1/2, 1/2 on a coarse edge that does not contain them.
Evidence
Band-refined 3D box (UnstructuredSimplexBox(cellSize=0.5, refinement=1), adapt(metric, max_levels=2)), random coarse nodal field, compared against an independent reference (containing cell by geometric point location, value by the closed-form simplex Lagrange basis — deliberately not uw.function.evaluate, cf #432):
| generation | disagreeing nodes | |vertex transfer − truth| | |cell-based transfer − truth| | lie on a coarse edge |
|---|---|---|---|---|
| 2 | 2 / 1004 | 1.64 | 5.3e-16 | 0 / 2 |
| 3 | 1 / 1608 | 1.47 | 0.0 | 0 / 1 |
| 4 | 1 / 2136 | 2.31 | 4.4e-16 | 0 / 1 |
Generations 0, 1 and 5 are identical between the two constructions. 2D is unaffected (identical at every generation).
The comparison does not assume which construction is right: both are measured against the same independent reference.
Why the test missed it
test_reproduces_an_arbitrary_coarse_field validates a fine vertex by locating the coarse edge it lies on and taking the P1 value along it, then asserts only checked > 0.9 * (fvE - fvS). Vertices on no coarse edge are silently skipped — and those are precisely the wrong ones. The slack is structural in 3D, not a tolerance: the Maubach diagonal midpoints can never lie on a coarse edge, so tightening the bound to 100% would fail rather than catch this.
Possible impact
This is a candidate explanation for the recorded observation that the exact nested P1 transfer converged one iteration worse than the barycentric geometric builder in 3D (5,6,5 vs 4,5,4). It was installing a prolongation with a few O(1)-wrong entries.
Status / suggested fix
Work on #425 (exact any-degree nested transfer) builds the prolongation from the parent cell map returned by the refinement transform, evaluating the coarse basis inside the parent. That construction is exact at degree 1 too and matches the independent reference to machine precision, so #425 routes all degrees through it and no longer consumes _adapt_prolongation.
That leaves two options for this issue:
- retire
nested_prolongation_from_dmsandMesh._adapt_prolongationonce Use the nested hierarchy for MG transfers on adapt children (topological prolongation) #425 lands (nothing in the library would consume them), or - fix round 2 to reject a candidate whose inferred parents are not actually endpoints of a coarse edge.
A regression test is included with #425
(tests/test_0847_nested_transfer_any_degree.py::test_the_vertex_transfer_is_wrong_in_3d_and_the_cell_transfer_is_not)
which pins the defect and will fail loudly if it is fixed, as a prompt to retire the test with the issue.
Underworld development team with AI support from Claude Code
Activity
lmoresi commentedon Aug 8, 2026
Status from the #488 re-review (2026-08-09): the defect is STILL LIVE at the branch head — 1 of 842 interior rows wrong on macOS gmsh 4.15.1 — despite CI's guard test reporting it "appears FIXED". Whether any interior vertex lands in the defective closure-cascade configuration is a lottery on the gmsh-generated base mesh: CI's Linux PyPI wheel (open pin) produces zero defective rows, macOS 4.15.1 produces one. The guard test is being converted to a NON-STRICT xfail (xfails where the defect manifests, passes quietly where the mesh doesn't exercise it) so neither gmsh outcome breaks CI while this stays open. The
TODO(BUG)innvb.nested_prolongationmarks the source.The 3-D prolongation tripwire is mesh-dependent: skip, don't assert, …
Fix the two CI failures: a gmsh-lottery guard and a tolerance calibra…
lmoresi commentedon Nov 13, 2026
Labelled
fixed-in-PR: PR #1134 removes the wrong rows. In the review on #1134 (#1134 (comment)), the one-coarse-cell acceptance rule for round-2 pairs gives 0 wrong rows and 0 declines over 151 refinement passes on 27 fixtures and 36mesh.adaptcalls, where the previous first-pair rule gives 285 wrong rows in 65 of the 151 passes. Every wrong row reproduced the vertex's coordinates exactly, which is why a coordinate test could not see it.Reading the bisection record instead of inferring parents (step 2) is a separate roadmap item. The label becomes
fixed-in-developmentwhen #1134 merges; the issue stays open until release.Underworld development team with AI support from Claude Code
Generated by Claude Code
#449 review: a 3-D case that sees every pass, stale text, the measure…
#449 re-check: comments say what the code does; the slow 3-D case is …
Merge pull request #1134 from underworldcode/bugfix/nested-transfer-o…
lmoresi commentedon Nov 13, 2026
Fixed in
developmentby PR #1134: the 3-D nested P1 prolongation accepts a round-2 pair of resolved neighbours only when the supports of their two rows lie in one coarse cell, read from the coarse mesh's connectivity with no tolerance. In review that gave 0 wrong rows over 151 refinement passes where the previous rule gave 285 in 65; test_0449 and test_0753's new 3-D case fail on the previous code. Reading the refinement's own record instead of inferring parents is a roadmap item. The issue stays open untildevelopmentis released tomain.Underworld development team with AI support from Claude Code
Generated by Claude Code
Nested P1 transfer: a round-2 pair is accepted only if its rows lie i…