# The Particle-in-Cell Algorithm¶

Section author: Axel Huebl

For now, please refer to the textbooks [BirdsallLangdon], [HockneyEastwood], our latest paper on PIConGPU and [Huebl2014] (chapters 2.3, 3.1 and 3.4).

## System of Equations¶

\begin{align}\begin{aligned}\nabla \cdot \mathbf{E} &= \frac{1}{\varepsilon_0}\sum_s \rho_s\\\nabla \cdot \mathbf{B} &= 0\\\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}} {\partial t}\\\nabla \times \mathbf{B} &= \mu_0\left(\sum_s \mathbf{J}_s + \varepsilon_0 \frac{\partial \mathbf{E}} {\partial t} \right)\end{aligned}\end{align}

for multiple particle species $$s$$. $$\mathbf{E}(t)$$ represents the electic, $$\mathbf{B}(t)$$ the magnetic, $$\rho_s$$ the charge density and $$\mathbf{J}_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{x},\mathbf{v},t) + \mathbf{v} \cdot \nabla_x f_s(\mathbf{x},\mathbf{v},t) + \frac{q_s}{m_s} \left[ \mathbf{E}(\mathbf{x},t) + \mathbf{v} \times \mathbf{B}(\mathbf{x},t) \right] \cdot \nabla_v f_s(\mathbf{x},\mathbf{v},t) = 0$

with $$f_s$$ as the distribution function of a particle species $$s$$, $$\mathbf{x},\mathbf{v},t$$ as position, velocity and time and $$\frac{q_s}{m_s}$$ the charge to mass-ratio of a species. The momentum is related to the velocity by $$\mathbf{p} = \gamma m_s \mathbf{v}$$.

The equations of motion are given by the Lorentz force as

$\begin{split}\frac{\mathrm{d}}{\mathrm{d}t} \mathbf{V_s}(t) &= \frac{q_s}{m_s} \left[ \mathbf{E}(\mathbf{X_s}(t),t) + \mathbf{V_s}(t) \times \mathbf{B}(\mathbf{X_s}(t),t) \right]\\ \frac{\mathrm{d}}{\mathrm{d}t} \mathbf{X_s}(t) &= \mathbf{V_s}(t) .\end{split}$

Attention

TODO: write proper relativistic form

$$\mathbf{X}_s = (\mathbf x_1, \mathbf x_2, ...)_s$$ and $$\mathbf{V}_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$$.

Note

Particles in a particle species can have different charge states in PIConGPU. In the general case, $$\frac{q_s}{m_s}$$ is not required to be constant per particle species.

## Electro-Magnetic PIC Method¶

Fields such as $$\mathbf{E}(t), \mathbf{B}(t)$$ and $$\mathbf{J}(t)$$ are discretized on a regular mesh in Eulerian frame of reference (see [EulerLagrangeFrameOfReference]).

The distribution of Particles is described by the distribution function $$f_s(\mathbf{x},\mathbf{v},t)$$. This distribution function is sampled by markers (commonly referred to as macro-particles). 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]).

Markers carry a spatial shape of order $$n$$ and a delta-distribution in momentum space. In most cases, these shapes are implemented as B-splines and are pre-integrated to assignment functions $$S$$ of the form:

\begin{align}\begin{aligned}\begin{split}S^0(x) = \big\{ \substack{1 \qquad \text{if}~0 \le x \lt 1\\ 0 \qquad \text{else}}\end{split}\\S^n(x) = \left(S^{n-1} * S^0\right)(x) = \int_{x-1}^x S^{n-1}(\xi) d\xi\end{aligned}\end{align}

PIConGPU implements these up to order $$n=4$$. The three dimensional marker shape is a multiplicative union of B-splines $$S^n(x,y,z) = S^n(x) S^n(y) S^n(z)$$.

## References¶

 [EulerLagrangeFrameOfReference] (1, 2) Eulerian and Lagrangian specification of the flow field. https://en.wikipedia.org/wiki/Lagrangian_and_Eulerian_specification_of_the_flow_field
 [BirdsallLangdon] C.K. Birdsall, A.B. Langdon. Plasma Physics via Computer Simulation, McGraw-Hill (1985), ISBN 0-07-005371-5
 [HockneyEastwood] R.W. Hockney, J.W. Eastwood. Computer Simulation Using Particles, CRC Press (1988), ISBN 0-85274-392-0
 [Huebl2014] 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), https://doi.org/10.5281/zenodo.15924