Interpolation shortened

This commit is contained in:
2019-04-21 17:47:48 +02:00
parent b63b9ab299
commit 2e1975b295
+97 -66
View File
@@ -368,7 +368,7 @@ Besides the domain of electrostatic and electromagnetic models there is another
\subsection{Interpolation}
\label{sec:num:interpol}
The previous section only discussed Eulerian quantities on the regular grid.
But the electromagnetic fields act on the Lagranian particles, which requires
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.
@@ -376,17 +376,23 @@ of an interpolation that we will discuss next.
\begin{figure}[h!]
\centering
\includegraphics[width=0.25\hsize]{figure/numerics/interpolation.png}
\caption{Interpolation using the overlap between the cell and the particle, weightes by the shape function}
\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. 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 particle that fall in the
cell are used as a weigth to multiply the field strength at the center of that
cell. Contributions from different cells are then added up to compute the mean
done. As discussed in the last chapter the numerical macroparticle represents
a sample of the phase space with finite extent..
%The computational macro-particle represents a large number of physical
%particles and is thus seen as a chunk of phase space with a density
%distribution over a finite extend.
The fraction of the phase space volume that is located in the cell is used as
a weight for the field strength contribution from that cell.
%The fraction of particle that fall in the cell are used as a weight to multiply
%the field strength at the center of that cell.
Contributions from different
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 .
@@ -401,7 +407,7 @@ W(x) = \int_{-\Delta{x}/2}^{\Delta{x}/2} S(x - x'), \mathrm{d}x' \quad .
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(x_p-(i+1/2)\Delta{x}) \cdot W(y_p - (j+1/2)\Delta{y}) \label{eq:num:Bzinterpol}\quad .
\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
@@ -412,39 +418,52 @@ $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}$.
In principle all these properties are satiesfied by a $\delta$-function. This
use of $S(x) = \delta(x)$ is also refered 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 locaton. 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 \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.
The Cloud-in-Cell efficiently the algorithm by \cite{Birdsall_1968} has a major
step forward in the performance and usefulness of Particle-in-Cell codes. Here
%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 function
that generates that view is given by
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) = \left\{
\begin{array}{ll}
1 & |x|\leq 1/2 \\
0 & \mathrm{else}
\end{array}
\right.
\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\{
\end{array},\quad W_{CIC}(x) = \left\{
\begin{array}{ll}
1-|x| & |x|\leq 1 \\
0 & \mathrm{else}
\end{array}
\right.
\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
@@ -492,45 +511,54 @@ straight forward to calculate and given by
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, higer order. The next step after CIC in this chain is called
$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 continous. This implies that the Fourier transform of it falls faster
towards higher $k$. As \cite{Langdon_1970} showed this correspondes 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.
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 continous derivatives and therefore
Higher order have an increasing number of continuous derivatives and therefore
quicker drop off in Fourier space, but at the cost of each particle interacting
with an increasing number of cells. The smoother fields generated by higher
order shape functions reduce unphysical binary forces between nearby particles
and therefore numerical collisionallity (see \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
and therefore numerical collisionallity\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 approch $r=0$ and follow the approach by
\cite{Ruyten_1993} to obtain a correct density representation, even at the
symmetry axis.
%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 approch $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. This construction leads to codes that
%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
@@ -538,19 +566,22 @@ of different orders to obtain a code that conserves total energy
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 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
comparisions have been made, including \cite{Abe_1986,Kilian_2013} and
\cite{Munoz_2014}. No universal winner has emerged and it is advisable to test
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.
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}
@@ -812,7 +843,7 @@ simple binomial filter to reduce high frequency fluctuations, but it is
possible to tune filters specifically to the problem at hand and get much
better performance.
\subsection*{Initalization and Particle Handling}
\subsection{Initalization and Particle Handling}
\label{subsec:num:init}