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)
- 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.
| Particles in a Tokamak (model "Vlasov") |
Toroidal Alfvén eigenmode (model "LinearMHDDriftKineticCC") |
|---|---|
| Strong Landau damping (model "VlasovAmpereOneSpecies") |
Anisotropic diffusion (propagator "ImplicitDiffusion") |
The code is freely available under an MIT license - Copyright (c) 2019-2026, Struphy developers, Max Planck Institute for Plasma Physics.
Tutorials
Get familiar with Struphy right away on mybinder - no installation needed.
Quick install
Quick install on your computer (using a virtual environment):
python -m venv struphy_env
source struphy_env/bin/activate
pip install -U pip
pip install -U struphy
struphy compile
In case you face troubles with install/compile:
- check the prerequisites
- visit trouble shooting
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
Quick run
As an example, let's say we want to solve Maxwell's equations. We can use the CLI and generate a default launch file via
struphy params Maxwell
Hit yes when prompted - this will create the file params_Maxwell.py in your current working directory (cwd). You can open the file and - if you feel like it already - change some parameters, then run
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.
Documentation
The doc is on Github pages, we recommend in particular to visit:
Get in touch
- Issues
- Discussions
- @spossann stefan.possanner@ipp.mpg.de (Maintainer)
- @max-models max.lindqvist@ipp.mpg.de (Maintainer)
- LinkedIn profile
Citing Struphy
- 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 2023, 263-271, Springer Nature Switzerland.
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.0.4.tar.gz.
File metadata
- Download URL: struphy-3.0.4.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4400efa99201ca12b9a43066f9c0a1597076dd4bfad7f091c536f2c3de8f8507
|
|
| MD5 |
201d598eab3582067d775c21d3063f47
|
|
| BLAKE2b-256 |
98f978c472d5f86a8d14ea44e55585586160451b9553ae18799843b9e27e496f
|
Provenance
The following attestation bundles were made for struphy-3.0.4.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.0.4.tar.gz -
Subject digest:
4400efa99201ca12b9a43066f9c0a1597076dd4bfad7f091c536f2c3de8f8507 - Sigstore transparency entry: 1004822371
- Sigstore integration time:
-
Permalink:
struphy-hub/struphy@02cf2a2a607a57944ee5abcc262226872bedfe9e -
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@02cf2a2a607a57944ee5abcc262226872bedfe9e -
Trigger Event:
push
-
Statement type:
File details
Details for the file struphy-3.0.4-py3-none-any.whl.
File metadata
- Download URL: struphy-3.0.4-py3-none-any.whl
- Upload date:
- Size: 4.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
701e814455a7c7bf544c817db630f677a9bddaa7499420a63f3497d97843845c
|
|
| MD5 |
c32dcbcecee413ca69a8d2f021dc7a1c
|
|
| BLAKE2b-256 |
97b7a61bc8b91213a8cae3833524f6a395dcd48cbc4cf3012460e4a22b1c3013
|
Provenance
The following attestation bundles were made for struphy-3.0.4-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.0.4-py3-none-any.whl -
Subject digest:
701e814455a7c7bf544c817db630f677a9bddaa7499420a63f3497d97843845c - Sigstore transparency entry: 1004822374
- Sigstore integration time:
-
Permalink:
struphy-hub/struphy@02cf2a2a607a57944ee5abcc262226872bedfe9e -
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@02cf2a2a607a57944ee5abcc262226872bedfe9e -
Trigger Event:
push
-
Statement type: