Skip to content

Draft UWTN 2026-011: Moving the Mesh Without Remaking It - #7

Merged
lmoresi merged 19 commits into
mainfrom
note/moving-the-mesh-without-remaking-it
Aug 13, 2026
Merged

lmoresi merged 19 commits into
mainfrom
note/moving-the-mesh-without-remaking-it

Conversation

@lmoresi

@lmoresi lmoresi commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

The M1 note from WRITING-PLAN.md, at review so the preview picks it up.

The argument

Adaptive refinement charges for resolution twice. The first charge is the one
everybody quotes — repartition and migrate. The second is the multigrid
hierarchy: either we need a nested-refinement adaptation (complicated,
not always local) or we need to re-derive
a hierarchy with non-nested meshes. Moving nodes under a fixed budget
pays neither cost, and the article works through a (our) mechanism: what it is worth
in numbers, and where its ceiling is.

The part worth publishing is the reference frame. The functional measures
distortion against the mesh as first handed over, so a distorted mesh is its
own optimum and redistribute_nodes under a uniform metric moves exactly
nothing. Swap the reference for a regular simplex and the same machinery
becomes a shape repairer.

What is in it

  • The Huang–Kamenski functional, and why non-folding is a theorem rather than a guard
  • The transfer that remains after a move, and why it never crosses a rank boundary
  • Three reference frames, and the warning that relax() and relax(metric) are different operations
  • Numbers: −17.5% interpolation error on a library-adapted mesh; the production adapt/relax table; the hierarchy surviving with a full four-level pc=mg
  • The ceiling — a fixed node budget saturates, and baking refinement into the gmsh base compounds rather than merely maintaining
  • How to check the mover actually moved: the outer-iteration trace, and achieved grading against requested
  • What it does not fix: structural slivers, 3-D accuracy, and why "wasted refinement" resists being a scalar

Reviewing

The figure is generated by examples/redistribute_figure.py, which ships with
the note. Both DOI citations resolve in the HTML and the PDF, and the PDF
carries a single references section.

Producing the figure turned up a mover defect, which is filed separately as
underworld3#531
and deliberately kept out of the note — this is a methods document, not a
defect tracker. What the note keeps from it is the general acceptance test.

Before it publishes

WRITING-PLAN.md now records that this should go out alongside G1 (setting
up full multigrid). The note's central claim is that the hierarchy survives
node movement, and that is worth much less to a reader who has not been told
what the hierarchy is worth.

Underworld development team with AI support from Claude Code

The M1 note from the writing plan. Adaptive refinement charges twice --
in parallel migration, and in a multigrid hierarchy whose extra levels are
not a doubling of h and so cost a smoother sweep for nothing. Moving nodes
under a fixed budget pays neither, and the note works through the mechanism
(Huang-Kamenski MMPDE, non-folding by construction), what it is worth in
numbers, and where its ceiling is.

The part worth the note is the reference frame: the default reference is the
mesh as first handed over, so a distorted mesh is its own optimum and the
mover moves EXACTLY nothing under a uniform metric. Swapping the reference
for a regular simplex turns the same machinery into a shape repairer.

Figure generated for this note (examples/redistribute_figure.py), and it
turned up a live defect on the way: accel="cg" stalls after 9 outer
iterations of 150 with the line search backtracked to a zero step, which the
outer loop reads as convergence -- 1.08x grading where the unaccelerated
mover reaches 1.65x. Neither the area floor nor the tolerances are involved.
Filed as underworldcode/underworld3#531 and flagged in the note, since the
recommended setting is the one that under-delivers.

Left at `review`, and the plan now records that it should publish alongside
G1 (setting up full multigrid) -- the claim that the hierarchy survives is
worth much less to a reader who has not been told what the hierarchy is worth.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from e23cdca. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

The draft had drifted into a bug report: a "Two bugs worth naming" section
and a warning box pointing at an issue number. Neither belongs in a note whose
job is to explain a method -- the defect tracker is where defects go.

What survives is the part that is genuinely method: HOW YOU CHECK THE MOVER
MOVED. A mover that stops early returns a valid, non-folded, correctly
partitioned mesh that simply is not the one you asked for, and nothing
downstream can tell. So the note now says what to look at -- the outer
iteration trace, and the grading actually achieved against the grading
requested -- as an acceptance test to run when setting a problem up, not as a
story about something that went wrong.

Also rewrote the "wasted refinement" paragraph out of the confessional and
into the general: why the property resists being a scalar, rather than an
account of four attempts that failed.

The accel guidance stays, as guidance: which setting to reach for and when,
with no editorialising about why.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 957c91f. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Some adjustments to the framing. Do not merge yet.
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 1ef4ff1. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

The section on relaxing an already-refined mesh arrived out of nowhere: the
whole note up to that point is about redistribution under a fixed budget, and
then without warning it was tagging rules, Alfeld, NVB, an error-times-cells
normalisation and a maintainer's note on where to put relax() in an adapt
loop. Four screens on a subject the opening never promised.

Fixed structurally rather than with a linking sentence. It now follows THE
CEILING, so the fixed node budget is what motivates bringing refinement into
the discussion at all, and it reads as the consequence it is: the two
strategies compose, and the second reference frame is where they meet.

Cut to about a third. Gone: the refinement taxonomy, the error-times-cells
lecture, the "both placements are defensible and we do not rank them"
paragraph, and the admonition about base mesh quality (folded into a clause).
Kept: one number, one table, and the honest reason the numbers are not larger.

"Does the hierarchy actually survive?" moved after it, since that table is its
evidence and it had been forward-referencing it. Trimmed the wasted-refinement
paragraph the same way.

Abstract rewritten to match the new opening -- three strategies, we take the
third -- instead of the old claim that refinement tears the hierarchy down,
which was too strong and is no longer what the note argues.

Underworld development team with AI support from Claude Code
…inks

The refinement detail cut from M1 is not wrong, it is in the wrong note. M4
now holds it -- tagging rules, bisection versus Alfeld, error-times-cells as
the scale-free comparator, and where relaxation belongs in an adapt loop --
with a pointer to the commit that still has the text, so writing it is
editing rather than rediscovering.

Also records why M1 must not be deposited yet. It forward-refers to M2 and
carries material destined for M4, and neither exists, so those references are
unlinked prose. Publishing with dangling references is recoverable; depositing
is not, because the PDF is the citable record and its links freeze at the
moment the DOI is minted.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 0cb3d4c. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Maintainer ruling: this is not a journal of record. The concept DOI resolves
to the newest version and re-versioning is cheap -- we put 40 records to v2 in
one batch in August 2026 -- so a dangling cross-reference is a reason to issue
a v2 later, not a reason to delay a deposit now.

Which makes the problem remembering, not blocking. So the reminder moved off
M1, where nobody will be standing when it matters, and onto M2, M4 and G1 --
the notes whose publication is the trigger. Whoever writes one of those will
see "on publication: re-version M1" in the entry they are working from.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 7c7a1ef. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Updated various sections for clarity and accuracy, including rephrasing questions and statements regarding node budgets, mesh optimization, and field transfer requirements.
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from f6563e1. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Everything about improving an already-refined mesh has gone to M4, replaced by
the sentence Louis wrote: the mover is benign, it will not undo refinement,
and we come back to it later. That takes out the whole "where the two
strategies meet" section along with its 17.5% figure and the adapt/relax
comparison, and the paragraph about structural slivers, which was about
refinement rules rather than about the mover. All of it is recorded in M4 with
the numbers and a pointer to the commit that still has the prose.

What stayed, and why:

- The multigrid hierarchy survives. The note claims this in its opening
  bullets and nothing backed it. Now stated with its own evidence, since the
  table it used to lean on has left.
- Three dimensions behave differently: quality improves, interpolation error
  does not. A property of the method, and someone will otherwise expect the
  2-D gain to carry over.
- Telling a mover that finished from one that stalled, cut from its own
  section to one paragraph inside the ceiling, where the shortfall it has to
  be distinguished from is already being explained.

Also dropped adapt(relax=...) from the closing example, since the material
that explained it has moved.

450 lines to 334.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 344a851. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Louis spotted alt text rendering on the preview page. The cause is that MyST
reads a directive option as the rest of its own line, so wrapping `:alt:` for
the 84-column convention did two things at once: truncated the alt to its
first line, and dropped the remaining words into the directive body, where
they came out as a second caption under the figure. The built AST had two
caption nodes where there should be one.

Nothing caught it. The build exits 0, validate reports no warnings, and the
asset check passes because the image reference itself was fine. It is only
visible by looking at the page, which is what happened.

A sweep of all 55 articles and the pages found no other instance -- the Ghost
converter always wrote single-line options -- so this was self-inflicted and
is now fixed with a shorter, single-line alt.

Added test_no_directive_option_is_wrapped_over_two_lines, which looks for an
indented non-blank line immediately after a `:option:` inside a directive
fence. Negative-controlled: re-wrapping the alt makes it fail with the file
and line number.

Underworld development team with AI support from Claude Code
Louis flagged that the current implementation may not fall back to the global
RBF builder, and that it does not matter here either way. The second point
settles it: the note only needs to say that operators built by geometric point
location have to be rebuilt when the coordinates move. Which builder rescues
which failure mode is solver-internal detail, and the 23-versus-2 iteration
counts were evidence for a claim the note no longer makes.

For the record, since I had asserted it: the retry does exist in the code
(custom_mg.py:1056 attempts the configured builder then 'rbf'), but it only
engages when the build raises, and the zero-column cause it was written for
was fixed at source under #424 -- so whether it ever fires now is a fair
question and not one this note should be answering.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 6d005d4. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

The 3D section was a blast of quality statistics that meant nothing in the
context of the rest of the article. Replaced with the point they were evidence
for: it all works in 3D, but the metric guarantees much less there. A
tetrahedron can have the right volume and sensible edge lengths in every
direction the metric constrained and still be a sliver, because those
constraints leave free the one degree of freedom that flattens its four
vertices onto a plane. Good size is not a good element. One number survives,
that the near-degenerate population roughly halves.

New worked example: convection in an annulus at Ra 1e7, viscosity contrast
1e3, with the mesh redistributed as it runs. The animation is the argument the
prose has been making -- the node count never changes while the mesh follows
the boundary layers and plume margins as they migrate.

The GIF was 24.7 MB. Reduced to a 96-colour palette WITHOUT dithering, which
gives 14.6 MB with no visible degradation; the dithered passes speckled along
the contour lines, and dithering an animation also shimmers between frames.
125 frames at 600x600 are all preserved. Verified the PDF carries a converted
frame (600x600 image in the export) rather than silently dropping the figure,
which is the failure mode noted in pixi.toml.

Banner is Louis's choice of fishing nets at Busum, by Waldemar Brandt on
Unsplash, credited in the house pattern. Resized 6000px/6.2MB to 1800px/947KB,
in line with the rest of the corpus.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from f8982ed. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Confirmed by Louis: Frank-Kamenetskii viscosity spanning a factor of 1000,
Ra 1e7 defined on the LOWEST viscosity (worth stating, since the same run
labelled against a different reference viscosity would look like a different
experiment), base mesh resolution 32, and R8 is the metric's finest-to-coarsest
ratio.

That last one earns a clause: the metric asks for 8 and a fixed node budget
cannot deliver 8, which is exactly the ceiling the earlier section measures. So
the example now demonstrates the limitation as well as the capability, instead
of quietly leaving the reader to assume the asked-for grading was achieved.

Underworld development team with AI support from Claude Code
…t a span

I had it as "the finest:coarsest cell-size ratio you are asking for", in the
caption and in the code comment. Wrong, and checked against the implementation
rather than the docstring alone:

    log_rho_max = 2.0 * np.log(ref_val)   # densest cells -> h0/R
    coar_val    = ref_val ** (1.0 / cdim) # 'auto' coarsening

refinement=R is the maximum local refinement factor on the BACKGROUND cell
size: the densest cells target h0/R. With coarsening="auto" the sparsest relax
to h0*R**(1/d), so the envelope is [h0/R, h0*R**(1/d)] and the actual
finest:coarsest span for R=8 in 2-D is about 23, not 8.

The error came in from the adaptive-meshing skill, which says "refinement=R is
the finest:coarsest grading ratio". That is wrong too and should be fixed in
underworld3 -- flagged, not fixed here, since it needs its own branch.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 5167388. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Louis's framing, and it is the sharpest statement of the limit in the note:
refinement is fly-by-wire. Turning it up asks for more, but what arrives
depends on the node budget and on how the metric is spread across the domain,
and no setting guarantees a particular result.

Which settles what this tool is. Redistribution grades a base mesh; it is not
adaptive refinement in its own right, and the note now says so rather than
leaving a reader to infer it from the numbers. It also earns the example its
place: the convection problem is one where base-mesh grading is enough, and
that is why it is the example.

Underworld development team with AI support from Claude Code
"Enough for" concedes that the example was picked because it is a case the
tool handles, which is not what we want to be saying in the sentence that
classifies the tool. "Well-suited to" makes the same point about fit without
the apology, and the trailing clause explaining why the example is there went
with it.

Underworld development team with AI support from Claude Code
One conflict, in tests/test_migration.py, and it was additive on both sides --
main appended the deposit-queue tests, this branch appended the guard against
a directive option wrapped over two lines. Neither replaces the other, so both
are kept. 123 tests pass with no duplicate test names, and validate, build and
the asset check are all clean on the merged tree.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from c83170a. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

Clarified the explanation of mesh refinement and its effects on the MMPDE algorithm. Improved the language for better understanding of the relationship between node movement and mesh quality in 3D.
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 2f25e91. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

status review -> published, dated today. It now appears in the production
build, the feed and the listings; before this it was preview-only.

Underworld development team with AI support from Claude Code
…imation

CI failed where local succeeded, in two independent ways, and both would have
published a defective note.

DOI RESOLUTION. MyST fetches citation data from doi.org at build time. On the
runner it returned nothing usable for 10.1016/j.jcp.2015.08.032 -- "Citation
data from doi.org was not available or malformed" -- so the note would have
gone out with a dead citation and a missing reference entry. Both references
are now pinned in references.bib and cited by key. A deposited PDF cannot be
repaired, so the bibliography belongs in the source rather than being fetched
from the network at build time.

GIF CONVERSION. MyST shells out to ImageMagick to give Typst something it can
place, and on the runner that died with "TypeError: Cannot read properties of
undefined (reading 'length')". The export then produced NO PDF at all, which
our own guard caught: "1 article(s) declare a PDF export but produced none".
The corpus already has a GIF that converts successfully on CI -- 55 frames,
10.6 MB -- and mine was 125 frames and 14.6 MB, so the likely cause is a
resource limit on the runner rather than a missing tool. Halved the frames to
63 and doubled the frame delay, so the animation plays at exactly the same
speed and now sits at 6.8 MB, inside the envelope of the one that works.

Verified locally on a clean build: no DOI errors, no conversion error, the PDF
carries the 600x600 animation frame, and the references section has both
entries.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 82cfabc. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

@lmoresi
lmoresi merged commit 139af8d into main Aug 13, 2026
2 checks passed
lmoresi added a commit that referenced this pull request Aug 13, 2026
…ating it

Two defects in how the preview gets announced. The link is the only way to
reach a preview -- the directory is a hash of the branch name and nothing links
to it -- so a missing notification is a missing preview.

FIRST: preview.yml comments on PUSH, and only if a pull request already exists
for the branch. Push, then open the pull request -- the natural order, and the
one the worktree flow encourages -- and the comment step correctly finds no
pull request and exits. The preview is built and serving the whole time. That
happened to UWTN 2026-012 and had to be recovered by computing the URL by hand.

preview-link.yml now fires on pull_request opened/reopened and comments the
link WITHOUT rebuilding: it reads the same URL, confirms it is really serving
first, and says nothing if it is not, leaving the push-triggered run to comment
when its build lands. It takes the path from preview_mark.preview_path rather
than reimplementing the hash, and reads head.ref rather than GITHUB_REF_NAME,
which on a pull_request event is "<number>/merge" and would key the URL to the
wrong directory.

SECOND: the dedupe never matched. It looked for a body starting "**Preview:**"
while the variant that carries links starts "**Preview" with no colon -- so the
common case matched nothing and every push appended another comment. PR #7 has
thirteen. Both workflows now match on the prefix both variants share.

Underworld development team with AI support from Claude Code
lmoresi added a commit that referenced this pull request Aug 13, 2026
* Comment the preview link when the pull request opens, and stop duplicating it

Two defects in how the preview gets announced. The link is the only way to
reach a preview -- the directory is a hash of the branch name and nothing links
to it -- so a missing notification is a missing preview.

FIRST: preview.yml comments on PUSH, and only if a pull request already exists
for the branch. Push, then open the pull request -- the natural order, and the
one the worktree flow encourages -- and the comment step correctly finds no
pull request and exits. The preview is built and serving the whole time. That
happened to UWTN 2026-012 and had to be recovered by computing the URL by hand.

preview-link.yml now fires on pull_request opened/reopened and comments the
link WITHOUT rebuilding: it reads the same URL, confirms it is really serving
first, and says nothing if it is not, leaving the push-triggered run to comment
when its build lands. It takes the path from preview_mark.preview_path rather
than reimplementing the hash, and reads head.ref rather than GITHUB_REF_NAME,
which on a pull_request event is "<number>/merge" and would key the URL to the
wrong directory.

SECOND: the dedupe never matched. It looked for a body starting "**Preview:**"
while the variant that carries links starts "**Preview" with no colon -- so the
common case matched nothing and every push appended another comment. PR #7 has
thirteen. Both workflows now match on the prefix both variants share.

Underworld development team with AI support from Claude Code

* Only preview when something renderable changed

Louis: 'It's odd that there is a preview action that holds up merging 13 and 12
when those have nothing to preview.'

It was not actually holding anything up -- only `test` is a required check, so
those merge whatever preview is doing -- but spending six minutes republishing
an unchanged site for a branch that touches workflows and tests is waste, and
it makes the checks list look like it is blocking when it is not.

The push trigger now filters on the paths that change what a reader sees.
scripts/ is in the list deliberately: those build the site, so a change there
can alter every page without touching an article.

Safe as a paths filter ONLY because preview is not required. A required check
skipped this way stays 'expected' and blocks the merge forever rather than
passing, so the test says so next to the assertion.

Underworld development team with AI support from Claude Code

* Assert the outcome, not the mechanism

The deposit-preview test pinned 'paths-ignore' as the way a deposit-queue
branch is kept out of the preview. Replacing it with a positive paths list --
which excludes deposit-queue.txt more strongly, by not naming it -- made that
test fail on a change that improved the thing it guards.

Also: I committed the previous change with that test failing, because the
command piped pytest into tail and the pipe's exit status masked pytest's.
Second time this session. Run it, check $?, then commit.
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.

1 participant