Replace bundled AMOS complex Bessel with fortnum (6/8)#145
Draft
krystophny wants to merge 1 commit into
Draft
Conversation
c16d13f to
f7ca693
Compare
0c81000 to
406cf38
Compare
406cf38 to
285980f
Compare
This was referenced Jun 14, 2026
69ae8e5 to
1d587bc
Compare
816ff96 to
174cbbb
Compare
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.
Merge order
These fortnum-migration PRs are individually based on
mainand form onecumulative 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 versusmainandoverlaps 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 itsown increment.
Scope
The headline removal: replace the bundled AMOS complex-argument Bessel sources with the fortnum complex-Bessel core. A new
common/math/fortnum_amos_compatmodule provideszbesj/zbesi/zbeskon the historical AMOS(ZR, ZI, FNU, KODE, N, CYR, CYI, NZ, IERR)ABI, so every caller compiles and links unchanged: the KiLCA wrappers (interface/bessel.f90,math/bessel/bessel.f90), the conductivity D-array kernels, the vacuum stitching (hmedium), the Maxwell start values, and the KIM dispersion solvers (fun_input,wkb_dispersion). Thezbes*family and its AMOS helpers (anddgamln, used only by them) are deleted fromcommon/math/slatec; the machine-constant and error routines stay for QUADPACK and ddeabm. The dead, never-compiledKiLCA/math/bessel/amosand/644trees are deleted.Dependency removed
Bundled AMOS
zbesj/zbesi/zbesk(common/math/slatecz*.f) and the SLATECzbesiused by KIM.Verification
The fortnum-backed shim computes the AMOS sequences correctly through the original ABI:
In the stack-tip build,
nmover every shipped binary shows 0 defined AMOS implementation symbols (zbknu zbinu zseri zmlri zasyi zacai zacon zunhj zunik zuoik zwrsk zbuni zbunk zairy zbesh zbesy zbiry dgamln zabsall 0), whilezbesi_/zbesj_/zbesk_resolve to the fortnum-backed shim and pullfortnum_bessel_i_complex_array/__fortnum_special_complex_bessel_MOD_*.test_ampere_matricesand the integration tests pass (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: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 k4cannot reproduce the GSLrk8pdgolden with DOP853 at the unchanged1e-8bar. See#143and#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.