Particle in cell python

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Particle-in-cell code for plasma simulation

SmileiPIC/Smilei

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Smilei is an open-source, user-friendly electromagnetic particle-in-cell code for the kinetic simulation of plasmas. Co-developed by physicists and computer scientists, it is designed for high-performance on the most recent supercomputing architectures. Smilei is applied to a wide range of applications, from laser-plasma interaction, to accelerator physics, space physics and astrophysics. It is also used at the bachelor and master levels as a teaching platform for plasma physics.

  • Issues: bug reports, feature requests, reporting on bad doc or unexpected behaviour.
  • Chat room: general discussions, suggestions, remarks, sharing results & papers or just to say hi!
  • Contribute.

About

Particle-in-cell code for plasma simulation

Источник

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

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.

Читайте также:  Python show modules imported

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:

conda install numba scipy h5py mkl conda install -c conda-forge mpi4py 

(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 cudatoolkit and cupy — e.g. using CUDA version 10.0.
conda install cudatoolkit=10.0 pip install cupy-cuda100 

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

  • 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:

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) and David Grote (LLNL and LBNL).

Читайте также:  Phpstorm путь к php

FBPIC’s algorithms are documented in following scientific publications:

  • General description of FBPIC and it’s algorithm (original paper): R. Lehe et al., CPC, 2016 (arXiv)
  • Boosted-frame technique with Galilean algorithm: M. Kirchen et al., PoP, 2016 (arXiv) and Lehe et al., PRE, 2016 (arXiv)
  • Parallel finite-order solver for multi-CPU/GPU simulations: S. Jalas et al., PoP, 2017 (arXiv)
  • Parallel finite-order boosted-frame simulations for multi-CPU/GPU simulations: M. Kirchen et al., PRE, 2020

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.

Источник

The Particle-in-Cell Algorithm

for multiple particle species \(s\) . \(\mathbf(t)\) represents the electric, \(\mathbf(t)\) the magnetic, \(\rho_s\) the charge density and \(\mathbf_s(t)\) the current density field.

Except for normalization of constants, PIConGPU implements the governing equations in SI units.

Relativistic Plasma Physics

The 3D3V particle-in-cell method is used to describe many-body systems such as a plasmas. It approximates the Vlasov–Maxwell–Equation

(1) \[\partial_t f_s(\mathbf,\mathbf,t) + \mathbf \cdot \nabla_x f_s(\mathbf,\mathbf,t) + \frac \left[ \mathbf(\mathbf,t) + \mathbf \times \mathbf(\mathbf,t) \right] \cdot \nabla_v f_s(\mathbf,\mathbf,t) = 0\]

with \(f_s\) as the distribution function of a particle species \(s\) , \(\mathbf,\mathbf,t\) as position, velocity and time and \(\frac\) the charge to mass-ratio of a species. The momentum is related to the velocity by \(\mathbf

= \gamma m_s \mathbf\) .

The equations of motion are given by the Lorentz force as

TODO: write proper relativistic form

\(\mathbf_s = (\mathbf x_1, \mathbf x_2, . )_s\) and \(\mathbf_s = (\mathbf v_1, \mathbf v_2, . )_s\) are vectors of marker positions and velocities, respectively, which describe the ensemble of particles belonging to species \(s\) .

Particles in a particle species can have different charge states in PIConGPU. In the general case, \(\frac\) is not required to be constant per particle species.

Electro-Magnetic PIC Method

Fields such as \(\mathbf(t), \mathbf(t)\) and \(\mathbf(t)\) are discretized on a regular mesh in Eulerian frame of reference (see [EulerLagrangeFrameOfReference] ). See section Finite-Difference Time-Domain Method describing how Maxwell’s equations are discretized on a mesh in PIConGPU.

The distribution of Particles is described by the distribution function \(f_s(\mathbf,\mathbf,t)\) . This distribution function is sampled by markers, which are commonly referred to as macroparticles. These markers represent blobs of incompressible phase fluid moving in phase space. The temporal evolution of the distribution function is simulated by advancing the markers over time according to the Vlasov–Maxwell–Equation in Lagrangian frame (see eq. (1) and [EulerLagrangeFrameOfReference] ). A marker has a finite-size and a velocity, such that it can be regarded as a cloud of particles, whose center of mass is the marker’s position and whose mean velocity is the marker’s velocity. The cloud shape \(S^n(x)\) of order \(n\) of a marker describes its charge density distribution. See section Hierarchy of Charge Assignment Schemes for a list of available marker shapes in PIConGPU.

Читайте также:  Failed to created java virtual machine

References

C.K. Birdsall, A.B. Langdon. Plasma Physics via Computer Simulation, McGraw-Hill (1985), ISBN 0-07-005371-5

R.W. Hockney, J.W. Eastwood. Computer Simulation Using Particles, CRC Press (1988), ISBN 0-85274-392-0

A. Huebl. Injection Control for Electrons in Laser-Driven Plasma Wakes on the Femtosecond Time Scale, Diploma Thesis at TU Dresden & Helmholtz-Zentrum Dresden — Rossendorf for the German Degree “Diplom-Physiker” (2014), DOI:10.5281/zenodo.15924

A. Huebl. PIConGPU: Predictive Simulations of Laser-Particle Accelerators with Manycore Hardware, PhD Thesis at TU Dresden & Helmholtz-Zentrum Dresden — Rossendorf (2019), DOI:10.5281/zenodo.3266820

© Copyright Documentation under CC-BY 4.0, The PIConGPU Community. Revision ad1f7a27 .

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

An ipython notebook based introduction to the particle-in-cell algorithm

PrometheusPi/particle-in-cell_tutorial

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Introduction to the particle-in-cell algorithm

a jupyter notebook based tutorial

The primary purpose of this repository is to provide an introduction to the rudimentary particle-in-cell algorithm. Examples are based on laser-plasma physics and standard plasma instabilities.

The different steps of the particle-in-cell algorithm:

  • solving the time-dependent Maxwell equations to update the electromagnetic field
  • interpolating the field values onto the particles to compute the Colomb force
  • solving the equation of motion based on the previously calculated force
  • compute the current created by the particle motion and interpolate it onto the simulation grid will be treated separately.

In order to provide an easy to use development environment, this project provides jupyter notebooks in python. This approach is inspired by the great work of @labarba et al. regarding, for example, the tutorial on the Navier-Stokes equation.

As of now, this is work in progress and far from complete. Feel free to contribute.

About

An ipython notebook based introduction to the particle-in-cell algorithm

Источник

Оцените статью