Plasma Simulations by Example

This is the companion website for Plasma Simulations by Example by L. Brieda, CRC Press, 2019. If you have already purchased a copy, thank you! If not, links to several online book sellers can be found below.

My aim with this book is to introduce engineering students and researchers to the world of numerical plasma simulations through the use of example codes. I have been developing plasma and rarefied gas simulation codes for over a decade. Through out this time, I have come across a plethora of textbooks and journal articles related to this field. However, very few of them contain practical examples that would be benefitial to a new learner. The few examples that tend to exist are available either as a pseudocode or are written in legacy languages (such as Fortran 77) that do not reflect modern programming paradigms. This book attempts to address these shortcomings by illustrating how to develop plasma simulation codes through example applications. The book begins by comparing particle and fluid-based approaches. Particle methods are then introduced by developing a simulation of an electron oscillating around a potentiall hill. This example is expanded in Chapter 2 to develop a fully-kinetic (particle electrons) simulation of a grounded box. This code is modified in Chapter 3 to simulate flow of ions past a charged sphere with electrons represented using a simple fluid approximation. Surface neutralization and collisions are covered in Chapter 4. Chapter 5 then illustrates how to reduce the run time of a 3D simulation through the use of symmetry or reduced dimensionality. Chapter 6 covers the use of unstructured meshes and the finite element method. Chapter 7 introduces electromagnetics. Fluid, mesh-based solution methods are discussed in Chapter 8. Finally Chapter 9 covers parallelization approaches using multithreading, MPI domain decomposition, and GPU programming.

The examples found in this book are written mainly in C++ with language constructs and standard library features from the C++11 revision. Python is utilized in few spots for prototyping and some plotting. These two languages are commonly encountered in the numerical modeling community. Python comes in handy for rapid algorithm prototyping, but the final code is developed in C++ for improved performance. C++ also forms the basis of the CUDA language used for GPU-based parallell processing. A crash course on C++ is found in Chapter 2. Simulation results are visualized using Paraview.

I hope you find the text useful and do not hesitate to reach out with questions.

Dr. Lubos Brieda
President, Particle in Cell Consulting, LLC

Buy

Plasma Simulations by Example can be purchased from popular book sellers such as Routledge, Amazon, and Barnes & Noble.

Plasma Simulation Courses

Interested in a more interactive way to learn fundamentals of plasma simulations? Every summer I run a roughly 8-week long online class covering topics from the book. You can find more information and registration information here. In 2024, I will be teaching the introductory Fundamentals of the Particle in Cell Method class. I suggest registering early as classes have limited capacity.

Citations

Publications citing the book can be seen here.

Example Codes

Example codes can be found on a GitHub repository or can be downloaded as a zip file (1.4 Mb).

Video Summary

I have also put together the following video summary:

Chapters

Chapter 1: Introduction

This chapter begins by introducing the velocity distribution function and differences between fluid and kinetic gas simulation approaches. Next, the basics of particle-based methods are introduced by developing a one-dimensional simulation of an electron oscillating between two grounded electrodes. This section introduces the Leapfrog method, domain discretization, finite difference method (FDM), direct and interactive matrix solvers, and mesh-to-particle interpolation.

Chapter 2: Grounded Box

The electrostatic particle in cell (ES-PIC) method is introduced by developing a 3D simulation of electrons oscillating in a grounded box filled with background ions. This chapter also serves as a crash course in C++. Topics covered include operator overloading, templates, dynamic memory, and object oriented programming, as well as quiet start, random numbers, and boundary conditions. Simulation results are visualized using Paraview.

Chapter 3: Flow Around a Sphere

The 3D grounded box ES-PIC code from Chapter 2 is modified to simulate flow of plasma past a stationary sphere (which is analogous to an object moving through through ambient plasma environment). Here we introduce hybrid PIC with Boltzmann relationship for electrons, non-linear Poisson solver, sugarcubing, preconditioned conjugate gradient, steady-state data averaging, calculation of mesh-averaged flow velocity and temperature, and the quasi-neutral approximation.

Chapter 4: Material Interactions

The example in the prior chapter modeled only ions, which were removed on surface impact to approximate surface neutralization. This chapter modifies the code to explicitly simulate the neutral species. The chapter also reviews velocity sampling from the Maxwellian velocity distribution using uniform and variable macroparticle weight techniques with particle merging. Collisions are introduced next using the Monte Carlo Collisions (MCC) and Direct Simulation Monte Carlo (DSMC) methods. The chapter closes with a discussion of dielectric boundaries and the use of tessellated surface geometries.

Chapter 5: Symmetry

This chapter introduces approaches for reducing simulation run time by exploiting inherent symmetry or uniformities along a spatial direction. In the case of the flow around the sphere example, symmetry allows one to simulate just a quarter domain. Periodic boundary conditions are also reviewed. Next, a simulation of flow around an infinitely long cylinder is introduced, yielding a planar (XY) 2D simulation. The chapter closes by covering the axisymmetric formulation applicable for simulating cylindrical domains.

Chapter 6: Unstructured Meshes

This chapter introduces approaches for performing PIC simulations on unstructured meshes. It begins by describing steps needed to generate and load such meshes. Next, a particle tracking code is developed in order to demonstrate how to push particles and interpolate mesh data with unstructured mesh. The finite element method (FEM) is introduced next to produce a Poisson solver. An unstructured version of the flow around a sphere example is then developed.

Chapter 7: Electromagnetics

This chapter begins by introducing the Boris algorithm for advancing velocities of magnetized particles. Magnetostatic field solver is developed next. This leads to an electromagnetic PIC code utilizing staggered (Yee) grids. The computation of curl, as well as relativistic push are covered.

Chapter 8: Eulerian Methods

This chapter introduces numerical methods that are based around solving partial differential equations (PDEs) on a stationary grid. The chapter introduces governing equations of magnetohydrodynamics (MHD), with solution methods demonstrated using the model advection-diffusion equation. Stability analysis is covered. The chapter also introduces Vlasov solvers for solving the Boltzmann equation governing the evolution of the velocity distribution function.

Chapter 9: Parallel Programming

The final chapter introduces parallelization techniques. The chapter covers profiling, multithreading, domain decomposition with MPI, and graphics card processing using CUDA. Common pitfalls, such as race condition, deadlock, and GPU memory transfer overhead are reviewed. A parallel version of the flow around the sphere is developed.