Struphy

Struphy is an open-source Python package for the numerical solution of fluid, kinetic and hybrid plasma models. Fields are discretized with structure-preserving (geometric) finite elements and kinetic species with particle-in-cell methods.

Toroidal wireframe Tokamak domain generated with Struphy

Loading interactive domain…

Tokamak domain generated with Struphy.Drag to rotate · Scroll to zoom · Shift-drag to pan

Overview

Struphy provides a common interface for fluid, kinetic and hybrid plasma models, together with the discretization, time stepping and post-processing tools needed to run them.

Discretization

Fields are represented in B-spline finite element spaces forming a discrete de Rham complex. Kinetic species are represented by weighted markers (particle-in-cell), with an optional δf method.

Models

Fluid, kinetic and hybrid models are composed from shared propagators, so that the same substeps are reused across models.

Geometry

Simulations run on mapped domains, including Cartesian, cylindrical and toroidal geometries, and on domains generated externally.

Implementation

The interface is written in Python; performance-critical kernels are compiled. A simulation is defined by a model, a domain, an equilibrium, perturbations and numerical parameters, which are stored together with the output.

Numerical methodsSearch the catalogueCitation and reproducibility

What "structure-preserving" means

The equations of plasma physics have structural properties such as conservation of energy and mass and the divergence-free condition on the magnetic field. Standard discretizations satisfy these only up to truncation error, which can accumulate over long simulations. Struphy builds its finite element discretization on a discrete de Rham complex, for which the vector-calculus identities underlying these properties, such as ∇·(∇×A) = 0, hold at the discrete level up to round-off and not only in the limit of vanishing grid size. Conservation of energy additionally depends on the time discretization.

The discrete de Rham complexFour compatible finite-element spaces are connected by the gradient, curl, and divergence operators: H1 maps to H(curl) via grad, H(curl) maps to H(div) via curl, and H(div) maps to L2 via div. Because these discrete spaces and operators commute exactly with their continuous counterparts, identities such as curl grad equals zero and div curl equals zero hold to machine precision, not just approximately.scalar potentialsH(curl)electric fieldH(div)magnetic fieldmass densitygradcurldiv
Discrete fields are elements of compatible finite element spaces connected by discrete operators, so that identities such as ∇·(∇×A) = 0 hold to round-off.

Models

Struphy supports three classes of plasma models, all built on the same discretization.

Fluid

Maxwell, MHD and multi-fluid models, discretized with compatible finite elements.

Kinetic

Vlasov and drift-kinetic models, represented by markers (particle-in-cell).

Hybrid

Coupled field–particle models, including MHD-kinetic models.

Quick start

Install Struphy and compile its kernels.

A simulation is defined by a model, a domain and grid, the discretization parameters and the time stepping, which are collected in one Simulation object; see building a simulation.

Continue with the installation guide, the quick start guide, and tutorials.

$ pip install struphy
$ struphy compile

Publications

A selection of papers on the methods and algorithms implemented in Struphy. See the full publication list for more.