From 5b6ae765bad08ecc2cf97d61d9504009c834ab80 Mon Sep 17 00:00:00 2001 From: lmoresi Date: Sun, 16 Aug 2026 17:54:29 +1000 Subject: [PATCH] Skill: refinement=R is a factor on the background spacing, not a grading ratio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The adaptive-meshing skill described refinement=R as the finest:coarsest cell-size ratio. It is the maximum local refinement on the background spacing h0: the metric targets h in [h0/R, h0*coarsening], and coarsening="auto" takes the budget-conserving R**(1/d). The finest:coarsest ratio is therefore R**(1+1/d) — about 11 for R=5 in 2-D, not 5. The skill is the first thing a session reads about the mover, so the error propagated into every model built from it. Also records that passing refinement takes the envelope branch, which ignores amp, lo/hi_percentile, mode and power. Underworld development team with AI support from Claude Code --- .claude/skills/adaptive-meshing/SKILL.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.claude/skills/adaptive-meshing/SKILL.md b/.claude/skills/adaptive-meshing/SKILL.md index 80883d34..c2c98da2 100644 --- a/.claude/skills/adaptive-meshing/SKILL.md +++ b/.claude/skills/adaptive-meshing/SKILL.md @@ -71,8 +71,10 @@ adapt a mesh to a field `T` each step: ```python import underworld3 as uw -# metric from |grad T|: refinement = finest:coarsest cell-size ratio (~5). -# Use refinement=R, NOT strategy= (strategy caps at ~2 and under-grades). +# metric from |grad T|: refinement=R is a factor on the BACKGROUND spacing h0, +# not a finest:coarsest ratio. The envelope is h in [h0/R, h0*coarsening], and +# coarsening="auto" is R**(1/d) — so R=5 in 2-D spans h0/5 to 2.2*h0, a ratio +# of R**(1+1/d) ~ 11. Use refinement=R, NOT strategy= (caps at ~2, under-grades). rho = uw.meshing.metric_density_from_gradient( mesh, T, refinement=5, coarsening="auto", metric_choice="front-following") @@ -124,10 +126,15 @@ method_kwargs=dict(step_frac=0.2, accel="cg", momentum=0.0), slip_surfaces=True) ### 2. Metric - Thermal: `metric_density_from_gradient(mesh, T, refinement=R, - metric_choice="front-following")` — `refinement=R` (≈5) is the finest:coarsest - grading ratio; named `strategy=` caps at ~2 and under-grades. R≈5 extracts ~all - the grading the node budget/layout allows; don't over-tune R (benign no-op above - budget). + metric_choice="front-following")`. `refinement=R` (≈5) is the maximum local + refinement **on the background cell size h0**, not the finest:coarsest ratio: + the metric targets `h ∈ [h0/R, h0·coarsening]`, and `coarsening="auto"` takes + the budget-conserving `R**(1/d)`. So R=5 in 2-D asks for h0/5 up to 2.2·h0 — + a finest:coarsest ratio of `R**(1+1/d)` ≈ 11, and ≈ 8.5 in 3-D. Named + `strategy=` caps at ~2 and under-grades. R≈5 extracts ~all the grading the + node budget/layout allows; don't over-tune R (benign no-op above budget). + Passing `refinement` takes the **envelope branch**, which ignores `amp`, + `lo/hi_percentile`, `mode` and `power`. - Fault / sharp feature: a **hand-built anisotropic SPD tensor** `M = ρ·I + (Rf²−1)·exp(−(d/w)²)·n nᵀ` (thin ACROSS the feature normal n). A scalar bump refines a fat isotropic corridor and leaves the centre-line coarse.