Fixes as discussed on zoom
mostly typos and grammar.
This commit is contained in:
+55
-55
@@ -28,7 +28,7 @@ Non-rectangular grids are discussed in the review \cite{Meierbachtol_2015}.
|
||||
Particle-in-Cell codes commonly use a finite difference formulation based on
|
||||
the electromagnetic fields. Codes that use the scalar electrostatic potential and
|
||||
magnetic vector potential also exist \cite{Daughton_2006, Eremin_2013} but are less common. A finite element view of the fields was considered in \cite{Eastwood_1991} but leads to a non-local matrix equation for the fields. Lumping spatial and temporal averaging operators reduces the scheme to the same expressions that are obtained from the finite difference formulation. The typical arrangement of field samples in this finite difference formulation is
|
||||
given by the Yee lattice described in \cite{Yee_1966}. Component of the
|
||||
given by the Yee lattice described in \cite{Yee_1966}. Components 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
|
||||
@@ -47,7 +47,7 @@ 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 widely used in
|
||||
Particle-in-Cell codes as they make the magnitude of electric and magnetic
|
||||
components similar. (Of course codes in SI units such as EPOCH \cite{Arber_2015} or codes that treat the problem completly in dimensionless units such as VPIC \cite{Bowers_2008,Seaton_2020} also exist.) Since we treat all material effects due to the plasma
|
||||
components similar. (Of course codes in SI units such as EPOCH \cite{Arber_2015} or codes that treat the problem completely in dimensionless units such as VPIC \cite{Bowers_2008,Seaton_2020} also exist.) 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}$.
|
||||
@@ -64,7 +64,7 @@ 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}
|
||||
\frac{\partial \vec{E}}{\partial t} &= \phantom{-} c \nabla \times \vec{B} - 4 \pi \vec{\jmath} \label{eq:num:Eevolution}
|
||||
\end{align}
|
||||
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
|
||||
@@ -141,11 +141,11 @@ the magnetic field and use
|
||||
|
||||
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
|
||||
Since we mentioned 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
|
||||
satbility condition that is quite common in explicit schemes (see Chapter~8 on
|
||||
stability condition that is quite common in explicit schemes (see Chapter~8 on
|
||||
how to avoid this limitation using implicit schemes) and is named after
|
||||
Courant, Friedrichs and Lewy. For simplicity let's analyse the case where there
|
||||
Courant, Friedrichs and Lewy. For simplicity let's analyze the case where there
|
||||
is no current $\vec{\jmath}$ and where fields can vary only in $x$ and $t$. In
|
||||
that case equations~\eqref{eq:num:B1update}-\eqref{eq:num:Eupdate} for $E_y$
|
||||
and $B_z$ reduce to
|
||||
@@ -164,8 +164,8 @@ 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
|
||||
only consider neighbouring cells. The simplified analysis shown here can be
|
||||
generalized to allow propogation also in $y$ and $z$ in which case we will find
|
||||
only consider neighboring cells. The simplified analysis shown here can be
|
||||
generalized to allow propagation also in $y$ and $z$ in which case we will find
|
||||
the condition given above. In other plasma models other waves might be the most
|
||||
unstable modes, e.g. Whistler waves in many hybrid-kinetic codes or
|
||||
fast-magneto-sonic waves in MHD, typically because the light wave considered
|
||||
@@ -232,7 +232,7 @@ The right hand side of equation~\eqref{eq:num:Bevolution} now reads
|
||||
& - \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
|
||||
\cite{Fang_1989}. For typical PiC simulations with marginally stable time steps
|
||||
the gain in accuracy is negligible compared to the computational cost.
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ the gain in accuracy is negligible compared to the computational cost.
|
||||
%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
|
||||
second order, but with a smaller constant in front of the error term. Many such
|
||||
non-standard finite-difference (NSFD) schemes have been investigated over the
|
||||
years.
|
||||
|
||||
@@ -429,7 +429,7 @@ of an interpolation that we will discuss next.
|
||||
|
||||
Fig.~\ref{fig:num:interpolation} illustrates how the interpolation from grid
|
||||
quantities (magnetic field $B_z$ in this case) to the particle location is
|
||||
done. As discussed in the last scetion the numerical macroparticle represents
|
||||
done. As discussed in the last section the numerical macroparticle represents
|
||||
a sample of the phase space with finite extent and a macrofactor, or (statistical) weight $w_p$ 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
|
||||
@@ -449,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
|
||||
@@ -458,18 +458,18 @@ cell we can write the two-dimensional interpolation as
|
||||
\end{equation}
|
||||
|
||||
Many different choices for the shape function $S$ are possible and different
|
||||
codes make different design choices here. B-Splines are commonly chosen, but is not the only family of function that satiesfies the following requirements:
|
||||
The shape function should not include the statistical weight of the macro particle, but rather should to be normalized, i.e.
|
||||
codes make different design choices here. B-Splines are commonly chosen, but is not the only family of function that satisfies the following requirements:
|
||||
The shape function should not include the statistical weight of the macro particle, but rather should 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
|
||||
equation~\eqref{eq:num:Bzinterpol}, the shape function should have compact support,
|
||||
i.e. be non-zero only up to some small $x_{max}$.
|
||||
i.e. be non-zero only up to some small $x_{max}$ to limit the sum to only go over a few grid cells.
|
||||
|
||||
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.
|
||||
shape function switches from one cell to another when the interface between those cells 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
|
||||
@@ -582,14 +582,14 @@ 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
|
||||
Higher orders 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
|
||||
Otherwise orders 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
|
||||
@@ -608,7 +608,7 @@ This construction leads to codes that
|
||||
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
|
||||
\cite{Bowers_2008}) that mixes 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.
|
||||
@@ -647,8 +647,8 @@ Similar to the leap-frog procedure for the electromagnetic fields the particle's
|
||||
|
||||
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
|
||||
there is dependence on $\vec{v}(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)$ solves this problem to second order, but
|
||||
this leads to an implicit dependence of equation~\eqref{eq:num:velupdate} on
|
||||
$\vec{v}(t+\Delta{t}/2)$ on both sides.
|
||||
|
||||
@@ -709,16 +709,16 @@ 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{\Omega} &= \tan{\left(\frac{q}{\gamma\,m}|\vec{B}(t)|\frac{\Delta{t}}{2}\right)}\frac{\vec{B}(t)}{|\vec{B}(t)|} \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
|
||||
It is worth noting that the original algorithm by Boris contains the \textit{tan} in
|
||||
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
|
||||
fourth order if it is too expensive to compute \textit{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.
|
||||
|
||||
@@ -758,8 +758,8 @@ can be found in \cite{Ripperda_2018} or \cite{Zenitani_2018}.
|
||||
|
||||
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
|
||||
distribution $\rho$ resulting from the new locations of the particles, or -- in the
|
||||
case of an electromagnetic code -- the current density distribution $\vec{\jmath}$. 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
|
||||
@@ -775,14 +775,14 @@ The sum is taken over all particles, multiplying their charge $q_p$ (which is gi
|
||||
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.
|
||||
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
|
||||
@@ -821,8 +821,8 @@ 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
|
||||
the longitudinal part of the electric field correct. It is computationally cheaper
|
||||
and very effective 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}.
|
||||
|
||||
@@ -839,7 +839,7 @@ 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
|
||||
scheme needs to branch to different algorithms its use on GPU is
|
||||
disadvantageous as branching is computationally more expensive there. Additionally
|
||||
this scheme is tedious to extend to shape functions beyond CIC.
|
||||
|
||||
@@ -898,7 +898,7 @@ as illustrated in Fig.~\ref{fig:num:currentassignment_umeda}% illustrates this m
|
||||
%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
|
||||
computational cost and noise-properties between the latter two deposition schemes
|
||||
is similar.
|
||||
|
||||
% \begin{figure}[htbp]
|
||||
@@ -938,7 +938,7 @@ 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 also 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
|
||||
@@ -953,7 +953,7 @@ case we can pick the initial position of the particle at random using
|
||||
\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 \mbox{(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 reduced the fluctuations in the number of particles per cell and also makes it easy to represent
|
||||
the position inside the cell at random. This eliminates the fluctuations in the number of particles per cell and 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
|
||||
@@ -963,7 +963,7 @@ 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). But beware the possibility of multi-beam and ring instabilities as analysed by \cite{Birdsall_2005}.
|
||||
$\mathcal{O}(1/N)$ with the particle number. Adding more particles at random 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}.
|
||||
|
||||
The non-relativistic Maxwellian distribution is simply the composition of three
|
||||
velocity components that individually follow a normal distribution:
|
||||
@@ -1011,7 +1011,7 @@ 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
|
||||
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.
|
||||
@@ -1053,7 +1053,7 @@ momentum and energy.
|
||||
\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
|
||||
boundary and proper care has to be taken 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.
|
||||
@@ -1066,7 +1066,7 @@ 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.
|
||||
points 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.
|
||||
@@ -1170,7 +1170,7 @@ 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{Thiele_2016, Ardaneh_2020}), 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.
|
||||
|
||||
@@ -1186,16 +1186,16 @@ 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 extremely
|
||||
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
|
||||
depend on the platform that the code targets (CPUs, GPUs, accelerator cards and
|
||||
so on). The recent arrival of performance portability frameworks such as Kokkos
|
||||
\cite{Edwards_2014} or RAJA \cite{Beckingsale_2019} are changing the codes from
|
||||
\cite{Edwards_2014} or RAJA \cite{Beckingsale_2019} is changing the codes from
|
||||
carefully formulated C++ and Fortran codes that can be vectorized by the
|
||||
compiler and handwritten assembler primitives to higher level of abstraction.
|
||||
compiler and handwritten assembler primitives to higher levels of abstraction.
|
||||
While good reference literature on the topic is rare, the field is changing too
|
||||
rapidly for us to give good advice that will still be relevant in one or two
|
||||
decades.
|
||||
@@ -1213,7 +1213,7 @@ 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
|
||||
each other and share the simulation workload. For the communication MPI
|
||||
\cite{Walker_1996} is the de facto standard but recently frameworks have started
|
||||
\cite{Walker_1996} is the de facto standard but recently frameworks \cite{Bauer_2012} 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
|
||||
@@ -1237,7 +1237,7 @@ 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 efficiency drops. One can attempt
|
||||
to improve load balance the simulation by moving the boundaries between local
|
||||
to improve load balance in 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 incurs
|
||||
additional costs.
|
||||
@@ -1250,7 +1250,7 @@ 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 neighboring field values and can use
|
||||
its 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 neighboring process same as in the case with patch
|
||||
@@ -1260,7 +1260,7 @@ filling curve do not have to be equally long and can be rebalanced more easily.
|
||||
\subsection{Diagnostics}
|
||||
\label{subsec:num:diag}
|
||||
|
||||
Designing and using a Particle-in-Cell code is interesting by itself, the ultimate
|
||||
Designing and using a Particle-in-Cell code is interesting by itself, but 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.
|
||||
@@ -1286,8 +1286,8 @@ 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
|
||||
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
|
||||
@@ -1357,7 +1357,7 @@ 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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user