Repository navigation
Description
Problem
Two defects in the two-pass auto ψ grid (refined_psi_grid, src/Equilibrium/GridRefinement.jl) make Δ′ wrong or setting-dependent.
(a) No knot-density floor. Knots are placed only where measured curvature is high, so smooth equilibria get too few knots away from the rationals. Δ′ needs the coefficients resolved well beyond what the energies need.
- Solovev α 1.09 on the default auto grid: Δ′ = +48 against a converged −90.
- With a floor of 200 knots per unit ψ_N (
rho .= max.(rho, 200)): −90.3 ± 0.3% from 257 to 1012 knots, and et₁ returns to the converged 14.3009. - In a calibration over Solovev α 0.9–2.3, the auto grid without the floor gives a bad Δ′ (>10% error) at every α ≥ 1.05.
- A wider rational patch (
RATIONAL_RES_RADIUS) or a tighterpsi_accuracydoes not fix it.
(b) Bracket width tied to singfac_min. The knot-free bracket around each rational has half-width BRACKET_COEF · singfac_min / (n_min·|q′|) (BRACKET_COEF = 4), so the radial grid changes when the crossing/matching setting singfac_min changes.
- With
singfac_min≥ 1e-3 the 4× bracket is wide enough to under-resolve the coefficients next to the rational, and Solovev Δ′ goes wrong. - With a fixed bracket, Δ′ is flat in
singfac_minfrom 1e-4 to 3e-3 to ≤1e-5. - But too narrow a cell is also bad at high α: grid-point noise is amplified by w^(−2α). Solovev α 1.37: −702 at half-width 2.5e-4, −930 at 2e-3, −932 at 4e-3.
Proposed fix
- Floor the knot density
rhoat a fixed value (prototype: 200 per unit ψ_N) before equidistributing. - Bracket half-width = max(W₀, c ·
singfac_min/(n_min·|q′|)).singfac_minstays as the lower bound because the bracket must contain the Δ′ matching points (and, after ForceFreeStates - BUGFIX - Decouple the ideal-crossing jump width from singfac_min #481, the crossing legs). W₀ is likely ~1–2e-3.
Both are a few lines in refined_psi_grid.
What to do first: choose the numbers
The floor and W₀ above were measured on inputs that later turned out to be contaminated (DIII-D profiles before #506; field lines before #398). Re-choose both by scan on the corrected base:
- base: develop + Equilibrium - BUGFIX! - Build F and P of g-file and IMAS equilibria from the tabulated FF′ and p′ #506 + Equilibrium - BUGFIX! - Sample flux surfaces on common straight-fieldline angles, cap core EL knots, and suppress near-axis kinetic terms #398 (+ Equilibrium - BUGFIX - Converge PEST Δ′ in the radial grid #524 if it has landed);
- cases: DIII-D-like n = 1 Riccati, q = 2..5 (references with Equilibrium - BUGFIX! - Build F and P of g-file and IMAS equilibria from the tabulated FF′ and p′ #506 profiles: 5.84 / −7.97 / −18.70 / −3830 ± 40), and Solovev α 0.9–1.5;
- scan W₀ ∈ {5e-4, 1e-3, 2e-3, 4e-3} and floor ∈ {100, 200, 400}; pick the smallest values where Δ′ is flat to ≤1e-3 and knot count/runtime is acceptable.
Acceptance
- Auto grid matches a fine fixed grid for Δ′ on the cases above to ≤1%.
- Δ′ unchanged (≤1e-5) when
singfac_minvaries over 1e-4–1e-3. - Report knot count and runtime change on the harness cases. Auto-grid results move, so the PR takes
!and re-pins the harness.
Dependencies
- Choose the numbers after Equilibrium - BUGFIX! - Build F and P of g-file and IMAS equilibria from the tabulated FF′ and p′ #506 and Equilibrium - BUGFIX! - Sample flux surfaces on common straight-fieldline angles, cap core EL knots, and suppress near-axis kinetic terms #398 land.
- Keep the bracket ≥ the matching distance; coordinate with ForceFreeStates - BUGFIX - Decouple the ideal-crossing jump width from singfac_min #481 (crossing legs must sit inside the bracket) and ForceFreeStates - BUGFIX! - ⚠️ Keep both crossings of a rational surface on reverse-shear profiles #492 (reverse-shear double rationals share bracket logic).
Activity
logan-nc commentedon Oct 23, 2026
Closing. I tested the proposed fixes on current develop (with #398) and neither makes a difference that the data can support.
(a) Knot-density floor. The auto grid already had a floor of 5 knots per unit ψ_N. Raising it to 64 or 200, with Riccati Δ′ in hamada coordinates:
core_edge_packedgrids at 1024 and 2048 intervalsOn Solovev, the fixed-grid "references" don't converge either: −66 at 512 intervals, −100 at 1024, +789 at 2048 (
flux_surface_rtol = 1e-7). What shows up there is field-line tracing noise amplified at the surface, which is #524, not knot density. The original floor evidence was measured on inputs later found to be contaminated (before #506 and #398), and I could not reproduce a case where a floor helps. (p0facadds a constant to the pressure, so it does not change α; I did not reach the α ≥ 1.05 cases.)(b) Bracket tied to
singfac_min. In practice it isn't. The bracket half-width is the largest of4·singfac_min/(n|q′|),MIN_KNOT_SPACING, and half the local spacing. Within ±5e-3 of every rational, the near-rational patch holds the local spacing at 5e-4, so the half-width settles near 2.5e-4. That is the resolution-set W₀ proposed here.singfac_min= 1e-6 is identical to the one at 1e-4.Widening W₀ to 1–2e-3 would put each surface in a cell 4–8× wider than its neighbours. It would also run into the overlap check in #492 on dense edge rationals. The structural decoupling belongs to #481.
Follow-up for Solovev Δ′ convergence is #524.