Small hard to merge changed
abbreviations, whitespace, empty tex files, etc.
This commit is contained in:
+93
-94
@@ -12,9 +12,8 @@ fields on the grid for one time step. The simulation grid can resolve one, two o
|
||||
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}.
|
||||
cells. How the source terms are calculated is discussed in Sect.~\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
|
||||
@@ -33,7 +32,7 @@ given by the Yee lattice described in \cite{Yee_1966}. Component of the
|
||||
electric field $E_i$ are located at the mid points of edges pointing in
|
||||
coordinate direction $x_i$ whereas magnetic flux components $B_i$ are located
|
||||
at the center of cell phases with have normal vectors pointing in direction
|
||||
$x_i$, as shown in Figure~\ref{fig:num:rot_yee}.
|
||||
$x_i$, as shown in Fig.~\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
|
||||
@@ -41,8 +40,8 @@ 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.
|
||||
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
|
||||
@@ -58,17 +57,17 @@ and $\vec{B}$.
|
||||
\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
|
||||
Gauss's Law in equation~\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
|
||||
magnetic field, equation~\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 time evolution given by these equations will not violate equations~\eqref{eq:num:gauss} and \eqref{eq:num:monopol} if they were satisfied initially.
|
||||
Equations~\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.
|
||||
|
||||
@@ -96,7 +95,7 @@ magnetic field.
|
||||
%%\label{fig:num:rot_yee}
|
||||
%%\end{figure}
|
||||
%%
|
||||
%%As figure \ref{fig:num:rot_yee} illustrates, there is an elegant finite
|
||||
%%As Fig.~\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
|
||||
@@ -107,7 +106,7 @@ magnetic field.
|
||||
%%\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
|
||||
%%suppressed and equation~\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}} +
|
||||
@@ -123,7 +122,7 @@ magnetic field.
|
||||
|
||||
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
|
||||
The temporal derivative in equations~\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
|
||||
@@ -140,7 +139,7 @@ the magnetic field and use
|
||||
\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, solutions are sought after to remove the noise. Increasing particles numbers is typically not an option as the noise level decreases as $1/\sqrt{N}$. For the cause of the noise and properties thereof see for example \cite{Okuda_1972} and \cite[Appendix D]{Shalaby_2017}. Filtering can be applied to either the source term $\vec{\jmath}^{t+1/2}$ so avoid the production of noise or the fields themselves to dampen existing noise. The latter is possible since noise is concentrated at high $k$ values and numerical errors (e.g. dispersion errors) are largest there. This low-pass filtering is described in \cite{Friedman_1990} and changes Eqs.~\eqref{eq:num:B1update} and \eqref{eq:num:B2update}.
|
||||
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, solutions are sought after to remove the noise. Increasing particles numbers is typically not an option as the noise level decreases as $1/\sqrt{N}$. For the cause of the noise and properties thereof see for example \cite{Okuda_1972} and \cite[Appendix D]{Shalaby_2017}. Filtering can be applied to either the source term $\vec{\jmath}^{t+1/2}$ so avoid the production of noise or the fields themselves to dampen existing noise. The latter is possible since noise is concentrated at high $k$ values and numerical errors (e.g. dispersion errors) are largest there. This low-pass filtering is described in \cite{Friedman_1990} and changes equations~\eqref{eq:num:B1update} and \eqref{eq:num:B2update}.
|
||||
|
||||
Since we mentioned of CFL for the first time in the book just two paragraphs
|
||||
ago and it appears in several other chapters let's take a quick look at this
|
||||
@@ -161,7 +160,7 @@ Assuming that there is no initial $B_z^{t-1/2}$ and that $E_y^t$ has the form $A
|
||||
So for the most unstable $k = \pi/\Delta{x}$ -- which is also the highest $k$
|
||||
that can be supported by the grid -- the amplitude has grown after a single
|
||||
timestep by a factor $c^2\,\Delta{t}^2/\Delta{x}^2$. If this factor is larger
|
||||
than unity the time advance will amplify waves exponentially with time. To
|
||||
than unity the time advance will amplify waves exponentially with time. To
|
||||
avoid that we require $\Delta{t} \leq \Delta x/c$. Intuitively this requirement
|
||||
say ``the time step should be short enough that waves don't travel further than
|
||||
one grid cell per step''. Which makes sense since our numerical derivatives
|
||||
@@ -189,12 +188,12 @@ the presence of the particles can be found in standard textbooks such as
|
||||
%%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
|
||||
%%equations~\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
|
||||
%%If desired equation~\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
|
||||
@@ -224,15 +223,15 @@ 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
|
||||
% The equivalent to equation~\eqref{eq:num:rot_yee} reads
|
||||
The right hand side of equation~\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
|
||||
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.
|
||||
|
||||
@@ -303,7 +302,7 @@ 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
|
||||
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}.
|
||||
@@ -323,7 +322,7 @@ given in \cite{Vay_2011}.
|
||||
% Blinne_2018.pdf optimized FTDT stencils
|
||||
|
||||
A different approach is the pseudo-spectral solution of the field equations.
|
||||
As known from e.g. hydrodynamics the partial differential equations in real space
|
||||
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
|
||||
@@ -359,17 +358,17 @@ solvers (\cite{Vay_2013}).
|
||||
%%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
|
||||
%%equation based on Amperes Law (equation~\eqref{eq:num:Eevolution}), but is directly
|
||||
%%calculated from Gauss Law (equation~\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
|
||||
%%equation~\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
|
||||
%%solve equation~\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
|
||||
@@ -381,8 +380,8 @@ For the limit of very small particle velocities (as compared to the speed of lig
|
||||
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}).
|
||||
equation based on Amperes Law (equation~\eqref{eq:num:Eevolution}), but is directly
|
||||
calculated from Gauss Law (equation~\eqref{eq:num:gauss}).
|
||||
This of course limits the electric field to its longitudinal, curl-free component and magnetic fields are no longer time dependent. Intuitively that makes sense as very slow
|
||||
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}). Gauss Law can be solved in higher dimensions using either spectral solvers \cite{Birdsall_2005} or multigrid solvers.
|
||||
|
||||
@@ -411,7 +410,7 @@ particle motion implies very small currents. Historically some of the first Part
|
||||
%%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.
|
||||
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}
|
||||
@@ -450,7 +449,7 @@ 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 .
|
||||
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
|
||||
@@ -463,7 +462,7 @@ codes make different design choices here. B-Splines are commonly chosen, but is
|
||||
The shape function should not include the statistical weight of the macro particle, but rather should to be normalized, i.e.
|
||||
$\int_{-\infty}^{\infty}S(x)\,\mathrm{d}x = 1$ to ensure that the plasma density is correctly represented. The shape function should be symmetric, i.e.
|
||||
$S(-x) = S(x)$, to avoid unphysical self-forces on the particles. To allow efficient evaluation of
|
||||
Eq.~\eqref{eq:num:Bzinterpol}, the shape function should have compact support,
|
||||
equation~\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
|
||||
@@ -561,7 +560,7 @@ 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$.
|
||||
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
|
||||
@@ -606,7 +605,7 @@ enough that a consensus as to their names has emerged.
|
||||
%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, if the shape functions used during interpolation and deposition (see below in section~\ref{subsec:num:depostion}) are identical. Alternatively it is possible to combine shape function
|
||||
conserve total momentum, if the shape functions used during interpolation and deposition (see below in Sect.~\ref{subsec:num:depostion}) are identical. 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
|
||||
@@ -650,7 +649,7 @@ 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
|
||||
this leads to an implicit dependence of equation~\eqref{eq:num:velupdate} on
|
||||
$\vec{v}(t+\Delta{t}/2)$ on both sides.
|
||||
|
||||
%
|
||||
@@ -660,7 +659,7 @@ $\vec{v}(t+\Delta{t}/2)$ on both sides.
|
||||
%$\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
|
||||
%equation~\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.
|
||||
|
||||
@@ -670,7 +669,7 @@ $\vec{v}(t+\Delta{t}/2)$ on both sides.
|
||||
%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
|
||||
%equations~\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.
|
||||
|
||||
@@ -679,7 +678,7 @@ versions, the formulation shall be done using relativistic momentum per rest mas
|
||||
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
|
||||
Equations~\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 \label{eqn:macro_vel} \quad , \\
|
||||
\gamma(t+\Delta{t}/2) &= \sqrt{1 + \frac{\vec{u}(t+\Delta{t}/2) \cdot \vec{u}(t+\Delta{t}/2)}{c^2}} \\
|
||||
@@ -687,11 +686,11 @@ Eqs.~\eqref{eq:num:velupdate} and \eqref{eq:num:posupdate} then read
|
||||
\vec{F}(x(t),v(t)) &= q \left(\vec{E}(x(t)) + \vec{v}(t) \times \vec{B}(x(t))\right) \label{eqn:macro_force} \quad .
|
||||
\end{align}
|
||||
One important thing to note is that the macrofactor $w_p$ cancels
|
||||
Eq.~\eqref{eqn:macro_vel} and Eq.~\eqref{eqn:macro_force}, since both charge
|
||||
between equation~\eqref{eqn:macro_vel} and equation~\eqref{eqn:macro_force}, since both charge
|
||||
$q$ and mass $m$ of a macro particle are increased compared to $q_\alpha$ and
|
||||
$m_\alpha$ of a single physical particle. Positions $\vec{x}$ and velocities
|
||||
$\vec{v}$ are both unscaled. This mean that
|
||||
Equations~\eqref{eqn:macro_vel}-\eqref{eqn:macro_force} apply to physical
|
||||
equations~\eqref{eqn:macro_vel}-\eqref{eqn:macro_force} apply to physical
|
||||
particles and phase space samples in the same way and the dynamics of macro
|
||||
particles in the code can be intuitively interpreted as particle trajectories.
|
||||
|
||||
@@ -718,14 +717,14 @@ into two equal parts performed before and after handling the magnetic field. Usi
|
||||
\end{align}
|
||||
|
||||
It is worth noting that the original algorithm by Boris contains the $\tan$ in
|
||||
Eq.~\eqref{eq:num:tanrotation} and the suggestion to expand it at least up to
|
||||
equation~\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
|
||||
The Lorentz factor $\gamma$ in equation~\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.
|
||||
\cite{Vay_2008} can lead to spurious forces.
|
||||
%and he suggests a more complicated expression.
|
||||
%
|
||||
% He therefor suggests to use
|
||||
@@ -839,9 +838,9 @@ 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
|
||||
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]
|
||||
@@ -898,8 +897,8 @@ as illustrated in Fig.~\ref{fig:num:currentassignment_umeda}% illustrates this m
|
||||
%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
|
||||
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]
|
||||
@@ -939,9 +938,9 @@ better performance.
|
||||
%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
|
||||
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
|
||||
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.
|
||||
@@ -962,7 +961,7 @@ 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
|
||||
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). But beware the possibility of multi-beam and ring instabilities as analysed by \cite{Birdsall_2005}.
|
||||
|
||||
@@ -982,7 +981,7 @@ deviation is set by the thermal speed
|
||||
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.
|
||||
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.
|
||||
@@ -1011,10 +1010,10 @@ 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
|
||||
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
|
||||
@@ -1035,7 +1034,7 @@ In simulations where many new particles are created the algorithm by
|
||||
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
|
||||
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
|
||||
@@ -1092,12 +1091,12 @@ 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
|
||||
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
|
||||
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
|
||||
@@ -1162,7 +1161,7 @@ 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,
|
||||
for the study of larger systems (see \cite{Daughton_2006,
|
||||
Klimas_2008, Ohtani_2009}).
|
||||
|
||||
%Besides the injection of thermal plasma on the boundary
|
||||
@@ -1187,8 +1186,8 @@ methods explained in this book: A huge number of particles and a large number
|
||||
of time steps is required to simulate physically relevant systems. And even
|
||||
then we are not covering macroscopic scales. To increase the maximum size of
|
||||
the problem that can be studied and to reduce the time a scientist has to wait
|
||||
before obtaining results that can be studied parallelization is extremly common
|
||||
and has been used for a long time.
|
||||
before obtaining results that can be studied parallelization is extremely
|
||||
common and has been used for a long time.
|
||||
|
||||
This parallelization can make use of vectorization in the form of
|
||||
single-instruction-multiple-data (SIMD) \cite{Bowers_2008}. Details of this
|
||||
@@ -1213,34 +1212,34 @@ Since the compute power of a single machine is only sufficient for very
|
||||
selected problems and the memory can only hold approximately one billion
|
||||
particles in RAM, it is commonly required to parallelize the code over many
|
||||
nodes. Each node runs one (or more) separate process that communicate with
|
||||
eachother and share the simulation workload. For the communication MPI
|
||||
\cite{Walker_1996} is the defacto standard but recently frameworks have started
|
||||
each other and share the simulation workload. For the communication MPI
|
||||
\cite{Walker_1996} is the de facto standard but recently frameworks have started
|
||||
to appear that take care of threading and communication for the programmer.
|
||||
|
||||
The common way to distribute the workload is to split the simulation domain
|
||||
into smaller local domains (also known as patches or blocks). Each process is
|
||||
then responsible for the particles and fields in that local domain
|
||||
\cite{Pfund_1998, Plimpton_2000, Qiang_2000, Messmer_2001, Qiang_2010}. The
|
||||
state of the electromagnetic field in neighbouring domains is then copied into
|
||||
state of the electromagnetic field in neighboring domains is then copied into
|
||||
ghost zones that surround the local domain and act as boundary
|
||||
conditions\footnote{The reason why this works efficiantly is that the the
|
||||
conditions\footnote{The reason why this works efficiently is that the
|
||||
particle shape function have only compact support and the field update only
|
||||
requiring neighboring cells. However with extra effort domain decomposition can
|
||||
also be applied to spectral solvers\cite{Vay_2013}.}. Particles that hit the
|
||||
boundary of the local domain are communicated to the neighbouring process,
|
||||
also be applied to spectral solvers\cite{Vay_2013}.}. Particles that hit the
|
||||
boundary of the local domain are communicated to the neighboring process,
|
||||
inject from the wall there and are removed from the local domain.
|
||||
Particle-in-Cell codes tend to parallelize very efficiently using this method
|
||||
since only communication with a handfull of neighbors is required and global
|
||||
since only communication with a handful of neighbors is required and global
|
||||
all-to-all messaging can be nearly completely avoided. The only caveat is that
|
||||
efficiency only remains high as long as all processes have fairly balanced
|
||||
workloads. If the setup starts unbalanced (e.g. because of a bad decomposition
|
||||
or because of inhomogeneous plasma density) or develops load imbalances over
|
||||
the course of the simulation (typically in reconnection simulations when
|
||||
plasmoids are generated, or shock simulations where the downstream has higher
|
||||
density than the upstream) the parallelization efficancy drops. One can attempt
|
||||
to improve load balance the simulation by imoving the boundaries between local
|
||||
density than the upstream) the parallelization efficiency drops. One can attempt
|
||||
to improve load balance the simulation by moving the boundaries between local
|
||||
domains and making additional grid cells and particles the responsibility of
|
||||
less loaded processes, but this requires much more complicated code and incures
|
||||
less loaded processes, but this requires much more complicated code and incurs
|
||||
additional costs.
|
||||
|
||||
An alternative to splitting the global domain into rectangular or brick-shaped
|
||||
@@ -1251,11 +1250,11 @@ the space filling curve has the properties that grid cells that are close to
|
||||
each other along the curve are also mostly close to each other in the full 2d
|
||||
or 3d space. When the curve is then cut into segments to be distributed across
|
||||
processes the cells of each process tend to be close to each other. For most of
|
||||
it's grid cells the process also owns the neighbouring field values and can use
|
||||
it's grid cells the process also owns the neighboring field values and can use
|
||||
those without additional communication. Moving particles that enter another
|
||||
grid cell are likely to stay with the same process. If they do leave they are
|
||||
communicated to the correct neighboruing process same as in the case with patch
|
||||
based domain decomposition. The big upside is that the segments of the space
|
||||
communicated to the correct neighboring process same as in the case with patch
|
||||
based domain decomposition. The big upside is that the segments of the space
|
||||
filling curve do not have to be equally long and can be rebalanced more easily.
|
||||
|
||||
\subsection{Diagnostics}
|
||||
@@ -1277,24 +1276,24 @@ particles is several terabytes. Saving the simulation state for later analysis o
|
||||
|
||||
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
|
||||
that can be post-processed 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
|
||||
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 local domain (in a simulation that uses domain decomposition and MPI) 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 local 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
|
||||
require any extra calculation. The two most widely used choices are dumping
|
||||
the memory of every local domain (in a simulation that uses domain decomposition and MPI) 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 local 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
|
||||
@@ -1315,7 +1314,7 @@ 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
|
||||
wall-clock 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
|
||||
@@ -1357,12 +1356,12 @@ 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
|
||||
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.
|
||||
@@ -1397,7 +1396,7 @@ analytic solutions is rather small.
|
||||
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}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user