[math-06] Verify equilibrium and plasma-background formulas#218
[math-06] Verify equilibrium and plasma-background formulas#218marjohma wants to merge 3 commits into
Conversation
|
Review (standards + spec vs #198) — keeping this in draft. Two distinct things are bundled here, and they deserve different fates. 1. Undisclosed production-numerics changes (the main reason for the hold). Four real fixes hide inside a
These all look physically right — and the new KIM oracle test genuinely exercises production 2. Verification-layer gaps (the recurring family pattern).
Genuine wins worth keeping as-is: derivatives-after-periodization is properly verified against production ( Minor: two >100-col lines in |
Review follow-ups for #187: - Oracle assertions now compare per-row RELATIVE (rows committed as exactly zero must stay exactly zero). The old max(1,|expected|) scaling made every rho-B row (magnitudes 1e-14..1e-22) vacuous: a stubbed-zero fp_rho_B_harmonic passed the oracle subtest. With the fix, a mutation battery of sign, 4*pi, Fourier phase, Bessel order, and ks^2 each fails the ctest; the pristine kernel's maximum scaled error is 6.4e-14 against the predeclared 1e-12 tolerance. - The enforced oracle immediately caught a real defect: the speed of light in constants_mod lacked _dp and was rounded through single precision (29979246592 vs 29979245800, 2.6e-8 relative), exactly the rho-B mismatch observed. Fixed here (same correction as #218 carries); every c-dependent result shifts by ~2.6e-8, so the golden baseline needs a re-bless. - fp_rho_phi_harmonic/fp_rho_B_harmonic take rho_L as an explicit argument instead of recomputing abs(vT/omega_c); hatG_* pass the stored species rho_L, so ion_flr_scale_factor acts on the off-diagonal path exactly as on the diagonal one (regression test added). - fp_ks_model is now configurable: KIM_CONFIG key fp_ks_model_name ('kperp_full' default, 'kr_only' legacy approximation), mapped in kim_read_config with a hard error on unknown names; documented in both shipped nmls and KIM/README.md including the default-behavior change relative to the old kern_include_ks2=.false. - New fp_mphi_truncation_check validation gate (fails closed on unassessable sums) with a slow-decay negative fixture; infinite on-axis ks negative fixture; kernel tests restore the production default model; FORMULA_INDEX rho-B/KIM-05/KIM-06 claims reworded to what is actually verified (the rho-B WL entry remains a transcription; an independent K^{rho B} derivation pass is still open).
## Summary - report reciprocal condition estimates and scaled backward errors for dense solves - reject singular, non-finite, ill-conditioned, and inaccurate systems with explicit statuses - turn quadrature, Fourier, harmonic, deformation, and cross-method tolerances into nonzero test exits ## Why Numerical trust failures are visible and cannot be mistaken for accepted physics. ## Validation Validated cumulatively at the stack head: - `cmake --build build -j2` - `ctest --test-dir build -E 'test_rhs_balance|test_periodic_convergence|test_periodic_vs_global' --output-on-failure` — 35/35 passed Known red gates are intentionally excluded from that command: the pre-existing `test_rhs_balance` baseline failure, the periodization-deformation acceptance gate, and the unresolved periodic-vs-global 5% agreement gate. ## Stack Base: `fix/kim-fp-198-equilibrium-oracle` Head: `fix/kim-fp-189-numerical-gates` Closes #189
Summary
Why
Both solvers use source-checked equilibrium quantities with consistent units and species sums.
Validation
Validated cumulatively at the stack head:
cmake --build build -j2ctest --test-dir build -E 'test_rhs_balance|test_periodic_convergence|test_periodic_vs_global' --output-on-failure— 35/35 passedKnown red gates are intentionally excluded from that command: the pre-existing
test_rhs_balancebaseline failure, the periodization-deformation acceptance gate, and the unresolved periodic-vs-global 5% agreement gate.Stack
Base:
fix/kim-fp-188-matched-bvpHead:
fix/kim-fp-198-equilibrium-oracleCloses #198