Skip to main content

Multi-model plasma physics package

Project description


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)
  • 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-2025, 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:

  1. check the prerequisites
  2. visit trouble shooting

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

Citing Struphy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

struphy-3.0.3.tar.gz (3.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

struphy-3.0.3-py3-none-any.whl (4.0 MB view details)

Uploaded Python 3

File details

Details for the file struphy-3.0.3.tar.gz.

File metadata

  • Download URL: struphy-3.0.3.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

Hashes for struphy-3.0.3.tar.gz
Algorithm Hash digest
SHA256 256f83b0c953be7c7f595fa6c5b2536a5afb92c8738a5676065dfaa6581b1cb5
MD5 f05ffa95e493c7579e80a2cfcc2f5767
BLAKE2b-256 1799e42ccf0354ff44e109d358b194add8325d74e47039492acaa9bd3231c54f

See more details on using hashes here.

Provenance

The following attestation bundles were made for struphy-3.0.3.tar.gz:

Publisher: pypi-release.yml on struphy-hub/struphy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file struphy-3.0.3-py3-none-any.whl.

File metadata

  • Download URL: struphy-3.0.3-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

Hashes for struphy-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 deb1c2bcf790efbc6954b7f0a30d4ab316b5c88e8b2223018d08f899177f4466
MD5 1decef36634fe0a0ee6736b3926c5c2c
BLAKE2b-256 5d37b04c6980a47c6e226fd48f0e247b08a3ac1b6d8d0a99a1daf846b7512376

See more details on using hashes here.

Provenance

The following attestation bundles were made for struphy-3.0.3-py3-none-any.whl:

Publisher: pypi-release.yml on struphy-hub/struphy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page