Evolve KiLCA background and imhd ODEs continuously with fortnum rk8pd (4/8)#143
Evolve KiLCA background and imhd ODEs continuously with fortnum rk8pd (4/8)#143krystophny wants to merge 3 commits into
Conversation
bde806b to
d730a8c
Compare
e8525fb to
a612cb8
Compare
a612cb8 to
b8d5044
Compare
b8d5044 to
411de6d
Compare
Diagnosis of the ql-balance golden divergenceBisection over the migration chain (golden record built from
Root causeThe KiLCA background ODE was tuned against Two genuine GSL-fidelity gaps in fortnum rk8pd were found and fixed upstream ( VerdictThe 1e-8 golden, recorded from the exact GSL binary, is unachievable for any clean-room ODE backend on this consumer - analogous to the golden-is-inferior/over-tight situation flagged elsewhere, here driven by amplification rather than reference inaccuracy. Options: (a) regenerate the golden from the fortnum-backed build and keep 1e-8 as a fortnum-vs-fortnum regression gate, or (b) relax the bar for the linear-response quantities to a physically meaningful level (~1e-5). No tolerance was weakened and no golden regenerated as part of this investigation. Companion branch |
calc_back's background equilibrium ODE was tuned against GSL gsl_odeiv_step_rk8pd under gsl_odeiv_control_y_new, run as one continuous adaptive evolve carrying the step across the radial grid. The per-segment dop853 path reset the integrator at every grid point and uses a different 8(7) error norm. Replace it with fortnum's GSL-faithful rk8pd C ABI (fortnum_rk8pd_create / integrate_to / destroy), evolving continuously with the golden initial step h0 = x[1]-x[0]; the background profile is now bit-identical to the golden's GSL rk8pd output. incompressible.cpp / compressible_flow.cpp stay on dop853. Re-pin fortnum to the main commit carrying rk8pd and its C ABI.
The incompressible and compressible-flow imhd zone basis solvers built their radial grid from the original gsl_odeiv_evolve_apply loop under gsl_odeiv_control_y_new(eps_abs, eps_rel): one continuous rk8pd evolve that stored every accepted step. The dop853 replacement reset per segment, used a different 8(7) error norm, and produced a different accepted-step mesh. Evolve continuously with fortnum's rk8pd C ABI, recording each accepted step via fortnum_rk8pd_step_to (one gsl_odeiv_evolve_apply per call), starting from h0 = 1e-6 in the integration direction as the original did. Re-pin fortnum to the main commit carrying the single-step rk8pd ABI and the GSL std_control / yerr fidelity fixes.
a815666 to
6147eff
Compare
Replace the GSL rk8pd ODE evolve in KiLCA's background equilibrium solver with a clean-room, GSL-faithful fortnum integrator, used continuously across the radial grid.
Background
calc_back's background equilibrium ODE was tuned against GSL
gsl_odeiv_step_rk8pdundergsl_odeiv_control_y_new(1e-16, 1e-16), run as one continuous adaptive evolve. The interim per-segment dop853 path reset the integrator at every grid point and uses a different 8(7) error norm, so it can drift from the recorded golden near a near-resonant grid point.This PR adds a re-entrant Prince-Dormand RK8(7)13M stepper to fortnum (
fortnum_ode_rk8pd) with the GSL standard controller and a re-entrant evolve state, exposes it through a C ABI (fortnum_rk8pd_create/fortnum_rk8pd_integrate_to/fortnum_rk8pd_destroy), and rewires calc_back to evolve its background ODE continuously with it. incompressible.cpp and compressible_flow.cpp stay on dop853.Verification
fortnum unit + C-ABI tests green (74/74 ctest, capi smoke incl. re-entrant decay).
fortnum rk8pd validated against the real GSL 2.8 library on the calc_back background RHS, continuous evolve at eps_abs=eps_rel=1e-16:
KAMEL
ql-balance_golden_record(rtol=1e-8, atol=1e-15, golden from main 45e4afa):sqg_btheta_overc,Er,Vth,Vz,n,Te,Tiall match the golden with maxabsdiff = 0. The same holds under the previous dop853 tip for this AUG f_6_2 case.dqle11,Brat LinearProfiles iteration 0, where the background is bit-exact), which the QL-balance iteration amplifies to O(1) by iteration 8. This divergence is present identically under the dop853 tip; it lives in the fortnum quadrature / special-function replacements, not in calc_back.So this PR closes the calc_back ODE component (background bit-faithful to the golden's GSL rk8pd). The remaining golden gap is a different fortnum-vs-GSL component, addressed elsewhere. No golden regeneration, no tolerance change.
KAMEL build is clean: calc_cond.cpp, sysmat_profs.cpp, adaptive_grid.cpp, calc_back.cpp all compile (the files use
gsl_heapsort_index; nosort_index_doublessymbol break).fortnum commits:
b3f514e(rk8pd integrator + tests),86c2878(rk8pd C ABI).Note: fortnum pin updated to current main (92de6e9) after a fortnum history rewrite; old shas no longer resolve.