Small fixes. 39 pages

This commit is contained in:
Patrick Kilian
2019-04-26 16:11:56 -06:00
parent 677659edd7
commit 9539ae5af4
9 changed files with 164 additions and 159 deletions
+113 -106
View File
@@ -5,14 +5,14 @@ description of phase space samples represented as macro particles coupled to
electromagnetic fields described in an Eulerian way on a grid. Connecting the
two parts correctly is crucial in the numerical implementation, but let us
start with the relatively simple step of evolving the electric and magnetic
fields on the grid for one time step.
fields on the grid for one time step. The simulation grid can resolve one, two or three dimensions, but typically vector quantities such as fields vectors or particle velocities retain all three components.
\subsection{Field Solvers}
\label{sec:num:field}
This subsection discusses how electromagnetic fields are calculated from
source terms (moments of the distribution function of all charged particle
This subsection discusses how electromagnetic fields are calculated from
source terms (moments of the distribution function of all charged particle
species). The source are assumed to be known on a uniform grid of rectangular
cells. How the source terms are calculated is discussed in section
cells. How the source terms are calculated is discussed in section
\ref{subsec:num:depostion}. Non-rectangular grids are discussed in the
review \cite{Meierbachtol_2015}.
@@ -33,7 +33,7 @@ given by the Yee lattice described in \cite{Yee_1966}. Component of the
electric field $E_i$ are located at the mid points of edges pointing in
coordinate direction $x_i$ whereas magnetic flux components $B_i$ are located
at the center of cell phases with have normal vectors pointing in direction
$x_i$.
$x_i$, as shown in Figure~\ref{fig:num:rot_yee}.
%In principle the two dual subgrids could be interchanged, but this
%arrangement neatly follows the view of electromagnetism as a discrete exterior
%calculus, where the electric field is a one-form that naturally lives on cell
@@ -59,13 +59,14 @@ and $\vec{B}$.
Gauss's Law in Eq.~\eqref{eq:num:gauss} is the corner stone for electrostatic
Particle-in-cell codes, but we will ignore it for now. It's equivalent for the
magnetic field, Eq.~\eqref{eq:num:monopol}, that describes the absence of
monopole is mostly relevant as an initial condition. Faraday's Law and Ampere's
monopoles is mostly relevant as an initial condition. Faraday's Law and Ampere's
law can be rewritten as evolution equations:
\begin{align}
\frac{\partial \vec{B}}{\partial t} &= -c \, \nabla \times \vec{E} \label{eq:num:Bevolution} \\
\frac{\partial \vec{E}}{\partial t} &= \phantom{-} c \nabla \times \vec{B} - \frac{4 \pi}{c} \vec{\jmath} \label{eq:num:Eevolution}
\end{align}
This implies that the curl of the electric field does not have to be known at
The time evolution given by these equations will not violate Eqs.~\eqref{eq:num:gauss} and \eqref{eq:num:monopol} if they were satisfied initially.
Eqs.~\eqref{eq:num:Bevolution} and \eqref{eq:num:Eevolution} implie that the curl of the electric field does not have to be known at
the location of the electric field, but rather at the location of the dual,
magnetic field.
@@ -118,14 +119,16 @@ magnetic field.
%%values of the field components are naturally integers.
%%
The classical solution to store electric and magnetic fields on the grids that yields the curl of the fields at the required position is the Yee grid. Here e.g. $B_y$ is stored at cell face $(i+1/2,j,k+1/2)$, while $E_y$ is stored at $(i,j+1/2,k)$. Not only does this process result in curls calculated at the correct position without interpolation, but the curl is calculated in second order immediately.
The classical solution to store electric and magnetic fields on the grids that yields the curl of the fields at the required position is the Yee grid. Here e.g. $B_y$ is stored at cell face $(i+1/2,j,k+1/2)$, while $E_y$ is stored at $(i,j+1/2,k)$\footnote{The grid cells have edge length $\Delta{x}$, $\Delta{y}, \Delta{z}$ and any position can be given as $\vec{x} = \left(i\cdot\Delta{x}, j\cdot\Delta{y}, k\cdot\Delta{z}\right)$.}. Not only does this process result in curls calculated at the correct position without interpolation, but the curl is calculated in second order immediately.
The temporal derivative in Eqs.~\eqref{eq:num:Bevolution} and \eqref{eq:num:Eevolution} can be solved using the second-order spatial derivatives. The customary
solution is to leap-frog the fields, i.e. use the curl of the electric field at
time $t\Delta{t}$ to update the magnetic field from time $(t-1/2)\Delta{t}$ to
$(t+1/2)\Delta{t}$ and then use the curl of the magnetic field at that time to
update the electric field to $(t+1)\Delta{t}$. This leads to a scheme that is
also second order accurate in time. However to update the particle position and
also second order accurate in time. The timestep $\Delta{t}$ can not be larger than the CFL limit $\Delta{t} < \sqrt{\Delta{x}^2 + \Delta{y}^2 + \Delta{z}^2} / c$ to avoid instability.
To update the particle position and
location it is useful to have electric and magnetic fields at the position of
the particle at the same time. The solution to this is to split the update of
the magnetic field and use
@@ -163,7 +166,7 @@ This solver is the most common method and is accurate to second order with respe
The one instability that plagues electromagnetic Particle-in-Cell codes and is
the main driver to go beyond the simple and robust field solver described above
is the Numerical Cherenkov Instability. This long known instability (see
is the Numerical Cherenkov Instability (NCI). This long known instability (see
\cite{Godfrey_1974}) occurs when particles move close to the speed of light
and couple to light waves. In reality this only happens when then influence of
a medium reduces the speed of light below the vacuum value and particle can
@@ -265,7 +268,7 @@ for a narrow range of frequencies propagating on the grid. Subsequently
Fig.\ref{fig:num:rot_ck} illustrates all the grid locations that are used in this
family of schemes. Choosing different relative weights between the different
grid locations allows to tune for different optimization goals. An overview is
given in \cite{Vay_2011}.
given in \cite{Vay_2011}.
%Of course the development did not stop at this point, but to keep the page number limited, the interested reader is referred to \cite{Shlager_1993, Garcia_1996, Pukhov_1999, Finkelstein_2006, Yang_2006, Hadi_2007, Smith_2012, Lehe_2013, Blinne_2018} as entry points to further reading on this fascinating topic.
%%Das ist fast eine halbe Seite an Referenzen, die sich daraus ergeben...
@@ -282,13 +285,13 @@ given in \cite{Vay_2011}.
% Blinne_2018.pdf optimized FTDT stencils
A different approach is the pseudo-spectral solution of the field equations.
As known from e.g. hydrodynamics the partial differential equations in real space
are converted to ordinary equations in Fourier space. This eliminates finite stencils,
but requires a global FFT \cite{Haber_1973, Jalas_2017}. For constant current density
As known from e.g. hydrodynamics the partial differential equations in real space
are converted to ordinary equations in Fourier space. This eliminates finite stencils,
but requires a global FFT \cite{Haber_1973, Jalas_2017}. For constant current density
Maxwell's equations can be integrated analytically in time leading to pseudo-spectral
analytic time domain (PDATD) schemes that are completely free of numerical dispersion.
Since global FFTs require a lot of communication and can limited scalability, there
have been some attempts to avoid them and instead use local FFTs to build field
Since global FFTs require a lot of communication and can limited scalability, there
have been some attempts to avoid them and instead use local FFTs to build field
solvers (\cite{Vay_2013}).
%An old idea that has recently gained traction again is to try field solvers
@@ -336,7 +339,7 @@ solvers (\cite{Vay_2013}).
%%possibility for better parallelisation for large systems, when the FFTs are
%%communication limited.
For the limit of very small particle velocities (as compared to the speed of light) the situation becomes much simpler. This is the electrostatic limit, where electric fields are calculated using Gauss Law (Eq.~\eqref{eq:num:gauss}) and magnetic fields are no longer time dependent. This of course limits the electric field to is longitudinal, curl-free component. Historically some of the first Particle-in-Cell codes were electrostatic (see e.g. \cite{Hockney_1966, Gitomer_1972}). Gauss Law can be solved in higher dimensions using either spectral solvers \cite{Birdsall_2005} or multigrid solvers.
For the limit of very small particle velocities (as compared to the speed of light) the situation becomes much simpler. This is the electrostatic limit, where electric fields are calculated using Gauss Law (Eq.~\eqref{eq:num:gauss}) and magnetic fields are no longer time dependent. This of course limits the electric field to its longitudinal, curl-free component. Historically some of the first Particle-in-Cell codes were electrostatic (see e.g. \cite{Hockney_1966, Gitomer_1972}). Gauss Law can be solved in higher dimensions using either spectral solvers \cite{Birdsall_2005} or multigrid solvers.
% darwin
@@ -383,15 +386,15 @@ of an interpolation that we will discuss next.
Fig.~\ref{fig:num:interpolation} illustrates how the interpolation from grid
quantities (magnetic field $B_z$ in this case) to the particle location is
done. As discussed in the last chapter the numerical macroparticle represents
a sample of the phase space with finite extent..
a sample of the phase space with finite extent and a macro factor, or (statistical) weight) given by the number of physical particles it represents.
%The computational macro-particle represents a large number of physical
%particles and is thus seen as a chunk of phase space with a density
%distribution over a finite extend.
The fraction of the phase space volume that is located in the cell is used as
a weight for the field strength contribution from that cell.
%The fraction of particle that fall in the cell are used as a weight to multiply
%the field strength at the center of that cell.
Contributions from different
%distribution over a finite extend.
The fraction of the phase space volume that is located in the cell is used as
a interpolation weight for the field strength contribution from that cell.
%The fraction of particle that fall in the cell are used as a weight to multiply
%the field strength at the center of that cell.
Contributions from different
cells are then added up to compute the mean
magnetic field strength at the particle location. In a single dimension, this calculation can be expressed by
\begin{equation}
@@ -412,7 +415,7 @@ cell we can write the two-dimensional interpolation as
Many different choices for the shape function $S$ are possible and different
codes make different design choices here. Some properties are however required.
The shape function has to be normalized, i.e.
The shape function does not include the statistical weight of the macro pareticle, but rather has to be normalized, i.e.
$\int_{-\infty}^{\infty}S(x)\,\mathrm{d}x = 1$ and should be symmetric, i.e.
$S(-x) = S(x)$. To allow efficient evaluation of
Eq.~\eqref{eq:num:Bzinterpol}, the shape function should have compact support,
@@ -420,8 +423,8 @@ i.e. be non-zero only up to some small $x_{max}$.
The \textit{Nearest Grip Point} or NGP scheme is the minimal example satisfying
all requirements: The shape function is the $\delta$-function $S(x) = \delta(x)$.
This choice is simple to implement and computationally cheap, but the field that
particles see is non-contiguous and the current induced by particles using this
This choice is simple to implement and computationally cheap, but the field that
particles see is non-contiguous and the current induced by particles using this
shape function switches from one cell to another when an interface is crossed.
%In principle all these properties are satisfied by a $\delta$-function. This
@@ -434,25 +437,25 @@ shape function switches from one cell to another when an interface is crossed.
%interface is crossed. This leads to a high level of numerically induced
%fluctuations in the source terms and consequently the fields.
The Cloud-in-Cell
%efficiently the
The Cloud-in-Cell
%efficiently the
algorithm by \cite{Birdsall_1968} was a major step forward in the performance
and usefulness of Particle-in-Cell codes. Here
each particle is viewed as a cloud of constant density and with the same size
as a grid cell (but freely movable relative to the grid). The shape and weight function
that generate that view are given by
\begin{equation}
S_{CIC}(x) =
S_{CIC}(x) =
\begin{cases}
1 & |x|\leq 1/2 \\
0 & \text{else}
\end{cases},\quad W_{CIC}(x) =
\end{cases},\quad W_{CIC}(x) =
\begin{cases}
1-|x| & |x|\leq 1 \\
0 & \text{else}
\end{cases}
\end{equation}
and illustrated in Fig.~\ref{fig:num:S_CIC}.
and illustrated in Fig.~\ref{fig:num:S_CIC}.
%The associated weight function $W_{CIC}$ is
%straight forward to calculate and given by
%\begin{equation}
@@ -475,7 +478,7 @@ and illustrated in Fig.~\ref{fig:num:S_CIC}.
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{figure/numerics/formfaktor_TSC_S.png}
\caption{Triangluar Shaped Cloud}
\caption{Triangular Shaped Cloud}
\label{fig:num:S_TSC}
\end{subfigure}
\begin{subfigure}{0.25\hsize}
@@ -494,7 +497,7 @@ and illustrated in Fig.~\ref{fig:num:S_CIC}.
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{figure/numerics/formfaktor_TSC_density.png}
\caption{Triangluar densityhaped Cloud}
\caption{Triangular Shaped Cloud}
\label{fig:num:density_TSC}
\end{subfigure}
\begin{subfigure}{0.25\hsize}
@@ -527,7 +530,7 @@ towards higher $k$.
%can help. The downside is that the finite support of the shape function is
%larger and more grid cells are involved in both the interpolation of the fields
%to the particle location as well as the deposition.
In \cite{Langdon_1970} it has been shown that this decreases aliasing of high $k$.
In \cite{Langdon_1970} it has been shown that this decreases aliasing of high $k$.
This in turn decreases the finite grid instability - a numerical artifact that occurs,
when the numerical grid does not resolve the Debye length and that artificially heats
the plasma. The use of higher order shape functions improves the conservation of
@@ -539,9 +542,9 @@ Higher order have an increasing number of continuous derivatives and therefore
quicker drop off in Fourier space, but at the cost of each particle interacting
with an increasing number of cells. The smoother fields generated by higher
order shape functions reduce unphysical binary forces between nearby particles
and therefore numerical collisionallity\cite{Eastwood_1974,Matsuda_1975}.
and therefore numerical collisionality \cite{Eastwood_1974,Matsuda_1975}.
%The EPOCH code \cite{} might be the most widely used code to
%use high order shape function.
%use high order shape function.
Otherwise order beyond TSC are not used widely
enough that a consensus as to their names has emerged.
@@ -550,12 +553,12 @@ enough that a consensus as to their names has emerged.
%uses cylindrical or spherical coordinates one can either use unmodified shape
%function in ``index space'' that look cartician, just like the grids we discuss
%here. Or one can take into account that grid cells become smaller and
%eventually have a singularity as they approch $r=0$ and follow the approach by
%eventually have a singularity as they approach $r=0$ and follow the approach by
%\cite{Ruyten_1993} to obtain a correct density representation, even at the
%symmetry axis.
%So far only interpolation in one dimension has been discussed or interpolation
%that treats all dimensions the same.
%that treats all dimensions the same.
So far only dimension-by-dimension interpolation has been discussed.
This construction leads to codes that
conserve total momentum. Alternatively it is possible to combine shape function
@@ -573,12 +576,12 @@ The low-level interpolation unfortunately requires very high particle numbers
to reach acceptable noise levels.
Since many different choices for shape functions are possible, many
comparisons have been made \cite{Abe_1986,Kilian_2013,Munoz_2014}. No universal
comparisons have been made \cite{Abe_1986,Kilian_2013,Munoz_2014}. No universal
winner has emerged and it is advisable to test
different shape function to make sure that physical results are insensitive to
the choices made. A recent idea by \cite{Wu_2018} is to use adaptive width per
particle and update them during the course of the simulation to reduce overall
noise.
noise.
%Other schemes that pick or modify the width of the shape function to
%reduce known numerical problems might follow.
@@ -599,16 +602,16 @@ Similar to the leap-frog procedure for the electromagnetic fields the particle's
\end{align}
When the force depends only on position, this can be solved straight forward.
For velocity dependent forces - magnetic fields are the most important case -
there is dependence on $\vec{x}(t)$, which is not known. The interpolation
For velocity dependent forces - magnetic fields are the most important case -
there is dependence on $\vec{x}(t)$, which is not known. The interpolation
$\vec{v}(t) \approx 1/2\left(\vec{v}(t-\Delta{t}/2)+\vec{v}(t+\Delta{t}/2)\right)$, but
this leads to an implicit dependence of Eq.~\eqref{eq:num:velupdate} on
this leads to an implicit dependence of Eq.~\eqref{eq:num:velupdate} on
$\vec{v}(t+\Delta{t}/2)$ on both sides.
%
%Without magnetic field, when the force $\vec{F}$ only depends on the particle
%position $x(t)$, this is straight forward to solve. If there is however a
%magnetic field, the Lorentz force introduces a dependance on the velocity
%magnetic field, the Lorentz force introduces a dependence on the velocity
%$\vec{v}(t)$ that we do not know. The straight forward next step is to approximate
%the velocity at this point in time by $\vec{v}(t) \approx
%1/2\left(\vec{v}(t-\Delta{t}/2)+\vec{v}(t+\Delta{t}/2)\right)$, but now
@@ -624,16 +627,19 @@ $\vec{v}(t+\Delta{t}/2)$ on both sides.
%floating point numbers close to the speed of light.
%Eqs.~\eqref{eq:num:velupdate} and \eqref{eq:num:posupdate} then read
The Boris push allows us to solve this directly. In order to account for relativistic
versions, the formulation shall be done using relativistic momentum per rest mass $\vec{u} = \vec{p}/m = \gamma\vec{v}$.
The Boris push allows us to solve this directly and efficiently. The computation efficiency is important since typical simulations contain many more particles than grid cells.
In order to account for relativistic
versions, the formulation shall be done using relativistic momentum per rest mass $\vec{u} = \vec{p}/m = \gamma\vec{v}$. Here $\gamma$ is the Lorentz factor of the macro particle.
This quantity does not suffer from the problem that it has a fixed upper value
and thus we avoid the loss of precision due to the finite resolution of
floating point numbers close to the speed of light.
Eqs.~\eqref{eq:num:velupdate} and \eqref{eq:num:posupdate} then read
\begin{align}
\vec{u}(t+\Delta{t}/2) &= \vec{u}(t-\Delta{t}/2) + \vec{F}(x(t),v(t))\cdot\Delta{t}/m \quad , \\
\gamma(t+\Delta{t}/2) &= \sqrt{1 + \frac{\vec{u}(t+\Delta{t}/2) \cdot \vec{u}(t+\Delta{t}/2)}{c^2}} \\
\vec{x}(t+\Delta{t})\phantom{/2} &= \vec{x}(t)\phantom{-\Delta{t}/2}\,\,\, + \vec{u}(t+\Delta{t}/2)\cdot\Delta{t}/\gamma(+\Delta{t}/2) \quad .
\vec{u}(t+\Delta{t}/2) &= \vec{u}(t-\Delta{t}/2) + \vec{F}(x(t),v(t))\cdot\Delta{t}/m \quad , \\
\gamma(t+\Delta{t}/2) &= \sqrt{1 + \frac{\vec{u}(t+\Delta{t}/2) \cdot \vec{u}(t+\Delta{t}/2)}{c^2}} \\
\vec{x}(t+\Delta{t})\phantom{/2} &= \vec{x}(t)\phantom{-\Delta{t}/2}\,\,\, + \vec{u}(t+\Delta{t}/2)\cdot\Delta{t}/\gamma(t+\Delta{t}/2) \quad , \\
\vec{F}(x(t),v(t)) &= \frac{q}{m} \left(\vec{E}(x(t)) + \vec{v}(t) \times \vec{B}(x(t))\right) \quad .
\end{align}
\begin{figure}[h!]
@@ -659,16 +665,16 @@ into two equal parts performed before and after handling the magnetic field. Usi
\end{align}
It is worth noting that the original algorithm by Boris contains the $\tan$ in
Eq.~\eqref{eq:num:tanrotation} and the suggestion to expand at least up to
fourth order. Many codes since then have made the
Eq.~\eqref{eq:num:tanrotation} and the suggestion to expand it at least up to
fourth order if it is too expensive to compute $\tan$ to machine precision. However many codes since then have made the
approximation $\vec{\Omega} \approx q/(\gamma\,m)\,\vec{B}(t)\,\Delta{t}/2$,
This produces only the correct gyro radius, not the correct gyro angle.
This produces only the correct gyro radius, not the correct gyro angle.
The Lorentz factor $\gamma$ in Eq.~\eqref{eq:num:tanrotation} is approximated by
$\gamma = \sqrt{1 + \vec{u}_1\cdot\vec{u}_1 / c^2}$, which according to
\cite{Vay_2008} can lead to spurious forces
%and he suggests a more complicated expression.
%
%
% He therefor suggests to use
% \begin{align}
% \vec{u}_1 &= \vec{u}(t-\Delta{t}/2) + \frac{q}{m}\vec{E}(t)\frac{\Delta{t}}{2} \\
@@ -681,15 +687,15 @@ $\gamma = \sqrt{1 + \vec{u}_1\cdot\vec{u}_1 / c^2}$, which according to
% s &= \frac{1}{1 + \vec{\tau}\cdot\vec{\tau}}\\
% \vec{u}(t+\Delta{t}/2) &= s\left( \vec{u}' + (\vec{u}' \cdot \vec{\tau})\vec{\tau} + \vec{u}' \times \vec{\tau}\right)
% \end{align}
%
%
Other modifications of the Boris push, such as \cite{Higuera_2017} and
\cite{Umeda_2018} exist as well. Some comparision between different variants
\cite{Umeda_2018} exist as well. Some comparison between different variants
can be found in \cite{Ripperda_2018} or \cite{Zenitani_2018}.
% All of these algorithm assume that the electric and magnetic fields do not
% change during the time step $\Delta{t}$, nor is the field reinterpolated to the
% changing position of the particle. The particle therefore effectively
% experiences a constant and homogenous field. The solution to the (relativistic)
% experiences a constant and homogeneous field. The solution to the (relativistic)
% equation of motion is in principle known analytically (see e.g.
% \cite{Hyman_1997}), but no particle pusher based on this analytic solution is
% in widespread use.
@@ -702,7 +708,7 @@ Now that the electromagnetic field has acted on the particle we need to
calculate -- in the case of an electrostatic code -- the charge density
distribution resulting from the new locations of the particles, or -- in the
case of an electromagnetic code -- the current density distribution. This
requires interpolation from the particle locations back to the grid. As
requires interpolation from the particle locations back to the grid and is typically the most expensive operation in the simulation code. As
\cite{Birdsall_2005} shows it is desirable to use the same interpolation method
for both the interpolation from the grid to the particle location as well as
the deposition of the particle quantities $\rho$ and $\vec{\jmath}$ onto the
@@ -716,7 +722,7 @@ $\vec{x}(t+\Delta{t})$ is straight forward and simply given by
The sum is taken over all particles, multiplying their charge with the weight
function based on the distance between the particle position
$\vec{x}_p(t+\Delta{t})$ and the origin of the grid cell, where the charge
density is located.
density is located.
%One might be tempted to locate the charge density at the
%center of the cell, to allow for the nice interpretation as the charge
%contained in the cell, but typically the field solver calculates the
@@ -775,7 +781,7 @@ The first of these so called \textit{charge conserving} schemes is by
%\footnote{this paper is probably better known for the novel
%Maxwell solver described therein, not the current deposition algorithm.}
but several others have been developed since. The deposition in these schemes is
slightly more expensive than in the naive algorithm, but the the need to remove
slightly more expensive than in the naive algorithm, but the need to remove
violations of Gauss' Law is completely eliminated.
Somewhat more widely implemented in the scheme by \cite{Villasenor_1992}. The
@@ -809,7 +815,7 @@ Additionally this scheme is tedious to extend to shape functions beyond CIC.
, it's trajectory is modified to go via the midpoint.}
\label{fig:num:currentassignment_umeda}
\end{subfigure}
\caption{Charge conserving current desposition}
\caption{Charge conserving current deposition}
\end{figure}
@@ -823,10 +829,10 @@ total current is identical, but the distribution onto the different grid points
is different. In this algorithm the motion of the particle is decomposed into
separate displacements parallel to the grid axis that are weighted
individually. Readers that are interested in implementing this algorithm are
refered back to the excellent original paper.
referred back to the excellent original paper.
The other widely used scheme
%in modern codes
The other widely used scheme
%in modern codes
is the Zig-Zag scheme described in
\cite{Umeda_2003}. In this scheme particles can only cross between cells at the
midpoint of the interface. A particle that does not naturally go through that
@@ -834,7 +840,7 @@ point has its motion split into a motion from the starting position to the mid
point, followed by a separate motion from the midpoint to the final location,
resulting in a Zig-Zag trajectory %that gave the scheme it's name.
as illustrated in Fig.~\ref{fig:num:currentassignment_umeda}% illustrates this motion and the
resulting current for the same particle trajectory as used before.
resulting current for the same particle trajectory as used before.
%Finding the midpoints for the fraction of particles that does not stay in the same cell
%requires some conditional code, but the upside is that the current deposition
%inside each cell is slightly simpler. Overall the computational cost and
@@ -855,13 +861,13 @@ noise-properties between the two deposition schemes is similar
%discrete exterior algebra in its derivation.
Once the current is deposited on the grid it can be filtered to remove unwanted
noise. The paper by \cite{Vay_2011} has an introduction to some digital filters
noise. The noise level in PiC simulations is exacerbated by the artificially lowered number of macro particles. The paper by \cite{Vay_2011} has an introduction to some digital filters
and the associated terminology. Many codes simply use one or more passes of a
simple binomial filter to reduce high frequency fluctuations, but it is
possible to tune filters specifically to the problem at hand and get much
better performance.
\subsection{Initalization and Particle Handling}
\subsection{Initialization and Particle Handling}
\label{subsec:num:init}
@@ -870,9 +876,9 @@ better performance.
%particles and how new source terms are deposited onto the grid based on the
%updated particle properties. An important part that is still undescribed is the
%setup of the initial conditions. For the field quantities on the grid these are
%usually simply set base on analytic expression for known equalibria. Most of
%them only require an inital magnetic field and have vanishing electric field.
%Creating the inital particle population is a little bit more complicated and
%usually simply set base on analytic expression for known equilibria. Most of
%them only require an initial magnetic field and have vanishing electric field.
%Creating the initial particle population is a little bit more complicated and
%can have an important influence on the noise level in the simulation.
%The difficulty is to create a number of particles that represent the desired
%distribution function $f(\vec{x},\vec{v},t_0)$. We will approach this problem
@@ -887,7 +893,7 @@ distribution function $f(\vec{x},\vec{v},t_0)$ is more complicated and the metho
used may have a measurable impact on the noise level.
The easiest and not uncommon case is a constant spatial density and
The easiest and not uncommon case is a constant spatial density
and a non-relativistic Maxwellian velocity distribution. In this
case we can pick the initial position of the particle at random using
\begin{equation}
@@ -963,13 +969,13 @@ equal parts of half the statistical weight and displace them slightly from the
center mass to ensure that the following plasma dynamics will transport them
separately. Some care can be taken that the displacement does not change the
energy in the electromagnetic fields.
%, but even without that the naive algorithm works well.
%, but even without that the naive algorithm works well.
The main problem is particle merging, as we will never find two
particles of exactly equal velocities close to each other. Combining two
particles of unequal speeds however can not conserve both momentum and energy
at the same time.
at the same time.
%A first solution was offered by \cite{Shon_2001}, combining several particles
%into several new particles to conserve charge density, momentum and energy.
%into several new particles to conserve charge density, momentum and energy.
In simulations where many new particles are created the algorithm by
\cite{Welch_2007} that estimates the distribution function from $N \gg 2$
particles and replaces them with $M$ ($2 \ll M < N$) new particles can be
@@ -980,7 +986,7 @@ described by the first few fluid moments, it is necessary to find particles of
similar speeds. The method by \cite{Martin_2012} to find such particle pairs or
groups can be useful for this task. The method by \cite{Vranic_2015} aims to
merge $N$ existing particles into two new particles while conserving charge,
momentum and energy.
momentum and energy.
%If the reason for splitting particles is mesh-refinement
%in one of the rare AMR codes, the method by \cite{Drouin_2018} can help with
%splitting, but merging remains a problem.
@@ -1005,8 +1011,8 @@ lower end of the coordinate. Particles that leave through one side are
reinjected unmodified at the other end. Periodic boundary conditions mimic
infinite space reasonably well, as there are no fixed walls or ends to the
simulations. The periodic nature of the simulation does however select a finite
number of modes %-- out of the infinite possibilities that exist in free space --
that have an integer number of wavelengths in the simulation box. The number of grid
number of modes %-- out of the infinite possibilities that exist in free space --
that have an integer number of wavelengths in the simulation box. The number of grid
limits the mode number and the spectrum.
%If the number of grid cells is small, so is the number of allowed wave modes and the
@@ -1037,8 +1043,8 @@ domain. Vanishing electric field, even in the presence of an electric current
is typical for a \textit{perfect electric conductor} (PEC). This boundary
therefore mimics a metal wall with vanishing resistivity. If a realistic metal
boundary is required, much more effort is needed. This boundary condition does
reflect impinging electromagnetic waves. The PEC boundary is therefore often
coupled with a reflecting boundary condition for particles. When a particle
reflect impinging electromagnetic waves. The PEC boundary is therefore often
coupled with a reflecting boundary condition for particles. When a particle
ends outside the boundary at the end
of the timestep, both the component of the position normal to the wall, as well
as the normal component of the velocity are flipped. This process is identical to specular
@@ -1066,8 +1072,8 @@ the lower end of the moving window.
This brings us to the topic of absorbing boundary conditions. These have been a
problem for a long time. Initially Liao boundary conditions \cite{Liao_1984}
and Mur \cite{Mur_1981} have been used. These boundary condition are described
in detail in the great book on FDTD methods by \cite{Taflove_2000}. The problem
and Mur \cite{Mur_1981} have been used. These boundary condition are described
in detail in the great book on FDTD methods by \cite{Taflove_2000}. The problem
with these boundary conditions is that they
rely on fixed waves speeds. The presence of the plasma changes the wave speed.
%from the speed of light to a lower speed that might depend on wavelength,
@@ -1084,12 +1090,12 @@ reflected. Inside the material the wave is however damped, attenuating before
it reaches the actual boundary. There a simple boundary condition such as PEC
can be chosen. Any wave that does reach the boundary and gets reflected is
attenuated a second time on the way out, greatly improving performance of this
scheme.
scheme.
%Several different formulations of PML have been developed such as
%split-PML (where each electric and magnetic field component inside the boundary
%is split into two independent, unphysical fields that are damped separately),
%uniaxial PML (UPML) and more general stretched-coordinate PML wave been
%developed.
%developed.
One implementation known as convolutional PML (CPML) has been used
successfully in multiple cases. The book \cite{Berenger_2007} explains the
different methods and their connections.
@@ -1105,7 +1111,7 @@ the injection of fresh upstream with not-yet-reconnected magnetic flux allows
for the study of larger systems (see \cite{Daughton_2006,
Klimas_2008, Ohtani_2009}).
%Besides the injection of thermal plasma on the boundary
%Besides the injection of thermal plasma on the boundary
It is also possible to
inject electromagnetic waves to study their propagation. This can either be
achieved by the means of an artificial current, acting as an antenna or by
@@ -1115,7 +1121,7 @@ schemes that allow for the injection of realistic laser pulses
(\cite{Perez_2018}) or of magnetized plasma without unwanted numerical noise
(\cite{Kilian_2018}) are possible as well.%, but require a bit of care.
% Eliasson_2002.pdf outflow condition for fourier transformed vlasov-poison system
% Eliasson_2002.pdf outflow condition for Fourier transformed Vlasov-poison system
\subsection{Diagnostics}
\label{subsec:num:diag}
@@ -1123,34 +1129,35 @@ schemes that allow for the injection of realistic laser pulses
As much fun as it can be to write and run a Particle-in-Cell code, the ultimate
goal is to produce output that can be used to gain understanding of the
physical system. This requires the calculation of diagnostic quantities and
storing them in a way that persists beyond the duration of the simulation.
storing them in a way that persists beyond the duration of the simulation.
%As tempting as it might be to simply save the complete state of the simulation and
%use later post-processing to produce higher-level diagnostics and plots, it is
%usually a bad idea from a performance standpoint.
Simply storing the full state of the simulation is typically impossible for
%usually a bad idea from a performance standpoint.
Simply storing the full state of the simulation is typically impossible for
performance reasons.
Whenever possible the simulation code should calculate diagnostics as close
to the final plots and output only them. After all, a simple histogram for
a velocity distribution might only be a few kilobytes, where the dump of all
Whenever possible the simulation code should calculate diagnostics as close
to the final plots and output only them. After all, a simple histogram for
a velocity distribution might only be a few kilobytes, where the dump of all
particles is several terabytes. Saving the simulation state for later analysis or restart might still be necessary but should be performed as rarely as possible.
There are of course many high-level diagnostics and it is impossible to cover
all of them. This section will therefore mostly cover general-purpose output
that can be postprocessed further. To gain high-level insight into the
simulation at low I/O cost it is often useful to calculate a breakdown of
the energy content in the simulation in several rough categories, such as
the energy in the electric field, the energy in the magnetic field and in
the particles.
that can be postprocessed further. To gain high-level insight into the
simulation at low I/O cost it is often useful to calculate a breakdown of
the energy content in the simulation in several rough categories, such as
the energy in the electric field, the energy in the magnetic field and in
the particles. The diagnostic is also very valuable to check conservation of total energy in a PiC code that conserves momentum by construction.
Another obvious candidate for output are gridded quantities, such as
electric and magnetic field as well as current density. These quantities do not
require any extra calculation, but their size requires a binary output. The two most widely used choices are dumping the memory of every
require any extra calculation.
The two most widely used choices are dumping the memory of every
MPI domain to a separate binary file or writing a global view to a structured
format such as HDF5. The first choice has the advantage of very little
overhead. The downside is that the separate views of the different domains
need to be combined for further analysis. The overhead of creating many
format such as HDF5. The first choice has the advantage of low
overhead. The downside is that the separate views of the different domains
need to be combined for further analysis. The overhead of creating many
files at once and the tedious
file handling make this alternative a poor choice for more than a few hundred cores. Parallel I/O to HDF5 requires
file handling make this alternative a poor choice for more than a few hundred cores. Parallel I/O to HDF5 requires
slightly more complicated I/O code and introduces some overhead, but allows for
the inclusion of meta-data and easy loading into analysis tool, independent of
programming language and CPU architecture.
@@ -1177,10 +1184,10 @@ wallclock limit, or due to a compute node crashing. Also some analysis can
only be performed as post-processing, either due to poor scalability or because
it is actively being developed based on the simulation results. In this case,
the full particle information needs to be stored. Again direct binary dumps or
higher-level self-describing formats are the two main possibilities. Some codes
even implement both, the high-level format for scientific analysis and binary
dumps that are overwritten periodically as faster checkpoints that are only
used for restarts.
higher-level self-describing formats are the two main possibilities. %Some codes
%even implement both, the high-level format for scientific analysis and binary
%dumps that are overwritten periodically as faster checkpoints that are only
%used for restarts.
Many other diagnostics have been developed and the following list of examples
is certainly incomplete: one-dimensional histograms of particle quantities
@@ -1211,7 +1218,7 @@ to be included \cite{Kalapotharakos_2018}.
\label{subsec:num:test}
Compared to fluid codes that easily develop instabilities e.g. through
Compared to fluid codes that easily develop instabilities e.g. through
negative densities or numerical instabilities, PiC codes are rather robust.
This numerical stability is sometimes mistaken as physical plausibility.
It is therefore important that the researcher employs a healthy skepticism