Skip to content

The mesh-move remap has no limiter by default, and a variable's kd-tree follows a mover - #982

Merged
lmoresi merged 6 commits into
developmentfrom
bugfix/remap-no-clamp
Nov 12, 2026
Merged

lmoresi merged 6 commits into
developmentfrom
bugfix/remap-no-clamp

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 6, 2026

Copy link
Copy Markdown
Member

The mesh-move remap no longer applies the monotone clamp by default, and a variable's kd-tree now follows a mover. Stacked on #959; review and merge that first.

The clamp was added in 086cad25 for a parallel free-slip failure. Louis asked for it to go: it bounds every remapped value by its nearest DOFs on one rank, which adds error on smooth fields and is what made the result depend on the partition.

Why the original failure doesn't come back

June's failure was targets outside the old mesh: a wall node that slid along a convex boundary sits a sagitta beyond the old polygon, and in parallel the value could come from a far cell. Those targets now take the location fallback in global_evaluate. That fallback is the best-claim reduction with an inverse-distance read, which is a convex combination, not the FE basis. An independent reading of that path found no way to the raw basis for exterior targets. June's np 5 fault run itself has not been re-run.

The kd-tree

The fallback reads each variable's kd-tree, which was keyed on _mesh_version. A mover doesn't change that, so after a mover the tree stayed at the old nodes (rbf_interpolate off by 0.2 on the new test). It is now keyed on _geometry_version, which moves with the coordinates and which the snapshot check does not read. This is one of the caches listed in #966; the others stay as they are.

Measured

Wall vertices slide a fifth of a cell along an annulus, with a smooth P2 field (largest over np 1, 2, 4, 8):

Clamp (before) This PR
Interior error 1e-2 to 5e-2 8.3e-4
Wall error 2.7e-2 to 9.7e-2 2.7e-2
Difference from serial up to 8e-2 1e-15
Ghost against owner up to 8e-2 1e-15

A mover move at np 5 on a 3-level annulus (penalty free slip, sharp T, live velocity), T error against its formula:

Clamp This PR
Interior 2.5e-1 1.1e-2 to 1.3e-2
Wall 5.6e-2 5e-4 to 1.4e-3
Wall v.r 2.2e-2 5e-3 to 7e-3

The clamp column of the second table is with the unfinished frozen metric on feature/mmpde-annulus-fmg, and this PR's column is the default metric over 3 moves, so compare orders of magnitude only. v_rms is 0.765 in both, and T stays within 0.001-1.300.

What this gives up

A P2 field can now leave its nodal range inside a cell at a front narrower than a cell. On an annulus (h about 1/32):

Front P2, no clamp P2, clamp P1, no clamp
Width 0.03 no overshoot (below 1e-10) none not run
Width 0.005 7-9 %, not growing over 3 moves none none

Viscosity-bearing fields are already kept to P0/P1 by the adaptive-meshing guide, and P1 stays in range. A level-set phi or a yield field in P2 is exposed. REMESH_MONOTONE=clamp remains available.

Repeated wall slides also accumulate wall error through the fallback's low order: 6.5e-2 after 4 slides of a fifth of a cell each. A geometric read on the old wall gave 8.6e-3, but needed about 90 lines and failed on graded and coplanar walls in review, so it was dropped (bugfix/remap-wall-dofs-geometry, a record only). Raising the fallback's order is the better route, later.

Tests

  • tests/test_0768_remap_without_a_limiter.py (tier B): the wall slide and the kd-tree fail on the After a mesh move, solves see the remapped field; a move is decided over all ranks #959 build (interior 9.8e-3 against the 2e-3 bound). The P1 test also passes on that build, because the clamp bounds it there: it records a property, not this fix.
  • tests/parallel/test_0768_remap_without_a_limiter_parallel.py (tier B): passes at np 2, 4 and 8; fails on the After a mesh move, solves see the remapped field; a move is decided over all ranks #959 build at np 4 (5.1e-2). It checks each rank count against bounds, and does not compare rank counts directly. That was a separate run, the 1e-15 above.
  • test_0780 depended on the old cache key and now bumps _geometry_version.
  • Every test file that moves a mesh or reads rbf_interpolate (32 files): 274 passed, 4 skipped, serial, before the last test edits; the edited files were rerun and pass. Eight parallel files at np 4 pass.

This leaves #960 open (the except Exception: continue, ghosts in discontinuous fields, follow_metric), and #966 open (swarm proxies and the other caches).

Checklist (UW3 Style Charter)

  • Read the Style Charter and followed it over the surrounding code
  • No drive-by refactors, renames or cleanups
  • Bug fixes ship the regression test, written first, with level_* and tier_* markers
  • No hedging names and no commented-out code
  • No new exception swallows
  • New data access uses .array / mesh.X.coords
  • Parallel safety checked at np 2, 4 and 8
  • No dependency changes
  • AI-assisted work carries the attribution line

Underworld development team with AI support from Claude Code

… a mover

The monotone clamp bounded every remapped value by its nearest DOFs on one rank. On a
smooth field that adds error (interior 8e-4 to 1e-2 in serial, 5e-2 in parallel) and
makes the result depend on the partition (8e-2 between rank counts on a wall slide).
Without it the remap agrees across rank counts to 1e-15. A target outside the old mesh
takes the location fallback in global_evaluate, which reads the variable's kd-tree.
That tree was keyed on _mesh_version, which a mover does not change, so it is now keyed
on _geometry_version.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Adversarial review

An independent reviewer read the commit before the last test edits. This was by reading code; it ran nothing.

Fixed

  1. test_0780 relied on the old cache key; it now bumps _geometry_version.
  2. The parallel test asserted interior error only. It now covers the wall too, and it is renamed, since it checks bounds and does not compare rank counts.
  3. The kd-tree test now asserts the nodes moved.
  4. Docstrings carry the contract, not history, and "needs no limiter" is gone.

Accepted, measured, and in the description
2. In-cell P2 overshoot at a sharp front is now unbounded: 7-9 % at a front narrower than a cell, none when resolved, and none for P1. Removing the clamp is Louis's decision, made with these numbers to hand.

Not fixed: the comment at discretisation_mesh.py:2701 names only boundary normals as the counter's consumer. Reading it in _get_kdtree is the new use; I left that file out to keep this small.

Attacks that found nothing

  • The June overshoot for exterior targets: both serial and parallel reach the convex inverse-distance read.
  • Out-of-range barycentrics: the face tolerance is about 1e-5 model units, which is negligible for simplices.
  • _geometry_version: always set by __init__; the kd-tree comparison is rank-local; a restore that moves coordinates bumps it.
  • Hot path: a rebuild happens only on an RBF read.
  • Nothing else reads REMESH_MONOTONE or _kdtree_mesh_version. Semi-Lagrangian paths have their own monotone_mode.

Issue verdicts: #960, #966, #977 and #979 are still live; this branch fixes one of #966's caches and doesn't close it.

An earlier version of this branch, a geometric read on the old wall, went through two reviews that found real failures on graded walls, coplanar walls and hex walls. That is why this is the simple version.

Underworld development team with AI support from Claude Code

Underworld development team with AI support from Claude Code
lmoresi pushed a commit that referenced this pull request Nov 10, 2026
Development's _evaluated_in_storage_layout (7bfdfaa) does what this
branch's _values_in_data_layout did, with units, so the conflicts take
development's helper, and the limiter takes development's per-entry bounds
(this branch's reorder would now permute twice). What remains here is the
swarm view of a full matrix and the symmetric-tensor tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lmoresi pushed a commit that referenced this pull request Nov 10, 2026
The two conflicts combine both sides: the evaluation stays at the
non-dimensional coordinates the DM holds (this branch), and the result is
laid out by development's _evaluated_in_storage_layout, which also reduces a
dimensional evaluation to the non-dimensional values var.data holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#982 turns the remap limiter off by default, so the extrapolated 500 K is
stored unclipped. The case pins the storage-layout path under the clamp it
was written for (#1002), so set REMESH_MONOTONE to clamp for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmoresi
lmoresi changed the base branch from bugfix/mover-stale-mesh-vector to development November 11, 2026 19:43
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmoresi lmoresi closed this Nov 11, 2026
@lmoresi lmoresi reopened this Nov 11, 2026
@lmoresi
lmoresi merged commit cab11f0 into development Nov 12, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants