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. in Phys. Plasmas 20, 013507, 2013. 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.