Shortened Test Cases, Diagnostics

This commit is contained in:
2019-04-22 23:27:54 +02:00
parent 405c36dfb2
commit d1391efd45
+104 -77
View File
@@ -1072,46 +1072,48 @@ with these boundary conditions is that they
rely on fixed waves speeds. The presence of the plasma changes the wave speed. 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, %from the speed of light to a lower speed that might depend on wavelength,
%incident angle and plasma parameters such as the magnetizations %incident angle and plasma parameters such as the magnetizations
This makes is This makes it very hard to absorb all wave modes that reach the boundary sufficiently well.
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 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 Layer} (PML) by \cite{Berenger_1994}. This layer is technically not a boundary
condition, but rather a region of space with modified permeability and condition, but rather a region of space with modified permeability and
permitivity. These material properties are choosen such that the impedance of permittivity. These material properties are chosen such that the impedance of
the material is identical to the adject free space. Therefore the refractive the material is identical to the adjacent free space. Therefore the refractive
index does not change from free space to the material layer and now waves are 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 reflected. Inside the material the wave is however damped, attenuating before
it reaches the actual boundary. There a simple boundary condition such as PEC it reaches the actual boundary. There a simple boundary condition such as PEC
can be chosen. And wave that does reach the boundary and gets reflected is 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 attenuated a second time on the way out, greatly improving performance of this
scheme. Several different formulations of PML have been developed such as scheme.
split-PML (where each electric and magnetic field component inside the boundary %Several different formulations of PML have been developed such as
is split into two independent, unphysical fields that are damped separately), %split-PML (where each electric and magnetic field component inside the boundary
uniaxial PML (UPML) and more general stretched-coordinate PML wave been %is split into two independent, unphysical fields that are damped separately),
developed. One version known as convolutional PML (CPML) has been used %uniaxial PML (UPML) and more general stretched-coordinate PML wave been
successfully in multiple coes. The book \cite{Berenger_2007} explains the %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. different methods and their connections.
Even before the development of these methods was completed, PML conditions were %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}. %used in Particle-in-Cell simulations, see e.g. \cite{Pasik_1999, Pukhov_1999}.
PML boundary conditions are often combined with particle boundaries that absorb PML boundary conditions are often combined with boundaries that absorb
outgoing particles and replace them in some scheme to simulate the presence of a 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 thermal plasma bath outside the simulation domain that can act as the source of
unperturbed upstream. This has been used in particular in the simulation of unperturbed upstream. This has been used in the simulation of
magnetic reconnection, where the removal of plasma in the outflow regions and magnetic reconnection, where the removal of plasma in the outflow regions and
the injection of fresh upstream with not-yet-reconnected magnetic flux allows the injection of fresh upstream with not-yet-reconnected magnetic flux allows
for the study of larger systems and long time effects (see \cite{Daughton_2006, for the study of larger systems (see \cite{Daughton_2006,
Klimas_2008, Ohtani_2009}). Klimas_2008, Ohtani_2009}).
Besides the injection of thermal plasma on the boundary it is also possible to %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 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 achieved by the means of an artificial current, acting as an antenna or by
manipulating the electromagnetic field directly. More complicated inject manipulating the electromagnetic field directly. More complicated injection
schemes that allow for the injection of realistic laser pulses schemes that allow for the injection of realistic laser pulses
(\cite{Thiele_2016}), of oblique waves with arbitrary envelops (\cite{Thiele_2016}), of oblique waves with arbitrary envelops
(\cite{Perez_2018}) or of magnetized plasma without unwanted numerical noise (\cite{Perez_2018}) or of magnetized plasma without unwanted numerical noise
(\cite{Kilian_2018}) are possible as well, but require a bit of care. (\cite{Kilian_2018}) are possible as well.%, but require a bit of care.
% Eliasson_2002.pdf outflow condition for fourier transformed vlasov-poison system % Eliasson_2002.pdf outflow condition for fourier transformed vlasov-poison system
@@ -1121,50 +1123,48 @@ schemes that allow for the injection of realistic laser pulses
As much fun as it can be to write and run a Particle-in-Cell code, the ultimate As much fun as it can be to write and run a Particle-in-Cell code, the ultimate
goal is to produce output that can be used to gain understanding of the goal is to produce output that can be used to gain understanding of the
physical system. This requires the calculation of diagnostic quantities and physical system. This requires the calculation of diagnostic quantities and
storing them in a way that persists beyond the duration of the simulation. As storing them in a way that persists beyond the duration of the simulation.
tempting as it might be to simply save the complete state of the simulation and %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 %use later post-processing to produce higher-level diagnostics and plots, it is
usally a bad idea from a performance standpoint. Whenever possible the %usually a bad idea from a performance standpoint.
simulation code should calculate diagnositics as close to the final plots and Simply storing the full state of the simulation is typically impossible for
output only them. After all, a simple histogram for a velocity distribution performance reasons.
might only be a few kilobytes, where the dump of all particles is serval Whenever possible the simulation code should calculate diagnostics as close
terabytes. Saving the simulation state for later analysis or restart might to the final plots and output only them. After all, a simple histogram for
still be necessary but should be performed as rarely as possible. 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 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 all of them. This section will therefore mostly cover general-purpose output
that can be postprocessed further. 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.
To gain high-level insight into the simulation at low I/O cost it is often Another obvious candidate for output are gridded quantities, such as
useful to calculate a breakdown of the energy content in the simulation in electric and magnetic field as well as current density. These quantities do not
several rough categories, such as the energy in the electric field, the energy require any extra calculation, but their size requires a binary output. The two most widely used choices are dumping the memory of every
in the magnetic field and in the particles.
Another obvious candidate for output are all the gridded quantities, such as
electric and magnetic field as well as current density. These quantites do not
require any extra calculation, but there size prohibits writing them out as
text files. 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 MPI domain to a separate binary file or writing a global view to a structured
format such as HDF5. The first choice has the advantage of very little format such as HDF5. The first choice has the advantage of very little
overhead, even is a small header is included. The downside is that the separate overhead. The downside is that the separate views of the different domains
views of the different doamins need to combined for further analysis. The need to be combined for further analysis. The overhead of creating many
overhead of creating many files in the same directory at once and the tedious files at once and the tedious
file handling make this alternative an increasing poor choice once the file handling make this alternative a poor choice for more than a few hundred cores. Parallel I/O to HDF5 requires
simulation used 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 slightly more complicated I/O code and introduces some overhead, but allows for
the inclusing of meta-data and easy loading into analysis tool, independend of the inclusion of meta-data and easy loading into analysis tool, independent of
programming language and CPU architecture. programming language and CPU architecture.
Other field data that need to be computed just for diagnostic purposes such as 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 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 pressure tensor can also be good choices for grid based output. Even if many of
these quantities are required it is typically cheaper to computer the these quantities are required it is typically cheaper to compute the
diagnostics during the parallel simulation instead of dumping the full particle diagnostics during the parallel simulation instead of dumping the full particle
information and doing post-processing. information and doing post-processing.
In many cases not all of the three-dimensional field data is required. 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 Averaging over one or two dimensions to obtain line profiles or two-dimensional
selections is an option. Alternatively lineouts or two-dimensional cuts can be 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 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 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 cadence. If a global overview is needed, but not the full resolutions, it is
@@ -1173,76 +1173,103 @@ low-pass filter -- such as a Kaiser window \cite{Kaiser_1980} -- before the
decimation to avoid aliasing. decimation to avoid aliasing.
In some cases it is necessary to restart the code, either due to reaching a In some cases it is necessary to restart the code, either due to reaching a
wallclock limit, or due to a compute node crashing (this is actually an wallclock limit, or due to a compute node crashing. Also some analysis can
increasing problems with supercomputers pushing the 10000 limit and
mean-time-between-failures measured in days at best). Also some analysis can
only be performed as post-processing, either due to poor scalability or because 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, it is actively being developed based on the simulation results. In this case,
the pull particle information needs to be stored. Again direct binary dumps or 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 higher-level self-describing formats are the two main possibilities. Some codes
even implement both, the high-level format for scientific analysis and binary even implement both, the high-level format for scientific analysis and binary
dumps that are overwritten periodically as faster checkpoints that are only dumps that are overwritten periodically as faster checkpoints that are only
used for restarts. used for restarts.
Many other diagnostics have been developed and the following list of examples Many other diagnostics have been developed and the following list of examples
is certainly incomplete: one-dimensional histogramms of particle quantities is certainly incomplete: one-dimensional histograms of particle quantities
such as speed or energy, two-dimensional cuts in phasespace showing e.g. (speed, energy), two-dimensional cuts in phase space showing e.g.
$x-v_x$-densities, fourier transforms of other quantites such as $x-v_x$-densities, Fourier transforms of other quantities such as
$\tilde{B}(|k|)$, time averages of other quantities to remove high-frequency $\tilde{B}(|k|)$, time averages of other quantities to remove high-frequency
noise, trajectories of specially selected particles of interest, often together noise, trajectories of specially selected particles of interest, often together
with local field quantities at the position of the tracer particles, with local field quantities at the position of the tracer particles,
reconstruction of the particle phasespace density on a six-dimensional grid, reconstruction of the particle phase space density on a six-dimensional grid,
discrete estimates of the entropy based on a binned phasespace. The discrete estimates of the entropy based on a binned phase space. The
possibilities are endless here and a large fraction of the delevopment time of possibilities are endless here and a large fraction of the development time of
a mature code will be invested in probiding userfriendly, scalable, efficient a mature code will be invested in providing user friendly, scalable, efficient
diagnostics. diagnostics.
One special diagnostic that is of interest in astrophysical applications in the One special diagnostic that is of interest in astrophysical applications in the
calculation of radiation spectra. This is different from the spectrum of 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 field inside the simulation domain that is limited to frequencies that are
explicitly resolved. Often there is synchrotron or inverse-Compton radiation at explicitly resolved. Often there is synchrotron or inverse-Compton radiation at
much higher frequenies that can be calculated separately. See much higher frequencies that can be calculated separately. See
\cite{Pausch_2018} on how to implement and properly test such \cite{Pausch_2018} on how to implement and properly test such
radiation diagnostics. Some recent codes include the production of gamma rays radiation diagnostics. Some recent codes include the production of gamma rays
and electron-positron pairs \cite{Nerush_2017}. This is especially relevant for and electron-positron pairs \cite{Nerush_2017}. This is especially relevant for
the nascent field of pulsar magnetosphere simulations, where the back reaction the nascent field of pulsar magnetosphere simulations, where the back reaction
of the radiation processes on the energetic particles in the similation needs of the radiation processes on the energetic particles in the simulation needs
to be included \cite{Kalapotharakos_2018}. to be included \cite{Kalapotharakos_2018}.
\subsection*{Test Cases} \subsection{Test Cases}
Unlike hydro codes that tend to develop negative densities or pressures when \label{subsec:num:test}
numerical problems occure Particle-in-Cell codes are relatively robust. This
can be a good, but brings the risk of obtaining a plausible but wrong result. Compared to fluid codes that easily develop instabilities e.g. through
It is therefore important that the researcher employs a healthy scepticism negative densities or numerical instabilities, PiC codes are rather robust.
towords the code and that the code is tested. Other communities have a large 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 have a large
number of test cases for which analytic solutions are known, or at least 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 results from other codes are available. In the Particle-in-Cell community
effort into validation (making sure that the employed plasma model is adaquate validation efforts (making sure that the employed plasma model is adequate
and that the underlying assumptions are met), benchmarking (comparisson with and that the underlying assumptions are met), benchmarking (comparison with
other codes) and valdidation (testing proper implementation) are relativly new 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, and rare. One of the reasons is that the number of test problems with known,
analytic solutions is rather low. analytic solutions is rather small.
But there some test cases that can be recommended. The paper by
\cite{Jacobs_2006} introduced a discontinuous galerkin code on unstructured %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 mesh, but also includes several useful test cases. The study of
Kelvin-Helmholtz instability in saturns magnetopause in \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 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} 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 lists several test problems that are solvable with that code and offers
opportunity for benchmarking. Papers that investigate new hybrid codes such as opportunity for benchmarking. Papers that investigate new hybrid codes such as
\cite{Amano_2014,Munoz_2018} contain testproblems to demonstrate the new \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 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 \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. 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 Physical setups for which analytic solutions exist include the study of plasma
waves \cite{Aastroem_1950, Bernstein_1958, Andre_1985, Swanson_2003} and the waves \cite{Aastroem_1950, Bernstein_1958, Andre_1985, Swanson_2003} and the
thermal excitation of fluctuations oin density \cite{Dougherty_1960} or thermal excitation of fluctuations in density \cite{Dougherty_1960} or
electromagnetic fields \cite{Akhiezer_1975, Yoon_2017}. For complicated electromagnetic fields \cite{Akhiezer_1975, Yoon_2017}. For complicated
distribution function that do not admit analytic solutions for the dispersion distribution function that do not admit analytic solutions for the dispersion
relation of plasma waves comparisson with numeric dispersion solver relation of plasma waves comparison with numeric dispersion solver
\cite{Roennmark_1982, Xie_2016} is useful. The study of Landau damping has a \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 long tradition \cite{Dawson_1961} and can be useful to test the long term
stability of the code \cite{Manfredi_1997}. stability of the code \cite{Manfredi_1997}.
@@ -1250,6 +1277,6 @@ stability of the code \cite{Manfredi_1997}.
The comparison between different code types such as in \cite{Dimits_2000, 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 Munoz_2015} can be useful to find the limits of applicability. This kind of
comparison is especially popular in the Fusion power community comparison is especially popular in the Fusion power community
\cite{Falchetto_2008}. The expected scaling behaviour when improving numerical \cite{Falchetto_2008}. The expected scaling behavior when improving numerical
resolution can also be used to test the code, even without outside reference resolution can also be used to test the code, even without outside reference
simulations, as shown in \cite{Riva_2017}. simulations, as shown in \cite{Riva_2017}.