ReMKiT1D -- A framework for building reactive multi-fluid models of the tokamak Scrape-Off Layer with coupled electron kinetics in 1D

Stefan Mijin, Dominic Power, Ryan Holden, W. A. Hornsby, D. Moulton, F. MilitelloComput. Phys. Commun 2023

TL;DR

This paper introduces ReMKiT1D, a flexible 1D framework for simulating the tokamak Scrape-Off Layer (SOL) by coupling multi-fluid and electron kinetic models. It addresses the need for efficient, adaptable tools to study complex plasma physics in this crucial region, enabling faster model development and exploration of kinetic effects.

What Problem Does This Paper Address?

The Scrape-Off Layer (SOL) of tokamaks is a complex region where plasma interacts with material surfaces, leading to a rich variety of plasma physics phenomena, including atomic and molecular reactions. Accurately modeling this region is crucial for understanding and controlling fusion devices. Traditional approaches often involve separate fluid or kinetic models, or simplified 0D collisional-radiative models. However, there's a growing need for flexible, unified frameworks that can handle the interplay between fluid and kinetic electron physics, as well as complex collisional-radiative processes, all within a computationally tractable 1D setting. This allows for rapid iteration on reduced models and detailed investigation of kinetic effects that influence transport and reaction rates.

Methods

ReMKiT1D is built upon a flexible, object-oriented design, primarily using Modern Fortran for its core computational engine and Python for user interaction and configuration. Key methodological aspects include:

  • Modeller-Model-Manipulator (3M) Pattern: An extension of the puppeteer pattern, this design separates concerns into Modellers (managing variables and communication), Models (grouping terms and data), and Manipulators (executing operations like integration). This promotes modularity and extensibility.
  • Object-Oriented Fortran: Leverages Fortran's capabilities for high-performance numerical computations, with a focus on reusable abstractions.
  • Python Interface: Provides a user-friendly way to configure simulations, define models, and analyze results, using JSON for configuration files and HDF5 for data output.
  • Calculation Trees (Derivations): Allows users to define complex variable relationships and transformations using Python expressions, which are then translated into efficient Fortran code.
  • PETSc Integration: Utilizes the PETSc library for solving large, non-linear systems of equations, particularly for implicit time-stepping, enabling efficient handling of stiff problems.
  • MPI Parallelism: Implements domain decomposition for spatial and harmonic dimensions to achieve scalability on high-performance computing systems.

Datasets

Not discussed in the paper. The paper focuses on the framework itself and its verification through established test cases and manufactured solutions, rather than training on specific datasets.

Key Insights and Ideas

  • Unified Framework for SOL Physics: The core insight is the development of a single framework that can seamlessly integrate multi-fluid, kinetic electron, and collisional-radiative models. This breaks down traditional silos between different modeling approaches.
  • Flexibility through Design: The Modeller-Model-Manipulator pattern and the Python interface are crucial for enabling rapid model development and iteration, a significant advantage for exploring complex plasma phenomena.
  • Bridging Python and Fortran: The use of JSON configuration files and expression tree derivations effectively bridges the gap between Python's ease of use for defining models and Fortran's performance for numerical computation.
  • Scalability for Kinetic Models: The novel harmonic dimension domain decomposition is shown to be critical for achieving good parallel performance in kinetic simulations, which are computationally more demanding.

Key Results

  • Verification: The framework has been extensively verified against analytical solutions and established benchmarks for fluid advection, MMS tests, kinetic advection, Coulomb collision operators (electron-electron, electron-ion), and collisional-radiative models.
  • Performance: Strong and weak scaling tests demonstrate good parallel performance, particularly for kinetic simulations, with speedups observed when utilizing the harmonic dimension parallelization. For example, kinetic simulations scale well up to 1024 cores on ARCHER2.
  • Model Flexibility: The framework successfully handles various problem classes, including fluid and kinetic equations, ODEs for collisional-radiative models, and hyperbolic conservation laws.

Limitations and Future Work

  • Dimensionality: The primary limitation acknowledged is the 1D nature of the framework, which is baked into many parts. Future work aims to explore the applicability of the 3M pattern to higher dimensions and different numerical methods.
  • Harmonic Basis Assumption: The framework currently assumes distribution functions are represented in a Legendre/Spherical Harmonic basis.
  • Shock Capturing: Shock-capturing methods are not yet implemented, though they are a planned addition.
  • Future Extensions: Planned extensions include full support for explicit Term objects, adaptive Boltzmann collision operator stencils, Python-level custom stencils for kinetic operators, and multi-linear interpolation for atomic data in CRM models. Further performance improvements are expected through more detailed PETSc integration (including GPU support) and more efficient data structures. The Python interface is also under active development to enhance user-friendliness.

Summary updated

Abstract

In this manuscript we present the recently developed flexible framework for building both fluid and electron kinetic models of the tokamak Scrape-Off Layer in 1D - ReMKiT1D (Reactive Multi-fluid and Kinetic Transport in 1D). The framework can handle systems of non-linear ODEs, various 1D PDEs arising in fluid modelling, as well as PDEs arising from the treatment of the electron kinetic equation. As such, the framework allows for flexibility in fluid models of the Scrape-Off Layer while allowing the easy addition of kinetic electron effects. We focus on presenting both the high-level design decisions that allow for model flexibility, as well as the most important implementation aspects. A significant number of verification and performance tests are presented, as well as a step-by-step walkthrough of a simple example for setting up models using the Python interface.
BibTeX
@article{mijin2023remkit,
  author = {Stefan Mijin and Dominic Power and Ryan Holden and W. A. Hornsby and D. Moulton and F. Militello},
  title = {{ReMKiT1D -- A framework for building reactive multi-fluid models of the tokamak Scrape-Off Layer with coupled electron kinetics in 1D}},
  journal = {Comput. Phys. Commun},
  year = {2023},
}
Figure