Skip to content

Equilibrium - BUGFIX - Add a knot-density floor to the auto grid and set the rational bracket by resolution #525

Open

Description

@jhalpern30

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 tighter psi_accuracy does 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_min from 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

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:

Acceptance

  • Auto grid matches a fine fixed grid for Δ′ on the cases above to ≤1%.
  • Δ′ unchanged (≤1e-5) when singfac_min varies 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions