Skip to content

Replace ZEAL with fortnum complex_region_roots in WKB dispersion (Z1)#148

Open
krystophny wants to merge 1 commit into
fortnum/k8-plumbingfrom
fortnum/z1-zeal-region-roots
Open

Replace ZEAL with fortnum complex_region_roots in WKB dispersion (Z1)#148
krystophny wants to merge 1 commit into
fortnum/k8-plumbingfrom
fortnum/z1-zeal-region-roots

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.

First of three stacked PRs (Z1-Z3) that finish removing the avoidable upstream numerical dependencies from KIM onto fortnum, completing the GSL/AMOS/SLATEC/QUADPACK removal. Base of this PR is the fortnum k8-plumbing tip (PR #147).

What changed

run_ZEAL_dispersion drove the bundled ZEAL package (zeal(), set_zeal_search_region, the Zeal_Module/Zeal_Input_Module/Function_Input_Module triple, VALREG, and the netlib dqagx contour quadrature) to find the complex zeros of the kinetic dispersion relation over a rectangular search box. It now drives fortnum complex_region_roots over the same box (center +/- halfwidth maps to the ll/ur corners). The per-branch focused search, the broad search, multiplicities, and the WKB_dispersion_solver='ZEAL' config option are preserved; only the dependency internals change.

The KIM dispersion functions move onto the fortnum complex_root_fn_t ABI via the dispersion_region_fn adapter. Function_Input_Module drops its Precision_Module dependency (uses KIM_kinds_m) and the ZEAL-only VALREG. zeal_input.f90, test_zeal.f90, FetchZeal.cmake, the external_zeal source set, and the now-unused dqagx source are removed.

fortnum is pinned to 38a5110, which provides complex_region_roots and the LAPACK-backed eigensolve, guarded by if(NOT TARGET fortnum).

Verification

Full CMake/Ninja build at the stack tip (fortnum 38a5110), then ctest. The new test_region_roots_vs_muller cross-checks that complex_region_roots and the in-tree Muller solver return the same zeros on one analytic test function to within 1e-6.

Before (on the base branch the ZEAL package is fetched and compiled; no region/Muller equivalence test exists).

After:

$ ./build/tests/test_region_roots_vs_muller.x
 Region/Muller equivalence OK:            3  shared zeros within   9.9999999999999995E-007
   zero            1  =  (-2.0000000000000000,1.0000000000000000)  mult 1
   zero            2  =  (0.25000000000000000,-1.7500000000000000) mult 1
   zero            3  =  (1.5000000000000000,0.50000000000000000)  mult 1

$ ctest
100% tests passed, 0 tests failed out of 19

$ nm build/install/bin/KIM.x | grep -ciE 'zeal_module|zeal_input_module|valreg|set_zeal_search'
0

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/z1-zeal-region-roots branch from 00e2522 to 85718ca Compare June 15, 2026 19:28
@krystophny krystophny changed the base branch from main to fortnum/k8-plumbing 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