Skip to main content

STRUPHY Header

Release License badge Ubuntu latest MacOS latest isort and ruff PyPI PyPI Downloads

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.

Max Planck Institute Logo

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:

  1. check the prerequisites
  2. 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

Publications

Metadata

Release files for struphy 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for struphy 3.3.0
File Size Uploaded
struphy-3.3.0.tar.gz 4.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for struphy 3.3.0
File Interpreter ABI Platform
struphy-3.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 MB

Release files / struphy-3.3.0.tar.gz

Download URL struphy-3.3.0.tar.gz
Size 4.0 MB
Tags Source
SHA-256 checksum
How to use checksums
e3ff096f606e7ce3af3a1cc40ab680754a637e22c214b604aa7101cc5aa4a789
BLAKE2b-256 checksum
How to use checksums
b9ac447c383f6099f3dc685e3509fa1852d3dcb68cac900a30a8f221d2ddd460
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / struphy-3.3.0-py3-none-any.whl

Download URL struphy-3.3.0-py3-none-any.whl
Size 4.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
768ac2c4f541c9eb9d78d944423b396dc21991158b0f50be97b637b93872229f
BLAKE2b-256 checksum
How to use checksums
da2bbf51300e03dafe991ab7799e52e90dfee79586e7314ccf30ebac75ef5baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.3.0 This release

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.5

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.9.9

2 release files

1.9.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page