Skip to content

Migrate KiLCA roots, sort, multiroot to fortnum (5/8)#144

Draft
krystophny wants to merge 1 commit into
fortnum/k4-kilca-odefrom
fortnum/k5-kilca-roots-util
Draft

Migrate KiLCA roots, sort, multiroot to fortnum (5/8)#144
krystophny wants to merge 1 commit into
fortnum/k4-kilca-odefrom
fortnum/k5-kilca-roots-util

Conversation

@krystophny

@krystophny krystophny commented Jun 14, 2026

Copy link
Copy Markdown
Member

Merge order

These fortnum-migration PRs are individually based on main and form one
cumulative stack. Merge them in this order:

#140 -> #141 -> #142 -> #143 -> #144 -> #145 -> #146 -> #147 -> #148 -> #149 -> #150

Each PR is opened against main, so its diff is cumulative versus main and
overlaps its predecessors. Merging in the order above keeps the history linear:
once a predecessor merges into main, the next PR's diff shrinks to just its
own increment.

Scope

Route the remaining GSL solver and utility call sites onto the fortnum C ABI. The resonant-surface search (calc_mode) uses fortnum_root_brent; the eigenmode determinant zero search (calc_eigmode) uses fortnum_multiroot_hybrid with its internal central-difference Jacobian in place of the gsl_multiroot_fdfsolver hybridsj solver plus the hand-rolled eval_jac; the grid index sorts (calc_cond, sysmat_profs, adaptive_grid) go through a new sort_index_doubles helper wrapping fortnum_argsort. The gsl_vector residual and the unused GSL circle-integration helpers are removed.

Dependency removed

GSL roots (gsl_root_fsolver brent), multiroot (gsl_multiroot_fdfsolver hybridsj), gsl_deriv_central, and gsl_heapsort in KiLCA.

Verification

The fortnum root/multiroot/deriv/argsort signatures compile, link, and compute correctly:

$ g++ -std=c++14 -I.../fortnum/include probe.cpp libfortnum.a -lgfortran -o probe && ./probe
brent=1.41421 root2(1,2) deriv=2 perm=1,2,0

test_root_finding, test_ampere_matrices pass in the stack-tip ctest run (see K8). Draft: only the stack tip was built end to end.


Stack reconciliation (update)

The migration stack was rebuilt as a strictly linear cumulative chain on main 428a708:

k1 (+ golden CI fix) -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8 -> z1 -> z2 -> z3

Every branch now pins fortnum to main 974dcf1 (all kernel fixes plus both new integrators). This branch's standalone golden result above stands. The cumulative tip (#150 z3) does not pass: the KiLCA background equilibrium ODE on #143 k4 cannot reproduce the GSL rk8pd golden with DOP853 at the unchanged 1e-8 bar. See #143 and #150. Tolerances were not weakened and the stored golden was not regenerated.

Merge order: #140 -> #141 -> #142 -> #143 -> #144 -> #145 -> #146 -> #147 -> #148 -> #149 -> #150.

Note: fortnum pin updated to current main (92de6e9) after a fortnum history rewrite; old shas no longer resolve.

@krystophny krystophny force-pushed the fortnum/k5-kilca-roots-util branch from 0c757cd to 473b7b8 Compare June 15, 2026 19:27
@krystophny krystophny changed the base branch from main to fortnum/k4-kilca-ode June 15, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant