Skip to content

EQUIL - BUGFIX - Fix ideal Δ′ non-convergence on the auto psi-grid - #350

Open
logan-nc wants to merge 1 commit into
developfrom
bugfix/autogrid-delta-prime-convergence
Open

EQUIL - BUGFIX - Fix ideal Δ′ non-convergence on the auto psi-grid#350
logan-nc wants to merge 1 commit into
developfrom
bugfix/autogrid-delta-prime-convergence

Conversation

@logan-nc

@logan-nc logan-nc commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

What & why

The two-pass auto psi-grid (grid_type = "auto") produced a non-convergent ideal Δ′: as
psi_accuracy tightened, the Δ′ diagonal oscillated erratically (dpm[1,1] ≈ 7.2–10.1 on the
DIII-D-like case) instead of converging to the fixed-grid reference.

Root cause. The grid pinned a knot on each rational surface. The Δ′ asymptotic matching
stencil [ψ_s ± singfac_min/|n·q′|] then straddled that knot, so the cubic 3rd derivative the
singular extraction samples was inconsistent across the crossing. Confirmed by a clean in-run
natural experiment: surfaces whose knot happened to fall outside the stencil (e.g. q=4) were
rock-stable, while those straddling it (q=2/3/6) were erratic.

The fix (grid layer only)

  • bracket_mandatory_nodes — center each rational between a knot pair (never on a knot),
    blended to half the local spacing, so the matching stencil lies in one clean, locally-uniform
    spline segment and q‴ is single-valued across it.
  • Fixed-width (τ-independent) near-rational resolution patch — Δ′ accuracy is a property of
    the rational surface, so its local resolution must not scale with the global accuracy target
    psi_accuracy (that only sizes the pedestal/edge grid). This is what makes the default
    psi_accuracy = 1e-3 land on the converged value.
  • enforce_min_spacing floor on the auto refined grid and the fixed ldp/pow1 grids, so no
    grid packs its edge below the field-line-integration noise scale at high mpsi.

Result

dpm[1,1] now converges τ-independently to ~9.2 (matching the uniform mpsi ladder), default
psi_accuracy=1e-3 included, vs the prior erratic 7.2–10.1. Equilibrium scalars are unchanged
(q95, β_n = 0.00%) — this is grid placement only.

develop (erratic) this PR
dpm[1,1] @ τ=1e‑3 9.05 (lucky) 9.199 (converged)
dpm[1,1] across τ 7.2–10.1 9.2–9.3 (τ-independent)

Regression (diiid_n1, develop vs this branch)

Equilibrium scalars unchanged. Δ′-dependent quantities changed as intended: Δ′ diagonal
(dpm[1,1] 9.05 → 9.199), island half-widths (7.5%), Chirikov (21%), resonant field (14%). Runtime
+13% (within budget). These changes need reviewer sign-off — the harness is a live develop-vs-local
diff, so develop becomes the new baseline on merge.

Scope / follow-ups

⚠️ Human review is mandatory

Do not merge without a third-party human reviewer's approval, and please confirm the regression
changes above are acceptable.

Closes/relates: #349 (deferred grid-invariance redesign)

🤖 Generated with Claude Code

https://claude.ai/code/session_0125dY2qbGtm3gky8TPv7vh6

The two-pass auto grid pinned a knot on each rational surface; the Δ′
asymptotic matching stencil [ψ_s ± singfac_min/|n·q′|] then straddled it,
so the cubic 3rd derivative the singular extraction samples was
inconsistent across the crossing and the Δ′ diagonal oscillated with
psi_accuracy (7.2–10.1 on the DIII-D-like case) instead of converging.

- Bracket each rational (bracket_mandatory_nodes): center ψ_s inside a
  clean, locally-uniform interval between a knot pair, never on a knot,
  so the matching stencil lies in one spline segment and q‴ is
  single-valued across it.
- Fixed-width (τ-independent) near-rational resolution patch so Δ′ is
  accurate at any psi_accuracy — Δ′ is a property of the rational
  surface, so its resolution must not scale with the global accuracy
  target (that only sizes the pedestal/edge grid).
- Global minimum knot-spacing floor (enforce_min_spacing) on the auto
  refined grid and the fixed ldp/pow1 grids, so no grid packs its edge
  below the field-line-integration noise scale at high mpsi.

dpm[1,1] now converges τ-independently to ~9.2 (matching the uniform
mpsi ladder) at the default psi_accuracy=1e-3, vs the prior erratic
7.2–10.1. Equilibrium scalars are unchanged (grid-placement only).

The accuracy-driven density remains grid-dependent near the separatrix
(a real q/geometry singularity); that is tracked separately for a
self-consistent / one-pass grid redesign and does not affect this fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0125dY2qbGtm3gky8TPv7vh6
@logan-nc
logan-nc requested a review from d-burg August 1, 2026 01:05
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