STRUPHY
STRUPHY stands for STRUcture-Preserving HYbrid code (or STRUcture-preserving PHYsics code). It is an open-source Python package, developed at the Max Planck Institute for Plasma Physics, for fluid, kinetic and hybrid plasma models such as
- Maxwell’s equations
- Magneto-hydrodynamics (MHD)
- Vlasov-Poisson and Vlasov-Maxwell kinetic models
- Drift-kinetic models for strongly magnetized plasma
- MHD-kinetic hybrid models
Fields are discretized with B-spline finite elements that form a discrete de Rham complex, so that gradient, curl and divergence hold exactly and the discretization keeps the structure of the equations. Kinetic species are particle-in-cell markers. The 36 models share their substeps, and run on mapped domains from slabs and cylinders to tokamaks and stellarators. The models are written in Python; the loops over particles, cells and spline coefficients are kernels compiled to Fortran or C with Pyccel, parallelized with MPI and OpenMP.
My part: I am one of the core developers and authors of STRUPHY, and its second-largest contributor. I ported STRUPHY to NVIDIA GPUs: the particle pushers, charge and current accumulation, geometry and spline evaluation and the field diagnostics run as CUDA kernels through cunumpy, markers move between ranks with CUDA-aware MPI, and GPU tests run in CI on the GPU runners at MPCDF. I also work on the performance, testing and tooling of the code, and its plotting through plasma-plots.
Documentation and examples: struphy-hub.github.io
Check out the code on GitHub! · PyPI
From the documentation
Field lines in a GVEC stellarator, with the same ions followed as guiding centres (red) and as full orbits (blue)
Guiding-centre orbits on the nested flux surfaces of a five-field-period stellarator
Full-orbit particle trajectories gyrating around a tokamak
Helical orbits of charged particles around a uniform magnetic field
The phase-space vortex of the two-stream instability
Density and magnetic field lines in the Orszag–Tang vortex