Electrostatic particle-in-cell
A Python solver for collisionless, electrostatic 1D1V dynamics, with configurable populations, initial distributions, sources, and boundaries. Simulation and plotting are separate, with HDF5 output and CSV diagnostics.
Two-stream evolution
The animation shows the summed number distribution in position–velocity space, using all particles in each saved snapshot. Colors use a fixed logarithmic scale (bright: higher density; dark: lower density), with no smoothing. The preview samples 51 saved states from normalized time 0 to 40.

The run uses 32,768 particles, 128 mesh cells, a time step of 0.025, and periodic boundaries. Two equal electron populations have drifts of ±1 and thermal speeds of 0.05, with a neutralizing background. All quantities are normalized; the code documentation defines the units.
Results
Particle count stays constant in this run. The maximum relative change in total energy is 0.0034% over the saved diagnostics. These are illustrative numerical results; energy conservation alone does not establish convergence.

Electric-field evolution and diagnostics for the full run.

Distribution snapshots and marginals, computed from all simulation particles.

Saved particle phase-space snapshots.
Download and reproduce
- Download code and results (ZIP): solver, plotting tools, tests, five example inputs, resolved configurations, and diagnostic CSV files.
- Browse source code on GitHub.
- Browse results and diagnostics for two-stream, Landau, single-beam Pierce, two-stream Pierce, and reflecting-plasma runs.
- Download the animation (GIF).
From the extracted pic folder, use Python 3.10 or newer:
python -m pip install -r requirements.txt
python -m unittest test_pic_solver.py
python pic_solver.py inputs/two_stream.json --output results/two_stream
python pic_plots.py results/two_stream/run.h5 --animate --distribution-animation
python make_preview.py results/two_stream/run.h5 --output preview
Large raw HDF5 files are regenerated by the simulation command. The README documents the input format, numerical method, output schema, and model limits.