Files
teaching/nummeth-ws22/skript.tex
T

6339 lines
411 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
\documentclass[12pt,a4paper,twoside]{scrbook}
%Individuelle Kopf- und Fußzeilen
\usepackage[headsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
%Tabellen
\usepackage{booktabs}%für horizontale Linien
\usepackage{multirow}
\usepackage{bigdelim}
%Figures
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{caption}
\usepackage{subcaption}%subfigures
\usepackage{sidecap}%caption an der seite
%Mathe/Physik
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{bigints}%rescale integrals
%\usepackage{bbold} % einheitsmatrix-doppeleins
\usepackage{esint}%volumen und oberflächenintegrale
\usepackage[thinc]{esdiff}%derivative-macros
\usepackage{physics}
\usepackage{siunitx}
\DeclareSIUnit\gauss{G}
\DeclareSIUnit \clight {\text{\ensuremath {c}}}
\sisetup{range-phrase=-}
\sisetup{range-units=single}
%Literatur
\usepackage{natbib}
\usepackage{csquotes}%recommended to ensure that quoted texts are typeset according to the rules of the main language
%Sonstiges
%\usepackage{microtype}%bessere abstände zur vermeidung von underfull boxes etc.
\usepackage[framemethod=tikz]{mdframed}%merkboxen
\mdfdefinestyle{theoremstyle}{
linecolor=gray,linewidth=2pt,
frametitlerule=true,
frametitlebackgroundcolor=gray,
}
\mdtheorem[style=theoremstyle]{nutshell}{"In a Nutshell"}
\usepackage{framed}%kleine merkboxen
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{color}%farbiger text
\usepackage{hyperref}
\usepackage{cleveref}
%\renewcommand{\vec}[1]{\boldsymbol{#1}}
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\begin{document}
%Titelseite(n)
\KOMAoptions{twoside=false}
%Preface and Contents
\clearpage
\begingroup
\pagestyle{empty}
\renewcommand*\chapterpagestyle{empty}
\begin{titlepage}
\centering
\includegraphics[width=0.5\textwidth]{./unihdlogo.pdf}\par\vspace{3cm}
{\scshape\LARGE Lecture Notes \par}
\vspace{1cm}
{\scshape\Large Winter 2022/2023 \par}
\vspace{2.5cm}
{\huge Numerical Methods in Plasma-Astrophysics
\par}
\vspace{3cm}
{\Large\itshape Priv.-Doz. Dr. F. Spanier \par}
\vfill
\end{titlepage}
\chapter*{Preface}
Plasma is sometimes called "the $4^{th}$ state of matter" or it is claimed that "99\% of the universe is made up of plasma". While there is some truth behind these claims, the reality is far more complex. It is an undisputed fact that most astrophysical objects are primarily containing plasma.
Unfortunately trying to understand astrophysical plasmas is not really simple and only very few cases allow for a simple pen-and-paper calculation. This inevitably leads to computer simulations. Within this lecture some simulation techniques shall be discussed. This list neither conclusive nor is everything discussed in depth.
This script is still deep in writing process. If you have suggestion or if you find errors, typos etc. please email \href{mailto:felix.spanier@uni-heidelberg.de}{felix.spanier@uni-heidelberg.de}\\
\tableofcontents
\clearpage
\endgroup
%Pagestyle, Kopf und Fußzeilen für den Rest des Dokuments
\newpage
\KOMAoptions{twoside=true}
\setcounter{page}{1}
\ohead{\headmark}
\automark[section]{chapter}
\setlength{\parindent}{0em}%keine Einrückung bei neuem Absatz
\chapter{Short introduction to plasma physics}
\label{chap:1-short-intro}
Many people - mostly people doing plasma research - claim that the universe is "99\% plasma". Others not so involved in the topic say that plasma is "the $4^{th}$ state of matter" and the common belief is that a plasma is simply an ionized gas.\\
None of the above is really wrong, but most of it is at some point incorrect. I would like to refer the reader to my lecture ``Introduction to astro-plasmaphysics'' or the vast literature to read about the details of how plasmas work. In order to understand the physical background of the numerical techniques in this lecture we will go through the main definitions and parameters of plasmas.
\section{Collective behavior}
\label{sec:1-1-coll-behavior}
The difference between a gas and a plasma is the interaction of single particles. In a gas interaction only takes place during collisions (particles "feel" the short range $r^{-6}$ field). In a plasma particles are subject to the long range $r^{-2}$ electrostatic forces. This leads to a simultaneous response of the plasma to an external stimulus.
\subsection{Debye Shielding}
\label{sec:1-1-1-debye-shielding}
The most important factor of a plasma is its ability to reduce electric fields effectively. The effect of shielding can be discussed by introducing an additional point-like charge $+Q$ into an infinite homogeneous plasma which has equal densities of ions and electrons $n_{e0}=n_{i0}$. $+Q$ shall be located at the origin of the coordinate system. Electrons will be attracted while ions will be repelled. This effect is sketched in \cref{fig:1-2-shielding}.
\begin{figure}[bh]
\centering
\begin{subfigure}[t]{.49\textwidth}
\centering
\includegraphics[width=.4\linewidth, height=3.5cm]{./fig_chapter1/2a_shielding.png}
\caption{Shielding arises from a net attraction of electrons and repulsion of ions, leading to trajectory bending.}
\label{fig:1-2-shielding-a}
\end{subfigure}
\begin{subfigure}[t]{.49\textwidth}
\centering
\includegraphics[width=.4\linewidth, height=3.5cm]{./fig_chapter1/2b_shielding.png}
\caption{For higher energies the trajectories become stiffer and the shielding less efficient}
\label{fig:1-2-shielding-b}
\end{subfigure}
\caption{The effect of shielding}
\label{fig:1-2-shielding}
\end{figure}
This gives rise to a net space charge in the vicinity of $+Q$, which tends to weaken the electric field generated by $+Q$.\par\medskip
The bending depends on the particle energy. The higher the energy of the electrons (ions), i.e. the higher the temperature of the electron(ion)gas is, the stiffer the trajectory becomes (\cref{fig:1-2-shielding-b}). Therefore a cold species of particles will be very effective in shielding the extra charge and we can conjecture that the size of the perturbed region is small, whereas the perturbation has a greater range for hotter electrons (ions).\par\medskip
Obviously, this shielding process is not static, but is governed by the thermal motion of the plasma electrons and ions. Therefore we need a simple statistical description, for which we use the Boltzmann factor. For a quantitative description we calculate the number of electrons and ions that are found at an enhanced electric potential in the vicinity of $+Q$. For a repulsive potential the Boltzmann factor \eqref{eq:1-1-boltz-distr} gives the number of particles in a thermal distribution that have overcome a potential barrier $\Phi$. For an attractive potential, the density can even become higher than the equilibrium value:
\begin{align}
\label{eq:1-8-shielding-densities}
n_{\mathrm{e}}(\mathbf{r})=n_{e 0} \exp \left(+\frac{e \Phi(\mathbf{r})}{k_{\mathrm{B}} T_{\mathrm{e}}}\right) \nonumber\\
\\
n_{\mathrm{i}}(\mathbf{r})=n_{i 0} \exp \left(-\frac{e \Phi(\mathbf{r})}{k_{\mathrm{B}} T_{\mathrm{i}}}\right). \nonumber
\end{align}
For simplicity, we assume that the perturbed potential $\Phi$ is small compared to the thermal energy, which allows us to expand the exponential and use only the first term in the Taylor-expansion
\begin{align}
\label{eq:1-9-shielding-densities-approx}
n_{\mathrm{e}}(\mathbf{r}) \approx n_{\mathrm{e} 0}\left(1+\frac{e \Phi(\mathbf{r})}{k_{\mathrm{B}} T_{\mathrm{e}}}\right)\nonumber\\
\\
n_{\mathrm{i}}(\mathbf{r}) \approx n_{\mathrm{i} 0}\left(1-\frac{e \Phi(\mathbf{r})}{k_{\mathrm{B}} T_{\mathrm{i}}}\right). \nonumber
\end{align}
A self-consistent solution for the electric potential can then be obtained by using
Poisson’s equation
\begin{equation}
\label{eq:1-10-shielding-poisson}
\Delta \Phi = -4 \pi \rho = -4 \pi \left[Q \delta (\vec{r}) - e n_{\mathrm{e}}(\mathbf{r})+e n_{\mathrm{i}}(\mathbf{r}) \right].
\end{equation}
Inserting the linearized densities from \eqref{eq:1-9-shielding-densities-approx} we get
\begin{equation}
\label{eq:1-11-insert-linearization}
\frac{\partial^{2} \Phi}{\partial r^{2}}+\frac{2}{r} \frac{\partial \Phi}{\partial r}=-4 \pi\left[4\pi Q \delta(r)-e n_{\mathrm{e} 0} \frac{e \Phi}{k_{\mathrm{B}} T_{\mathrm{e}}}-e n_{\mathrm{i} 0} \frac{e \Phi}{k_{\mathrm{B}} T_{\mathrm{i}}}\right]
\end{equation}
We are only considering the $r$-dependency, i.e. we assume spherical symmetry. This can be brought into the Helmholtz-type equation
\begin{equation}
\label{eq:1-12-shielding-helmholtz}
\frac{\partial^{2} \Phi}{\partial r^{2}}+\frac{2}{r} \frac{\partial \Phi}{\partial r}-\frac{1}{\lambda_{\mathrm{D}}^{2}} \Phi=-16 \pi^2 Q \delta(r).
\end{equation}
The parameter $\lambda_D$ has the dimension of a length and is defined by
\begin{equation}
\label{eq:1-13-debye-length}
\frac{1}{\lambda_{\mathrm{D}}^{2}}=\frac{4 \pi e^{2} n_{\mathrm{e} 0}}{ k_{\mathrm{B}} T_{\mathrm{e}}}+\frac{4 \pi e^{2} n_{\mathrm{i} 0}}{ k_{\mathrm{B}} T_{\mathrm{i}}}
\end{equation}
The differential equation \eqref{eq:1-12-shielding-helmholtz} can be solved by assuming that the potential distribution is given by a modified Coulomb potential
\begin{equation}
\label{eq:1-14-mod-coulomb}
\Phi(r)=\frac{a}{r} f(r).
\end{equation}
Then for all $r>0$ the function $f(r)$ is a solution of the differential equation
\begin{equation}
\label{eq:1-15-shielding-dgl-allg}
f^{\prime \prime}-\lambda_{\mathrm{D}}^{-2} f=0,
\end{equation}
which gives $f_1(r) = \exp(-r/\lambda_D)$. The second solution $f_2(r) = \exp(+r/\lambda_D)$ is unphysical due to the exponential growth.\\
The solution to the original problem is then
\begin{equation}
\label{eq:1-16-shielding-solution}
\Phi(r)=\frac{Q}{r} \mathrm{e}^{-r / \lambda_{\mathrm{D}}}.
\end{equation}
This is called Debye-Hückel-potential. Typically this is also called "Debye-shielding". The parameter $\lambda_D$ is the Debye shielding length. For the identification of specific contributions the electron Debye length $\lambda_{De}$ and ion Debye length $\lambda_{Di}$ are defined:
\begin{equation}
\label{eq:1-17-individual-debye-length}
\lambda_{\mathrm{De}}=\left(\frac{k_{\mathrm{B}} T_{\mathrm{e}}}{4 \pi n_{\mathrm{e} 0} e^{2}}\right)^{1 / 2} \lambda_{\mathrm{Di}}=\left(\frac{k_{\mathrm{B}} T_{\mathrm{i}}}{4 \pi n_{\mathrm{i} 0} e^{2}}\right)^{1 / 2}.
\end{equation}
\subsection{Quasineutrality}
\label{sec:1-1-2-quasineutrality}
As we have learned in the preceding paragraph, a plasma is not a strictly neutral mixture of electrons and positive ions but deviations from neutrality can develop on short scales, the Debye length. Therefore, we define that on length scales larger than the Debye length the plasma must be quasineutral
\begin{equation}
\label{eq:1-18-quasineutral}
\left|\sum_{j} Z_{j} e n_{\mathrm{i} 0, j}-n_{\mathrm{e} 0} e\right| \ll n_{\mathrm{e} 0} e.
\end{equation}
Here, the sum is extended over all (positive) ion species $j$ of charge number $Z_{j}$. The charge number is a positive quantity, hence negative ions will have a minus sign before the charge number. For a single ion species of charge $q=+e$ the short-hand notation of the quasineutrality condition is $n_{\mathrm{i} 0}=n_{\mathrm{e} 0} .$ In this way, quasineutrality can be used as a defining quality of a classical plasma.The plasma region can be distinguished from space-charge regions.
\subsection{Response Time and Plasma Frequency}
\label{sec:1-2-3-plasma-freq}
The response to an external electric perturbation was established by the combined
action of many particles. Therefore, Debye shielding is one example for collective
behavior of a plasma. The second aspect of collective behavior is the time scale,
after which the electrons establish a shielded equilibrium.The heavier ions will take a much longer time to reach their equilibrium positions.\\
When the potential perturbation is small, $|e \Phi| \ll k_{\mathrm{B}} T,$ the electron energy is not much changed from its thermal value. Hence, the typical electron velocity remains close to a thermal velocity $v_{\mathrm{e}} \approx\left(k_{\mathrm{B}} T_{\mathrm{e}} / m_{\mathrm{e}}\right)^{1 / 2}$. For the establishment of the new equilibrium, the electron must be able to reach its new position at a typical distance $\lambda_{\mathrm{De}} .$ This time can be estimated as $\tau \approx \lambda_{\mathrm{De}} / v_{\mathrm{e}} .$ The reciprocal of this response time is called the electron plasma frequency
\begin{equation}
\label{eq:1-19-plasma-freq}
\omega_{\mathrm{pe}}=\frac{v_{\mathrm{e}}}{\lambda_{\mathrm{De}}}=\left(\frac{4 \pi n_{\mathrm{e} 0} e^{2}}{m_{\mathrm{e}}}\right)^{1 / 2}.
\end{equation}
\section{Existence regimes}
\label{sec:1-2-exis-regimes}
A plasma of size $L$ must be sufficiently large, i.e. $L>>\lambda$ to behave in a collective manner (candle flames are not a plasma...). A plasma must also exist longer than the response $t>>\omega_{pe}^{-1}$.\\
Plasmas are found in a huge parameter space, which covers seven orders of magnitude in temperature and twenty-five orders of magnitude in electron density (see \cref{fig:1-3-existence-diagramm}
).
\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth, height=0.45\paperheight]{./fig_chapter1/3_existence-diagramm.png}
\caption{Existence diagram of various plasmas. The dotted line marks the border for strong coupling, the dashed line the onset of quantum effects. Relativistic effects play a role for $T > 10^9 \si{\kelvin}$}
\label{fig:1-3-existence-diagramm}
\end{figure}
\subsection{Strong-Coupling Limit}
\label{sec:1-2-1-strong-coupling}
The usual definition of a weakly coupled or ideal plasma is the requirement that there are many electrons inside the electron Debye sphere. This ensures that Debye shielding is a collective process and that the statistical derivation of a Debye length was correct. For this purpose we define the number of electrons inside the electron Debye sphere as the plasma parameter $N_{\text {De }}$
\begin{equation}
\label{eq:1-20-plasma-parameter}
N_{\mathrm{De}}=\frac{4 \pi}{3} \lambda_{\mathrm{De}}^{3} n_{\mathrm{e}}
\end{equation}
Because of the different temperatures, we can have different coupling states of electrons and ions $N_{\mathrm{De}} \neq N_{\mathrm{Di}} .$\\
The border line between weakly and strongly coupled plasmas is defined by $N_{\mathrm{De}}=1$ (see dotted line in \cref{fig:1-3-existence-diagramm} ), which gives the equation of the border line
\begin{equation}
\label{eq:1-21-border-line}
n_e = \frac{k_B^3}{36 \pi e^6} T_e^3
\end{equation}
This line has the slope 3 in the $\log n-\log T$ representation of \cref{fig:1-3-existence-diagramm} and we obtain a relation between the plasma parameter $N_{\mathrm{Di}}$ and the coupling parameter $\Gamma_{\mathrm{i}}$
\begin{equation}
\label{eq:1-22-coupling-parameter2}
\Gamma_{\mathrm{i}}=\frac{1}{3} N_{\mathrm{Di}}^{-2 / 3}.
\end{equation}
Hence, a larger number of particles in the Debye sphere ensures that the coupling strength is small. In other words, the electric field is the average field of many particles, whereas in a strongly coupled system the field of the nearest neighbor dominates. Weakly coupled plasmas are found at high temperature and low electron density.
\subsection{Quantum effect}
\label{sec:1-2-2-quantum-effects}
Quantum effects come into play when the interparticle distance of the electrons becomes comparable with their thermal de Broglie wavelength
\begin{equation}
\label{eq:1-23-de-broglie}
\lambda_{\mathrm{B}}=\frac{h}{m_{\mathrm{e}} v_{\mathrm{Te}}}.
\end{equation}
Here, $v_{\mathrm{Te}}=\left(2 k_{\mathrm{B}} T_{\mathrm{e}} / m_{\mathrm{e}}\right)^{1 / 2}$ is the most probable speed of a Maxwell distribution (see Sect. 4.1). In this limiting case, the Pauli exclusion principle becomes important and we must use Fermi-Dirac statistics. Such a plasma is called degenerate and the conditions of a cold dense plasma are typically found in dead stars, like White Dwarfs. It is worth mentioning that the exclusion principle prevents the final collapse of such a burnt-out star.\par\medskip
The second border line for degeneracy of the electron gas, $\lambda_{\mathrm{B}}=n_{\mathrm{e}}^{-1 / 3}$ is also shown as dashed line in Fig. $2.5 .$ Here, the slope is $3 / 2$ in the $\log n-\log T$ diagram. Note that the electrons in a metal form a strongly coupled degenerate system. Relativistic effects for the electrons become important for $T>10^{9} \mathrm{~K}$ as marked by the dot-dashed line in Fig. $2.5 .$ The marked regions of typical plasmas can all be treated by non-relativistic models.
\begin{nutshell}[Basics]
\begin{itemize}
\item Plasmas are quasineutral: $n_{\mathrm{e}}=\sum_{k} Z_{k} n_{k}$.
\item Quasineutrality can be violated within a Debye length $\lambda_{D}$
$$
\lambda_{\mathrm{D}}=\frac{\lambda_{\mathrm{De}} \lambda_{\mathrm{Di}}}{\left(\lambda_{\mathrm{De}}^{2}+\lambda_{\mathrm{Di}}^{2}\right)^{1 / 2}} \quad, \quad \lambda_{\mathrm{De}, \mathrm{Di}}=\left(\frac{ k_{\mathrm{B}} T_{\mathrm{e}, \mathrm{i}}}{4 \pi n_{\mathrm{e}, \mathrm{i}} e^{2}}\right)^{1 / 2}
$$
\item Quasineutrality can be established by the electrons within $\tau=\omega_{\mathrm{pe}}^{-1},$ with the plasma frequency
$$
\omega_{\mathrm{pe}}=\left(\frac{4 \pi n_{\mathrm{e}} e^{2}}{ m_{\mathrm{e}}}\right)^{1 / 2}
$$
\item The coupling parameter $\Gamma$ determines the state of each plasma component (electrons, ions, dust)
$$
\Gamma=\frac{q^{2}}{a_{\mathrm{WS}} k_{\mathrm{B}} T}
$$
$\Gamma$ may be different for the components, depending on the individual temperatures and densities. A gaseous phase is found for $\Gamma \ll 1$, the liquid state for $1<\Gamma<180$ and the solid phase for $\Gamma>180$.
\end{itemize}
\end{nutshell}
\section{Single particle description}
\label{sec:1-3-single-particle}
\subsection{Basic Equations}
\label{sec:1-3-1-motion-basics}
We will start with Newton's equation of motion together with the Lorentz force for a particle of mass $m$, charge $q$ in a given electric field $\vec{E}$ and magnetic field $\vec{B}$:
\begin{equation}
\label{eq:2-1-newton-lorentz}
\diff{\vec{p}}{t} = m \dot{\vec{v}} = q \left(\vec{E} + \frac{\vec{v}}{c} \times \vec{B} \right)
\end{equation}
\subsection{Cyclotron Frequencies}
\label{sec:2-1-2-cyclotron}
Let us first consider the case of a homogeneous and stationary magnetic field $\vec{B} = B_z \vec{e}_z$ and a vanishing electric field $\vec{E}=0$. This yields the equations:
\begin{align}
\label{eq:2-2-cartesian-eom}
\nonumber \dot{v}_x &= + v_y \frac{q}{m c} B_z \\
\dot{v}_y &= - v_x \frac{q}{m c} B_z \\
\nonumber\dot{v}_z &= 0.
\end{align}
Combining the equations for $v_x$ and $v_y$ yields the differential equation for a harmonic oscillator
\begin{equation}
\label{eq:2-3-harmonic-osci}
\ddot{v}_{x,y} = - \left(\frac{q B_z}{m c}\right)^2 v_{x,y} \, .
\end{equation}
The frequency for this oscillator is
\begin{equation}
\label{eq:2-4-cyclotron-frequency}
\Omega = \frac{\lvert q \rvert}{m c} B_z \, ,
\end{equation}
This frequency is called cyclotron frequency (sometimes designated $\omega_c$). \\
For protons and electrons we find
\begin{align*}
\Omega_p &= 9,58 \times 10^3 \, \si{\per\second} \cdot B \,[\text{Gauss}] \, , \\
\Omega_e &= 1,76 \times 10^7 \, \si{\per\second} \cdot B \, [\text{Gauss}] \, . \\
\end{align*}
In the x–y plane, a particle with perpendicular velocity $v_{\perp}$ performs a circular orbit with the gyroradius or Larmor radius
\begin{equation}
\label{eq:2-5-lamor-radius}
r_L = \frac{v_{\perp}}{\Omega}
\end{equation}
When the initial velocity $v_z$ along the magnetic field is nonzero, the orbit becomes a helix of constant pitch about the magnetic field direction. The motion about a magnetic field line is referred to as gyromotion or gyroorbit.\\
The sense of rotation about the magnetic field depends on the sign of the particle’s charge. Electrons move in a right-handed, positive ions in a left-handed orbit (see \cref{fig:2-1-gyromotion}).
\begin{SCfigure}
\centering
\caption{A schematic overview of the gyromotion for charged particles. Note the different direction for $e^-$ and $\text{Ion}^+$ !}
\includegraphics[width=0.49\textwidth]{./fig_chapter1/1_gyromotion.png}
\label{fig:2-1-gyromotion}
\end{SCfigure}
When the ions (electrons) can perform complete gyroorbits, the ions (electrons) are called magnetized. This is the case, when the gyroorbits are not interrupted by collisions. A condition for this to happen is that the ion (electron) collision frequency (\color{red} hier Referenz auf entsprechendes kapitel einsetzen\color{black}) is smaller than the ion (electron) cyclotron frequency. Usually, this condition can be better fulfilled by electrons than by ions.
\subsection{E x B Drift}
\label{sec:1-3-3-exb-drift}
When we allow for a stationary and homogeneous electric field, we can choose the orientation of our coordinate system to have electric and magnetic field in the $x-z$ plane, $\vec{E}=\left(E_{x}, 0, E_{z}\right)$ and $\vec{B}=\left(0,0, B_{z}\right) .$ In this case, Newton's equation of motion reads
\begin{equation}
\label{eq:2-6-drift-eom}
\begin{aligned}
\dot{v}_{x} &=\frac{q}{m}\left(E_{x}+\frac{v_{y}}{c} B_{z}\right) \\
\dot{v}_{y} &=\frac{q}{m}\left(-\frac{v_{x}}{c} B_{z}\right) \\
\dot{v}_{z} &=\frac{q}{m} E_{z} \, .
\end{aligned}
\end{equation}
The motion along the magnetic field is now accelerated but independent of the motion in the $x-y$ plane. According to the principle of superposition of motions, we can consider both effects separately. For the $x-y$ plane, the motion can again be decomposed
\begin{equation}
\label{eq:2-7-eom-decomposed}
\begin{array}{l}
\ddot{v}_{x}=-\Omega^{2} v_{x} \\
\ddot{v}_{y}=-\Omega^{2}\left(v_{y}+c \frac{E_{x}}{B_{z}}\right) \, .
\end{array}
\end{equation}
Again, we find a harmonic oscillation in $x$ -direction, but the motion in $y$ -direction is more complex. In a moving frame of reference, $\tilde{v}_{y}=v_{y}+c \cdot E_{x}/B_{z},$ which moves at a constant velocity $-c \cdot E_{x} / B_{z}$ in negative $y$ -direction, we obtain a simple harmonic motion
\begin{equation}
\label{eq:2-8-eom-y-direction}
\ddot{\tilde{v}}_{y}=-\Omega^{2} \tilde{v}_{y} \, .
\end{equation}
Thus the solution for the velocities is the superposition of a circular orbit and a constant motion in the same plane. This constant motion is called the $\mathrm{E} \times \mathrm{B}$ -drift. For a particle that is initially at rest, the solution reads
\begin{equation}
\label{eq:2-9-solution-drift}
\begin{aligned}
v_{x} &= c \frac{E_{x}}{B_{z}} \sin \Omega t \\
v_{y} &= c \frac{E_{x}}{B_{z}}\left[\cos \Omega t-1\right]
\end{aligned}
\end{equation}
A typical trajectory is shown in \cref{fig:2-2-drift}. Mathematically, the trajectory is a cycloid. For a positive particle starting at $t=0$ from the origin, the trajectory is described by
\begin{equation}
\label{eq:2-10-trajectory-drift}
x=\frac{c E_{x}}{B_{z} \Omega}\left[1-\cos \left(\Omega t\right)\right], \quad y=\frac{c E_{x}}{B_{z} \Omega}\left[\sin \left(\Omega t\right)-\Omega t\right]
\end{equation}
The $\vec{E} \times \vec{B}$ -drift can also be understood from energy considerations. On the high potential side, the kinetic energy is small, which makes the instantaneous gyroradius small. On the low-potential side, the ion has gained kinetic energy from the electric field, which makes the gyro-radius larger. The combination of these two effects results in a cycloidal motion.
It is a peculiarity of the $\vec{E} \times \vec{B}$ -drift that negative electrons and positive ions experience the same sign of the drift velocity. This is a consequence of the fact that the applied electric field force $q \vec{E}$ and the resulting Lorentz force $q \vec{v} \times \vec{B}$ both depend on the sign of $q,$ which cancels in the result. This effect can also be seen in \cref{fig:2-2-drift}. In vector notation, the $\vec{E} \times \vec{B}$ drift velocity is given by
\begin{equation}
\label{eq:2-11-drift-velocity}
\vec{v}_{E}=c \frac{\vec{E} \times \vec{B}}{B^{2}} \, .
\end{equation}
\begin{SCfigure}[1][th]
\centering
\caption{Cycloidal trajectory resulting from the superposition of gyro-motion and E × B-drift. The electric field is oriented along the x-axis, the magnetic field is perpendicular to the x–y plane. Note that ions (full line) and electrons (dashed line) have the same drift direction. An artificial electron mass, $m_e=0.3 m_{ion}$, was assumed here for clarity!}
\includegraphics[width=0.49\textwidth, height=0.4\paperheight]{./fig_chapter1/2_drift.png}
\label{fig:2-2-drift}
\end{SCfigure}
\section{Kinetic description}
In the classical description of plasmas the first step is to define a cold plasma (thermal velocity of all particles is zero). In this limit simple plasma descriptions are possible and the calculation of Eigenmodes is rather straightforward. For plasmas with a thermal distribution (mostly \emph{hot} plasmas) a different description is chosen: From Liouville's theorem over some dirty tricks the Vlasov equation can be derived:
\begin{equation}
\label{eq:vlasov-equation}
\frac{\partial f_{\alpha}}{\partial t}+\vec{v} \cdot \frac{\partial f_{\alpha}}{\partial \vec{r}}+\frac{q_{\alpha}}{m_{\alpha}}(\vec{E}+\frac{\vec{v}}{c} \times \vec{B}) \cdot \frac{\partial f_{\alpha}}{\partial \vec{v}}=0
\end{equation}
The \emph{Vlasov theory} is a quite complete description of fully ionized plasmas and it provides a solid foundation for wave-particle interactions. At the same time it often is much too detailed for practical purposes. The theory has its own limitations, in particular in weakly ionized plasmas (e.g., ionosphere, solar photosphere), where plasma-neutral collisions cannot be neglected. The effects arising from the collision term of the Boltzmann equation can be added to the Vlasov treatment, but that reduces the generality of the approach.
\subsection{Properties of the Vlasov equation}
\label{sec:1-4-1-properties-of-vlasov-eq}
The Vlasov equation is sometimes regarded as the most important equation of plasma physics. It has several useful properties:
\begin{itemize}
\item The Vlasov equation conserves particles. It is straightforward to show that
\begin{equation}
\label{eq:particle-conservation}
\frac{\partial}{\partial t} \int n_{\alpha} f_{\alpha} d^{3} r d^{3} v=0 \, ,
\end{equation}
by integrating $(5.1)$ over the entire $(\vec{r}, \vec{v})$ -space. Here $n_{\alpha}$ denotes the average density of species $\alpha$ in the volume under consideration.
\item Positive probabilities remain positive in the Vlasov description. If $f_{\alpha}(\vec{r}, \vec{v}, t=0)>0$ for all $(\vec{r}, \vec{v})$, then $f_{\alpha}(\vec{r}, \vec{v}, t)>0$ for all $t>0$. This is an important property to be ensured in numerical Vlasov simulations.
\item The Vlasov equation conserves entropy. Entropy is defined by
\begin{align}
\label{eq:entropy-conservation}
S &= -\sum_{\alpha} \int f_{\alpha} \ln f_{\alpha} d^{3} r d^{3} v \\
\Rightarrow \qquad \frac{d S}{d t} &=-\sum_{\alpha} \int\left(\frac{d f_{\alpha}}{d t} \ln f_{\alpha}+\frac{d f_{\alpha}}{d t}\right) d^{3} r d^{3} v=0 \, .
\end{align}
This is an important issue in the interpretation of Landau's solution of the Vlasov equation to which we turn in the next section.
\item The Vlasov equation has many equilibrium solutions. In statistical physics Boltzmann's \emph{H-theorem} states that there is a unique equilibrium in the collisional time scale, the Maxwell distribution. The relevant time scales of the Vlasov theory are much shorter than the collision periods due to the assumption $\partial f /\left.\partial t\right|_{c} \rightarrow 0 .$ Let $f_{\alpha 0}$ be any Vlasov equilibrium, then $\partial f_{\alpha 0} / \partial t=0$ and thus
\begin{equation}
\label{eq:equilibrium}
\left[\vec{v} \cdot \frac{\partial}{\partial \vec{r}}+\frac{q_{\alpha}}{m_{\alpha}}(\vec{E}+\vec{v} \times \vec{B}) \cdot \frac{\partial}{\partial \vec{v}}\right] f_{\alpha 0}=0 \, .
\end{equation}
In order to generate a general solution to this equation let $\left(\vec{r}^{\, \prime}\left(t^{\, \prime}\right), \vec{v}^{\, \prime}\left(t^{\, \prime}\right)\right)$ be the orbit of a particle that intersects the point $(\vec{r}, \vec{v})$ at the time $t^{\, \prime}=t$. If functions $a\left(\vec{r}^{\, \prime}, \vec{v}^{\, \prime}\right), b\left(\vec{r}^{\, \prime}, \vec{v}^{\, \prime}\right), \ldots$
are constants of motion for particles of species $\alpha$, then any function $f_{\alpha 0}\left[a\left(\vec{r}^{\, \prime}, \vec{v}^{\, \prime}\right),\right.$, $\left.b\left(\vec{r}^{\, \prime}, \vec{v}^{\, \prime}\right), \ldots\right]$ satisfies $(5.5)$ at the time $t^{\, \prime}=t$, and thus any function $f_{\alpha 0}[a(\vec{r}, \vec{v}), b(\vec{r}, \vec{v}), \ldots]$
of the constants of motion is a stationary-state solution of the Vlasov equation.
\end{itemize}
\paragraph{Examples of Vlasov Equilibria.}
\begin{enumerate}
\item $\vec{E}_{0}=\vec{B}_{0}=0 .$ In this case the constants of motion are
\begin{align*}
W &=\frac{m_{\alpha}}{2}\left(v_{x}^{2}+v_{y}^{2}+v_{z}^{2}\right) \\
\vec{p} &=m_{\alpha} \vec{v} \, .
\end{align*}
Examples of equilibrium solutions are now
\begin{align}
\label{eq:e-and-b-zero}
f_{\alpha 0} &= \left(\frac{m_{\alpha}}{2 \pi k_{B} T_{\alpha}}\right)^{3 / 2} \exp \left(-\frac{m_{\alpha}}{2 k_{B} T_{\alpha}} v^{2}\right) \\
f_{\alpha 0} &= C_{1} \frac{v_{0}}{2} \frac{1}{v^{4}+v_{0}^{4}} \\
f_{\alpha 0} &= C_{2} \, v_{0} \, \delta\left(v_{x}\right) \delta\left(v_{y}\right) \delta\left(v_{z}^{2}-v_{0}^{2}\right) \\
f_{\alpha 0} &= \sqrt{\frac{m_{\alpha}}{2 \pi k_{B} T_{\alpha}}} \delta\left(v_{x}\right) \delta\left(v_{y}\right) \exp \left(-\frac{m_{\alpha}\left(v_{z}^{2}-v_{\alpha 0}^{2}\right)}{2 k_{B} T_{\alpha}}\right) \, .
\end{align}
\item $\vec{E}_{0}=0, \vec{B}_{0}=B_{0}(\vec{r}) \vec{e}_{z} .$ A possible selection of constants of motion is
$$
\begin{array}{l}
W=\frac{m_{\alpha}}{2}\left(v_{x}^{2}+v_{y}^{2}+v_{z}^{2}\right) \\
p_{\|}=m_{\alpha} v_{z} \\
\vec{L}=m_{\alpha}\left(x v_{y}-y v_{x}\right) \vec{e}_{z}-q_{\alpha} r A_{\phi}(r) \vec{e}_{\phi}
\end{array}
$$
where $A_{\phi}$ is the azimuthal component of the vector potential, which is the only non-zero component in this configuration. \\
One of several possible equilibria for a constant $B_{0}$ is
\begin{equation}
\label{eq:constant-B0}
f_{\alpha 0}=F\left(v^{2}, v_{y}+\frac{q_{\alpha} B_{0}}{m_{\alpha} c} x, v_{x}-\frac{q_{\alpha} B_{0}}{m_{\alpha} c} y\right) \, .
\end{equation}
\end{enumerate}
\subsection{Vlasov-Maxwell-system}
\label{sec:1-4-2-landau-solution}
The Vlasov equation is not easy to solve. It must, of course, be done under the constraint to fulfill Maxwell's equations because the source terms of Maxwell's equations $(\rho, \vec{J})$ are determined by the distribution function, which, in turn, evolves according to the Vlasov equation. Furthermore, the force term in the Vlasov equation is nonlinear. Thus the Vlasov equation can be solved analytically only for small perturbations when linearization is possible. We start by writing functions to be solved as sums of equilibirum solutions and small perturbations
\begin{align*}
f_{\alpha} &=f_{\alpha 0}+f_{\alpha 1} \\
\vec{E} &=\vec{E}_{0}+\vec{E}_{1} \\
\vec{B} &=\vec{B}_{0}+\vec{B}_{1}
\end{align*}
and consider the equations of the first-order terms. However, the problem remains difficult. The general solution for homogeneous plasma in a homogeneous background magnetic field was presented for the first time by Bernstein [1958] and inclusion of inhomogeneities rapidly leads to problems that can be handled by numerical methods only. Landau [1946] solved the field-free case in the following way.
Consider homogeneous plasma free of ambient electromagnetic fields $\left(\vec{E}_{0}=\vec{B}_{0}=0\right)$ in \emph{electrostatic approximation}: $\vec{E}_{1}=-\nabla \varphi_{1} ; \vec{B}_{1}=0 .$ The linearized Vlasov equation is now
\begin{equation}
\label{eq:vlasov-linearized-1}
\frac{\partial f_{\alpha 1}}{\partial t}+\vec{v} \cdot \frac{\partial f_{\alpha 1}}{\partial \vec{r}}-\frac{q_{\alpha}}{m_{\alpha}} \frac{\partial \varphi_{1}}{\partial \vec{r}} \cdot \frac{\partial f_{\alpha 0}}{\partial \vec{v}}=0 \, ,
\end{equation}
where
\begin{equation}
\label{eq:vlasov-linearized-2}
\nabla^{2} \varphi_{1}=-4 \pi \sum_{\alpha} n_{\alpha} q_{\alpha} \int f_{\alpha 1} d^{3} v \, .
\end{equation}
\section{Fluid description}
\label{sec:1_5_derivation_of_macroscopic_equations}
\subsection{Derivation of macroscopic quantities}
\label{sec:1_5_1_derivation_of_macroscopic_quantities}
The Vlasov equation \ref{eq:vlasov-equation} as reproduced here
\begin{equation}
\frac{\partial f_{\alpha}}{\partial t}+\vec{v} \cdot \frac{\partial f_{\alpha}}{\partial \vec{r}}+\frac{q_{\alpha}}{m_{\alpha}}(\vec{E}+\frac{\vec{v}}{c} \times \vec{B}) \cdot \frac{\partial f_{\alpha}}{\partial \vec{v}}=0
\end{equation}
describes the temporal evolution of the distribution function in a collision free plasma. The inclusion of collision leads to the Boltzmann equation
\begin{equation}
\frac{\partial f_{\alpha}}{\partial t}+\vec{v} \cdot \frac{\partial f_{\alpha}}{\partial \vec{r}}+\frac{q_{\alpha}}{m_{\alpha}}(\vec{E}+\frac{\vec{v}}{c} \times \vec{B}) \cdot \frac{\partial f_{\alpha}}{\partial \vec{v}}=\left( \frac{\partial f_\alpha}{\partial t}\right)_\text{c}
\label{eq:boltzmann}
\end{equation}
The term on the RHS describes collisions through a collision operator in an arbitrary way. Depending on the specific problem this term may be complicated. This is typically a problem, when a numeric solution is needed for the Boltzmann equation. For most derivations used here we will just need some algebraic properties of the collision operator, but not the specific form.
A very simple form of a collision operator is the Krook model or relaxation time approximation: It is assumed that any distribution function will relax to an equilibrium after a certain time (typically this would be the Maxwell-Boltzmann distribution and the Krook model comes down to the H-theorem). The Krook model has the form
\begin{align}
\left( \frac{\partial f_\alpha}{\partial t}\right)_\text{c} = -\nu_c(f-f_0)
\label{eq:krook}
\end{align}
Here $f_0$ is the equilibrium distribution and $\nu_c$ the collision frequency. This model is often used in Lattice Boltzmann Simulations.
From thermodynamics and statistics we know that a distribution function can be characterized by an infinite series of moments of the distribution function. The same is true for the distribution function used in the Boltzmann or Vlasov equation. The first step now is to identify the moments of the distribution function with macroscopic quantities.
Before doing so we have to define a suitable normalization. In this case we choose
\begin{align}
\int_\mathfrak{V} \int_{\vec{v}} f(\vec r, \vec v, t) \dd^3 r \dd^3 v = N
\end{align}
So $f$ describes the \emph{number density} in the volume element $\dd x \dd y \dd z \dd v_x \dd v_y \dd v_z$ and has the unit \unit{cm^{-6} s^3}.
The average density in the volume $\mathfrak{V}$ is $\langle n\rangle =N/\mathfrak{V}$. However the particle density is usually a function of space and time. It is defined as the zero order velocity moment of the distribution function
\begin{align}
n(\vec r, t) = \int f(\vec r, \vec v, t) \dd^3 v
\end{align}
We will define the macroscopic quuantities as velocity moments of the distribution function
\begin{align*}
\int f(\vec r, \vec v, t) \dd^3 v;
\quad \int \vec v f(\vec r, \vec v, t) \dd^3 v;
\quad \int \vec v \vec v f(\vec r, \vec v, t) \dd^3 v
\end{align*}
In a plasma different species (labeled by $\alpha$) may have different distribution functions and therefore different velocity moments. If the particles of species $\alpha$ are charged with charge $q_\alpha$, the charge density\footnote{Please note that the use of $\rho$ as charge density is common, but not a unique choice. $\rho$ could very well be the mass density\dots} of the species is
\begin{align}
\rho_\alpha = q_\alpha n_\alpha
\end{align}
The first order moment yields the \emph{particle flux}
\begin{align}
\vec{\Gamma}_\alpha (\vec r, t) = \int \vec v f_\alpha(\vec r, t) \dd^3 v
\end{align}
Dividing this by the particle density we get the \emph{average velocity}
\begin{align}
\vec{V}_\alpha (\vec r, t) = \frac{\int \vec v f_\alpha(\vec r, t) \dd^3 v}{\int f_\alpha(\vec r, t) \dd^3 v}
\end{align}
from which we can further determine the \emph{current density}
\begin{align}
\vec j_\alpha(\vec r, t) = q_\alpha \vec{\Gamma}_\alpha = q_\alpha n_\alpha \vec{V}_\alpha
\end{align}
In second order we find the \emph{pressure tensor}
\begin{align}
\mathbb{P}_\alpha (\vec r, t) =
m_\alpha \int (\vec v - \vec{V}_\alpha)(\vec v - \vec{V}_\alpha) f_\alpha(\vec r,\vec v,t)\dd^3 v
\end{align}
where the product in the integral is \textbf{not} a scalar product, but a vector product of the type $A_{ij} = b_i c_j$. In the spherically symmetric case the pressure tensor reduces to the \emph{scalar pressure}
\begin{align}
P_\alpha = \frac{m_\alpha}{3} \int (\vec v - \vec{V}_\alpha)^2 f_\alpha(\vec r,\vec v,t)\dd^3 v = n_\alpha k_B T_\alpha
\end{align}
(the square now is actually a scalar product). Here we introduce the concept of \emph{temperature} $T_\alpha$. In the frame moving with the velocity $\vec V$ the temperature is given by
\begin{align}
\frac{3}{2} k_B T_\alpha (\vec r, t) = \frac{m_\alpha}{2} \frac{\int \vec v^2 f_\alpha(\vec r, t) \dd^3 v}{\int f_\alpha(\vec r, t) \dd^3 v}
\end{align}
which for a \emph{Maxwellian distribution} is the temperature of classical thermodynamics. In collisionless plasmas equilibrium distributions my be far from Maxwellian. Thus temperature is a non-trivial concept in plasma physics.
The relationship between the particle pressure and \emph{magnetic pressure} is the \emph{plasma beta}
\begin{align}
\beta = \frac{8\pi\sum_\alpha n_\alpha k_B T_\alpha}{B^2}
\end{align}
If $\beta>1$ the plasma governs the evolution of the magnetic field, if $\beta \ll 1$, the magnetic field determines the plasma dynamics.
\subsection{Derivation of differential equations}
\label{sec:1_5_2_derivation_of_evolution}
Now that we have defined the macroscopic quantities we can come back to Eq. \eqref{eq:boltzmann} to derive differential equations for these quantities. Starting with the zeroth moment of the Boltzmann equation itself we see that $f_\alpha \to 0$ for $v\to\infty$. Also the force term vanishes since
\begin{align}
\int \vec E \cdot \frac{\partial f}{\partial \vec v}\dd^3 v =
\int \frac{\partial }{\partial \vec v}(f \vec E) \dd^3v =\int f\vec{E}\cdot \dd \vec S = 0
\end{align}
as $f$ goes more quickly to 0 than $S$ and
\begin{align}
\int (\vec v \times\vec B) \cdot \frac{\partial f}{\partial \vec v}\dd^3 v = \int f(\vec v\times\vec B)\cdot\dd\vec S-\int f\frac{\partial}{\partial\vec v}\cdot(\vec v\times\ vec B)\dd \vec v = 0
\end{align}
The first vanisches with the same argument, the second vanishes since $\vec v\times\vec B$ is perpendicular to $\partial/\partial \vec v$.
The first term in the Boltzmann equation simply yields the time derivative of density. The collision term can be neglected as long as there are no ionizing or recombining collisions (as they would change the particle numbers in one species). We are left with the spatial derivative. Here velocity integration and spatial derivative can be interchanged
\begin{align}
\int \vec v\cdot \frac{f_\alpha}{\vec r} \dd^3 v = \nabla \cdot \int \vec v f_\alpha\dd^3 v = \nabla \cdot(n_\alpha \vec{V}_\alpha)
\end{align}
This leads to the\emph{continuity equation}
\begin{align}
\frac{\partial n_\alpha}{\partial t}+ \nabla (n_\alpha \vec{V}_\alpha) = 0
\label{eq:zeromomentcont}
\end{align}
Continuity equations for charge and mass are obtained by multiplying Eq. \eqref{eq:zeromomentcont} by $q_\alpha$ and $m_\alpha$ respectively. The continuity equation is a special case of a \emph{hyperbolic conservation law}
\begin{align}
\frac{\partial F}{\partial t} +\nabla\cdot\vec G = 0
\end{align}
for a density $F$ and a flux $\vec G$
Multiplying Eq. \eqref{eq:boltzmann} with $m_\alpha\vec v$ and integrating over $\vec v$ we find the first moment equation. This yields the \emph{momentum transport equation} which is the macroscopic \emph{equation of motion}
\begin{align}
n_\alpha m_\alpha \frac{\partial \vec{V}_\alpha}{\partial t} + n_\alpha m_\alpha \vec{V}_\alpha \cdot \nabla\vec{V}_\alpha - n_\alpha q_\alpha (\vec E + \frac{1}{c}\vec V_\alpha\times\vec B)+\nabla\cdot\mathbb{P}_\alpha = m_\alpha\int \vec v \left( \frac{\partial f_\alpha}{\partial t}\right)_\text{c}\dd^3 v
\label{eq:firstmomentmotion}
\end{align}
The average electric and magnetic field in Eq. \eqref{eq:firstmomentmotion} are determined by both internal and external sources and fulfill the average Maxwell equations
\begin{align}
\nabla\cdot \langle \vec E \rangle &= 4\pi(\sum_\alpha n_\alpha q_\alpha + \rho_\text{ext})\\ \nabla\times \langle \vec E \rangle &= \frac{1}{c}\frac{\partial\langle \vec E \rangle }{\partial t} +\frac{4\pi}{c}\left(\sum_\alpha n_\alpha q_\alpha\vec{V}_\alpha + \vec{j}_\text{ext}\right)\\
\end{align}
Because collisions transport momentum between different plasma species, the collision integral does not vanish, except for collisions between particles of the same species. The collision term is a complicated function of velocity. A useful approximation related to the Krook model is
\begin{align}
m_\alpha \int \vec v \left( \frac{\partial f_\alpha}{\partial t}\right)_\text{c}\dd^3 v = -\sum_\beta m_\alpha n_\alpha (\vec{V}_\alpha - \vec{V}_\beta)\langle v_{\alpha \beta}\rangle
\end{align}
where $\langle v_{\alpha \beta}\rangle$ is the average collision betewenn particles of type $\alpha$ and $\beta$.
The second-order contributions $\vec{V}_\alpha \cdot \nabla\vec{V}_\alpha$ and $\mathbb{P}_\alpha$ arise from terms containing products $\vec v \vec v$ or $\vec v\cdot \vec v$. The divergence of $\mathbb{P}_\alpha$ contains information of imhomogeneity and viscosity of the plasma. Note that $\mathbb{P}_\alpha$ is not independent of the collisions. For example if the collisions are frequent enough, the pressure tensor becomes diagonal or even isotropic.
Unfortunately the first moment equation contains the second moment of the distribution function (and this will go on forever\dots). The second moment of the Boltzmann equation can be calculated and the result will be presented here. But in most applications only the first two moments of the Boltzmann equation are used and the pressure tensor is replaced with a simple closure. Typically the pressure is assumed to be a scalar following an equation of state (isothermal, adiabatic, etc.).
The second moment equation is called \emph{energy} or \emph{heat transport equation}. We can write the equation in the form
\begin{align}
\frac{3}{2}n_\alpha k_B
\left( \frac{\partial T_\alpha}{\partial t}+\vec V_\alpha\cdot\nabla T_\alpha\right)
+P_\alpha \nabla\cdot \vec V_\alpha =\\\nonumber
-\nabla \cdot \vec H_\alpha-(\mathbb{P}_\alpha^\prime\cdot\nabla)\cdot\vec V-\frac{\partial}{\partial t}\left(\frac{n_\alpha m_\alpha V_\alpha^2}{2}\right)
\end{align}
where the isotropic part of the pressure $P_\alpha$ is written on the LHS and the non-isotropic part $\mathbb{P}_\alpha^\prime$.
The third order term $\vec H_\alpha$ describes the \emph{heat flux}. An equation for this quantity is found by taking the third order moment of the Boltzmann equation.
\subsection{Deriving MHD equations from the Boltzmann equation}
\label{sec:1_5_3_mhd_from_boltzmann}
So far we have derived macroscopic quantities and equations for each plasma species separately. The truncated series of equations can be used to set up a multi-fluid theory. Even in the presence of only one ion species and electrons it may be necessary to have more than two species, e.g., when different electron species with different temperature profiles exist.
Our goal is now to find a simplified single-fluid theory. As a first step we will reduce the problem to a two-fluid theory: All electrons are one fluid, all ions together another fluid. These two fluids interact through electromagnetic interaction and collisions.
\emph{Magnetohydrodynamics} (MHD) is probably the most widely known plasma theory. In MHD the plasma is considered as a single fluid in the center-of-mass (CM) frame. This a well-motivated approach in collision dominated plasmas, where the collisions constrain the plasma particles to follow each other closely and thermalize the distribution towards a Maxwellian, which makes the interpretation of velocity moments straightforward. MHD works also remarkably well in collisionless tenuous plasmas. However, great care should be exercised both with interpretation and approximations.
The single fluid variables are defined as:\\
mass density
\begin{align}
\rho_\text{m}(\vec{r}, t) = \sum_\alpha n_\alpha m_\alpha
\end{align}
charge density
\begin{align}
\rho_\text{q}(\vec{r}, t) = \sum_\alpha n_\alpha q_\alpha
\end{align}
macroscopic velocity
\begin{align}
\vec V(\vec{r}, t) = \frac{ \sum_\alpha n_\alpha m_\alpha \vec V_\alpha}{ \sum_\alpha n_\alpha m_\alpha}
\end{align}
current density
\begin{align}
\vec J(\vec{r}, t) = \sum_\alpha n_\alpha q_\alpha \vec V_\alpha
\end{align}
and pressure tensor in the CM frame
\begin{align}
\mathbb{P}_alpha^\text{CM}(\vec{r}, t) = m_\alpha\int (\vec v- \vec V)(\vec v - \vec V) f_\alpha\dd^3 v
\end{align}
from which we get the total pressure
\begin{align}
\mathbb{P}^\text{CM}(\vec{r}, t) = \sum_\alpha \mathbb{P}_\alpha^\text{CM}(\vec{r}, t)
\end{align}
Summing the individual continuity and momentum transport equation over particle species yields the continuity equation equations
\begin{align}
\frac{\partial \rho_\text{m}}{\partial t}+ \nabla \cdot(\rho_\text{m} \vec V) &= 0\\
\frac{\partial \rho_\text{q}}{\partial t}+ \nabla \cdot\vec J &= 0
\end{align}
and momentum transport equation
\begin{align}
\rho_\text{m}\left(\frac{\partial \vec V}{\partial t} +\vec V \cdot \nabla\vec V\right) = \rho_\text{q} \vec E +\vec J \times \vec B -\nabla\cdot\mathbb{P}
\end{align}
The momentum transport equation corresponds to the Navier-Stokes equation of hydrodynamics where the viscosity terms are written explicitly (here they are hidden in $\nabla\cdot\mathbb{P}$). At macroscopic level the deviations from charge neutrality are small and $\rho_\text{q} \vec E$ is usually negligible. The magnetic part of the Lorentz force $\vec J\times\vec B$ (sometimes called Amper\'e's force) is, however, essential in the theory of magnetic fluids.
Ohm's law in fluid description is a more complicated issue. In the particle picture the plasma current is the sum of all charged particle motions. In a single-fluid theory the current transport equation is derived by multiplying the momentum transport equations of each particle population by $q_\alpha/m_\alpha$ and summing over all populations. In the two-fluid case (e, i) we get
\begin{align}
\pd{\vec J}{t} + \nabla \cdot (\vec V \vec J + \vec J \vec V - \vec V\vec V \rho_\text{q}) = \sum_\alpha\frac{n_\alpha q_\alpha^2}{m_\alpha} \vec E
+\left(\frac{e^2}{m_e} + \frac{e^2}{m_i} \right)\frac{\rho_\text{m} \vec V \times\vec B}{m_e+m_i}\\\nonumber
- \left( \frac{e m_i}{m_e} -\frac{e m_e}{m_i} \right)\frac{\vec J \times \vec B}{m_e+m_i} -\frac{e}{m_e}\nabla\cdot\left( \mathbb{P}_i^\text{CM}\frac{m_e}{m_i}-\mathbb{P}_i^\text{CM}\right) +\sum_\alpha\int q_\alpha \vec v \left( \frac{\partial f_\alpha}{\partial t}\right)_\text{c}\dd^3 v
\label{eq:hannu_2_133}
\end{align}
where the products $\vec V \vec J$ etc., are cartesian tensors (dyads) with elements $V_i J_k$, and the divergence of a dyad is a vector, e.g. with components $\sum_i \partial_i V_i J_k$. This equation expresses the relationship between the electric current and the electric field. Thus it can be called \emph{generalized Ohm's law}.
The first step to simplify Eq. \eqref{eq:hannu_2_133} is to approximate the collision integral introducing a constant collision frequency $\nu$
\begin{align}
\sum_\alpha \int q_\alpha \vec v \left( \pd{f_\alpha}{t} \right)_\text{c}\dd^3 v = -\nu \vec J
\end{align}
Defining the \emph{conductivity } by $\sigma = n e^2/\nu m_e$ and neglecting all derivatives and the magnetic field in Eq. \eqref{eq:hannu_2_133} we get the familiar form of Ohm's law $\vec J = \sigma \vec E$.
Not all terms in the generalized Ohm's law are equally important. There are some that clearly are small than others (e.g. $\propto m_e/m_i$). Furthermore, the derivatives of the second-order terms $\vec V \vec J$, $\vec J \vec V$ and $\vec V \vec V$ can usually be neglected. At this level we have the generalized Ohm's law in the form that contains the most important terms for space plasmas
\begin{align}
\vec E + \frac{1}{c}\vec{v}\times\vec{B} = \frac{\vec J}{\sigma}\times\vec B-\frac{1}{n e}\nabla\cdot\mathbb{P}_e+\frac{m_e}{n e^2}\pd{\vec J}{t}
\label{eq:hannu_2_135}
\end{align}
Assume further so slow temporal change and large spatial gradient scales that $|\vec J\times\vec B|,\ |\partial \vec J/\partial t|$ and $|\nabla\cdot\mathbb{P}|$ are all smaller than $|\vec V\times\vec B|$. This leaves us with the standard form of Ohm's law in MHD
\begin{align}
\vec J = \sigma (\vec E +\frac{1}{c}\vec V \times \vec B)
\end{align}
which already familiar from elementary electrodynamics in cases, when moving frame are taken into account. Here the moving frame is attached to the fluid flow with the velocity $\vec V$. If the conductivity is very large, we find Ohm's law of the \emph{ideal MHD}
\begin{align}
\vec E +\frac{1}{c}\vec V \times \vec B=0
\end{align}
The road from the Liouville or Klimontovich equations to this simple equation is long and there are several potholes on the road. For example, while the ideal MHD is a reasonable starting point, it is not all clear that the next term to take into account should be $\vec J/\sigma$. In many space applications the \emph{Hall term} $\vec J\times\vec B/n e c$ and the pressure term $\nabla\cdot\mathbb{P}/ n e$ are more important.
\subsection{Simple approach: Adding terms to the equations of hydrodynamics}
\label{sec:1_5_4_from_hydrodynamics}
The approach using moments of the Boltzmann equation is instructive and allows for a microscopic derivation of Ohm's law, but is also very tedious. The different direction is to start with gas dynamics and add current and magnetic field.
The equation of ordinary gas dynamics can be written as
\begin{align}
\pd{\rho}{t} &= - \nabla \cdot(\rho\vec V)\label{eq:fluidcont}\\
\rho\frac{\dd \vec V}{\dd t} &= -\nabla P +\nu \rho\nabla^2\vec V \label{eq:navierstokes}\\
\frac{\dd}{\dd t}(P\rho^{-\gamma}) &= 0
\end{align}
where $\dd /\dd t = \partial/\partial t+ \vec V \cdot \nabla$ and $\gamma$ is the polytropic index. This set of five equations has five unknowns: density $\rho$, pressure $P$, and three velocity components. Equations \eqref{eq:navierstokes} are known as Navier-Stokes-equations, where $\nu$ is the viscosity. If viscosity can be neglected, as we often do in MHD, the equations are called Euler equations.
Of these equations Eq. \eqref{eq:fluidcont} is given in \emph{conservative form} $\partial F/\partial t +\nabla\cdot \vec G = 0$, where $F$ is the conserved quantity and $\vec G$ is the corresponding flux quantity. Often, particularly when doing numerical fluid simulations in conservative systems, it is convenient to write the whole theory in terms of conserved quantities. In hydrodynamics this requires that Euler equations can be used instead of Navier-Stokes-equations (i.e., $\nu=0$) because viscosity causes dissipation, making the system non-conservative.
The whole set of equations of conservative hydrodynamics can be formulated as
\begin{align}
\pd{\rho}{t} &= -\nabla\cdot \vec p\\
\pd{\vec p}{t} &= -\nabla\cdot\left( \frac{\vec p \vec p}{\rho} + P\mathbb{1} \right)\\
\pd{u}{t} &= -\nabla\cdot\left( (u+P)\frac{p}{\rho} \right)
\end{align}
where $\vec p = \rho \vec V$ is the momentum density (mass density flux), $\vec p \vec p$ denotes the direct product (dyad) with the components $p_i p_j$, $\mathbb{1}$ is the unit dyad, and $u$ the total energy density related to the pressure as
\begin{align}
u = \frac{p}{\gamma - 1} + \frac{\vec{p}^2}{2\rho}
\end{align}
$P/(\gamma-1)$ is the thermal energy density and $\vec{p}^2/2\rho$ is the kinetic energy density. Variables $(\rho, \vec V, P)$ are called \emph{primitive variables}, whereas $(\rho, \vec p, u)$ are \emph{conserved variables}.
In MHD we must add Amper\'e's force $\vec J \times \vec B$ to the momentum equation
\begin{align}
\pd{\vec p}{t}= -\nabla\cdot\left( \frac{\vec p \vec p}{\rho} + P\mathbb{1} \right) + \frac{1}{c} \vec J\times\vec B
\end{align}
This is not yet the conservative form, but neglecting the displacement current as we normally do in MHD we can express Amp\'ere's force as
\begin{align}
\vec{J} \times \vec B = -\frac{c}{4\pi}\vec B\times (\nabla \times \vec B)=\frac{c}{4\pi}\left( -\nabla \left(\frac{B^2}{2} \right) +\nabla\cdot(\vec B \vec B)\right)
\label{eq:koskinen69}
\end{align}
With this the momentum equation can be written in the conservative form
\begin{align}
\pd{\vec p}{t}= -\nabla\cdot\left( \frac{\vec p \vec p}{\rho} + \left(P\mathbb{1} + \frac{\vec{B}^2}{8\pi} \right) - \frac{1}{4\pi}\vec B \vec B\right)
\end{align}
Thus the momentum of the magnetic field is taken care of in a natural way. The magnetic field is now split into a magnetic tension ($\vec B \vec B$) and a magnetic pressure ($B^2$).
The energy equation is automatically conservative. However, it is instructive to write it in the form that explicitly illustrates the conservation of total energy density $u$ in the same way as in gas dynamics. This is straightforward to do because the magnetic energy density is $B^2/8\pi$. Thus
\begin{align}
u = \frac{P}{\gamma - 1}+\frac{\vec{p}^2}{2\rho} + \frac{B^2}{8\pi}
\end{align}
and the energy equation can be written as
\begin{align}
\pd{u}{t} = -\nabla\cdot\left( \left( u + P - \frac{\vec{B}^2}{8\pi} \right) \frac{\vec p}{\rho} + \frac{1}{4\pi \rho} \vec B\times(\vec p \times \vec B) \right)
\end{align}
We need one more equation to describe the time evolution of the magnetic field. Because we are now interested in conservative MHD, we must limit the discussion to the ideal MHD case, where $\vec E = -\vec V \times \vec B$. Inserting this into Faraday's law we get
\begin{align}
\pd{\vec B}{t}=\nabla\times(\vec V \times \vec B)
\end{align}
which after replacing $\vec V$ by the conserved quantity $\vec p$ reads
\begin{align}
\pd{\vec B}{t} = \nabla \times \left(\frac{\vec p}{\rho}\times\vec{B}\right)
\end{align}
Now we have the complete set of 8 equations for 8 conservative variables $(\rho, \vec p, u, \vec B)$ of the ideal MHD.
\chapter{Plasma-Astrophysics and where to find it}
\section{The Sun and other stars}
\begin{figure}
\begin{center}
\pgfimage[width=0.7\textwidth]{fig_chapter2/solar_plasmas}
\end{center}
\caption{ALMA image of the ISM \url{https://www.plasmacoalition.org/plasma_writeups/solar_plasmas.pdf} }
\label{fig:solar_plasmas}
\end{figure}
The Sun is in first place a fully ionized ball of gas. This could lead to the conclusion that the Sun is a pure plasma phenomenon. This is not completely true: In the core collisions are so frequent that the collective behaviour
\begin{figure}
\begin{center}
\pgfimage[width=0.7\textwidth]{fig_chapter2/plasma-parameters-sun}
\end{center}
\caption{Plasma parameters of the Sun \url{https://www.researchgate.net/figure/Plasma-parameters-and-magnetic-field-in-Sun-4_tbl1_312016940/download} }
\label{fig:plasma-sun}
\end{figure}
In the convection zone we find plasmas that can be well described by MHD theory, this holds to some degree also in the corona. In the corona we find also a larger number of nonthermal particles accelerated in solar energetic particle events or coronal mass ejections.
Coronal mass ejections (CME) will most likely not encounter collisions (mean free path of a proton is about 1 AU!) and therefore they are typically described as kinetic plasma.
\section{Interplanetary medium}
The Sun has an open atmosphere, i.e., particles are constantly streaming out. This particle stream is called the solar wind and consists mainly of protons and electrons. The wind is more or less collisionless and its density is decreasing outwards.
\begin{figure}
\begin{center}
\pgfimage[width=.7\textwidth]{fig_chapter2/ramigramm}
\end{center}
\caption{Profiles of solar wind speed (dash-dotted curves), Alfv´en
speed (dashed curves), and number density (solid curves). The thick
[thin] curves result from our slow [fast] solar wind model. A fit to the
observational equatorial electron densities is denoted by crosses (Vainio et al., 2003).}
\end{figure}
One of the most interesting features of the solar wind is the termination shock, the interface between the interstellar and interplanetary medium. Here shocks can be found, where cosmic are rays are accelerated or reflected.
\begin{figure}
\begin{center}
\pgfimage[width=.7\textwidth]{fig_chapter2/heliosphere}
\end{center}
\caption{Artist's impression of the heliosphere}
\end{figure}
\section{Earth's magnetosphere}
Earth's magnetosphere is the special case of the solar wind hitting a planetary body that has a magnetic field. The shape of the Earth's magnetosphere is the direct result of being blasted by solar wind. The solar wind compresses its sunward side to a distance of only 6 to 10 times the radius of the Earth. A supersonic shock wave is created sun-ward of Earth called the Bow Shock. Most of the solar wind particles are heated and slowed at the bow shock and detour around the Earth in the Magnetosheath. The solar wind drags out the night-side magnetosphere to possibly 1000 times Earth's radius; its exact length is not known. This extension of the magnetosphere is known as the Magnetotail. The outer boundary of Earth's confined geomagnetic field is called the Magnetopause. The Earth's magnetosphere is a highly dynamic structure that responds dramatically to solar variations. Also residing within the magnetosphere are areas of trapped charged particles; the inner and outer Van Allen Radiation Belts, the Plasmasphere and the Plasmasheet.
\begin{figure}
\begin{center}
\pgfimage[width=.7\textwidth]{fig_chapter2/magnetosphere}
\end{center}
\caption{Artist's impression of the magnetosphere (NASA)}
\end{figure}
Of special interest is the interaction of the solar wind with the magnetosphere when violent events take place on the Sun. The following storm may lead to strong effects even on Earth's surface (the aurora borealis being one of mildest phenomena). The so-called space weather is one of the fields in space research that has a direct economic influence. Current simulations of plasmas in this area are performed using hybrid simulations (electrons are a fluid, ions are particles).
\section{The interstellar medium}
\begin{figure}
\begin{center}
\pgfimage[width=0.7\textwidth]{fig_chapter2/alma}
\end{center}
\caption{ALMA image of the ISM \url{https://astrochem.iff.csic.es/interstellar-medium/} }
\label{fig:alma_ism}
\end{figure}
The interstellar medium takes up the largest part of the volume of our galaxy. It is basically everywhere a plasma with a significant background field. Cosmic rays can be found anywhere in the ISM as nonthermal component. A very rough estimate shows that in kinetic energy, magnetic field and cosmic rays the energy density is on the order of 1 erg/cm$^{-3}$. Depending on the scientific question hydrodynamic (structure formation), magnetohydrodynamic (particle transport and shocks) or kinetic (particle acceleration and shocks) simulation techniques are used.
Properties of the interstellar medium
\begin{itemize}
\item densities: $n \approx 10^{-3} - 10^5$ cm$^{-3}$
\item temperatures: $T \approx 10 - 10^6$ K
\item composition:
\item ca. 10\% of the visible matter in the Galaxy
\item mass: $\approx$ 70\% hydrogen (HI, HII, H 2) + 28\% He + ``metals'' (C, N, O, Ne, Na, Mg, S, Si, \dots) + dust (ca. 1\% of the ISM mass)
\item number of atoms: $\approx$ 90\% hydrogen + 10\% He + ``metals''
\item ionised and neutral atomic gas, ionization rate 1 - 100 \%
\end{itemize}
\begin{figure}
\begin{center}
\pgfimage[width=0.7\textwidth]{fig_chapter2/mckee_and_ostriker}
\end{center}
\caption{Phases of the ISM according to McKee and Ostriker}
\label{fig:mckee_ostriker}
\end{figure}
\section{The intergalactic medium}
The intergalactic medium resembles to some extent the hot-interstellar medium, only thinner and hotter ($n\approx 10^{-9}$ cm$^{-3}$, $T \approx 10^5 - 10^7$ K). One important difference is the absence of a strong background magnetic field.
Measurements of the magnetic field strength are complicated, but recently (Neronov\& Vovk) a combination of plasma simulations and gamma-ray observations has been used to calculate an estimate for the magnetic field strength.
\section{Supernovae}
Supernovae are a prime example of expanding hot plasma into a cold and dense medium. Typically the temperature of the plasma is well above $10^6$ K and expansion speeds are clearly supersonic.
\begin{figure}
\begin{center}
\pgfimage[width=0.7\textwidth]{fig_chapter2/crab}
\end{center}
\caption{The crab nebula}
\label{fig:crab}
\end{figure}
As supernova explosions have different stages different plasma descriptions and simulation techniques are relevant. Especially the very early stages where nuclear processes will still take place a simple ansatz is not possible. For later stages either kinetic simulations (allowing for particle acceleration) or fluid approaches (modeling shock fronts at very late stages) are used.
\section{Accretion discs and jets}
Accretion discs can form around black holes. These accretion discs are typically very hot plasmas, which are governed in the inner part not only by plasma physics but also by general relativity. Frame dragging and other effects play a major role.
\begin{figure}
\begin{center}
\pgfimage[width=0.7\textwidth]{fig_chapter2/m87}
\end{center}
\caption{The Active Galactic Nucleus M87 with its jet extending to 10 kpc}
\label{fig:m87}
\end{figure}
In, e.g., Active Galactic Nuclei (AGN) jets are launched from black holes. These jets can reach several parsec in length. The process of jet launching is not fully understood, but the models involved are typically a combination of general relativity, plasma physics and particle physics (here: electron-positron pair creation from high luminosities). Most jet plasma simulations are based purely on MHD (for the sake of simplicity). Since AGN jets are a prime source of (ultra-high energy) cosmic rays kinetic models of shock waves in jets are also of utmost importance.
\chapter{N-body codes and general ideas of numerical methods}
In the previous chapter we have introduced a number of different concepts for the description of plasmas. From a physics viewpoint the main distinction here is between kinetic and fluid descriptions. Both descriptions can be cast into a hyperbolic conservation law (the prime example for this is the Navier-Stokes equation - a fluid description).
In terms of fluid dynamics two different viewpoints for the equations have been established:
\begin{itemize}
\item Lagrange picture: We follow a fluid element and changes are given by the material derivative
\item Euler picture: We look at a fixed point in space and a fluid flows through the volume.
\end{itemize}
\begin{figure}
\begin{center}
\pgfimage[width=.9\textwidth]{fig_chapter3/euler-lagrange}
\end{center}
\end{figure}
The derivatives are linked to each other like this
\begin{align}
\diffp{}{t} + \vec v \cdot \nabla = \frac{D}{D t}
\end{align}
For essentially any numerical scheme describing actual fluids the Euler picture is used. If we go back to our different descriptions of plasmas we see that kinetic descriptions of a plasma can be given as single particles. This would be the Lagrangian viewpoint!
The distinction in plasma physical simulations is more on the line of particle- and mesh-methods. The main branches are pure mesh methods (e.g., MHD simulations) and particle-mesh methods (e.g., particle-in-cell).
In first place we will now focus on pure particle methods. This is typically not used for plasma simulations. The reason behind this is simple: In pure particle methods the interaction is calculated between each particle with every other, but plasmas actually shield long range interactions. A typical application are \emph{N-body codes} used for gravitational simulations.
In order to discuss some general ideas and concepts, we will look into these N-body codes anyway!
\section{Simple approach to N-body}
We want to calculate the evolution of a system of particles that interact with each other through gravity.
A very naive interpretation of an N-body code looks like this
\begin{itemize}
\item Build a list of particles with mass, position and velocity
\item Iterate through the particle list
\item Calculate the distance to each other particle and the associated force
\item Update the velocity from the force
\item Update the position from the velocity
\end{itemize}
This looks nice since it's a very simple approach, but actually everything's bad. The algorithm is $\mathcal{O}(N^2)$ with respect to the particle number and it is numerically unstable.
We are actually using a ``forward Euler'' scheme here
\begin{align}
\vec{r}_i^{n+1} &= \vec{r}_i^n+\Delta t\cdot \vec{v}_i^{n}\\
\vec{v}_i^{n+1} &= \vec{v}_i^n+\Delta t\cdot \vec{a}_i^{n}\\
\vec{a}_i^n &= \sum_{j\neq i}G \frac{m_i m_j}{m_i} \frac{\vec{r}_i^n - \vec{r}_j^n}{|\vec{r}_i^n - \vec{r}_j^n|^3}
\end{align}
The Euler scheme requires very small time steps (this is bad\dots)
A first improvement to such a scheme is the so called \emph{Leapfrog}: We define positions at time $t^n, t^{n+1}, t^{n+2},\dots$ and velocities at $t^{n-1/2}, t^{n+1/2}, t^{n+3/2},\dots$
\begin{align}
\vec{r}^n &= \vec{r}^{n-1}+\Delta t \cdot \vec{v}^{n-1/2} \\
\vec{v}^{n+1/2} &= \vec{v}^{n-1/2} + \Delta t \cdot \vec{a}^n
\end{align}
The initial condition is $\vec{v}^{1/2} = \vec{v}^{0} + 1/2 \Delta t \cdot \vec{a}^0$. The shift between position and velocity by a half timestep changes the stability drastically and makes the whole scheme 2nd order. But what does that mean?
\section{Numerics - the general idea}
Let us assume the following
\begin{itemize}
\item $u^n$ is the numerical solution of a given problem at time $t^n$
\item $u_e^n$ is the exact solution of a given problem at time $t^n$ (which is unknown for any interesting problem)
\item $L$ is the operator of a numerical scheme (this is typically a linear operator that yiels $u^{n+1} = L u^n$
\end{itemize}
From these definitions we may now derive the following terms (the norm $||\dots||$ is typically the $L_2$ norm, but that does not matter too much)
\subsection{Consistency and order}
For a numerical solution we may define
\begin{align}
|| u^n - u^n_e|| = \epsilon(\Delta x, \Delta t) = \mathcal{O}((\Delta x)^p, (\Delta t)^q)
\end{align}
In order for a numerical scheme to be \emph{consistent} the numerical solution must converge to the exact solution, when $\Delta x$ and $\Delta t$ go to 0. The constants $p$ and $q$ are called the order of the scheme.
The \emph{local truncation error}
\begin{align}
LTE = u_e^{n+1} - L u_e^n
\end{align}
is also defined. It is a measure on the amount of deviation one step produces.
\subsection{Stability}
If we look at
\begin{align}
|| L u_e^n - L u^n|| \leq k ||u_e^n -u^n||
\end{align}
we see that there should be a bound on growth of the error of a numerical scheme. Using harmonic analysis (which we will do later), one can determine this growth factor. In real life it means that the ``energy'' of the numerical solution should not grow without physical cause. In fact the $L_2$ norm is related to the energy.
\subsection{Convergence}
A numerical scheme that has consistency and stability is called \emph{convergent}.
\section{Return to N-body}
We have discussed the Leapfrog scheme as a solution for the N-body problem. Can we do better than the 2nd order there? Easily: We can use the Hermite scheme
\begin{align}
\vec{r}^{n+1} &= \vec{r}^n +\frac{1}{2}(\vec{v}^n + \vec{v}^{n+1}) \Delta t + \frac{1}{12}(\vec{a}^n - \vec{a}^{n+1})(\Delta t)^2\\
\vec{v}^{n+1} &= \vec{v}^n +\frac{1}{2}(\vec{a}^n + \vec{a}^{n+1}) \Delta t + \frac{1}{12}(\vec{j}^n - \vec{j}^{n+1})(\Delta t)^2
\end{align}
where $j$ is the so called jerk
\begin{align}
\vec{j} = \diff{^3}{t^3} \vec r
\end{align}
which can be calculated as
\begin{align}
\vec{j}^n = \sum_{i\neq j} \left( \frac{\vec{v}_j^n-\vec{v}_i^n}{\vec{r}_{ij}^3} - 3 \frac{(\vec{r}_j^n \cdot \vec{v}_j^n)\vec{r}_j^n}{\vec{r}_{ij}^5} \right)
\end{align}
This scheme is of higher order than the Leapfrog. That itself is not too interesting. It is much more interesting to figure out, how this scheme is derived and how it works.
Before we go into the derivation, here are some definitions
\begin{align}
\vec s = \diff{^4}{t^4} \vec r, \quad \vec c = \diff{^4}{t^4} \vec c, \quad \vec p = \diff{^6}{t^6} \vec r
\end{align}
Now we can go into the Taylor expansion of the position
\begin{align}
\vec{r}^{n+1} &= \vec{r}^n + \vec{v}^n \Delta t + \frac{1}{2} \vec{a}(\Delta t)^2 + \frac{1}{6}\vec{j}^n(\Delta t)^3 + \frac{1}{24} \vec{s}^n (\Delta t)^4 + \frac{1}{120} \vec{c}^n (\Delta t)^5\\
\vec{v}^{n+1} &= \vec{v}^n + \vec{a}^n \Delta t + \frac{1}{2} \vec{j}(\Delta t)^2 + \frac{1}{6}\vec{s}^n(\Delta t)^3 + \frac{1}{24} \vec{c}^n (\Delta t)^4 \\
\vec{a}^{n+1} &= \vec{a}^n + \vec{j}^n \Delta t + \frac{1}{2} \vec{s}(\Delta t)^2 + \frac{1}{6}\vec{c}^n(\Delta t)^3\\
\vec{j}^{n+1} &= \vec{j}^n + \vec{s}^n \Delta t + \frac{1}{2} \vec{c}(\Delta t)^2
\end{align}
Now one can eliminate $\vec{c}^n$ and $\vec{s}^n$
\begin{align}
\vec{s}^n &= 6 (\vec{a}^{n+1}-\vec{a}^n)(\Delta t)^{-2} - 2(\vec{j}^{n+1}+2\vec{j}^n)(\Delta t)^{-1}\\
\vec{c}^n &= -12(\vec{a}^{n+1}-\vec{a}^n)(\Delta t)^{-3} +6(\vec{j}^{n+1}+\vec{j}^n)(\Delta t)^{-2}\\
\Rightarrow \vec{v}^{n+1} &= \vec{v}^n +\frac{1}{2}(\vec{a}^n + \vec{a}^{n+1}) \Delta t + \frac{1}{12}(\vec{j}^n - \vec{j}^{n+1})(\Delta t)^2
\end{align}
So what do we learn from this? One can perform a Taylor expansion to higher order (every good physicist should do that!) and solve for the updated values at $t^{n+1}$. On the one hands a looks a bit lengthy, but solvable. That first impression is so wrong!
In order to solve the equations for the next time step we need knowledge about quantities from that future time. This is not too uncommon, there are actually many applications for such \emph{implicit} schemes and as a rule of thumb implicit schemes are far more stable.
How do we solve these implicit equations then? There are basically two approaches:
\begin{itemize}
\item We can treat the equation as a matrix equation (the numerical scheme in discretized quantities can be viewed as a linear operator), which can inverted. There are exact and approximate inversion techniques, the latter being the faster.
\item We can use predictor/corrector schemes, where we take a guess for the next time step and then correct this approximation.
\end{itemize}
We will discuss matrix methods later (especially in the context of the Poisson equation). Let's shortly discuss how such a predictor-corrector scheme looks like (there are several different types on the market with slightly different properties).
Predictor
\begin{align}
\vec{v}_p^{n+1} &= \vec{v}^n + \vec{a}^n \Delta t + \frac{1}{2} \vec{j}^n (\Delta t)^2\\
\vec{r}_p^{n+1} &= \vec{r}^n + \vec{v}^n \Delta t + \frac{1}{2} \vec{a}^n (\Delta t)^2 +\frac{1}{6}\vec{j}^n(\Delta t)^3
\end{align}
where we can now calculate the acceleration and jerk using these predicted values
\begin{align}
\vec{a}_p^{n+1} = \vec{a}(t^{n+1},\vec{r}_p^{n+1}),\quad \vec{a}_p^{n+1} = \vec{j}(t^{n+1},\vec{r}_p^{n+1},\vec{v}_p^{n+1})
\end{align}
Now we can apply the corrector
\begin{align}
\vec{v}_c^{n+1} &= \vec{v}_p^{n+1} + \frac{1}{6} \ddot\vec{a}^n(\Delta t)^3 + \frac{1}{24}\dddot{\vec{a}}(\Delta t)^4\\
\vec{r}_c^{n+1} &= \vec{r}_p^{n+1} + \frac{1}{24} \ddot\vec{a}^n (\Delta t)^4 + \frac{1}{120}\dddot{\vec{a}}(\Delta t)^5
\end{align}
with
\begin{align}
\frac{1}{2} \ddot\vec{a}^n &= -3 \frac{\vec{a}^n-\vec{a}^{n+1}_p}{(\Delta t)^2}-\frac{\dot\vec{a}^n+\dot\vec{a}_p^{n+1}}{\Delta t}\\
\frac{1}{6} \dddot{\vec{a}}^n &= 2 \frac{\vec{a}^n-\vec{a}^{n+1}_p}{(\Delta t)^3}-\frac{\dot\vec{a}^n+\dot\vec{a}_p^{n+1}}{(\Delta t)^2}
\end{align}
\section{The Barnes-Hut algorithm}
We have started solving the N-body problem in probably the most naive way: Using a forward-Euler step with direct forces between each particle pair. This is unstable - which has been resolved using Leapfrog or higher-order schemes - but we are still left with a $\mathcal{O}(N^2)$ algorithm.
One idea to resolve this problem is to simplify the interactions: Far away clusters of masses cannot be distinguished from a single mass point. So why not use the center of mass?\footnote{Some of the following text is stolen from Wikipedia. As we are not diving too deep into the matter the description there is sufficient.}
The ``Barnes–Hut simulation'' (named after Josh Barnes and Piet Hut) is an approximation algorithm for performing an N-body simulation. It is notable for having $\mathcal{O}(n \log n)$ compared to a direct-sum algorithm which would be $\mathcal{O}(N^2)$.
The simulation volume is usually divided up into cubic cells via an octree (in a three-dimensional space), so that only particles from nearby cells need to be treated individually, and particles in distant cells can be treated as a single large particle centered at the cell's center of mass. This can dramatically reduce the number of particle pair interactions that must be computed.
\subsection{The Barnes–Hut tree}
In a three-dimensional N-body simulation, the Barnes–Hut algorithm recursively divides the $N$ bodies into groups by storing them in an octree (or a quadtree in a 2D simulation). Each node in this tree represents a region of the three-dimensional space.
\begin{figure}
\begin{center}
\pgfimage[width=.8\textwidth]{fig_chapter3/quadtree}
\end{center}
\caption{A quadtree representation of 100 particles using the Barnes-Hut algorithm}
\end{figure}
The topmost node represents the whole space, and its eight children represent the eight octants of the space. The space is recursively subdivided into octants until each subdivision contains 0 or 1 bodies (some regions do not have bodies in all of their octants).
There are two types of nodes in the octree: internal and external nodes. An external node has no children and is either empty or represents a single body. Each internal node represents the group of bodies beneath it, and stores the center of mass and the total mass of all its children bodies.
\begin{figure}
\begin{center}
\pgfimage[width=.45\textwidth]{fig_chapter3/2galaxies}\hspace{5mm} \pgfimage[width=.45\textwidth]{fig_chapter3/2galaxies_tree}
\end{center}
\caption{Mass distribution of two neighbouring galaxies and the representation using the Barnes-Hut tree}
\end{figure}
\subsection{Calculating the force acting on a body}
To calculate the net force on a particular body, the nodes of the tree are traversed, starting from the root. If the center of mass of an internal node is sufficiently far from the body, the bodies contained in that part of the tree are treated as a single particle whose position and mass is respectively the center of mass and total mass of the internal node. If the internal node is sufficiently close to the body, the process is repeated for each of its children.
Whether a node is or isn't sufficiently far away from a body, depends on the quotient $s/d$, where $s$ is the width of the region represented by the internal node, and $d$ is the distance between the body and the node's center of mass. The node is sufficiently far away when this ratio is smaller than a threshold value $\Theta$. The parameter $\Theta$ determines the accuracy of the simulation; larger values of $\Theta$ increase the speed of the simulation but decreases its accuracy. If $\Theta = 0$, no internal node is treated as a single body and the algorithm degenerates to a direct-sum algorithm.
\section{Fast Multipole Method}
Another approach at getting around the pairwise evaluation of interactions is the Fast Multipole Method. Multipole expansions are already known from electrodynamics lectures: Instead of calculating the interaction of a single charge with a complex charge distribution spherical harmonics are calculated for that charge distribution and the interaction with the leading terms can be calculated.
The potential of a cell with masses can be written as
\begin{align}
\Phi(\vec r) &=
\sum_{l=0}^\infty \sum_{m=-l}^l
\frac{M_l^m}{} Y_{lm}(\Theta,\varphi)\\
M_l^m &= \sum_{i=1}^k m_i \rho_i^l Y_{lm}^* (\alpha_i,\beta_i)
\end{align}
where $\rho, \alpha, \beta$ are the positions within the cell.
Now one starts with an idea similar to Barnes-Hut: The mass distribution is split into a tree. Depending on the distance we have either multipole-multipole or local interaction. With intelligent tree splitting and cluster finding this method can drive the complexity of the problem down to $\mathcal{O}(N)$.
The Fast Multipole Method is considered one of the top 10 algorithms. For plasma simulations, however, its use is extremely limited as charge shielding is dominating.
\section{Poisson equation}
The next chapter will focus on the Particle-in-Cell method, which is a \emph{Particle-Mesh-Method}. It should be pointed out that the gravitational problem can also be solved using a PM-approach: Instead of calculating the force between particle pairs we can work out the gravitational potential of masses
\begin{align}
\nabla \vec g &=-\nabla \cdot (\nabla \Phi_\mathrm m(\vec r)) = -4 \pi \cdot G \cdot \rho_\mathrm m(\vec r)\\ \Leftrightarrow
\Delta \Phi_\mathrm m(\vec r)& = 4 \pi \cdot G \cdot \rho_\mathrm m(\vec r)
\end{align}
This opens up two questions:
\begin{itemize}
\item How do we figure out $\rho_\mathrm{m}$?
\item How do we solve the Poisson equation?
\end{itemize}
The first question will be addressed in great depth in the next chapter - for now we will just assume the so-called \emph{Nearest Grid Point} method: On a grid the mass of particle will be deposited at the nearest point of the mesh.
The second question is far more complicated. It all starts with a discretization of the Poisson equation. Using the finite difference numerical method to discretize the 2-dimensional Poisson equation (assuming a uniform spatial discretization, $\Delta x=\Delta y$) on a $m\times n$ grid gives the following formula:
\begin{align}
{\nabla}^2 u )_{ij} &= \frac{1}{\Delta x^2} (u_{i+1,j} + u_{i-1,j} + u_{i,j+1} + u_{i,j-1} - 4 u_{ij}) = g_{ij}
\end{align}
This will result in an $mn \times mn$ linear system:
\begin{align}
A\mathbf{u} = \mathbf{b}
\end{align}
where
\begin{align}
A =
\begin{bmatrix}
~D & -I & ~0 & ~0 & ~0 & \cdots & ~0 \\
-I & ~D & -I & ~0 & ~0 & \cdots & ~0 \\
~0 & -I & ~D & -I & ~0 & \cdots & ~0 \\
\vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \vdots \\
~0 & \cdots & ~0 & -I & ~D & -I & ~0 \\
~0 & \cdots & \cdots & ~0 & -I & ~D & -I \\
~0 & \cdots & \cdots & \cdots & ~0 & -I & ~D
\end{bmatrix},
\end{align}
$ I $ is the $m \times m$ identity matrix, and $D$, also $m \times m$, is given by:
\begin{align}
D =
\begin{bmatrix}
~4 & -1 & ~0 & ~0 & ~0 & \cdots & ~0 \\
-1 & ~4 & -1 & ~0 & ~0 & \cdots & ~0 \\
~0 & -1 & ~4 & -1 & ~0 & \cdots & ~0 \\
\vdots & \ddots & \ddots & \ddots & \ddots & \ddots & \vdots \\
~0 & \cdots & ~0 & -1 & ~4 & -1 & ~0 \\
~0 & \cdots & \cdots & ~0 & -1 & ~4 & -1 \\
~0 & \cdots & \cdots & \cdots & ~0 & -1 & ~4
\end{bmatrix},
\end{align}
and $\mathbf{b}$ is defined by
\begin{align}
\mathbf{b} =
-\Delta x^2 \begin{bmatrix} g_{11} , g_{21} , \ldots , g_{m1} , g_{12} , g_{22} , \ldots , g_{m2} , \ldots , g_{mn} \end{bmatrix}^\mathsf{T}
\end{align}
For further discussions it is helpful to break this down to the 1D Poisson equation
\begin{align}
\frac{1}{(\Delta x)^2} \begin{pmatrix}
-2 & 1 & & & \\
1 & -2 & 1& & \\
& & \ddots & &\\
& & & 1 & -2
\end{pmatrix}
\begin{pmatrix}
u_1 \\ u_2 \\ \vdots \\ u_N
\end{pmatrix}
\begin{pmatrix}
f_0 \\ f_1 \\ \vdots \\ f_{N-1}
\end{pmatrix}
\end{align}
One can of course try to solve for the inverse of the matrix, but that is insane in terms of computation time. Instead one wants to go for an iterative solver to yield an approximate solution. The Gauss-Seidel algorithm is such a technique for solving a square system of $n$ linear equations with unknown $x$:
\begin{align}A\mathbf x = \mathbf b .\end{align}
It is defined by the iteration
\begin{align}
L_* \mathbf{x}^{(k+1)} = \mathbf{b} - U \mathbf{x}^{(k)},
\end{align}
where $\mathbf{x}^{(k)}$ is the $k$th approximation or iteration of $\mathbf{x}$, $\mathbf{x}^{(k+1)}$> is the next or $k + 1$ iteration of $\mathbf{x}$, and the matrix $A$ is decomposed into a lower triangular component $L_*$, and a strictly upper triangular component $U$ i.e., $A = L_* + U$
In more detail, write out $A$, $x$ and $b$ in their components:
\begin{align}
A=\begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\a_{n1} & a_{n2} & \cdots & a_{nn} \end{bmatrix},
\qquad \mathbf{x} = \begin{bmatrix} x_{1} \\ x_2 \\ \vdots \\ x_n \end{bmatrix} ,
\qquad \mathbf{b} = \begin{bmatrix} b_{1} \\ b_2 \\ \vdots \\ b_n \end{bmatrix}.
\end{align}
Then the decomposition of $A$ into its lower triangular component and its strictly upper triangular component is given by:
\begin{align}
A& =L_*+U
\qquad \text{where} \qquad \\
L_* &= \begin{bmatrix} a_{11} & 0 & \cdots & 0 \\ a_{21} & a_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\a_{n1} & a_{n2} & \cdots & a_{nn} \end{bmatrix},\\
U &= \begin{bmatrix} 0 & a_{12} & \cdots & a_{1n} \\ 0 & 0 & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\0 & 0 & \cdots & 0 \end{bmatrix}.
\end{align}
The system of linear equations may be rewritten as:
\begin{align}
L_* \mathbf{x} = \mathbf{b} - U \mathbf{x}
\end{align}
The Gauss–Seidel method now solves the left hand side of this expression for $x$, using previous value for $x$ on the right hand side. Analytically, this may be written as:
\begin{align}
\mathbf{x}^{(k+1)} = L_*^{-1} \left(\mathbf{b} - U \mathbf{x}^{(k)}\right).
\end{align}
However, by taking advantage of the triangular form of $L_*$, the elements of $x^{k+1}$ can be computed sequentially using forward substitution:
\begin{align}
x^{(k+1)}_i = \frac{1}{a_{ii}} \left(b_i - \sum_{j=1}^{i-1}a_{ij}x^{(k+1)}_j - \sum_{j=i+1}^{n}a_{ij}x^{(k)}_j \right),\quad i=1,2,\dots,n.
\end{align}
How does this very theoretical approach now look like when applied to the Poisson equation? In 2D we can formulate the finite-difference equation as
\begin{align}
\frac{u_{ij+1}-2u_{ij}+u_{ij-1}}{(\Delta x)^2} + \frac{u_{i+1j}-2u_{ij}+u_{i-1j}}{(\Delta x)^2} = f_{ij}
\end{align}
An iterative solution looks now like
\begin{align}
u_{ij}^{n+1} = \frac{1}{4}(u_{ij+1}^n + u_{i+1j}^n + u_{ij-1}^{n+1} + u_{i-1j}^{n+1} + (\Delta x)^2 f_{ij})
\end{align}
This Gauss-Seidel algorithm uses updated values of the solution $u$. This is somewhat advantageous in terms of memory usage, but otherwise pretty slow.
A slighlty updated version of the Gauss-Seidel scheme is the \emph{Red-Black} scheme: Points are alternating red or black. The update runs over red points first, after all red points are updated, the black points will be updated. The main advantage is that the update only relies on old points (which allows for parallelization).
While the scheme is extremely simple, it is also horribly slow. One way to speed up things is the \emph{successive over-relaxation}. For
\begin{align}
A x = f \Rightarrow A = D + L + U
\end{align}
Where $D$ is the diagonal matrix and $L$ and $U$ are the strictly lower and upper matrix respectively. The relaxation now looks like
\begin{align}
(D+\omega L) x = \omega f -(\omega U+(\omega-1)D) x
\end{align}
Where $\omega > 0$ with $\omega=1$ being the Gauss-Seidel case
\begin{align}
x^{k+1} = (D+\omega L)^{-1}(\omega f - (\omega U + (\omega -1) D)x^k)
\end{align}
Making use of matrix structure then yields
\begin{align}
x_i^{k+1} = (1-\omega) x_i^k + \frac{\omega}{a_{ii}}(f_i - \sum{j>i} a_{ij}x_j^k-\sum_{j<i} a_{ij} x_j^{k+1})
\end{align}
This scheme is convergent for $0<\omega<2$, where $\omega>1$ yields faster convergence and $\omega<1$ yields convergence safely.
Another scheme used typically is the Jacobi scheme
\begin{align}
A x =f \Rightarrow A = D + R\\
x^{k+1} = D^{-1} (f-R x^k)
\end{align}
\subsection{Multigrid}
If one looks at previous methods one will notice that methods like Gauss-Seidel are correct on smallest scale, but tend to deviate from the correct solution when larger scales are involved. This is due to the fact that the update only relies on the neighbouring points.
Before we discuss a strategy to circumvent this problem we need to discuss some terms. We are looking for the correct solution $u$ (which we may or maybe not reach) and approximate this by the iteration $u^n$. The difference these two is the error
\begin{align}
e = u^n - u
\end{align}
Again: If we knew the error we would also know the real solution. We will never know the real solution\dots
What we know is the residual
\begin{align}
r = f - A u^n
\end{align}
But since for the exact solution we know
\begin{align}
A u = f
\end{align}
we have
\begin{align}
f - A u^n = A (u-u^n ) = r
\end{align}
Coming back to the original problem: How can we improve our solution on larger levels? One is the so-called Multigrid scheme: Instead of using one fixed grid the data is sampled grids with different resolutions. The ``original'' grid is the finest grid and data is coarsened from there on.
Using the notation ``superscript describes the coarseness of the grid'' (i.e., $u^n$ is an approximate solution on the finest grid, while $u^{2n}$ is the approximate solution on a grid with double spacing) we need the following ingredients
\begin{itemize}
\item A restriction matrix $R^h_{2h}$ transfers vectors from the fine grid to the coarse grid.
\item The return step to the fine grid is by an interpolation matrix $I = I^h_{2h}$.
\end{itemize}
Possible interpolation:
\begin{align}
u_{2i,2j} = v_{i,j},\quad u_{2i,2j+1} = \frac{1}{2}(v_{i,j}+v_{i,j+1}
\end{align}
The restriction is essentially the inversion of this.
A simple two grid v-cycle looks like this
\begin{enumerate}
\item Iterate on $A^h u = b^h$ to reach $u^h$ (say 3 Jacobi or Gauss-Seidel steps).
\item Restrict the residual $r^h = b^h -A^h u^h$ to the coarse grid by $r^{2h} = R^{2h}_h r^h$.
\item Solve $A^{2h} e^{2h} = r^{2h}$ (or come close to $e^{2h}$ by 3 iterations from $e = 0$).
\item Interpolate $e^{2h}$ back to $e^h = I^h_{2h} e_{2h}$. Add $e^h$ to $u^h$.
\item Iterate 3 more times on $A^h u = b^h$ starting from the improved $u^h + e^h$
\end{enumerate}
Here we solve the Poisson equation on a fine grid and one coarser grid. This scheme can be extended to ever finer grids.
\begin{figure}
\begin{center}
\pgfimage[width=.7\textwidth]{fig_chapter3/multigrid}
\end{center}
Grapical representation of the multigrid cycle
\end{figure}
\chapter{Particle-in-Cell}
While plasmas with a nonthermal component could be described using numerical standard techniques for hyperbolic conservation laws, the so-called Particle-in-Cell (PiC) technique has become the standard technique for many plasma simulations.
PiC is a versatile and extremely easy to implement method, which is the main factor behind its popularity. The relatively low computational cost is the next point making PiC such a common choice. Unfortunately this simplicity leads often to carelessness in implementation and simulation design.
This chapter shall give a brief introduction to the physics of kinetic plasmas, the setup of PiC codes, implementation details and the design of simulations of various physical effects.
\section{Numerical Implementation}
\label{sec:num}
Particle-in-Cell codes are semi-Lagrangian in that they follow a Lagrangian
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. 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
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
\ref{subsec:num:depostion}. Non-rectangular grids are discussed in the
review \cite{Meierbachtol_2015}.
%In this subsection we will assume that the source terms that are based on
%moments of the distribution function of all charged species are known on the
%grid. How this is actually accomplished will be discussed in the next
%subsection. We will further more assume that we have a uniform grid of
%rectangular or cubic cells. Triangular or tetrahedral cells are much more
%complicated to deal with and are typically only used when a body-fitted mesh
%around or inside a metal body is needed. More details can be found in the
%review \cite{Meierbachtol_2015}.
Particle-in-Cell codes commonly use a finite difference formulation based on
the electromagnetic fields (as opposed to scalar electrostatic potential and
magnetic vector potential). The typical arrangement of field samples is then
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$, 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
%edges. The magnetic flux is represented by two-forms assigned to cell phases.
%This view of computational electrodynamics is rather recent but has proven
%useful when designing field solvers on unstructured grids \cite{Rabina_2014, Na_2018}.
The staggered arrangement of components
%looks complicated as first and the reader might fear that it will require a lot of re-interpolation.
is non-trivial and it looks as if interpolation is needed to calculate derivatives
at the correct positions.
But the contrary is true as we will see in a moment. We start our consideration from
Maxwell's equation in CGS units. These are still customarily used in
Particle-in-Cell codes as they make the magnitude of electric and magnetic
components similar. Since we treat all material effects due to the plasma
explicitly by having particles react to the fields $\vec{E}$ and $\vec{H}$,
we can use them interchangeably with the respective flux densities $\vec{D}$
and $\vec{B}$.
\begin{align}
\nabla \times \vec{E} &= - \frac{1}{c} \frac{\partial \vec{B}}{\partial t} \label{eq:num:faraday}\\
\nabla \times \vec{B} &= \phantom{-} \frac{1}{c} \frac{\partial \vec{E}}{\partial t} + \frac{4 \pi}{c} \vec{\jmath} \label{eq:num:ampere} \\
\nabla \cdot \vec{E} &= 4 \pi\,\rho \label{eq:num:gauss}\\
\nabla \cdot \vec{B} &= 0 \label{eq:num:monopol}
\end{align}
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. Its equivalent for the
magnetic field, Eq.~\eqref{eq:num:monopol}, that describes the absence of
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}
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} imply 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.
\begin{figure}[h!]
\centering
\begin{subfigure}{0.4\hsize}
\centering
\includegraphics[width=3cm]{fig_chapter4/rotation_yee.png}
\caption{Finite difference approximation in Yee scheme}
\label{fig:num:rot_yee}
\end{subfigure}
\begin{subfigure}{0.4\hsize}
\centering
\includegraphics[width=3.5cm]{fig_chapter4/rotation_o4.png}
\caption{Finite difference approximation in simplest $4^{th}$ order scheme}
\label{fig:num:rot_o4}
\end{subfigure}
\caption{$2^{nd}$ and $4^{th}$ order Finite-Difference Time-Domain schemes}
\end{figure}
%%\begin{figure}[h!]
%%\centering
%%\includegraphics[width=0.5\hsize]{fig_chapter4/rotation_yee.png}
%%\caption{Finite difference approximation in Yee scheme}
%%\label{fig:num:rot_yee}
%%\end{figure}
%%
%%As figure \ref{fig:num:rot_yee} illustrates, there is an elegant finite
%%difference approximation for the curl of the electric field at the location of
%%the magnetic flux, based on the four edges that surround the magnetic flux at
%%the center of the face. If we write this approximation carefully it reads
%%\begin{align}
%%\left(\nabla \times \vec{E}\right)_x&(i\Delta{x},(j+1/2)\Delta{y},(k+1/2)\Delta{z}) \approx \nonumber \\
%%&\frac{E_y(i\Delta{x},(j+1/2)\Delta{y},k\Delta{z}) - E_y(i\Delta{x},(j+1/2)\Delta{y},(k+1)\Delta{z})}{\Delta{z}} + \nonumber \\
%%&\frac{E_z(i\Delta{x},(j+1)\Delta{y},(k+1/2)\Delta{z}) - E_z(i\Delta{x},j\Delta{y},(k+1/2)\Delta{z})}{\Delta{y}} \quad . \label{eq:num:rot_yee_long}
%%\end{align}
%%This expression is of course rather unwieldy, so customarily the edge length as
%%well as the offsets required to center components along edges and on faces are
%%suppressed and Eq.~\eqref{eq:num:rot_yee_long} is simply written as
%%\begin{equation}
%%\left(\nabla \times \vec{E}\right)_x(i,j,k) \approx
%%\frac{E_y(i,j,k) - E_y(i,j,k+1)}{\Delta{z}} +
%%\frac{E_z(i,j+1,k) - E_z(i,j,k)}{\Delta{y}} \quad . \label{eq:num:rot_yee}
%%\end{equation}
%%When presented with such an expression the reader needs to know that the use of
%%the electric field at locations $k\Delta{z}$ and $(k+1)\Delta{z}$ implies that
%%the magnetic flux (where the curl is used) is located at $(k+1/2)\Delta{z}$.
%%This can make reading papers tedious, but is much more compact and closer to
%%the actual implementation where the array indices into the arrays holding the
%%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)$\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. 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
\begin{align}
\vec{B}^{t\phantom{+1/2}} &= \vec{B}^{t-1/2} - \frac{1}{2} c \cdot \Delta t \cdot \nabla \times \vec{E}^{t} \label{eq:num:B1update} \quad ,\\
\vec{B}^{t+1/2} &= \vec{B}^{t\phantom{-1/2}} - \frac{1}{2} c \cdot \Delta t \cdot \nabla \times \vec{E}^{t} \label{eq:num:B2update} \quad ,\\
\vec{E}^{t+1\phantom{/2}} &= \vec{E}^{t\phantom{-1/2}} + c \cdot \Delta t \cdot \nabla \times \vec{B}^{t+1/2} - 4 \pi \Delta t \cdot \vec{\jmath}^{t+1/2} \label{eq:num:Eupdate} \quad .
\end{align}
This solver is the most common method and is accurate to second order with respect to a given current. Since small numbers of macroparticles lead to an increased noise, solvers are sought after to remove the noise. Increasing particles numbers is typically not an option as the noise level decreases as $1/\sqrt{N}$. Either the source term $\vec{\jmath}^{t+1/2}$ can be filtered or the noise can be damped. The latter is possible since noise is concentrated at high $k$ values. This low-pass filtering is described in \cite{Friedman_1990} and changes Eqs.~\eqref{eq:num:B1update} and \eqref{eq:num:B2update}.
%%This solver works well and is implemented in many codes. However the
%%electromagnetic fields can be rather noisy in Particle-in-cell simulations.
%%There is a limited number of options to combat this. Increasing the number of
%%macro particles to bring it close to the number of physical particles works,
%%but is rather expensive as the noise level only goes down as $1/\sqrt{N}$.
%%Another commonly used method is to filter the the source term
%%$\vec{\jmath}^{t+1/2}$.
%%%FIXME do that below and reference here
%%The third option is to make use of the fact that most of that noise is
%%concentrated at high $k$ and modify the field solver to damp those modes. This
%%is exactly what the method described in \cite{Friedman_1990} does. It replaces
%%Eqs.~\eqref{eq:num:B1update} and \eqref{eq:num:B2update} by
%%\begin{align}
%%\vec{B}^{t+1/2} &= \vec{B}^{t-1/2} - c \cdot \Delta t \cdot \nabla \times \left[\left(1+\frac{\theta}{4}\right)\vec{E}^t-\frac{1}{2}\vec{E}^{t-1}+\left(\frac{1}{2}-\frac{\theta}{4}\right)\vec{\bar{E}}^{t-2}\right]\quad , \label{eq:num:Bupfriedman}\\
%%\vec{\bar{E}}^{t-2} &= \left(1-\frac{\theta}{2}\right)\vec{E}^{t-1} + \frac{\theta}{2}\vec{\bar{E}}^{t-3} \quad .
%%\end{align}
%%If desired Eq.~\eqref{eq:num:Bupfriedman} can be split into two steps to get
%%access to $\vec{B}^t$. The method allows tuneable damping by selecting $\theta$
%%between 0 and 1 at the extra expense of storing and updating $\vec{\bar{E}}$.
%%The damping rate $\gamma$ is given by
%%\begin{equation}
%%\gamma\Delta{t} = - \frac{8\,\theta}{(2-\theta)^2} \left(\frac{c\,\Delta{t}}{\Delta{x}}\right)^4\sin^4\left(\frac{k\,\Delta{x}}{2}\right) \quad .
%%\end{equation}
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 (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 the influence of
a medium reduces the speed of light below the vacuum value and particle can
reach the local phase velocity. Numerically this can happen when the numerical
scheme introduces a dispersion error which reduces the speed of light. The
Maxwell solver presented above does that, especially for short wavelength
comparable to the length of the cell edges.
%\begin{figure}[h!]
% \centering
% \includegraphics[width=0.25\hsize]{fig_chapter4/rotation_o4.png}
% \caption{Finite difference approximation in simplest $4^{th}$ order scheme}
% \label{fig:num:rot_o4}
%\end{figure}
In other applications of finite-difference time-domain (FDTD) schemes the
solution would typically be to use a higher order approximation of the discrete
curl operator. Fig.~\ref{fig:num:rot_o4} shows how the straight forward
extension to $4^{th}$ order in space would look like.
% The equivalent to Eq.~\eqref{eq:num:rot_yee} reads
The right hand side of Eq.~\eqref{eq:num:Bevolution} now reads
\begin{align}
\left(\nabla \times \vec{E}\right)_x(i,j,k) \approx & \frac{27}{24}\frac{E_y(i,j,k) - E_y(i,j,k+1)}{\Delta{z}} \nonumber \\
& - \frac{E_y(i,j,k-1) - E_y(i,j,k+2)}{\Delta{z}} \nonumber \\
& + \frac{27}{24}\frac{E_z(i,j+1,k) - E_z(i,j,k)}{\Delta{y}} \nonumber \\
& - \frac{E_z(i,j+2,k) - E_z(i,j-1,k)}{\Delta{y}} \label{eq:num:rot_o4}
\end{align}
in this case. Also the temporal derivatives can be approximated in fourth order
\cite{Fang_1989}. For typical PiC simulations with marginal stable time steps
the gain in accuracy is negligible compared to the computational cost.
%It is also possible to make the approximation of the temporal
%derivative accurate to $4{th}$ order in the timestep $\Delta{t}$ as shown in
%\cite{Fang_1989}. The problem is that Particle-in-Cell simulation tend to use
%space and time steps that are just sufficient to get stable results. Using
%substantially smaller steps is usually prohibitively expensive. This means that
%$\lambda/\Delta{x}$ or $\omega \Delta{t}$ tend to be close to unity and the
%difference between second and fourth order is small.
The way forward has therefore been to use schemes that are still ``only''
second order, but with a small constant in front of the error term. Many such
non-standard finite-difference (NSFD) schemes have been investigated over the
years.
%\begin{figure}[h!]
% \centering
% \includegraphics[width=0.25\hsize]{fig_chapter4/rotation_m24.png}
% \caption{Finite difference approximation in M24 scheme}
% \label{fig:num:rot_m24}
%\end{figure}
\begin{figure}[h!]
\centering
\begin{subfigure}{0.4\hsize}
\centering
\includegraphics[width=2.84cm]{fig_chapter4/rotation_m24.png}
\caption{Finite difference approximation in M24 scheme}
\label{fig:num:rot_m24}
\end{subfigure}
\begin{subfigure}{0.4\hsize}
\centering
\includegraphics[width=6cm]{fig_chapter4/rotation_nsfd.png}
\caption{Finite difference approximation in Cole-Karkkainen schemes}
\label{fig:num:rot_ck}
\end{subfigure}
\caption{Non-standard Finite-Difference Time-Domain schemes}
\end{figure}
%\begin{figure}[h!]
%\centering
%\includegraphics[width=0.25\hsize]{fig_chapter4/rotation_m24.png}
%\caption{Finite difference approximation in M24 scheme}
%\label{fig:num:rot_m24}
%\end{figure}
One such scheme, proposed by \cite{Hadi_1997} under the name ``M24'' makes use
of the grid locations used by the standard Yee scheme, the locations used by
the fourth order scheme and additional locations that close a larger loop
around the mid point. The relative weights of the three loops are in principle
arbitrary, subject to the constraint that they have to sum to one. The
remaining two free parameters can be tuned to optimize the dispersion
properties of the scheme. The original paper suggests some values, but more
interesting is \cite{Greenwood_2004} that shows how these parameters can be
chosen to reduce NCI.
%\begin{figure}[h!]
% \centering
% \includegraphics[width=0.5\hsize]{fig_chapter4/rotation_nsfd.png}
% \caption{Finite difference approximation in Cole-Karkkainen schemes}
% \label{fig:num:rot_ck}
%\end{figure}
So far all schemes only used grid locations at $i\Delta{x}$, but
\cite{Cole_2002} shows that using $(i\pm1)\Delta{x}$ can be useful, at least
for a narrow range of frequencies propagating on the grid. Subsequently
\cite{Karkkainen_2006} extended that to broad bandwidth.
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}.
%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...
% Shlager_1993.pdf Dispersion error of FDTD schemes
% Garcia_1996.pdf construction of high order FDTD in anisotropic dielectrica
% Pukhov_1999.pdf Laser-Plasma simulation with tuned Maxwell solver, open boundaries
% Finkelstein_2006.pdf M24 scheme for low dispersion FDTD
% Yang_2006.pdf nummerically tuned FDTD solvers
% Hadi_2007.pdf finite volume based low dispersion FDTD
% Smith_2012.pdf low-dispersion and low-anisotropy FDTD
% Jung_2013.pdf optimized 2,4 FDTD scheme
% Lehe_2013.pdf NCI suppression with tuned FDTD
% 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
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 parallel 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
%that are not based on FDTD schemes, but based on solving Maxwell's equations in
%the spectral domain (\cite{Haber_1973, Jalas_2017}). This requires global FFTs
%to convert the fields between real space and the spectral domain. The upside
%is that there is no need to use a finite stencil that approximates the curl to
%some low order. Instead the differential operator can be expressed as a
%multiplication by $\imath k$ which gives rise to the class of pseudo-spectral
%time domain solvers which have basically infinite stencil order. Under the
%assumption of fixed source terms, i.e. constant current density, is is
%additionally possible to integrate Maxwell's equation analytically in time and
%derive 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 solvers (\cite{Vay_2013}) or correction
%methods for more conservative FDTD schemes (\cite{Yu_2016, Li_2017}).
% Jalas_2017.pdf pseudo spectral analytic time domain
% Li_2017.pdf local FFT correction to FTDT to remove NCI
% Yu_2017.pdf yee-fft
% Na_2018b.pdf diagnosing NCI on general meshes
% electrostatic
%%If all particle motion is slow compared to the speed of light life is much
%%easier. Not only do all NCI related problems go away, but it might be possible
%%to remove light waves completely from the plasma model and to reduce
%%computational expense. The straight forward way to do this is the electrostatic
%%plasma model, where the electric field is not updated using an evolution
%%equation based on Amperes Law (Eq.~\eqref{eq:num:Eevolution}), but is directly
%%calculated from Gauss Law (Eq.~\eqref{eq:num:gauss}). This of course limits the
%%electric field to is longitudinal, curl-free component. Bases on
%%Eq.~\eqref{eq:num:Bevolution} this tell us that the magnetic field will not
%%evoluve in time, but is restricted to an initial magnetic field that stays
%%constant in time. Intuitively that makes sense as very slow (comparted to the
%%speed of light) particle motion implies very small currents. Historically some
%%of the first Particle-in-Cell codes were electrostatic (see e.g.
%%\cite{Hockney_1966, Gitomer_1972}) and very also the first to be expressed in
%%implicit form (\cite{Cohen_1989}). Numerically there is several options to
%%solve Eq.~\eqref{eq:num:gauss}. In one spatial dimension direct integration is
%%possible, in higher dimension two methods are worth considering. A basic
%%spectral solver is simple to implementr and the book \cite{Birdsall_2005} has a
%%good overview of the more subtil design trade-off one can make. The other
%%option is a multigrid solver. This is somewhat harder to implement but has the
%%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 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
%%Between the electrostatic and electromagnetic plasma model that is rarely
%%considered, but can be very effective and successfull in its domain of
%%application. In the Darwin approximation \cite{Darwin_1920}, effects up to
%%order $\mathcal{O}((v/c)^2)$ are retained, which allows for magnetic field
%%fluctuations but removes light waves. Alternatively it can be though of the
%%approximation where the time retardation due to the finite speed of light is
%%removed. Aquivalently the divergence-free part of the displacement current is
%%removed, which explicitly removes lightwaves from the problem. Interestingly
%%all these approximation turn out to be identically as demonstrated by
%%\cite{Krause_2007}. Some codes have been implemented in this approximation (see
%%e.g. \cite{Eremin_2013}). The approximation does however change the natural of
%%the system of differential equations to elliptic, requiring a global field
%%solve in every time step. This makes the timestep more expensive and can limit
%%scalability. Thus the Darwin approximation only results in a net speed up if
%%the time step covers a much longer duration then the CFL limit for an
%%electromagnetic code. Another limitation to keep in mind is that some low
%%frequency modes that are not ordered out are still modified as demonstrated by
%%\cite{Xie_2014}.
%%
%%The Vlasov-Poiswell model that only retains effects up to $\mathcal{O}(v/c)$
%%can be formulated in a consistent manner (see \cite{Besse_2007}), but is rarely
%%used in practice.
Besides the domain of electrostatic and electromagnetic models there is another intermediate regime called Darwin approximation \cite{Darwin_1920} which includes magnetodynamic effects up to order $\mathcal{O}((v/c)^2)$, but which does not consider light waves. This equivalent to removing the divergence-free part of the displacement current. While time resolution constraints are relaxed since the speed of light is no longer present, the differential equations representing the electromagnetic field are now elliptic requiring a global field solver.
\subsection{Interpolation}
\label{sec:num:interpol}
The previous section only discussed Eulerian quantities on the regular grid.
But the electromagnetic fields act on the Lagrangian particles, which requires
knowledge of the field strength at the location of the particle, not just at
the regular grid locations. This crucial switch in view point is done by means
of an interpolation that we will discuss next.
\begin{figure}[h!]
\centering
\includegraphics[width=0.25\hsize]{fig_chapter4/interpolation.png}
\caption{Interpolation using the overlap between the cell and the particle, weighted by the shape function}
\label{fig:num:interpolation}
\end{figure}
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 scetion the numerical macroparticle represents
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 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}
\bar{B}_z(x_p) = \sum_{i} B_z((i+1/2)\Delta{x}) \cdot \int_{i\Delta{x}}^{(i+1)\Delta{x}} S(x - x_p)\, \mathrm{d}x \quad .
\end{equation}
Since this calculation is required for all particles and all field components
in each timestep, the integral over the shape function $S$ is not performed
numerically, but rather done analytically ahead of time to obtain the weight
function $W$:
\begin{equation}
W(x) = \int_{-\Delta{x}/2}^{\Delta{x}/2} S(x - x'), \mathrm{d}x' \quad .
\end{equation}
Using this and suppressing the explicit location of the gridded quantity in the
cell we can write the two-dimensional interpolation as
\begin{equation}
\bar{B}_z(\vec{x}_p) = \sum_{i,j} B_z(i,j) \cdot W\left(x_p-(i+1/2)\Delta{x}\right) \cdot W\left(y_p - (j+1/2)\Delta{y}\right) \label{eq:num:Bzinterpol}\quad .
\end{equation}
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 does not include the statistical weight of the macro particle, 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,
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
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
%use of $S(x) = \delta(x)$ is also referred to as \textit{Nearest Grip Point} or
%NGP scheme. Computationally it is very cheap, as no interpolation or summation
%has to be done, we just assume that the field at the particle location is
%identical to nearest available field on a grid location. The downside however is
%that 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. This leads to a high level of numerically induced
%fluctuations in the source terms and consequently the fields.
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) =
\begin{cases}
1 & |x|\leq 1/2 \\
0 & \text{else}
\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}.
%The associated weight function $W_{CIC}$ is
%straight forward to calculate and given by
%\begin{equation}
%W_{CIC}(x) = \left\{
%\begin{array}{ll}
%1-|x| & |x|\leq 1 \\
%0 & \mathrm{else}
%\end{array}
%\right.
%\end{equation}
\begin{figure}[h!]
\centering
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{fig_chapter4/formfaktor_CIC_S.png}
\caption{Cloud-in-Cell \phantom{andere zeile}}
\label{fig:num:S_CIC}
\end{subfigure}
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{fig_chapter4/formfaktor_TSC_S.png}
\caption{Triangular Shaped Cloud}
\label{fig:num:S_TSC}
\end{subfigure}
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{fig_chapter4/formfaktor_PQS_S.png}
\caption{Piecewise Quadratic Shape}
\label{fig:num:S_PQS}
\end{subfigure}
\\
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{fig_chapter4/formfaktor_CIC_density.png}
\caption{Cloud-in-Cell \phantom{andere zeile}}
\label{fig:num:density_CIC}
\end{subfigure}
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{fig_chapter4/formfaktor_TSC_density.png}
\caption{Triangular Shaped Cloud}
\label{fig:num:density_TSC}
\end{subfigure}
\begin{subfigure}{0.25\hsize}
\centering
\includegraphics[width=\hsize]{fig_chapter4/formfaktor_PQS_density.png}
\caption{Piecewise Quadratic Shape}
\label{fig:num:density_PQdensity}
\end{subfigure}
\caption{Different shape functions in 1d and 2d}
\label{fig:num:shape_function}
\end{figure}
This simple shape function is not only a major step forward, but has the added
benefit of generating an entire family of shape function of increasing order,
by using the weight function $W$ for the previous order as the shape function
$S$ of the new, higher order. The next step after CIC in this chain is called
\textit{triangular shaped cloud} or TSC. This shape function has the advantage
of being continuous. This implies that the Fourier transform of it falls faster
towards higher $k$.
%As \cite{Langdon_1970} showed this corresponded to reduced
%aliasing of higher $k$ to low $k$ that can be represented by the Eulerian grid
%and consequently a reduction of the finite grid instability. This numerical
%instability heats the plasma when the numerical grid does not resolve the Debye
%length and can outgrow the physical processes the simulation is supposed to
%study. Using higher order shape function suppress the instability and allows
%the use of (slightly) larger grid cells or alternatively a better conservation
%of the plasma thermal energy at identical resolution \cite{Shadwick_2009}. A
%similar problem exists when the cell size does not resolve the gyro radius of
%electrons, as shown by \cite{Horky_2017}, and again higher order shape function
%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$.
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
thermal energy\cite{Shadwick_2009}.
Higher order shape function from the same family such as \textit{Piecewise
Quadratic Shape} PQS illustrated in Fig.~\ref{fig:num:S_PQS} have been used.
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 collisionality \cite{Eastwood_1974,Matsuda_1975}.
%The EPOCH code \cite{} might be the most widely used code to
%use high order shape function.
Otherwise order beyond TSC are not used widely
enough that a consensus as to their names has emerged.
%Historically another family of shape function was used, the so-called
%subtracted dipole shapes, see \cite{Kruer_1973} for more detail. If the code
%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 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.
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
of different orders to obtain a code that conserves total energy
\cite{Sokolov_2013}. A good example of this is the VPIC code (description in
\cite{Bowers_2008}) that mixed NGP and CIC shape functions. Magnetic field
components $B_i$ are interpolated using linear interpolation in the $x_i$
coordinate and NGP in the other two coordinates. Electric field components
$E_i$ use NGP in the $x_i$ coordinate and CIC for the other two directions.
%The use of only six locations to obtain the local magnetic field and twelve for
%the electric field allows to handle larger numbers of particles efficiently.
%The downside is of course that hundreds or thousands of particles per species
%are required to bring down the noise level.
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
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.
%Other schemes that pick or modify the width of the shape function to
%reduce known numerical problems might follow.
\subsection{Particle Motion}
\label{sec:num:particle}
Once the electromagnetic fields have been interpolated to the location of the
particle, it is necessary to update the position and velocity of the particle
accordingly. Since the first publication of the particle push by
\cite{Boris_1970} basically all codes use this method, possibly with minor
adjustments.
Similar to the leap-frog procedure for the electromagnetic fields the particle's position and velocity are updated according to
\begin{align}
\vec{v}(t+\Delta{t}/2) &= \vec{v}(t-\Delta{t}/2) + \vec{F}(x(t),v(t))\cdot\Delta{t}/m \quad , \label{eq:num:velupdate}\\
\vec{x}(t+\Delta{t})\phantom{/2} &= \vec{x}(t)\phantom{-\Delta{t}/2}\,\,\, + \vec{v}(t+\Delta{t}/2)\cdot\Delta{t} \quad . \label{eq:num:posupdate}
\end{align}
When the force depends only on position, this can be solved straightforwardly.
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
$\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 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
%Eq.~\eqref{eq:num:velupdate} has new new velocity $\vec{v}(t+\Delta{t}/2)$ on
%both sides. The Boris push allows us to solve this implicit equation without
%matrix inversion or iteration.
%The Boris push allows us to solve this implicit equation without matrix inversion or iteration. Since different modifications of the Boris push differ in how they handle the
%relativistic case it is worthwhile to switch from velocities $\vec{v}$ to the
%relativistic momentum per rest mass $\vec{u} = \vec{p}/m = \gamma\vec{v}$.
%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
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(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!]
\centering
\includegraphics[width=0.4\hsize]{fig_chapter4/boris_push.pdf}
\caption{Velocity diagram of the Boris push: The red arrows indicate the change in velocity $q/m \vec{E}(t) \Delta{t}/2$ from the acceleration by the electric field $E(t)$ at the beginning and end of the Boris push. The vector $\vec{\Omega}$ is a normalized magnetic field $\vec{B}$ such that a cross product with it produces half the final rotation. This allows the construction of $\vec{v}_2$ and the final accurate solution.}
\label{fig:num:boris_push}
\end{figure}
The major insight that allows to solve the problem is that the magnetic field
can only change the direction of the velocity vector. It is therefore possible
to construct a suitable rotation using geometric considerations. The effect of
the electric field is purely an acceleration in the direction of the electric
field. To maintain reversibility in time and second order accuracy it is split
into two equal parts performed before and after handling the magnetic field. Using this insight we can perform the following steps:
\begin{align}
\vec{u}_1 &= \vec{u}(t-\Delta{t}/2) + \frac{q}{m}\vec{E}(t)\frac{\Delta{t}}{2} \\
\vec{\Omega} &= \tan{\left(\frac{q}{\gamma\,m}|B(t)|\frac{\Delta{t}}{2}\right)}\frac{\vec{B}}{|\vec{B}|} \label{eq:num:tanrotation} \\
\vec{t} &= \frac{2}{1 + \vec{\Omega}\cdot\vec{\Omega}} \vec{\Omega}\\
\vec{u}_2 &= \vec{u}_1 + \vec{u}_1 \times \vec{\Omega} \\
\vec{u}_3 &= \vec{u}_1 + \vec{u}_2 \times \vec{t} \\
\vec{u}(t+\Delta{t}/2) &= \vec{u}_3 + \frac{q}{m}\vec{E}(t)\frac{\Delta{t}}{2}
\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 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.
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} \\
% \vec{\tau} &= \frac{q}{m}\vec{B}(t)\frac{\Delta{t}}{2} \\
% \vec{u}' &= \vec{u}_2 + \frac{q}{m}\vec{E}(t)\frac{\Delta{t}}{2} \\
% u^{*} &= \left(\vec{u}' \cdot \vec{\tau}\right) / c \\
% \gamma' &= \sqrt{1 + \frac{\vec{u}' \cdot \vec{u}'}{c^2}} \\
% \sigma &= \gamma'^2 - \vec{\tau} \cdot \vec{\tau} \\
% \gamma &= \sqrt{\frac{\sigma+\sqrt{\sigma^2 + 4(\vec{\tau}\cdot\vec{\tau} + u^{*2})}}2{}}\\
% 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 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 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.
\subsection{Deposition and Filtering}
\label{subsec:num:depostion}
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 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
grid to avoid spurious self-forces.
The deposition of $\rho(t+\Delta{t})$ based on the newly calculated
$\vec{x}(t+\Delta{t})$ is straight forward and simply given by
\begin{equation}
\rho(i\Delta{x},j\Delta{y}) = \sum_{p} q_p W(x_p - i\Delta{x}) \cdot W(y_p - j\Delta{y}) \quad .
\end{equation}
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.
%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
%electrostatic potential at the location where the charge density is located.
%Picking the corners of the cell allows to use a straight forward finite
%difference approximation to calculate the electric field at the midpoint of
%the edges.
It is advisable to store the charge density at the cell corners.
Calculating the current $\vec{\jmath}(t+\Delta{t}/2)$ based on the old location
$\vec{x}(t)$, the new location $\vec{x}(t+\Delta{t})$ and the velocity
$\vec{v}(t+\Delta{t}/2)$ is slightly more complicated.
\begin{figure}[htbp]
\begin{center}
\includegraphics[width=0.5\textwidth]{fig_chapter4/currentassignment_naive.pdf}
\caption{Naive current deposition for a charged particle moving as indicated by the black arrow and deposition current density onto the grid as shown in green. Solid black lines indicate grid cells, dashed line illustrate midplanes of cell faces.}
\label{fig:num:currentassignment_naive}
\end{center}
\end{figure}
The current carried by a particle with charge $q_p$ moving at velocity
$\vec{v}(t+\Delta{t}/2)$ is given by $\vec{\jmath} = q_p
\vec{v}(t+\Delta{t}/2)$ and it is located around the position at this time,
$\vec{x}(t+\Delta{t}/2)$ that can be approximated by
$\left(\vec{x}(t)+\vec{x}(t+\Delta{t})\right)/2$.
Fig.~\ref{fig:num:currentassignment_naive} illustrates that this current can
simply be interpolated onto the grid using the weight functions, just as for
the charge density. The current on a cell edge is then simply the charge
flowing through the associated cell face over the course of a time step.
The problem with this straightforward procedure is that the current deposited
in this way does not satisfies the discrete continuity equation given by
\begin{align}
&\frac{\rho(i\Delta{x},j\Delta{y},t+\Delta{t})-\rho(i\Delta{x},j\Delta{y},t)}{\Delta{t}} \nonumber \\
&\quad + \frac{j_x((i+1/2)\Delta{x},j\Delta{y},t+\Delta{t}/2) - j_x((i-1/2)\Delta{x},j\Delta{y},t+\Delta{t}/2)}{\Delta{x}} \nonumber \\
&\quad + \frac{j_y(i\Delta{x},(j+1/2)\Delta{y},t+\Delta{t}/2) - j_y(i\Delta{x},(j-1/2)\Delta{y},t+\Delta{t}/2)}{\Delta{y}} = 0 \quad .
\end{align}
Since this current enters Maxwell's equations as a source term it will lead to
an electric field that does not actually satisfy Gauss' Law. In other words the
curl-free component of the electric field in an electromagnetic code using this
current deposition scheme will differ from the electric field in an
electrostatic code with the same particle distribution. This is clearly not
desirable and different methods have been used to correct the problem. One is to
deposit the charge density separately and to solve a Poisson equation to get
the longitudinal part of the electric field correct. Computationally cheaper
and very effective is to make use of the fact that the electric field is nearly
correct and to clean up the remaining error using a correction scheme, such as
the one by \cite{Marder_1987}.
This problem is solved all-together by current deposition schemes that
deposit a current that satisfies the discrete continuity equation directly.
The first of these so called \textit{charge conserving} schemes is by
\cite{Eastwood_1991},
%\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 need to remove
violations of Gauss' Law is completely eliminated.
Somewhat more widely implemented in the scheme by \cite{Villasenor_1992}. The
downside of this scheme is the need to treat the particle motion differently
depending how many cell interfaces the particle interacts with. Since this
scheme needs to branch to different algorithms its use especially on GPU is
disadvantageous as branching computationally more expensive there.Additionally
this scheme is tedious to extend to shape functions beyond CIC.
% \begin{figure}[htbp]
% \begin{center}
% \includegraphics[width=0.5\textwidth]{currentassignment_esirkepov.pdf}
% \caption{Current deposition using the algorithm by \cite{Esirkepov_2001}. The particle motion is decomposed into axis-parallel segments that are individually weighted.}
% \label{fig:num:currentassignment_esirkepov}
% \end{center}
% \end{figure}
\begin{figure}[h!]
\centering
\begin{subfigure}{0.4\hsize}
\centering
\includegraphics[width=\textwidth]{fig_chapter4/currentassignment_esirkepov.pdf}
\caption{Current deposition using the algorithm by \cite{Esirkepov_2001}. The particle motion is decomposed into axis-parallel segments that are individually weighted.}
\label{fig:num:currentassignment_esirkepov}
\end{subfigure}
\begin{subfigure}{0.4\hsize}
\centering
\includegraphics[width=\textwidth]{fig_chapter4/currentassignment_umeda.pdf}
\caption{Current deposition using the Zig-Zag algorithm by \cite{Umeda_2003}. As the particle closes from one cell to another
%(across the solid black line indicating the cell interface)
, its trajectory is modified to go via the midpoint.}
\label{fig:num:currentassignment_umeda}
\end{subfigure}
\caption{Charge conserving current deposition}
\end{figure}
A scheme that works with arbitrary shape functions (as long as they are products
of separate one-dimensional shape functions) and without the need for different
treatment of special cases is the current deposition by \cite{Esirkepov_2001}.
Fig.~\ref{fig:num:currentassignment_esirkepov} illustrates the current density
that is deposited using this algorithm for the same particle move as used in
Fig.~\ref{fig:num:currentassignment_naive}. The reader can verify that the
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
referred back to the excellent original paper.
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
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.
%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
%noise-properties between the two deposition schemes is similar.
Although the method requires some code depending on conditional branching the
computational cost and noise-properties between the two later deposition schemes
is similar.
% \begin{figure}[htbp]
% \begin{center}
% \includegraphics[width=0.5\textwidth]{currentassignment_umeda.pdf}
% \caption{Current deposition using the Zig-Zag algorithm by \cite{Umeda_2003}. As the particle closes from one cell to another (across the solid black line indicating the cell interface), it's trajectory is modified to go via the midpoint.}
% \label{fig:num:currentassignment_umeda}
% \end{center}
% \end{figure}
%
%Even in the case of unstructured grids, a charge-conserving current deposition
%method has been developed by \cite{Moon_2015}, that makes use of the
%discrete exterior algebra in its derivation.
Once the current is deposited on the grid it can be filtered to remove unwanted
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{Initialization and Particle Handling}
\label{subsec:num:init}
%We can now covered how the particle based source terms are incorporated in the
%evolution of the gridded electromagnetic quantities, how those act on the
%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 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
%step by step.
So far we have described how the temporal evolution of particles and fields and
their interaction are done in PiC codes. Yet the initial conditions have to be
prescribed. For field quantities this is a straight forward procedure: Analytic
expressions for equilibria are used (typically the magnetic field is given and the
electric is assumed to be zero). Reproducing the desired
distribution function $f(\vec{x},\vec{v},t_0)$ is more complicated and the method
used may have a measurable impact on the noise level.
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}
\vec{x} = \left(L_x\cdot \mathcal{U}(0,1), L_y \cdot \mathcal{U}(0,1), L_z \cdot \mathcal{U}(0,1)\right) \quad,
\end{equation}
where the random generator function $\mathcal{U}$ produces three independent (pseudo-)random numbers, uniformly distributed between zero and one. The expected number of \textit{particles per cell} (\textit{ppc}) is Poisson distributed as we have a discrete probability distribution with independent probability. Since the number of macroparticles is significantly smaller than the number of real particles, the statistical density fluctuations are higher in the simulation than in the reality. One easy step to remedy this to some extent is to create exactly the expected number of macro particles per cell and only choose
the position inside the cell at random. This also makes it easy to represent
spatially changing densities, by computing the number of particles in each cell
from a known analytic function $n(\vec{x})$. This works well as long as the
scale length $l_n = n / \frac{\partial\, n}{\partial{x}}$ is large compared to
the cell size $\Delta{x}$.
For uniform densities there is also the possibility to use \textit{low
discrepancy series} such as the Halton sequence \cite{Halton_1964}. This
sequence distributes particles more uniformly in the
simulation domain. This reduces the noise level as
$\mathcal{O}(1/N)$ with the particle number. Adding more particles would reduce the noise level only like $\mathcal{O}(1/\sqrt{N})$ . This \textit{quiet start} has been successfully used e.g. in the study of instabilities. %(see \cite{Byers_1970} for an example).
The non-relativistic Maxwellian distribution is simply the composition of three
velocity components that individually follow a normal distribution:
\begin{equation}
\vec{v} = \left(\mathcal{N}(u_x, v_{th}), \mathcal{N}(u_y, v_{th}), \mathcal{N}(u_z,v_{th})\right) \quad.
\end{equation}
$\mathcal{N}(\mu,\sigma)$ produces a random number from a normal
distribution with mean $\mu$ and standard deviation $\sigma$. The mean can be
the average drift velocity of that species (and can depend on position and
particle species, e.g. in the setup of a current sheet) and the standard
deviation is set by the thermal speed
\begin{equation}
v_{th} = \sqrt{\frac{k_B T}{m}} \quad .
\end{equation}
Note that there is a second popular definition of the thermal speed that
includes a factor of square root two. When comparing with other codes and results this is a
point worth double-checking. Different species of different masses will have
different thermal speeds at the same temperature.
%The extension of this method
%to include species of different temperatures for different species or spatial
%directions is straight forward.
%Some early simulations used other methods to approximate a Maxwellian
%distribution, but on modern machines the generation of $\mathcal{N}$ using the
%Box-Muller method or the ziggurat algorithm is sufficiently fast that a
%straight-forward approach performs well. This is both thanks to the fast
%evaluation of $\log$ and trigonometric functions and to the increased
%performance of the underlying generators producing pseudo-random integers.
If the drift speed $\vec{u}$ approaches relativistic speeds, but the thermal
speeds are still sufficiently low, some accuracy can be gained by generating a
non-drifting distribution and boosting it with a Lorentz boost. If the thermal
speed is large as well, it is necessary to generate a proper Maxwell-J\"uttner
distribution. This used to be problematic and many older codes neglect this,
however this leads to problematic deviations from the correct distribution as
demonstrated in \cite{Melzani_2013}. Fortunately an efficient algorithm is
described in \cite{Zenitani_2015}.
Sometimes it is desired to generate new particles from a given distribution
during initialization, but also later in the simulation, e.g. to fill a portion
of newly expanded simulation space or to inject plasma through an inflow
boundary. This is possible, but some subtleties need to be considered due to the
interaction with existing fields in the domain \cite{Cartwright_2000}.
% particle splitting and merging
In many simulations particles are created once and afterwards their number
never changes. It can however be useful to split particles into particles with
smaller macrofactor. in regions of (phase-)space, where there is a low number
of particles, to get better statistics and reduce noise. Many of those particles
however leave the interesting region again and need to be merged together again
to avoid a ballooning of the computational cost.
Splitting particles in a way that conserves mass, momentum and energy is
straight forward, as we can simply pick a source particle, split it into two
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.
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.
%A first solution was offered by \cite{Shon_2001}, combining several particles
%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
useful. The method of \cite{Faghihi_2017} extends this to include also the
stress tensor. If we do not want to redraw the complete particle population,
e.g. because we want to preserve features in phase space that are not well
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.
%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.
%Handling of dynamic particle numbers in a way that covers phase space well, is
%numerically efficient and conserves all global quantities remains a problem,
%despite all the described attempts and many others in recent year.
\subsection{Boundary Conditions}
\label{subsec:num:boundary}
As mentioned before it might be desirable to create new particles at the
boundary and proper care has to be taken for to match the existing fields
there. This is a general problem with boundary conditions in Particle-in-cell
codes. One has to handle both the fields and the particles there and should do
so in a consistent way to avoid problems.
Numerically easiest are periodic boundary conditions where the cell at the
upper end of a coordinate is logically wrapped around (for $N$ cells cell number 0 is right of cell $N-1$) to be just below the
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
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
%quantization of the spectrum can have visible, undesirable effects.
%Another set of boundary conditions that are reasonably popular is a version of
%Dirichlet boundary conditions for some field components. More specifically the
%normal component of the magnetic field is held fixed in time and the two
%tangential components of the electric field are set to zero. Geometrically this
%affects the three field components that are located at that face of the unit
%cell. The two magnetic field components on the perpendicular faces and the
%electric field on the edge normal to the boundary are not needed at the
%boundary and are not modified by evolved freely, same as in the interior of the
%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.
Also popular are Dirichlet boundary conditions for some field components: The
normal component of the magnetic field is held fixed in time and the two
tangential components of the electric field are set to zero. Geometrically this
affects the three field components that are located at that face of the unit
cell. The two magnetic field components on the perpendicular faces and the
electric field on the edge normal to the boundary are not needed at the
boundary and are evolved freely, same as in the interior of the
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
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
reflection when reaching the boundary.
More complicated boundary conditions for particles might absorb the particle or
emit one or more new particles drawn from some distribution function, possibly
depending on the energy of the incoming particle. This can simulate more or
less realistic metal wall including effects such as wall charging or secondary
electron emission.
While physically not a boundary condition, moving simulation domains are often
implemented in terms of boundary conditions. One example is the moving window
in the XOOPIC code \cite{Bruhwiler_2001}. Here the Eulerian mesh is not moving,
but instead new grid cells are created on one side and populated with
background magnetic field and fresh thermal particles. On the other side the
grid is truncated and particles are removed. If the window happens to move at the
speed of light -- common in simulation that follow the path of a laser pulse
through a plasma (see e.g. \cite{Yu_2016}) -- no perturbation caused by the
downstream boundary can reach the interior of the simulation domain, greatly
simplifying the implementation. If the window is moving slower, a boundary that
absorbs waves and does not reflect them back into the interior is needed at
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
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,
%incident angle and plasma parameters such as the magnetizations
This makes it very hard to absorb all wave modes that reach the boundary sufficiently well.
A great step forward was the development of the \textit{Perfectly Matched
Layer} (PML) by \cite{Berenger_1994}. This layer is technically not a boundary
condition, but rather a region of space with modified permeability and
permittivity. These material properties are chosen such that the impedance of
the material is identical to the adjacent free space. Therefore the refractive
index does not change from free space to the material layer and no waves are
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.
%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.
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.
%Even before the development of these methods was completed, PML conditions were
%used in Particle-in-Cell simulations, see e.g. \cite{Pasik_1999, Pukhov_1999}.
PML boundary conditions are often combined with boundaries that absorb
outgoing particles and replace them in some scheme to simulate the presence of a
thermal plasma bath outside the simulation domain that can act as the source of
unperturbed upstream. This has been used in the simulation of
magnetic reconnection, where the removal of plasma in the outflow regions and
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
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
manipulating the electromagnetic field directly. More complicated injection
schemes that allow for the injection of realistic laser pulses
(\cite{Thiele_2016}), of oblique waves with arbitrary envelops
(\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
\subsection{Diagnostics}
\label{subsec:num:diag}
Designing and using a Particle-in-Cell code is interesting by itself, 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.
%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
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
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. 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. 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\footnote{other formats are available,
but HDF5 is widely supported by many post-processing tools}. The first choice
has the advantage of low overhead as nearly no metadata is saved. 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 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.
Other field data that need to be computed just for diagnostic purposes such as
the mass density, charge density, average bulk velocities, or components of the
pressure tensor can also be good choices for grid based output. Even if many of
these quantities are required it is typically cheaper to compute the
diagnostics during the parallel simulation instead of dumping the full particle
information and doing post-processing.
In many cases not all of the three-dimensional field data is required.
Averaging over one or two dimensions to obtain line profiles or two-dimensional
selections is an option. Alternatively line-outs or two-dimensional cuts can be
useful. If points of interest are known beforehand or can easily be computed on
the fly it is interesting to output time histories of those points at high
cadence. If a global overview is needed, but not the full resolutions, it is
possible to output a downsampled grid. Care should be taken to apply a digital
low-pass filter -- such as a Kaiser window \cite{Kaiser_1980} -- before the
decimation to avoid aliasing.
In some cases it is necessary to restart the simulation, either due to reaching a
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.
Many other diagnostics have been developed and the following list of examples
is certainly incomplete: one-dimensional histograms of particle quantities
(speed, energy), two-dimensional cuts in phase space showing e.g.
$x-v_x$-densities, Fourier transforms of other quantities such as
$\tilde{B}(|k|)$, time averages of other quantities to remove high-frequency
noise, trajectories of specially selected particles of interest, often together
with local field quantities at the position of the tracer particles,
reconstruction of the particle phase space density on a six-dimensional grid,
discrete estimates of the entropy based on a binned phase space. The
possibilities are endless here and a large fraction of the development time of
a mature code will be invested in providing user friendly, scalable, efficient
diagnostics.
One special diagnostic that is of interest in astrophysical applications is the
calculation of radiation spectra. This is different from the spectrum of the
field inside the simulation domain that is limited to frequencies that are
explicitly resolved. Often there is synchrotron or inverse-Compton radiation at
much higher frequencies that can be calculated separately. See
\cite{Pausch_2018} on how to implement and properly test such
radiation diagnostics. Some recent codes include the production of gamma rays
and electron-positron pairs \cite{Nerush_2017}. This is especially relevant for
the nascent field of pulsar magnetosphere simulations, where the back reaction
of the radiation processes on the energetic particles in the simulation needs
to be included \cite{Kalapotharakos_2018}.
\subsection{Test Cases}
\label{subsec:num:test}
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
towards the code and that the code is tested. Other communities like the
fluid simulation community. have a large number of test cases for which
analytic solutions are known, or at least results from other codes are
available. In the Particle-in-Cell community validation efforts (making
sure that the employed plasma model is adequate and that the underlying
assumptions are met), benchmarking (comparison with other codes) and
validation (testing proper implementation) are relatively new
and rare. One of the reasons is that the number of test problems with known,
analytic solutions is rather small.
%Unlike hydro codes that tend to develop negative densities or pressures when
%numerical problems occur Particle-in-Cell codes are relatively robust. This
%can be a good, but brings the risk of obtaining a plausible but wrong result.
%It is therefore important that the researcher employs a healthy skepticism
%towards the code and that the code is tested. Other communities have a large
%number of test cases for which analytic solutions are known, or at least
%results from other codes are available. In the Particle-in-Cell community
%effort into validation (making sure that the employed plasma model is adequate
%and that the underlying assumptions are met), benchmarking (comparison with
%other codes) and validation (testing proper implementation) are relatively new
%and rare. One of the reasons is that the number of test problems with known,
%analytic solutions is rather low.
%But there some test cases that can be recommended. The paper by
%\cite{Jacobs_2006} introduced a discontinuous Galerkin code on unstructured
%mesh, but also includes several useful test cases. The study of
%Kelvin-Helmholtz instability in Saturn's magnetopause in \cite{Delamere_2011}
%has been used by several hybrid codes. Code description paper such as the one
%for the Apart-T code \cite{Melzani_2013} or the SHARP code \cite{Shalaby_2017}
%lists several test problems that are solvable with that code and offers
%opportunity for benchmarking. Papers that investigate new hybrid codes such as
%\cite{Amano_2014,Munoz_2018} contain testproblems to demonstrate the new
%method, but many of them are also accessible to PiC codes. The paper by
%\cite{Kilian_2017} contains a list of wave modes and suggested parameters that
%are accessible to different plasma models that can be implemented by PiC codes.
But there are some test cases that can be recommended. The paper by
\cite{Jacobs_2006} introduced a discontinuous Galerkin code on unstructured
mesh, but also includes several useful test cases. The study of
Kelvin-Helmholtz instability in Saturn's magnetopause \cite{Delamere_2011}
has been used by several hybrid codes. Code description paper such as the one
for the Apart-T code \cite{Melzani_2013} or the SHARP code \cite{Shalaby_2017}
lists several test problems that are solvable with that code and offers
opportunity for benchmarking. Papers that investigate new hybrid codes such as
\cite{Amano_2014,Munoz_2018} contain test problems to demonstrate the new
method, but many of them are also accessible to PiC codes. The paper by
\cite{Kilian_2017} contains a list of wave modes and suggested parameters that
are accessible to different plasma models that can be implemented by PiC codes.
Physical setups for which analytic solutions exist include the study of plasma
waves \citep{Aastroem_1950, Bernstein_1958, Andre_1985, Swanson_2003} and the
thermal excitation of fluctuations in density \citep{Dougherty_1960} or
electromagnetic fields \cite{Akhiezer_1975, Yoon_2017}. For complicated
distribution function that do not admit analytic solutions for the dispersion
relation of plasma waves comparison with numeric dispersion solver
\cite{Roennmark_1982, Xie_2016} is useful. The study of Landau damping has a
long tradition \cite{Dawson_1961} and can be useful to test the long term
stability of the code \cite{Manfredi_1997}.
The comparison between different code types such as in \cite{Dimits_2000,
Munoz_2015} can be useful to find the limits of applicability. This kind of
comparison is especially popular in the Fusion power community
\cite{Falchetto_2008}. The expected scaling behavior when improving numerical
resolution can also be used to test the code, even without outside reference
simulations, as shown in \cite{Riva_2017}.
\chapter{Hyperbolic conservation laws}
A large number of physics problems can be cast into a hyperbolic conservation law of the type
\begin{align}
\diffp{u(x,t)}{t} + \diffp{f(u(x,t))}{x} = 0
\end{align}
or in more than one dimension
\begin{align}
\diffp{u(x,t)}{t} + \nabla f(u(x,t)) = 0
\end{align}
As the name promises, something is conserved. Here $u$ is conserved and $f$ is the flux of this quantity. Whenever something behaves vaguely like a fluid this type of equation comes into play. The most simple form of this conservation law is the advection equation. As we will discuss later, the advection equation has - in its simple form - an analytic solution. If this was the case for all hyperbolic conservation laws there would be no need for numerical simulations. Unfortunately most hyperbolic conservation laws are similar to the Burgers equation, which includes a nonlinearity on the RHS (Navier-Stokes, MHD, etc.). And then there is no analytic solution.
We still need to understand how solutions look like for hyperbolic conservation laws to develop numerical schemes and decide, which solution is correct.
One point we have to discuss is the fact that we deal with PDEs now rather than ODEs before. We may solve a conservation law using, e.g., a Runge-Kutta 3rd order scheme
\begin{align}
u^\prime &= u^n +\Delta t \diffp{u^n}{x}\\
u^{\prime\prime} &= \frac{3}{4} u^n + \frac{1}{4}u^\prime +\frac{1}{4}\diffp{u^\prime}{x}\\
u^{n+1} &= \frac{1}{3} u + \frac{2}{3} u^{\prime\prime} - \frac{2}{3}\diffp{u^{\prime\prime}}{x}
\end{align}
Looks simple? It isn't. As we will figure out, the derivatives with respect to $x$ cannot just be cast into a finite difference.
\section{Advection equation}
The advection equation
\begin{align}
\partial_t u + a \partial_x u &= 0\\
u_0(x,t=0) &= u_0(x)
\end{align}
describes how the quantity $u$ is advected with a constant velocity $a$. When everything moves at constant speed, we can easily find the analytic solution
\begin{align}
u(x,t) = u_0(x- a t)
\end{align}
The solution is constant along the line $x_0 = x-at$. These lines are called characteristics.
\begin{figure}
\begin{center}
\pgfimage[width=.8\textwidth]{fig_chapter5/linear-advection}
\end{center}
\end{figure}
Characteristics are a fundamental concept for first order differential equations and we will make use of this concept for the more complicated conservation schemes.
The characteristic fulfills $x^\prime(t)=a$ and $x(0)=x_0$. When differentiating $u$ along the characteristic we find
\begin{align}
\diff{}{t} u(x(t),t) &= \diffp{}{t} u(x(t),t) + \diffp{}{x} u(x(t),t) x^\prime(t)\\
&= u_t + a u_x = 0
\end{align}
As pointed out before: $u$ is a constant along the characteristic.
Now we may take a more general approach: let the advection speed be a function of $x$
\begin{align}
\partial_t u + \partial_x (a(x) u) = 0
\end{align}
where $a(x)$ is a smooth function.
\begin{align}
\partial_t u + a(x)\partial_x u = -a^\prime(x) \Leftrightarrow\left(\diffp{}{t}+a(x)\diffp{}{x} \right) u(x,t) = -a^\prime(x) u(x,t)
\end{align}
The evolution of $u$ along
\begin{align}
x^\prime(t) = a(x(t)),\quad x(0) = x_0
\end{align}
is given by the ODE
\begin{align}
\diff{}{t} u(x(t),t) = -a^\prime(x(t)) u(x(t),t)
\end{align}
We have found a characteristic again, but this is no longer a constant.
On which points does the solution depend? For the linear advection equation the answer is simple: It is the point $x_0$ through which the characteristic goes. The concept is called \emph{Domain of Dependence} $\mathcal{D}(x,t) = \{x_0\}$. It is not completely unexpected that $\mathcal{D}$ is not necessarily a single point. For hyperbolic systems we can at least conclude that $\mathcal{D}$ is a bounded interval. The length of the interval will increase with time
\begin{align}
\mathcal{D} \subset \{x:|x-\bar x| \leq a_\text{max} \bar t\}
\end{align}
Vice versa this means that starting from a single given point only a given area $ \{x:|x- x_0| \leq a_\text{max} t\}$ will be influenced (\emph{Range of Influence}). Hyperbolic systems have a limited velocity of propagation.
\subsection{Non-smooth data}
We have implictly assumed that $u_0$ is differentiable. For the characteristic differentiable functions are not essential. Even for $u_0$ with singularities we may define a solution. The singularity will move along the characteristic.
For non-differentiable $u_0$ the solution $u$ is no longer a classic solution (since the differential equation requires\dots differentiation\dots). The solution fulfills, however, the integral conservation law (i.e., the fundamental physics behind this).
A different approach to this would be: Let $u_0^\epsilon$ be a series of differentiable functions with $\lim_{\epsilon\to 0} = u_0$
\begin{align}
\| u_0 - u_0^\epsilon \|_1 < \epsilon, \quad \| \cdot \|_1 \Rightarrow \| v\|_1= \int_{-\infty}^{+\infty} |v(x)| \dd x
\end{align}
The $u_0^\epsilon$ lead to differentiable, classic solutions $u^\epsilon(x,t)$
\begin{align}
u^\epsilon(x,t) = u_0^\epsilon(x - at) \Rightarrow u(x,t) = \lim_{\epsilon\to 0} u_0^\epsilon(x-at) = u_0(x- at)
\end{align}
This works totally fine when talking about the linear case. When we move on to a non-constant advection speed we change from the advection equation to the diffusion advection equation
\begin{align}
\partial_t u + a \partial_x u = \epsilon \partial_x^2 u
\end{align}
in the limit of vanishing viscosity $\epsilon$. Let $u^\epsilon(x,t)$ be a solution to this equation. This solution is always differentiable since we have moved from a hyperbolic to a parabolic equation. From that point we can move to $\lim_{\epsilon\to 0}$ - the so-called vanishing viscosity solution. We will discuss this for non-linear equations in the next section.
\section{Burgers equation}
Let's move on to real nonlinear equations. We will consider equations of the type
\begin{align}
\partial_t u + \partial_x f(u) = 0
\end{align}
where $f(u)$ is a convex function with $\partial_x^2 f(u) > 0$. The simplest case is the Burgers equation with $f(u) = 1/2 u^2$
\begin{align}
\partial_t u + u\partial_x u = 0
\end{align}
It should be pointed out that the original Burgers equation in fact includes a dissipation term $\epsilon \partial_x^2 u$ on the RHS.
One may find the exact solution to this equation using the Cole-Hopf transformation that transforms the Burgers equation to heat transfer equation. But this is too theoretical. We are interested in the characteristics
\begin{align}
x^\prime (t) &= u(x(t),t)\\
\diff{}{t} u(x(t),t) &= \diffp{}{t} u(x(t),t) + \diffp{}{x} u(x(t),t) x^\prime(t)\\
&= u_t + u u_x
\end{align}
Since $u$ is constant along the characteristic the gradient of the characteristic does not change, i.e. the gradients are straight lines (cf. Fig. \ref{fig:burgers1}).
\begin{figure}
\begin{center}
\pgfimage[width=.8\textwidth]{fig_chapter5/burgers1}
\end{center}
\caption{Solution to the Burgers equation with characteristics. Due to the nonlinearity the peak moves faster and becomes steeper.}
\label{fig:burgers1}
\end{figure}
For small times $t$ the characteristics do not cross each other, one may calculate
\begin{align}
x &= \zeta + u(\zeta,0) t\\
u(x,t) &= u(\zeta,0)
\end{align}
For increasing times $t$ the characteristic come close to each other (cf. \ref{fig:burgers2}) until at some time $T_b$ two characteristic cross each other. This leads to a non-unique solution.
\begin{figure}
\begin{center}
\pgfimage[width=.8\textwidth]{fig_chapter5/burgers2}
\end{center}
\caption{Solution to the Burgers equation for non-smooth data. As in Fig. \ref{fig:burgers1} the peak becomes faster.}
\label{fig:burgers2}
\end{figure}
This process is somewhat like wave-breaking. As seen in Fig. \ref{fig:burgers3} we would have a three valued function for $t>T_b$ (don't be fooled by the breaking wave analogy: the process is similar, but $u$ is not a wave shape).
\begin{figure}
\begin{center}
\pgfimage[width=.8\textwidth]{fig_chapter5/burgers3}
\end{center}
\caption{Following the evolution of \ref{fig:burgers1} would result in a non-well defined solution. For some points three solutions exist. This is clearly unphysical}
\label{fig:burgers3}
\end{figure}
As pointed out before we may make use of viscosity to find the correct solution (the vanishing viscosity solution).
\subsection{Weak solutions}
So how do we find the solution for the inviscid equation without demanding differentiability? We will take a step back and consider the integral formulation (the integral includes the fundamental physical background of conservation).
Let's consider a test function $\varphi \in C_0^1 (\mathbb{R}\times \mathbb{R})$ which is continuously differentiable with compact support (i.e., 0 outside the interval). We will now multiply the equation $u_t + f_x = 0$ with $\varphi(x,t)$
\begin{align}
\int_0^\infty \dd t \int_{-\infty}^{+\infty} \dd x (\varphi \partial_t u + \varphi \partial_x f(u)) &= 0
\end{align}
Using integration by parts we can show that this is
\begin{align}
\left(\int_{-\infty}^{+\infty}\dd x \varphi u \right)|_0^\infty - \int_0^\infty \dd t\int_{-\infty}^{+\infty} \dd x \varphi_t u + \varphi_x f(u)
\end{align}
The function $u(x,t)$ is called weak solution when for all functions $\varphi \in C_0^1 (\mathbb{R}\times \mathbb{R})$ the following equation holds
\begin{align}
\int_0^\infty \dd t\int_{-\infty}^{+\infty} \dd x \varphi_t u + \varphi_x f(u) = -\int_{-\infty}^{+\infty} \dd x \varphi(x,0) u(x,0)
\end{align}
The concept of weak solutions is not something that is used in real life, it is a theoretical concept to prove the correctness of solutions. The following solutions all fulfil the weak solution concept.
\section{The Riemann problem}
The connection of a conservation problem and a piecewise constant initial value yields a so called Riemann problem. The Riemann problem is essentially a template for the general solution. We will again consider the Burgers equation as conservation law and
\begin{align}
u(x,0) = \begin{cases} u_l & x<0 \\ u_r & x>0 \end{cases}
\end{align}
We will assume $u>0$ for the sake of simplicity.
\subsection{Case 1}
For $u_l> u_r$ we will find the following solution
\begin{align}
u(x,t) = \begin{cases} u_l & x < s t\\ u_r & x > s t\end{cases}
\end{align}
with the shock speed $s=1/2(u_l+u_r)$. When viscosity is included, this will result in the traveling wave solution.
\begin{figure}
\begin{center}
\pgfimage[width=.8\textwidth]{fig_chapter5/riemann1}
\end{center}
\caption{The case $u_l>u_r$}
\label{fig:riemann1}
\end{figure}
Fig. \ref{fig:riemann1} shows the solution of a moving shock where the characteristic converge \emph{into} the shock.
\subsection{Case 2}
For $u_l < u_r$ there are infinitely many weak solutions. The upper solution in Fig. \ref{fig:riemann2} includes again a shock with speed $s$. The difference to the previous case is that the characteristics come out of the shock. This is an entropy violating solution, which is unstable against perturbations.
The correct solution is a rarefaction wave (shown in the lower part of Fig. \ref{fig:riemann2})
\begin{align}
u(x,t) = \begin{cases} u_l & x < u_l t\\ x/t & u_l t \leq x \leq u_r t \\ u_r & x> u_r t \end{cases}
\end{align}
\begin{figure}
\begin{center}
\pgfimage[width=.8\textwidth]{fig_chapter5/riemann2}
\end{center}
\caption{The case $u_l<u_r$}
\label{fig:riemann2}
\end{figure}
\subsection{Shock speed}
The shock solution is only a weak solution, when $s=1/2(u_l+u_r)$. For any other speed the solution is not a weak solution. For $M > s t$
\begin{align}
\diff{}{t} \int_{-M}^{+M}\dd x u(x,t) &= f(u_l) - f(u_r) \\
&= \frac{1}{2} (u_l+u_r)(u_l-u_r)\\
\int_{-M}^{+M}\dd x u(x,t) &= (M+st) u_l + (M-st) u_r\\
\Rightarrow \diff{}{t}\int_{-M}^{+M}\dd x u(x,t) &= s(u_l-u_r)
\end{align}
In the general case the $f(u)$ can be derived from the Rankine-Hugoniot jump conditions
\begin{align}
f(u_l) - f(u_r) = s(u_l-u_r)
\end{align}
In the scalar case
\begin{align}
s = \frac{f(u_l) - f(u_r)}{u_l-u_r} = \frac{[f]}{[u]}
\end{align}
where $[\cdot]$ is the difference over the shock. When $f$ and $u$ are vectors, $s$ is still a scalar. Jumps are, therefore, only allowed for when $f(u_l) - f(u_r)$ and $u_l-u_r$ are linear dependent.
In the real world (more than dimension, more than one quantity) the flux $f(u)$ is a linear system $A u$ where $u$ is $N$-dimensional and $A$ is a $N\times N$ matrix. The characteristics of this system are then the Eigenvalues of the system. Discontinuities are following these characteristics.
\subsection{Manipulation of conservation laws}
When considering the Burgers equation
\begin{align}
\partial_t u + \partial_x(1/2 u^2) = 0
\end{align}
we can perform the following manipulations
\begin{align}
2 u \partial_t u + 2 u^2 \partial_x u & 0\\
\Rightarrow \partial_t (u^2) + \partial_x (2/3 u^3) = 0
\end{align}
This is seemingly a conservation law (for $u^2$) and we have made no grave mathematical mistake. The smooth solutions are even identical. The weak solutions, however, are behaving differently
\begin{align}
s_1 &= \frac{[1/2 u^2]}{[u]} = 1/2 (u_l + u_r)\\
s_2 &= \frac{[2/3 u^3]}{[u^2]} = 2/3 \frac{(u_r^3 - u_l^3)}{u_r^2-u_l^2}
\end{align}
Why is this different (and wrong\dots)? The manipulation is only valid for smooth solutions, where taking the derivative is a safe and well-defined operation.
\subsection{Entropy condition}
Obviously there is some ambiguity in solving the correct equations correctly. How do I figure out which solution is correct? The theoretical considerations from the last sections show that we may use the \emph{vanishing viscosity} ansatz. While this is technically correct, it is completely impractical and complicated.
We may use our knowledge about what happens at the shock: Characteristics shall run \textbf{into} the shock rather than \textbf{out of} the shock. In the latter case the solution is unstable. From this we can conclude an \emph{entropy condition}
Version 1
\begin{align}
f^\prime(u_l) > s > f^\prime(u_r)
\end{align}
Version 2
\begin{align}
\frac{f(u) - f(u_l)}{u - u_l} \geq s \geq \frac{f(u) - f(u_r)}{u - u_r}
\end{align}
Version 3
\begin{align}
\exists E \forall a > 0, t> 0 \quad \frac{u(x+a,t)-u(x,t)}{a} < \frac{E}{t}
\end{align}
%
\subsection{Scalar examples}
\subsubsection{Traffic flow}
Traffic fulfills a continuity equation
\begin{align}
\partial_t \rho + \partial_x(\rho u) = 0
\end{align}
where one can derive the velocity $u$ from the traffic density $\rho$
\begin{align}
u = u(\rho) = u_\text{max}(1-\frac{\rho}{\rho_\text{max}})
\end{align}
This is actually a closure for a complicated system - only one equation earlier than in typical fluid equations
\begin{align}
\partial_t \rho + \partial_x(f(\rho)) = 0,\quad f(\rho) =\rho u_\text{max}(1-\frac{\rho}{\rho_\text{max}})
\end{align}
For some system (here: Lincoln tunnel) other fluxes have been measured $f(\rho) = a \rho \log \rho_\text{max}/\rho$.
The characteristics can be derived for the standard case
\begin{align}
f^\prime(\rho) = u_\text{max}\left( 1 - \frac{2\rho}{\rho_\text{max}} \right)
\end{align}
Bildchen mit Stau/Fahrzeug-Charakteristik
\subsection{Nonlinear systems}
\subsubsection{Euler equation}
The Euler equations describe gas flows
\begin{align}
\partial_t \rho +\partial_x (\rho v ) &= 0\\
\partial_t (\rho v) + \partial_x(\rho v^2 + p) &= 0\\
1/2 \rho v^2 + \rho e &= E \quad \text{(specific inner energy)}\\
\partial_t E +\partial_x(v(E+p)) &= 0
\end{align}
This can be written in vector form
\begin{align}
\partial_t \begin{pmatrix} \rho \\\rho v\\E\end{pmatrix} +\partial_x \begin{pmatrix} \rho v\\ \rho v^2 +p\\ v(E+p) \end{pmatrix}
\end{align}
For the ideal gas we have the following relations
\begin{align}
p &= \rho k_B T/m\\
e &= c_V T \\
\gamma = c_p/c_V
\end{align}
The entropy is known to be
\begin{align}
S &= c_V \log(p/\rho^\gamma)\\
\Rightarrow p &= \kappa \exp(S/c_V)\rho^\gamma\\
\Rightarrow \partial_t S + v\partial_x S &= 0
\end{align}
which leads to the Euler equation for the ideal gas
\begin{align}
\partial_t \rho + \partial_x (\rho v) &= 0\\
\partial_t (\rho v) + \partial_x ) &= 0\\
\partial_t S + v\partial_x S &= 0
\end{align}
\section{Numerical methods}
Let us linear equations of the type
\begin{align}
\partial_t u + A \partial_x u &= 0 \label{eq:leveque10.1}\\
u(x,0) &= u_0 (x)\\
x_j &= j h \\
t^n &= n k \\
x_{j+1/2} &= x_j + h/2
\end{align}
where $A$ is a linear operator.
The finite solution will produce approximations $U_j^n \in \mathbb{R}^m$ to the true solution $u(x_j,t^n)$ which will be denoted $u_j^n = u(x_j, t^n)$. A better approximation is the cell average
\begin{align}
\bar{u}_j^n = \frac{1}{h}\int_{x_{j-1/2}}^{x_{j+1/2}} \dd x\ u(x,t^n)
\end{align}
since $u$ is a conserved quantity and the conservation is given as exactly this integral.
There are a wide variety of finite difference methods that can be used. Many of these
are derived simply by replacing the derivatives occurring in Eq. \eqref{eq:leveque10.1} by appropriate finite differenc eapproximations. For example, replacing $u_t$, by a forward-in-time approximation and $u_x$, by a spatially centered approximation, we obtain the following difference equations for $U^{n+1}$:
\begin{align}
\frac{U_j^{n+1} - U_j^n}{k}+A\left( \frac{U_{j+1}^n-U_{j-1}^n}{2h}\right) = 0
\end{align}
This can be solved to obtain
\begin{align}
U_j^{n+1} = U_j^n-\frac{k}{2h}A(U_{j+1}^n - U_{j-1}^n)\label{eq:leveque10.7}
\end{align}
Unfortunately, despite the quite natural derivation of this method, it suffers from severe
stability problems and is useless in practice.
A far more stable method is obtained by evaluating the centered difference approximations to $u_x$ at time $t_{n+1}$ rather than at time $t_n$, giving
\begin{align}
\frac{U_j^{n+1} - U_j^n}{k}+A\left( \frac{U_{j+1}^{n+1}-U_{j-1}^{n+1}}{2h}\right) = 0
\end{align}
or
\begin{align}
U_j^{n+1} = U_j^n-\frac{k}{2h}A(U_{j+1}^{n+1} - U_{j-1}^{n+1})\label{eq:leveque10.9}
\end{align}
Note, however, that in order to determine $U^{n+1}$ from the data $U^n$ in each timestep, we
must view equation \eqref{eq:leveque10.9} as a coupled system of equations over all values of $j$. This would be an infinite system for the Cauchy problem, but in any practical calculation we
would use a bounded interval with $N$ gridpoints and this would be a finite system. In
the scalar case this is an $N\times N$ linear system with a tridiagonal coefficient matrix.When
$ u\in \mathbb{R}^m$, the discrete system is $mN\times mN$.
The method \eqref{eq:leveque10.7} allows us to determine $U^{n+1}$ explicitly, and is called an explicit method, whereas \eqref{eq:leveque10.9} is an implicit method. Implicit methods are rarely used for time-dependent hyperbolic problems, although they are very important for other classes of equations. Although the method \eqref{eq:leveque10.7} is useless due to stability problems, there are other explicit methods which work very satisfactorily with reasonable size timesteps and these are typically more efficient than implicit methods.
If we look at which gridpoints are involved in the computation of $U^{n+1}$ with a given
method, we can obtain a diagram that is known as the stencil of the method. The stencils
for the methods \eqref{eq:leveque10.7} and \eqref{eq:leveque10.9} are given below.
A wide variety of methods can be devised for the linear system \eqref{eq:leveque10.1} by using different finite difference approximations. A few possibilities are listed in the table below along with their stencils. Most of these are based directly on finite difference approximations to
the PDE. An exception is the Lax-Wendroff method, which is based on theTaylor series
expansion
\begin{align}
u(x,t+k) = u(x,t) + k \partial_t u(x,t) + \frac{1}{2} k^2 \partial_t^2 u(x,t) + \dots \label{eq:leveque10.10}
\end{align}
and the observation that from $\partial_t u = - A\partial_x u$, we can compute
\begin{align}
\partial_t^2 = - A \partial_x\partial_t u = - A\partial_t\partial_x u = A^2 \partial_x^2 u
\end{align}
so that Eq. \eqref{eq:leveque10.10} becomes
\begin{align}
u(x,t+k) = u(x,t) -k A \partial_x u(x,t) + \frac{1}{2}k^2 A^2 \partial_x^2 u(x,t)\label{eq:leveque10.12}
\end{align}
The Lax-Wendroff method then results from retaining only the first three terms of \eqref{eq:leveque10.12} and using centered difference approximations for the derivatives appearing there.
With the exception of the Leapfrog method, all of themethods below are 2-level
methods. For time-dependent conservation laws, 2-level methods are almost exclusively
used. Methods involving more than 2 levels have additional difficulties. They require
more storage (a disadvantage primarily in two or three dimensional calculations) and
they require special start up procedures, since initially only one level of data is known.
We will study explicit 2-level methods almost exclusively, and introduce some special
notation for such methods, writing
\begin{align}
U^{n+1} = \mathcal{H}_k(U^n)
\end{align}
Here $U^{n+1}$ represents the vector of approximations $U_j^{n+1}$ at time $t^{n+1}$. The value $U_j^{n+1}$ at a particular point $j$ typically depends on several values from the vector $U^n$ (depending on how large the stencil is), and so we write
\begin{align}
U_j^{n+1} =\mathcal{H}_k(U^n; j)
\end{align}
to signify that $U^{n+1}_j$ depends on the full vector $U^n$. For example, the $\mathcal{H}_k$ operator for method \eqref{eq:leveque10.7} takes the form
\begin{align}
\mathcal{H}_k(U^n;k) = U_j^n - \frac{k}{2 h}(U_{j+1}^n - U_{j-1}^n)
\end{align}
A list of often used discretizations is given here. This list is not exhaustive, but gives a rough idea of what is used in the wild. The graphics provide an idea of the stencil in space and time.
\begin{description}
\item[Backward Euler]
$$U_j^{n+1} = U_j^n-\frac{k}{2h} A(U_{j+1}^{n+1} - U_{j-1}^{n+1}) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,1) circle (0.1);
\draw (0.2,1) -- (0.8,1);
\fill[black] (1,1) circle (0.1);
\draw (1.2,1) -- (1.8,1);
\fill[black] (2,1) circle (0.1);
\draw(1,0.8) -- (1,0.2);
\fill[black] (1,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[One-sided]
$$U_j^{n+1} = U_j^n-\frac{k}{h} A(U_{j}^n - U_{j-1}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (1,0) circle (0.1);
\draw (0.2,0) -- (0.8,0);
\fill[black] (1,1) circle (0.1);
\draw (1,0.2) -- (1,0.8);
\fill[black] (0,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[One-sided]
$$U_j^{n+1} = U_j^n-\frac{k}{h} A(U_{j+1}^n - U_{j}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (1,0) circle (0.1);
\draw (1.2,0) -- (1.8,0);
\fill[black] (1,1) circle (0.1);
\draw (1,0.2) -- (1,0.8);
\fill[black] (2,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[Lax-Friedrichs]
$$U_j^{n+1} = \frac{1}{2}(U_{j-1}^n + U_{j+1}^n)-\frac{k}{2h} A(U_{j+1}^n - U_{j-1}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,0) circle (0.1);
\draw (0.2,0.2) -- (0.8,0.8);
\fill[black] (1,1) circle (0.1);
\draw (1.8,0.2) -- (1.2,0.8);
\fill[black] (2,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[Lax-Wendroff]
$$U_j^{n+1} = U_j^n-\frac{k}{2h} A(U_{j+1}^n - U_{j-1}^n) + \frac{k^2}{2h^2}A^2(U_{j+1}^n - 2U_j^n + U_{j-1}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,0) circle (0.1);
\draw (0.2,0) -- (0.8,0);
\fill[black] (1,1) circle (0.1);
\draw (1.2,0) -- (1.8,0);
\fill[black] (2,0) circle (0.1);
\draw(1,0.8) -- (1,0.2);
\fill[black] (1,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[Leapfrog]
$$U_j^{n+1} = U_j^{n-1}-\frac{k}{2h} A(U_{j+1}^n - U_{j-1}^n) $$ \begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,1) circle (0.1);
\draw (0.2,1.2) -- (0.8,1.8);
\fill[black] (1,2) circle (0.1);
\draw (1.2,1.8) -- (1.8,1.2);
\fill[black] (2,1) circle (0.1);
\draw(1.8,0.8) -- (1.2,0.2);
\fill[black] (1,0) circle (0.1);
\draw(0.8,0.2) -- (0.2,0.8);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\end{description}
\subsection{Local truncation error}
The local truncation error $L_k(x,t)$ is a measure of how well the difference equation models
the differential equation locally. It is defined by replacing the approximate solution $U_j^n$ in
the difference equations by the true solution $u(x_j,t^n)$. Of course this true solution of the
PDE is only an approximate solution of the difference equations, and how well it satisfies
the difference equations gives an indication of how well the exact solution of the difference
equations satisfies the differential equation.
As an example, consider the Lax-Friedrichs method. This method is similar to the unstable method \eqref{eq:leveque10.7} but replaces $U_j^n$ by $1/2(U_{j-1}^n+U_{j+1}^n)$ and is stable
provided $k/h$ is sufficiently small, as we will see later.
We first write this method in the form
\begin{align}
\frac{1}{k}\left( U_j^{n+1} - \frac{1}{2}(U_{j-1}^n + U_{j+1}^n\right) +\frac{1}{2h} A (U_{j+1}^n - U_{j-1}^n) = 0
\end{align}
so that it appears to be a direct discretization of the PDE. If we now replace each $U_j^n$ by
the exact solution at the corresponding point, we will notget zero exactly. What we get
instead is defined to be thelocal truncation error
\begin{align}
L_k(x,t) = \frac{1}{k}\left( u(x,t+k) - \frac{1}{2}(u(x-h,t)+u(x+h,t)\right) +\frac{1}{2h} A (u(x+h,t) - u(x-h,t))
\end{align}
In computing the local truncation error we always assume smooth solutions, and so we
can expand each term on the right hand side in a Taylor series about $u(x,t)$.
Doing this and collecting terms gives (with $u=u(x,t)$):
\begin{align}
L_k(x,t) &= \frac{1}{k}\left( (u+k\partial_t u +\frac{1}{2} k^2 \partial_t^2 u+\dots) - (u +\frac{1}{2}h^2 \partial_x^2 u+\dots)\right) +\frac{1}{2h} A (2 h \partial_x u +\frac{1}{3}\partial_x^3 u+\dots)\\
&= \partial_t u + A\partial_x u +\frac{1}{2}\left(k\partial_t^2 u -\frac{h^2}{k} \partial_x^2 u \right) + \mathcal{O}(h^2)
\end{align}
Since we assume that $u(x,t)$ is the exact solution $\partial_t u +A\partial_x u =0$ we find that
\begin{align}
L_k(x,t) &= \frac{1}{2} k \left( A^2 - \frac{h^2}{k^2}I\right) \partial_x^2 u(x,t) + \mathcal{O}(k^2)\\
&= \mathcal{O}(k) \ \text{as} \ k\to 0
\end{align}
Recall that we assume a fixed relation between $k$ and $h$, $k/h=\text{constant}$, so that $h^2/k^2$ is constant as the mesh is refined. (This also justifies indexing $L_k$ by $k$ alone rather than by both $k$ and $h$.)
By being more careful in this analysis, using Taylor's theorem with remainder and
assuming uniform bounds on the appropriate derivatives of $u(x,t)$, we can in fact show a
sharp bound of the form
\begin{align}
\vert L_k(x,t) \vert \leq C k \quad \text {for all~} k<k_0
\end{align}
The constant $C$ depends only on the initial data $u_0$, since for the linear system we consider
here we can easily bound derivatives of $u(x,t)$ in terms of derivatives of the initial data.
If we assume more over that $u_0$ has compact support, then $L_k(x,t)$ will have finite 1-norm
at each time $t$ and we can obtain a bound of the form
\begin{align}
\Vert L_k(\cdot,t) \leq C_L k \quad \text {for all~} k<k_0
\end{align}
for some constant $C_L$ again depending on $u_0$.
The Lax-Friedrichs method is said to be first order since the local error depends linearly on $k$
We now extend these notions to arbitrary 2-level methods: For a general 2-level method, we define the local truncation error by
\begin{align}
L_k(x,t) = \frac{1}{k}\left( u(x,t+k) - \mathcal{H}(u(\cdot,t);x) \right) \label{eq:leveque10.33}
\end{align}
The method is consistent if
\begin{align}
\Vert L_k(\cdot,t)\Vert \to 0 \ \text{as} \ k \to 0
\end{align}
The method is of order $p$ if for all sufficiently smooth initial data
with compact support, there is some constant$C_L$ such that
\begin{align}
\Vert L_k(\cdot,t)\Vert < C_L k^p\ \text{for all} \ k < k_0,\ t \leq T
\end{align}
This is the local order of the method, but it turns out that for smooth solutions,the
global error will be of the same order provided the method is stable.
\subsection{Stability}
Note that we can rewrite Eq \eqref{eq:leveque10.33} in the form
\begin{align}
u(x,t+k) = \mathcal{H}_k(u(\cdot,t);x) + k L_k(x,t)
\end{align}
Since the numerical solution satisfies
\begin{align}
U(x,t+k) = \mathcal{H}_k(U_k(\cdot,t);x)
\end{align}
we can obtain a simple recurrence relation for the error in a linear method by subtracting these two expressions, obtaining
\begin{align}
E_k(x,t+k) = \mathcal{H}_k(E_k(\cdot,t);x)-k L_k(x,t)
\end{align}
Note that linearity is strongly required here. Since the method is linear, we can rewrite the last equation in the functional form
\begin{align}
E_k(\cdot,t+k) = \mathcal{H}_k E_k(\cdot,t) - k L_k(\cdot,t)
\end{align}
The error at time $t+k$ is seen to consist of two parts. One is the new local
error $-k L_k$ introduced in this timestep. The other part is the cumulative error from
previous timesteps. By applying this relation recursively we obtain an expression for the
error at time $t_n$:
\begin{align}
E_k(\cdot, t_n) = \mathcal{H}_k^n E_k(\cdot,0) - k \sum_{i=1}^n \mathcal{H}_k^{n-i} L_k(\cdot, t_{i-1})
\end{align}
Here superscripts on $\mathcal{H}_k$ represents powers of the matrix (or linear operator) obtained by repeated applications.
In order to obtain a bound on the global error, we must insure that the local error $L_k(\cdot, t_{i-1}$ is not unduly amplified by applying $n-i$ steps of the method. This requires stability of the metho, and we use a form that is often referred to as Lax-Richtmyer stability.
The method is stable if for each time $T$ there is a constant $C_S$ and a value $k_0>0$ such that
\begin{align}
\Vert \mathcal{H}_k^n\Vert \leq C_S \ \text{for all} \ k < k_0,\ n k \leq T
\end{align}
Note in particular that the method is stable if $\Vert \mathcal{H}_k \vert \leq 1$, for then $\Vert \mathcal{H}_k^n\Vert \leq \Vert \mathcal{H}_k\Vert^n \leq 1$ for all $n,k$. More generally, some growth is allowed.
\subsection{Lax Equivalence Theorem}
This is the fundamental convergence theorem for linear difference methods, and says that
for a \emph{consistent}, linear method, \emph{stability} is necessary and sufficient for convergence.
The proof is lengthy and unnecessary for this specific lecture\dots
\subsection{The CFL condition}
One of the first papers on finite difference methods for PDEs was written in 1928 by
Courant, Friedrichs, and Lewy. They use finite difference methods as an analytic tool for proving existence of solutions of certain PDEs. The idea is to define a sequence of approximate solutions (via finite difference equations), prove that they converge as the grid is refined, and then show that the limit function must satisfy the PDE, giving existence of a solution.
In the course of proving convergence of this sequence (which is precisely what we
are interested in), they recognized that a necessary stability condition for any numerical
method is that the domain of dependence of the finite difference method should include
the domain of dependence of the PDE, at least in the limit as $k,h\to 0$. This condition
is known as the CFL condition after Courant, Friedrichs, and Lewy.
The domain of dependence $\mathcal{D}_k(\bar x, \bar t)$ for the PDE has already been described. Recall that for the linear system, the set $\mathcal{D}_k(\bar x, \bar t)$ consists of the points
$\bar x- \lambda_p \bar t$, $p=1,2,\dots,m$ since only initial data at these points can affect the solution at $(\bar x, \bar t)$.
The numerical domain of dependence $\mathcal{D}_k(\bar x, \bar t)$, for a particular method is similarly defined. It is the set of points $\bar x$ for which initial data $u_0(x)$ could possibly affect the numericalsolution at $(\bar x, \bar t)$.
\textbf{Example:} Consider a three-point scheme with a stencil as for \eqref{eq:leveque10.7}. The value of $U_k(x_j,t^n)$ depends on values of $U_k$ at time $t_{n-1}$ the three
points $x_{j+q}, q=-1,0,1$. These values in turn depend on $U_k$ at time $t_{n-2}$ at the points
$x_{j+q}$ for $q=-2,-1,0,1,2$. Continuing back to $t=0$ we see that the solution at $t_n$
depends only on initial data at the points $_{j+q}$ for $q=-n,\dots,n$, and so the numerical
domain of dependence satisfies
\begin{align}
\mathcal{D}_k(x_j;t^n) \subset \{x: \vert x-x_k\vert \leq n h \}
\end{align}
or in terms of a fixed point $(\bar x,\bar t)$,
\begin{align}
\mathcal{D}_k(\bar x;\bar t) \subset \{x: \vert x- \bar x\vert \leq (\bar t/k)h \}
\end{align}
If we now refine the mesh with $k/h$ fixed, say $k/h=r$, then in the limit this domain of
dependence fills out the entire set,
\begin{align}
\mathcal{D}_0(\bar x;\bar t) = \{x: \vert x- \bar x\vert \leq \bar t/r \}
\end{align}
The CFL condition requires that
\begin{align}
\mathcal{D}_(\bar x;\bar t) \subset \mathcal{D}_0(\bar x;\bar t)
\label{eq:leveque10.54}
\end{align}
For a three-point scheme applied to a linear system this requires that
\begin{align}
\vert (\bar x - \lambda_p \bar t)-\bar x\vert \leq \bar t/r
\end{align}
i.e., that
\begin{align}
\left\vert \frac{\lambda_p k}{h} \right\vert \leq 1
\label{eq:leveque10.55}
\end{align}
for each eigenvalue $\lambda_p$ of A. This guarantees that the characteristics of the system lie within the computational triangle shown in Fig. \ref{fig:leveque_10.2}.
\begin{figure}
\begin{center}
\pgfimage[width=.6\textwidth]{fig_chapter5/leveque_10.2.png}
\end{center}
\caption{Computational triangle for a three-point scheme. The CFL condition requires
that characteristics lie within this triangle.}
\label{fig:leveque_10.2}
\end{figure}
The CFL condition is only a necessary condition for stability, not sufficient. The fact that it is necessary stems from the observation that \eqref{eq:leveque10.54} is violated then there are points $\zeta$ in the true domain of dependence that are not in the numerical domain of dependence. Changing the value of the initial data at $\zeta$ would thus effect the true solution but not the numerical solution, and hence the numerical solution cannot possibly converge to the true solution for all initial data.
For the Lax-Friedrichs method we have already seen that \eqref{eq:leveque10.55} is also a sufficient condition for stability, hence it is necessary and sufficient.
There are examples, however, when the CFL condition is not sufficient for stability. For example, the three-point centered method has the usual domain of dependence for a three-point method, and hence satisfies the CFL condition if \eqref{eq:leveque10.55} holds, but turns out to be unstable for any mesh ratio as is easily shown by von Neumann analysis.
\subsection{Upwind methods}
For scalar advetion equations with $a>0$, the one-sided method
\begin{align}
U_j^{n+1} = U_j^n - \frac{k}{h} a (U_{j+1}^n -U_j^n)
\end{align}
can be applied ans is stable provided the CFl condition is satisfied. This method is usually called the first order upwind method, since the one-sided stencil points in the \emph{upwind} or \emph{upstream} direction, the correct direction from which characteristic information propagates. If we think of the advection equation as modeling hte advection of a concentration profile in a fluid stream, then this is literally the upstream direction.
Similarly
\begin{align}
U_j^{n+1} = U_j^n - \frac{k}{h} a (U_{j}^n -U_{j-1}^n)
\end{align}
is the upwind method for the advection equation with $a<0$.
For a system of equations, we have seen that a one-sided method can only be used if all of the eigenvalues of A have the same sign. Ths is typically not the case in practice. In the linearized Euler equations, for example, the eigenvalues of $f^\prime(u)$ are $v, v\pm c$ and these all have the same sign only if $|v|>c$. In this case the fluid speed is greater than the sound speed and the flow is said to be supersonic. If $|v|<c$ then the flow is subsonic and any one-sided method will be unstable since there are sound waves propagating in both directions and the CFL condition is violated.
When computing discontinuous solutions, upwind differencing turns out to be an important tool, even for indefinite systems with eigenvalues of mixed sign. The appropriate application of upwind methods requires some sort of decomposition into characteristic fields. For example, if we change variables and decouple the linear system into
\begin{align}
\partial_t v - \Lambda \partial_x v = 0
\end{align}
the each of the resulting scalar problems can be solved with an appropriate upwind method, using the point to the left, when $\lambda_p>0$ or to the right when $\lambda_p <0$.
\section{Computing Discontinuous Solutions}
For conservations laws we are naturally interested in the difficulties caused by discontinuities in the solution. In the linear theory presented so far we have assumed smooth solutions, and used this in our discussion of the truncation error and the convergence proof. We now consider what happens when we apply a numerical method to a linear problem with discontinuous initial data, e.g., the Riemann problem for the scalar advection equation
\begin{align}
\partial_t u + a \partial_x u &= 0\label{eq:leveque11.1}\\
u_0(x) &= \begin{cases} 1 & x<0\\ 0 & x>0\end{cases}
\end{align}
Of course the exact solution is simply $u_0(x-at)$, but we expect our numerical method to have difficulty near the discontinuity. Note for example that a finite difference approximation to $\partial_x u$ applied across the discontinuity in the true solution will blow up as $h\to 0$.
\begin{align}
\frac{u(a t + h, t) - u (a t -h,t)}{2h} = \frac{0-1}{2 h} \to -\infty \ \text{as} \ h \to 0
\end{align}
The local truncation error does not vanish as $h\to 0$ and the proof of convergence presented before breaks down. This proof can be rescued by considering approximations $u^\epsilon_0(x)$ to $u_0(x)$ that are smooth and approach $u_0$ as $\epsilon \to 0$. Although convergence can be again be proven for a stable and consistent method, the \emph{rate} of convergence may be considerably less than what is expected from the \glqq order \grqq of the method as defined by its behavior on smooth solutions. Moreover, the numerical solution may look very unsatisfactory on any particular finite grid.
Figures \ref{fig:leveque_11.1} and \ref{fig:leveque_11.2} show numerical solutions to the Riemann problem \eqref{eq:leveque11.1} computed with some of the standard methods discussed in the previous chapter. In all cases
$a = 1, k/h = 0.5$ and the results are plotted at time $t = 0.5$ along with the exact solution.
In Figure \ref{fig:leveque_11.1}, $h = 0.01$ while a finer grid with $h = 0.0025$ is used in Figure \ref{fig:leveque_11.2}. Notice that the first order methods (Lax-Friedrichs and upwind) give very smeared solutions
while the second order methods (Lax-Wendroff and Beam-Warming) give oscillations.
This behavior is typical.
\begin{figure}
\begin{center}
\pgfimage[width=0.8\textwidth]{fig_chapter5/leveque_11.1.png}
\end{center}
\caption{Numerical and exact solution to \eqref{eq:leveque11.1} with $h = 0.01$ and the following
methods: (a) Lax-Friedrichs, (b) Upwind, (c) Lax-Wendroff, (d) Beam-Warming.}
\label{fig:leveque_11.1}
\end{figure}
\begin{figure}
\begin{center}
\pgfimage[width=0.8\textwidth]{fig_chapter5/leveque_11.2.png}
\end{center}
\caption{Numerical and exact solution to \eqref{eq:leveque11.1} with $h = 0.0025$ and the following
methods: (a) Lax-Friedrichs, (b) Upwind, (c) Lax-Wendroff, (d) Beam-Warming.}
\label{fig:leveque_11.2}
\end{figure}
If we compute the 1-norm error in these computed solutions we do not see the expected
rates of convergence. Instead the \glqq first order\grqq methods converge with an error that is
$\mathcal{O}(k^{1/2})$ while the \glqq second order\grqq methods have an error that is $\mathcal{O}(k^{2/3})$ at best. These convergence rates can be proved for very general initial data by a careful analysis using
smooth approximations. An indication of why this should be so will be given later in this
chapter.
\subsection{Modified equation}
useful technique for studying the behavior of solutions to difference equations is to
model the difference equation by a differential equation. Of course the difference equation
was originally derived by approximating a PDE, and so we can view the original PDE
as a model for the difference equation, but there are other differential equations that are
better models. In other words, there are other PDEs that the numerical method solves
more accurately than the original PDE.
At first glance it may seem strange to approximate the difference equation by a PDE.
The difference equation was introduced in the first place because it is easier to solve
than the PDE. This is true if we want to generate numerical approximations, but on
the other hand it is often easier to predict the qualitative behavior of a PDE than of
a system of difference equations. At the moment it is the qualitative behavior of the
numerical methods that we wish to understand.
The derivation of the modified equation is closely related to the calculation of the
local truncation error for a given method. Consider Lax-Friedrichs, for example, where
we calculated the local truncation error $L_k(x, t)$. Since $u(x, t)$ is taken to be
the exact solution to $\partial_t u+ A\partial x u = 0$, we found that $L_k(x, t) = \mathcal{O}(k)$. However, if we instead take $u(x, t)$ to be the solution of the PDE
\begin{align}
\partial_t u + A \partial_x u + \frac{1}{2}\left(k\partial_t^2 -\frac{h^2}{k}\partial_x^2 u \right) = 0
\end{align}
then the truncation error would be $\mathcal{O}(k^3)$. We conclude that the Lax-Friedrichs method
produces a second order accurate approximation to the solution of this PDE. This equation is
called a modified equation for the Lax-Friedrichs method. (The term "model equation"
is also sometimes used.)
\section{Conservative Methods for Nonlinear Problems}
When we attempt to solve nonlinear conservation laws numerically we run into additional
difficulties not seen in the linear equation. Moreover, the nonlinearity makes everything
harder to analyze. In spite of this, a great deal of progress has been made in recent years.
For smooth solutions to nonlinear problems, the numerical method can often be linearized
and results from the theory of linear finite difference methods applied to obtain
convergence results for nonlinear problems. We will not pursue this topic here since we are
primarily interested in discontinuous solutions, for which very reasonable looking finite
difference methods can easily give disasterous results that are obviously (or sometimes,
not so obviously) incorrect.
We have already seen some of the difficulties caused by discontinuous solutions even
in the linear case. For nonlinear problems there are additional difficulties that can arise:
\begin{itemize}
\item The method might be "nonlinearly unstable", i.e., unstable on the nonlinear problem
even though linearized versions appear to be stable. Often oscillations will trigger
nonlinear instabilities.
\item The method might converge to a function that is not a weak solution of our original
equation (or that is the wrong weak solution, i.e., does not satisfy the entropy
condition).
\end{itemize}
The fact that we might converge to the wrong weak solution is not so surprising -
if there is more than one weak solution why should we necessarily converge to the right
one? (We must make sure that the finite difference approximations satisfy some discrete
form of the entropy condition, as we will do later.)
The fact that we might converge to a function that is not a weak solution at all is more
puzzling, but goes back to the fact that it is possible to derive a variety of conservation
laws that are equivalent for smooth solutions but have different weak solutions. For example the PDEs
\begin{align}
\partial_t u + \partial_x (1/2 u^2) &= 0 \label{eq:leveque12.1}
\end{align}
and
\begin{align}
\partial_t (u^2) + \partial_x (2/3 u^3) &= 0 \label{eq:leveque12.2}
\end{align}
have exactly the same smooth solutions, but the Rankine-Hugoniot condition gives different
shock speeds, and hence different weak solutions.
Consider a finite difference method that is consistent with one of these equations,
say \eqref{eq:leveque12.1}, using the same definition of consistency as for linear problems (expand in
Taylor series, etc.). Then the method is also consistent with \eqref{eq:leveque12.2} since the Taylor series
expansion (which assumes smoothness) gives the same result in either case. So the method
is consistent with both \eqref{eq:leveque12.1} and \eqref{eq:leveque12.2} and while we might then expect the method to
converge to a function that is a weak solution of both, that is impossible when the two
weak solutions differ.
Example: If we write the Burgers' equation \eqref{eq:leveque12.1} in the quasilinear form
\begin{align}
\partial_t u + u \partial_x u
\end{align}
then a natural finite difference method, obtained by a minor modification of the upwind method for $\partial_t u + a \partial_x u = 0$ (and assuming $U_j^n \geq 0$ for all $j, n$) is
\begin{align}
U_j^{n+1} = U_j^n - \frac{k}{h}U_j^n(U_j^n - U_{j-1}^n)\label{eq:leveque12.4}
\end{align}
This method adequate for smooth solutions but will not, in general, converge to
a discontinuous weak solution of Burgers' equation \eqref{eq:leveque12.1} as the grid is refined. Consider,
for example, the data from
\begin{align}
U_j^0 = \begin{cases} 1 & j< 0 \\ 0 & j\geq 0\end{cases}
\end{align}
Then it is easy to verify from \eqref{eq:leveque12.4} that $U_j^1 = U_j^0$ for all $j$. This happens in every
successive step as well and so $U_j^n = U_j^0$ for all $j$ and $n$, regardless of the step sizes $k$ and
$h$. As the grid is refined, the numerical solution thus converges very nicely to the function
u(x, t) = uo(x). This is not a weak solution of \eqref{eq:leveque12.1} (or of \eqref{eq:leveque12.2} either).
In this example the solution is obviously wrong, but similar behavior is seen with other
initial data that may give reasonable looking results that are incorrect. Figure \ref{fig:leveque_12.1} shows
the true and computed solutions at time $t = 1$ with Riemann data $u_l = 1.2$ and $u_r = 0.4$.
We get a nice looking solution propagating at entirely the wrong speed.
\begin{figure}
\begin{center}
\pgfimage[width=0.8\textwidth]{fig_chapter5/leveque_12.1.png}
\end{center}
\caption{True and computed solutions to Burgers' equation using a nonconservative
method.}
\label{fig:leveque_12.1}
\end{figure}
\subsection{Conservative Methods}
Luckily, there turns out to be a very simple and natural requirement we can impose on
our numerical methods which will guarantee that we do not converge to non-solutions.
This is the requirement that the method be in conservation form, which means it has
the form
\begin{align}
U_j^{n+1} = U_j^n - \frac{k}{h}\left[F(U_{j-p}^n,U_{j-p+1}^n,\dots, U_{j+q}^n) - F(U_{j-p-1}^n,U_{j-p+1}^n,\dots, U_{j+q-1}^n) \right]
\label{eq:leveque12.6}
\end{align}
for some function $F$ of $p+q+1$ arguments. $F$ is called the numerical flux function. In the simplest case, $p=0$ and $q=1$ so that $F$ is a function of only two variables and \eqref{eq:leveque12.6} becomes
\begin{align}
U_j^{n+1} = U_j^n - \frac{k}{h} \left[ F(U_j^n,U_{j+1}^n) - F(U_{j-1}^n ,U_j^n) \right]
\label{eq:leveque12.7}
\end{align}
This form is very natural if we view $U_j^n$ as an approximation to the cell average $\bar{u}^n_j$. We know that the weak solution $u(x,t)$ satisfies the integral form of the conservation law
\begin{align}
\int_{x_{j-1/2}}^{x_{j+1/2}} \dd x u(x,t^{n+1}) = \int_{x_{j-1/2}}^{x_{j+1/2}} u(x,t^n) -\\
-\left[ \int_{t^n}^{t^{n+1}} \dd t f(u(x_{j+1/2},t) - \int_{t^n}^{t^{n+1}} \dd t f(u(x_{j-1/2},t)\right] \nonumber
\end{align}
Dividing by $h$ and using the averages defined this yields
\begin{align}
\bar{u}_j^{n+1} = \bar{u}_j^n - \frac{1}{h} \left[ \int_{t^n}^{t^{n+1}} \dd t f(u(x_{j+1/2},t) - \int_{t^n}^{t^{n+1}} \dd t f(u(x_{j-1/2},t)\right]
\end{align}
Comparing this to \eqref{eq:leveque12.7} we see that the numerical flux function $F(U_j;U_{j+1})$ plays the role of an average flux through $x_{j+1/2}$ over the time interval $(t^n;t^{n+1})$
\begin{align}
F(U_j,U_{j+1} \approx \frac{1}{k}int_{t^n}^{t^{n+1}} \dd t f(u(x_{j+1/2},t)
\end{align}
One way to derive numerical methods in conservation form is to use standard finite difference discretizations but to start with the conservative form of the PDE rather than the
quasilinear form. For example, if we generalize the upwind method to Burgers' equation, we obtain
\begin{align}
U_j^{n+1} = U_j^n-\frac{k}{h}\left[ \frac{1}{2}(U_j^n)^2 - \frac{1}{2}(U_j^{n-1})^2\right]
\end{align}
This is of the form \eqref{eq:leveque12.7} with
\begin{align}
F(v,w) = \frac{1}{2}v^2
\end{align}
Here we again assume that $U^\prime > 0$ for all $j, n$, so that the ``upwind'' direction is
always to the left. More generally, for a nonlinear system $\partial_t u + \partial_x f(u)= 0$ for which the Jacobian matrix $f^\prime(U_j^n)$ has non-negative eigenvalues for all $U_j^n$, the upwind method is of the form \eqref{eq:leveque12.7} with
\begin{align}
F(v,w) = f(v) \label{eq:leveque12.13}
\end{align}
Of course in general the Jacobian will have eigenvalues of mixed sign and it will not be
possible to use a completely one-sided method. Also note that for the nonlinear problem,
unlike the linear advection equation, the ``upwind'' direction depends on the data $U_j^n$; and
may vary from point to point. Even in the scalar case we need to introduce some way of
switching the directional bias based on the data. We will consider various generalizations
of \eqref{eq:leveque12.13} to handle this situation later. For now we simply note that if $f\prime(U_j^n)$ has only non-positive eigenvalues for all $U_jn$, then the upwind method always uses the point to the right, and the flux becomes
\begin{align}
F(v,w) = f(w) \label{eq:leveque12.13}
\end{align}
\textbf{Lax-Friedrichs}. he generalization of the Lax-Friedrichs method to nonlinear systems takes the form
\begin{align}
U_j^{n+1} = \frac{1}{2} (U_{j-1}^n + U_{j+1}^n) - \frac{k}{2h}(f(U_{j+1}^n) - f(U_{j-1}^n))
\end{align}
This method can be written in the conservation form \eqref{eq:leveque12.7} by taking
\begin{align}
F(U_j,U_{j+1}) = \frac{h}{2k} (U_j - U_{j+1}) + \frac{1}{2}(f(U_j) + +f(U_{j+1}))
\end{align}
\section{Godunov's method}
Recall that one-sided methods cannot be used for systems of equations with eigenvalues
of mixed sign. For a linear system of equations we previously obtained a natural generalization of the upwind method by diagonalizing the system. For nonlinear systems the matrix of eigenvectors is not constant, and this same approach does not work directly. In this chapter we will study a generalization in which the local characteristic structure, now obtained by solving a Riemann problem rather than by diagonalizing the Jacobian matrix, is used to define a natural upwind method. This method was first proposed for gas dynamics calculations by Godunov.
Since solving a Riemann problem is a nontrivial task, we should first justify the need
for upwind methods. An alternative is to use a centered method such as the Lax-Friedrichs
method which allows eigenvalues of either sign. In the scalar case, this turns out
to be stable provided
\begin{align}
\left\vert \frac{k}{h} f^\prime(U_j^n)\right\vert \leq 1
\end{align}
for all $U_j^n$. However, we have seen for the linear advection equation that Lax-
Friedrichs is generally more dissipative than the upwind method, and gives less accurate
solutions. This is not surprising since the theory of characteristics tells us that the solution at $x_j$ depends only on the data to the left of $x_j$ and the upwind method takes advantage of this knowledge. In fact, for the advection equation we know that
\begin{align}
u(x_j,t^{n+1}) = u(x_j- a k, t^n)
\end{align}
and both upwind and Lax-Friedrichs can be viewed as interpolation formulas to approximate $u$ at $x_j - a k$ from the values of $u$ at the grid points. Upwind is better because it
interpolates using values at the two nearest grid points $x_{j-1}$ and $x_j$
\begin{align}
U_j^{n+1} = \frac{1}{h}\left[(h- ak) U_j^n + a k U_{j-1}^n \right]
\end{align}
whereas Lax-Friedrichs interpolates using values a $x_{j-1}$ and $x_{j+1}$
\begin{align}
U_j^{n+1} = \frac{1}{2h}\left[ (h-ak) U_{j+1}^n + (h+ak)U_{j-1}^n \right]
\end{align}
By doing upwind differencing in the appropriate direction for each characteristic component in a system of equations we can hope to obtain a similar improvement and decrease
the numerical dissipation.
Looking ahead, there are other reasons for introducing methods based on the solution
of Riemann problems. Both Lax-Friedrichs and the upwind method are only first order
accurate on smooth data, and even the less dissipative upwind method gives unacceptably
smeared shock profiles. We ultimately want to correct these deficiencies by developing
``high resolution'' methods that are second order accurate in smooth regions and give much
sharper discontinuities. However, our experience with the linear advection equation indicates that natural second order methods, even one-sided methods like
Beam-Warming, give oscillatory solutions. We will be able to cure this only by using more
information about the local behavior of the solution. The first order Godunov method
introduced here forms a basis for many of the high resolution generalizations that will be
studied later.
\subsection{The Courant-Isaacson-Rees method}
Historically, one of the first attempts at upwinding for the equations of gas dynamics
was made by Courant, Isaacson and Rees in 1952. They proposed solving certain
equations along the characteristics going back from the point $(x_j, t^{n+1})$ To evaluate the
characteristic variables at time $t^n$, this method uses interpolation based on the two nearest grid values, which are $(U_{j-1}^n, U_j^n)$ or $(U_j^n, U_{j+1}^n)$ depending on whether the corresponding characteristic speed is positive or negative. Of course the exact path of the characteristic is not known, but is approximated by a straight line with slope $\lambda_p(U_j^n)$. This is schematically illustrated in Figure \ref{fig:leveque_13.1}.
For the scalar advection equation this reduces to the upwind method. For a scalar
nonlinear problem, in which $u$ is constant along characteristics, it reduces to determining
$U_j^{n +1}$ by an approximation to $U$ at the point $x_j - f^\prime(U_j^n )k$ obtained by linear interpolation of the data $U^n$. For example, if $f^\prime(U_j^n) > 0$ then we would interpolate between $U_{j-1}^n$ and $U_j^n$
\begin{align}
U_j^{n+1} &= \frac{1}{h}\left[(h-f^\prime(U_j^n)k) U_j^n + f^\prime(U_j^n) k U_{j-1}^n \right]\\
&= U_j^n -\frac{k}{h} f^\prime(U_j^n)\left[ U_{j-1}^n\right]
\end{align}
\begin{figure}
\begin{center}
\pgfimage[width=.6\textwidth]{fig_chapter5/leveque_13.1.png}
\end{center}
\caption{ In the CIR method, characteristics are traced back from $(x_j, t^{n+1})$ and linear interpolation used at time $t^n$.}
\label{fig:leveque_13.1}
\end{figure}
This is a natural upwind approximation to $\partial_t u +f'(u)\partial_x u = 0$, but this is not a good method for a problem involving shocks, since it is not in conservation form.
\subsection{Godunov's method}
In 1959, Godunov proposed a way to make use of the characteristic information within
the framework of a conservative method. Rather than attempting to follow characteristics backwards in time, Godunov suggested solving Riemann problems forward in time.
Solutions to Riemann problems are relatively easy to compute, give substantial information about the characteristic structure, and lead to conservative methods since they are
themselves exact solutions of the conservation laws and hence conservative.
In Godunov's method, we use the numerical solution $U^n$ to define a piecewise constant
function $\tilde{u}^n(x, t^n)$ with the value $U_j^n$ on the grid cell $x_{j-1/2} < x < x_{j+1/2}$. At time in this agrees with the piecewise constant function $U_k(x, t^n)$ that has already been introduced, but the function $\bar{u}^n$, unlike $U_k$, will not be constant over in $t^n \leq t < t^{n+1}$. Instead, we use $\tilde{u}^n(x,t^n)$ as initial data for the conservation law, which we now solve exactly to obtain $\tilde{u}^n(x, t)$ for $t^n \leq r \leq t^{n+1}$. The equation can be solved exactly over a short time interval
because the initial data $\tilde{u}^n(x, t^n)$ is piecewise constant, and hence defines a sequence of Riemann problems. The exact solution, up to the time when waves from neighboring
Riemann problems begin to interact, is obtained by simply piecing together these Riemann
solutions. This is illustrated in Figure \ref{fig:leveque_13.2}.
\begin{figure}
\begin{center}
\pgfimage[width=.6\textwidth]{fig_chapter5/leveque_13.2.png}
\end{center}
\caption{Solution of independent Riemann problems for the piecewise constant data
$\bar{u}^n(x, t^n)$ in the case $m = 2$.}
\label{fig:leveque_13.2}
\end{figure}
After obtaining this solution over the interval $[t^n,t^{n+1}]$, we define the approximate solution $U^{n+1}$ at time $t^{n+1}$ by averaging the exact solution at time $t^{n+1}$
\begin{align}
U_j^{n+1} = \frac{1}{h} \int_{x_{j-1/2}}^{x_{j+1/2}} \dd x \tilde{u}^n(x,t^{n+1})
\label{eq:leveque13.6}
\end{align}
These values are then used to define new piecewise constant data $\tilde{u}^{n+1}(x,t^{n+1})$ and the process repeats.
In practice this algorithm is considerably simplified by observing that the cell average
\eqref{eq:leveque13.6} can be easily computed using the integral form of the conservation law. Since $\tilde{u}^n$ is assumed to be an exact weak solution, we know that
\begin{align}
\int_{x_{j-1/2}}^{x_{j+1/2}} \dd x \tilde{u}^n(x,t^{n+1}) = \int_{x_{j-1/2}}^{x_{j+1/2}} \dd x \tilde{u}^n(x,t^{n}) + \int_{t^n}^{t^{n+1}} \dd t f(\tilde{u}(x_{j-1/2},t)\\
- \int_{t^n}^{t^{n+1}} \dd t f(\tilde{u}(x_{j+1/2},t)
\end{align}
Dividing by $h$, using \eqref{eq:leveque13.6}, and noting that $\tilde{u}^n(x,t^n) = U_j^n$ over the cell $(x_{j-1/2},x_{j+1/2}$ this equation reduces to
\begin{align}
U_j^{n+1} = U_j^n - \frac{k}{h}\left[ F(U_j^n,U_{j+1}^n) - F(U_{j-1}^n,U_j^n) \right]
\label{eq:leveque13.7}
\end{align}
where the numerical flux function $F$ is given by
\begin{align}
F(U_j^n,U_{j+1}^n) = \frac{1}{k} \int_{t^n}^{t^{n+1}} \dd t f(\tilde{u}^n(x_{j+1/2},t))
\label{eq:leveque13.8}
\end{align}
This shows that Godunov's method can be written in conservation form. Moreover, note
that the integral we need to compute in \eqref{eq:leveque13.8} is trivial because $\tilde{u}^n$ is constant at the point $x_{j+1/2}$ over the time interval $(t^n, t^{n+1})$. This follows from the fact that the solution of the Riemann problem at $x_{j+1/2}$ is a similarity solution, constant along each ray $(x-x_{j+1/2})/t =
constant$.
The constant value of $\tilde{u}^n$ along the line $x=x_{j+1/2}$ depends only on the data $U_j^n$ and $U_j^{n+1}$ for this Riemann problem. If we denote this value by $u^*(U_j^n,U_{j+1}^n)$, the flux \eqref{eq:leveque13.8} reduces to
\begin{align}
F(U_j^n,U_{j+1}^n) = \frac{1}{k} \int_{t^n}^{t^{n+1}} \dd t f(u^*(x_{j+1/2},t)
\label{eq:leveque13.9}
\end{align}
and Godunov's method becomes
\begin{align}
U_j^{n+1} = U_j^n-\frac{k}{h} \left[ f(u^*(U_j^n,U_{j+1}^n) - f(u^*(U_{j-1}^n,U_{j}^n) \right]
\end{align}
Note that the flux \eqref{eq:leveque13.9} is consistent with $f$ since $U_j^n = U_{j+1}^n = \bar{u}$ then $u^*(U_j^n,U_{j+1}^n=\bar u$ as well. Lipschitz continuity follows from smoothness of $f$.
For large $t$, of course, the solution may not remain constant at $x_{j+1/2}$ because of the effect of waves arising from neighboring Riemann problems. However, since the wave speeds are bounded by the eigenvalues of $f^\prime(u)$ and the neighboring Riemann problems are distance $h$ away, $\bar{u}(x_{j+1/2},t)$ will be constant over $[t^n,t^{n+1}]$ provided $k$ is sufficiently small. We require that
\begin{align}
\left\vert \frac{k}{h}\lambda_p(U_j^n) \right\vert \leq 1
\label{eq:leveque13.11}
\end{align}
for all eigenvalues $\lambda_p$ at each $U_j^n$. The maximum of this quantity over the values of $u$ arising in a particular problem is called the \emph{Courant number}, a natural generalization from the linear problem.
Note that \eqref{eq:leveque13.11} allows the interaction of waves from neighboring problems during the time step, provided the interaction is entirely contained within a mesh cell. See Figure \ref{fig:leveque_13.3} for an example. In this case the solution $\tilde{u}^n (x,t)$ would be difficult or impossible to calculate. However, we never explicitly calculate the full solution, since all we require is the cell average \eqref{eq:leveque13.6}. This is still easy to compute because $\tilde{u}$ remains constant on each cell boundary.
\begin{figure}
\begin{center}
\pgfimage[width=.6\textwidth]{fig_chapter5/leveque_13.3.png}
\end{center}
\caption{Exact solution $\tilde{u}^n$ used in determining $U_j^{n+1}$ by Godunov's method. Note that $\tilde{u}^n$ is constant along the line segments $t^n < t < t^{n+1}$ at $x=x_{j-1/2}$ and $x=x_{j+1/2}$}
\label{fig:leveque_13.3}
\end{figure}
\section{Approximate Riemann solvers}
Godunov's method, and higher order variations of the method to be discussed later, require the solution of Riemann problems at every cell boundary in each time step. Although
in theory these Riemann problems can be solved, in practice doing so is expensive, and
typically requires some iteration for nonlinear equations.
Note that most of the structure of the resulting Riemann solver is not used in Godunov's method. The exact solution is averaged over each grid cell, introducing large
numerical errors. This suggests that it is not worthwhile calculating the Riemann solutions exactly and that we may be able to obtain equally good numerical results with an
approximate Riemann solution obtained by some less expensive means.
There are two distinct ways we could think of generalizing Godunov's method. One
is to start with the Codunov flux
\begin{align}
F(u_l,u_r) = f(u^*(u_l,u_r))
\end{align}
where $u^*(u_l,u_r)$ is the intermediate state $w(0)$ arising in the similarity solution $u(x,t)=w(x/t)$ of the Riemann problem, and replace the function $u^*(u_l,u_r)$ by some approximation $\hat{u}(u_l,u_r)$. This leads to the approximate Godunov method
\begin{align}
U_j^{n+1} = U_j^n -\frac{k}{h}\left[ f(\hat{u}^*(U_j^n,U_{j+1}^n) - f(\hat{u}^*(U_j^{n-1},U_{j}^n) \right]
\end{align}
Note that this method will be conservative and consistent for any choice of the function $\hat{u}^*$, provided it satisfies the natural condition that $\hat{u}^*(\bar u, \bar u) = \bar u$ with appropriate Lipschitz continuity.
We might define the function $\hat{u}^*$ by first defining an approximate Riemann solution $\hat{u}^*(x,t) = \hat{w}(x/t)$ and then setting $\hat{u}^*(u_l,u_r) = \hat{w}(0)$.
A second approach to generalizing Godunov's method is to go back to the original
description of the method, where $U_j^{n+1}$ is taken to be the cell average of $\tilde{u}^n (x,t^{n+1})$ and now replace $\tilde{u}^n (x, t)$ by an approximate solution $\hat{u}^n(x, t)$. This can be defined by simply piecing together approximate Riemann solutions at each cell interface, just as $\tilde{u}^n$ was defined for the exact Riemann solutions. This requires that we define an approximate Riemann solution $\hat w (x/t)$ with finite propagation speeds, so that
\begin{align}
\hat{w} (\zeta) = \begin{cases} u_l & \zeta < a_\text{min} \\ u_r & \zeta > a_\text{max} \end{cases}
\end{align}
where $a_\text{min}$ and $a_\text{max}$ are the minimum and maximum propagation speeds (which typically correspond closeloy to the range of Eigenvalues of $f^\prime(u_r)$ and $f^\prime(u_r)$). We need
\begin{align}
\left\vert \frac{a k}{h} \right\vert < \frac{1}{2}
\end{align}
in order for the construction of $\hat{u}^n(x,t)$ described above to work, but once we determine the corresponding flux function this can be relaxed to require only $|ak/h<1|$ as in Godunov's method with the exact Riemann solution.
\subsection{Modified conservation law}
One natural way to $\hat w(x/t)$ is to compute the exact Riemann solution to some modified conservation law $\partial_t \hat u +\partial_x \hat f(\hat u) = 0$, with a flux function $\hat f(u)$ that is presumably easier to work with than the original flux $f(u)$. By using the integral form of this conservation law, we see that
\begin{align}
\hat f(u_r) - \hat f(u_l) = f(u_r) - f(u_l)
\label{eq:leveque14.13}
\end{align}
The resulting numerical flux function is then given by
\begin{align}
F(u_l,u_r) = \hat f(\hat w(0)) + f(u_r) - \hat f(u_r)
\end{align}
\subsection{Roe's approximate Riemann solver}
One of the most popular Riemann solvers currently in use is due to Roe. The idea is
to determine $\hat u(x, t)$ by solving a constant coefficient linear system of conservation laws
instead of the original nonlinear system, i.e., we solve a modified conservation law as
described above with flux $\hat f(u) = \hat Au$. Of course the coefficient matrix used to define this linear system must depend on the $u_l$ and $u_r$, in order for \eqref{eq:leveque14.13} to be satisfied, so we will write the linear system for $\hat u$ as
\begin{align}
\partial_t \hat u + \hat A(u_l,u_r)\partial_x \hat u = 0
\end{align}
This linear Riemann problem is relatively easy to solve. If $\hat A$ has eigenvalues $\hat{\lambda}_i$ and eigenvectors $\hat{r}_i$ and if we decompose
\begin{align}
u_r - u_l = \sum_p \alpha_p \hat{r}_p
\end{align}
then
\begin{align}
\hat w(\zeta) = u_l + \sum_{\hat{\lambda}_p < \zeta} \alpha_p \hat{r}_p
\end{align}
We still have the problem of determining $\hat A(u_l, u_r)$ in a reasonable way. Roe suggested
that the following conditions should be imposed on $\hat A$:
\begin{enumerate}
\item $\hat A(u_l, u_r)(u_r-u_l) = f(u_r) - f(u_l)$
\item $\hat A(u_l, u_r)$ is diagonalizable with real eigenvalues
\item $\hat A(u_l, u_r) \to f^\prime(\hat u)$ smoothly as $u_l,u_r \to u$.
\end{enumerate}
\section{Semi-discrete Methods}
The methods discussed so far have all been fully discrete methods, discretized in both
space and time. At times it is useful to consider the discretization process in two stages,
first discretizing only in space, leaving the problem continuous in time. This leads to
a system of ordinary differential equations in time, called the ``semi-discrete equations''.
We then discretize in time using any standard numerical method for systems of ordinary
differential equations. This approach of reducing a PDE to a system of ODEs, to which
we then apply an ODE solver, is often called the method of lines.
This approach is particularly useful in developing methods with order of accuracy
greater than 2, since it allows us to decouple the issues of spatial and temporal accuracy.
We can define high order approximations to the flux at a cell boundary at one instant
in time using high order interpolation in space, and then achieve high order temporal
accuracy by applying any of the wide variety of high order ODE solvers.
\subsection{Evolution equations for the cell averages}
Let $U_j(t)$ represent a discrete approximation to the cell average of $u$ over the $j$th cell at time $t$, i.e.,
\begin{align}
U_j(t) \approx \bar{u}_j(t) = \frac{1}{h} \int_{x_{j-1/2}}^{x_{j+1/2}} \dd x u(x,t)
\end{align}
We know from the integral form of the conservation law that the cell average $\bar{u}_j (t)$ evolves according to
\begin{align}
\bar{u}^\prime_j(t) = -\frac{1}{h}\left[ f(u(x_{j+1/2},t)) - f(u(x_{j-1/2},t)) \right] = H(u(\cdot,t);j)
\end{align}
We now let $\mathcal{F}(U(t);j)$ represent an approximation to $f(u(x_{j+1/2},t))$, obtained from the discrete data $U(t) = \{U_j(t)\}$. For example, we might solve the Riemann problem with data $U_j(t)$ and $U_{j+1}(t)$ for the intermediate state $u^*(U_j(t),U_{j+1}(t))$ and then set
\begin{align}
\mathcal{F}(U(t);j) = f(u^*(U_j(t),U_{j+1}(t)))
\label{eq:leveque17.3}
\end{align}
Replacing the true fluxes by $\mathcal{F}$ and the cell average $\bar{u}_j(t)$ by $U_j(t)$, we obtain a discrete system of ordinary differential equations for the $U_j(t)$
\begin{align}
U_j^\prime(t) = -\frac{1}{h} \left[ \mathcal{F}(U(t);j) - \mathcal{F}(U(t);j-1) \right] = \mathcal{H}(U(t);j)
\label{eq:leveque17.4}
\end{align}
Note that this is a coupled system of equations since each of the fluxes $\mathcal{F}$ depends on two or more of the $U_j(t)$.
We can now discretize in time. For example, if we discretize \eqref{eq:leveque17.4} using Euler's
method with time step $k$, and let $U_j^n$ now represent our fully-discrete approximation to
$U_j(t^n)$, then we obtain
\begin{align}
U_j^{n+1} &= U_j^n + k \mathcal{H}(U(t);j)\\
&= U_j^n -\frac{k}{h} \left[ \mathcal{F}(U(t);j) - \mathcal{F}(U(t);j-1) \right]
\end{align}
which is in the familiar form of a conservative method. In particular, if $\mathcal{F}$ is given by \eqref{eq:leveque17.3}, then this is simply Godunov's method. More generally, however, $\mathcal{F}(U(t);j)$ represents an approximation to the value of f(u(xj+1/2i1)) at one point in time, whereas the standard numerical flux $F(U; j) $used before has always represented an approximation to the average of $f (u(x_{j+1/2}, t))$ over the time interval $[t^n, t^{n+1}]$. In Codunov's method these are the same, since $u(x_{j+1/2}, t)$ is constant in time in the Riemann solution.
To obtain higher order accuracy, we must make two improvements: the value $\mathcal{F}$ obtained by piecewise constant approximations in \eqref{eq:leveque17.3} must be improved, and the first
order accurate Euler method must be replaced by a higher order time-stepping method.
One advantage of the method of lines approach is that the spatial and temporal accuracy
are decoupled, and can be considered separately. This is particularly useful in several
space dimensions.
One way to obtain greater spatial accuaracy is to use a piecewise linear approximation
in defining F. From the data $\{U_j(t)\}$ we can construct a piecewise linear function $\tilde u(x)$ using slope limiters. Then at the interface $x_{j+1/2}$ we have values on the left and right from the two linear approximations in each of the neighboring cells. Denote these values by
\begin{align}
U_{j+1/2}^L &= U_j + \frac{h}{2} \sigma_j \\
U_{j+1/2}^R &= U_{j+1} - \frac{h}{2} \sigma_{j+1}
\end{align}
A second order accurate approximation to the flux at this cell boundary at time $t$ is then
obtained by solving the Riemann problem with left and right states given by these two
values, and setting
\begin{align}
\mathcal{F}(U;j) = f(u^*(U_{j+1/2}^L,U_{j+1/2}^R))
\end{align}
\subsection{ENO schemes}
Many of the problems addressed in the previous section can be solved with CWENO.
with CWENO (\textbf{C}entral \textbf{w}eighted \textbf{e}ssential \textbf{n}on\textbf{o}sscillatory) schemes, which was first described by Kurganov and Levy
(\cite{kurganov-levy:2000}). The CWENO method is
a solution method for hyperbolic DGLs with third-order accuracy in smooth domains
order accuracy in smooth domains and separate treatment of shocks.
\subsection{Structure of the method}
Starting from a hyperbolic DGL
\begin{align}
\diffp{}{t}u(x,t) + \diffp{}{x}f(u(x,t)) = 0
\end{align}
mean values are defined over the cells and put into a flow representation.
flow representation. From this follows
\begin{align}
\bar u(x,t) &= \frac{1}{\delta x}\int_{x-1/2}^{x+1/2}u(\xi,t)\ d\xi\\
\bar u_{j+1/2}^{n+1} &= \bar u_{j+1/2}^{n} + \int_t^{t+1}\left(f(u_{j+1},\tau)-f(u_{j},\tau)\right)\ d\tau
\end{align}
In the next step, with the help of the cell averages, the function
$u$ polynomially reconstructed in the cells. With the help of the polynomials
can then be used to determine values at arbitrary points in the cell
can be determined. When determining the polynomials, not only the cells themselves are taken into account, but also the respective cells themselves, but also the left and right neighbouring cells.
\begin{align}
P_j(x) = w_L P_L(x) + w_C P_C(x) + w_R P_R(x)
\end{align}
$P_C$ is a quadratic polynomial that obtains the central cell mean value
whereas the other two polynomials are linear and obtain the
left or right mean value.
\begin{align}
P_L(x) &= \bar u_j^n + \frac{\bar u_{j+1}^n-\bar u_j^n}{\delta x}(x_j-x)\\
P_R(x) &= \bar u_j^n + \frac{\bar u_j^n-\bar u_{j-1}^n}{\Delta x}(x_j-x)\
P_C(x) &= \bar u_j^n + \frac{1}{12}(\bar u_{j+1}^n - 2\bar u_j^n +\bar u_{j-1}^n) \nonumber \
& & +\frac{\bar u_{j+1}^n-\bar u_{j-1}^n}{2\Delta x}(x_j-x) + \frac{\bar u_{j+1}^n - 2\bar u_j^n +\bar u_{j-1}^n}{(\Delta x)^2}(x_j-x)^2
\end{align}
The parabola in the centre is clearly chosen so that it satisfies the following
equation
\begin{align}
P_{\textrm{Exact}}(x) = c_R P_R(x) + c_C P_C(x) +c_L P_L(x)
\end{align}
$P_\textrm{Exact}$ is the unique parabola that obtains all three
cell mean values. It is given by
\begin{align}
P_{\textrm{Exact}}(x) = u^n_j+u_j'(x-x_j) +\frac{1}{2}u_j''(x-x_j)^2
\end{align}
The values of the constants $c$ were chosen as $c_L=c_R=1/4$ and $c_C=1/2$
respectively. Kurganov and Levy show that without loss of accuracy
any other symmetrical combination of $c_i$ with $\sum_i c_i=1$
can be chosen. From $c_i$ the weights are later calculated
$w_i$ for the CWENO method.
In the reconstruction it should be noted that this is only valid in the
one-dimensional case. In the multidimensional case, in $P_C$ the
multidimensional Laplace operator must be used in $P_C$.
Many deThe next step in the CWENO procedure is now to determine the
weighting $w_i$ (with $i
\in \{ L,C,R \}$). These are to be chosen in such a way that in smooth
the maximum accuracy is achieved in smooth areas. At shocks, however
the ideal one-sided derivative should be chosen (to avoid oscillations).
oscillations). The weights are defined as follows
\begin{align}
\label{eq:weights}
w_i &= \frac{\alpha_i}{\sum_m \alpha_m}\\
\alpha_i &= \frac{c_i}{(IS_i + \epsilon)^p}
\end{align}
The constant $\epsilon$ prevents the denominator from becoming zero and has the value
has the value $10^{-6}$ (the influence of $\epsilon$ is negligible).
negligible). When choosing $\epsilon$ it must be noted that
the constant is small against values of $IS$. $p$ was chosen by Kurganov
and Levy as $2$, with this parameter one can choose between
high accuracy and good shock resolution. $IS_i$ is an
``smoothness'' indicator that searches for shocks and is defined as follows
defined as follows
\begin{align}
IS_i &= \sum_{l=1}^2\int_{x_j-1/2}^{x_j+1/2}(\delta x)^{2l-1}(P_i^{(l)}(x))^2 dx\\
\Rightarrow IS_L &=& (\bar u_j^n - \bar u_{j-1}^n)^2\\
IS_R &=(\bar u_j^n - \bar u_{j+1}^n)^2\\
IS_C &= \frac{13}{3}(\bar u_{j+1}^n - 2 \bar u_j^n + \bar u_{j-1}^n)^2 + \frac{1}{4}(u_{j+1}^n-u_{j-1}^n)^2
\end{align}
It makes sense to introduce the following abbreviations
\begin{align}
P_j(x) &= A_j + B_j (x-x_j) + \frac{1}{2}C_j(x-x_j)^2\\
A_j &= \bar u_j^n -\frac{w_c}{12}\left(\bar u_{j+1}^n -2 \bar u_j^n+\bar u_{j-1}^n\right)\\
B_j &= \frac{1}{\Delta x}\left(w_r(\bar u_{j+1}^n - \bar u_j^n) + w_c \frac{\bar u_{j+1}^n- \bar u_{j-1}^n}{2} + w_l (\bar u_j^n - \bar u_{j-1}^n)\right)\\
C_j &= 2 w_c \frac{\bar u_{j+1}^n - 2\bar u_j^n + \bar u_{j-1}^n}{(\delta x)^2}
\end{align}
\begin{figure}
\begin{center}
\pgfimage[width=.6\textwidth]{fig_chapter5/cweno4.pdf}
\end{center}
\caption{schematic drawing of the CWENO procedure}
\label{fig:cweno4.pdf}
\end{figure}
Based on these considerations about the reconstruction in the
grid cells, the time step can now be developed. The
basic procedure is shown in fig. \ref{fig:cweno4.pdf}.
At this point a distinction is made between the fully discrete scheme, in which the
time derivative is discretised and the semi-discrete scheme, in which only the
only the spatial derivative is discretised.
In the full-discrete scheme, in each cell, the
propagation velocities of the discontinuities are determined in each cell.
\begin{align}
a_{j+1/2}^n = max\left(\diffp{f}{u}(u_{j+1/2}^-),\diffp{f}{u}(u_{j+1/2}^+)\right)
\end{align}
Accordingly, areas are determined in which the discontinuity is
spreads as well as areas which have a smooth solution. (``$+$'' refers
refers to the right side of the discontinuity, ``$-$'' to the left).
For the exact calculation of $w_j$ I would like to refer here to Kurganov and Levy
and instead refer directly to the semi-discrete scheme, which is actually
which is actually used here.
In the semi-discrete limit case, the time step goes towards zero, which means that the
radii of the discontinuities also converge towards zero.
converge. With this limit, the values of $u$ from the
reconstruction on the left and right sides, so that the flux can also be determined.
flux can be determined.
\begin{align}
u_{j+1/2}^+(t) &= A_{j+1} - \frac{\delta x}{2} B_{j+1} + \frac{(\delta x)^2}{8} C_{j+1} \\
u_{j+1/2}^-(t) &= A_{j} + \frac{\delta x}{2} B_{j} + \frac{(\delta x)^2}{8} C_{j} \\
\Rightarrow \frac{d\bar u_j}{dt} &= -\frac{1}{2\delta x} \left( f(u_{j+1/2}^+(t)) + f(u_{j+1/2}^-(t)) - f(u_{j-1/2}^+(t)) - f(u_{j-1/2}^-(t))\right) \nonumber\\
&+\frac{a_{j+1/2}^+}{2\delta x}\left(u_{j+1/2}^+(t) - u_{j+1/2}^-(t)\right)-\frac{a_{j-1/2}^+}{2\delta x}\left(u_{j-1/2}^+(t) - u_{j-1/2}^-(t)\right)
\end{align}
It is easy to see that the expression formed in this way can be put into flow form.
can be put into flow form.
\subsection{Advantages of the method}
As already described above, the central advantage of the
CWENO method compared to classical difference schemes is that
CWENO does not tend to oscillate at shocks and still has third-order accuracy in smooth areas.
third-order accuracy in smooth areas. As a result, CWENO
also shows less numerical dissipation than other methods that limit at
limit on shocks. Moreover, there is no need for a Riemann solver, which for each
the Jacobi determinant for each point and determines the eigenvectors.
eigenvectors. This makes the method considerably less
more time-consuming than other approaches.
\subsection{The Two-Dimensional CWENO Scheme}
The multi-dimensional CWENO scheme is best illustrated via the example of the two-dimensional scheme. The only step in the scheme sometimes not easily extended to higher dimensions is the reconstruction of point values from the cell averages. This, however, will be the issue of the next section. The two-dimensional scheme will be applied to hyperbolic differential equations of the form:
\begin{align}
\partial_t \vec u + \partial_x f(\vec{u}) + \partial_y g(\vec u) = 0\label{eq:ralph3.2}
\end{align}
This equation is examined on a discrete spatial grid with cells given by:
\begin{align}
\left(x_i -\frac{\Delta x}{2}\dots x_i +\frac{\Delta x}{2} \right) \times \left( y_j -\frac{\Delta y}{2}\dots y_j +\frac{\Delta y}{2} \right)
\end{align}
For these individual cell the scheme will compute the average values of $\vec u$, which will from now on be termed as cell-averages of $\vec u$. Since the scheme has to deal with point values on the cell boundaries, too, these point values are evaluated from the cell averages by the application of a piecewise polynomial reconstruction – that is the spatial variation of $\vec u$ is approximated by a polynomial of the desired order. For the second-order version of the scheme one can, e.g., assume this reconstruction in the cell $C_{i, j}$ at time $t^n$ to be of the form:
\begin{align}
\vec{p}_{i,j}(\vec x, t^n) = \vec{p}_{i,j}^n(x,y) = \vec{u}_{0i,j} + \vec{u}_{xi,j}(x-x_i) + \vec{u}_{yi,j}(y-y_j)
\end{align}
While a cross-term containing both linear parts may also be added, it is not of any importance, because it cancels out due to the evaluation of these polynomials on the middle of the cell faces in the final form of the second order scheme (see below). One has to bear in mind that these polynomials are given for just one cell. Thus, there is an ambiguity at the cell boundaries as to which of these reconstructions is to be used. For this we introduce the notation $p^\pm$, where, e.g., $p^+_{i+1/2,j}$ is the point value at the upper x-boundary
of cell $C_{i, j}$ with the reconstruction stemming from the next cell $C_{i+1, j}$.
From this one obtains the cell-averages via integration as:
\begin{align}
\bar{\vec u}_{i,j} = \frac{1}{\Delta x \Delta y} \int_{y_{j-1/2}}^{y_{j+1/2}}\dd y \int_{x_{i-1/2}}^{x_{i+1/2}}\dd x \vec{p}_{i,j}^n (x,y)
\end{align}
where $x_{i\pm 1/2}$ and $y_{j\pm 1/2}$ signify the cell boundaries in the corresponding directions. For further reference the point values evaluated using such a reconstruction at some specific points are getting labelled:
\begin{align}
\vec{u}_{i,j}:= \vec{p}_{i,j}^n(x_i,y_j), \quad \vec{u}^N_{i,j}:= \vec{p}_{i,j}^n(x_i,y_{j+1/2}), \quad \vec{u}^{NE}_{i,j}:= \vec{p}_{i,j}^n(x_{i+1/2},y_{j+1/2}),\\
\vec{u}^{E}_{i,j}:= \vec{p}_{i,j}^n(x_{i+1/2},y_{j}),\quad \vec{u}^{SE}_{i,j}:= \vec{p}_{i,j}^n(x_{i+1/2},y_{j-1/2}),\quad \vec{u}^{S}_{i,j}:= \vec{p}_{i,j}^n(x_{i},y_{j-1/2}),\\
\vec{u}^{SW}_{i,j}:= \vec{p}_{i,j}^n(x_{i-1/2},y_{j-1/2}),\quad \vec{u}^{W}_{i,j}:= \vec{p}_{i,j}^n(x_{i-1/2},y_{j}),\quad \vec{u}^{NW}_{i,j}:= \vec{p}_{i,j}^n(x_{i-1/2},y_{j+1/2}),
\end{align}
With all this in mind the equations are basically solved by a spatial integration of the system in Eq.\eqref{eq:ralph3.2} over each cell and an integration in time from the actual to the next time step. There is, however, a problem inherent in this integration directly connected to the reconstruction. With every cell having in general an individual reconstruction polynomial there may occur a jump in the different polynomial reconstructions from one cell to another. The integration of Eq. \eqref{eq:ralph3.2} over each cell and over one time
step results in:
\begin{align}
\bar{\vec u}_{i,j}^{n+1} = \bar{\vec u}_{i,j}^{n} -\dd x \int_{t^n}^{t^{n+1}} \dd \tau
\left( f(\vec{u}(x_{i+1/2},y_j,\tau) - f(\vec{u}(x_{i-1/2},y_j,\tau) + g(\vec{u}(x_{i},y_{j+1/2},\tau) - g(\vec{u}(x_{i},y_{j-1/2},\tau) \right)
\end{align}
This equation does not look too bad but due to the discontinuities where the fluxes are to be evaluated, one would have to solve a generalised Riemann problem at these positions to obtain the temporal evolutions of the fluxes, which is a numerically very expensive task.
We can, however, make use of the fact that such a jump can only propagate with a finite velocity
depending on the system of equations to be solved with the scheme. In general this maximum propagation velocity will change with space and time. Therefore, when we would like to integrate the system in Eq. \eqref{eq:ralph3.2}) over one cell and over the time-interval $[t^n, t^{n+1}]$ only the data near the cell boundaries as, e.g., illustrated in Fig. \ref{fig:ralph3.1} might be non-smooth at any time between $t^n$ and $t^{n+1}$. Thus, instead of integrating each entire cell we treat the smooth and non-smooth domains individually. This leads to a scheme, which
does not have to utilise Riemann solvers, while still producing high-order results, since we average the non-smooth parts of the solutions over a domain as small as possible. This has to be seen in contrast to the Nessyahu-Tadmor scheme (Nessyahu and Tadmor 1990) where an integration is performed over a complete staggered cell.
\begin{figure}
\begin{center}
\pgfimage[width=.5\textwidth]{fig_chapter5/ralph3.1}
\end{center}
\caption{The area around the cell $x_i, y_j$ with the non-smooth regions hatched.}
\label{fig:ralph3.1}
\end{figure}
To perform the integration over the smooth and the non-smooth regions separately one needs an
estimate for the form of these areas which also has to be able to reflect the order of the scheme. It will, however, become evident that the transfer into the semidiscrete framework simplifies things again. A semidiscrete scheme is one, which was derived utilising the fact that the time step $\dd t$ is small as compared to any characteristic time scale of the system of hyperbolic equations with regard to a single numerical cell. The use of the semidiscrete limit is motivated by the fact that a fully discrete scheme suffers from higher numerical dissipation. This results from an accumulation of excessive dissipation due to the small time steps needed in a fully discrete scheme. The size of these time steps is mainly determined by the CFL condition first introduced in one of the first papers on finite difference methods for partial differential equations by Courant et al. (1928). This is a necessary condition for the stability of a numerical scheme. It essentially states that a numerical method can only be convergent if its numerical domain of dependence contains the true domain of dependence of the actual partial differential equation. With respect to this condition a fully discrete scheme has to fulfil the restricted condition $\Delta t \propto (\Delta x)^2$ for the time step, whereas for the semidiscrete scheme it is possible to use the convective CFL condition see also Kurganov and Levy (2000). Apart from that we enjoy the fact that a semidiscrete scheme is much
simpler than a fully discrete one.
\begin{figure}
\begin{center}
\pgfimage[width=.5\textwidth]{fig_chapter5/ralph3.2}
\end{center}
\caption{High-order approximation for the non-smooth regions in the individual cells for the CWENO scheme}
\label{fig:ralph3.2}
\end{figure}
An example for a high order estimation for the form of those regions of non-smooth data is illustrated in Fig. \ref{fig:ralph3.2}. In this figure we distinguish three types of regions. First there is the smooth region in the inner part of each cell. Secondly the light gray and the dark grey regions indicate regions possibly holding non-smooth data. The dark grey regions can, however, safely be neglected. This is due to the fact that we are using the semidiscrete form of the scheme, which says that we are solving the system of equations in the limit $\dd t \to 0$.
In the semidiscrete limit the size of the dark-grey regions can be estimated to be:
\begin{align}
D_{i+1/2,j+1/2} = (a^+_{i+1/2,j+1/2}+a^-_{i+1/2,j+1/2}+)(b^+_{i+1/2,j+1/2}+b^-_{i+1/2,j+1/2})\dd t^2+\mathcal{O}(\dd t^3)
\end{align}
where $D_{i+1/2,j+1/2}$ indicates the corresponding region in Fig. \ref{fig:ralph3.2}. Additionally, a± are the right- and left-handed maximum propagation velocities for discontinuities for the upper right corner in the x-direction respectively. In the same way b± corresponds to the signal propagation velocities in the y-direction. Like the equations describing the problem under consideration these velocities have to be specified corresponding to the problem. They are obtained from the Jacobian for each direction. The size of this region is of second order in time and can, therefore, safely be neglected in the semidiscrete limit.
As compared to this the light-grey areas can be estimated to have the size
\begin{align}
D_{i+1/2,j} = (a^+_{i+1/2,j+1/2}+a^-_{i+1/2,j+1/2}+)\dd t (\Delta y -(b^+_{i+1/2,j+1/2}+b^-_{i+1/2,j+1/2})\dd t)+\mathcal{O}(\dd t^3)
\end{align}
which is of the order $\dd t$, thus, showing that the dark-grey areas can indeed be neglected as compared to these. So, it is clear that we only have to discuss the light-grey areas and the undisturbed area in the centre of the cell.
As mentioned above, we have to integrate the system over the individual areas separately in order to avoid Riemann-solvers and to obtain the highest possible order. In turn we have to use some procedure to get from this distributed framework back to the original grid. The overall method can be split in three major steps:
\begin{enumerate}
\item Integration of the system over the light-grey and the undisturbed domains indicated in Fig. \ref{fig:ralph3.2} utilising a local polynomial reconstructions to obtain averages for all domains for the next time step.
\item These averages are then used to obtain a reconstruction of all necessary point values at the next time step.
\item This is then projected to the original grid, thus, finally yielding cell averages at time tn+1.
\end{enumerate}
For step 1 the cell averages over the domains indicated in Fig. \ref{fig:ralph3.2} are designated as:
\begin{align}
\int_{D_{i,j}} \longrightarrow \bar{\omega}_{i,j},\quad \int_{D_{i+1/2,j}} \longrightarrow \bar{\omega}_{i+1/2,j},\quad \int_{D_{i,j+1/2}} \longrightarrow \bar{\omega}_{i,j+1/2}
\end{align}
From these cell averages given at time $t^n$ we compute local averages at time $t^{n+1}$. From these local average $\omega^{n+1}$ we compute local piecewise polynomial reconstructions $\tilde{\omega}^{n+1}$. The global pievewise polynomial reconstruction needed for the second step of the above procedure is the written as
\begin{align}
\tilde{\omega}^{n+1} (x,y) = \sum_{i,j}\left(\omega_{i,j}^{n+1} \chi_{i,j} + \tilde{\omega}^{n+1}_{i+1/2,j}\chi_{i+1/2,j} + \tilde{\omega}_{i,j+1/2}\chi_{i,j+1/2} \right)
\end{align}
Here the $\chi$s are the characteristic functions of the corresponding domains $D$.
The third step consists of the projection of this interpolant onto the original grid according to:
\begin{align}
\bar{\vec u}^{n+1} = \frac{1}{\Delta x \Delta y} \int_{y_{j-1/2}}^{y_{j+1/2}}\dd y \int_{x_{i-1/2}}^{x_{i+1/2}}\dd x \tilde{\omega}^{n+1}(x,y)
\end{align}
With these results we find when neglecting terms of order $\mathcal{O}(\dd t^2)$
\begin{align}
\frac{\dd}{\dd t}\bar{u}_{i,j}(t) &= \lim_{\Delta t \to 0} \frac{\bar{\vec{u}}^{n+1}_{i,j}-\bar{\vec{u}}^{n}_{i,j}}{\Delta t}\\
&= \lim_{\Delta t \to 0} \left( \sum_\pm \frac{|D_{i\pm 1/2,j}\cap C_{i,j}|}{\Delta t \Delta x \Delta y} \bar{\omega}^{n+1}_{i\pm 1/2,j} + \sum_\pm \frac{|D_{i,j\pm 1/2}\cap C_{i,j}|}{\Delta t \Delta x \Delta y} \bar{\omega}^{n+1}_{i,j\pm 1/2} + \frac{|D_{i,j}\cap C_{i,j}|}{ \Delta x \Delta y} \bar{\omega}^{n+1}_{i,j} \right)
\end{align}
The terms on the RHS can be calculated
\begin{align}
\frac{|D_{i\pm 1/2,j}\cap C_{i,j}|}{\Delta t \Delta x \Delta y}
\bar{\omega}^{n+1}_{i\pm 1/2,j} &=
\frac{a_{i\pm 1/2,j}^\pm}{(a_{i\pm 1/2,j}^+ + a_{i\pm 1/2,j}^-)\Delta x}
\left(\left( \pm a_{i\pm 1/2,j}^\pm \vec{u}^{W(E)}_{i+1/2,j} \mp a_{i\pm 1/2,j}^\mp \vec{u}^{E(W)}_{i+1/2,j} \right)\right. \nonumber\\ & - \left.\left(\pm f(\vec{u}_{i\pm 1,j}^{W(E)}) \mp f(\vec{u}_{i,j}^{E(W)}) \right) \right)
\end{align}
\chapter{MHD equations}
\section{MHD Equations and Properties}
\label{sec:1_chp1}
Most of the visible universe is in the plasma state where the kinetic
energy of charged particles is much larger than their potential energy.
Examples in our own solar system are the atmosphere of our sun and
the stream of charged particles from the sun called solar wind which
interacts with unmagnetized and magnetized bodies in the solar system.
In the latter case this creates planetary magnetospheres of which
our own terrestrial magnetosphere is the best studied example. At
large distances from the sun the solar wind interacts with the interstellar
neutral and charged material.
In general, properties and evolution of a plasma involves electromagnetic
interaction and is much more complicated than that of a hydrodynamic
system. Particularly on small spatial scales, aspects of charge neutrality
and gyro motion of charged particles complicate the plasma dynamics.
Fortunately, many systems such as solar magnetic structures and most
planetary magnetospheres are much larger than typical kinetic scales.
For instance, the terrestrial magnetosphere has typical scales of
10s of Earth radii (1$R_{E}\approx$ 6400 km) while ion gyro scales
are a few 100 km and electron scales are much smaller. This argument
does not imply that kinetic physics can be ignored, but rather that
errors due to kinetic physics on the much larger magnetospheric scales
are often small. Therefore, many large scale plasma systems can be
understood in terms of a collective fluid plasma description called
magnetohydrodynamics. The formulation of the magnetohydrodynamic (MHD)
equations by Alfv\'en, Schl\"uter and others enabled the theoretical understanding
of many plasma systems such as magnetospheres, solar atmospheric structures,
and laboratory applications from the 1950s.
Plasma fluid equations can be systematically derived by integrating
the moments of the Boltzmann equation in velocity space which yields
equations for mass, momentum, and energy density in space for electrons
and each ion species. Assuming a single ion species only and charge
neutrality, and defining a total mass density $\rho$ and average
bulk velocity $\mathbf{u}$ through $\rho=n(m_{i}+m_{e})$ and $\rho\mathbf{u}=n(m_{i}\mathbf{u}_{i}+m_{e}\mathbf{u}_{e})$,
where $m_{e}$ and $m_{i}$ are electron and ion mass, $n$ is number
density and $\mathbf{u}_{e}$ and $\mathbf{u}_{i}$ are electron and
ion bulk velocity, the plasma fluid continuity and momentum equations
become
\begin{eqnarray}
\frac{\partial\rho}{\partial t}+\nabla\cdot\rho\mathbf{u} & = & 0\\
\frac{\partial\rho\mathbf{u}}{\partial t}+\nabla\cdot(\rho\mathbf{uu})+\frac{m_{e}m_{i}}{e^{2}}\nabla\cdot(\frac{1}{\rho}\mathbf{jj}) & = & -\nabla p+\mathbf{j}\times\mathbf{B}\\
\mathbf{E}+\mathbf{u}\times\mathbf{B}-\frac{m_{e}m_{i}}{e^{2}\rho}\left[\frac{\partial\mathbf{j}}{\partial t}+\nabla\cdot\left(\mathbf{uj}+\mathbf{ju}\right)\right] & = & -\frac{M}{e\rho}\nabla p_{e}+\frac{m_{i}}{e\rho}\mathbf{j}\times\mathbf{B}+\eta\mathbf{j}
\end{eqnarray}
(e.g. \cite{krall83}). Here $e$ represents the elementary
charge, $\mathbf{j}$ current density, $p$ the sum of electron and
ion pressure, $\mathbf{B}$ the magnetic field, $\mathbf{E}$ the
electric field, $M=m_{e}+m_{i}$, and $\eta$ resistivity. The first
equation represents the continuity equation for mass, the second is
the equation for the bulk momentum, and the third is an equation for
the current density or electron momentum better known as generalized
Ohm's law. Applying scaling laws in equation (3), the term in square
brackets scales with the electron inertial scale $\lambda_{e}^{2}/L_{0}^{2}$
where $\lambda_{e}=c/\omega_{pe}$ represents the electron inertial
scale, $\omega_{pe}$ the electron plasma frequency, and $L_{0}$
a typical scale length of the plasma system under consideration. The
first two terms on the right side of generalized Ohm's law (3) scale
with the ion inertial scale $\lambda_{i}/L_{0}$ with $\lambda_{i}=c/\omega_{pi}$
where the $\mathbf{j\times B}$ term is addressed as the Hall term.
For the solar corona $\lambda_{e}$ is a few cm or less and for the
magnetosphere $\lambda_{e}$ is of the order of several 100 m to a
few km such that for almost all applications the corresponding term
can be ignored in generalized Ohm's law. This is the case also for
the $\mathbf{jj}$ term in the momentum equation which scales with
the electron inertial length and provides the electron contribution
to the bulk momentum equation. Although the ion inertia scale is much
larger than the corresponding electron scale $\lambda_{i}^{2}/\lambda_{e}^{2}=m_{i}/m_{e}$,
it is often still much smaller than typical scales of the system,
particularly for solar applications. Note also that the electron velocity
can be expressed as $\mathbf{u}_{e}=\mathbf{u}-\mathbf{j}/ne$ where
the current density term scales with $\lambda_{i}/L_{0}$ such that
the electron velocity can be significantly different from the ion
of bulk plasma velocity when the ion inertial scale is important (Hall
physics).
Ignoring the electron and ion inertial terms on sufficiently large
scales, equation (3) becomes the well known resistive Ohm's law. The
three equations are complemented by equations for energy density of
electrons and ions and Maxwell's equations for a neutral medium. Strictly
the pressure terms in equations (2) and (3) should be the divergence
of the corresponding pressure tensors. However, to lowest order these
pressure terms just represent the trace of the respective pressure
tensor or thermal energy. With plasma isotropy and neglecting kinetic
and inertial plasma scales the fluid equations are the so-called MHD
equations
\begin{eqnarray}
\frac{\partial\rho}{\partial t}+\nabla\cdot\rho\mathbf{u} & = & 0\\
\frac{\partial\rho\mathbf{u}}{\partial t}+\nabla\cdot(\rho\mathbf{uu}) & = & -\nabla p+\mathbf{j}\times\mathbf{B}\\
\mathbf{E}+\mathbf{u}\times\mathbf{B} & = & \eta\mathbf{j}\\
\frac{1}{\gamma-1}\left(\frac{\partial}{\partial t}p+\nabla\cdot p\mathbf{u}\right) & = & -p\nabla\cdot\mathbf{u}+\eta\mathbf{j}^{2}
\end{eqnarray}
(e.g. \cite{alfven:63,chan61}). Sometimes the last equation
for pressure or thermal energy is replaced by an equation for total
energy density for strict local energy conservation. The assumption
of isotropy strictly requires either a sufficient number of collisions
or an unmagnetized plasma. However, for many macro-scale problems
local mass, momentum, and energy conservation seem more important
on sufficiently large scales than plasma isotropy. The equations are
complemented by Ampere's law and the induction equation
\begin{eqnarray}
\nabla\times\mathbf{B} & = & \mu_{0}\mathbf{j}\\
\nabla\times\mathbf{E}+\frac{\partial\mathbf{B}}{\partial t} & = & 0
\end{eqnarray}
where the displacement current is ignored for non-relativistic applications.
Here $\nabla\cdot\mathbf{B}=0$ is introduced through the initial
conditions and the induction equation insures that it should be satisfied
for all times.
It is worth noting that ideal Ohm's law $\mathbf{E}+\mathbf{u}\times\mathbf{B}=0$
implies the so-called frozen-in condition, i.e., for any closed contour
which moves with the bulk velocity $\mathbf{u}$, the amount of magnetic
flux through this contour does not change with time (e.g., \cite{prie87}).
This condition can also be expressed in a different manner, specifically,
if two fluid elements that move with the velocity $\mathbf{u}$ are
connected through a magnetic field line at one time they are connected
through a field line at all times as illustrated in Fig.~\ref{fig:1_chp1}.
Note that on sufficiently small scales with the Hall term included,
ideal Ohm's law is $\mathbf{E}+\mathbf{u}_{e}\times\mathbf{B}=0$
such that the frozen-in condition applies to the electron fluid velocity
$\mathbf{u}_{e}$ instead of the bulk velocity $\mathbf{u}$.
\begin{figure}[b]
\begin{center}
\includegraphics[scale=0.4]{./fig_chapter6/fig1}
\par\end{center}
\caption{Illustration of magnetic line conservation for
fluid elements $f_{1}$ and $f_{2}$.}
\label{fig:1_chp1} % Give a unique label
\end{figure}
In addition to this concept of magnetic flux conservation there are
a number of basic conserved quantities which are mass, momentum, and
energy conservation. These conservation laws can be expressed in a
straightforward manner where the spatial derivatives are expressed
as gradients or the divergence of tensor quantities.
\begin{eqnarray}
\frac{\partial\rho}{\partial t} & = & -\nabla\cdot\rho\mathbf{u}\\
\frac{\partial\rho\mathbf{u}}{\partial t} & = & -\nabla\cdot\left[\rho\mathbf{uu}+\left(p+\frac{B^{2}}{2\mu_{0}}\right)\underline{\underline{1}}-\frac{1}{\mu_{0}}\mathbf{BB}\right]\\
\frac{\partial w_{tot}}{\partial t} & = & -\nabla\cdot\left[\left(\frac{1}{2}\rho u^{2}+\frac{\gamma p}{\gamma-1}+\frac{1}{\mu_{0}}B^{2}\right)\mathbf{u}-\frac{\mathbf{u}\cdot\mathbf{B}}{\mu_{0}}\mathbf{B}+\frac{\eta}{\mu_{0}}\mathbf{j}\times\mathbf{B}\right]
\end{eqnarray}
with
\[
w_{tot}=\frac{1}{2}\rho u^{2}+\frac{p}{\gamma-1}+\frac{1}{2\mu_{0}}B^{2}
\]
For instance mass for any fixed finite volume $V_{0}$ where with
mass $M=\int_{V_{0}}\rho d^{3}r$ is then expressed as $dM/dt=\ointclockwise^{\delta V}\rho\mathbf{u}\cdot d\sigma$
where $d\sigma$ is a surface element of the boundary $\delta V$
of the volume V. This illustrates that changes in density can occur
only with momentum density flux through the surface of the chosen
volume and require a component of the velocity normal to that surface.
This also implies that mass is conserved in any volume moving with
the fluid. Similar conclusions subject also to the magnetic field
orientation at the boundary can be reached for momentum and energy
conservation.
Note, that the substitution $p=h^{\gamma}$ in the pressure equation
(7) generates a continuity equation which is exactly satisfied for
ideal conditions ($\eta=0$)
\begin{equation}
\frac{\partial h}{\partial t}+\nabla\cdot h\mathbf{u}=\frac{\gamma-1}{\gamma}h^{1-\gamma}\eta\mathbf{j}^{2}
\end{equation}
However, this formulation requires a continuous and differentiable
value of the pressure and is violated for the case of shocks and MHD
discontinuities. It still provides an interesting test as an ideal
conservation law.
Conservation laws and particularly the frozen-in condition for ideal
MHD are of major importance for any plasma simulation. Most space
plasma systems are collisionless such that collisional resistivity
is really 0. However, at very thin boundaries with strong currents,
collective processes can exchange ion and electron momentum yielding
an effective resistivity or some other term in generalized Ohm's law
which violates the frozen-in condition. It should be emphasized that
this violation occurs in a very small and limited volume with extreme
gradients while almost everywhere the frozen-in condition is satisfied.
This is important because, in some way, many space plasma problem
address the transport of magnetic flux or mass, momentum, and energy
across boundaries. This transport requires the local violation of
the frozen-in condition. Therefore, any significant violation due
to numerical errors can easily invalidate the results from numerical
simulations (not only in MHD systems).
\section{CWENO for Numerical MHD}
Even for the two-fluid system using the CWENO scheme we essentially have to solve the hyperbolic part of the equations. The source terms will be taken into account separately. This is sensible insofar as each aspect of the equations is solved with the most appropriate method. Having to solve only the hyperbolic part of the equations with the CWENO solver means that the system of equations is reduced to the MHD equations for the charged particle fluid and to the hydrodynamic equations for the neutral fluid. Here we discuss the explicit implementation of the MHD equations into the CWENO scheme, since the hydrodynamic equations are basically included therein.
As seen in the discussion of the CWENO scheme it does not need as much adaptation as, e.g., a
Riemann solver. For the former it is not necessary to use different solvers for hydrodynamical or MHD simulations. The only inputs that have to be given are the system of equations to be solved and the formula for the derivation of the maximum of the characteristic speeds at the cell boundaries.
It is shown that the characteristic speeds correspond to the
eigenvalues of the Jacobian of the system for the individual directions.
The resulting characteristic speeds are
\begin{align}
\lambda_1 &= u_x\\
\lambda_{2,3} &= u_x \pm v_{Ax}\\
\lambda_{4,5} &= u_x \pm v_{fx}\\
\lambda_{6,7} &= u_x \pm v_{sx}
\end{align}
for the x-direction. Here the following definitions have been used for the normalised system of equations:
\begin{align}
c_s &= \sqrt{\gamma \frac{p}{\rho}} & \text{speed of sound}\\
v_A &= \frac{B}{\sqrt{4\pi\rho}} & \text{Alfv\'en speed}\\
v_{f_x} &= \frac{1}{\sqrt{2}} \sqrt{c_s^2+v_A^2 + \sqrt{}(c_s^2+v_A^2)^2-(2c_s v_{Ax})^2} & \text{fast magnetosonic} \label{eq:ralph3.44}\\
v_{s_x} &= \frac{1}{\sqrt{2}} \sqrt{c_s^2+v_A^2 - \sqrt{}(c_s^2+v_A^2)^2-(2c_s v_{Ax})^2} & \text{slow magnetosonic}
\end{align}
Thus, we can identify four different wave types: $\lambda_{2,3}$ obviously indicates Alfv\'en waves and $\lambda_{4,5}$ and $\lambda_{6,7}$ represent the propagation of the fast and slow magneto-acoustic modes. Finally $\lambda_{1}$ indicates a wave not propagating in space, which is identified in Kalikhman (1967) as an entropy wave. All in all, the Jacobian has distinct eigenvalues, which are always real. Therefore, the system is strictly hyperbolic, which is a
necessary ingredient for the numerical method.
For the CWENO method we do not have to evaluate all of the characteristic speeds. Rather it is
sufficient to find the maximum possible speeds at the boundaries of the cells. For example the velocities $a^\pm$ needed for the scheme are the highest possible speeds to the left and
to the right, respectively.
For the MHD equations clearly $\lambda_{4,5}$ dominate all other possible speeds. Designating $\lambda_{4}$ as the one with the positive sign, this is usually the highest possible speed. Only for a negative flow velocity $u_x$ greater than the fast magnetosonic speed $v_{fx}$ the corresponding speed has to be set to zero. The highest possible speed to the left on the other hand is $\lambda_{5}$. Therefore, the local speeds $a^\pm$ in the x-direction to be used in the CWENO scheme are
\begin{align}
a^+ &= \text{max}(u_x + v_{fx},0)\\
a^- &= \text{max}(u_x - v_{fx},0)
\end{align}
Initially this might seem as if one has to supply as much information on the system as would be necessary for a Riemann solver. Luckily, however, Eq. \eqref{eq:ralph3.44} can also be applied to strictly hydrodynamical simulations, for which the magnetic induction merely has to be set to zero. Moreover, one has to keep in mind that so far no exact Riemann solver for MHD problems is known, whereas the corresponding velocities necessary for the implementation of the CWENO scheme can very well be found. Finally, a Riemann solver would also have to yield the spatial dependence of all the other variables involved, which is not necessary here.
\section{Solenoidality of the Magnetic Field}
There are various strategies available to ensure the absence of magnetic monopoles for numerical computations as required by the corresponding Maxwell equation
\begin{align}
\nabla\cdot\vec B = 0
\end{align}
This equation has to be fulfilled at all times. Analytically this is guaranteed by the normalised evolutionequation for the magnetic induction
\begin{align}
\diffp{\vec B}{t} = \nabla\times(\vec u \times \vec B) = 0
\end{align}
Therefore, analytically the divergence of the magnetic induction evolves according to:
\begin{align}
\diffp{\nabla \cdot \vec B}{t} = \nabla\cdot(\nabla\times(\vec u \times \vec B)) = 0
\end{align}
Thus, an initially solenoidal magnetic induction will analytically be solenoidal for all times. Numerically, unfortunately, things look a little different. In this case we are using the hyperbolic form of the above equation:
\begin{align}
\diffp{\vec B}{t} = -\nabla\times(\vec u \vec B - \vec u \vec B) = -\nabla\cdot\begin{pmatrix} 0 & u_x B_y - u_y B_x & u_x B_z - u_z B_x\\ u_y B_x - u_x B_y & 0 & u_y B_z - u_z B_y \\ u_z B_x - u_x B_z & u_z B_y - u_y B_z & 0\end{pmatrix}
\end{align}
Analytically the two forms are completely equivalent. Unfortunately, however, this is
not the case anymore when using the discrete version of the equation. Additionally the truncation errors introduced by any numerical computation can accumulate during a numerical simulation. All in all it is necessary to find some method to ensure the solenoidality of the magnetic field. Otherwise numerical monopoles are introduced yielding physically wrong results.
To ensure the solenoidality of the magnetic field also for the numerical simulations at hand there are basically three typical methods available. These methods will here be briefly introduced one by one.
\subsection{Lagrangian Multipliers}
The method of Lagrangian multipliers was first implemented by Assous et al. (1993) for the numerical solution of the Maxwell equations. They introduced a Lagrangian multiplier to couple the divergence constraint to the other evolution equations. This idea was extended to the MHD equations by Dedner et al. (2002). They introduced an additional function $\Psi$, which is integrated together with the MHD equations. Generally this variable is introduced to couple the solenoidality constraint to the other equations. This means that the system is extended to the form:
\begin{align}
\diffp{\vec B}{t} &= -\nabla\times(\vec u \vec B - \vec u \vec B) - \nabla \Psi\\
\mathcal{D}(\Psi) &= - \nabla \cdot \vec{B}
\end{align}
with $\mathcal{D}$ some linear differential operator. Of the different possibilities for this operator:
\begin{align}
\mathcal{D}(\Psi) &= \frac{1}{c_h^2}\diffp{\Psi}{t} + \frac{1}{c_p^2}\Psi
\end{align}
could be shown to be the best choice. This results in an evolution equation of the form:
\begin{align}
\partial_t \Psi = -c_h^2 \nabla\cdot\vec B - \frac{c_h^2}{c_p^2}\Psi
\end{align}
This is generally denoted as the mixed generalised Lagrange multiplier (GLM) formulation. The interesting thing about this choice for the operator $\mathcal{D}$ is that it allows for hyperbolic ($c_h$) and parabolic ($c_p$) corrections at the same time. Especially the hyperbolic part is very interesting since it allows the transport of the divergence out of the numerical domain with the velocity $c_h$. Although this method proved to be very efficient for many numerical problems, it is unfortunately not very interesting for our problem. Due to the periodic boundary conditions it is not possible to transport the non-zero divergence out of the
numerical domain. Moreover, the fact that the turbulence is homogeneous means that there is no place in the numerical domain where we can shift the divergence to.
\subsection{Projection Schemes}
An alternative way to get rid of unphysical magnetic monopoles is based on the works by Chorin. In a series of papers he introduced the so-called projection scheme to guarantee the incompressibility of the numerical solution of the Navier-Stokes equation (see Chorin 1967, 1968, 1969). This scheme was first applied to the MHD equations by Brackbill and Barnes (1980). The idea of these schemes is to evolve the MHD equations by some arbitrary numerical scheme and after each time step to project the resulting magnetic induction to a divergence free field. For doing so the magnetic induction is decomposed into the sum of a solenoidal and a divergence containing field:
\begin{align}
\vec B = \nabla \times \vec A + \nabla \Phi
\end{align}
where the scalar field $\Phi$ is responsible for the divergence of the field. Therefore, the field $\vec A$ can be said to be the physically meaningful part of the magnetic induction. Thus, all that has to be done is to subtract this part from the magnetic induction in order to obtain a solenoidal magnetic field. By taking the divergence of the above equation one easily finds an equation determining the scalar field:
\begin{align}
\nabla^2 \Phi = \nabla\cdot\vec B
\end{align}
The essential step, therefore, is to solve this Poisson equation. After this the divergence free magnetic field is easily obtained by:
\begin{align}
\vec B \rightarrow \vec B - \nabla \Phi
\end{align}
The actual solution of the Poisson equation can be obtained by many different methods quite easily. For this work we used a multi-grid solver or a Fourier solver (the latter was used whenever use of the fftw (see Frigo 2004) library was necessary anyhow ) for the solution of this equation. For both solvers we showed the solenoidality of the magnetic field to be assured up to the round off error. For a numerical solver, however, this can only be achieved for one kind of discretisation i.e. we have to decide for one discretisation of the divergence of the magnetic induction – only for this discretisation we will be able to assure the solenoidality. This is also true for any other method to assure the solenoidality of the magnetic field.
\begin{figure}
\begin{center}
\pgfimage[width=.9\textwidth]{fig_chapter6/fig_ralph3.4}
\end{center}
\caption{Visualisation of the accumulation of fluctuation energy at small spatial scales for the projection
schemes (left). These results are compared to those obtained with a constrained transport scheme (right). All
values are normalised.}
\label{fig:ralph3.4}
\end{figure}
Despite the fact that this method yields divergence-free fields to the round off error it proved to be not acceptable for turbulence simulations. This is due to the fact that the method introduces additional small-scale fluctuations, which produce unphysical fluctuation spectra for the highest wavenumbers. There is an unphysical pile up of fluctuation energy at large
wavenumbers for the former solution. This was also observed by Balsara and Kim (2004). They found
that the excessive fluctuation energy at small scales is connected to the decoupling of even and odd grid points which occurs when using a centred finite difference for the representation of the divergence of the magnetic induction. The main problem, however, seems to be connected to spurious magnetic field structures produced by the projection schemes in general, which Balsara and Kim attribute to the non-locality of the projection schemes. This means that the correction does not take local shock structures into account, thus, yielding solutions not being conform to the shock solution anymore. Balsara and Kim identify the constrained transport schemes to be those best suited for turbulence simulations. Therefore, we also rely on such a scheme for our investigations.
\subsection{Constrained Transport Schemes}
The idea with constrained transport schemes is to formulate the equations in a way that the divergence of the magnetic induction vanishes in the desired discretisation. Originally this method was introduced by Evans and Hawley (1988) where the authors introduce a staggered grid for the magnetic induction to maintain the solenoidality of the scheme for finite difference schemes. For this they write the induction equation explicitly via the curl of the electric field:
\begin{align}
\diffp{\vec B}{t} = -\nabla \cdot \vec E
\end{align}
Their main idea is to place – for the 2D case – the electric field at the cell corners.
\begin{figure}
\begin{center}
\pgfimage[width=.9\textwidth]{fig_chapter6/fig_ralph3.5}
\end{center}
\caption{Spatial arrangement of electromagnetic quantities for constrained transport schemes. For further
discussions on the scheme cf. the text.}
\label{fig:ralph3.5}
\end{figure}
This spatial arrangement is also visualised in Fig. \ref{fig:ralph3.5}. T
Therefore, an initially solenoidal magnetic induction will remain so up to the truncation error of the
variables used in the code. This property has been verified using the above scheme. This method can
be easily implemented and very successful for finite difference schemes. When, however, dealing with
fluids for which shocks might occur one has to use a method like CWENO also for the magnetic field
evolution. This problem was solved by Balsara and Spicer (1999), where they combine the constrained
transport idea with a Godunov type base scheme. This is done via the identification of the electrical field
with the numerical fluxes.
\section{Spectral methods}
Fourier transforms can be used to transform differential equations into ordinary equations using the relation
\begin{align}
\widetilde{\partial_x f} = \int \dd x \exp(i k\cdot x) \partial_x f = k f
\end{align}
This allows for a different approach to solving hyperbolic conservation laws. As we will figure out the core problem is that terms of the $(\vec u \nabla) \vec u$ cannot be transformed easily into Fourier space. This leads to the distinction of two different types of spectral methods
\begin{itemize}
\item Spectral methods: Nonlinear terms are evaluated in Fourier space, i.e. everything is performed in Fourier space. This requires a convolution in order to evaluate nonlinearities
\item Pseudospectral methods: Nonlinear terms are evaluated in real space. This requires an inverse Fourier transform of all involved quantities and the Fourier transform of the actual nonlinearity.
\end{itemize}
In both cases a computationally expensive task is involved (Fourier transform or convolution) which makes spectral methods only in special cases relevant. The one case we will discuss here in more detail is the incompressible MHD equations. These can be described by the two conditions
\begin{align}
\nabla\cdot \vec B &= 0\\
\nabla\cdot \vec u &= 0
\end{align}
While the the first condition is an initial condition for the Maxwell equation which will be fulfilled always (except for numerical errors), the second one has to be enforced in every time step. In fact a pressure term will ensure this. Typically in ``normal'' simulations a pressure term will enforce the incompressibility. This leads to a Poisson equation which is as expensive to solve as a Fourier transform.
We will now consider the following set of MHD equations in Fourier space
\begin{align}
\diffp{\vec{\tilde u}}{t} &= \int \text{d}^3 x \text{ } e^{i\vec k \vec x} \left( \vec{b} \cdot \nabla \vec{b} \right) - \int \text{d}^3 x \text{ } e^{i\vec k
\vec x} \left( \vec{u} \cdot \nabla \vec{u} \right) - i\vec k \tilde P - \nu_n \vec k^{2n} \vec{\tilde u}, \\
\diffp{\vec{\tilde b}}{t} &= \int \text{d}^3 x \text{ } e^{i\vec k \vec x} \left( \vec{b} \cdot \nabla \vec{u} \right) -\int \text{d}^3 x \text{ } e^{i\vec k
\vec x} \left(\vec{u} \cdot \nabla \vec{b}\right) - \nu_n \vec k^{2n} \vec{\tilde b}, \\
\vec k \cdot \vec{\tilde u} &= 0, \\
\vec k \cdot \vec{\tilde b} &= 0,
\end{align}
The pressure term can be expressed using the incompressibility condition and the Einstein sum convention
\begin{equation}
-\nabla P = -ik_\gamma\left( \delta_{\alpha \beta} - \frac{k_\alpha k_\beta}{k^2} \right) \left( \widetilde{u_\beta u_\gamma} - \widetilde{b_\beta b_\gamma}
\right) +i k_\beta \left( \widetilde{u_\alpha u_\beta } - \widetilde{b_\alpha b_\beta } \right)
\end{equation}
Using the Kronecker delta this leads to
\begin{align}
-ik_\gamma \delta_{\alpha \beta} \left( \widetilde{u_\beta u_\gamma} - \widetilde{b_\beta b_\gamma} \right) &= -ik_\gamma \left( \widetilde{u_\alpha u_\gamma}
- \widetilde{b_\alpha b_\gamma} \right) \nonumber \\
&= -ik_\beta \left( \widetilde{u_\alpha u_\beta} - \widetilde{b_\alpha b_\beta} \right)
\end{align}
and finally
\begin{equation}
\widetilde{\nabla P} = -i \frac{k_\alpha k_\beta k_\gamma}{k^2} \left( \widetilde{u_\beta u_\gamma} - \widetilde{b_\beta b_\gamma} \right),
\end{equation}
and
\begin{equation}
\tilde P = - \frac{k_\beta k_\gamma}{k^2} \left( \widetilde{u_\beta u_\gamma} - \widetilde{b_\beta b_\gamma} \right)
\end{equation}
This is equivalent to the closure condition in real space
\begin{equation}
\Delta P = \nabla \vec b \otimes \nabla \vec b -\nabla \vec v \otimes \nabla \vec v.
\end{equation}
The other MHD equations in component description are then
\begin{align}
\diffp{\tilde u_\alpha}{t} &= -ik_\gamma\left( \delta_{\alpha \beta} - \frac{k_\alpha k_\beta}{k^2} \right) \left( \widetilde{u_\beta u_\gamma} -
\widetilde{b_\beta b_\gamma} \right) - \nu k^2 \tilde u_\alpha \label{eq:k-raum_mhd-impuls} \\
\diffp{\tilde b_\alpha}{t} &= -ik_\beta \left( \widetilde{u_\beta b_\alpha} - \widetilde{b_\beta u_\alpha} \right)- \nu k^2 \tilde b_\alpha \label{eq:k-raum_mhd
-induktion}\\
k_\alpha \tilde u_\alpha &= 0 \label{eq:k-raum_mhd-inkompressibel}\\
k_\alpha \tilde b_\alpha &= 0, \label{eq:k-raum_mhd-Bmonopol}
\end{align}
Since the incompressible MHD equations describe Alfv\'en waves it is helpful to introduce the Elsasser notation
das Gleichungssystem im Fourierraum. Unter Verwendung der Definitionen \ref{eq:defwpm} erhält man nach einigen
\begin{align}
\left(\partial_t - v_A k_z \right)\tilde w_\alpha^- &= \frac{i}{2} \frac{k_\alpha k_\beta k_\gamma}{k^2} \left(\widetilde{w_\beta^+ w_\gamma^-} +
\widetilde{w_\beta^- w_\gamma^+}\right) -ik_\beta \; \widetilde{w_\alpha^- w_\beta^+} - \frac{\nu}{2} k^{2n} \tilde w_\alpha^- \\
\left(\partial_t + v_A k_z \right)\tilde w_\alpha^+ &= \frac{i}{2} \frac{k_\alpha k_\beta k_\gamma}{k^2} \left(\widetilde{w_\beta^+ w_\gamma^-} +
\widetilde{w_\beta^- w_\gamma^+}\right) -ik_\beta \; \widetilde{w_\alpha^+ w_\beta^-} - \frac{\nu}{2} k^{2n} \tilde w_\alpha^+ \\
k_\alpha \tilde w_\alpha^\pm &= 0
\end{align}
which describe forward and backward moving Alfv\'en waves.
Using this notation now we notice that the over $\beta$ and $\gamma$ are independent from the $\alpha$ summation:
\begin{align}
\left(\partial_t - v_A k_z \right)\tilde w_\alpha^- &= i \frac{k_\alpha k_\beta k_\gamma}{k^2} \; \widetilde{w_\beta^+ w_\gamma^-} -ik_\beta \;
\widetilde{w_\alpha^- w_\beta^+} - \frac{\nu}{2} k^{2h} \tilde w_\alpha^- \label{eq:elsmhdfinal1} \\
\left(\partial_t + v_A k_z \right)\tilde w_\alpha^+ &= i \frac{k_\alpha k_\beta k_\gamma}{k^2} \; \widetilde{w_\beta^+ w_\gamma^-} -ik_\beta \;
\widetilde{w_\alpha^+ w_\beta^-} - \frac{\nu}{2} k^{2h} \tilde w_\alpha^+ \\
k_\alpha \tilde w_\alpha^\pm &= 0 \label{eq:elsmhdfinal3}
\end{align}
\subsection{Aliasing}
\begin{figure}[ht]
\begin{center}
\mbox{
\includegraphics[width=0.9 \textwidth]{fig_chapter6/Aliasing.png}
}
\caption{ Illustration of possible problems in spectral methods. Left: general Moir\'e effect from overlaying slightly differing grid structures. Right: Spatial aliasing effect. }
\label{fig:aliasing}
\end{center}
\end{figure}
It is not generally possible to reproduce an arbitrary function using the Fourier representation. This is due to the discretisation of the signal. One can see the effect as Moir\'e pattern in the wild. The problem is in general known as aliasing effect, which is connected to the Nyquist frequency. Any signal can only be represented by an Fourier transform when its frequency is below the Nyquist frequency which is half of the scanning frequency.
An aliasing problem arises in using the pseudospectral method since the nonlinearity $\vec u \vec u$ will lead to higher ``frequencies'' which may not be represented in the FFT. From a physical viewpoint Alfv\'en waves that are represented by the Fourier modes coalesce to modes with higher wavenumber beyond the Nyquist frequency.
The simplest approach to the solution of the aliasing problem is \emph{Zero-padding}: all wavemodes with $|\vec k| > o\,N$ mit $1/3\leq o \leq 1/2$ are set to zero.
$o=1/3$ is the worst case scenario in which each grid cell osciallates between two values. All wavemodes below the zero-padding are called \emph{active modes} and are free from aliasing effects. For any simulation using spectral methods one can assume for $N_k$ active modes a grid triple that size has to be usede.
\section{Hall MHD}
Hall magnetohydrodynamic (MHD) theory has been used to
describe and understand a variety of interesting space
and laboratory plasma phenomena over the last three decades.
Hall MHD introduces additional physical processes on
scale sizes smaller than the ion inertial length
(but larger than electron scales) such as new wave
modes and instabilities, enhanced magnetic field transport, and
fast magnetic reconnection rates.
The theory has been successfully applied to the
structuring of sub-Alfv\'enic plasma expansions
and to rapid magnetic field
transport in plasma opening switches.
In was suggested that Hall physics plays
a critical role in magnetic reconnection physics and this has spurred
renewed interest in this subject.
Generally speaking, the theory is applicable to phenomena occurring on
length scales shorter than an ion inertial length, and time scales shorter
than an ion cyclotron period.
\subsection{Basic Equations and Wave Modes}
The essence of Hall MHD physics is contained in Ohm's law.\index{Ohm's Law}
The generalized form of Ohm's law can be written as \cite{bittencourt86}
\begin{equation}
\frac{m_e}{ne^2}\frac{\partial {\textbf{J}}}{\partial t} -
\frac{1}{ne}\nabla \cdot \overline{\overline{P}}_e =
{\textbf{ E}} + \frac{1}{c}{\textbf{ V}}_i \times {\textbf{ B}} -
\frac{1}{nec}{\textbf{ J}} \times {\textbf{ B}} -
{\textbf{ J}}/\sigma
\label{eq1a}
\end{equation}
where $\sigma$ is the plasma conductivity. We simplify (\ref{eq1a})
by assuming
$L >> c/\omega_{pe}$, $L >> \rho_e$, and $\sigma \rightarrow \infty$
where $\omega_{pe}$ is the electron plasma frequency,
$\rho_e$ is the electron Larmor radius, and $L$ is the scale length
of the plasma. These assumptions allow us to neglect the electron
inertia and electron pressure terms, and the conductivity term.
We then obtain
\begin{equation}
{\textbf{ E}} = -\frac{1}{c}{\textbf{ V}}_i \times {\textbf{ B}} +
\underbrace{\frac{1}{nec}{\textbf{ J}} \times {\textbf{ B}}}_{Hall\ term} \ .
\label{eq3}
\end{equation}
The final term in (\ref{eq3}) is identified as the Hall term.
Physically, the Hall term decouples ion and electron motion on
ion inertial length scales: $L \lesssim c/\omega _{pi}$ where
$\omega _{pi} = 4\pi n_i e^2/m_i$.
The full set of Hall MHD equations is as follows:
\begin{equation}
\frac{\partial \rho }{\partial t} + \nabla \cdot \rho {\textbf{ V}}=0
\label{continuity}
\end{equation}
\begin{equation}
\frac{\partial \rho {\textbf{ V}}}{\partial t}+\nabla \cdot \left[ \rho {\textbf{
VV}}+(P+B^2/8\pi)\underline{\underline{{\textbf{ I}}}}-{\textbf{ BB}}/4\pi \right] = 0
\label{momentum}
\end{equation}
\[
\frac{\partial \epsilon }{\partial t}+
\nabla \cdot \left[ {\textbf{ V}}(\epsilon +P+B^2/8\pi ) -
{\textbf{ B}}/4\pi ({\textbf{ V}} \cdot {\textbf{ B}})\right] +
\]
\begin{equation}
\nabla \cdot \left[ {\textbf{ V}}_H(B^2/8\pi) -
{\textbf{ B}}/4\pi ({\textbf{ V}}_H \cdot {\textbf{ B}})\right] = 0
\label{energy}
\end{equation}
\begin{equation}
\frac{\partial {\textbf{ B}}}{\partial t}=
-c\nabla \times {\textbf{ E}} =
\nabla \times \left[ ({\textbf{ V}} +
{\textbf{ V}}_H) \times {\textbf{ B}} \right]
\label{faraday}
\end{equation}
where
$\epsilon =\rho V^2/2+P/(\gamma - 1)+B^2/8\pi$,
$P/\rho ^\gamma$ = cnst,
and ${\textbf{ V}}_H = -{\textbf{ J}}/ne$. The plasma pressure is obtained from
\begin{equation}
P = (\gamma - 1)(\epsilon - \rho V^2/2 - B^2/8\pi) \ .
\label{pressure}
\end{equation}
We take $\gamma = 5/3$.
In writing (\ref{continuity}) -- (\ref{faraday})
the subscript $i$ has been dropped for simplicity, and the variable ${\textbf{ V}}_H$
is defined as a `Hall velocity' to explicitly show where the Hall term enters
the equations. Aside from the magnetic field induction equation
(\ref{faraday}), the Hall term only enters the energy equation
(\ref{energy}). Thus, the Hall term is a transport mechanism for the
magnetic field but not for mass or momentum.
We point out that
solving the energy equation to calculate the pressure is problematic
in low $\beta$ plasmas because it involves subtracting two large numbers
(i.e., $\epsilon$ and $B^2/8\pi$). An alternative to
using the energy equation (\ref{energy}) is to use
the adiabatic pressure equation
\begin{equation}
\frac{\partial P }{\partial t} + \nabla \cdot P {\textbf{ V}} =
-(\gamma - 1)P\nabla \cdot {\textbf{ V}} \ .
\label{pressureeq}
\end{equation}
However, a computational problem arises using (\ref{pressureeq}): the
Rankine-Hugoniot jump conditions
across a shock are not correct unless additional modifications
are made (e.g., inclusion of an artificial viscosity); whereas
the jump conditions are automatically satisfied using the total
energy equation.
The Hall term introduces two new wave modes into the plasma system:
whistler waves and Hall drift waves. It is important that these wave modes
be identified and understood in developing a Hall simulation code
because they determine the time step through the Courant condition.
The dispersion relations for these
wave modes are easily derived in the electron magnetohydrodynamic
(EMHD) limit: ${\textbf{ V}} = 0$. In this limit the ions are assumed to
be a stationary, neutralizing background. The EMHD magnetic induction
equation is
\begin{equation}
\frac{\partial {\textbf{ B}}}{\partial t}=
\nabla \times ({\textbf{ V}}_H \times {\textbf{ B}}) =
-\nabla \times
({\textbf{ J}}/ne \times {\textbf{ B}}) \ .
\label{faradayemhd}
\end{equation}
We rewrite (\ref{faradayemhd}) as follows to identify the
origin of each wave mode
\begin{equation}
\frac{\partial {\textbf{ B}}}{\partial t}\ = \
\underbrace
{-\frac{1}{ne}\nabla \times ({\textbf{ J}} \times {\textbf{ B}})}_
{\text{ \Large Whistler\ waves}} \ \
\underbrace
{\ +\ \frac{1}{n^2e}\nabla n \times ({\textbf{ J}} \times {\textbf{ B}})}_
{\text{ \Large Hall\ drift\ waves}} \ .
\label{faradayemhd2}
\end{equation}
The first term on the RHS of (\ref{faradayemhd2}) is responsible
for the whistler wave, while the second term for the Hall drift wave.
It is important to note that Hall drift waves only occur in inhomogeneous
plasmas. We now discuss each wave mode in more detail.
\subsubsection{Whistler Waves}\index{Whistler waves}
We assume the following plasma configuration. The plasma is homogeneous
and the ambient magnetic field is in the $z-$direction: ${\,athbf{ B}} =
B_0 {\mathbf{\hat{e}}}_z$. The magnetic field is perturbed with
$\delta B_x$ and $\delta B_y$ $\propto$ exp($ik_zz-i\omega t$).
The linear dispersion equation is obtained from
\begin{equation}
\frac{\partial \delta{\mathbf{ B}}}{\partial t}\ = \
-\frac{1}{ne}\nabla \times (\delta{\mathbf{ J}} \times {\mathbf{ B}}) \ .
\label{whistler1}
\end{equation}
We linearize (\ref{whistler1}) to obtain
\begin{equation}
\omega \delta{\mathbf{ B}} = \frac{1}{ne}(k_zB\delta J_x\ {\mathbf{ \hat{e}}}_x +
k_zB\delta J_y\ {\mathbf{ \hat{e}}}_y ) \ .
\label{whistler2}
\end{equation}
Making use of Ampere's law (i.e., $\delta {\mathbf{ J}} =
(c/4\pi )\nabla \times \delta {\mathbf{ B}})$ we obtain the coupled equations
\begin{equation}
\omega \delta B_x = -i\frac{ck_z^2B}{4\pi ne}\delta B_y
\label{whistler3}
\end{equation}
\begin{equation}
\omega \delta B_y = i\frac{ck_z^2B}{4\pi ne}\delta B_x \ .
\label{whistler4}
\end{equation}
Finally, solving (\ref{whistler3}) and (\ref{whistler4}) the whistler
wave dispersion relation is obtained
\begin{equation}
\omega = \frac{k_z^2B}{4\pi ne} = k_zV_A\left(\frac{k_zc}
{\omega _{pi}}\right) \ .
\label{whistler5}
\end{equation}
It is evident from the final form of the dispersion relation that
the whistler wave phase velocity exceeds the Alfv\'{e}n velocity
for wavelengths $\lambda _z < c/\omega _{pi}$. This makes it clear
that the Hall term is important for scale sizes less than the
ion inertial length as noted in the Introduction.
\subsubsection{Hall Drift Waves}\index{Hall drift waves}
We assume the following plasma configuration. The plasma density is
inhomogeneous
$n(x)$ and the ambient magnetic field is in the $z-$direction: ${\mathbf{ B}} =
B_0 {\mathbf{ \hat{e}}}_z$. The ambient magnetic field is perturbed with
$\delta B_z$ $\propto$ exp($ik_yy-i\omega t$).
The linear dispersion equation is obtained from
\begin{equation}
\frac{\partial \delta {\mathbf{ B}}}{\partial t}\ =
\frac{1}{n^2e}\nabla n \times (\delta {\mathbf{ J}} \times {\mathbf{ B}}) \ .
\label{kmc1}
\end{equation}
We linearize (\ref{kmc1}) and find that
\begin{equation}
i\omega \delta B_z = \frac{1}{n^2e}\frac{\partial n}
{\partial x}\delta J_xB \ .
\label{kmc2}
\end{equation}
Noting that $\delta J_x = ik_y(c/4\pi )\delta B_z$, the following dispersion
relation is obtained from (\ref{kmc2})
\begin{equation}
\omega = \frac{k_yB}{4\pi ne}\frac{1}{n}\frac{\partial n}{\partial x}
= k_yV_A\left(\frac{c}{L_n\omega _{pi}}\right)
\label{kmc3}
\end{equation}
where $L_n = (\partial ln\, n/\partial x)^{-1}$ is the density gradient
scale length.
Again, it is clear that the Hall term is important when $L_n < c/\omega _{pi}$.
The Hall drift wave described by (\ref{kmc3}) is a magnetic drift wave that
propagates in the ${\mathbf{ B}} \times \nabla n$ direction. A detailed analysis
of this wave mode is presented in Refs. \cite{kingsepetal90} and \cite{huba91}.
In addition to the propagation of a linear wave mode, it has also
been shown that shock-like solutions exist based on a nonlinear
analysis of (\ref{faradayemhd}) \cite{fruchtmanrudakov92,%
fruchtmanrudakov94}. Rudakov and Huba \cite{rudakovhuba02}
found that a rapid, localized thinning of a current
layer supported by a uni-directional magnetic field
leads to the generation of a nonlinear, shock-like structure.
This shock-like wave also propagates in the
${\mathbf{ B}} \times \nabla n$ direction; it is self-supportive and can lead
to a nonlocal thinning of the current layer and the release
of magnetic energy.
\subsection{Numerical Methods}
We describe in some detail the numerical techniques used in the
NRL 3D Hall MHD code VooDoo to solve (\ref{continuity}) --
(\ref{faraday}). The key points we address are
the cell definition, the finite volume method, the time step scheme,
the high order interpolation scheme, the partial donor cell flux limiter,
the distribution function method, the calculation of the
electric field, the Courant condition, and sub-cycling the
Hall term for computational efficiency.
\subsubsection{Cell Definition}
The code uses a Cartesian, staggered mesh, known
as the Yee grid, and is shown in Fig. \ref{3dmhd_cell}.
The hydrodynamic variables
mass density $\rho$, velocity ${\mathbf{ V}}$, and energy density $\epsilon$
are defined at the cell center. The magnetic field ${\mathbf{ B}}$ is defined
normal to the cell faces, and the electric field ${\mathbf{ E}}$ is defined
along the cell edges. The advantage to using this grid is that
$\nabla \cdot {\mathbf{ B}} = 0$ is satisfied to machine error.
\begin{figure}
\begin{center}
\includegraphics[width=3in]{fig_chapter6/3dmhd_cell.pdf}
\caption{Mesh used in the NRL 3D Hall code VooDoo.}
\label{3dmhd_cell}
\end{center}
\end{figure}
\subsubsection{Time Step Scheme}
The code uses a 2nd order Adams-Bashforth time stepping scheme.
The time advancement scheme to update the variable $A$ from
time $t$ to time $t+\Delta t$ is
\begin{equation}
A^{t+\Delta t} = A^t + \Delta t {\cal F}_A^{t+\Delta t/2}
\label{tss1}
\end{equation}
where ${\cal F}_A^{t+\Delta t/2}$ is the total
flux of $A$ through the cell faces at the half time step.
The values of the variables
at the half time step needed to calculate the flux {\cal F} are obtained by a
linear extrapolation from the two previous time steps. Specifically,
the half time step values are given by
\begin{equation}
A^{t+\Delta t/2} = A^t + \frac{\Delta t}{2\Delta t_0}
\left(A^t - A^{t-\Delta t_0}\right)
\label{tss2}
\end{equation}
where the time steps are shown schematically in Fig. \ref{adamsbashforth}.
The code uses
a variable time step so the full time step increments ($\Delta t_0$ and
$\Delta t$) can be different.
\begin{figure}
\begin{center}
\includegraphics[width=3in]{fig_chapter6/adamsbashforth.pdf}
\caption{Schematic of the time step scheme to obtain variables
at the half time step.}
\label{adamsbashforth}
\end{center}
\end{figure}
\subsubsection{Finite Volume Method}\index{Finite volume method}
The finite volume method updates the conserved variables mass,
momentum, and energy by calculating the fluxes of these variables
across the cell faces. This is more clearly understood by considering
an example. The continuity equation is given by
\begin{equation}
\frac{\partial \rho }{\partial t}=-\nabla \cdot \rho {\mathbf{ V}} \ .
\label{fvm1}
\end{equation}
This equation is integrated over a cell volume
\begin{equation}
\int\frac{\partial \rho }{\partial t}\ d^3x
=-\int\nabla \cdot \rho {\mathbf{ V}}\ d^3x
\label{fvm2}
\end{equation}
which can be written as
\begin{equation}
\frac{\partial \rho _T}{\partial t}=-\oint (\rho {\mathbf{ V}})\,%
{\mathbf{ \cdot \,\hat n\,\,}}d^2x
\label{fvm3}
\end{equation}
where $\rho _T=\int \rho \,d^3x$ is the mass in the cell,
${\mathbf{ \hat{n}}}$ is the normal to the cell face, and we have used Gauss'
law. The total mass is then advanced in time from $t$ to $t+\Delta t$ by
\begin{equation}
\rho _T^{t+\Delta t}=\rho _T^t-\Delta t\,\oint
\underbrace{(\rho {\mathbf{ V}})^{t+\Delta t/2}}_{{\text{ flux\ }}{\mathbf{ F}}}
{\mathbf{ \, \cdot \, \hat n\,\,}}d^2x
\label{fvm4}
\end{equation}
where we have explicitly identified the mass flux term. The density
at the updated time step is then $\rho^{t+\Delta t} =
\rho_T^{t+\Delta t}/\int d^3x$.
This same technique is also used to update the momentum and energy.
Thus, the code must calculate the mass, momentum, and energy fluxes
at each cell face.
The general updating scheme for $A$ is
\begin{equation}
A^{t+\Delta t} = A^t - \Delta t\,\int {\mathbf{ F}}_A^{t+\Delta t/2}
\cdot {\mathbf{ n}}\ d^2x
\label{fvm5}
\end{equation}
where ${\mathbf{ F}}_A$ is the flux of $A$.
\subsubsection{Flux Calculation}
The code VooDoo uses a distribution function scheme to calculate the
fluxes of mass, momentum, and energy at cell faces. The details of this
method are described in Ref. \cite{hubalyon99}
\index{Distribution function method} and will not be repeated
here. Rather, we will present an overview of the method, and descriptions
of the high order interpolation scheme and the partial donor cell flux
limiter.
The calculation of the flux at a cell face is as follows; we
use the one dimensional continuity equation as an example. The mass flux
is defined as
\begin{equation}
F = \rho V = \rho \int dv\, v \,f(v)
\label{fc1}
\end{equation}
where $f(v)$ is a distribution function that describes the plasma system
(this will be discussed shortly). We need to calculate this quantity
at a cell face $i+1/2$. The total flux $F$ is decomposed into two parts,
a left flux $F_L$ and a right flux $F_R$, as follows
\begin{equation}
F_{i+1/2} = (\rho V)_{i+1/2} =
(\rho V)_{i+1/2}^L + (\rho V)_{i+1/2}^R
\label{fc2}
\end{equation}
where $F_L = (\rho V)_{i+1/2}^L$ and $F_R = (\rho V)_{i+1/2}^R$
in Fig. \ref{flux1}. The interpretation of the left and right state
fluxes is as follows. The left state flux $F_L$ is the contribution to the
total flux from mass moving from cell $i$ into cell $i+1$; the right
state flux $F_R$ is the contribution from mass moving from cell $i+1$
into cell $i$. Using the distribution function method, these fluxes
are defined as
\begin{equation}
F_L = \rho ^L \int_0^\infty dv\, v \,f^L(v)
\label{fc3}
\end{equation}
and
\begin{equation}
F_R = \rho ^R \int_{-\infty}^0 dv\, v \,f^L(v)
\label{fc4}
\end{equation}
so that the total flux at a cell interface is
\begin{equation}
F = F_R + F_L \ .
\label{fc5}
\end{equation}
In (\ref{fc3}), only particles moving in the positive direction
contribute to the flux $F_L$; hence, the integration limits are
from 0 to $\infty$. Conversely, in (\ref{fc4}), only particles moving
in the negative direction contribute to the flux $F_R$ and therefore the
integration limits are from $-\infty$ to 0. Note that the fluxes
are defined with variables in the left state $L$ and the
right state $R$. The left and right state values are determined
using a high order interpolation scheme and the partial donor cell
method. The high order interpolation scheme defines the values
at the cell face, and the partial donor cell method is then used to
define the left and right states. We now elaborate on these points.
\begin{figure}
\begin{center}
\includegraphics[width=2in]{fig_chapter6/flux1.pdf}
\caption{Flux components $F_L$ and $F_R$ at a cell face $i+1/2$.}
\label{flux1}
\end{center}
\end{figure}
\subsubsection{Distribution Function Method}
The code VooDoo uses a distribution function method to calculate
the fluxes of mass, momentum, and energy at cell interfaces.
The question naturally arises, what is $f(v)$? This method is
described in detail in Ref. \cite{hubalyon99}.
\index{Distribution function method}
We define the following generalized transport equation
\begin{equation}
\frac{\partial \rho \left\langle \chi \right\rangle }{\partial t}+\nabla
\cdot \rho \left\langle \chi {\mathbf{ v}}\right\rangle -\rho \left\langle {\mathbf{ a}}%
\cdot \frac{\partial \chi }{\partial {\mathbf{ v}}}\right\rangle =0
\label{dfm1}
\end{equation}
where
\[
\left\langle {\cal F}\right\rangle =\int d{\mathbf{ v}}\,f({\mathbf{ v}})\,{\cal F}
\]
\[
{\mathbf{ a}} = \frac{\nabla \mathbf M}{8\pi \rho};
\quad
{\mathbf{ M}} = B_x^2\,{\mathbf{ e}}_x + B_y^2\,{\mathbf{ e}}_y + B_z^2\,{\mathbf{ e}}_z \ .
\]
The continuity equation is obtained from (\ref{dfm1}) by setting
$\chi = m$, the momentum equation by setting $\chi = m{\mathbf{ v}}$, and
the energy equation by setting $\chi = mv^2/2$.
The question to be answered is the following. Can we find a distribution
$f({\mathbf{ v}})$ such that, when substituted into the transport
equation (\ref{dfm1}), the 3D MHD equations (\ref{continuity}) -
(\ref{energy}) are recovered?
The following distribution function satisfies this requirement.
\begin{equation}
f=f_1+f_2 \label{dfm2}
\end{equation}
where
\begin{equation}
f_1=\frac{\exp (-u_1^2)}{\left( \pi v_{1x}^2\right) ^{1/2}}\frac{\exp
(-v_1^2)}{\left( \pi v_{1y}^2\right) ^{1/2}}\frac{\exp (-w_1^2)}{\left( \pi
v_{1z}^2\right) ^{1/2}} \label{dfm3}
\end{equation}
\begin{equation}
f_2=-\left( u_2v_2+u_2w_2+v_2w_2\right) \frac{\exp (-u_2^2)}{\left( \pi
v_{2x}^2\right) ^{1/2}}\frac{\exp (-v_2^2)}{\left( \pi v_{2y}^2\right) ^{1/2}%
}\frac{\exp (-w_2^2)}{\left( \pi v_{2z}^2\right) ^{1/2}} \label{dfm4}
\medskip
\end{equation}
\noindent and $u_\alpha=\left( v_x-V_x\right) /v_{\alpha x},
\;v_\alpha =\left( v_y-V_y\right)/v_{\alpha y},
\;w_\alpha=\left( v_z-V_z\right) /v_{\alpha z},
\,v_{1x}^2=2C_s^2/\gamma
+V_{Ay}^2+V_{Az}^2,
\,v_{1y}^2=2C_s^2/\gamma
+V_{Ax}^2+V_{Az}^2,
\,v_{1z}^2=2C_s^2/\gamma
+V_{Ax}^2+V_{Ay}^2,$
\,$v_{2x}^2=4V_{Ax}^2,$
\,$v_{2y}^2=4V_{Ay}^2,$
\,$v_{2z}^2=4V_{Az}^2,$ and
$C_s^2=\gamma P/\rho$.
In (\ref{dfm2}), $f_1$ defines the diagonal terms in the MHD equations
and $f_2$ defines the off-diagonal terms.
The point of this method is that the distribution function $f(v)$
contains the hydrodynamic force (pressure) and all of the
electromagnetic forces except those associated with ${\mathbf{ a}}$.
Thus, by using $f(v)$ to calculate mass, momentum, and energy fluxes,
most of the electromagnetic contribution is calculated directly,
i.e., one does not have to solve the hydrodynamic and magnetic
force components separately or differently.
\subsubsection{Magnetic Field Evolution}
The evolution of the magnetic field is governed by
\begin{equation}
\frac{\partial {\mathbf{ B}}}{\partial t}=
-c\nabla \times {\mathbf{ E}} = -c\nabla \times \left[{\mathbf{ E}}_c
+ {\mathbf{ E}}_H\right]
\label{mfe1}
\end{equation}
where we define ${\mathbf{ E}}_c = -{\mathbf{ V}} \times {\mathbf{ B}}/c$
and ${\mathbf{ E}}_H = -{\mathbf{ V}}_H \times {\mathbf{ B}}/c$
with ${\mathbf{ V}}_H = -{\mathbf{ J}}/ne$. The electric field ${\mathbf{ E}}_c$
is the convective electric field and ${\mathbf{ E}}_H$ is the Hall
electric field. The general technique to solve (\ref{mfe1}) is
as follows.
The normal component of the field is integrated over a cell face
\begin{equation}
\int d{\mathbf A\cdot }\frac{\partial {\mathbf B}}{\partial t}=
-c\int d{\mathbf %
A\cdot \,}\nabla \times {\mathbf E}=-c\int {\mathbf E}\cdot \;d{\mathbf l}
\label{mfe2}
\end{equation}
where $\int d{\mathbf{ l}}$ denotes a line integral around the cell face
(see Fig. \ref{3dmhd_cell}). The advantage of using this technique
to calculate the magnetic field is that is satisfies
$\nabla \cdot {\mathbf{ B}} = 0$ to machine accuracy.
As a specific example, the magnetic flux
in the $x$ direction at a cell interface is evolved using
\begin{equation}
\frac{\partial \Phi _x}{\partial t} = -cE_y\,dy-cE_z\,dz
\label{mfe3}
\end{equation}
where $\Phi _x=B_x\,dydz$. The updated magnetic flux in the $x$
direction is
\begin{equation}
\Phi _x^{t+\Delta t}=\Phi _x^t-c\Delta t\left( E_y\,dy+
E_z\,dz\right) ^{t+\Delta t/2}\ . \label{mfe4}
\end{equation}
The convective and Hall electric fields are structurally very
different and require different numerical techniques. We
describe each field calculation separately.
\paragraph{Convective Electric Field}
The convective electric field in VooDoo is calculated using
the distribution function method. This is most easily seen
by considering a single component of the convective electric field
\begin{equation}
E_{cz} = -\frac{1}{c}(V_xB_y - V_yB_x)
\label{cef1}
\end{equation}
which is written as
\begin{equation}
E_{cz} = -\frac{1}{c}\left(\int f({\mathbf{ v}})v_xB_y\,d^3v -
\int f({\mathbf{ v}})v_yB_x\,d^3v\right) \ .
\label{cef2}
\end{equation}
Thus, the calculation of ${\mathbf{ E}}_c$
is based on the fact that ${\mathbf{ V}} = \int f({\mathbf{ v}}){\mathbf{ v}}\,d^3v$.
We note that the actual implementation of this technique is fairly
complicated; it is described in Ref. \cite{hubalyon99}.
\paragraph{Hall Electric Field}
The Hall electric field is
\begin{equation}
{\mathbf{ E}}_H = -\frac{1}{c}{\mathbf{ V}}_H \times {\mathbf{ B}}
= \frac{1}{nec}{\mathbf{ J}} \times {\mathbf{ B}} \ .
\label{hef1}
\end{equation}
Since the Hall electric field is solely a function of the
magnetic field, the distribution function method cannot be
used to solve for it. We use an upwinding
scheme to solve for the Hall electric field. We will explain
this method by using a simple example.
\begin{figure}
\begin{center}
\includegraphics[width=2.5in]{fig_chapter6/ehall2b.pdf}
\caption{Schematic of the upwinding scheme used to
calculate one component of the Hall electric
field.}
\label{ehall2b}
\end{center}
\end{figure}
We consider a single component of the Hall electric field
\begin{equation}
E_{Hz} = -\frac{1}{c}(V_{Hx}B_y-V_{Hy}B_x)
\label{hef2}
\end{equation}
which we break up into two parts
\begin{equation}
E_{Hz}^{xy} = -V_{Hx}B_y \quad {\text{ and}\quad }
E_{Hz}^{yx} = V_{Hy}B_x \ .
\label{hef3}
\end{equation}
By analogy with the convective electric field, we interpret
$B_y$ being convected at the Hall velocity $V_{Hx}$ and
$B_x$ being convected at the Hall velocity $V_{Hy}$ in
(\ref{hef3}).
We now focus on the component $E_{Hz}^{xy}$ which is shown
in Fig. \ref{ehall2b}. In this figure $E_{Hz}^{xy}$
and $V_{Hx}$ are defined along a cell edge
(as shown in Fig. \ref{3dmhd_cell}) and $V_{Hx} > 0$.
Also shown are the face-centered magnetic field $B_y$
and the left ($B_{yL}$) and right ($B_{yR}$) states of
$B_y$. The left and right states of $B_y$ are determined
using the high order interpolation scheme and partial
donor cell method previously described. The upwinding scheme
to determine $E_{Hz}^{xy}$ is
\begin{equation}
E_{Hz}^{xy} =
\left\{ \begin{array}{ll}
V_{Hx}B_{yL} & \ \text{ for}\ V_{Hx} > 0 \\
V_{Hx}B_{yR} & \ \text{ for}\ V_{Hx} < 0
\end{array}
\right.
\label{hef4}
\end{equation}
The interpretation of (\ref{hef4}) is straightforward. If
$V_{Hx} > 0$, as shown in Fig. \ref{ehall2b}, then the
Hall term is convecting the magnetic field from left to
right and the left state magnetic field is used, i.e.,
the upwinded state. Conversely, if $V_{Hx} < 0$, then the
right state magnetic field is used.
\subsubsection{Courant Condition}
The time step in an explicit code is controlled by a Courant condition
\begin{equation}
\Delta t < \frac{\Delta x}{V_{max}}
\label{cc1}
\end{equation}
where $V_{max}$ is the maximum fluid or wave velocity in the system.
Usually the Courant condition is set by wave speeds. The following
velocities need to be considered in a Hall MHD code:
\begin{itemize}
\item Fluid flow: $V$
\item Magnetosonic wave: $V_m = \sqrt{V_A^2+C_s^2}$
\item Hall velocity: $V_H = -J/ne$
\item Hall drift wave: $V_{hdw} = V_A^2/L_n\Omega _i$
\item Whistler wave: $V_w = kV_A^2/\Omega _i$
\end{itemize}
where $V_A = B/(4\pi n_im_i)^{1/2}$ is the
Alfv\'{e}n velocity, $C_s = (2T/m_i)^{1/2}$
is the sound speed, $L_n = (\partial ln\, n/\partial x)^{-1}$ is
the density gradient scale length, $\Omega _i = eB/m_ic$ is
the ion cyclotron frequency, and $k$ is the wavenumber. We
set $k = 2\pi /\Delta x$ to evaluate $V_w$ numerically.
Thus, we use the following velocity in the Courant condition
\begin{equation}
V_{max} = \text{ max}(V+V_m+V_H+V_{hdw}+V_w) \ .
\label{cc2}
\end{equation}
In general, the Hall drift and whistler wave phase velocities determine
the time step. For phenomena in which only the plasma dynamics
in the plane transverse to the magnetic field is important, the
Hall drift wave controls the time step; examples are plasma opening
switches and sub-Alfv\'{e}nic plasma expansions. On other hand,
for phenomena that require plasma dynamics along the magnetic field,
the whistler wave phase velocity controls
the time step; a prominent example is magnetic field line reconnection.
The whistler wave is particularly troublesome in modeling Hall
MHD processes for two reasons. First, $V_w >> V_A$ so that
the time step is significantly smaller than that used in ideal
MHD simulations. Second, and most important, the whistler phase
velocity is proportional to $k$ (or $1/\Delta x$ numerically) so that
the shortest waves in the system have the highest phase velocity.
This can generate spurious, short wavelength noise in Hall MHD
simulations. This noise can be suppressed by adding an artificial
hyper-resistivity to the magnetic induction equation
or by numerically smoothing the Hall electric field.
The latter is done in VooDoo using a 3-point smoothing algorithm
\cite{birdsalllangdon91}.
In addition, there is also a severe penalty in the time
step when the resolution is increased. The time step is proportional
to $(\Delta x)^2$ so that time step decreases by an additional
factor of 2 when the resolution is doubled.
\chapter{Hybridcodes}
A hybrid code in the context of plasma physics generally refers to a computational model in which some of the plasma species are treated kinetically and others as fluids, while the electric and magnetic fields can be considered as either electrostatic or electromagnetic. Most often in hybrid codes employed in space plasmas all the different ion species are treated kinetically using particle-in-cell methods, the electrons are modeled as a fluid with massless electrons, and Maxwell’s equations are solved in the radiation-free (i.e., no light waves) limit. It is in this more restricted domain that we discuss hybrid codes in this chapter. Even in this limited space, there is still freedom in how to treat the fast phenomena associated with electron dynamics. In space plasmas in particular, hybrid codes occupy a unique niche, intermediate between fluid codes that are most useful for modeling large portions of the solar wind or the interaction of the solar wind with the Earth’s magnetosphere and fully kinetic treatment of all the plasma components, i.e., all ion species and electrons, that are resolved down to the smallest electron scales. Fully kinetic codes are commonly referred to as PIC codes, because traditionally particle-in-cell methods have been used to treat the particle dynamics. Instead, hybrid codes model a portion of the solar wind-magnetosphere boundary or a small region in the solar wind or the magnetosphere on spatial and temporal scales on which ion dynamics dominates. The effects of the larger fluid scales can be modeled through boundary conditions, while the small-scale effects of electrons are added in through models for the electron pressure tensor, and high-frequency (e.g., electron-ion lower-hybrid or higher electron-electron) wave effects are included through a resistivity or other transport coefficients. But as computers have become larger and faster, fully kinetic codes can now model system sizes and time scales that previously were only accessible to hybrid codes, and hybrid codes in turn can now model systems large enough that could once only be studied by fluid models. Thus, as the domains of calculations with different physics models can overlap, having an assortment of hybrid models allows comparisons between hybrid-PIC and fluid-hybrid simulations to be done effectively in order to verify the validity of models, provide additional validation of codes, and give further insight into spacecraft data.
\section{Review of basic model and implementation}
In this section we present a simplified hybrid model with massless electrons, which is still commonly used, that provides a framework for discussion of more complex adaptations later in the chapter. The basic physics model and the associated equations that are solved as a function of space and time are defined as follows. To be consistent with the hybrid model, the ions are treated kinetically using standard particle-in-cell methods. Each simulation ion (with position $\vec{x}_p$, velocity $\vec{v}_p$, charge $q_i$ and mass $m_i$), which represents many actual physical particles, is subject to the usual (non-relativistic) equations of motion in the electric $\vec E$ and magnetic $\vec B$ fields:
\begin{align}
m_i \diff{\vec{v}_p}{t} &= q_i (\vec E + \vec{v}_p\times\vec B)\\
\diff{\vec{x}_p}{t} &= \vec{v}_p
\end{align}
where the fields have values given on a spatial grid, and are interpolated to the location of the simulation particle. The updated particle data for the ion charge density ($q_i n_i$) and current $\vec{J}_i = q_i n_i \vec{V}_i$, are collected on the grid, from which the number density ($n_i$) and flow velocity ($\vec{V}_i$) are determined for use later in calculating the electric field. (For simplicity, we assume a single ion species; for multiple species, one accumulates the data for each species separately and then adds them together to get the total ion charge density and current.)
In the standard hybrid model the electrons are treated as an massless fluid, although ``inertia-less'' is a more accurate description. Thus, the left side of the electron momentum equation is zero, resulting in:
\begin{align}
\diff{}{t} (n_e m_e \vec{V}_e) = 0 = -e n_e(\vec E + \vec{V}_e \times \vec{B})-\nabla \underline{\underline{\mathbf{P}}}_e + e n_e \eta \vec J \label{eq:winske3}
\end{align}
where $\vec{V}_e$ is the electron fluid velocity, $\underline{\underline{\mathbf{P}}}_e$ is the electron pressure tensor, $\vec J$ is the total current and $\eta$ is the resistivity. Even though we assume $m_e$ in Eq. \eqref{eq:winske3}, we still include the electron pressure term on the right hand side. This contributes to the electric field that insures that the plasma remains quasi-neutral, and thus eliminating Debye length effects, i.e.,
\begin{align}
e n_e = q_i n_i
\end{align}
where $e$ is the elementary charge. In Eq. \eqref{eq:winske3}, $\underline{\underline{\mathbf{P}}}_e$ is usually taken to be a scalar $\underline{\underline{\mathbf{P}}}_e = p_e \underline{\underline{\mathbf{1}}}$ but sometimes separate electron pressures along and transverse to the background magnetic field are included. The last term in Eq. \eqref{eq:winske3} is an optional resistive term. Usually $\eta$ is assumed to be a scalar with a constant value. If this term is included, there is a corresponding term in the ion equation motion to balance momentum exchange. This term is usually assumed small and is often used as a numerical means to reduce high-frequency fluctuations in the electromagnetic field, but in certain problems (e.g., magnetic reconnection), it can be physically significant, as a localized model for high frequency waves that initiate reconnection of field lines. We will discuss the pressure model and resistivity later in regard to numerical tests and specific applications.
The electric and magnetic fields in an electromagnetic hybrid model are treated in the low frequency approximation (i.e., Darwin model) that ignores light waves. Thus, we use Ampere’s law,
\begin{equation}
\nabla \times \vec B = \mu_0 \vec J = \mu_0 q_i n_i (\vec {V}_i - \vec {V}_e)
\label{eq:winske5}
\end{equation}
and Faraday's law
\begin{align}
\diffp{\vec B}{t} = -(\nabla \times\vec E) \label{eq:winske6}
\end{align}
Eq. \ref{eq:winske6} is used to advance the magnetic field in time. Eq. \ref{eq:winske5} is used to eliminate the electron flow velocity in Eq. \ref{eq:winske3}, which then reduces to the equation for the electric field $\vec E$. In this low-frequency approximation, the electric field is thus not advanced in time, but instead is determined from the (updated) magnetic field, and ion density and flow velocity. Calculating the electric field at the next time step is the essential problem in all hybrid algorithms and different methods to accomplish this will be discussed throughout this chapter.
The numerical implementation of these equations in a hybrid code begins by choosing a spatial grid. Often, but not always, a rectangular grid is used. One must also decide on the location of fields and particle source terms on the grid. The standard approach is to use a Yee lattice as discussed before. Given the grid, the ion dynamics are done as in usual PIC codes.
The advance in time also follows PIC methodology and proceeds as follows. We start at time step $N$ (denoted by superscript), when the particle positions $\vec{x}_p^N$ and the electric field $\vec{E}^N$ and magnetic field $\vec{B}^N$ are known, while the particle velocities are a half time step behind, $\vec{v}_p^{N-1/2}$. This allows the particle positions and velocities to ``leapfrog'' in time. First, the particle velocities are advanced to the next level $N+1/2$ with time step $\Delta t$ in the equations of motion:
\begin{align}
\vec{v}_p^{N+1/2} = \vec{v}_p^{N-1/2} + \frac{q_i}{m_i}(\vec{E}^N + \vec{v}_p^N\times\vec{B}^N)\Delta t \label{eq:winske7}
\end{align}
And then the particle positions are similarly advanced to time level $N+1$
\begin{align}
\vec{x}_p^{N+1} = \vec{x}_p^B + \vec{v}_p^{N+1/2} \Delta t\label{eq:winske8}
\end{align}
In the process the ion current is collected at time step $N+1/2$ and the density at $N+1$. We also save the old value of the ion density $n_i^N$ for later use. We note that in Eq. \ref{eq:winske7}, $\vec{v}_p^N = 1/2 (\vec{v}_p^{N-1/2}+\vec{v}_p^{N+1/2})$, which can then be solved to get $\vec{v}_p^{N+1/2}$.
Next hte magnetic field $\vec{B}^N$ is advanced to $\vec{B}^{N+1/2}$ using $\vec{E}^N$ and Faraday's law, Eq. \ref{eq:winske6}:
\begin{align}
\vec{B}^{N+1/2} = \vec{B}^N - \frac{\Delta t}{2} (\nabla\times\vec E)
\end{align}
By solving the electron momentum Eq. \eqref{eq:winske3} for the electric field, we can evaluate $\vec{E}^{N+1/2}$:
\begin{align}
\vec{E}^{N+1/2} &= -\vec{V}_i^{N+1/2} \times \vec{B}^{N+1/2} - \frac{\vec{B}^{N+1/2}\times(\nabla\times\vec{B}^{N+1/2})}{\mu_0 q_i n_i^{N+1/2}}\label{eq:winske10}\\
&= \vec{E}^{N+1/2}(\vec{B}^{N+1/2},\vec{V}_i^{N+1/2},n_i^{N+1/2})\nonumber
\end{align}
because we know the ion current $\vec{V}_i^{N+1/2}$ from collecting the new ion particle velocities $\vec{v}_p^{N+1/2}$, the ion density from averaging its old and new values, $n_i^{N+1/2} = 1/2 (n_i^N+n_i^{N+1})$ and $\vec{B}^{N+1/2}$ from Eq. \ref{eq:winske9}. On the far right side of Eq. \eqref{eq:winske10} we have explicitly written out the time levels of the appropriate variables needed to compute $\vec E$, for later reference. We have also assumed an adiabatic form for the scalar electron pressure:
\begin{align}
p_e = n_0 T_{e0}(n_e/n_0)^\gamma
\end{align}
where $T_{e0}(n_0)$ is a reference electron temperature (density), usually with $\gamma=5/3$ (adiabatic9, so that from Eq. \eqref{eq:winske4}, $p_e^N$ involves just knowing $n_i^N$.
Then again, we use Faraday's Law \eqref{eq:winske6}, as in Eq. \eqref{eq:winske9} with $\vec{B}^{N+1/2}$ and $\vec{E}^{N+1/2}$ to advance the magnetic field to $\vec{B}^{N+1}$. However, the advance of $\vec{E}^{N+1/2}$ to $\vec{E}^{N+1}$, shows that while $\vec{B}^{N+1}$ and $n_i^{N+1}$ are known, $\vec{V}_i^{N+1}$ is not.
Various models exist for the advance made here: predictor-corrector methods and Current Advance Method and Cyclic Leapfrog (CAM-CL). We restrict ourselves here to a third, and the simplest, method to advance the electric field its final half time step. In this approach, before we advance the particles to calculate $\vec{v}_p^{N+1/2}$ and thus accumulate the particle information on the grid to determine $\vec{V}_i^{N+1/2}$, we retain $\vec{V}_i^{N-1/2}$ (as well as $q_i n_i N$) and then use a simple linear extrapolation to obtain:
\begin{align}
\vec{V}_i^{N+1} = \frac{3}{2}\vec{V}_i^{N+1/2} - \frac{1}{2}\vec{V}_i^{N-1/2}
\label{eq:winske12}
\end{align}
The $\vec{E}^{N+1}$ can be evaluated using Eq. \eqref{eq:winske10} and the update to time level $N+1$ is completed. Note that in this method, as well as in others discussed later, the determination of the electric field does not require a global elliptic solve, so that hybrid codes that use these methods are readily scalable to run on very large computer architectures.
In the hybrid model the shortest wavelength modes in the system are whistlers, which because of the quadratic dispersion of the wave frequency $\omega$ in terms of the wavenumber $k$, $\omega ~ k^2$ for parallel propagation, can be problematic. The issue can be minimized (without adding resistivity) to some degree by using a smaller time step to just advance the magnetic field from $N$ to $N+1/2$, while retaining a larger time step for the ions. This sub-stepping is done using Faraday's law, Eq. \ref{eq:winske6}, where $\vec{E}$ is expressed in terms of its source terms, Eq. \eqref{eq:winske10}:
\begin{align}
\vec{B}^{N+1/2} = \vec{B}^N - \frac{\Delta t}{2}\nabla \times \vec{E}^N(\vec{B}^N, \vec{V}^N_i, n_i^N)
\label{eq:winske13}
\end{align}
In this case a 4th order Runge-Kutta scheme is used, where on the right-hand side of Eq. \eqref{eq:winske13} we keep $n_i^N$ and $\vec{V}_i^N$ fixed and just advance $\vec{B}$. Specifically, we subcycle $\vec B$ from $N$ to $N+1/2$ in $L$ sub-steps so that $\Delta t^\prime = (\Delta t/2)/L$. At the $l$-th sublevel, $l=1,2,\dots,L$, with $N^\prime = N + l/L$, we advance $\vec B$ to $N^\prime + 1/L$ as follows:
\begin{align}
\vec{B}^{N^\prime + 1/L} = \vec{B}^{N^\prime} + \frac{\Delta t^\prime}{6}\sum_{j=1}^4 f_j \vec{K}_j^{N^\prime}
\end{align}
where
\begin{align}
\vec{K}_j^{N^\prime} = -\nabla \times \vec{E}\left( \vec{B}^{N^\prime} + g_j \Delta t^\prime \vec{K}_{j-1}^{N^\prime},\vec{V}_i^N, n_i^N \right)
\end{align}
and $f_j=(1,2,2,1)$, $g_j = (0,1/1,1/2,1)$ and $\vec{K}_0 = 0$
This completes the discussion of a basic hybrid code algorithm that neglects electron inertia.
\section{Hybrid kinetic simulations with finite electron mass}
Hybrid kinetic simulations describe ion-scale kinetic phenomena in
space plasmas by considering ions kinetically, i.e. as particles, while the
the electrons are modelled as a fluid. Most existing hybrid kinetic codes
neglect the electron mass for a simplified calculation
of the electromagnetic fields. There are situations, however, in which delays due to
the electron inertia matters.
The relative scarcity of binary particle collisions in space and astrophysical plasmas makes many of their plasma processes multi-scale in nature, spanning from the largest, global fluid- to electron kinetic particle scales like magnetic reconnection, shock waves and turbulence.
In order to investigate those usually non-linear and non-local processes by
computer simulations one needs to resolve, in principle, the necessary for the
processes smallest scales and at the same time the large scales of the
system, both in space and time.
While fully kinetic plasma models well describe physical processes down to ion
and electron kinetic scales they are time computationally prohibitively expensive,
too ambitious to describe at the same time larger scale processes even for
future computational facilities.
The physicists way out of this situation is to understand the processes in parts by
modelling and simulating certain of their aspects of physics while neglecting
others. This implies the use of a variety of simulation models. A
comprehensive understanding is then obtained by combining various aspects of
these simulations.
Hybrid-kinetic plasma simulation models completely neglect kinetic effects associated
with the electrons. This further reduces the computational burden.
Such models are, therefore, suitable to study processes for which ion kinetic
effects are important while electron kinetic effects are not.
The majority of existing hybrid-kinetic plasma simulation models simplify their
numerical evaluation by assuming a massless (inertia-less) electron fluid.
This assumption allows a direct calculation of the electric field from the electron's
momentum equation without the need of solving extra differential field
equations.
It limits, however, the validity of the model to describe processes at scales
exceeding by far the electron scales.
Effects of the finite electron mass originate from electron scales.
They nevertheless may play also an important role for larger scale
plasma phenomena. Laboratory experiments of reconnection have revealed, e.g. that the
thickness of current sheets maybe as sthin as several electron inertial
lengths. A the same time the current sheet thickness can be larger than the
electron gyro-radius. This allows a fluid description of the electrons. And hybrid-code simulations with a finite-mass electron fluid have shown that the electron inertia
can dominate when the current sheets thin down to electron inertial
scale lengths.
In hybrid simulations of collisionless plasma turbulence, carried out for
mass-less electrons, current sheets thin down to the grid scale. This is not physical. Hence hybrid-kinetic simulation studies of thinning current sheets must incorporate
electron inertial effects. With inertial electrons hybrid simulations in
collisionless plasma turbulence, indeed, show the formation of electron-scale thin current sheets. The same has been observed by simulations of the steepening of
non-stationary shocks. In case of hybrid simulations with mass-less electrons the shocks thinned down to the grid scale. Inertial electron hybrid code simulations showed that the finite mass of the electrons macroscopic determined the shock reformation In particular, it determined the strong phase-space mixing between the upstream (incoming) and the reflected ions via wave-particle interactions, the ion thermalization and the growth of plasma waves in the foot and ramp
regions of the shock.
Thus the consideration of the finite electron mass, although it is small,
is important to understand a number of critical phenomena in space and
astrophysical plasmas.
\subsection{Equations to be solved}
In hybrid kinetic models, ions are treated as particles and electrons
as a fluid.
The equations of motion of every ion macro-particle
\begin{eqnarray}
\frac{d\vec{x}_p}{dt}&=&\vec{v}_p\label{eq:xp} \\
m_i\frac{d\vec{v}_p}{dt}&=&e(\vec{E}+\vec{v}_p\times \vec{B}) \label{eq:vp}
\end{eqnarray}
where $\vec{x}_p$ and $\vec{v}_p$ are the positions and velocities of ion
macro-particles, respectively, are solved by a PIC algorithm (see Chapter 6).
The full finite-mass-electron fluid momentum equation is given by
\begin{equation}
m_e\left[\frac{\partial \vec{u}_e}{\partial t}+(\vec{u}_e\cdot\nabla)\vec{u}_e\right]
=
% -e(\vec{E}+\vec{u}_e\times \vec{B})-\frac{1}{n_e}\frac{\partial}{\partial x_j}P_{e,ij}\label{eq:emom}
-e(\vec{E}+\vec{u}_e\times \vec{B})-\frac{1}{n_e} \nabla. \underbar{P}_{e}\label{eq:emom}
\end{equation}
where $\vec{u}_e$ and $\underbar{P}_{e}$ are the electron fluid velocity and
the electron pressure tensor, respectively.
The electron density is determined by the quasi-neutrality condition $n_e=n_i=n$.
The electric and magnetic fields are related to the plasma current density via Maxwell's equations:
\begin{eqnarray}
\nabla\times \vec{E}&=&-\frac{\partial \vec{B}}{\partial t}
\label{eq:faraday}\\
\nabla\times \vec{B}&=&\mu_0ne(\vec{u}_i-\vec{u}_e)
\label{eq:ampere}
\end{eqnarray}
Here $\vec{u}_i$ is the ion fluid velocity obtained by the first order velocity moment of the ion distribution
function.
From Eqs. \ref{eq:emom} and \ref{eq:faraday}, we obtain an evolution equation for the
generalized vorticity $\overrightarrow{W}=\nabla\times\vec{u}_e-e\vec{B}/m_e$.
\begin{eqnarray}
\frac{\partial\overrightarrow{W}}{\partial t}
&= &\nabla\times (\vec{u}_e\times \overrightarrow{W})-\nabla\times\left(\frac{\nabla p_e}{m_en_e}\right)\label{eq:curl_emom}\\
p_e&=&n_eT_e\label{eq:eos}
\end{eqnarray}
For simplicity, usually the electron pressure is assumed to be a scalar quantity $p_e$.
For a uniform temperature $T_e$ the last term in Eq.~\ref{eq:curl_emom} vanishes.
Substituting $\vec{u}_e$ in the expression of $\overrightarrow{W}$ from Ampere's law
one obtains an elliptic equations for the magnetic field,
\begin{eqnarray}
\frac{1}{\mu_0e}\nabla\times\left(\frac{\nabla\times\vec{B}}{n}\right)+\frac{e\vec{B}}{m_e}&=&\nabla\times\vec{u}_i-\overrightarrow{W}\label{eq:elliptic_b}
\end{eqnarray}
Eqs.~\ref{eq:xp}--\ref{eq:elliptic_b} represent a complete hybrid-PIC plasma model
without any approximation on the electron inertial terms in the electron momentum
equation.
Note that ina conventional hybrid codes, which neglect the electron inertia,
the terms on the left hand side (LHS) of Eq. \ref{eq:emom} are neglected
allowing a direct calculation of $\vec{E}$ from this equation.
As a result the $\nabla \times \vec{u}_e$ term in the expression of $\overrightarrow{W}$
disappears and Eq. (\ref{eq:curl_emom}) becomes an evolution equation
for the magnetic field, i.e. Eq. (\ref{eq:elliptic_b}) does not have to be solved at all.
In conventional hybrid codes with electron inertia, the electric and magnetic fields
are obtained from Eqs.~\ref{eq:emom} and \ref{eq:curl_emom} by usually
neglecting some of the terms.
Substituting for $\vec{u}_e$ from Eq.~\ref{eq:ampere} and neglecting terms proportional to $\partial \vec{u}_i/\partial t$ and $\partial n/\partial t$, the LHS of Eq.~\ref{eq:curl_emom} can be written entirely in terms of the time derivative of the magnetic field. The neglect of $\partial \vec{u}_i/\partial t$ and $\partial n/\partial t$ in Eq.~\ref{eq:curl_emom} is justified for a large mass ratio $m_i/m_e$. However these approximations are not necessarily valid in all situations of interest and need to be separately justified, especially for artificially small mass ratios $m_i/m_e$.
Neglecting electron scale variation of the density, the LHS of that equation can further simplified
to $\partial/\partial t[e(\vec{B}-d_e^2\nabla^2\vec{B})/m_e]$, where $d_e=c/\omega_{pe}$ is the electron inertial length. The electric field is calculated directly from Eq.~\ref{eq:emom} by neglecting $\partial\vec{u}_e/\partial t$, which is clearly inconsistent with keeping this term in Eq.~\ref{eq:curl_emom}.
In a non-restricted approach, the electric field is calculated from Eq.~\ref{eq:emom}
by explicitly evaluating the time derivative term $\partial\vec{u}_e/\partial t$~\cite{Munoz2018}.
For this purpose Ref.~\cite{Munoz2018} used the heaviness of the ions to assume that
the ions quantities do not change much during a single time step $\sim$. i.e. during a
fraction of the electron gyro-period. Thus for a single time step ($dt$) $\vec{u}_e$ at $t=t_0+dt$ and $t=t_0+2\,dt$ can then obtained by advancing Eq.~\ref{eq:curl_emom}, first from $t=t_0$ to $t=t_0+dt$ and then from $t=t_0+dt$ to $t=t_0+2\,dt$. This allows the calculation of $\partial\vec{u}_e/\partial t$ by a central difference scheme. In the second of the two time steps, the ion current and density from the previous time step can be used. Alternatively the electric field can be calculated by solving an elliptical PDE which one obtains by taking the curl of the Faraday's law (Eq.~\ref{eq:faraday}) using Amp\`ere's law (Eq.~\ref{eq:ampere}) and substituting for $\partial\vec{J}/\partial t$ from the generalized Ohm's law. The numerical solution of the resulting elliptical PDE in more than one dimension, however, is much more involved than that of the elliptic PDE for the magnetic field (Eq.~\ref{eq:elliptic_b}). The difficulty arises from the fact that one cannot use a Poisson equation to substitute for $\nabla\cdot\vec{E}$, which reveals cross-derivative terms in the equation. In case of Eq.~\ref{eq:elliptic_b}, the condition $\nabla\cdot\vec{B}=0$ simplifies the calculations.
\subsection{Numerical implementation}
For definiteness we illustrate, how a hybrid kinetic simulation model
with a finite-mass electron fluid without additional approximations
(see Sec.~\ref{sec:model}) works we describe its numerical implementation
by a code called CHIEF (Code Hybrid with Inertial Electron Fluid).
CHIEF combines elements of the PIC code ACRONYM
to describe the ions as particles with an EMHD code which solves the electromagnetic equations coupled with an inertial electron fluid. Both codes have separately been tested and independently used to simulate different aspects of magnetic reconnection, of plasma instabilities, of particle acceleration, shocks, wave coupling, resonant wave-particle interactions etc.These simulations have helped to to clean up both codes off numerical
errors.
\subsubsection{Ions as particles}
In the ion-related (PIC-)part of the code the macro-particle positions and
velocities at the $N$th time step are advanced for the electric and magnetic
field values defined on a staggered, the Yee-lattice grid~\cite{Yee1966}
being known at the time step $N$.
For this the fields are first interpolated from the grid to
the (macro-) ions positions with a weighting given by a
shape function $S(\vec{x}-\vec{x}^{\;p})$:
\begin{eqnarray}\label{eq:interpolation_em}
\vec{E}^{\;p}& = &\vec{E}(\vec{x}^{\;p})=\int \vec{E}(\vec{x})\,S(\vec{x}-\vec{x}^{\;p})\,d\vec{x}, \\
\vec{B}^{\;p} &= &\vec{E}(\vec{x}^{\;p}) = \int \vec{B}(\vec{x})\,S(\vec{x}-\vec{x}^{\;p})\,d\vec{x}, \label{eq:interpolation_em2}
\end{eqnarray}
where the super-script $p$ indicates the location of each (macro-)particle.
Then, the ions are moved by a second-order accurate leap-frog algorithm.
This means that at each time step $N$ the ion velocities are advanced from
the half-time step $N-1/2$ to the half-time step $N+1/2$ and the ion
positions from time step $N$ to time step $N+1$ by using the
discretized version of Eqs.~\ref{eq:xp}
and~\ref{eq:vp} (see, e.g., Sec.~4.3 of Ref.~\cite{Birdsall1991}):
\begin{eqnarray}
\label{eq:xp_num} \vec{x}^{p,N+1} & = &\vec{x}^{p,N} + \vec{v}^{p,N+1/2}\Delta t , \\
\label{eq:vp_num} \vec{v}^{p,N+1/2} & = &\vec{v}^{p,N-1/2} + \frac{e\Delta t}{m_i}\left( \vec{E}^{p,N}+\frac{\vec{v}^{p,N+1/2}+\vec{v}^{p,N-1/2}}{2}\times \vec{B}^{p,N}\right)
\end{eqnarray}
Note that the first equation is explicit for $\vec{x}^{p,N+1}$ while the
second is implicit for $\vec{v}^{p,N+1/2} $. If one advances the ion velocity
via a Boris method~\cite{Boris1970}, i.e. a rotation of $\vec{v}_i^{\;N+1/2}$
(i.e., the magnitude of the vector stays constant) Eq.~\ref{eq:vp_num}
also becomes explicit.
Because of the staggered position- and velocity updates the sources of the
electromagnetic field, the ion number density $n_i$
and ion current density $\vec{\jmath}_i$, are computed at
time steps indexed $N+1$ and $N+1/2$, respectively.
The deposition of both ion and current density onto the grid is done via an interpolation scheme using the same shape function as for the electromagnetic field interpolation from the grid to the macro-particles position (Eqs.~\ref{eq:interpolation_em}-\ref{eq:interpolation_em2}):
\begin{eqnarray}\label{eq:interpolation_n_j}
n_i^{N+1}(\vec{x}) & = &\sum_p N_p\,S(\vec{x}-\vec{x}^{\;p,N+1}) , \\
\vec{\jmath}_i^{\;N+1/2}(\vec{x}) & =& \sum_p N_p\,\vec{v}^{\;p,N+1/2} S(\vec{x}-\vec{x}^{\;p,N+1}).\label{eq:interpolation_n_j2}
\end{eqnarray}
The use of the same shape function in Eqs.~\ref{eq:interpolation_em} and \ref{eq:interpolation_n_j}
avoids self-forces and preserves the global momentum.
\subsubsection{Electron fluid}
The electron density $n_e^{N+1/2}$ is set equal to the ion density $n_i^{N+1/2}$,
i.e. $n_e^{N+1/2}$ is obtained by applying the quasi-neutrality condition. If a
constant (not evolving in time electron) temperature $T_e$ is assumed the electron
pressure $p_e^{N+1/2}=n_e^{N+1/2}k_BT_e$ can be calculated via the equation of
state, Eq.~\ref{eq:eos}.
\subsubsection{Electromagnetic fields}
Once the sources of the electromagnetic fields (Eqs.~\ref{eq:interpolation_n_j}-\ref{eq:interpolation_n_j2})
are known on the Yee lattice, the electromagnetic fields are updated by using the electron fluid
equations and Maxwell's equations.
The electric and magnetic fields are updated by advancing the generalized vorticity
$\overrightarrow{W}$ in Eq.~\ref{eq:curl_emom} from time step $N$ to step $N+1$
using a flux-corrected transport algorithm LCPFCT package of the
U.S. Naval Research Laboratory~\footnote{\texttt{\url{http://www.nrl.navy.mil/lcp/LCPFCT}}}.
This algorithm is advantegeous by conveniently resolving
steep gradients.
The full update to the next time step ($\overrightarrow{W}^{N+1}$) requires $\overrightarrow{W}^{N+1/2}$ and $\vec{u}_e^{N+1/2}$, which are not known yet.
Because of this, the field solver has first to advance the generalized
vorticity $\vec{W}^N$ by half a time step (with the input quantities $n_e^{N+1/2}$, $p_e^{N+1/2}$, $\vec{u}_e^{N}$, $\vec{W}^N$, $\vec{B}^N$) in order to estimate $\vec{u}_e^{N+1/2}$, $\vec{W}^{N+1/2}$, and $\vec{B}^{N+1/2}$, by solving the discretized version of Eq.~\ref{eq:curl_emom}:
\begin{eqnarray}\label{eq:curl_emom_discrete}
\left.\frac{\partial \overrightarrow{W}}{\partial t}\right|_{N\to N+1/2}
& = \vec{\nabla}\times\left [\vec{u}_e^N\times \overrightarrow{W}^N\right]-\vec{\nabla}\times\left(\frac{\vec{\nabla} p_e^{N+1/2}}{m_en_e^{N+1/2}}\right).
\end{eqnarray}
A three-dimensional flux-corrected transport algorithm for solving continuity
equations (LCPFCT) is used to solve this equation.
The solution for $\vec{B}^{N+1/2}$ of the discretized version of an
elliptic Eq.~\ref{eq:elliptic_b} can be obtained by solving
\begin{equation}
\vec{\nabla}\times\left(\frac{\vec{\nabla}\times\vec{B}^{N+1/2}}{\mu_0en^{N+1/2}}\right)+\frac{e\vec{B}^{N+1/2}}{m_e} =\vec{\nabla}\times\vec{u}_i^{N+1/2}-\vec{W}^{N+1/2}. \label{eq:b_half}
\end{equation}
The solution of Eq.~\ref{eq:b_half} allows to obtain $\vec{B}^{N+1/2}$ from $\vec{W}^{N+1/2}$.
The discretization of this elliptical PDE reveals a system of algebraic equations
which can be solved, e.g., by a general purpose scalable linear multi-grid solver contained
in the multigrid-library
HYPRE~\cite{Falgout2002,falgout2006}~\footnote
{\texttt{\url{https://hypre.readthedocs.io/en/latest/ch-intro.html}}}.
%https://computing.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods}}}.
%https://hypre.readthedocs.io/en/latest/ch-intro.html%
Next the components of $\vec{u}_e^{N+1/2}$ can be obtained solving the
discretized Amp\`ere's law Eq.~\ref{eq:ampere}.
\begin{eqnarray}
\vec{u}_e^{N+1/2}=\vec{u}_i^{N+1/2}-\frac{\vec{\nabla}\times\vec{B}^{N+1/2}}{\mu_0en_e^{N+1/2}}\label{eq:ue_half}.
\end{eqnarray}
At this point all relevant quantities are known at time step
$N+1/2$: $\vec{u}_e^{N+1/2}$, $\vec{B}^{N+1/2}$ and $\vec{W}^{N+1/2}$.
These quantities can now be advanced to time step $N+1$ by solving the
following equations
\begin{eqnarray}
\left.\frac{\partial \overrightarrow{W}}{\partial t}\right|_{N+1/2\to N+1}
& = & \vec{\nabla}\times\left [\vec{u}_e^{N+1/2}\times \overrightarrow{W}^{N+1/2}\right]\nonumber \\
& \qquad -&\vec{\nabla}\times\left(\frac{\vec{\nabla} p_e^{N+1/2}}{m_en_e^{N+1/2}}\right) \label{eq:w_full} \\
\vec{\nabla}\times\left(\frac{\vec{\nabla}\times\vec{B}^{N+1}}{\mu_0en_e^{N+1/2}}\right)+\frac{e\vec{B}^{N+1}}{m_e} & = &\vec{\nabla}\times\vec{u}_i^{N+1/2}-\vec{W}^{N+1}\label{eq:b_full} \\
\vec{u}_e^{N+1} & = &\vec{u}_i^{N+1/2}-\frac{\vec{\nabla}\times\vec{B}^{N+1}}{\mu_0en_e^{N+1/2}}\label{eq:ue_full}
\end{eqnarray}
% \end{document}
Eq.~\ref{eq:w_full} can be solved by using already mentioned three-dimensional
LCPFCT package developed by the U.S. Naval Research Laboratory and
Eq.~\ref{eq:b_full} by utilizing the HYPRE library package.
This way one obtains $\vec{W}^{N+1}$, $\vec{B}^{N+1}$ and $\vec{u}_e^{N+1}$.
Note that the ion quantities ($\vec{u}_i$ and $n_i$) are used at time steps $(N+1/2)$,
same as for the first half time step.
This is justified by the heavy ions whose mass is much larger compared to that
of the electrons.
% \end{document}
The two step time integrations (first half and then full time step) are carried out for
the integration along each one of the spatial directions $x,y$ and $z$ as required
by the multi-dimensional time operator splitting technique,
thus advancing in time all components of the quantities used by the field solver.
The electric field is then again advanced from time step $N+1$ to $N+2$ using the
ion quantities at the intermediate time step $N+1/2$ (i.e., assuming that they are
temporally fixed).
This reveals $\vec{B}^{N+2}$, $\vec{W}^{N+2}$ and $\vec{u}_e^{N+2}$.
Now, the electric field can be calculated at time step $N+1$ using the discretized
generalized Ohm's law Eq.~\ref{eq:emom}:
\begin{eqnarray}
\vec{E}^{N+1}&=&-\frac{m_e}{e}
\left[
\frac{\vec{u}_e^{N+2}-\vec{u}_e^{N}}{2\, \Delta t}
+(\vec{u}_e^{N+1}\cdot\vec{\nabla})\vec{u}_e^{N+1}
\right]\nonumber \\
&\qquad -&\vec{u}_e^{N+1}\times\vec{B}^{N+1}
-\frac{\vec{\nabla} p_e^{N+1}}{en_e^{N+1}}. \label{eq:E_at_NP1}
\end{eqnarray}
The value of $p_e^{N+1}=n_e^{N+1}k_BT_e$ are provided by the equation
of state Eq.~\ref{eq:eos} in the same way as before.
$p_e^{N+1}=p_e^{N+1/2}$ and $n_e^{N+1}=n_e^{N+1/2}$ is
assumed.
Finally, the values of $\vec{E}^{N+1}$ and $\vec{B}^{N+1}$ are available to
move the ions further. This ends a time step and the cycle becomes repeated.
Note that model and numerical implementation as presented in
Sects. \ref{sec:simulation_model} and \ref{sec:implementation}
do not contain resistive terms.
Finite resistivity is usually included in hybrid codes with massless electron
fluid to damp whistler waves propagating at the grid scale.
This is necessary since in massless electron fluids the whistler phase
velocity increases with the wave number without bounds.
As a result the time steps have to become very small with increasing
grid resolution to further satisfy the CFL (Courant) condition to still
resolve the whistler wave propagation.
The phase speed of whistlers in an inertial electron fluid, on the other hand,
is limited due to the finite electron mass.
Therefore, the use of finite resistivity is not necessary for keeping the
hybrid codes with massive electrons stable (see Sects. \ref{sec:simulation_model}
and \ref{sec:implementation}). It can, however, implemented in the code
to model collisional resistivity in case of interest.
The PIC-typical particle shot noise can be reduced in two different ways.
One is the use of higher (at least second) order shape functions for
the current density deposition from particles to grid and vice-versa
to calculate the electromagnetic fields at the ion position.
A second possibility in the code is to apply a standard binomial filter
on the current deposition, smoothing out the current density
as source term of the Maxwell solver.
\chapter{Vlasov simulations}
So far we have covered particle methods that represent the distribution function via pseudoparticles and fluid methods that use hyperbolic conservation laws (which are typically derived from moments of the distribution function). We now turn to the Vlasov equation directly. As we will notice in the course of this chapter the following thoughts could also be summarized under hyperbolic conservation laws - as the Vlasov equation is such a conservation law. Due to the specific details the Vlasov equation ended up with its own chapter.
\section{Numerical schemes and Hamiltonian dynamics }
\label{sec:numscheme_hamiltondynamics}
The Vlasov equation is the model equation for the study of collisionless magnetized plasma dynamics. The idea is that particles can be represented by a statistical approach and that each charged particle mainly interacts with the full system more than with nearby single particles. In other words, the force acting on the plasma represented statistically by a distribution function is given by the ``averaged'' electromagnetic field generated by the plasma itself plus external fields rather than by single particle interaction (the so-called mean field theory).
We define the N-particles distribution and the s-particles distribution in the (${\vec x}, {\vec v}$) phase space as
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\[
F({\vec x}_1, {\vec x}_2, .., {\vec x}_{_N}, {\vec v}_1, {\vec v}_2, ..., {\vec v}_{_N})
\]%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\[
F^{(s)} = \int F d{\vec x}_{s+1} ... d{\vec x}_{_N} d{\vec v}_{s+1} ... d{\vec v}_{_N}
\]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The $F$ distribution function satisfies the Liouville equation,
\[
\frac{dF}{dt} =0
\]
where $d/dt$ is the total derivative given by
\[
\frac{d}{dt} \equiv \frac{\partial}{ \partial t} + {\vec v} \cdot \frac{\partial}{\partial {\vec x}} + {\vec a} \cdot \frac{\partial}{\partial {\vec v}}\,
\]
Here ${\vec a}$ represents the total acceleration due to internal and external electromagnetic fields. Then, formally, the Vlasov equation is obtained by integrating the Liouville equation for the N-particles distribution function over all particles but one (see Ref.~\cite{krall} for the full theory)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\[
\int \frac{d}{dt} F({\vec x}_1, {\vec x}_2, .., {\vec x}_{_N}, {\vec v}_1, {\vec v}_2, ..., {\vec v}_{_N}) \, d{\vec x}_2 ... d{\vec x}_{_N} d{\vec v}_2 ... d{\vec v}_{_N} \rightarrow \frac{dF^{(1)}}{dt} = 0
\]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
neglecting the particle correlations at any level, $F^{(2)}=0$, and so on. This means that collisions are completely neglected, as consistent with the large majority of plasma systems in space, let's say border line in the laboratory.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[!ht]
\center
\includegraphics[scale=0.5]{fig_chapter8/fig1.png}
\caption{Phase space advection of the distribution function by the Vlasov equation. The phase space shape can be deformed but its surface (volume) cannot be changed during the dynamical evolution of the plasma.}
\label{fig:1}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
For instance, in the solar wind where non-Maxwellian d.f. are routinely detected by satellite measurements, the mean free path is of the order of one astronomical unit corresponding to the typical size of the system. So, neglecting the two particle correlation function and so on,
the resulting equation for the one point d.f. turns out to be a "multi-advection" equation in phase space satisfying the Liouville theorem, $df/dt = 0$ (from now on $F^{(1)} \equiv f$).
This equation is known as the Vlasov equation and for a given species $\alpha$, in the non relativistic limit, reads:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:Vlasov}
\frac{\partial f_{\alpha}}{\partial t} + {\vec v} \cdot \frac{\partial f_{\alpha}}{\partial \vec x} +
\frac{q_{\alpha}}{m_{\alpha}} \left( {\vec E}
+ \frac{ {\vec v} \times {\vec B}}{c} \right) \cdot\frac{\partial f_{\alpha}}{\partial \vec v} = 0
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Here the index $\alpha = i, e$ indicates the species (ions and electrons, respectively), $m_{\alpha}$ and $q_{\alpha}$ the mass and the electric charge, $\vec E$ and $\vec B$ the electric and magnetic field and $f_{\alpha}$
the distribution function, hereafter d.f. The distribution function is (multi)-advected in phase space by the space and velocity terms in the sense that any 2D slice (for the sake of simplicity) of the d.f. in phase space can be deformed during the evolution but its total surface cannot be changed, as schematically represented in Fig.~\ref{fig:1}. Furthermore, by integrating Eq.~\ref{eq:Vlasov}, it is easily shown that there are an infinite number of Invariants $I$ conserved by
the Vlasov equation, in particular any power of the d.f.:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:inv}
I_{\alpha}^n = \int f_{\alpha}^n ({\vec x}, {\vec v} , t) d{\vec x} d{\vec v} = cost.
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
More generally, any function $G(f)$ of $f$ is a constant of motion,
\[
\frac{dG}{dt}= \frac{dG}{df} \frac{df}{dt} = 0
\]
\noindent
To evolve in time the Vlasov equation, one must calculate self-consistently the electromagnetic fields using the plasma density and currents obtained from the zero and first moment of $f$ defined for the species ${\alpha}$ as
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:nj}
n_{\alpha} = \int f_{\alpha} d{\vec v}_{\alpha} \,; \;\;\;
j_{\alpha} = q_{\alpha} \int {\vec v} f_{\alpha} d{\vec v}_{\alpha}
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This is done by solving the Maxwell equations, namely the Faraday and Ampere equations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:maxwb}
\frac{1}{c} \frac{\partial {\vec B}}{\partial t} = - \nabla \times {\vec E}
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:maxwe}
\frac{1}{c} \frac{\partial {\vec E}}{\partial t} = \nabla \times {\vec B} - \frac{4 \pi }{c} {\vec j}
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or the Gauss equation (or Ampere with ${\vec B} = 0$ for non periodic boundary conditions) in the electrostatic limit:
\begin{equation} \label{eq:gauss}
\nabla \cdot {\vec E} = 4 \pi \int ( f_i - f_e ) d {\vec v}
\end{equation}
\noindent
The Vlasov equation, Eq.~(\ref{eq:Vlasov}), is basically a ``transport'' equation in phase space and we can distinguish the space advection term ${\cal A}_x$ and the velocity advection
term ${\cal A}_v$ separately (from now on the species index will be ignored):
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:advec}
\frac{\partial f}{\partial t} = {\cal A}[f] \equiv {\cal A}_x [f] + {\cal A}_v [f]
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note that the linear Vlasov equation becomes non linear when coupled with Maxwell equations since the velocity advection term ${\cal A}_v$ depends on the plasma density and currents and so on the d.f., see Eq.~(\ref{eq:nj}), used to solve the Maxwell equations and so the electromagnetic fields.
Equation~(\ref{eq:Vlasov}) has the following characteristics
%%%%%%%%%%%
\begin{equation} \label{eq:traj}
\frac{d {\vec s}}{dt} = {\vec v} \, ; \;\;\;
\frac{d {\vec v}}{dt} = {\vec a}
\end{equation}
%%%%%%%%%%%
which describe an "Hamiltonian flow" in phase space. Let's now consider for the sake of mathematical simplicity the electrostatic limit and adopt
the "classical" Hamiltonian formulation
%%%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:Hamilt_formulation}
\frac{\partial H}{\partial {\vec p}} = \frac{{\vec p}}{m}\, ; \;\;\;
\frac{\partial H}{\partial {\vec q}} = - m {\vec a}
\end{equation}
%%%%%%%%%%%%%%%%%%
where ${\vec q}$ and ${\vec p}$ are the usual canonical variables, $d {\vec q} / dt = {\vec p} / m$ and $d {\vec p} / dt = m {\vec a}$. Here $H$ is the Hamiltonian defined as
%%%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:H}
H = \frac{p^2 }{2m} \, - \Phi (q)
\end{equation}
%%%%%%%%%%%%%%%%%%
where $\Phi (q)$ is the electric potential. Using the Hamiltonian, we can rewrite the Vlasov equation as
%%%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:Hamilt_Vlasov}
\;\;\;\;\;\; \;\; \frac{\partial f}{\partial t} = [H, f] \, ; \;\;\;\;\;\; [H, f] = \frac{\partial H}{\partial x} \frac{\partial f}{\partial v} - \frac{\partial H}{\partial v} \frac{\partial f}{\partial x}
\end{equation}
%%%%%%%%%%%%%%%%%%
\noindent
where $[H, f] = (\partial H / \partial x) (\partial f / \partial v) - (\partial H / \partial v) (\partial f / \partial x)$ $ \equiv \Lambda f$ is the Poisson bracket.
It allows us to define ${\cal P}^t = e^{\Lambda t}$ as the Vlasov propagator whose analytical solution is in general unknown, so that the advection of
the d.f. in phase space is purely formal. However, the Hamiltonian can be split into two parts,
\[
H= H_s+ H_v \, ; \;\;\; H_s = p^2 / 2m \, \;\; H_v = - \, \Phi
\]
allowing us to define the space and velocity propagator separately
%%%%%%%%%%%%%%%%%%%
\[ {\cal P}_s^t \, = \exp( \Lambda_1 t ) \,; \;\;\;\;\; {\cal P}_v^t \, = \exp( \Lambda_2 t ) \]
%%%%%%%%%%%%%%%%%%%
The corresponding space and velocity phase space advection,
%%%%%%%%%%%%%%%%%%%
\[
\frac{\partial f}{\partial t}=[H_1,f] = - v \frac{\partial f} {\partial x} \, ; \;\;\;\;\;
\frac{\partial f}{\partial t} =[H_2,f]= E \frac{\partial f}{\partial v}
\]
%%%%%%%%%%%%%%%%%%%
(using now dimensionless variables) can be now solved analytically with solution given by:
%%%%%%%%%%%%%%%%%%%
\[
{\cal P}_x^t \left[ f_0 \right] \equiv f(x, v, t) = f_{_0} (x - vt, v) \,; \;\;\;
{\cal P}_v^t \, \left[ f_0 \right] \equiv f(x, v, t) = f_{_0} (x, v + Et)
\]
%%%%%%%%%%%%%%%%%%%
In other words, the solution of each advection equation is given by the solution at the previous time evolved along its own characteristic. This method is known as
the {\em splitting scheme} and was proposed many decades ago by Cheng and Knorr ~\cite{cheng76} for the electrostatic Vlasov equation. However, applying sequentially
the space and velocity propagators, ${\cal P}_v^t \, \left[ {\cal P}_x^t \left[ f_0 \right] \right]$, does not correspond to the full advection of the d.f., ${\cal P}^t \left[ f_0 \right]$,
since the space and velocity propagators do not commute. To solve the full advection one should iterate the two propagators, the so-called Magnus expansion \cite{magnus_exp}, as follows
%%%%%%%%%%%%%%%%%%%
\[
{\cal P}^t = \lim_{N\rightarrow \infty }\left[ {\cal P}_s^{t/2N} \, {\cal P}_v^{t/N} \, {\cal P}_s^{t/2N} \right]^N
\]
%%%%%%%%%%%%%%%%%%%
\noindent
For a finite time step $dt$ and taking $N=1$, the solution for the full Vlasov propagator is approximated at second order by:
%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:split}
{\cal P}^{d t} \left[f(x, v) \right] =
\left\{ {\cal P}_x^{d t/2} {\cal P}_v ^{dt} {\cal P}_x^{d t/2} \right\} \left[f(x, v) \right] + O(dt^{3})
\end{equation}
%%%%%%%%%%%%%%%%
provided that the electric field is calculated after the first space translation as discussed in Ref.~\cite{cheng76}.
In the electromagnetic case, one must take into account also the rotation of the d.f. around the magnetic field driven by the Lorentz force, $[E_x + v_y B_z ] \, \partial f / \partial v_x $ and $[E_y - v_x B_z] \, \partial f / \partial v_y $ (in the 2D limit in space for the sake of mathematical simplicity).
In the non relativistic limit since each component of the Lorentz force does not depend on the velocity along that component, one can still adopt the same strategy using the corresponding Vlasov propagators
%%%%%%%%%%%%%%%%
\[ {\cal P}_v ^{dt} = {\cal P}_{v_x}^{dt/2} \, {\cal P}_{v_y}^{dt} \, {\cal P}_{v_x}^{dt/2} \]
%%%%%%%%%%%%%%%%
which is easily extended to the full electromagnetic 3D case \cite{MangeneyJCP2002} as
\begin{equation} \label{eq:split3D}
{\cal P}_v ^{dt} = {\cal P}_{v_x}^{dt/2} \, \left\{ {\cal P}_{v_y}^{dt/2} \, {\cal P}_{v_z}^{dt} \, {\cal P}_{v_y}^{dt/2} \right\} \, {\cal P}_{v_x}^{dt/2} \end{equation}
%%%%%%%%%%%%%%%%
All this splitting technique is motivated by the need of avoiding direct calculation of phase space derivatives which would be too expensive in term of CPU time. For the sake of simplicity in the following let's take the electrostatic 1D-1V limit, but valid in general. By advancing each single advection along its own characteristic, the value of the d.f. at the new time step is obtained by a direct interpolation of the d.f. at the previous time. This can be easily understood by noticing that
the new d.f. is given by the value of the d.f. at the previous time shifted by the corresponding advection, for instance
%%%%%%%%%%%%%%%%
\[ f_s (x, v, t+dt/2) = f_v (x - v dt, v, t) \]
\[ E = - \nabla^2 \phi = 4\pi e (n_i - n_e) \, ; \;\;\; n_{\alpha} = \int f_{\alpha , s} dv \]
\begin{equation} \label{eq:propagator}
f_v (x, v, t+dt) = f _s (x, v + E dt, t+dt/2)
\end{equation}
%%%%%%%%%%%%%%%%
where $f_s$ and $f_v$ are the d.f. advected by the space and velocity term, respectively, which are shifted by a $dt/2$ one to each other, see Eq. (\ref{eq:propagator}), but
which are both advanced by a $dt$ time step\footnote{Technically, a $dt/2$ shift is made at $t=0$ by a space $dt/2$ advection. Then, the iteration of the last and first $dt/2$ space advection are cast into a single $dt$ space advection. To obtain the "correct" d.f. $f(x,v,t)$ at a given time, if needed, one must shift by $dt/2$ in space
the $f_v$ d.f.}. The value of the d.f. in any given phase space grid point at the new time step, $f_a (t + dt, x_i, v_j)$, $a = s, v$,
is given by the value of the d.f. at the previous time in the point shifted by the corresponding advection, $\tilde x = x_i - v dt$ or $\tilde v = E - v_j dt$, respectively.
As matter of fact, $\tilde x$ and $\tilde v$ will correspond not to a grid point of the phase space mesh. Because of numerical stability, see Ref. \cite{MangeneyJCP2002},
the time step $dt$ must be ``small enough'' such that $x_{i-1} < \tilde x < x_{i+1} $ and the same holds for the velocity advection. As a result, the splitting scheme reduces to
an interpolation of the d.f. in the point $ \tilde x$ (or $\tilde v$) using the known values in the nearby grid points, $x_{i-1}, x_i, x_{i+1}$ (the stencil can be extended to
increase the accuracy).
In the Vlasov code (and its more recent Hybrid-Vlasov version \cite{valent07}) developed in Pisa in these last years, we use the third order Van Leer scheme \cite{MangeneyJCP2002} involving a five points stencil. This interpolation scheme has the advantage of being very accurate, to conserve the charge and to be well suited for parallel machines since it requires only communications between nearby processors.
\section{Models of different Plasma Regimes}\label{models}
The great complexity and difficulty in the study of the dynamics of collisionless plasmas stems from the ability of a plasma in supporting an impressive variety of electrostatic and electromagnetic fluctuations at different scales and frequencies. These fluctuations are driven by several different basic physical processes developing at large, intermediate and small scales where the system is regulated by fluid, ion kinetic and electron kinetic dynamics, respectively.
As discussed in Section \ref{sec:intro}, the model equation able to capture all scales except the collisional one is the Vlasov equation, Eq.~(\ref{eq:Vlasov}), for each species at play self-consistently coupled with Maxwell equations, Eqs.~(\ref{eq:maxwb})-(\ref{eq:maxwe}). The Vlasov equation follows in time the evolution of the d.f. in the six-dimensional 3D-3V phase-space.
At the level of linear fluctuations underlying any important physical plasma process (turbulence, reconnection, wave-particle interaction, non linear interactions, ....), many modes are at play which develop from fluid down to ion and electron scales: from slow and fast MHD and Alfven waves, to ion acoustic and Bernstein modes, to whistler and kinetic Alfv\'en waves, to Langmuir waves (also known as plasma waves). These modes are separated by many order of magnitudes in wavelength and frequency. As an example, in the solar wind at 1 AU from the Sun Alfv\'en waves typically vary in the range $10^{-3} - 10^{-1}$ $Hz$ while KAW and whistler waves from a bit less than the ion cyclotron frequency, $f_{ci} \approx 1~Hz$, up to $10 - 10^2$ $Hz$ not forgetting about ion-sound waves from a few Hz to a few 100 Hz. At even larger frequencies around $10^3$ $Hz$ and more one observes plasma waves.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[!ht]
\center
\includegraphics[scale=0.4]{fig_chapter8/fig2.png}
\caption{The different theoretical models used in plasma physics at different scales }
\label{fig:2}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Linear modes in a fusion machine, from TAE (Toroidal Alfv\'en Eigenmodes) and ITG (Ion Temperature Gradient) driven modes to electrostatic and drift modes, are observed in a less extended range of frequencies, but still spanning a quite large range of at least three orders of magnitude, from $k Hz$ to $M Hz$. Turbulence development extends further the range of frequencies involved in the full system dynamics.
Wave modes introduced above are just the most popular ones and among the most representative of the different regimes shown in Fig.~\ref{fig:2}. However, in general even starting in the context of a well defined regime the system dynamics extend, very rapidly in some cases, to nearby regimes. In general such multi-scale behavior is limited to very localized regions such as e.g., current sheets, but nevertheless the consequences can have a global impact (magnetic field topology change by reconnection, particle acceleration, ...).
In these conditions other linear modes come into play depending on the processes at play that feed such regime transition self-consistently achieved by the system. Indeed, plasmas are know as multi-scale, multi-physics systems. A similar sketch as for Fig.~\ref{fig:2} of many different instabilities supported by a plasma depending on the regime of interest could be drawn. Note that instabilities are among the main drivers for regime transition.
As a consequence, addressing the dynamics of a magnetized plasma by numerical simulations not only requires very accurate algorithms to describe the non linear dynamics, but it also imposes to deal with a very large interval in wave numbers and frequencies corresponding to the requirement of a huge number of grid points both in space and velocity and a very large number of time steps. As an example, last years Vlasov-hybrid kinetic simulations can achieve up to tens of Tb of memory and running time of the order of tens of millions of core hours, which is at the limit of the present machines. A related technical problem to such a huge use of numerical resources, but nevertheless of strong consequences on the possibility to study the physics of interest, is the data storage and analysis in particular of the d.f.
Therefore, the solution of the full Vlasov-Maxwell system necessitates of an enormous investment in terms of computational resources both of CPU time and memory. It turns out that even using the most powerful supercomputers it is in practice impossible to fully describe phenomena such as
the interaction of the solar wind with the magnetosphere or the development of turbulent fluctuations in the solar wind where at least four order of magnitudes of scales and frequencies are involved. For instance, in the solar wind the ratio between the plasma frequency and the ion cyclotron frequency is about $10^3$ as shown in Ref.~\cite{sahra2010} (see Fig.~2 at pag.2), which means that more than four orders of magnitudes of frequencies should be taken into account in a Vlasov simulation if one wants to describe the full system,
from MHD up to electron frequencies. Correspondingly, a likewise very large interval in wave vectors must be taken into account.
For all these reasons, it is very important to separate the different actors at play in the full scenario of the system dynamics in order to adopt specific models to investigate selected pieces of physics.
For example, global simulations of the interaction of the solar wind - Earth's Magnetosphere using plasma parameters as given by satellite observations are still performed mainly using an MHD approach (see also Chapter 1 of this book), while to investigate the physics developing in the region of interaction, from the magnetosheath to the external magnetosphere, one can make use of hybrid models to follow the crossing from fluid to ion kinetic dynamics. A typical example is the study of the low latitude dynamics driven by the development of Kelvin-Hemholtz vortices initially on a fluid scale but rapidly exciting a dynamics across $d_i$ and/or $\varrho_i$ (the ion skin depth and the ion Larmor radius, respectively) down to sub-ion's scales.
One of the most popular models to investigate the physics of the low frequency MHD dynamics and its transition to the ion kinetic regime is the so-called Hybrid approach where the ion kinetic dynamics is advanced in time by the Vlasov equation while the electrons are advanced using a a fluid approach \cite{Winske85}. Quasi-neutrality is also assumed. Hybrid approach, long time ago developed within the PIC framework (see Chapter 3 of this book), is motivated by the need of following the fluid to ion-kinetic crossing of the dynamics but avoiding to take into account the electron kinetic dynamics too because of computational reasons.
This is in part justified by the low frequency physics mainly at play in many of the space systems and the possibility of a transition across the ion kinetic characteristic length-scale because of non linear interactions and/or instabilities development driven by plasma temperature anisotropy and/or by gradients at the interface between different systems or because of turbulence. Nevertheless, the lack of the electron kinetic dynamics remains a weak point because of the multi-scale behavior of plasma (with possible feedback from small to large scales) and because of the difficulties to impose a fluid closure\footnote{Formally, fluid equations are recovered by multiplying the Vlasov equation by ${\vec v}^n$, $n=0, 1,...$, and integrating in the velocity ${\vec v}$ space (the so-called n-moments). This leads to a "useless" infinite chain of equations (see e.g. Ref. \cite{krall}). The fluid closure is given by a supplementary equation. In general, one assumes an isotropic pressure and takes a polytropic relation between density and pressure eventually breaking the chain and closing the system of equations. However, this supplementary equation, initially motivated by the expected physics, can rapidly uncorrectly describe the dynamics at play.} (typically isothermal) which could be not at all appropriate once the dynamics develop. On the top of that electron Landau damping, lacking in the hybrid approach, can also be an important piece of physics first of all because it influences the dispersion relation of the main wave modes at frequencies overcoming the ion cyclotron frequency. Saying that, the hybrid approach has been (and it is still) a very powerfull approach to investigate fundamental problems such as, for instance, the dynamics of collisionless shocks, magnetic reconnection, temperature anisotropy instabilities, plasma turbulence across the ion cyclotron frequency, in all cases being able to catch the main ion kinetic physics of interest.
We start by considering the Vlasov Eulerian approach known as the HVM (Hybrid Vlasov Maxwell) code presented long time ago in Ref. \cite{valent07}. The numerical scheme to advance the ion Vlasov equation is based on the splitting scheme (see Section \ref{sec:numscheme_hamiltondynamics}) coupled to a discontinuous Galerkin method (see Ref. \cite{MangeneyJCP2002} for details). The hybrid scheme couples the ion Vlasov equation to fluid electrons by means of the so-called CAM algorithm \cite{CAM}. The CAM method has been extensively adopted by Hybrid PIC algorithms since it requires only a single computational step (i.e. only one integration of the d.f. to calculate the plasma density and current) to complete the full advancement. This is achieved by advancing the ionic current using an appropriate equation of motion such as to maintain second order time accuracy.
A different approach with respect to the splitting scheme has been proposed more than ten years ago in Ref. \cite{ElkBuch2008}. The main goal was to ensure the positivity of the d.f. thus avoiding numerical artificial oscillations that could lead to code instabilities. The time advancing scheme is given by a second-order upwing algorithm together with a finite volume approach for grid discretization.
In these last years a new 3D-3V hybrid-Vlasov code, namely Vlasiator (see \cite{Palmroth2018} and references therein), aimed at performing global magnetospheric simulations \cite{vlasiator2013,vlasiator2014} has been developed. This approach was motivated by the ability of the MHD model of capturing the global dynamics of the solar wind - magnetosphere system but at the same time by its inability to follow the kinetic dynamics developing first of all at the interfaces of different plasma regions. It has been the first Vlasov code developed to study the near Earth's environment. It integrates the Vlasov equation for the ion population by means of a finite volumes technique and adopting a splitting scheme similar to what has been presented for the HVM code in Section \ref{sec:numscheme_hamiltondynamics}, see Eq. (\ref{eq:split}). The electrons are instead considered as a massless neutralizing background. The system is closed by using an electric field calculated by an ideal Ohm's law in the Faraday equation while the electric field in the Vlasov equation contains also the Hall term. Finally quasi neutrality is assumed and the displacement current is neglected in the Ampere law. A dynamical time step is used to adjust it to the maximum allowed value depending on the dynamics. Vlasiator approach is very well suited for performing global magnetospheric simulations including boundaries where the kinetic physics at ion scales dominate the dynamics, as for instance the Earth's bow shock. The only compromise, as for all hybrid codes, is the neglecting of the electron scale kinetic processes, but being able to follow the multi scale plasma physics on a large number of scales.
As of today, the full kinetic Vlasov approach proposed long time ago by Mangeney $\&$ Califano \cite{MangeneyJCP2002} has not been exploited yet unless, for instance, in reduced geometry such as, for instance, 1D-3V geometry for the study of electromagnetic instabilities (see \cite{lopa2009,lopa2010} and references therein). This is the direct consequence of the very huge CPU time and memory requirement of the Eulerian approach where the full grid in phase space must be set from the initial time. For this reason the hybrid approach, 2D-3V first and more recently 3D-3V, has been so far so popular. However the impressive increase in computational power in the last recent years (the so-called Peta-scale computing, and soon achieving Exa-scale) now finally allows for fully kinetic Vlasov simulations. Recently, a new algorithm for the solution of the Vlasov Maxwell system still in the non-relativistic limit, has been presented \cite{juno2018}. This approach is based on a discontinuous Galerkin technique and makes use of finite element method for the spatial discretization. Moreover, in this approach the Vlasov equation is integrated directly without using the splitting technique for the two advection terms. The explicit time advancement, namely a third-order Runge-Kutta scheme, is constrained by the CFL condition on the time step resulting from the discretization of the two advection terms. Despite the highly sophisticated parallelization technique, the use of a full kinetic Eulerian Vlasov code still remains challenging when applied to research problems.
Very recently, still on the line of fully kinetic simulations, a full Vlasov numerical code adopting the Darwin approximation has been developed \cite{avida2019}. This code, namely ViDA, makes use of the Vlasov-Darwin model as the one adopted in Ref. \cite{schmitz2006}. The advancement of the distribution function is the same as the one discussed for the Hybrid-Vlasov (HVM) code introduced above. However, instead of coupling the d.f. advancement to the full set of Maxwell equations, it relies on the Darwin approximation where light waves are suppressed while standard wave modes are included (such as e.g., kinetic Alfven, whistler waves, etc). In particular, the standard hyperbolic time evolving Faraday and Ampere equations can be cast into a set of Helmholtz and Poisson-like equations.
This approach allows one to significantly increase the time step with respect to a Vlasov-Maxwell model since light waves are in general the fastest process to follow within the framework of an explicit algorithm. As a consequence, this approach is particularly adapted for the study of the dynamics in between the ion and the electron kinetic scale length, i.e. in between $\varrho_i, d_i$ and $\varrho_e, d_e$ (the ion/electron Larmor radius and the ion/electron skin depth, i/e respectively). This kind of approach aims at investigating multi-scale plasma problems where there is a need of a fine, no noise resolution of the electron physics embedded into a ion large-scale dynamics. Important examples are the study of kinetic turbulence and "dissipative"-like properties or of the structure of the ion/electron reconnection layer for direct comparison with satellite data such as those from MMS (the so-called electron diffusion layer).
\section{Vlasov equilibrium} \label{sect:em}
Any study aimed at investigating the dynamics of a specific plasma process, wave propagation, instabilities up to the non linear dynamics or the development of plasma turbulence, should mandatory start by finding an initial equilibrium configuration represented by the d.f. and the fields, $f_{\alpha}({\vec r}, {\vec v})$, ${\vec E({\vec r})}$, ${\vec B}({\vec r})$. This initial configuration must satisfy the Vlasov equation, Eq.~(\ref{eq:Vlasov}), self-consistently coupled to the Maxwell equations, Eqs.~(\ref{eq:maxwb})-(\ref{eq:maxwe}) in the stationary limit $\partial / \partial t = 0$. This can be achieved by using the ``integrals of motion'' starting from the single particle Hamiltonian:
%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:hamil}
{\cal H}_{\alpha} = p_{\alpha}^2 / {2 m_{\alpha}} + q_{\alpha} \phi_{\alpha} ({\vec r}) \,; \;\;\;\; {\vec p}_{\alpha} = m_{\alpha} {\vec v}_{\alpha} + q_{\alpha} {\vec A} / c
%{\vec A({\vec r})} / c
\end{equation}
%%%%%%%%%%%%%%%%
where $\phi ({\vec r})$ and $ {\vec A({\vec r})}$ are the potentials satisfying the following equations
%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:potentials}
\nabla^2 {\vec A} = - \frac{4 \pi}{c} {\vec J} ({\vec A}, \phi ) \, ; \;\;\;
\nabla^2 \phi = - 4 \pi \rho (A, \phi )
\end{equation}
%%%%%%%%%%%%%%%%
In the space plasmas context, collisions act on a time scale which is in general much longer than the dynamical time scale, a condition which remains more or less
true also in the laboratory (except that for special cases). Therefore plasmas are typically non equilibrium systems and Vlasov equilibria are thus defined as meta-equilibria.
As an example, anisotropic distributions such as
%%%%%%%%%%%%%%%%
\begin{equation}
f ({\vec v}) = C \exp \left[ -\frac{1}{2 m} \left( \frac{v_x^2}{T_x} + \frac{v_y^2}{T_y} + \frac{v_z^2}{T_z} \right) \right]
\end{equation}
%%%%%%%%%%%%%%%%
are formally solutions of the stationary Vlasov equation.
The most popular equilibrium because of its simplicity in modeling the reconnection problem is the Harris sheet equilibrium \cite{harris62}. It is a 1D model equilibrium based on
the assumption of no charge separation, $\nabla^2\phi=0$, giving $\phi = cts$. Then the integrals of motion are the canonical momentum, the energy and the component of
the velocity along the magnetic field direction. Assuming $x$ the coordinate of variation and $y$ the direction of the magnetic field, we take $f = f( p_z, v_y, v^2 )$ and
${\vec A } = A_z (x) {\vec e}_z$, so that one should solve the following equation:
%%%%%%%%%%%%%%%%
\begin{equation}
\label{eq:ampereharris}
\frac{ d^2 A_z} {d x^2} = - \frac{4\pi e}{c} \int \left(f_i-f_e \right) v_z d^3v
\end{equation}
%%%%%%%%%%%%%%%%
Here ${\vec A}$ is the magnetic vector potential defined as $\nabla \times {\vec A } = {\vec B}$. By using an Hamiltonian formulation where the force term is given by the current in the $z$-direction, one can define an equivalent effective potential
${\cal D} (A_z) = \int^{A_z}_{A_0}J_z\left(A_z^\prime\right)dA_z^\prime$ and get an Energy equivalent equation:
%%%%%%%%%%%%%%%%
\begin{equation}
\label{eq:energia_efficace}
\frac{1}{2} \left(A_z^{\prime} \right)^2 + {\cal D} \left(A_z \right) = cost.
\end{equation}
%%%%%%%%%%%%%%%%
The effective potential can be interpreted by considering the force balance equation, ${ (1/c)} \; {\vec J} \times {\vec B} = \nabla \cdot {\vec P} $.
Still assuming ${\vec A } = A_z (x) {\vec e}_z$, one gets an energy-like equation \cite{green93}
%%%%%%%%%%%%%%%%
\begin{equation} \label{HA}
\frac{d}{dx} \left[ \frac{1}{2} \left (\frac{d A_z}{dx} \right)^2 + 4 \pi P_{xx} \right] = 0
\end{equation}
%%%%%%%%%%%%%%%%
which, by comparing with Eq.(\ref{eq:energia_efficace}), finally gives the effective potential
\[ {\cal D} \left(A_z \right) = 4\pi P_{xx} \left(A_z \right) \]
As a result, the equilibrium configuration is not imposed but results from the solution of Eq.(\ref{HA}). In other words the vector potential is obtained, let's say, in a
blinded way and thus the magnetic field configuration can be in principle not well suited for the problem of interest. Furthermore, one must check {\em a posteriori} that
quasi-neutrality is satisfied and that $f( p_z, v_y, v^2 )$ is positive definite.
The most important model of the above theory is the well know Harris equilibrium, a magnetic sheared 1D configuration largely used in kinetic simulations aimed at investigating
the magnetic reconnection process. In this case the d.f. of both species can be wrtitten as:
%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:fH}
f_{\alpha} = f_{_0} N_{_H} \exp \left \{ -\frac{m_{\alpha}}{2 T_{\alpha}} \left[
v_{x,\alpha}^{2} + v_{y,\alpha}^{2} + (v_{z,\alpha} - u_{*,\alpha})^{2} + \frac{2 u_{*,\alpha} q_{\alpha}}{m_{\alpha}c} A_{z}\right ] \right\}
\end{equation}
%%%%%%%%%%%%%%%%
where $u_{*,\alpha}$ are the electron and ion mean velocity, $\alpha = i, e$, respectively, $f_{_0} = (m_{\alpha} / 2\pi T_{\alpha} )^{3/2}$ and $N_{_H}$ a normalization factor. By combining Eq.~(\ref{eq:fH}),
easily rewritten in terms of
the integral of motion, with Maxwell equations %%%%%%%%%%%%%%%%
\[
{\vec\nabla} \cdot {\vec E} = 4\pi \Sigma_{\alpha}q_{\alpha}
\int f_{\alpha} du_{\alpha}^{3}
\]
%%%%%%%%%%%%%%%%
\[
{\vec\nabla}\times{\vec B} = (4 \pi / c) \Sigma_{\alpha} q_{\alpha}
\int f_{\alpha}{\vec u}_{\alpha} du_{\alpha}^{3}
\]
one gets the equations for the potential:
%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:potH}
\frac{d^{2}\varphi}{dx^{2}} = 4\pi e N_{_H} \left\{ \exp\left[ \frac{e u_{*,e}}{cT_{e}}A_{z} - \frac{e}{T_{e}} \varphi \right]
- \exp\left[ - \frac{e u_{*,i}}{cT_{i}}A_{z} + \frac{e}{T_{i}} \varphi \right] \right\}
\end{equation}
\begin{equation}\label{eq:10}
\frac{d^{2}A_{z}}{dx^{2}} = - \frac{4\pi e N_{_H} }{c} \left\{ \frac{u_{*,e} }{T_e}\exp\left[ \frac{e u_{*,e}}{cT_{e}}A_{z} - \frac{e}{T_{e}} \varphi\right]
- \frac{u_{*,i} }{t_i}\exp\left[ -\frac{e u_{*,i}}{cT_{i}} A_{z} + \frac{e}{T_{i}} \varphi \right] \right\}
\end{equation}
%%%%%%%%%%%%%%%%
To get the Harris solution, one must impose the quasi-neutrality condition, $\phi = 0$. Thus from Eq.(\ref{eq:potH}) one gets the constraint
%%%%%%%%%%%%%%%%
\begin{equation} \label{eq:neutro_harris}
\frac{u_{*,i}}{T_i} + \frac{u_{*,e}}{T_e} = 0 %\,; \;\;\; \frac{u_{*,e}}{T_e} = - \frac{u_{*,i}}{T_i} = - h
\end{equation}
%%%%%%%%%%%%%%%%
By using the Hamiltonian formulation using the integrals of motion and assuming the force term given by the current in the $z$-direction, one gets the effective potential
$ {\cal D}(A_z) = {\cal D}_0 \exp [A_z / {\bar A_z}] $. Finally, we integrate Eq.~(\ref{eq:energia_efficace}) and get
the following solution
%%%%%%%%%%%%%%%%
\[
A_z \left( x \right) = - \frac{2 c T_e}{e u_{*,e}} \log \left[ \cosh\left(x/L \right) \right] \,; \;\;\; \frac{1}{L} = \frac{e u_{*,i}}{c T_i} \sqrt{2\pi N_{_H} (T_i + T_e) }
\]
\begin{equation}
B_y \left( x \right) = \frac{e u_{*,e}}{c T_e} \sqrt{2\pi N_{_H} (T_e + T_i)} \tanh\left(x/L \right)
\end{equation}
%%%%%%%%%%%%%%%%
Assuming $T_e \simeq T_i$, the equilibrium scale length can be written as $L \simeq d_e (v_{th,e} / u_{*,e})$ so that
if the characteristic velocity supporting the current is much smaller than the thermal velocity, $u_{*,e} \ll v_{th,e}$, we get $L \gg d_e$,
a characteristic condition corresponding to the MHD regime.
Here $d_e = c / \omega_{pe}$ indicates the electron skin depth.
Finally, by integrating the d.f. one obtains the density distribution as follows:
%%%%%%%%%%%%%%%%
\begin{equation}
n_i (x) = n_e (x) = n_{_H} \cosh^{-2} (x/L)
\end{equation}
%%%%%%%%%%%%%%%%
This equation shows that the density far from the central current layer goes to zero which is often an unrealistic condition, in
particular for what concerns space plasmas. Therefore, the Harris sheet model often includes a constant supporting density, a so-called platform,
given by a Maxwellian which is a function of the energy only and thus still represents an equilibrium:
\begin{equation}\label{eq:p_3}
F_{\alpha} (x) = f_{\alpha_{H}} (x) + f_{_0} N_{_P} \exp \left \{ -\frac{m_{\alpha}}{2 T_{\alpha}} \left[
u_{x,\alpha}^{2} + u_{y,\alpha}^{2} + u_{z,\alpha}^{2} \right ] \right\}
\end{equation}
%%%%%%%%%%%%%%%%
The Harris equilibrium plus platform can be simply viewed as a current layer, particularly suited for the study of magnetic reconnection \cite{gem,buch96} because of its
capability of capturing the main physics of reconnection in spite of its technical and mathematical simplicity, a feature particularly useful
for numerical simulations
In general, because of computational reasons, periodic boundary conditions are used, a constraint not suited for the Harris equilibrium.
To circumvent this inconvenient, in many studies a double Harris sheet is employed, that is a simple sum of two opposite Harris equilibria so that
the magnetic field profile can now be assumed as periodic. However, the so-called {\em double-Harris sheet} is no more a kinetic equilibrium
because the first of Eq.(\ref{eq:potentials}) is a non linear equation and thus not satisfied by a simple linear combination of Harris sheets. Nevertheless,
the double-Harris sheet is a force balance (MHD) equilibrium and thus has been deeply used in kinetic simulations by assuming that its characteristic
time to evolve is longer than the system dynamics time scale or that it rapidly relaxes to a nearby kinetic equilibrium. However, this point remains since
the above assumptions are difficult to be proven. More generally, even for a stationary Vlasov equilibrium one must check the stability against phase space
instabilities in the velocity space, for example those due to the presence of local beam-like configurations or temperature anisotropy that would partially or even completely mask the dynamics of interest because, for example, of the impact on the growth rate of the reconnection instability \cite{coppi79,chen84}.
An analytical solution for a ``double-Harris like configuration'' has been obtained by superposing two opposite currents corresponding to two counter-streaming
electron populations leading to a sinusoidal magnetic equilibrium but involving temperature anisotropic distributions, see Ref. \cite{att99}.
These Harris-like approaches still face with the problem of obtaining an equilibrium solution in a "blinded way", so that the final
equilibrium is in principle "unknown" at the beginning of the procedure. In other words at the end of the procedure the equilibrium solution could be far from the one to be used. To step over this problem,
a generalized method for the "inverse problem" in 1D has been developed and summarized in Ref. \cite{allanson16}. It is aimed at
obtaining analytical Vlasov equilibrium supporting a given macroscopic current sheet, including the case of force-free equilibria. The main
objective is to address the magnetic reconnection problem. In this case, still using an Hamiltonian formulation in terms of the canonical momenta $p_{\alpha} = mv_{\alpha} + qA_{\alpha} /c$ and
the corresponding Hamiltonian $H = mv^2 / 2 + q \phi$ for each species, one starts by imposing the force balance between
the Lorentz force and the pressure term using the standard definition for the species pressure tensor:
%%%%%%%%%%%%%%%%
\begin{equation} \label{pinverse}
\Pi_{ij} = \sum_s m \int ( v_{i} - u_{*,i} ) ( v_j - u_{*,j} ) f dv^3
\end{equation}
%%%%%%%%%%%%%%%%
where $u_{*,i/j}$ is the $i/j$ component of the mean velocity and the species index $\alpha$ has been omitted.
The idea is to write the d.f. of each species in Eq.(\ref{pinverse}) in term of a subset of constant of motions multiplied by an unknown deviation $g_{\alpha}$ from a Maxwellian
still assuming quasi-neutrality. By inverting the equation for $g_{\alpha}$ one is finally able to retrieve the kinetic equilibrium
In many situation as for instance the dayside magnetosphere, the Harris-like equilibrium (or any equilibrium obtained with the same mathematics) cannot be used because of
the perfect symmetry of the Harris equilibrium with respect to the ``neutral line'' corresponding to the magnetic field reversal. Many attempts have been made in the past to overcome this problem in order to obtain a non symmetric Vlasov equilibrium first of all addressing specifically the Magnetosphere configuration (see Ref. \cite{roth96} and refs. therein).
Recently a {\em semi-analytic} kinetic model for a tangential current sheet has been developed \cite{belm2012}. This model considers kinetic ions and fluid electrons.
It allows for a non-symmetric density with an antisymmetric magnetic field and a null electric field and valid even in the absence of a guide field. On the other hand, the electrons are assumed as fluid. As a consequence, only the ion d.f. is calculated. By means of a fully kinetic PIC approach, it has been shown that this kind of equilibrium remains stable even for an electron d.f. that does not correspond initially to a kinetic equilibrium \cite{darg2016}. More recently an exact 1D Vlasov analytical solution for an asymmetric Harris sheet has been proposed. The solution is obtained as a sum of four exponential functions of the constants of motion. The corresponding distribution function is given by the sum of four shifted Maxwellians \cite{allanson17}.
A different approach to avoid the complications of starting with a Vlasov equilibrium is to take advantage from a kinetic equilibrium configuration generated, for example, by a primary instability then unstable to a secondary instability. This is the case, for example, of fast electron magnetic reconnection \cite{cali2001} developing on the shoulder of a sheared magnetic field generated by the development of the current filamentation (or Weibel) instability \cite{cal98} (see Section \ref{sect:CF} for details on this instability).
\section{Basic applications: Two textbook example}
\subsection{Electrostatic limit: Landau damping and non linear evolution} \label{sect:es}
The electrostatic response of a plasma is a fundamental part of plasma dynamics which often do play a key role also in the more general electromagnetic context.
One for all we cite the Landau damping process, a fundamental wave-particle interaction mechanism well known in the case of Langmuir waves, but of far-reaching consequences. For example, it turns out to be a key ingredient to calculate the correct dispersion relation of kinetic Alfven waves (KAW) or of the whistler waves in the kinetic regime (both waves are at the basis of the most popular turbulence plasma models). Another fundamental electrostatic process, still not limited to the electrostatic dynamics, is particle trapping which can be seen as an alternative non linear saturation mechanism
of instabilities (in particular streaming instabilities). Electrostatic dynamics is typically studied numerically by coupling the Vlasov equation with the Poisson equation often assuming the ions just as a fixed neutralizing background of density $n_{_0}$ because of the fast time scale of the electron dynamics. Limiting to the 1D-1V case and assuming periodic boundary conditions for the sake of simplicity, the system of equations reads:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:Ves}
\frac{\partial f}{\partial t} + v \frac{\partial f}{\partial x} + E \frac{\partial f}{\partial v} = 0
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:poiss}
\nabla^2 \phi = (n - n_{_0})\end{equation}
\[
n = \int f dv \,; \;\;\;
E = - \nabla \phi
\]
%%%%%%%%%%%%%%%%%%%%%%%%
\noindent
Here we have normalized all quantities using electron characteristic quantities, the plasma frequency $\omega_{pe}$, the
Debye length $\lambda_{_D}$, and a characteristic electric field ${\bar E} = m v_{th,e} \omega_{pe} / e$ where $v_{th,e}$ is the thermal velocity of the electrons.
%Furthermore, $n = \int f dv$ and $E = - \nabla \phi$.
To solve numerically the above equations only the d.f. needs to be initialized, $f(x, v, t=0)$ depending on the problem to be studied. The electric field is given by the Poisson equation once $n (t=0)$ has been calculated by the integral of the d.f., i.e. the zero moment of $f$. In the case of open boundary conditions instead, the Vlasov equation, Eq.~(\ref{eq:Ves}), must be coupled to the Ampere equation, Eq.~(\ref{eq:maxwe}). This is an evolving equation for the electric field (in normalized units)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:amp}
\frac{\partial E}{\partial t} = - j
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
where $j$ is the electron current calculated as the first moment of the d.f. The Ampere equation must be used when dealing with open boundary conditions because using the Poisson equation one would instantaneously propagate any (unavoidable) numerical error at the boundary, see e.g. Ref. \cite{cal2005}. However in this case the initial electric field $E(x, t=0)$ must be properly set according the initialization of the d.f. in order to satisfy the Poisson equation at $t=0$.
%It is worth noticing that to properly treating the open boundary conditions for the d.f. depends on the chosen algorithm.
Starting from the electron characteristic time of order of one in dimensionless units, $\tau_e = \omega_{pe}^{-1}$,
the other two basic characteristic times characterizing the electrostatic regime are the Landau time, $\tau_{_L} = \gamma_{_L}^{-1}$, where $\gamma_{_L}$ is
the Landau damping rate, and the particle bouncing time, $\tau_{_B} = \omega_{_B}^{-1}$ with $\omega_{_B} = (k E_k)^{1/2}$ (still in dimensionless units).
Here $k$ and $E_k$ are the wave number and the wave amplitude of a given fluctuation (typically a Langmuir wave). Analytically, one must solve the linearized Vlasov Poisson system\footnote{To linearize the Vlasov Poisson system one typically claims that $\delta f \ll f_{_0}$ while what is actually assumed is
$\partial_v \delta f \ll \partial_v f_{_0}$. Since $\delta f$ evolves rapidly generating steeper and steeper velocity gradient in phase space while the velocity gradient of
the initial d.f. is fixed, after some time this assumption is no longer valid even if $\delta f \ll f_{_0}$ is still satisfied as, for instance, for a plasma wave.} which, in the Fourier space, corresponds to find the zero in the complex plane of the dielectric function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:VPFT}
D(k, \omega) = 1 + \frac{\omega_{pe}^2}{k} \int_{-\infty}^{\infty} \frac{\partial f_{_0} / \partial v}{\omega - k v} dv
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
where $\omega = \omega_r + i \gamma$ is the complex frequency and $\omega = k v$ corresponds to the poles. Analytically, the dispersion relation $D(k, \omega) = 0$ can be solved only in
the limit $\omega \simeq {\cal R}e (\omega)$, i.e. for $\omega_r \gg \gamma$ corresponding to the weakly damped regime:
%%%%%%%%%%%%%%%%%%%%%%
\[
D(\omega) \simeq D_r(\omega_r)
+ i \gamma \left( \frac{\partial D_r}{\partial \omega}\right)_{\omega=\omega_r}
+ i \, \left\{ D_i(\omega_r) + i \gamma \left(\frac{\partial D_i }{\partial \omega}\right)_{\omega=\omega_r}\right\} = 0
\]
%%%%%%%%%%%%%%%%%%%%%%
Since we assumed $\gamma \ll \omega_r$ we get
%%%%%%%%%%%%%%%%%%%%%%
\[ D_r(\omega_r) \simeq 0 \]
where $\gamma \partial D_i / \partial \omega$ has been neglected because both $\gamma$ and $D_i$ are assumed small with respect to $D_r$ (the velocity gradients are ``gentle'' in the vicinity of the phase velocity). The imaginary part gives:
%%%%%%%%%%%%%%%%%%%%%%
\[
\gamma = - \frac{D_i(\omega_r)}{\partial D_r (\omega) / \partial \omega}
\]
%%%%%%%%%%%%%%%%%%%%%%
Finally, by defining ${\cal P}$ as the Cauchy principal value, we obtain:
%%%%%%%%%%%%%%%%%%%%%%
\[
D_r(k, \omega) = 1 + \frac{\omega_{pe}^2}{k} {\cal P} \int \frac{\partial f_{_0} / \partial v}{\omega - k v} dv \,; \;\;\;
D_i(k, \omega) = - \pi \frac{\omega_{pe}^2}{k} \frac{\partial f_{_0}}{\partial v}
\]
%%%%%%%%%%%%%%%%%%%%%%
We take an initial 1D-1V Maxwellian velocity distribution,
%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:1DMaxw}
f_{_0} = (2 \pi v_{th,e})^{-1/2} exp [- v^2 / 2 \pi v_{th,e}^2]
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%
and assume (which could be questionable) that the phase velocity is much larger than the electron thermal velocity. Then,
the integral can be evaluated explicitly and one gets the following plasma waves dispersion relation (see Ref. \cite{krall} for the full theory):
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\omega_r \simeq \omega_{pe} \left (
\begin{equation}\label{eq:PW}
\omega_r \simeq \omega_{pe} \left [ 1 + \frac 3 2 (k \lambda_{_D})^2 \right ] \,; \;\;\;\;
\gamma \equiv \gamma_{_L} = - \sqrt{\frac{\pi}{8}} \frac{\omega_{pe}}{(k \lambda_{_D})^3} e^{- \left (\frac{3}{2} + \frac{1}{2 k^2 \lambda_{_{_D}}^2} \right )}
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The plasma waves dispersion relation, Eq.~\ref{eq:PW}, has been obtained in the limit $c_{ph} \gg v_{th,e}$ (where $c_{ph}$ is the phase velocity) which corresponds to
the limit $k \lambda_{_D} \ll 1$. In this limit the time scale of the oscillation is much shorter than the damping time,
$\tau_e \simeq 1 / \omega_{pe} \ll \tau_{_L} = 1 / \gamma_{_L}$ thus satisfying {\em a posteriori} the starting hypothesis of ``weak'' damping.
Landau damping is a linear mechanism where electrons traveling at nearly the same speed of
the wave can be accelerated or decelerated efficiently.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[!ht]
\center
\includegraphics[scale=0.4]{fig_chapter8/fig3a.png}
\includegraphics[scale=0.32]{fig_chapter8/fig3b.png}
\caption{The electric field oscillation by a plasma wave {\em vs.} time. Upper frame: undamped plasma wave, $k \lambda_{_D} = 0.125$.
Bottom frame: Damped plasma wave, $k \lambda_{_D} = 0.6$.}
\label{fig:3}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Since the mechanism is collisionless, the energy of
the electrons is not really damped but transferred and stored into small scale oscillations of the d.f. In Fig.~\ref{fig:3} we show an example of a 1D-1V simulation of a plasma wave made by taking a Maxwellian initial d.f., Eq.~(\ref{eq:1DMaxw}),
supporting a sinusoidal fluctuation of wave number normalized to the Debye length much smaller than one, $k \lambda_{_D} =0.125$, left frame, or order one,
$k \lambda_{_D} =0.6$, right frame. We see in the first case that the wave is undamped, as expected, while a weak damping is observed in
the second case with a damping rate in excellent agreement with the theoretical estimation. For smaller wavelengths closer to the Debye length, the damping rate
increases while the analytical estimation (that assumes $c_{\phi} \gg v_{th,e}$) of the damping rate becomes less and less accurate. Particles with a kinetic
energy less than the potential energy of the wave will bounce back and forth into the potential well if the wave is damped more slowly than the bouncing time.
This bouncing (or trapping) effect can be estimated roughly as follows. Let us assume a plasma wave given by
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\[
E(x,t) = \epsilon sin(kx - \omega t) \,; \;\;\;\; \phi(x,t) = (\epsilon /k) cos(kx - \omega t)
\]
damped on a characteristic time $t_{_L} = 1 / \gamma_{L}$. An electron moving at nearly $c_{ph}$ sees, in the wave reference frame, a quasi-stationary
electrostatic field. As a result, the motion equation for the electron is given by
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\[
m \frac{d^2 x}{dt^2} = -e \epsilon sin(kx) \simeq -e \epsilon kx \;\;\; \rightarrow \;\;\; T = \frac{1}{2\pi} \sqrt{\frac{m}{e k \epsilon}} = \frac{2\pi}{\omega_{_B}}
\]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
where $\omega_{_B}$ is the bouncing frequency and $T$ the period (assuming the regime $kx \ll 1$, i.e. $k \lambda_{_D} \ll 1$). It can be shown that, by
integrating along the unperturbed trajectory, the bouncing (trapping) time $\tau_{_B} \equiv (m / e k \epsilon)^{1/2}$ corresponds to the characteristic time
for which the velocity derivative of the d.f. perturbation, $\partial (\delta f) / \partial v$, becomes of the same order as the velocity derivative of the initial Maxwellian,
$\partial f_{_0} / \partial v$ \cite{krall}. This is consistent with the fact that once the particle starts to be trapped, its trajectory is completely changed with respect to
its initial state of a free traveling particle, in other words it corresponds to the transition to a non linear regime. This process can be studied numerically with a great accuracy by Eulerian Vlasov code (see \cite{brun2000} and references therein) and summarized as follows.
Once particles start to be trapped, the d.f. develops a
plateau around the resonant velocity ($c_{ph}$) and Landau damping stops since $\partial f_{_0} / \partial v$ becomes locally null. In this case the wave amplitude, initially
damped for $t < \tau_{_B}$, remains constant without being damped anymore. The resulting particle trapping corresponds to harmonic-like oscillations of
the particles in phase space leading the d.f. to form vortex like structures, a process known as {\em nonlinear Landau damping}. In Fig.~\ref{fig:4} we show a typical phase space vortex-like structure forming as soon as the nonlinear Landau damping comes into play, a clear signature of particles oscillating in phase space. More precisely, the figure is a zoom
in the ($x,v$) phase space of the shaded iso-contours of the d.f. around the resonant velocity. We see that the corresponding isolines of the d.f. are wrapped more and more but remain quite well separated even if some numerical dissipation on the grid scale length is at play because the velocity gradient scale became of
the order of the grid mesh size.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[!ht]
\center
\includegraphics[scale=0.45]{fig_chapter8/fig4.png}
\caption{Zoom of the shaded iso-contours of the distribution function in phase space around the resonant velocity resulting from a nonlinear Landau damping process}
\label{fig:4}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
For this reason, it appears on the large scale as a closed vortex with well defined separatrix\footnote{The separatrix is a curve in phase space separating two distinct dynamical behavior as, for instance, trapped particles inside a phase space vortex and free streaming particles outside. In the case of a plasma wave in the wave reference frame, trapped and free-streaming particles are those with kinetic energy less or greater than the wave potential energy.}. The numerical diffusion at
the grid scale length is unavoidable (and it would have been physical in any case since the increasing of the velocity gradient proceed at an exponential rate \cite{gale05}) and corresponds to a violation of the Vlasov equation. Such violation is very well visible on the Vlasov invariants as, for example the second or third order invariant, see Eq.~\ref{eq:inv} with $n=2, 3$, which are very useful in Vlasov simulation as a check of the dissipative properties of the system. Indeed, these invariants will stay constant during the Landau damping process and the initial formation of the vortex-like structure in phase space. Then, as soon as the scale length of the fluctuations becomes comparable to the mesh size $\Delta x$, dissipating effects come into play. As a consequence, the invariants start rapidly to decrease till the vortex is formed by the breaking and reconnecting of the d.f. isolines (violation of the Vlasov equation). As soon as the vortex is well formed the invariants stay again perfectly constant in time since phase space vortices correspond to BGK wave solutions \cite{BGK}. These structures are metastable Vlasov equilibria which is the reason why the invariants do not vary anymore.
Finally, we note that phase space vortices driven by particle trapping is a general marker of a saturation process of electrostatic instabilities such as the bump on tail or
the two stream instability, but at play also in the electromagnetic case as for instance for the Current Filamentation instability (often known as the Weibel instability, see next Section). Phase space vortex like structures have been
detected in the solar wind but also in the laboratory mainly in the form of bipolar electric signals and have been proposed as a possible collisionless ``dissipative'' mechanism.
\subsection{Electromagnetic case: The Current filamentation (Weibel) instability} \label{sect:CF}
The current filamentation instability (hereafter CFI) often referred as the Weibel instability (hereafter WI, see below) is an electromagnetic instability that generates a "quasi-static" magnetic field in the presence of two counter propagating electron populations (beams). This instability competes with the electrostatic two-stream instability and dominates when the beam velocity approaches the light speed. The growth rate increases for increasing values of the wave vector and saturates at around $k d_e \simeq 1$, corresponding to wavelengths of the order of the electron skin depth $d_e = c / \omega_{pe}$ (see \cite{cal98} and references therein).
Typically, the initial counter streaming beams configuration is achieved starting first with an electron beam generated by some acceleration process. Then, this beam is "immediately" compensated by a return current produced by the plasma to ensure quasi neutrality. As a result, the initial total current is zero, $n_b {\vec v}_b + n_r {\vec v}_r =0$ (where the index $b$ and $r$ refers to the {\em initial beam} and to the {\em return current}). Mostly in the laser-plasma interaction community (but not only), the CFI has been dubbed as the WI since the physical process underlying the instability development and the resulting magnetic field is very similar. Nevertheless, we recall that the WI is driven by an initial temperature anisotropy while the CFI by an initial electron momentum anisotropy. The development of the CFI is particularly relevant in the context of laser-plasma interaction where it was observed and studied more than twenty years ago, for instance, in the wake of an ultra-intense, ultra-short laser pulse propagating in an underdense plasma \cite{liseikina99}. It became later, together with the WI, very popular also in the Astrophysical context to explain the magnetic field structure observed in collisionless shocks \cite{shockweibelsims,weibelshockexp} or proposed as the mechanism capable of generating the initial magnetic field to be then amplified at cosmological level \cite{cal2002,cosmoweibel}.
The magnetic field generation process driven by the counter propagating beams can be understood as follows. Let's superpose to the initial currents directed along the $y$-axis of a Cartesian reference frame, an infinitesimal perpendicular perturbation with wave vector along the $x$-axis (see Fig.~\ref{fig:5}). The two currents are now infinitesimally displaced one with respect to the other. As a result, the initial perturbation is amplified since two opposite currents tend to repeal each other leading to the development of the instability feed by the energy initially stored in the two beams. The progressive separation of the currents corresponds to the growth of a dipolar magnetic field along the $z$-axis perpendicular to the initial beams and to the wave vector of the initial perturbation. It is worth noticing that the linear stage of the CFI can be in principle described in the framework of a fluid approach (see for example \cite{cal97} and references therein).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[!ht]
\center
\includegraphics[scale=0.4]{fig_chapter8/fig5.png}
\caption{Schematic representation of the current filamentation instability.}
\label{fig:5}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The kinetic study of the basic physics of the CFI and/or the WI can be done using an Eulerian Vlasov approach discussed in Section~\ref{sec:numscheme_hamiltondynamics} limited to a reduced 1D-2V phase space. For beam velocities not exceeding $\sim 0.3 c$ (where c is the speed of the light) relativistic effects can be neglected. The spatial direction is aligned with the most unstable wave vectors and the 2D phase space is the minimum needed for allowing the gyration of the particles around the generated magnetic field. In this configuration the two-stream instability, which develops along the same direction of the beams, is therefore excluded a priori. Furthermore, since the instability develops on the electron time scale, one can assume the ions as a fixed neutralizing background. We assume periodic boundary conditions. By defining $f_e (x, v_x, v_y, t)$ the electron distribution function (hereafter e.d.f.), the full set of equation reads:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\[
\frac{\partial f_e}{\partial t} + {\vec v}_e \cdot \frac{\partial f_e}{\partial \vec x} +
\left( {\vec E} + {\vec v}_e \times {\vec B} \right) \cdot \frac{\partial f_e}{\partial {\vec v}_e} = 0
\]
\begin{equation} \label{eq:CFI}
\frac{\partial {\vec B}}{\partial t} = - \nabla \times {\vec E} \,; \;\;\;\;\;\;\;\;
\frac{\partial {\vec E}}{\partial t} = \nabla \times {\vec B} - {\vec j}
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In the above equations we have normalized all quantities using the electron mass $m_e$, a characteristic particle density $\bar n$, the speed of light c,
the electron plasma frequency $\omega_{pe} = (4 \pi \bar n e^2 / m_e)^{1/2}$ and the characteristic electric and magnetic fields $\bar E = \bar B = m_e c \omega_{pe} / e$. %(where $e$ is the {\em electron charge}).
The initial e.d.f. carrying the two initial counter propagating currents is given by:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\[
f_e (v_x, v_y, t=0) = \frac{1}{\pi u_{_{th}}^2} e^{-(v_x / u_{_{th}})^2} \left[ \mu e^{-[(v_y + u_{_{0,1}})/u_{_{th}}]^2} +
(1 - \mu) e^{-[(v_y + u_{_{0,2}} / u_{_{th}}]^2} \right ]
\]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
where $u_{_{0,1/2}}$ is the beam velocity of the first/second beam, $1/2$ respectively. Furthermore, $\mu \in (0,1)$ represents the beam density asymmetry (symmetric for $\mu = 0.5$) and $u_{_{th}}$ is the thermal velocity which is taken equal for the two beams for the sake of simplicity. We recall that the total electron density is normalized to one. Since the net initial current must be zero, we have $\mu u_{_{0,1}} + (1 - \mu) u_{_{0,2}} = 0$. To initialize the numerical simulation in the simplest way one must set to zero the initial electric field and adding a very small sinusoidal magnetic perturbation along the $z$ direction of the form $\delta b_z = \epsilon sin(kx)$, with $\epsilon \ll 1$. Once the perturbation amplitude grows, the beams start to be deflected more and more in the perpendicular direction, i.e. along $v_x$. The instability saturates kinetically as soon as the gyroradius becomes of the order of $d_e$ since the initial momentum anisotropy is lost.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[!ht]
\center
\includegraphics[scale=0.45]{fig_chapter8/fig6.png}
\caption{Schematic representation of the current filamentation instability development in phase space. Left and middle frame: the e.d.f. at the initial time in the ($v_x , v_y$) and ($x , v_y$) phase space. Right frame: the e.d.f. at saturation in the ($v_x , v_y$) phase space.
[Reprinted from the book: "Eulerian Codes for the Numerical Solution", Chapter 2, Nova Science Publishers, NY, 2011] }
\label{fig:6}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In Fig.~\ref{fig:6} we show a simple sketch of the e.d.f. evolution in the case of the CFI development. In the first and second frame we plot the two initial beams in the ($v_x , v_y$) and ($x , v_y$) phase space. The beams have a mean velocity $u_{_{0,1}} = -0.1$ and $u_{_{0,2}} = 0.2$ normalized to the light speed. The space interval is $L = 12\pi$ in $d_e$ units. The middle picture shows that the beams are homogeneous in space. After the development of the instability the most unstable mode $k \simeq 2\pi$ generate magnetic field peaks around which the "particles" (i.e. the e.d.f.) start to spread leading at saturation (right frame) to a more and more isotropic configuration of the beams in their respective reference frame. A complete analysis of the kinetic saturation of the CFI can be found in \cite{cal98}.
\chapter{Lattice-Boltzmann}
A common technique in fluid dynamics that is not commonly used in astrophysics is the Lattice-Boltzmann technique. In first place the Boltzmann equation is solved, but as we have learned in the previous chapter the Vlasov equation and therefore also the Boltzmann equation are hard to solve numerically. The trick here is to simplify the velocity dimension drastically.
While this technique is rarely used for large scale astrophysical plasma, it is typically used in fluid simulations of flows around rigid bodies (and in this consequence also in satellite simulations).
\section{General scheme}
\begin{minipage}[t]{6cm}
The Boltzmann equation is discretized in order to solve it. A grid in position space is introduced, as well as in velocity space. A two-dimensional space could be discretized using the D2Q9 as shown in this example (details are given in the next section). In the figure the points are position space points, while the arrows represent the probabilities of velocities that are associated with the fluid particle at the grid position.
\end{minipage}
\begin{minipage}[t]{3cm}
Bild Wikipedia
\end{minipage}
Um die Boltzmanngleichung zu lösen, wird sie diskretisiert. Die Diskretisierung erfolgt durch Einführung eines Gitters im Ortsraum, wodurch auch die Geschwindigkeitsrichtungen diskretisiert werden. Somit ist der ganze Phasenraum diskretisiert. Ein zweidimensionaler Raum lässt sich beispielsweise mit dem hier gezeigten D2Q9-Modell diskretisieren. In der Abbildung stellen die Punkte Punkte im Ortsraum dar, während die Pfeile darstellen, wie wahrscheinlich die Geschwindigkeit der Teilchen, die einem Punkt zugeordnet sind in die Richtung des Pfeiles am jeweiligen Punkt auftritt. Ein Fluidpartikel kann pro Zeitschritt an gleicher Stelle bleiben oder sich in den jeweils angrenzenden Zellen des quadratischen Gitters bewegen. Er besitzt daher neun mögliche Geschwindigkeiten c → i {\displaystyle {\vec {c}}_{i}}, wobei der Index i = 0 , … , 8 {\displaystyle i=0,\ldots ,8} die Richtung kennzeichnet.
Der Algorithmus lässt sich in zwei Teilschritte einteilen, deren Reihenfolge fest, aber beliebig ist:
Kollisionsschritt
Strömungsschritt
\bibliographystyle{natdin}
\bibliography{./literatur.bib}
\end{document}