Scope
KAMEL is MIT-licensed but fetches and links GSL 2.4 (GPL-2.0+) through cmake/FetchGSL.cmake, and vendors several copies of special-function, quadrature, and ODE code with mixed provenance. fortnum replaces the generic numerics: special functions behind the direct GSL bindings, adaptive quadrature, generic ODE/RK steppers, and duplicate Lagrange-interpolation helpers. It also gives a clean-room home for the vendored Bessel, error-function, and hypergeometric code that currently has uncontrolled licensing. Domain physics stays in KAMEL: the KIM kinetic integrands, the KiLCA mode and conductivity solvers, and the equilibrium and Fourier preprocessing.
Planned leaves
| leaf |
replaces |
needs |
model |
| special functions to fortnum_special |
KIM/src/math/gsl_mod.f90 |
fortnum M1 (special) |
sonnet |
| drop GSL fetch glue |
cmake/FetchGSL.cmake |
after special/quadrature leaves merge |
sonnet |
| quadrature and ODE replacement |
KIM/src/math/quadpack_integration_m.f90, KIM/src/math/quadpack_compat_xerror.f90, KIM/src/kernels/integrals.f90, KIM/src/kernels/integrals_adaptive.f90, KIM/src/kernels/integrands_adaptive.f90, KIM/src/math/ddeabm/*, KiLCA/math/odeint_allroutines.f, KiLCA/solver/VER_5_STABLE/odeint_allroutines.f, KiLCA/flre/conductivity/odeint_allroutines.f, common/equil/rk4_integrator.f90, PreProc/fourier/src/rk4dc.f90 |
fortnum M2 (ode), M4 (integrate) |
opus |
| dedupe Lagrange interpolation to fortnum_interp |
KIM/src/util/plag_coeff.f90, QL-Balance/src/base/plag_coeff.f90, KiLCA/solver/VER_5_STABLE/plag_coeff.f90 |
fortnum M3 (interp) |
sonnet |
Provenance-audit pre-leaves
Each vendored special-function tree needs a provenance and license audit before any port. The audit is one pre-leaf per tree (opus); the replace-vs-vendor decision per #291 (clean-room fortnum_special, or deliberate vendoring with explicit license and tests) is a separate decision leaf (fable).
| pre-leaf (provenance-audit) |
paths |
model |
| AMOS Bessel |
KiLCA/math/bessel/amos/* |
opus |
| TOMS 644 Bessel |
KiLCA/math/bessel/644/* |
opus |
| SLATEC support |
common/math/slatec/* |
opus |
| libcerf |
KIM/src/math/libcerf-main/*, KIM/src/math/use_libcerf_mod.f90 |
opus |
| confluent hypergeometric |
KiLCA/math/hyper/hyper1F1.cpp |
opus |
Leaf issues are created from this table only once the named fortnum milestone is closed. Until then this tracker is the only issue.
Execution conventions
Model ladder (implementation):
- haiku: label/milestone housekeeping, checklist updates, re-export boilerplate. No algorithms.
- sonnet: fully specified ports (source path + SHA given), wrappers, CI fixes with a clear failing log.
- opus: build-system and CI scaffolding, multi-file refactors, ports that change APIs.
- fable: API design issues, clean-room algorithm work, review of opus-implemented PRs.
Review ladder: sonnet PRs reviewed by opus; opus PRs reviewed by fable; haiku changes gated by CI only.
PR rules:
- One leaf issue = one PR. Branch from the base named in the issue.
- PR title = issue title. Body:
Closes #N plus a ## Verification section with real failing-before and passing-after output.
- Squash merge. Stacked PRs only where the issue names a non-main base.
Executor rule: if any issue under "Blocked by" is open, stop and report instead of starting.
Umbrella
itpplasma/libneo#291
Original report
Problem
KAMEL is MIT-licensed. It links GSL (GPL-2.0+) at build time via cmake/FetchGSL.cmake, which downloads and compiles GSL 2.4. Any binary that links KAMEL is subject to GPL obligations, which contradicts the MIT grant.
Affected files
KiLCA (C++)
| File |
GSL usage |
KiLCA/math/adapt_grid/adaptive_grid.cpp |
gsl_heapsort_index, gsl_integration_workspace, gsl_integration_qag |
KiLCA/math/fourier/four_transf.cpp |
gsl_integration_qag |
KiLCA/eigmode/calc_eigmode.cpp, calc_cond.cpp, sysmat_profs.cpp, others |
GSL errno, integration |
KiLCA/imhd/incompressible.cpp, compressible_flow.cpp, imhd_zone.cpp |
integration, special functions |
KiLCA/mode/calc_mode.cpp, QL-Balance/src/base/vel_integral.cpp |
integration |
KIM (Fortran)
KIM/src/math/gsl_mod.f90 defines direct C-bind interfaces to:
gsl_sf_bessel_In (modified Bessel I of integer order)
gsl_sf_erf, gsl_sf_erfc
gsl_sf_dawson
These are used in integrands.f90, integrands_adaptive.f90, FLR2_asymptotics.f90, numerics_utils.f90.
Replacement directions
- heapsort: replace
gsl_heapsort_index with std::sort + an index array using <algorithm> (no dependency).
- QAG adaptive integration: QUADPACK from Netlib (public domain) via a thin C or Fortran wrapper, or a self-contained Gauss-Kronrod 15/31-point rule.
- GL fixed quadrature: compute Gauss-Legendre nodes and weights in-tree with the Golub-Welsch algorithm (<50 lines).
- Bessel In: the C99 standard library does not cover this; Boost.Math (BSL-1.0) or the AMOS library (Netlib, public domain) are permissively licensed replacements.
- erf/erfc: these are C99 standard functions in
<math.h>; drop the GSL wrappers and call erf/erfc directly.
- Dawson: implement the Rybicki (1989) algorithm in-tree (~30 lines) or use Cephes (BSD-compatible).
Build system
Remove cmake/FetchGSL.cmake and its invocation from cmake/Dependencies.cmake once all call sites are replaced. Remove KIM/src/math/gsl_mod.f90 when no callers remain.
Scope
KAMEL is MIT-licensed but fetches and links GSL 2.4 (GPL-2.0+) through
cmake/FetchGSL.cmake, and vendors several copies of special-function, quadrature, and ODE code with mixed provenance. fortnum replaces the generic numerics: special functions behind the direct GSL bindings, adaptive quadrature, generic ODE/RK steppers, and duplicate Lagrange-interpolation helpers. It also gives a clean-room home for the vendored Bessel, error-function, and hypergeometric code that currently has uncontrolled licensing. Domain physics stays in KAMEL: the KIM kinetic integrands, the KiLCA mode and conductivity solvers, and the equilibrium and Fourier preprocessing.Planned leaves
KIM/src/math/gsl_mod.f90cmake/FetchGSL.cmakeKIM/src/math/quadpack_integration_m.f90,KIM/src/math/quadpack_compat_xerror.f90,KIM/src/kernels/integrals.f90,KIM/src/kernels/integrals_adaptive.f90,KIM/src/kernels/integrands_adaptive.f90,KIM/src/math/ddeabm/*,KiLCA/math/odeint_allroutines.f,KiLCA/solver/VER_5_STABLE/odeint_allroutines.f,KiLCA/flre/conductivity/odeint_allroutines.f,common/equil/rk4_integrator.f90,PreProc/fourier/src/rk4dc.f90KIM/src/util/plag_coeff.f90,QL-Balance/src/base/plag_coeff.f90,KiLCA/solver/VER_5_STABLE/plag_coeff.f90Provenance-audit pre-leaves
Each vendored special-function tree needs a provenance and license audit before any port. The audit is one pre-leaf per tree (opus); the replace-vs-vendor decision per #291 (clean-room fortnum_special, or deliberate vendoring with explicit license and tests) is a separate decision leaf (fable).
KiLCA/math/bessel/amos/*KiLCA/math/bessel/644/*common/math/slatec/*KIM/src/math/libcerf-main/*,KIM/src/math/use_libcerf_mod.f90KiLCA/math/hyper/hyper1F1.cppLeaf issues are created from this table only once the named fortnum milestone is closed. Until then this tracker is the only issue.
Execution conventions
Model ladder (implementation):
Review ladder: sonnet PRs reviewed by opus; opus PRs reviewed by fable; haiku changes gated by CI only.
PR rules:
Closes #Nplus a## Verificationsection with real failing-before and passing-after output.Executor rule: if any issue under "Blocked by" is open, stop and report instead of starting.
Umbrella
itpplasma/libneo#291
Original report
Problem
KAMEL is MIT-licensed. It links GSL (GPL-2.0+) at build time via
cmake/FetchGSL.cmake, which downloads and compiles GSL 2.4. Any binary that links KAMEL is subject to GPL obligations, which contradicts the MIT grant.Affected files
KiLCA (C++)
KiLCA/math/adapt_grid/adaptive_grid.cppgsl_heapsort_index,gsl_integration_workspace,gsl_integration_qagKiLCA/math/fourier/four_transf.cppgsl_integration_qagKiLCA/eigmode/calc_eigmode.cpp,calc_cond.cpp,sysmat_profs.cpp, othersKiLCA/imhd/incompressible.cpp,compressible_flow.cpp,imhd_zone.cppKiLCA/mode/calc_mode.cpp,QL-Balance/src/base/vel_integral.cppKIM (Fortran)
KIM/src/math/gsl_mod.f90defines direct C-bind interfaces to:gsl_sf_bessel_In(modified Bessel I of integer order)gsl_sf_erf,gsl_sf_erfcgsl_sf_dawsonThese are used in
integrands.f90,integrands_adaptive.f90,FLR2_asymptotics.f90,numerics_utils.f90.Replacement directions
gsl_heapsort_indexwithstd::sort+ an index array using<algorithm>(no dependency).<math.h>; drop the GSL wrappers and callerf/erfcdirectly.Build system
Remove
cmake/FetchGSL.cmakeand its invocation fromcmake/Dependencies.cmakeonce all call sites are replaced. RemoveKIM/src/math/gsl_mod.f90when no callers remain.