Skip to main content

Spectral, quasi-3D Particle-In-Cell for CPU and GPU

Project description

Fourier-Bessel Particle-In-Cell code (FBPIC)

pypi version License DOI

Online documentation: http://fbpic.github.io
Support: Join slack

Overview

FBPIC is a Particle-In-Cell (PIC) code for relativistic plasma physics.

It is especially well-suited for physical simulations of laser-wakefield acceleration and plasma-wakefield acceleration, with close-to-cylindrical symmetry.

Algorithm

The distinctive feature of FBPIC is to use a spectral decomposition in cylindrical geometry (Fourier-Bessel decomposition) for the fields. This combines the advantages of spectral 3D PIC codes (high accuracy and stability) and those of finite-difference cylindrical PIC codes (orders-of-magnitude speedup when compared to 3D simulations). For more details on the algorithm, its advantages and limitations, see the documentation.

Language and hardware

FBPIC is written entirely in Python, but uses Numba Just-In-Time compiler for high performance. In addition, the code can run on CPU (with multi-threading) and on GPU. For large simulations, running the code on GPU can be much faster than on CPU.

Advanced features of laser-plasma acceleration

FBPIC implements several useful features for laser-plasma acceleration, including:

  • Moving window
  • Cylindrical geometry (with azimuthal mode decomposition)
  • Calculation of space-charge fields at the beginning of the simulation
  • Intrinsic mitigation of Numerical Cherenkov Radiation (NCR) from relativistic bunches
  • Field ionization module (ADK model)

In addition, FBPIC supports the boosted-frame technique (which can dramatically speed up simulations), and includes:

  • Utilities to convert input parameters from the lab frame to the boosted frame
  • On-the-fly conversion of simulation results from the boosted frame back to the lab frame
  • Suppression of the Numerical Cherenkov Instability (NCI) using the Galilean technique

Installation

The installation instructions below are for a local computer. For more details, or for instructions specific to a particular HPC cluster, see the documentation.

The recommended installation is through the Anaconda distribution. If Anaconda is not your default Python installation, download and install it from here.

Installation steps:

  • Install the dependencies of FBPIC. This can be done in two lines:

    conda install numba scipy h5py mkl
    conda install -c conda-forge mpi4py
    
  • Download and install FBPIC:

    pip install fbpic
    

    (If you want to run FBPIC through the PICMI interface, you can instead use pip install fbpic[picmi].)

  • Optional: in order to run on GPU, install the additional package cupy — e.g. using CUDA version 11.8. (The command below also automatically installs cudatoolkit which is also needed by FBPIC.)

    conda install cupy cuda-version=11.8
    

    (In the above command, you should choose a CUDA version that is compatible with your GPU driver ; see this table for more info.)

    If you want to use CUDA version 12+ which no longer comes with the cudatoolkit package, explicit installation of cuda-nvcc and cuda-nvrtc is required

    conda install cupy cuda-version=12.0 cuda-nvcc cuda-nvrtc
    
  • Optional: in order to run on a CPU which is not an Intel model, you need to install pyfftw, in order to replace the MKL FFT:

    conda install -c conda-forge pyfftw
    

Running simulations

Once installed, FBPIC is available as a Python module on your system.

Therefore, in order to run a physical simulation, you will need a Python script that imports FBPIC's functionalities and use them to setup the simulation. You can find examples of such scripts in the documentation or in this repository, in docs/source/example_input/.

Once your script is ready, the simulation is run simply by typing:

python fbpic_script.py

The code outputs HDF5 files, that comply with the OpenPMD standard, and which can thus be read as such (e.g. by using the openPMD-viewer).

Contributing

We welcome contributions to the code! Please read this page for guidelines on how to contribute.

Research & Attribution

FBPIC was originally developed by Remi Lehe at Berkeley Lab, and Manuel Kirchen at CFEL, Hamburg University. The code also benefitted from the contributions of Soeren Jalas (CFEL), Kevin Peters (CFEL), Irene Dornmair (CFEL), Laurids Jeppe (CFEL), Igor Andriyash (Laboratoire d'Optique Appliquee), Omri Seemann (Weizmann Institute), Daniel Seipt (University of Michigan), Samuel Yoffe (University of Strathclyde), David Grote (LLNL and LBNL) and Anton Golovanov (Weizmann Institute).

FBPIC's algorithms are documented in following scientific publications:

If you use FBPIC for your research project: that's great! We are very pleased that the code is useful to you!

If your project even leads to a scientific publication, please consider citing at least FBPIC's original paper. If your project uses the more advanced algorithms, please consider citing the respective publications in addition.

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

fbpic-0.27.0.tar.gz (283.4 kB view details)

Uploaded Source

Built Distribution

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

fbpic-0.27.0-py3-none-any.whl (304.9 kB view details)

Uploaded Python 3

File details

Details for the file fbpic-0.27.0.tar.gz.

File metadata

  • Download URL: fbpic-0.27.0.tar.gz
  • Upload date:
  • Size: 283.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fbpic-0.27.0.tar.gz
Algorithm Hash digest
SHA256 8c486fe47be7b217cd499383e5e5986ac5766d6048e59038aa6db33a8e7568c8
MD5 3ce4602771c31f165268e3d466aaf426
BLAKE2b-256 cb9555cfa450cfb2a2851c7e7a9458aa0fc6844befa3b8758aed6861fa8f5ac9

See more details on using hashes here.

Provenance

The following attestation bundles were made for fbpic-0.27.0.tar.gz:

Publisher: publish-to-pypi.yml on fbpic/fbpic

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

File details

Details for the file fbpic-0.27.0-py3-none-any.whl.

File metadata

  • Download URL: fbpic-0.27.0-py3-none-any.whl
  • Upload date:
  • Size: 304.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fbpic-0.27.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b4809617c1550e516fcbf5039cb70dde7c5703c0812c60b7baad24bc606eb18
MD5 67cb8ae9020307ecb6ff291b58691086
BLAKE2b-256 3263efa11e28271939f81b3437d740b62f391684a86d62ce5472361aeb43ad12

See more details on using hashes here.

Provenance

The following attestation bundles were made for fbpic-0.27.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on fbpic/fbpic

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