Multi-model plasma physics package
Project description
Welcome!
This is a Python package for solving partial differential equations (PDEs) mainly - but not exclusively - for plasma physics.
STRUPHY stands for STRUcture-Preserving HYbrid code (or STRUcture-preserving PHYsics code). The package provides off-the-shelf models for plasma physics problems, such as
- Maxwell’s equations
- Magneto-hydrodynamics (MHD)
- Multi-fluid models
- Vlasov-Poisson and Vlasov-Maxwell kinetic models
- Drift-kinetic models for strongly magnetized plasma
- MHD-kinetic hybrid models
All models can be run on multiple cores through MPI (distributed memory) and OpenMP (shared memory). The compute-intensive parts of the code are translated and compiled (“transpiled”) using pyccel, giving you the speed of Fortran or C while working within the familiar Python environment.
The code is freely available under an MIT license - Copyright (c) 2019-2026, Struphy developers, Max Planck Institute for Plasma Physics.
Quick install
Struphy is available on PyPI, so you can install it with pip:
pip install -U struphy
struphy compile
In case you face troubles with install/compile:
- check the prerequisites
- visit trouble shooting
Example: solve Maxwell’s equations
Use the command line to generate a default launch file:
struphy params Maxwell
This will create params_Maxwell.py in your current working directory (cwd). You can open the file and - if you feel like it already - change some parameters. Start the simulation with
python params_Maxwell.py
The default output is in sim_1/ in your cwd. You can change the output path via the class EnvironmentOptions in the parameter file.
Parallel simulations are run for example with
pip install -U mpi4py
mpirun -n 4 python params_Maxwell.py
You can also put the run command in a batch script.
Available models
Check the list of currently available models in the documentation. If you want to see a particular model implemented, please let us know via issues.
Documentation
The doc is on Github pages, we recommend in particular to visit:
Python API
Try out the Python API in a Jupyter notebook or any Python environment. For example, you can create a simulation object and show the domain and equilibrium magnetic field of the linear MHD model via
from struphy import (
Simulation,
domains,
equils,
)
from struphy.models import LinearMHD
model = LinearMHD()
domain = domains.DESCunit()
equil = equils.DESCequilibrium(use_nfp=False)
sim = Simulation(
model=model,
domain=domain,
equil=equil,
)
sim.show_domain(scalars="absB0", window_size = (850, 250), zoom_factor=2.0)
This will show the domain and equilibrium magnetic field of the linear MHD model. You can find more examples in the documentation.
Tutorials on Binder
Get familiar with Struphy right away on mybinder - no installation needed.
Docker
If you want to get started right away without installing anything, you can use the Docker image - just pull and run:
docker pull spossann/struphy:main
docker run -it --rm spossann/struphy:main
ls struphy_*
This will show three available Struphy environments, which you can activate for example via
source struphy_fortran_/env_fortran_/bin/activate
There is also a Docker image with just the prerequisites (on Ubuntu), so you can install and compile Struphy on top of it yourself:
docker pull spossann/ubuntu-for-struphy:main
docker run -it --rm spossann/ubuntu-for-struphy:main
Get in touch
- Issues
- Discussions
- @spossann stefan.possanner@ipp.mpg.de (Maintainer)
- @max-models max.lindqvist@ipp.mpg.de (Maintainer)
- LinkedIn profile
Publications
-
D. Bell, M.C. Pinto, S. Possanner, E. Sonnendrücker, The linearized Vlasov–Maxwell system as a Hamiltonian system, Journal of Computational Physics, Volume 555, 114765 (2026).
-
V. Carlier, M.C. Pinto, Variational discretizations of ideal magnetohydrodynamics in smooth regime using structure-preserving finite elements, Journal of Computational Physics, Volume 523, 113647 (2025).
-
Y. Li, M.C. Pinto, F. Holderied, S. Possanner, E. Sonnendrücker, Geometric Particle-In-Cell discretizations of a plasma hybrid model with kinetic ions and mass-less fluid electrons, Journal of Computational Physics 498, 112671 (2023).
-
S. Possanner, F. Holderied, Y. Li, B.-K. Na, D. Bell, S. Hadjout and Y. Güçlü, High-Order Structure-Preserving Algorithms for Plasma Hybrid Models, International Conference on Geometric Science of Information, 263-271, Springer Nature Switzerland (2023).
-
F. Holderied, S. Possanner, Magneto-hydrodynamic eigenvalue solver for axisymmetric equilibria based on smooth polar splines, Journal of Computational Physics 464, 111329 (2022).
-
F. Holderied, S. Possanner, X. Wang, MHD-kinetic hybrid code based on structure-preserving finite elements with particles-in-cell, Journal of Computational Physics 433, 110143 (2021).
-
F. Holderied, S. Possanner, A. Ratnani, X. Wang, Structure-preserving vs. standard particle-in-cell methods: The case of an electron hybrid model, Journal of Computational Physics 402, 109108 (2020).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file struphy-3.2.0.tar.gz.
File metadata
- Download URL: struphy-3.2.0.tar.gz
- Upload date:
- Size: 3.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9e90d9e523424d4aaba528fe9049cea9575c3ddf9fa02696f2e73588a0a3b76
|
|
| MD5 |
1cc791aaf1d949d9426e41257e002db6
|
|
| BLAKE2b-256 |
c0000f72bbf4c65d01c9b8d91428a9b3b32914d12226533188afc2ab08f77c22
|
Provenance
The following attestation bundles were made for struphy-3.2.0.tar.gz:
Publisher:
pypi-release.yml on struphy-hub/struphy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
struphy-3.2.0.tar.gz -
Subject digest:
e9e90d9e523424d4aaba528fe9049cea9575c3ddf9fa02696f2e73588a0a3b76 - Sigstore transparency entry: 1764601357
- Sigstore integration time:
-
Permalink:
struphy-hub/struphy@f6ed7bc62d9d5d29e2e3758815bd36743ebc7a79 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/struphy-hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@f6ed7bc62d9d5d29e2e3758815bd36743ebc7a79 -
Trigger Event:
push
-
Statement type:
File details
Details for the file struphy-3.2.0-py3-none-any.whl.
File metadata
- Download URL: struphy-3.2.0-py3-none-any.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce8c5ff4ab22753cbc17bc585d60b2a5a9e2fc6b829b0cf0f0af9e001e520c27
|
|
| MD5 |
ca8af3ea15a8b94168184fba00ce0237
|
|
| BLAKE2b-256 |
2d05ef8c9fc174b6a311ef9598120464c62e666745ae4a8f69dac13d5da4d0b6
|
Provenance
The following attestation bundles were made for struphy-3.2.0-py3-none-any.whl:
Publisher:
pypi-release.yml on struphy-hub/struphy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
struphy-3.2.0-py3-none-any.whl -
Subject digest:
ce8c5ff4ab22753cbc17bc585d60b2a5a9e2fc6b829b0cf0f0af9e001e520c27 - Sigstore transparency entry: 1764601872
- Sigstore integration time:
-
Permalink:
struphy-hub/struphy@f6ed7bc62d9d5d29e2e3758815bd36743ebc7a79 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/struphy-hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@f6ed7bc62d9d5d29e2e3758815bd36743ebc7a79 -
Trigger Event:
push
-
Statement type: