Repository navigation
A solve after a move of a refined mesh runs on the moved geometry (#1037) - #1044
Conversation
) The move gave the new coordinates to mesh.dm only. On a refined mesh, mesh.dm is a clone of the finest hierarchy level, and solvers build on a clone of the hierarchy, so scalar solvers assembled on the pre-move coordinates: 51 % off for Poisson at refinement 2, whether the solver was made before or after the move. _deform_mesh now gives the finest level its own copy of the moved coordinates and rebuilds its coordinate field, as nuke_coords_and_rebuild does for mesh.dm. The coarse levels keep their geometry. Every mover and relax() go through _deform_mesh. Test: refinement 0, 1 and 2, default PC and FMG, solver made before and after the move, relax() on a refined annulus; serial and np 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adversarial review record for #1044, at a836387Verdict: request changes. The core fix works. After every mover tried, scalar solves on the branch match a single-level mesh on the moved DM to 1e-12, where development is 0.08–16% off. That holds at refinement 1 and 2 and at np 1, 2 and 4. Two things block the merge:
Paths under Adversarial review: PR #1044 (
|
| case | np 1 | np 2 |
|---|---|---|
| L=1.5, ref 2, FMG | 4 / 4 / 5 | 4 / 4 / 4 |
| L=4, ref 2, FMG | 5 / 4 / 5 | 4 / 4 / 6 |
| L=4, ref 2, V-cycle | 5 / 4 / 7 | 4 / 4 / 8 |
| annulus, MMPDE (max disp 0.034 at ref 1, 0.018 at ref 2), FMG | 4 → 4 | 3 → 4 |
The moved solution matches LU on the moved mesh to 1e-14 in every case.
Custom-P FMG (set_custom_fmg) is different. Its transfers are coordinate-based, so unmoved coarse levels do
cost iterations after a large move. Before → after the move:
| case | np 1 | np 2 |
|---|---|---|
| L=1.5, ref 1 | 3 → 9 | 4 → 11 |
| L=1.5, ref 2 | 3 → 16 | 4 → 18 |
| L=4, ref 2 | 2 → 27 | 4 → 33 |
The answers stay right (1e-12 against LU), and development shows the same counts (corr matrix cfmg:
28/33 on both builds), so this is not a regression. But the new docstring says "their transfers are
topological, and a coarse level only preconditions". That is true only for PETSc MG, and it should say so.
Q2: degree-2 coordinate meshes at refinement 1
- The new sync code cannot be reached through any public mover for a degree-2 mesh, and it was not reachable
before.mesh.X.coordsholds the vertices only: (534, 2) on the annulus, against 2020 degree-2 nodes. So
mesh.deformandredistribute_nodesraise a broadcastValueErroron both builds (q2_annulus_*_1044.log,
q2sizes.py). - The finest level never had degree-2 coordinates.
mesh.dmholds 4040 coordinate entries, but
dm_hierarchy[-1]and the solver DM hold 1068 (P1), with or without a move, on both builds. So even with no
move, a solve on a refined degree-2 mesh runs on P1 geometry. It makes no numerical difference here, because
the "degree-2" nodes sit on chord midpoints, not on the circle: r_min is 0.49846 on the r=0.5 boundary. The
unmoved solve matches a degree-2 single-level reference to 1.6e-14. This is pre-existing. - Through a direct
_deform_meshwith the full node array (q2direct.py, scale ×1.2):- At refinement 0, both builds are right: the integral ratio is 2.0736, as expected.
- At refinement 1, the branch raises the new
RuntimeError, but only aftermesh.dmhas been moved and
rebuilt. The mesh is left half-moved:mesh.dmmax|x| is 1.2, the finest level 1.0, and the next solve's
ratio is 1.44 where 2.0736 is expected. That is the same wrong answer development gives silently. - The spherical shell is the same: ratio 1.728 against 2.488.
- The result is identical at np 2.
- Boundary curvature: there is none to keep. See above.
Q3: NVB path, _moved decided "equal" after a move
[read] When the levels compare equal, base_finest = self.dm_hierarchy[-1] is used directly: there is no clone
and no duplicate vector. That is safe for the refinement itself:
- the native NVB path clones before labelling (
d = current_dm.clone()); - SBR and edge-split take it as input;
write_tagged_state_labelnow seeds on the moved geometry, which is correct.
It is not safe for the multigrid tail. coarse_tail = self._coarse_level_meshes() is a cache built once.
If it was built before the move, by any earlier adapt, multigrid_levels or set_custom_fmg(mesh.multigrid_levels…),
its last entry wraps the pre-move finest level. Development replaced that entry with _moved_wrap because
_moved was True. The branch never takes that branch any more, which also makes it dead code.
Measured (q3adapt.py: stretch ×1.5, refinement 1, metric band at x=1.2, child Poisson with its automatic
tail):
| case | branch: tail base-finest xmax, MG its | development: tail base-finest xmax, MG its |
|---|---|---|
| no cache before the move, nvb / sbr, np 1 | 1.5, 4 / 4 | 1.5, 4 / 4 |
| cache before the move, nvb, np 1 / 2 / 4 | 1.0, 17 / 19 / 19 | 1.5, 4 / 5 / 5 |
| cache before the move, sbr, np 1 / 2 / 4 | 1.0, 15 / 17 / 18 | 1.5, 4 / 5 / 5 |
adapt → move → adapt (q3cycle.py), L=1.5, np 1 / 2 |
1.0, 10 / 12 | 1.5, 5 / 6 |
| adapt → move → adapt, L=3, np 1 / 2 | 1.0, 17 / 21 | 3.0, 7 / 8 |
- Values are right. The child's MG solve equals LU to 1e-13 or better, and LU matches the exact solution to
2.0e-6. The child's xmax is 1.5 or 3.0 in every case. - Nothing is shared that shouldn't be. No coordinate handle of the child or the tail equals the parent's
dmordm_hierarchy[-1]. A later parent move left the child and the tail unmoved (0.0). A child move left
the parent's finest level equal tomesh.dmand its coarse level unmoved (0.0).
Findings
| ID | Severity | Finding | Evidence |
|---|---|---|---|
| H1 | High | adapt() after a move gives the child a multigrid tail whose base-finest level has the pre-move geometry whenever _coarse_level_meshes_cache exists. The fix makes _moved False, and that drops the moved wrap. This is the move-fault, re-refine, add-patch cycle (#1017 ruling). The answer stays right; iterations go up 2–4x, more as the move grows. |
Q3 table; discretisation_mesh.py ~9234 and ~9726 [read] |
| H2 | High (merge gate) | test_0764::TestEngineLessAdapt::test_redistribute_then_adapt_composition fails on the branch serially and at np 2, and passes on development. It asserts dm_hierarchy[-1] is unchanged after redistribute_nodes, which the PR now changes on purpose. The PR's "200 pass" list did not include it. |
logs/ser_1044_test_0764*, logs/rep_*_test_0764* |
| M1 | Medium | Each move adds 6 more entries to petsc4py's deferred-destroy list at np 2 than development does: 12 per move against 6, both with and without a solve per move. Rank-0 max RSS over 10 moves rose 367 → 390 MB (branch) against 371 → 380 MB (development). Development's own 6 per move is pre-existing. The two duplicated Vecs are replaced straight away by createCoordinateSpace (see L1), so they are likely part of the waste. |
logs/aux_leak*_np2.log |
| M2 | Medium | The layout check raises after mesh.dm has been moved and nuke_coords_and_rebuild has run, so the mesh is left half-committed (Q2). The check is also rank-local before a collective: a rank holding no cells compares 0 == 0, goes on into createCoordinateSpace, and hangs against the ranks that raised [read; not run, since there is no public route]. |
q2direct_1044_r1.log; _sync_hierarchy_finest_coordinates |
| L1 | Low | Two mutants survive test_1172: shared (the finest level takes mesh.dm's own Vecs) and globalonly (no local copy). Both give 12 passed at np 1 and np 2, because the rebuild replaces the vectors anyway. The handle-inequality assertion therefore cannot fail, and the local duplicate/copy is redundant. The essential mutants are caught: noop and nocopy fail 10 tests, and norebuild fails the 4 solver_before_move cases. |
logs/mut_* |
| L2 | Low | The docstring and commit say "their transfers are topological, and a coarse level only preconditions". That holds for PETSc MG, not for custom-P (Q1). | Q1 |
| L3 | Low | adapt's _moved branch, and its comment that "redistribute_nodes moves mesh.dm's coordinates while the static base hierarchy keeps the originals", are now dead or false. |
[read] |
| O1 | Observation (pre-existing) | On development the stale finest level depends on the path taken. After any earlier solve, a new variable and solver built after the move see the moved coordinates (why.py: solver xmax 1.5 with a pre-move solve, 1.0 without). So my "kept" matrix columns pass on development and cannot discriminate there. The discriminating evidence is the isolated runs below and test_1172. We did not find the mechanism. |
why.py, logs/corr_dev526_* against logs/iso_dev526_* |
| O2 | Observation (pre-existing, file separately) | An AdvDiffusion solver kept across a mesh.deform stretch differs from a fresh one by an amount that depends on the rank count: 5.8e-4 at np 1, 1.1e-2 at np 2, 3.1e-1 at np 4. It does so at refinement 0 too (0.26 at np 4), identically on both builds. The MMPDE and spring movers give a flat 1.3–1.6e-3. Part of the difference is the solver's history by design; the dependence on rank count is not. |
corr_summary.txt, rows deform * kept advdiff |
| O3 | Observation | The issue's scope sentence names the advection-diffusion solvers. In isolation (iso_dev526_*_advdiff) development's AdvDiffusion was right (3e-12) for all three movers; Poisson with FMG, custom FMG and FAC were not. |
logs/iso_* |
Attacks that failed (the fix holds)
- Correctness after a move, against a single-level mesh wrapping the moved DM, solved with LU
(corr.py, unstructured box withregular=False):-
Movers:
deform(x ×1.5), spring (smooth_mesh_interior, 10 iterations) and MMPDE (redistribute_nodes). -
Refinement 1 and 2, np 1, 2 and 4.
-
Solvers: Poisson with the default PC, Poisson with FMG, Stokes, AdvDiffusion (3 steps), custom FMG, and
custom FMG withfac_zone. -
The branch gives relative error of 1e-12 or better for every fresh solver (108 rows), and for every kept
solver except AdvDiffusion (O2, identical on development). -
Isolated, one solver per process at refinement 2 and np 2, development is wrong for:
solver deform MMPDE spring FMG 1.1e-1 3.5e-3 8e-4 custom FMG 1.6e-1 1.1e-1 1.2e-2 FAC 1.6e-1 1.1e-1 1.2e-2 Development's Stokes is right (4e-13), as reported. The branch is right for all of them.
-
Refinement 0 is the same on both builds.
-
- Coordinates in parallel (
aux.py coords, MMPDE, refinement 2, np 1, 2 and 4, with 74 and 158 ghost
coordinate entries at np 2 and 4):- For
mesh.dm, the finest level and the solver DM, the local vector equals a global-to-local scatter of the
global vector, to 0.0. - The finest level equals
mesh.dm, local and global, to 0.0, and so does the solver DM. - Development is off by 1.3e-2.
- For
ephemeral_coords(np 1, 2 and 4):- Inside the scope, the finest level equals
mesh.dmand a solve sees the moved area of 1.5. Development is
off by 0.5 inside the scope, and gives 7.91e-2 where 1.285e-1 is right. - On exit, the finest level,
mesh.dmand the solve are restored exactly (rel 0).
- Inside the scope, the finest level equals
- Snapshot restore after a mover (
save_state,redistribute_nodes,load_state; np 1, 2 and 4): the
restore succeeds, the finest level,mesh.dmand the solver DM all return to the original coordinates
(0.0), and the solve matches the pre-snapshot value to 1e-16. nuke_coords_and_rebuildis reached only through_deform_mesh, so the sync always follows it [read].
The direct callers,extract_region(~2583) andremesh(~10087), replaceself.dmoutright [read].- test_1172:
- Development gives 10 failed, 2 passed, 2 skipped serially and at np 2. The PR body says 9; at 526edb9 the
relax-annulus test fails as well. - The branch gives 12 passed, 2 skipped serially and at np 2.
- Development gives 10 failed, 2 passed, 2 skipped serially and at np 2. The PR body says 9; at 526edb9 the
- Mesh-move suite, np 2, one file per mpirun (
--with-mpi):- We ran 51 files (
movefiles.txt) on both builds and got identical outcomes in 49. - test_0764 differs (H2).
- test_1014 is apparent only: rank 1 fails
pytest.warnson both builds. - Failing on both builds: 0004, 0840, 0841, 0843, 0867, 1015 and 1016_custom_mg_hierarchy.
- test_1111 hangs on both. test_1087 was still running on both at the time of writing.
- We ran 51 files (
- After a mesh move, solves see the remapped field; a move is decided over all ranks #959 is in the base (526edb9), and test_0766, serial and parallel, passes on both.
- Custom-P hierarchy state no longer outlives a change to its solver or mesh (#1019, #1020, #1017, #1012) #1036 (merged after the base, at 03c33e2) [read; no build contains it]:
- Its hunks do not overlap the PR's, and GitHub reports
blocked, notdirty. _move_versionis bumped inremesh_with_field_transfer, not in_deform_mesh. So the sync runs on trial
moves insideephemeral_coordswithout bumping it, which is consistent.- The FAC kill reads the custom-P level meshes, which this PR does not touch.
- Swarm and kd-tree sync are unchanged: the kd-tree is rebuilt from
mesh.dmbefore the sync [read].
- Its hunks do not overlap the PR's, and GitHub reports
Merge conditions
- Fix H1: on every move, refresh the cached base-finest wrap (
_coarse_level_meshes_cache[-1]), keeping its
_refine_slotand_mg_static. Alternatively, decideadapt's_movedagainst that wrap. Then remove or
rewrite the dead_movedbranch and its comment. Add a regression test: build the cache (viaadaptor
multigrid_levels), move,adapt, and assert that the tail's base-finest coordinates equalmesh.dm's and
that the iteration count matches a run with no cache. - Update test_0764's assertion to the new contract: the coarse levels are unchanged and the finest level equals
the movedmesh.dm. List every file actually run in the PR body. - Make the layout check collective, run it before
mesh.dmis touched, and state that degree-2 refined meshes
are not supported (M2). - Bring the deferred-destroy growth per move at np 2 back to development's level, or justify it (M1). Drop the
redundant duplicate Vecs, or make the test able to tell them apart (L1). - Correct the docstring on topological transfers (L2).
What we could not test
- The PR merged onto current development (e7fdcb2, with Custom-P hierarchy state no longer outlives a change to its solver or mesh (#1019, #1020, #1017, #1012) #1036): no build exists and we did not rebuild. That
interaction is [read] only. - Degree-2 coordinates through any public mover (
deformand MMPDE fail earlier on both builds), and true
curved degree-2 boundaries (the meshes do not generate them). - 3-D beyond the degree-2 shell through a direct
_deform_mesh. - Stokes with custom FMG (
field_id=0) after a move. - The rank-local hang in M2 (no public route reaches it).
- test_1060 (47 min) and test_1087 (did not finish). CI's xdist batching.
- We did not run the issue's p_hier2.py or the round-3 p6mv.py probes themselves.
corr.pyandq3adapt.py
cover the same ground.
Underworld development team with AI support from Claude Code
… the moved mesh - _coarse_level_meshes re-wraps its cached finest level when a move has changed dm_hierarchy[-1], keeping its _refine_slot and _mg_static. adapt's _moved branch could no longer fire, so it and its comment are gone (H1, L3). - test_0764 asserts the new contract: the finest level carries the move, the coarse levels keep the original (H2). - The layout check runs before mesh.dm is touched and is collective; a refined mesh with degree-2 coordinates raises (M2). - The sync copies the global coordinates only, the local vector is regenerated, and the old coordinate space it releases is freed with a collective garbage_cleanup: two deferred entries in all, against twelve a move (M1, L1). The always-true handle assertion is gone. - The docstring says the coarse geometry is free for PETSc MG only (L2). - test_1172 gains the adapt-after-a-move case and joins scripts/test.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review answered at f4ae8a3: development e7fdcb2, with #1036, is merged in. Point by point:
Tests run locally on the pushed tree, serial unless marked:
The full list is in the PR body. I haven't run your one-file-per-mpirun np 2 sweep of 51 files. Underworld development team with AI support from Claude Code |
# Conflicts: # scripts/test.sh
Re-check of PR #1044 (fix for #1037) at f4ae8a3 and at the merged head b5fa806READY. This covers f4ae8a3 and the merged head b5fa806. All seven round-1 conditions are met, measured on both heads, and nothing blocks the merge. Three low-severity items remain and can be follow-ups (N1–N3). Round 1 is How the runs were done:
Status of the round-1 findingsH1 (high): resolved
Regression test. test_1172 has a new test,
The #1017 cycle (
Results:
H2 (high): resolvedtest_0764 now asserts the new contract: the finest level equals the moved
M2 (medium): resolved
The rank-with-no-cells case is now constructed and run (
The degree-2 limitation is stated in the RuntimeError's text and in the private method's docstring. It is not in any public docstring ( M1 (medium): resolvedThe sync now ends with
L1 (low): partly resolvedThe local duplicate is gone: the sync copies the global coordinates only, which makes it the round-1 Mutants against test_1172 (
Two of these survivors are the residual: nothing tests that the finest level holds its own Vec ( L2 (low): resolvedThe L3 (low): resolved
Correctness matrix (
|
| test | serial | np 2 |
|---|---|---|
| test_1172 | 13 passed, 2 skipped | 13 passed, 2 skipped |
| test_1172, parallel file | — | 13 passed, 2 skipped |
| test_1146 | 4 passed | 4 passed |
| test_1149 | 12 passed | 12 passed |
| test_1149, parallel file | — | 2 passed |
| test_1151 | 2 passed | 2 passed |
| test_1152, parallel file | — | 2 passed (also on development) |
test_0764 is covered under H2.
Mesh-move suite at np 2, one file per mpirun. We ran round 1's movefiles.txt on f4ae8a3 and on development 5ce73fd, without test_1111 (it hangs on both) and test_1087 (it did not finish in round 1). That leaves 49 files, and 46 have identical outcomes. The three that differ:
- test_0764: same outcome on both builds; only the exit code differs, 142 against 63, both from the pre-existing garbage-intersect abort.
- test_1014: apparent only. Both builds have one rank fail the two
pytest.warnstests; the summariser read different ranks' lines. Same as round 1. - test_0835
test_wedge_metric_funnels_finest_level_to_feature: fails on f4ae8a3 (6.0 < 6.0) and passes on development. It is not caused by this PR. Development's test sums the marked counts over the ranks (test_0835 wedge-metric test compares rank-local marked-cell counts and fails at np 2 on rank 0 #1043, which landed after e7fdcb2), and f4ae8a3's test is older. On the merged head it passes at np 2 (10 passed).
Failing on both builds, all pre-existing: 0004, 0840, 0841, 0843, 0867, 1015 and 1016_custom_mg_hierarchy.
Checkpoint reload (ckpt.py, serial):
- A moved refinement-1 box written and reloaded gives the finest level equal to
mesh.dmon the branch (xmax 1.5, 0.0). On development the finest level is 1.0 against 1.5. So the reload's deferred stamp, which goes through_deform_mesh, now carries the move into the hierarchy. - A refined degree-2 annulus fails to reload with PETSc error 62 on both builds. This is pre-existing; the new degree-2 guard is not reached.
Merged head b5fa806
- Is it the same PR? b5fa806's parents are f4ae8a3 and development 6a2b04e, and 6a2b04e contains c5e5900.
git diff 6a2b04ed b5fa806ftouches only the PR's five files. The patch-ids ofdiscretisation_mesh.py, test_0764 and both test_1172 files are identical to the e7fdcb2..f4ae8a3 delta. - The conflict is gone. At f4ae8a3, a read-only
git merge-treeagainst c5e5900 conflicted only inscripts/test.sh, anddiscretisation_mesh.pymerged automatically. The merged head resolves the conflict. - What development changed nearby. Development's changes to
discretisation_mesh.pyin that range are Reload a refined mesh's checkpoint correctly on any rank count (#690) #1063's refined-reload rework. Its reference coordinates come fromdm_hierarchy[0], which this PR leaves unmoved, and its deformed stamp still goes through_deform_mesh[read].
Results on wt-1044c, from git archive b5fa806f tests:
| check | result |
|---|---|
| test_1172, serial | 13 passed, 2 skipped |
| test_1172, np 2 | 13 passed, 2 skipped |
| test_1172, np 4 | 13 passed, 2 skipped |
| test_1172 parallel file, np 2 | 13 passed, 2 skipped |
| test_1172 parallel file, np 4 | 13 passed, 2 skipped |
| test_1172 parallel file, serial | 15 skipped (by design: it needs MPI) |
| test_0764, serial | 10 passed |
| test_0764, np 2 | 9 passed, 1 failed (the pre-existing slip-normals failure and abort, as on development) |
| test_1146, serial / np 2 | 4 / 4 passed |
| test_1149, serial / np 2 | 12 / 12 passed; parallel file 2 passed |
| test_1151, serial / np 2 | 2 / 2 passed |
| test_0835, np 2 | 10 passed |
q3adapt np 2, nvb and sbr, cache / no cache |
tail = mesh.dm True; 5 / 5 its; rel(MG − LU) ≤ 2.9e-15 |
q3cycle L=3, np 2 |
tail xmax 3.0; 8 its |
cycle1017 (MMPDE, np 2) |
tail = moved base (0.0); 4 velocity its; |v| 2.1659038487e+01, the same as f4ae8a3 |
New findings (none blocking)
| ID | Severity | Finding |
|---|---|---|
| N1 | Low | Nothing catches the shared and noclean mutants (table under L1). A deferred-entry count after a few moves (PETSc.garbage_view) would guard M1 in CI. |
| N2 | Low | Degree-2 refined meshes are stated as unsupported only in the error text and a private docstring. Public deform/mover docs do not mention it [read]. |
| N3 | Low [read] | multigrid_levels and _coarse_level_meshes() now do an allreduce on every access once the cache exists. Before, only the first access was collective. The multigrid_levels docstring still says "built on the first access, which is collective". We found no rank-conditional caller (we searched src, tests and docs), but the docstring should say that every access is collective. |
| O1 | Observation | Each re-wrap builds a new Mesh for the base-finest level. That is one per adapt after a move, which development's _moved_wrap also did, so it is not a new cost. |
Not tested
- 3-D NVB adapt after a move.
- Degree-2 coordinates through any public mover. They fail earlier, as in round 1.
- test_1111 and test_1087.
- CI's xdist batching.
Evidence index
| check | logs |
|---|---|
| H1 | logs/q3_*, q3cycle_*, cyc1017_*, mut_norewrap_* |
| H2 | logs/ser_*_test_0764*, rep_*_test_0764* |
| M2 | logs/q2direct_1044b_*, m2empty_* |
| M1 | logs/leak2*, aux_leak* |
| L1 | logs/mut_* |
| Correctness matrix | logs/corr_1044b_* |
| Mesh-move suite | logs/mv_* |
| Checkpoint reload | logs/ckpt_* |
| Merged head | logs/c_* |
Underworld development team with AI support from Claude Code
…worldcode#978) The degree argument of Mesh and of the uw.meshing constructors set the degree of the coordinate field. Particle location, cell sizes, boundary normals, mesh motion and the multigrid hierarchy all read the coordinates as straight-sided cells, and a degree-2 mesh failed in each. It did not curve a boundary either: the edge nodes sat on the chords. - Mesh._require_straight_sided_cells raises ValueError unless degree is the integer 1. Mesh.__init__ calls it first, and each of the 20 uw.meshing constructors calls it before generating anything, so every rank refuses together and rank 0 never starts gmsh. - mesh.degree is a read-only property returning 1. - Removed what existed only for degree-2 coordinates: the quadrature cell sizer petsc_fem_get_local_cell_sizes and its PETSc declarations (underworldcode#983), the degree guard in _compute_geometry_fvm, and the _finest_level_takes_moved_coordinates guard in _deform_mesh (underworldcode#1044). - Docstrings of all constructors and docs/developer/subsystems/meshing.md say that the mesh degree is 1 and the variable carries the order. - Tests: test_0782 (serial and parallel) now hold the refusal for every constructor found by signature, the strict check, the read-only property, and the degree-1 cell sizes that the degree-2 tests carried (manifold facets, empty rank, extracted region). The estimate_dt accuracy step keeps its closed-form baseline on a degree-1 mesh. Underworld development team with AI support from Claude Code
Fixes #1037. On a mesh built with
refinement, a scalar solve after a move (mesh.deform, any mover,relax()) assembled on the pre-move coordinates. For Poisson at refinement 2 that is 51 % off, whether the solver was made before or after the move. Stokes was already right.Cause.
_deform_meshgave the new coordinates tomesh.dmonly. On a refined mesh,mesh.dmis a clone of the finest hierarchy level, and solvers build on a clone ofmesh.dm_hierarchy. The finest level kept the old coordinates. It also kept its coordinate field (cell geometry), so a solver already built before the move stayed wrong even after it was given the new coordinates.Change (
Mesh._sync_hierarchy_finest_coordinates, called from_deform_mesh):mesh.dmcan't move the hierarchy behind the mesh's back.nuke_coords_and_rebuildrebuildsmesh.dm's.relax()reach it, because they all move through_deform_mesh.Test (
test_1172, serial andtests/parallelat np 2; written first). Poisson on a box built on [0, 1.5] × [0, 1], against a [0, 1]² box stretched there:relax()on a refined annulus, with an FMG Poisson solve after it;The 36 mesh-move test files (deform, movers, remesh, adapt, NVB, relax, smoothing, FMG, custom MG): 200 pass. One test,
test_1060, takes 47 minutes, so it ran on its own; it passes with and without this change.Not in this PR. The advection-diffusion solvers (SLCN, SUPG) and Stokes are right after a move on development, so the defect is in Poisson-type solves and the multigrid preconditioners. Whether published moved-mesh results are affected is being checked separately: the June 2026 code has an older defect of its own after a move.
Files run for the review round (f4ae8a3), 230 passed, 8 skipped:
test_0001_sphere_refinement_folds.py,test_0004_checkpoint_fmg_hierarchy.py,test_0056_projected_normals_deform.py,test_0057_deformed_domain_membership.py,test_0505_projection_smoothing_length.py,test_0751_mmpde_graded_area_floor.py,test_0752_mesh_shape_relaxation.py,test_0764_node_redistribution.py,test_0764_petsc_index_boundary_conditions.py,test_0766_mover_refreshes_mesh_vector.py,test_0773_surface_smoother.py,test_0820_deform_mesh_solver_rebuild_regression.py,test_0825_deform_mesh_cache_invalidation.py,test_0826_deform_capability_gate.py,test_0830_mesh_adapt_variable_transfer.py,test_0834_adapt_legacy_call_guard.py,test_0835_sbr_adapt_on_top.py,test_0836_nvb_graded_adapt.py,test_0837_nvb_native_transform.py,test_0838_nvb_graded_native.py,test_0839_nvb_parallel_adapt.py,test_0840_nvb_3d_serial_adapt.py,test_0841_nvb_tet_transform.py,test_0842_nvb_3d_parallel_adapt.py,test_0843_edge_split_adapt.py,test_0845_relax_pinned_band.py,test_0847_mesh_hierarchy_plot.py,test_0850_mesh_smoothing.py,test_0867_place_sheet_adapted_3d.py,test_1016_custom_mg_hierarchy.py,test_1020_fmg_single_field_lockout.py,test_1022_composed_ribbon_fmg.py,test_1055_yield_smoother.py,test_1060_stress_store_smoothing.py,test_1111_rotated_fmg_coarse_shifted_lu.py,test_1113_rotated_fmg_one_coarse_factorisation.py,test_1146_custom_mg_after_deform.py,test_1149_custom_mg_hierarchy_lifecycle.py,test_1151_first_solve_after_a_mesh_move.py,test_1172_moved_refined_mesh_solves_on_moved_geometry.py.test_1172was also run at np 2 (13 passed).Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)
level_*andtier_*markers (S8)maybe_/try_/do_) and no commented-out code (S3, S4).array/mesh.X.coords— nowith ....access(...), nomesh.data(S7)pixi.toml/pixi.lockor other dependency changes riding in an unrelated PRUnderworld development team with AI support from Claude Code
🤖 Generated with Claude Code