KN1DPy

A 1D-space, 2D-velocity kinetic neutrals code developed by B. LaBombard (MIT PSFC)

Published: Jul 22, 2026 by Ava Dean

Project info

licence LGPL-3.0

KN1DPy is a 1D-space, 2D-velocity kinetic neutrals code developed as a translation into Python from an original written in IDL.

The code was already in a well-mainted state. A set of tasks were identified to be completed, some by the current maintainers and some by the PlasmaFAIR team. The use of TOML files instead of JSON was implemented as the former are typically considered to be more human-readable than the latter. We highlighted the importance of keeping dependency specifications in the pyproject.toml file up to date with SPEC0 to ensure their versions do not drift.

We took examples already in use by the code and used them to develop a smart suite of regression tests, whereby stored output is compared against current. This utilised a PlasmaFAIR-developed package, snaptol. This package automates the process of storing, fetching and comparing the data. To accompany the tests, we also added a workflow to run the tests automatically on every push or pull request in to the repository. The ruff package was used to lint the code according to a defined set of rules. This cleaned up a large number of code smells, to better improve the consistency of the code, as well as to ensure it is less bug-prone. We also included a workflow to automate the linting. sphinx was used to automatically create a basic documentation structure. Smaller additions included script entry points and the use of optional dependencies in the pyproject.toml file.

This project was a great collection of all the tools and skills I’ve learnt as part of PlasmaFAIR up until now. We were able to complete the work effectively and efficiently. In the process of the software health check on this code, some extensions/updates were identified and implemented in the snaptol package, that this code now depended upon. This was a great development of one code that led to the development of another.

python kinetic plasma transport algorithm

Share