KAMEL is a collection of research codes for kinetic plasma response and quasilinear transport in fusion plasmas. The repository provides one CMake build for three coupled solvers, their preprocessing tools, and Python interfaces.
| Component | Purpose | Documentation |
|---|---|---|
| KiLCA | Cylindrical kinetic response solver with finite-Larmor-radius effects | KiLCA/README.md |
| KIM | Non-local integral plasma-response model, including global and forced-periodic electrostatic solvers | KIM/README.md |
| QL-Balance | One-dimensional quasilinear transport solver using KIM or KiLCA response fields | QL-Balance/README.md |
Supporting directories include:
PreProc/— Fourier-mode and NEO-2 preprocessing tools.python/— KAMELpy interfaces and analysis utilities.common/— shared equilibrium, HDF5, logging, and numerical code.test/golden/— physics-output regression tests for all three solvers.
KIM run types include electrostatic, forced-periodic electrostatic,
electromagnetic, WKB dispersion and second-order local FLR (flr2) runs; see
the KIM namelist reference for options and restrictions.
Data flow between the codes, file formats and units are described in
Data.md.
The complete build requires:
- CMake 3.24 or newer, Ninja, Git, and a POSIX build environment.
- C, C++, and Fortran compilers with OpenMP support.
- BLAS and LAPACK.
- SuperLU (used by KIM).
On Ubuntu 24.04 or newer (Ubuntu 22.04 ships CMake 3.22, which is too old):
sudo apt-get install git make cmake ninja-build gcc g++ gfortran \
libopenblas-dev liblapack-dev libsuperlu-dev python3-venvOn macOS, install the Xcode command line tools (xcode-select --install) and
then, with Homebrew:
brew install cmake ninja gcc llvm libomp openblas lapack superluThe build picks up Homebrew's LLVM clang and GNU Fortran automatically. CI
installs exactly these packages, so the lists stay tested.
The first configuration needs network access. CMake fetches pinned or selected versions of fortnum, fortio, SUNDIALS, SuiteSparse, and libneo. HDF5 and NetCDF files are read and written through fortio, so the native HDF5 and NetCDF libraries are not linked. The complex error function library libcerf is bundled in KIM. Python is optional for the compiled solvers but required for the Python interfaces (see Python interface).
CI builds and tests on Ubuntu (GNU compilers) and on macOS with Homebrew (GNU Fortran, LLVM OpenMP).
From the repository root:
git clone https://github.com/itpplasma/KAMEL.git
cd KAMEL
make allThe Makefile is a thin wrapper around the unified CMake/Ninja build. Common targets are:
make KIM # build KIM.x
make KiLCA # build the KiLCA executables
make QL-Balance # build ql-balance.x
make PreProc # build the Fourier preprocessing program
make cleanExecutables and libraries are written below build/install/; the principal
executables are:
build/install/bin/KIM.x
build/install/bin/KiLCA_Normal_...
build/install/bin/ql-balance.x
For direct CMake use, the equivalent release build is:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallelDependency commits are pinned in cmake/DependencyPins.cmake and added
through ItpDeps. To build another
branch, tag, or commit of a dependency, pass -DITP_<NAME>_REF=<ref> to CMake,
e.g. -DITP_LIBNEO_REF=<ref>. To use a local checkout, pass
-DFETCHCONTENT_SOURCE_DIR_<NAME>=<dir>. With make, put these flags in
CMAKE_ARGS, e.g. make all CMAKE_ARGS=-DITP_LIBNEO_REF=<ref>. They only take
effect on a fresh configure, so run make clean first if build/ exists.
The tutorials walk through complete, tested example runs of KIM (with and without Python), KiLCA and QL-Balance. Each runs in seconds.
Each solver expects a prepared run directory; the example namelists in
KIM/nmls/ and QL-Balance/namelists/ describe the configuration format but
are not self-contained plasma datasets.
KIM accepts the namelist path as its first argument:
build/install/bin/KIM.x /path/to/KIM_config.nmlFor the supported Python workflow (electrostatic, forced-periodic electrostatic, and FLR2), use
the kim package (installation: Python interface):
kim --help
kim validate /path/to/request.json
kim run /path/to/request.json --executable /absolute/path/to/KIM.xSee the Python API guide and
request JSON guide. The Python API initially supports r_eff
profiles in CGS units and requires HDF5 output. Additional Fortran run modes are documented in the
namelist reference.
Run the versioned KiLCA_Normal_... executable from a directory containing a
complete KiLCA input set. The
python/KiLCA_interface/ package is the recommended
way to prepare and manage those runs.
QL-Balance reads balance_conf.nml from its working directory:
cd /path/to/run-directory
/path/to/KAMEL/build/install/bin/ql-balance.xThe template is QL-Balance/namelists/balance_conf.nml.
Build and run the CTest suite with:
make testThe golden-record suite compares the current physics output with the frozen
golden-baseline tag. It is intentionally separate because it performs two
complete builds:
make goldenSee test/golden/README.md before adding a case or
re-blessing the baseline.
make pytest runs the Python checks for the golden-record harness, the
periodic workflow configuration, and the consistency of the KIM namelist
reference with the source.
KAMEL has two Python packages: kim for KIM (in KIM/python) and KAMELpy
for QL-Balance and KiLCA (in python/). Both need Python 3.10 or newer.
Install them in editable mode into a virtual environment from the repository
root:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ./KIM/python -e ./pythonEditable installs find the executables in build/install/bin/ of this
checkout. See python/README.md and the
KIM Python API guide for usage.
The build stages its executables and libraries below build/install. The
kim command belongs to the kamel-kim Python package; the solver executable
is KIM.x. If an older setup left a kim alias or symlink pointing to KIM.x,
remove it so that the Python command is found (command -v kim).
Design notes, implementation plans, benchmark records and verification
reports are collected in docs/.
See CONTRIBUTING.md for the development workflow and
formatting requirements. KAMEL is academic research software; numerical
changes should include focused tests and must pass the physics golden record
when they intentionally affect solver output.
KAMEL is licensed under the MIT License. See LICENSE.