EQUIL - BUGFIX - Fix ideal Δ′ non-convergence on the auto psi-grid - #350
Open
logan-nc wants to merge 1 commit into
Open
EQUIL - BUGFIX - Fix ideal Δ′ non-convergence on the auto psi-grid#350logan-nc wants to merge 1 commit into
logan-nc wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The two-pass auto psi-grid (
grid_type = "auto") produced a non-convergent ideal Δ′: aspsi_accuracytightened, the Δ′ diagonal oscillated erratically (dpm[1,1] ≈ 7.2–10.1 on theDIII-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 thesingular 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.
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 defaultpsi_accuracy = 1e-3land on the converged value.enforce_min_spacingfloor on the auto refined grid and the fixedldp/pow1grids, so nogrid 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-3included, vs the prior erratic 7.2–10.1. Equilibrium scalars are unchanged(q95, β_n = 0.00%) — this is grid placement only.
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
developbecomes the new baseline on merge.Scope / follow-ups
singularity; the default converges to the uniform reference, ~3% above the ldp reference).
That is out of scope here and tracked in Auto psi-grid: accuracy-driven density is grid-dependent — pursue a self-consistent / one-pass construction #349 (self-consistent / one-pass grid redesign).
kinetic_factor > 0spot-check (the ideal deck haskinetic_factor = 0,and the near-rational knots' rationale is the kinetic-MHD path).
feature/tearing-growthrates(Feature: add SLAYER and GGJ tearing growth rates #238)if approved.
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