Examples

This section allows you to download input files that correspond to different physical situations.

We provide two kinds of inputs:

For a complete list of all example input files, have a look at our Examples/ directory. It contains folders and subfolders with self-describing names that you can try. All these input files are automatically tested, so they should always be up-to-date.

Beam-driven electron acceleration

AMReX inputs:

PICMI:

Laser-driven electron acceleration

AMReX inputs:

PICMI (Python) scripts:

Plasma mirror

2D case

Laser-ion acceleration

2D case

Note

The resolution of this 2D case is extremely low by default. You will need a computing cluster for adequate resolution of the target density, see comments in the input file.

Warning

It is strongly advised to set the parameters <species>.zmin / zmax / xmin / ... when working with highly dense targets that are limited in one or multiple dimensions. The particle creation routine will first create particles everywhere between these limits (defaulting to box size if unset), setting particles to invalid only afterwards based on the density profile. Not setting these parameters can quickly lead to memory overflows.

Uniform plasma

2D case 3D case

Capacitive discharge

The Monte-Carlo collision (MCC) model can be used to simulate electron and ion collisions with a neutral background gas. In particular this can be used to study capacitive discharges between parallel plates. The implementation has been tested against the benchmark results from Turner et al. [1]. The figure below shows a comparison of the ion density as calculated in WarpX (in June 2022 with PR #3118) compared to the literature results (which can be found here).

MCC benchmark against Turner et. al. (2013).

An input file to reproduce the benchmark calculations is linked below. To run a given case -n, from 1 to 4, execute:

python3 PICMI_inputs_1d.py -n 1

Once the simulation completes an output file avg_ion_density.npy will be created which can be compared to the literature results as in the plot above. Running case 1 on 4 processors takes roughly 20 minutes to complete.

Note

This example needs additional calibration data for cross sections. Download this data alongside your inputs file and update the paths in the inputs file:

git clone https://github.com/ECP-WarpX/warpx-data.git

Test cases

PICMI (Python) test cases included that can be used as a reference:

  • Gaussian beam

  • Langmuir plasma wave test in 3d

  • Langmuir plasma wave test in RZ

  • Langmuir plasma wave test in 2D

Manipulating fields via Python

An example of using Python to access the simulation charge density, solve the Poisson equation (using superLU) and write the resulting electrostatic potential back to the simulation is given in the input file below. This example uses the fields.py module included in the pywarpx library.

An example of initializing the fields by accessing their data through Python, advancing the simulation for a chosen number of time steps, and plotting the fields again through Python. The simulation runs with 128 regular cells, 8 guard cells, and 10 PML cells, in each direction. Moreover, it uses div(E) and div(B) cleaning both in the regular grid and in the PML and initializes all available electromagnetic fields (E,B,F,G) identically.

Kinetic-fluid hybrid model

Several examples and benchmarks of the kinetic-fluid hybrid model are shown below. The first few examples are replications of the verification tests described in Muñoz et al. [2]. The hybrid-PIC model was added to WarpX in PR #3665 - the figures below were generated at that time.

Electromagnetic modes

In this example a simulation is seeded with a thermal plasma while an initial magnetic field is applied in either the \(z\) or \(x\) direction. The simulation is progressed for a large number of steps and the resulting fields are analyzed for mode excitations.

Right and left circularly polarized electromagnetic waves are supported through the cyclotron motion of the ions, except in a region of thermal resonances as indicated on the plot below.

Parallel EM modes in thermal ion plasma

Perpendicularly propagating modes are also supported, commonly referred to as ion-Bernstein modes.

Perpendicular EM modes in thermal ion plasma

The input file for these examples and the corresponding analysis can be found at:

The same input script can be used for 1d, 2d or 3d simulations as well as replicating either the parallel propagating or ion-Bernstein modes as indicated below.

python3 PICMI_inputs.py -dim {1/2/3} --bdir {x/y/z}

A RZ-geometry example case for normal modes propagating along an applied magnetic field in a cylinder is also available. The analytical solution for these modes are described in Stix [3] Chapter 6, Sec. 2.

Normal EM modes in a metallic cylinder

The input file for this example and corresponding analysis can be found at:

Ion beam R instability

In this example a low density ion beam interacts with a “core” plasma population which induces an instability. Based on the relative density between the beam and the core plasma a resonant or non-resonant condition can be accessed. The figures below show the evolution of the y-component of the magnetic field as the beam and core plasma interact.

Resonant ion beam R instability
Non-resonant ion beam R instability

The growth rates of the strongest growing modes for the resonant case are compared to theory (dashed lines) in the figure below.

Resonant ion beam R instability growth rates

The input file for these examples and the corresponding analysis can be found at:

The same input script can be used for 1d, 2d or 3d simulations as well as replicating either the resonant or non-resonant condition as indicated below.

python3 PICMI_inputs.py -dim {1/2/3} --resonant

Ion Landau damping

Landau damping is a well known process in which electrostatic (acoustic) waves are damped by transferring energy to particles satisfying a resonance condition. The process can be simulated by seeding a plasma with a specific acoustic mode (density perturbation) and tracking the strength of the mode as a function of time. The figure below shows a set of such simulations with parameters matching those described in section 4.5 of Muñoz et al. [2]. The straight lines show the theoretical damping rate for the given temperature ratios.

Ion Landau damping

The input file for these examples and the corresponding analysis can be found at:

The same input script can be used for 1d, 2d or 3d simulations and to sweep different temperature ratios.

python3 PICMI_inputs.py -dim {1/2/3} --temp_ratio {value}

Magnetic reconnection

Hybrid-PIC codes are often used to simulate magnetic reconnection in space plasmas. An example of magnetic reconnection from a force-free sheet is provided, based on the simulation described in Le et al. [4].

Magnetic reconnection

The input file for this example and corresponding analysis can be found at:

Many Further Examples, Demos and Tests

WarpX runs over 200 integration tests on a variety of modeling cases, which validate and demonstrate its functionality. Please see the Examples/Tests/ directory for many more examples.

[1]

M. M. Turner, A. Derzsi, Z. Donkó, D. Eremin, S. J. Kelly, T. Lafleur, and T. Mussenbrock. Simulation benchmarks for low-pressure plasmas: Capacitive discharges. Physics of Plasmas, 01 2013. 013507. URL: https://doi.org/10.1063/1.4775084, doi:10.1063/1.4775084.

[2] (1,2)

P.A. Muñoz, N. Jain, P. Kilian, and J. Büchner. A new hybrid code (chief) implementing the inertial electron fluid equation without approximation. Computer Physics Communications, 224:245–264, 2018. URL: https://www.sciencedirect.com/science/article/pii/S0010465517303521, doi:https://doi.org/10.1016/j.cpc.2017.10.012.

[3]

T.H. Stix. Waves in Plasmas. American Inst. of Physics, 1992. ISBN 978-0-88318-859-0. URL: https://books.google.com/books?id=OsOWJ8iHpmMC.

[4]

A. Le, W. Daughton, H. Karimabadi, and J. Egedal. Hybrid simulations of magnetic reconnection with kinetic ions and fluid electron pressure anisotropy. Physics of Plasmas, 03 2016. 032114. URL: https://doi.org/10.1063/1.4943893, doi:10.1063/1.4943893.