FFS - NEW FEATURE - Certified adaptive psi grid for the calculated kinetic matrices - #410
Draft
logan-nc wants to merge 2 commits into
Draft
Conversation
…e-panel physics skeleton Replace the arbitrary constant-size decimation seed with the same structure the NTV psi quadrature panels at: rational windows, located kinetic-resonance surfaces (Omega_l = 0 via KineticForces.kinetic_resonance_psi_nodes -- one source of truth with the torque quadrature), and four interior points per inter-rational span (log-spaced in the axis span to match the core Frobenius structure). Warn loudly when certification exhausts max_rounds instead of returning silently. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzbLFQKyuRE5DYZmLokKmk
DIII-D auto-grid runs exhaust 6 rounds in the core spans (warned as designed); 10 rounds lets the certificate reach the spacing floors. Docstring now describes the physics-skeleton seed instead of the removed decimation seed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzbLFQKyuRE5DYZmLokKmk
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.
Stacked on #408 (base branch
performance/decoupled-el-matrix-grid; a force-push trimming that branch back to the cap commits is pending, until then this diff shows only the seed-rework commit).What
Adds
kinetic_grid_tol([ForceFreeStates], default 0 = off, bit-identical to today when off): whenkinetic_source = "calculated", the expensive bounce-average kernel is driven over a certified adaptive ψ grid instead of every equilibrium knot.tol · max|T|), including the adjoint combinationkw₃ − kt₃— never the kinetic increments in isolation.kinetic_resonance_psi_nodes, one source of truth with the torque quadrature), and four interior points per inter-rational span (log-spaced in the axis span, matching the core Frobenius structure).Threads.@threadskernel pattern is untouched). Spacing floors: the Frobenius cap in the core,RATIONAL_RES_SPACINGoutside, ÷4 inside rational windows (anti-aliasing where layers are expected). Certification exhaustion warns loudly with the first uncertified location.psiskwarg through the KineticForces callback); everything else sizes from it.Why
The shipped calculated-kinetic decks run
mpsi = 16and carry percent-level interpolation error on the B/C total matrices (ε 6.8e-2 → 5.8e-4 across a 16/64/256 ladder — mostly unresolved real structure, not noise). At production grids the kernel costs ~1.3 s/surface: minutes of matrix formation spent on knots the totals don't need, while coarse decks are silently under-resolved. Certification fixes both directions: it adds knots where the deck is starved and skips them where the equilibrium grid over-packs.Evidence
regress --cases solovev_kinetic_calculated,solovev_kinetic_ntv,solovev_kinetic_nuzero,diiid_n1 --refs performance/decoupled-el-matrix-grid,local→ 81/81 tracked quantities unchanged.handoff/issue376/RESULTS.md§28. Summary: the DIII-D kinetic-calculated configuration (never run before) is pathological on the full grid too — 223k EL steps (94% at ψ<0.01) and 17.5 GB solution dumps. A discriminator run (kernel tolerance ×10 tighter) reproduces the full-grid et[1] to 2.7e-7 with steps unchanged, so the pathology is real near-axis structure, not kernel noise: the calculated kinetic increments diverge toward the axis (~ψ^−0.7; the kernel has no near-axis validity clamp). The certified grid smooths that structure (et[1] off by 17→14% across the tol ladder, converging toward the full-grid value with cost exceeding the full grid). Two design consequences recorded for the fix: certify the post-Schur matrices the ODE consumes (f0/K/G amplify the raw-increment certificate ~20×), and the Frobenius core floor is unjustified for kinetic increments. A denser-equilibrium-grid check confirms the full-grid reference is converged (1.6e-4), so the certified deviation is unambiguously certification error; the identified design flaw is the certificate's GLOBAL max|T| scale, which is blind to the small-amplitude but dynamically dominant near-axis structure (1.6e-4 of the G scale, yet 94% of the ODE work). The blocking question is physics: should the drift-kinetic contribution be tapered/cut near the axis where the model degenerates? If yes, both the step pathology and the certification failure disappear together.🤖 Generated with Claude Code
https://claude.ai/code/session_01LzbLFQKyuRE5DYZmLokKmk