Skip to content

Commit 5e59174

Browse files
authored
Merge pull request #580 from underworldcode/docs/adaptive-meshing-refinement
Skill: refinement=R is a factor on the background spacing, not a grading ratio
2 parents a2d3231 + 5b6ae76 commit 5e59174

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

.claude/skills/adaptive-meshing/SKILL.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ adapt a mesh to a field `T` each step:
7171
```python
7272
import underworld3 as uw
7373

74-
# metric from |grad T|: refinement = finest:coarsest cell-size ratio (~5).
75-
# Use refinement=R, NOT strategy= (strategy caps at ~2 and under-grades).
74+
# metric from |grad T|: refinement=R is a factor on the BACKGROUND spacing h0,
75+
# not a finest:coarsest ratio. The envelope is h in [h0/R, h0*coarsening], and
76+
# coarsening="auto" is R**(1/d) — so R=5 in 2-D spans h0/5 to 2.2*h0, a ratio
77+
# of R**(1+1/d) ~ 11. Use refinement=R, NOT strategy= (caps at ~2, under-grades).
7678
rho = uw.meshing.metric_density_from_gradient(
7779
mesh, T, refinement=5, coarsening="auto", metric_choice="front-following")
7880

@@ -124,10 +126,15 @@ method_kwargs=dict(step_frac=0.2, accel="cg", momentum=0.0), slip_surfaces=True)
124126

125127
### 2. Metric
126128
- Thermal: `metric_density_from_gradient(mesh, T, refinement=R,
127-
metric_choice="front-following")``refinement=R` (≈5) is the finest:coarsest
128-
grading ratio; named `strategy=` caps at ~2 and under-grades. R≈5 extracts ~all
129-
the grading the node budget/layout allows; don't over-tune R (benign no-op above
130-
budget).
129+
metric_choice="front-following")`. `refinement=R` (≈5) is the maximum local
130+
refinement **on the background cell size h0**, not the finest:coarsest ratio:
131+
the metric targets `h ∈ [h0/R, h0·coarsening]`, and `coarsening="auto"` takes
132+
the budget-conserving `R**(1/d)`. So R=5 in 2-D asks for h0/5 up to 2.2·h0 —
133+
a finest:coarsest ratio of `R**(1+1/d)` ≈ 11, and ≈ 8.5 in 3-D. Named
134+
`strategy=` caps at ~2 and under-grades. R≈5 extracts ~all the grading the
135+
node budget/layout allows; don't over-tune R (benign no-op above budget).
136+
Passing `refinement` takes the **envelope branch**, which ignores `amp`,
137+
`lo/hi_percentile`, `mode` and `power`.
131138
- Fault / sharp feature: a **hand-built anisotropic SPD tensor**
132139
`M = ρ·I + (Rf²−1)·exp(−(d/w)²)·n nᵀ` (thin ACROSS the feature normal n). A
133140
scalar bump refines a fat isotropic corridor and leaves the centre-line coarse.

0 commit comments

Comments
 (0)