diff --git a/nummeth-ws22/exercises/entenrennen.pdf b/nummeth-ws22/exercises/entenrennen.pdf new file mode 100644 index 0000000..48ea48b Binary files /dev/null and b/nummeth-ws22/exercises/entenrennen.pdf differ diff --git a/nummeth-ws22/exercises/uebung9.tex b/nummeth-ws22/exercises/uebung9.tex new file mode 100644 index 0000000..708882a --- /dev/null +++ b/nummeth-ws22/exercises/uebung9.tex @@ -0,0 +1,66 @@ +\documentclass[12pt,a4paper]{uebungen} +\usepackage{german} +\usepackage[utf8]{inputenc} +\usepackage{epsfig} +\usepackage[amssymb]{SIunits} +\usepackage{wrapfig} +\usepackage{graphics} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{amsmath} +\usepackage{url} +\usepackage{pgf} +\usepackage{listings} +\lstset{language=[ANSI]C++,basicstyle=\ttfamily,commentstyle=\itshape, + keywordstyle=\bfseries,extendedchars=true,backgroundcolor=\color{gray}} + +%------------------------------------------------------------------------------ +%\graphicspath{{../../../GALLERY/}} +%------------------------------------------------------------------------------ +\setlength{\topmargin}{-2.5cm} +\setlength{\textheight}{26.0cm} +\setlength{\textwidth}{17cm} +\setlength{\oddsidemargin}{-0.5cm} +\setlength{\evensidemargin}{-0.5cm} +\setlength{\parskip}{0pt} +\setlength{\parindent}{0pt} +\pagestyle{empty} +%------------------------------------------------------------------------------ +\newcommand{\vt}[1]{\vec{#1}} +\newcommand{\mt}[1]{\underline{\underline{#1}}} +\newcommand{\dt}[1]{\left\vert\underline{\underline{#1}}\right\vert} +\newcommand{\mo}{\!\!\!\!\!-1} +%------------------------------------------------------------------------------ +\def\bbbr{{\rm I\!R}} +%------------------------------------------------------------------------------ +\begin{document} +%------------------------------------------------------------------------------ +\thispagestyle{myheadings} +\begin{center} +{\bf \underline{\Large Exercises in ``Numerical Methods in Plasma Astrophysics''}}\\ +%\hfill\\ +%{\bf \large }\\ +\hfill\\ +{\bf \large Winter 2022/23 \hfill Exercise 9}\\ +\end{center} +\noindent +% +\section*{\large Exercise 9: Rubber duck race}\vspace*{-0.0cm} +% +Rubber ducks are clearly racing animals, they love surfing the wild waters of the Neckar! We will try to follow such a race through the magic of computer simulations. Let's assume the race takes place in the well-known 1D Neckar that is described by the Burgers' equation. Due to the large extent of the Neckar it is absolutely necessary to make use of MPI to solve the the numerical problem. + +Two rubber ducks are taken as test particles in this 1D flow that will be advected along with the local flow speed. + +\begin{center} + \pgfimage[width=.7\textwidth]{entenrennen} +\end{center} + +\bigskip +\textbf{a)} Use the code sample discussed in the lecture to perform multi-CPU simulations of the Burgers' equation (you are free to use the [incompressible] Navier-Stokes equation instead, but that's far more complicated\dots) + +\textbf{b)} Define a rubber duck class with position and velocity and place two instances into the simulation domain. The rubber ducks will at some point follow the flow to the next processor, in this case the rubber duck has to be transferred to the next CPU as well.\\ +Hint: In every step neighbouring CPUs should communicate the number of rubber ducks to be transferred. Then a number of \texttt{double} values (2 per rubber duck: position and velocity) are transferred. On the old CPU the rubber duck has to be destroyed and created on the new CPU. There may be more than one rubber duck per CPU. + + +\end{document} +%------------------------------------------------------------------------------ diff --git a/nummeth-ws22/fig_chapter10/Cray-1-deutsches-museum.jpg b/nummeth-ws22/fig_chapter10/Cray-1-deutsches-museum.jpg new file mode 100644 index 0000000..eeadeef Binary files /dev/null and b/nummeth-ws22/fig_chapter10/Cray-1-deutsches-museum.jpg differ diff --git a/nummeth-ws22/fig_chapter10/alltoall.pdf b/nummeth-ws22/fig_chapter10/alltoall.pdf new file mode 100644 index 0000000..3626022 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/alltoall.pdf differ diff --git a/nummeth-ws22/fig_chapter10/altix.jpg b/nummeth-ws22/fig_chapter10/altix.jpg new file mode 100644 index 0000000..0dfe28b Binary files /dev/null and b/nummeth-ws22/fig_chapter10/altix.jpg differ diff --git a/nummeth-ws22/fig_chapter10/boinc.png b/nummeth-ws22/fig_chapter10/boinc.png new file mode 100644 index 0000000..f87d91a Binary files /dev/null and b/nummeth-ws22/fig_chapter10/boinc.png differ diff --git a/nummeth-ws22/fig_chapter10/burgers1.pdf b/nummeth-ws22/fig_chapter10/burgers1.pdf new file mode 100644 index 0000000..679e004 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/burgers1.pdf differ diff --git a/nummeth-ws22/fig_chapter10/burgers2.pdf b/nummeth-ws22/fig_chapter10/burgers2.pdf new file mode 100644 index 0000000..dd2d58d Binary files /dev/null and b/nummeth-ws22/fig_chapter10/burgers2.pdf differ diff --git a/nummeth-ws22/fig_chapter10/caracal.png b/nummeth-ws22/fig_chapter10/caracal.png new file mode 100644 index 0000000..0ae3fcf Binary files /dev/null and b/nummeth-ws22/fig_chapter10/caracal.png differ diff --git a/nummeth-ws22/fig_chapter10/chess.pdf b/nummeth-ws22/fig_chapter10/chess.pdf new file mode 100644 index 0000000..bc2d55a Binary files /dev/null and b/nummeth-ws22/fig_chapter10/chess.pdf differ diff --git a/nummeth-ws22/fig_chapter10/cluster.png b/nummeth-ws22/fig_chapter10/cluster.png new file mode 100644 index 0000000..eae85e7 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/cluster.png differ diff --git a/nummeth-ws22/fig_chapter10/diffmem.pdf b/nummeth-ws22/fig_chapter10/diffmem.pdf new file mode 100644 index 0000000..d36e61b Binary files /dev/null and b/nummeth-ws22/fig_chapter10/diffmem.pdf differ diff --git a/nummeth-ws22/fig_chapter10/diffmem2.pdf b/nummeth-ws22/fig_chapter10/diffmem2.pdf new file mode 100644 index 0000000..7967229 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/diffmem2.pdf differ diff --git a/nummeth-ws22/fig_chapter10/eniac.jpg b/nummeth-ws22/fig_chapter10/eniac.jpg new file mode 100644 index 0000000..bec7b04 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/eniac.jpg differ diff --git a/nummeth-ws22/fig_chapter10/ganglia.pdf b/nummeth-ws22/fig_chapter10/ganglia.pdf new file mode 100644 index 0000000..6a25307 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/ganglia.pdf differ diff --git a/nummeth-ws22/fig_chapter10/ganglia1.pdf b/nummeth-ws22/fig_chapter10/ganglia1.pdf new file mode 100644 index 0000000..ba89316 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/ganglia1.pdf differ diff --git a/nummeth-ws22/fig_chapter10/ganglia2.pdf b/nummeth-ws22/fig_chapter10/ganglia2.pdf new file mode 100644 index 0000000..efa2569 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/ganglia2.pdf differ diff --git a/nummeth-ws22/fig_chapter10/ganglia3.pdf b/nummeth-ws22/fig_chapter10/ganglia3.pdf new file mode 100644 index 0000000..8a985ac Binary files /dev/null and b/nummeth-ws22/fig_chapter10/ganglia3.pdf differ diff --git a/nummeth-ws22/fig_chapter10/hdf_basic.png b/nummeth-ws22/fig_chapter10/hdf_basic.png new file mode 100644 index 0000000..8c9c01d Binary files /dev/null and b/nummeth-ws22/fig_chapter10/hdf_basic.png differ diff --git a/nummeth-ws22/fig_chapter10/hdf_dataset.png b/nummeth-ws22/fig_chapter10/hdf_dataset.png new file mode 100644 index 0000000..e0832c0 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/hdf_dataset.png differ diff --git a/nummeth-ws22/fig_chapter10/hdf_group.png b/nummeth-ws22/fig_chapter10/hdf_group.png new file mode 100644 index 0000000..a099fdd Binary files /dev/null and b/nummeth-ws22/fig_chapter10/hdf_group.png differ diff --git a/nummeth-ws22/fig_chapter10/hdf_organi.png b/nummeth-ws22/fig_chapter10/hdf_organi.png new file mode 100644 index 0000000..f50a184 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/hdf_organi.png differ diff --git a/nummeth-ws22/fig_chapter10/headnode.png b/nummeth-ws22/fig_chapter10/headnode.png new file mode 100644 index 0000000..783cd03 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/headnode.png differ diff --git a/nummeth-ws22/fig_chapter10/independent.pdf b/nummeth-ws22/fig_chapter10/independent.pdf new file mode 100644 index 0000000..d954fd7 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/independent.pdf differ diff --git a/nummeth-ws22/fig_chapter10/matrices.png b/nummeth-ws22/fig_chapter10/matrices.png new file mode 100644 index 0000000..7267662 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/matrices.png differ diff --git a/nummeth-ws22/fig_chapter10/matrix2.png b/nummeth-ws22/fig_chapter10/matrix2.png new file mode 100644 index 0000000..c75ef88 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/matrix2.png differ diff --git a/nummeth-ws22/fig_chapter10/node.png b/nummeth-ws22/fig_chapter10/node.png new file mode 100644 index 0000000..a2f7bf5 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/node.png differ diff --git a/nummeth-ws22/fig_chapter10/node_cpu.png b/nummeth-ws22/fig_chapter10/node_cpu.png new file mode 100644 index 0000000..83a4717 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/node_cpu.png differ diff --git a/nummeth-ws22/fig_chapter10/node_ohne.png b/nummeth-ws22/fig_chapter10/node_ohne.png new file mode 100644 index 0000000..691c25e Binary files /dev/null and b/nummeth-ws22/fig_chapter10/node_ohne.png differ diff --git a/nummeth-ws22/fig_chapter10/nomp_1.png b/nummeth-ws22/fig_chapter10/nomp_1.png new file mode 100644 index 0000000..04b1bc4 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/nomp_1.png differ diff --git a/nummeth-ws22/fig_chapter10/nomp_2.png b/nummeth-ws22/fig_chapter10/nomp_2.png new file mode 100644 index 0000000..1e0a3a9 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/nomp_2.png differ diff --git a/nummeth-ws22/fig_chapter10/omp1.png b/nummeth-ws22/fig_chapter10/omp1.png new file mode 100644 index 0000000..794ef3b Binary files /dev/null and b/nummeth-ws22/fig_chapter10/omp1.png differ diff --git a/nummeth-ws22/fig_chapter10/omp2.png b/nummeth-ws22/fig_chapter10/omp2.png new file mode 100644 index 0000000..e64122d Binary files /dev/null and b/nummeth-ws22/fig_chapter10/omp2.png differ diff --git a/nummeth-ws22/fig_chapter10/omp3.png b/nummeth-ws22/fig_chapter10/omp3.png new file mode 100644 index 0000000..fc74e22 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/omp3.png differ diff --git a/nummeth-ws22/fig_chapter10/omp4.png b/nummeth-ws22/fig_chapter10/omp4.png new file mode 100644 index 0000000..348ffc3 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/omp4.png differ diff --git a/nummeth-ws22/fig_chapter10/p3dfft.png b/nummeth-ws22/fig_chapter10/p3dfft.png new file mode 100644 index 0000000..fdbd3ff Binary files /dev/null and b/nummeth-ws22/fig_chapter10/p3dfft.png differ diff --git a/nummeth-ws22/fig_chapter10/quad.png b/nummeth-ws22/fig_chapter10/quad.png new file mode 100644 index 0000000..a34420e Binary files /dev/null and b/nummeth-ws22/fig_chapter10/quad.png differ diff --git a/nummeth-ws22/fig_chapter10/scaling.pdf b/nummeth-ws22/fig_chapter10/scaling.pdf new file mode 100644 index 0000000..310752d Binary files /dev/null and b/nummeth-ws22/fig_chapter10/scaling.pdf differ diff --git a/nummeth-ws22/fig_chapter10/serval.png b/nummeth-ws22/fig_chapter10/serval.png new file mode 100644 index 0000000..b027cfc Binary files /dev/null and b/nummeth-ws22/fig_chapter10/serval.png differ diff --git a/nummeth-ws22/fig_chapter10/seti.pdf b/nummeth-ws22/fig_chapter10/seti.pdf new file mode 100644 index 0000000..c62934f Binary files /dev/null and b/nummeth-ws22/fig_chapter10/seti.pdf differ diff --git a/nummeth-ws22/fig_chapter10/shmem.pdf b/nummeth-ws22/fig_chapter10/shmem.pdf new file mode 100644 index 0000000..7a3a549 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/shmem.pdf differ diff --git a/nummeth-ws22/fig_chapter10/strong.pdf b/nummeth-ws22/fig_chapter10/strong.pdf new file mode 100644 index 0000000..da54ef5 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/strong.pdf differ diff --git a/nummeth-ws22/fig_chapter10/top500.png b/nummeth-ws22/fig_chapter10/top500.png new file mode 100644 index 0000000..7fd70a3 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/top500.png differ diff --git a/nummeth-ws22/fig_chapter10/twin.png b/nummeth-ws22/fig_chapter10/twin.png new file mode 100644 index 0000000..3fb0389 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/twin.png differ diff --git a/nummeth-ws22/fig_chapter10/weak.pdf b/nummeth-ws22/fig_chapter10/weak.pdf new file mode 100644 index 0000000..808b230 Binary files /dev/null and b/nummeth-ws22/fig_chapter10/weak.pdf differ diff --git a/nummeth-ws22/literatur.bib b/nummeth-ws22/literatur.bib index 06d5df9..e700d70 100644 --- a/nummeth-ws22/literatur.bib +++ b/nummeth-ws22/literatur.bib @@ -6,6 +6,26 @@ publisher = {McGraw-Hill, New York}, year = 1981, } +@ARTICLE{kurganov-levy:2000, + author = {{Kurganov}, Alexander and {Levy}, Doron}, + title = "{A Third-Order Semidiscrete Central Scheme for Conservation Laws and Convection-Diffusion Equations}", + journal = {SIAM Journal on Scientific Computing}, + keywords = {Mathematics - Numerical Analysis, Mathematics - Analysis of PDEs, 65M10 (Primary) 65M05 (Secondary)}, + year = 2000, + month = jan, + volume = {22}, + number = {4}, + pages = {1461-1488}, + doi = {10.1137/S1064827599360236}, +archivePrefix = {arXiv}, + eprint = {math/0002133}, + primaryClass = {math.NA}, + adsurl = {https://ui.adsabs.harvard.edu/abs/2000SJSC...22.1461K}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + + + @ARTICLE{2014CoPhC.185.1981S, author = {{Schreiner}, C. and {Spanier}, F.}, title = "{Wave-particle-interaction in kinetic plasmas}", @@ -27,7 +47,7 @@ archivePrefix = "arXiv", author = {{Ivascenko}, A. and {Lange}, S. and {Spanier}, F. and {Vainio}, R. }, title = "{Determining Pitch-angle Diffusion Coefficients from Test Particle Simulations}", - journal = {\apj}, + journal = {Astrophysical Journal}, archivePrefix = "arXiv", eprint = {1610.03240}, primaryClass = "physics.space-ph", @@ -46,7 +66,7 @@ archivePrefix = "arXiv", author = {{Lange}, S. and {Spanier}, F. and {Battarbee}, M. and {Vainio}, R. and {Laitinen}, T.}, title = "{Particle scattering in turbulent plasmas with amplified wave modes}", - journal = {\aap}, + journal = {Astronomy and Astrophysics}, archivePrefix = "arXiv", eprint = {1303.7463}, primaryClass = "astro-ph.SR", @@ -64,7 +84,7 @@ archivePrefix = "arXiv", @ARTICLE{2012ApJ...750..150W, author = {{Wisniewski}, M. and {Spanier}, F. and {Kissmann}, R.}, title = "{Diffusion of Energetic Particles in Turbulent Magnetohydrodynamic Plasmas}", - journal = {\apj}, + journal = {Astrophysical Journal}, archivePrefix = "arXiv", eprint = {1203.0933}, primaryClass = "astro-ph.HE", @@ -79,6 +99,25 @@ archivePrefix = "arXiv", adsnote = {Provided by the SAO/NASA Astrophysics Data System} } +@ARTICLE{Munoz2018, + author = {{Mu{\~n}oz}, P.~A. and {Jain}, N. and {Kilian}, P. and {B{\"u}chner}, J.}, + title = "{A new hybrid code (CHIEF) implementing the inertial electron fluid equation without approximation}", + journal = {Computer Physics Communications}, + keywords = {Plasma simulation, Hybrid methods, Particle-in-cell method, Physics - Plasma Physics, Physics - Computational Physics}, + year = 2018, + month = mar, + volume = {224}, + pages = {245-264}, + doi = {10.1016/j.cpc.2017.10.012}, +archivePrefix = {arXiv}, + eprint = {1612.03818}, + primaryClass = {physics.plasm-ph}, + adsurl = {https://ui.adsabs.harvard.edu/abs/2018CoPhC.224..245M}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + + + @BOOK{2002cra..book.....S, author = {{Schlickeiser}, R.}, title = "{Cosmic Ray Astrophysics}", @@ -108,7 +147,7 @@ booktitle = {Cosmic ray astrophysics / Reinhard Schlickeiser, Astronomy and Astr @ARTICLE{2006ApJ...644..631F, author = {{Fisk}, L.~A. and {Gloeckler}, G. and {Zurbuchen}, T.~H.}, title = "{Acceleration of Low-Energy Ions at the Termination Shock of the Solar Wind}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {Acceleration of Particles, Interplanetary Medium, Shock Waves}, year = 2006, month = jun, @@ -145,7 +184,7 @@ archivePrefix = "arXiv", {Willmott}, C. and {Told}, D. and {Loureiro}, N.~F. and {Califano}, F. and {Jenko}, F.}, title = "{Fully Kinetic versus Reduced-kinetic Modeling of Collisionless Plasma Turbulence}", - journal = {\apj}, + journal = {The Astrophysical Journal}, archivePrefix = "arXiv", eprint = {1706.02652}, primaryClass = "physics.plasm-ph", @@ -241,7 +280,7 @@ archivePrefix = "arXiv", @ARTICLE{2018ApJ...858L..19G, author = {{Grete}, P. and {O'Shea}, B.~W. and {Beckwith}, K.}, title = "{As a Matter of Force{\mdash}Systematic Biases in Idealized Turbulence Simulations}", - journal = {\apjl}, + journal = {The Astrophysical Journall}, archivePrefix = "arXiv", eprint = {1803.05481}, primaryClass = "physics.flu-dyn", @@ -276,7 +315,7 @@ archivePrefix = "arXiv", author = {{Papini}, E. and {Franci}, L. and {Landi}, S. and {Verdini}, A. and {Matteini}, L. and {Hellinger}, P.}, title = "{Can Hall Magnetohydrodynamics Explain Plasma Turbulence at Sub-ion Scales?}", - journal = {\apj}, + journal = {The Astrophysical Journal}, archivePrefix = "arXiv", eprint = {1810.02210}, primaryClass = "physics.plasm-ph", @@ -294,7 +333,7 @@ archivePrefix = "arXiv", @ARTICLE{2018ApJ...864L..21P, author = {{Parashar}, T.~N. and {Matthaeus}, W.~H. and {Shay}, M.~A.}, title = "{Dependence of Kinetic Plasma Turbulence on Plasma {$\beta$}}", - journal = {\apjl}, + journal = {The Astrophysical Journall}, archivePrefix = "arXiv", eprint = {1807.11371}, primaryClass = "physics.space-ph", @@ -309,6 +348,24 @@ archivePrefix = "arXiv", adsnote = {Provided by the SAO/NASA Astrophysics Data System} } +@ARTICLE{allanson17, + author = {{Allanson}, O. and {Troscheit}, S. and {Neukirch}, T.}, + title = "{The inverse problem for collisionless plasma equilibria}", + journal = {arXiv e-prints}, + keywords = {Physics - Plasma Physics}, + year = 2017, + month = oct, + eid = {arXiv:1710.04912}, + pages = {arXiv:1710.04912}, +archivePrefix = {arXiv}, + eprint = {1710.04912}, + primaryClass = {physics.plasm-ph}, + adsurl = {https://ui.adsabs.harvard.edu/abs/2017arXiv171004912A}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + + + @article{Yee_1966, author = {Kane Yee}, journal = {Antennas and Propagation, IEEE Transactions on}, @@ -1645,7 +1702,7 @@ Rmanelli}, author = {{Shalaby}, M. and {Broderick}, A.~E. and {Chang}, P. and {Pfrommer}, C. and {Lamberts}, A. and {Puchwein}, E.}, title = "{Importance of Resolving the Spectral Support of Beam-plasma Instabilities in Simulations}", - journal = {\apj}, + journal = {The Astrophysical Journal}, archivePrefix = "arXiv", eprint = {1704.00014}, primaryClass = "astro-ph.HE", @@ -1676,7 +1733,7 @@ archivePrefix = "arXiv", @ARTICLE{2009ApJ...699..990B, author = {{Bret}, A.}, title = "{Weibel, Two-Stream, Filamentation, Oblique, Bell, Buneman...Which One Grows Faster?}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {cosmic rays, gamma rays: bursts, instabilities, shock waves, Astrophysics - High Energy Astrophysical Phenomena, Physics - Plasma Physics}, year = "2009", month = "Jul", @@ -1707,7 +1764,7 @@ archivePrefix = {arXiv}, author = {{Burkart}, Thomas and {Elbracht}, Oliver and {Ganse}, Urs and {Spanier}, Felix}, title = "{The Influence of the Mass Ratio on the Acceleration of Particles by Filamentation Instabilities}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {acceleration of particles, galaxies: jets, instabilities, methods: numerical, plasmas, Astrophysics - High Energy Astrophysical Phenomena, Astrophysics - Cosmology and Extragalactic Astrophysics}, year = "2010", month = "Sep", @@ -1743,7 +1800,7 @@ archivePrefix = {arXiv}, @ARTICLE{2016A&A...585A.132K, author = {{Kempf}, A. and {Kilian}, P. and {Spanier}, F.}, title = "{Energy loss in intergalactic pair beams: Particle-in-cell simulation}", - journal = {\aap}, + journal = {Astronomy and Astrophysics}, keywords = {plasmas, galaxies: active, galaxies: jets, quasars: general, gamma rays: general, Astrophysics - High Energy Astrophysical Phenomena, Physics - Plasma Physics}, year = "2016", month = "Jan", @@ -1778,7 +1835,7 @@ archivePrefix = {arXiv}, @ARTICLE{2014ApJ...787...49S, author = {{Sironi}, Lorenzo and {Giannios}, Dimitrios}, title = "{Relativistic Pair Beams from TeV Blazars: A Source of Reprocessed GeV Emission rather than Intergalactic Heating}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {gamma rays: general, instabilities, intergalactic medium, plasmas, radiation mechanisms: non-thermal, Astrophysics - High Energy Astrophysical Phenomena, Astrophysics - Cosmology and Nongalactic Astrophysics}, year = "2014", month = "May", @@ -1796,7 +1853,7 @@ archivePrefix = {arXiv}, @ARTICLE{weibel1, author = {{Califano}, F. and {Pegoraro}, F. and {Bulanov}, S.~V.}, title = "{Spatial structure and time evolution of the Weibel instability in collisionless inhomogeneous plasmas}", - journal = {\pre}, + journal = {Phys. Rev. E}, keywords = {52.35.Qz, 52.40.Nk, 52.60.+h, 52.65.Kj, Microinstabilities, Magnetohydrodynamic and fluid equation}, year = 1997, month = jul, @@ -1943,7 +2000,7 @@ archivePrefix = {arXiv}, author = {{Sundkvist}, D. and {Retin{\`o}}, A. and {Vaivads}, A. and {Bale}, S.~D. }, title = "{Dissipation in Turbulent Plasma due to Reconnection in Thin Current Sheets}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Plasma turbulence, Magnetic reconnection, Laboratory studies of space- and astrophysical-plasma processes}, year = 2007, month = jul, @@ -1973,7 +2030,7 @@ archivePrefix = {arXiv}, author = {{Matteini}, L. and {Hellinger}, P. and {Landi}, S. and {Tr{\'a}vn{\'{\i}}{\v c}ek}, P.~M. and {Velli}, M.}, title = "{Ion Kinetics in the Solar Wind: Coupling Global Expansion to Local Microphysics}", - journal = {\ssr}, + journal = {Space Science Reviews}, keywords = {Solar wind, Ion kinetics, Numerical simulations}, year = 2012, month = nov, @@ -1988,7 +2045,7 @@ archivePrefix = {arXiv}, author = {{Greco}, A. and {Perri}, S. and {Servidio}, S. and {Yordanova}, E. and {Veltri}, P.}, title = "{The Complex Structure of Magnetic Field Discontinuities in the Turbulent Solar Wind}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {magnetic reconnection, solar wind, turbulence, Astrophysics - Solar and Stellar Astrophysics, Physics - Space Physics}, year = "2016", month = "Jun", @@ -2165,7 +2222,7 @@ archivePrefix = "arXiv", @ARTICLE{RobertsAPJ2017, author = {{Roberts}, O.~W. and {Narita}, Y. and {Escoubet}, C.~P.}, title = "{Direct Measurement of Anisotropic and Asymmetric Wave Vector Spectrum in Ion-scale Solar Wind Turbulence}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {turbulence}, year = "2017", month = "Dec", @@ -2199,7 +2256,7 @@ archivePrefix = "arXiv", {Roytershteyn}, V. and {Shay}, M. and {Wu}, P. and {Daughton}, W. and {Loring}, B. and {Chapman}, S.~C.}, title = "{Intermittent Dissipation at Kinetic Scales in Collisionless Plasma Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {94.05.Lk, 52.50.-b, 95.30.Qd, 96.50.Ci, Turbulence, Plasma production and heating, Magnetohydrodynamics and plasmas, Solar wind plasma, sources of solar wind}, year = "2012", month = "Nov", @@ -2453,7 +2510,7 @@ archivePrefix = "arXiv", @ARTICLE{KunzPRL2014, author = {{Kunz}, M.~W. and {Schekochihin}, A.~A. and {Stone}, J.~M.}, title = "{Firehose and Mirror Instabilities in a Collisionless Shearing Plasma}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1402.0010}, primaryClass = "astro-ph.HE", @@ -2524,7 +2581,7 @@ archivePrefix = "arXiv", @ARTICLE{Boldyrev2006, author = {{Boldyrev}, S.}, title = "{Spectrum of Magnetohydrodynamic Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, eprint = {astro-ph/0511290}, keywords = {Magnetohydrodynamics, Magnetohydrodynamics and plasmas}, year = 2006, @@ -2542,7 +2599,7 @@ archivePrefix = "arXiv", @ARTICLE{PlunkTatsuno11, author = {{Plunk}, G.~G. and {Tatsuno}, T.}, title = "{Energy Transfer and Dual Cascade in Kinetic Magnetized Plasma Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1007.4787}, primaryClass = "physics.plasm-ph", @@ -2564,7 +2621,7 @@ archivePrefix = "arXiv", author = {{Howes}, G.~G. and {Dorland}, W. and {Cowley}, S.~C. and {Hammett}, G.~W. and {Quataert}, E. and {Schekochihin}, A.~A. and {Tatsuno}, T.}, title = "{Kinetic Simulations of Magnetized Turbulence in Astrophysical Plasmas}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {0711.4355}, keywords = {Plasma turbulence, Gyrofluid and gyrokinetic simulations, MHD waves, plasma waves turbulence}, @@ -2583,7 +2640,7 @@ archivePrefix = "arXiv", @ARTICLE{ServidioPRL2017, author = {{Servidio}, S. and {Chasapis}, A. and {Matthaeus}, W.~H. and {Perrone}, D. and {Valentini}, F. and {Parashar}, T.~N. and {Veltri}, P. and {Gershman}, D. and {Russell}, C.~T. and {Giles}, B. and {Fuselier}, S.~A. and {Phan}, T.~D. and {Burch}, J.}, title = "{Magnetospheric Multiscale Observation of Plasma Velocity-Space Cascade: Hermite Representation and Theory}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1707.08180}, primaryClass = "physics.plasm-ph", @@ -2664,7 +2721,7 @@ archivePrefix = "arXiv", {Greco}, A. and {Servidio}, S. and {Hnat}, B. and {Chapman}, S.~C. and {Phan}, T.~D.}, title = "{Magnetic Reconnection and Intermittent Turbulence in the Solar Wind}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1403.4590}, primaryClass = "physics.space-ph", @@ -2705,7 +2762,7 @@ archivePrefix = "arXiv", author = {{Perri}, S. and {Goldstein}, M.~L. and {Dorelli}, J.~C. and {Sahraoui}, F.}, title = "{Detection of Small-Scale Structures in the Dissipation Regime of Solar-Wind Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Solar wind plasma, sources of solar wind, Turbulence}, year = 2012, month = nov, @@ -3010,7 +3067,7 @@ archivePrefix = "arXiv", @ARTICLE{PezziPRL2016, author = {{Pezzi}, O. and {Valentini}, F. and {Veltri}, P.}, title = "{Collisional Relaxation of Fine Velocity Structures in Plasmas}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, year = 2016, month = apr, volume = 116, @@ -3047,7 +3104,7 @@ archivePrefix = "arXiv", author = {{Servidio}, S. and {Matthaeus}, W.~H. and {Shay}, M.~A. and {Cassak}, P.~A. and {Dmitruk}, P.}, title = "{Magnetic Reconnection in Two-Dimensional Magnetohydrodynamic Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Magnetic reconnection, Interplanetary magnetic fields, MHD waves, plasma waves turbulence, Magnetic reconnection}, year = 2009, month = mar, @@ -3185,7 +3242,7 @@ archivePrefix = "arXiv", author = {{Daughton}, W. and {Roytershteyn}, V. and {Albright}, B.~J. and {Karimabadi}, H. and {Yin}, L. and {Bowers}, K.~J.}, title = "{Transition from collisional to kinetic regimes in large-scale reconnection layers}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Magnetic reconnection}, year = 2009, month = aug, @@ -3366,7 +3423,7 @@ archivePrefix = "arXiv", author = {{Le}, A. and {Egedal}, J. and {Ohia}, O. and {Daughton}, W. and {Karimabadi}, H. and {Lukin}, V.~S.}, title = "{Regimes of the Electron Diffusion Region in Magnetic Reconnection}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Magnetic reconnection}, year = 2013, month = mar, @@ -3419,7 +3476,7 @@ archivePrefix = "arXiv", author = {{Gro{\v s}elj}, D. and {Mallet}, A. and {Loureiro}, N.~F. and {Jenko}, F.}, title = "{Fully Kinetic Simulation of 3D Kinetic Alfv{\'e}n Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1710.03581}, primaryClass = "physics.plasm-ph", @@ -3610,6 +3667,7 @@ archivePrefix = "arXiv", adsurl = {http://adsabs.harvard.edu/abs/2017EGUGA..19..620C}, adsnote = {Provided by the SAO/NASA Astrophysics Data System} } + @ARTICLE{ChenBoldyrevAPJ2017, author = {{Chen}, C.~H.~K. and {Boldyrev}, S.}, title = "{Nature of Kinetic Scale Turbulence in the Earth's Magnetosheath}", @@ -3767,7 +3825,7 @@ archivePrefix = "arXiv", author = {{Alexandrova}, O. and {Chen}, C.~H.~K. and {Sorriso-Valvo}, L. and {Horbury}, T.~S. and {Bale}, S.~D.}, title = "{Solar Wind Turbulence and the Role of Ion Instabilities}", - journal = {\ssr}, + journal = {Space Science Reviews}, archivePrefix = "arXiv", eprint = {1306.5336}, primaryClass = "astro-ph.SR", @@ -4046,7 +4104,7 @@ archivePrefix = {arXiv}, @ARTICLE{HughesAPJ2017, author = {{Hughes}, R. Scott and {Gary}, S. Peter and {Wang}, Joseph}, title = "{Particle-in-cell Simulations of Electron and Ion Dissipation by Whistler Turbulence: Variations with Electron {\ensuremath{\beta}}}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {solar wind, turbulence, waves}, year = "2017", month = "Jan", @@ -4412,7 +4470,7 @@ archivePrefix = {arXiv}, author = {{Arzamasskiy}, Lev and {Kunz}, Matthew W. and {Chand ran}, Benjamin D.~G. and {Quataert}, Eliot}, title = "{Hybrid-kinetic Simulations of Ion Heating in Alfv{\'e}nic Turbulence}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {acceleration of particles, plasmas, solar wind, turbulence, Astrophysics - High Energy Astrophysical Phenomena, Physics - Plasma Physics, Physics - Space Physics}, year = "2019", month = "Jul", @@ -4446,6 +4504,39 @@ archivePrefix = "arXiv", adsnote = {Provided by the SAO/NASA Astrophysics Data System} } +@ARTICLE{liseikina99, + author = {{Liseikina}, T.~V. and {Califano}, F. and {Vshivkov}, V.~A. and {Pegoraro}, F. and {Bulanov}, S.~V.}, + title = "{Small-scale electron density and magnetic-field structures in the wake of an ultraintense laser pulse}", + journal = {Phys. Rev. E}, + keywords = {52.40.Nk, 52.60.+h, 52.65.Rr, 41.20.-q, Particle-in-cell method, Applied classical electromagnetism}, + year = 1999, + month = nov, + volume = {60}, + number = {5}, + pages = {5991-5997}, + doi = {10.1103/PhysRevE.60.5991}, + adsurl = {https://ui.adsabs.harvard.edu/abs/1999PhRvE..60.5991L}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + + + +@ARTICLE{alfven:63, + author = {{Alfv{\'e}n}, H.}, + title = "{Hydromagnetics of the Magnetosphere}", + journal = {Space Science Reviews}, + year = 1963, + month = dec, + volume = {2}, + number = {6}, + pages = {862-870}, + doi = {10.1007/BF00208816}, + adsurl = {https://ui.adsabs.harvard.edu/abs/1963SSRv....2..862A}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + + + @ARTICLE{MithaiwalaPOP2012, author = {{Mithaiwala}, M. and {Rudakov}, L. and {Crabtree}, C. and {Ganguli}, G. }, @@ -4687,7 +4778,7 @@ archivePrefix = "arXiv", author = {{Hatch}, D.~R. and {Jenko}, F. and {Ba{\~n}{\'o}n Navarro}, A. and {Bratanov}, V.}, title = "{Transition between Saturation Regimes of Gyrokinetic Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Gyrokinetics, Plasma turbulence, Gyrofluid and gyrokinetic simulations}, year = 2013, month = oct, @@ -4737,7 +4828,7 @@ archivePrefix = "arXiv", {Delzanno}, Gian Luca and {Chen}, Christopher H.~K. and {Gro{\v{s}}elj}, Daniel and {Loureiro}, Nuno F.}, title = "{Numerical Study of Inertial Kinetic-Alfv{\'e}n Turbulence}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {plasmas, turbulence, waves, solar wind}, year = "2019", month = "Jan", @@ -4838,7 +4929,7 @@ archivePrefix = "arXiv", {Plunk}, G.~G. and {Barnes}, M. and {Cowley}, S.~C. and {Howes}, G.~G. }, title = "{Nonlinear Phase Mixing and Phase-Space Cascade of Entropy in Gyrokinetic Plasma Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {0811.2538}, primaryClass = "physics.plasm-ph", @@ -4859,7 +4950,7 @@ archivePrefix = "arXiv", {Carati}, D. and {Merz}, F. and {G{\"o}rler}, T. and {Jenko}, F. }, title = "{Free Energy Cascade in Gyrokinetic Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1008.3974}, primaryClass = "physics.plasm-ph", @@ -4908,7 +4999,7 @@ archivePrefix = "arXiv", author = {{Servidio}, S. and {Valentini}, F. and {Califano}, F. and {Veltri}, P. }, title = "{Local Kinetic Effects in Two-Dimensional Plasma Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Plasma turbulence, Plasma simulation, Space plasma physics, Solar wind plasma, sources of solar wind}, year = 2012, month = jan, @@ -4995,7 +5086,7 @@ archivePrefix = "arXiv", author = {{Osman}, K.~T. and {Matthaeus}, W.~H. and {Hnat}, B. and {Chapman}, S.~C. }, title = "{Kinetic Signatures and Intermittent Turbulence in the Solar Wind Plasma}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1203.6596}, primaryClass = "physics.space-ph", @@ -5033,7 +5124,7 @@ archivePrefix = "arXiv", author = {{Howes}, G.~G. and {Tenbarge}, J.~M. and {Dorland}, W. and {Quataert}, E. and {Schekochihin}, A.~A. and {Numata}, R. and {Tatsuno}, T.}, title = "{Gyrokinetic Simulations of Solar Wind Turbulence from Ion to Electron Scales}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1104.0877}, primaryClass = "astro-ph.SR", @@ -5053,7 +5144,7 @@ archivePrefix = "arXiv", author = {{Ba{\~n}{\'o}n Navarro}, A. and {Teaca}, B. and {Told}, D. and {Groselj}, D. and {Crandall}, P. and {Jenko}, F.}, title = "{Structure of Plasma Heating in Gyrokinetic Alfv{\'e}nic Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1607.07480}, primaryClass = "physics.plasm-ph", @@ -5107,7 +5198,7 @@ archivePrefix = "arXiv", author = {{Osman}, K.~T. and {Matthaeus}, W.~H. and {Wan}, M. and {Rappazzo}, A.~F. }, title = "{Intermittency and Local Heating in the Solar Wind}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, archivePrefix = "arXiv", eprint = {1111.6921}, primaryClass = "physics.space-ph", @@ -5142,7 +5233,7 @@ archivePrefix = "arXiv", {Karimabadi}, H. and {Parashar}, T. and {Wu}, P. and {Shay}, M. }, title = "{Intermittent Dissipation and Heating in 3D Kinetic Plasma Turbulence}", - journal = {\prl}, + journal = {Phys. Rev. Letters}, keywords = {Plasma turbulence, Space plasma physics, MHD waves, plasma waves turbulence}, year = 2015, month = may, @@ -5210,7 +5301,7 @@ archivePrefix = "arXiv", @ARTICLE{ChoVishniacAPJ2000, author = {{Cho}, Jungyeon and {Vishniac}, Ethan T.}, title = "{The Anisotropy of Magnetohydrodynamic Alfv{\'e}nic Turbulence}", - journal = {\apj}, + journal = {The Astrophysical Journal}, keywords = {ISM: General, Magnetic Fields, Magnetohydrodynamics: MHD, Turbulence, Astrophysics}, year = "2000", month = "Aug", diff --git a/nummeth-ws22/skript.tex b/nummeth-ws22/skript.tex index 6238996..59f4692 100644 --- a/nummeth-ws22/skript.tex +++ b/nummeth-ws22/skript.tex @@ -3,6 +3,7 @@ %Individuelle Kopf- und Fußzeilen \usepackage[headsepline]{scrlayer-scrpage} \pagestyle{scrheadings} +\usepackage[T1]{fontenc} %Tabellen \usepackage{booktabs}%für horizontale Linien \usepackage{multirow} @@ -442,12 +443,12 @@ It is a peculiarity of the $\vec{E} \times \vec{B}$ -drift that negative electro \vec{v}_{E}=c \frac{\vec{E} \times \vec{B}}{B^{2}} \, . \end{equation} -\begin{SCfigure}[1][th] +\begin{figure} \centering - \caption{Cycloidal trajectory resulting from the superposition of gyro-motion and E × B-drift. The electric field is oriented along the x-axis, the magnetic field is perpendicular to the x–y plane. Note that ions (full line) and electrons (dashed line) have the same drift direction. An artificial electron mass, $m_e=0.3 m_{ion}$, was assumed here for clarity!} + \caption{Cycloidal trajectory resulting from the superposition of gyro-motion and $E\times B$-drift. The electric field is oriented along the x-axis, the magnetic field is perpendicular to the x–y plane. Note that ions (full line) and electrons (dashed line) have the same drift direction. An artificial electron mass, $m_e=0.3 m_{ion}$, was assumed here for clarity!} \includegraphics[width=0.49\textwidth, height=0.4\paperheight]{./fig_chapter1/2_drift.png} \label{fig:2-2-drift} -\end{SCfigure} +\end{figure} @@ -606,13 +607,13 @@ Before doing so we have to define a suitable normalization. In this case we choo \begin{align} \int_\mathfrak{V} \int_{\vec{v}} f(\vec r, \vec v, t) \dd^3 r \dd^3 v = N \end{align} -So $f$ describes the \emph{number density} in the volume element $\dd x \dd y \dd z \dd v_x \dd v_y \dd v_z$ and has the unit \unit{cm^{-6} s^3}. +So $f$ describes the \emph{number density} in the volume element $\dd x \dd y \dd z \dd v_x \dd v_y \dd v_z$ and has the unit \si{cm^{-6} s^3}. The average density in the volume $\mathfrak{V}$ is $\langle n\rangle =N/\mathfrak{V}$. However the particle density is usually a function of space and time. It is defined as the zero order velocity moment of the distribution function \begin{align} n(\vec r, t) = \int f(\vec r, \vec v, t) \dd^3 v \end{align} -We will define the macroscopic quuantities as velocity moments of the distribution function +We will define the macroscopic quantities as velocity moments of the distribution function \begin{align*} \int f(\vec r, \vec v, t) \dd^3 v; \quad \int \vec v f(\vec r, \vec v, t) \dd^3 v; @@ -896,7 +897,7 @@ The Sun has an open atmosphere, i.e., particles are constantly streaming out. Th \begin{center} \pgfimage[width=.7\textwidth]{fig_chapter2/ramigramm} \end{center} - \caption{Profiles of solar wind speed (dash-dotted curves), Alfv´en + \caption{Profiles of solar wind speed (dash-dotted curves), Alfv\'en speed (dashed curves), and number density (solid curves). The thick [thin] curves result from our slow [fast] solar wind model. A fit to the observational equatorial electron densities is denoted by crosses (Vainio et al., 2003).} @@ -4148,7 +4149,7 @@ In the semidiscrete limit the size of the dark-grey regions can be estimated to \begin{align} D_{i+1/2,j+1/2} = (a^+_{i+1/2,j+1/2}+a^-_{i+1/2,j+1/2}+)(b^+_{i+1/2,j+1/2}+b^-_{i+1/2,j+1/2})\dd t^2+\mathcal{O}(\dd t^3) \end{align} -where $D_{i+1/2,j+1/2}$ indicates the corresponding region in Fig. \ref{fig:ralph3.2}. Additionally, a± are the right- and left-handed maximum propagation velocities for discontinuities for the upper right corner in the x-direction respectively. In the same way b± corresponds to the signal propagation velocities in the y-direction. Like the equations describing the problem under consideration these velocities have to be specified corresponding to the problem. They are obtained from the Jacobian for each direction. The size of this region is of second order in time and can, therefore, safely be neglected in the semidiscrete limit. +where $D_{i+1/2,j+1/2}$ indicates the corresponding region in Fig. \ref{fig:ralph3.2}. Additionally, $a^\pm$ are the right- and left-handed maximum propagation velocities for discontinuities for the upper right corner in the x-direction respectively. In the same way $b^\pm$ corresponds to the signal propagation velocities in the y-direction. Like the equations describing the problem under consideration these velocities have to be specified corresponding to the problem. They are obtained from the Jacobian for each direction. The size of this region is of second order in time and can, therefore, safely be neglected in the semidiscrete limit. As compared to this the light-grey areas can be estimated to have the size \begin{align} @@ -4244,7 +4245,7 @@ become \frac{\partial\rho\mathbf{u}}{\partial t}+\nabla\cdot(\rho\mathbf{uu})+\frac{m_{e}m_{i}}{e^{2}}\nabla\cdot(\frac{1}{\rho}\mathbf{jj}) & = & -\nabla p+\mathbf{j}\times\mathbf{B}\\ \mathbf{E}+\mathbf{u}\times\mathbf{B}-\frac{m_{e}m_{i}}{e^{2}\rho}\left[\frac{\partial\mathbf{j}}{\partial t}+\nabla\cdot\left(\mathbf{uj}+\mathbf{ju}\right)\right] & = & -\frac{M}{e\rho}\nabla p_{e}+\frac{m_{i}}{e\rho}\mathbf{j}\times\mathbf{B}+\eta\mathbf{j} \end{eqnarray} -(e.g. \cite{krall83}). Here $e$ represents the elementary +(e.g. \cite{KrallandTrivelpiece1973}). Here $e$ represents the elementary charge, $\mathbf{j}$ current density, $p$ the sum of electron and ion pressure, $\mathbf{B}$ the magnetic field, $\mathbf{E}$ the electric field, $M=m_{e}+m_{i}$, and $\eta$ resistivity. The first @@ -5289,7 +5290,7 @@ simulations. This noise can be suppressed by adding an artificial hyper-resistivity to the magnetic induction equation or by numerically smoothing the Hall electric field. The latter is done in VooDoo using a 3-point smoothing algorithm -\cite{birdsalllangdon91}. +\cite{Birdsall_2005}. In addition, there is also a severe penalty in the time step when the resolution is increased. The time step is proportional to $(\Delta x)^2$ so that time step decreases by an additional @@ -5425,7 +5426,7 @@ exceeding by far the electron scales. Effects of the finite electron mass originate from electron scales. They nevertheless may play also an important role for larger scale plasma phenomena. Laboratory experiments of reconnection have revealed, e.g. that the -thickness of current sheets maybe as sthin as several electron inertial +thickness of current sheets maybe as as thin as several electron inertial lengths. A the same time the current sheet thickness can be larger than the electron gyro-radius. This allows a fluid description of the electrons. And hybrid-code simulations with a finite-mass electron fluid have shown that the electron inertia can dominate when the current sheets thin down to electron inertial @@ -5530,7 +5531,7 @@ errors. In the ion-related (PIC-)part of the code the macro-particle positions and velocities at the $N$th time step are advanced for the electric and magnetic -field values defined on a staggered, the Yee-lattice grid~\cite{Yee1966} +field values defined on a staggered, the Yee-lattice grid~\cite{Yee_1966} being known at the time step $N$. For this the fields are first interpolated from the grid to the (macro-) ions positions with a weighting given by a @@ -6081,7 +6082,7 @@ for numerical simulations In general, because of computational reasons, periodic boundary conditions are used, a constraint not suited for the Harris equilibrium. To circumvent this inconvenient, in many studies a double Harris sheet is employed, that is a simple sum of two opposite Harris equilibria so that -the magnetic field profile can now be assumed as periodic. However, the so-called {\em double-Harris sheet} is no more a kinetic equilibrium +the magnetic field profile can now be assumed as periodic. However, the so-called \emph{double-Harris sheet} is no more a kinetic equilibrium because the first of Eq.(\ref{eq:potentials}) is a non linear equation and thus not satisfied by a simple linear combination of Harris sheets. Nevertheless, the double-Harris sheet is a force balance (MHD) equilibrium and thus has been deeply used in kinetic simulations by assuming that its characteristic time to evolve is longer than the system dynamics time scale or that it rapidly relaxes to a nearby kinetic equilibrium. However, this point remains since @@ -6091,8 +6092,8 @@ instabilities in the velocity space, for example those due to the presence of lo An analytical solution for a ``double-Harris like configuration'' has been obtained by superposing two opposite currents corresponding to two counter-streaming electron populations leading to a sinusoidal magnetic equilibrium but involving temperature anisotropic distributions, see Ref. \cite{att99}. These Harris-like approaches still face with the problem of obtaining an equilibrium solution in a "blinded way", so that the final -equilibrium is in principle "unknown" at the beginning of the procedure. In other words at the end of the procedure the equilibrium solution could be far from the one to be used. To step over this problem, -a generalized method for the "inverse problem" in 1D has been developed and summarized in Ref. \cite{allanson16}. It is aimed at +equilibrium is in principle ``unknown'' at the beginning of the procedure. In other words at the end of the procedure the equilibrium solution could be far from the one to be used. To step over this problem, +a generalized method for the ``inverse problem'' in 1D has been developed and summarized in Ref. \cite{allanson16}. It is aimed at obtaining analytical Vlasov equilibrium supporting a given macroscopic current sheet, including the case of force-free equilibria. The main objective is to address the magnetic reconnection problem. In this case, still using an Hamiltonian formulation in terms of the canonical momenta $p_{\alpha} = mv_{\alpha} + qA_{\alpha} /c$ and the corresponding Hamiltonian $H = mv^2 / 2 + q \phi$ for each species, one starts by imposing the force balance between @@ -6419,6 +6420,7 @@ To give a rough idea of how Eq. \eqref{eq:lbm9} propagates the occupation number \definecolor{mylgrey}{rgb}{0.8,0.8,0.8} \definecolor{mygreen}{rgb}{0.1,0.1,0.9} \definecolor{mygray}{rgb}{0.4,0.4,0.4} +\definecolor{mymauve}{rgb}{0.6,0.45,0.45} \lstset{ language=Python, @@ -6517,11 +6519,11 @@ The initial values were chosen as $\rho = 1.0$ and $u = 0$ at time $t = 0$. hard walls drawn in black and a lid that slides to the right with a prescribed velocity, drawn in red. The lattice points all lie inside the box and the walls lie half way between boundary lattice points and (virtual) solid lattice points -outside the box. (b) Streamlines in the steady state for a domain of 300 × 300 +outside the box. (b) Streamlines in the steady state for a domain of 300 $\times$ 300 lattice points and $\omega = 1.7$, corresponding to Reynolds number 1000, given the typical velocity of the sliding lid as $u_\text{lid} = 0.1$. The figures is visualized using the streamplot function of the matplotlib6library. The lattice is resampled -into a 30 × 30 lattice before determining the streamlines.} +into a 30 $\times$ 30 lattice before determining the streamlines.} \label{fig:lbm3} \end{figure} @@ -6539,8 +6541,1716 @@ special treatment of boundary or interior domains. We calculated the velocity field in the steady state. Fig. \ref{fig:lbm3}b shows the streamlines of the flow field ater 1 million time steps for a lattice of $300\times 300$ lattice points with $\omega=1.7$ and the velocity of the lid chosen as $u_\text{lid} = 0.1$. The sliding lid induces a large vortex rotating clock wise. The two lower corners show smalls vortices rotating in the opposite direction. + + +\chapter{Parallel programming} + + +This chapter is mostly based on a tutorial for the usage of work group cluster. While the very specific details are related to a cluster no longer in existence, the general idea of parallelisation, using different HPC architectures and writing to file systems is essentially similar for other systems. + +\section{HPC Architectures} + +The meaning of High-performance computing (HPC) has changed over the last decades including meaning like large mainframe systems over vector computers to cluster systems. The term HPC is anyway poorly defined (most recently HPC has been mixed with data science\dots). + +The classic usage of HPC systems is the simulation of fluid dynamics. This is a relevant topic in several physics fields, engineering, meteorology. The topology of interconnets is modeled to suit this usage (with some deviations in Jülich with its 5-dimensional torus interconnect). + +The technology of supercomputers has changed pretty much over the years - as we will see later - until recently large homogenous clusters were the trend, but this changes more and more to heterogeneous systems using GPU cards. + + + +\subsection{The old days: ENIAC} + +ENIAC (Electronic Numerical Integrator and Computer) was the first programmable, electronic, general-purpose digital computer, completed in 1945. There were other computers that had these features, but the ENIAC had all of them in one package. It was Turing-complete and able to solve ``a large class of numerical problems'' through reprogramming. + +Although ENIAC was designed and primarily used to calculate artillery firing tables for the United States Army's Ballistic Research Laboratory (which later became a part of the Army Research Laboratory), its first program was a study of the feasibility of the thermonuclear weapon. + +ENIAC was completed in 1945 and first put to work for practical purposes on December 10, 1945 + +\begin{itemize} + \item 40 parallel components (60 cm $\times$ 270 cm $\times$ 70 cm) + \item 170 m$^2$, 27 tons + \item 17,486 electron tubes, 7,200 diodes, 1,500 relais , 70,000 resistors + \item Price (with today's prices) 7 Mio. US Dollar +\end{itemize} +\begin{center} + \pgfimage[width=0.95\textwidth]{fig_chapter10/eniac} +\end{center} + +An addition takes 0.2 ms, a multiplication 2.8 ms, a division 24ms\\ +Programs were ``hard wired'', programs could not be stored + +ENIAC was \emph{HPC} because it was simply large + +\subsection{CRAY computers} +Since 1976 Cray computers have been the synonym for supercomputers + +\begin{itemize} + \item First Cray machines were vector machines (see below) + \item Moved later to multi-processor systems + \item Nowadays they sell clusters +\end{itemize} + +\begin{center} + \pgfimage[width=0.95\textwidth]{fig_chapter10/Cray-1-deutsches-museum} +\end{center} + + + +\subsection{Vector computers} +In the 70s vector computers were the state-of-the-art HPC +\begin{itemize} + \item Parallelization through ``Single instruction - multiple data'' + \item Typical example $$\vec{Y} = a \cdot \vec{X} + \vec{Y}$$ can be solved for vector processors in one step + \item Very fast for any simulation that can be written in the SIMD form + \item Due to complex coding pure vector machines are rarely used + \item Mostly Japanese machines (NEC SX-9 and other) +\end{itemize} +BUT: +\begin{itemize} + \item Modern computer architectures feature vector units + \item SSE features in Intel CPUs + \item GPUs are also highly vectorized +\end{itemize} + +\subsection{Symmetric Multiprocessing} +Symmetric multiprocessing comprises of +\begin{itemize} + \item Multiple CPUs + \item One memory block + \item Common access of all CPUs to the same memory +\end{itemize} +SMP systems are actually scaled up systems of normal servers\\ +Unfortunately the prices does not scale linearly with CPU numbers\\ +Typical systems: Sun Sparc M32, HP Superdome + + +\subsection{NUMA} +An extension to SMP systems are the non-uniform memory access (NUMA) systems + +\begin{itemize} + \item CPUs have a local memory (like in the SMP case) + \item All CPUs in a system share a common memory +\end{itemize} +This approach makes the large common memories of SMP unnecessary.\\ +The complexity of NUMA systems is very high and so is the price\\ +Typical examples include the SGI Altix systems + +\begin{center} + \pgfimage[width=0.95\textwidth]{fig_chapter10/altix} +\end{center} + + +\subsection{Clusters} +Almost every new supercomputer is a cluster of some kind. Its typical elements are +\begin{itemize} + \item Nodes have a set of CPUs and memory on their own + \item Nodes cannot access the memory of other CPUs + \item Communication is done via a high-speed network +\end{itemize} +This approach scales much better in terms of money\\ +Problems have to be compatible with the heterogeneous memory\\ +The interesting component is the high-speed network: Mostly Infiniband, but also special interconnects from, e.g. Cray + +Almost all systems on the Top 500 list are clusters\dots +\begin{center} + \pgfimage[width=0.88\textwidth]{fig_chapter10/top500} +\end{center} + + +\subsection{Massively parallel computers} +The last interesting approach used, is the massively parallel computing +\begin{itemize} + \item Independent computers get independent pieces of the workload + \item Communication is only done to present the final results +\end{itemize} +This approach has been used by SETI\@ Home (now: Boinc) and is limited to a very small set of problems.\\ +Alternatively the GRID computing of Cern can be seen as MPP + + +\subsection{GPUs} +The newest trend in HPC: GPGPU!\\ +\emph{General Purpose Graphic Processing Unit} +\begin{itemize} + \item GPGPUs are in some way similar to vector computes + \item Many modern implementations deliver good results only for single-precision + \item GPGPUs boost the nominal speed of clusters + \item Can only be programmed using special languages +\end{itemize} +Typical example: NVidia Kepler, Intel Knight's Corner + + +\subsection{The Tau cluster} + + +\begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/node_ohne} +\end{center} + + +\begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/node_cpu} +\end{center} + + + +\begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/node} +\end{center} + + + +The nodes consist of +\begin{itemize} + \item 2 Intel E5-2650v2 CPUs (total of 16 physical cores)\\ (2.6 GHz, 20MB cache, AVX extension) + \item 64 GB RAM + \item 2 64 GB SSDs + \item Ethernet-, Infiniband- and management port +\end{itemize} +Each system is, therefore an SMP system of its own. + +Systems are grouped in Twin or Quad chassis ($\rightarrow$ 64 cores in 2 height units) + + +\begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/quad} +\end{center} + +\begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/twin} +\end{center} + +The nodes are connected to headnode +\begin{itemize} + \item Single CPU system + \item Bundles the node SSDs to a cluster file system (BeeGFS) + \item Connects via a SAS-link the HP 3Par disk system (which our ITC friends bought) +\end{itemize} + +\begin{center} + \pgfimage[width=0.95\textwidth]{fig_chapter10/headnode} +\end{center} + + + +Two further machines +\begin{itemize} + \item Dual CPU Intel E5-2630v2 (12 physical, 24 logical cores) + \item 32 GB RAM + \item Large (and slow) disk array attached to caracal + \item serval serves login purpose +\end{itemize} + + +\begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/serval} +\end{center} + +\begin{center} + \pgfimage[width=0.95\textwidth]{fig_chapter10/caracal} +\end{center} + +And then\dots +\begin{itemize} + \item All machines are connected via Ethernet (the cluster nodes are not directly connected to the university network) + \item All cluster nodes are connected via high-speed Infiniband network + \item All machines are attached to a management network (so you don't have to go there to press the power switch) +\end{itemize} + +\begin{center} + \pgfimage[width=0.95\textwidth]{fig_chapter10/cluster} +\end{center} + +Why this configuration?\\ +Value for money! + + \textbf{16 cores per node}\\ + \begin{itemize} + \item 2 CPUs = 2400\$ + \item Mainboard = 700\$ + \item 64 GB RAM = 700\$ + \end{itemize} + = 250 \$ per core + + \textbf{60 cores per node}\\ + \begin{itemize} + \item 4 CPUs = 23200\$ + \item Mainboard = 8000\$ + \item 256 GB RAM = 2800\$ + \end{itemize} + = 570 \$ per core + +\textbf{Infiniband} is also the most popular way to connect clusters. +%Intel® Xeon® Processor E5-2650 v2 +%(20M Cache, 2.60 GHz) Launched Q3'13 8 95 W BOX : $1171.00 +%-> Board 900$ +% +%Intel® Xeon® Processor E7-8880 v2 +%(37.5M Cache, 2.50 GHz) Launched Q1'14 15 130 W TRAY: $5729.00 +%-> Quadboard rund $6000 +% +% +%Intel® Xeon® Processor E7-4860 v2 +%(30M Cache, 2.60 GHz) Launched Q1'14 12 130 W TRAY: $3838.00 +% + + + + +\section{Basic concepts of parallelization} + +\subsection{Independent jobs} +\begin{center} + \pgf[width=0.85\textwidth]{fig_chapter10/independent} +\end{center} + +Simplest parallelization: +\begin{itemize} + \item Applicable when problem is separable in non-communicating subproblems + \item No specific needs for the system + \item Only very few problems can be parallelized like this +\end{itemize} + + +\subsection{Shared memory} + +\begin{center} + \pgfimage[width=\textwidth]{fig_chapter10/shmem} +\end{center} +For systems with shared memory (i.e., CPUs share the same memory controller) +\begin{itemize} + \item Whenever problems can be separated in space + \item Requires SMP systems + \item No CPU-CPU communication required + \item Data transfer through common memory + \item Fast and dangerous +\end{itemize} + +\subsection{Global communication} +\begin{center} + \pgfimage[width=0.85\textwidth]{fig_chapter10/alltoall} +\end{center} +All-to-All communication +\begin{itemize} + \item may be required for data aggregation + \item is usually extremely expensive +\end{itemize} + +\subsection{Local communication} +\begin{center} + \pgfimage[width=\textwidth]{fig_chapter10/diffmem} +\end{center} + +\begin{center} + \pgfimage[width=0.85\textwidth]{fig_chapter10/diffmem2} +\end{center} + +The inter-CPU communication is +\begin{itemize} + \item the workhorse for all problems, which can be spatially decomposed + \item very cost-effective in terms of communication (only point-wise communication) +\end{itemize} + +\subsection{SETI\@ HOME} +SETI\@ HOME was one of the first projects to distribute small work packages\\ +Nowadays it is part of BOINC +\begin{center} + \pgfimage[width=0.5\textwidth]{fig_chapter10/boinc} +\end{center} +The idea is to have a problem, that can be separated into independent problems.\\ +For SETI\@ HOME these were radio observations of some minutes length + +This kind of distributed computing is simple to realize and limited in application +\begin{center} + \pgfimage[width=0.7\textwidth]{fig_chapter10/seti} +\end{center} + + +\subsection{Chess} +\begin{center} + \pgfimage[width=0.85\textwidth]{fig_chapter10/chess} +\end{center} + +Chess is an atypical problem +\begin{itemize} + \item Different moves are evaluated + \item Each move offers different new moves + \item This yields a longer tree + \item Basically a new thread can be started for each branch +\end{itemize} +Parallelization is of unknown quality - we do not know how many branches there are or if some branch ends earlier (check mate\dots)\\ +Essentially easy to parallelize +\begin{itemize} + \item On shared memory systems all CPUs know the state of the game anyway + \item On separated systems the complete state of the game can easily be transmitted. +\end{itemize} + +\subsection{Algebra} +A major part of supercomputing is devoted to linear algebra\\ +(The actual benchmark LINPACK for clusters is in fact a linear algebra test) + +Most of the linear algebra applications have been solved in various packages - which are mostly available as parallel program + +Possible distribution of matrices on CPUs +\begin{center} +\pgfimage[width=.85\textwidth]{fig_chapter10/matrices} +\end{center} + +\begin{center} +\pgfimage[width=.85\textwidth]{fig_chapter10/matrix2} +\end{center} + +\begin{itemize} + \item Different matrix geometries for different operations + \item Aim: Minimize communication + \item Mostly block wise schemes are used + \item If you really need to do \textbf{LARGE} matrix operations: Go for ScaLapack +\end{itemize} + +(Short note: The analysis of the CMB is a science case for this) + + + +\subsection{Fourier Transform} +The discrete Fourier transform +\begin{align*} +\hat f (k_x) = \sum_{j=1}^n f(x) \exp(-i k_x x) +\end{align*} +with $x$ discretized as $x_j= j \Delta x$ is a typical numerical problem\\ +The actual implementation is usually the FFTW + +For 1D data parallelization does not help. But how about multi-D data? +\begin{align*} +\hat f (k_x,k_y) = \sum_{i_x,i_y=1}^n f(x) \exp(-i_x k_x x) \exp(-i_y k_y y) +\end{align*} +Here the transform can be done dimension by dimension + +\begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/p3dfft} +\end{center} + +\begin{itemize} + \item Data is transformed in one dimension on processor only + \item Through transposition data is arranged to be on one CPU for the next dimension + \item Finally data is transposed in the correct dimension + \item One dimension cannot be cut! +\end{itemize} + +\textbf{Don't try this at home!} Other people have implemented this for you +\begin{itemize} + \item P3DFFT - Fortran based + \item SandiaFFT - C++ based +\end{itemize} + +\subsection{Fluid simulations} +Typical problem: The Burgers' equation +\begin{align*} + \frac{\partial u}{\partial t} + \frac{\partial}{\partial x} u^2 = 0 +\end{align*} +This can be discretized to +\begin{align*} + u_i^{n+1} = u_i^n \Delta t \left( \frac{(u_{i+1}^n)^2 - (u_{i-1}^n)^2}{2\Delta x}\right) +\end{align*} +(This is a not too good numerical scheme, but anyway\dots)\\ +We will assume periodic boundaries + +Implementation on one CPU +\pgfimage[width=\textwidth]{fig_chapter10/burgers1} +We introduce two ghost cells on both sides\\ +\begin{enumerate} + \item Update from left with $u_i^{n+1}=\dots$ + \item Stop at $i-1$ + \item Copy $u_0$ to right ghost cell + \item Copy $u_{i-1}$ to left ghost cell + \item Start over +\end{enumerate} + +\pgfimage[width=\textwidth]{fig_chapter10/burgers2} +For two CPUs, the simulation area is divided into two equal halves.\\ +We introduce two ghost cells for every CPU\\ +\begin{enumerate} + \item Update from left with $u_i^{n+1}=\dots$ + \item Stop at right end of CPU + \item Copy rightmost cell to left ghost cell of the next CPU + \item Copy leftmost cell to right ghost cell of the next CPU + \item Start over +\end{enumerate} + + +This is essentially the most important case! +\begin{itemize} + \item It can easily be extended to more CPUs and more dimensions + \item For higher dimensions the cells to be transmitted are hyperplanes of one dimension less + \item A good choice of the +\end{itemize} + +\section{Scaling of codes} + + +\subsection{What is scaling?} +\begin{description} + \item[Weak scaling] Every code has a fixed work load and for the scaling test the number of cores is increased increasing also the total work load + \item[Strong scaling] The total work load is a fixed quantity, that is distributed to the cores. When the number of cores is increased for the scaling test, the work load per core is decreased. +\end{description} + + \begin{center} + \pgfimage[width=0.8\textwidth]{fig_chapter10/scaling} + \end{center} + +\begin{figure} + \begin{center} + \pgfimage[width=0.8\textwidth]{fig_chapter10/weak} + \end{center} + \caption{Typical examples for weak scaling runs} + \label{fig:weak} +\end{figure} + +\begin{figure} + \begin{center} + \pgfimage[width=0.8\textwidth]{fig_chapter10/strong} + \end{center} + \caption{Typical examples for strong scaling runs} + \label{fig:strong} +\end{figure} + +\begin{itemize} +\item Strong scaling can be used to find the optimal work load per CPU +\item Weak scaling can be used to find the maximum problem size +\end{itemize} + +What is limiting the scaling? +\begin{itemize} + \item Communication overhead (too much surface area per simulation volume) + \item Uneven workload + \item Output! + \item Cache size (code runs faster, when it fits into the CPU's cache) +\end{itemize} + + + + +\section{Basics of OpenMP} + +\subsection{What is OpenMP?} +{\Large \textbf{Open} Specifications for \textbf{M}ulti \textbf{P}rocessing} + +\begin{itemize} + \item Standardized API for parallel programming + \item Supported by many vendors + \item Implemented in C/C++ and Fortran + \item Only available for shared memory systems +\end{itemize} + +What OpenMP does not do +\begin{itemize} + \item No run-time check for deadlocks + \item No run-time check for data dependency +\end{itemize} + + + OpenMP is based on the \emph{fork/join} model + \begin{itemize} + \item An OpenMP program starts as single thread (master thread) + \item Further threads (team) are generated by parallel regions + \item At the end of parallel regions threads are barrier synchronized + \item Beyond the parallel region code is executed sequentially + \end{itemize} + + \pgfimage[width=\textwidth]{fig_chapter10/omp1} + + +\subsection{Hello World! - OpenMP} + + +Code +\begin{lstlisting}[language=C] +int main(void) +{ + #pragma omp parallel + printf("Hello World\n"); +} +\end{lstlisting} + +Compile +\begin{lstlisting}[language=bash] +icc -openmp -o hello hello.c +gcc -fopenmp -o hello hello.c + +export OMP_NUM_THREADS=4 +./hello +Hello world +Hello world +Hello world +Hello world +\end{lstlisting} + + + + + + \subsection{Variables} + + Data is stored either shared or private + \begin{itemize} + \item The binding of variables is chosen in the code + \item Variables are by default shared + \item This is not true for loop variables! + \end{itemize} + There is also the special case of reduction variables, which are reduced by an arithmetic reduction at the end of a parallel block + +\pgfimage[width=\textwidth]{fig_chapter10/omp3} + +\pgfimage[width=\textwidth]{fig_chapter10/omp4} + + \subsection{General pragmas} + +C-style pragma +\begin{lstlisting}[language=C] +#pragma omp directive [clause[[,] clause] ...] +structured block +\end{lstlisting} +\vspace*{-10mm} +Fortran-style pragme +\begin{lstlisting}[language=Fortran] +!$OMP directive [clause[[,] clause] ...] +structured block +!$OMP END +\end{lstlisting} +\vspace*{-10mm} +You can check for OpenMP support during compile time +\begin{lstlisting}[language=C] +#ifdef _OPENMP +iam = omp_get_thread_num(); +#endif +\end{lstlisting} +\vspace*{-10mm} +\begin{lstlisting}[language=Fortran] +!$ iam = OMP_GET_THREAD_NUM() +\end{lstlisting} + + +\subsection{Useful OpenMP Runtime Commands} + +sets or returns the number of threads in the team +\begin{lstlisting}[language=C] +void omp_set_num_threads(int num_threads); +int omp_get_num_threads(void); +\end{lstlisting} + +returns the maximal number of threads in a team +\begin{lstlisting}[language=C] +int omp_get_max_threads(void); +\end{lstlisting} + +returns the the thread id (from 0 to $n-1$) +\begin{lstlisting}[language=C] +int omp_get_thread_num(void); +\end{lstlisting} + +returns the number of processors on which the program can be run +\begin{lstlisting}[language=C] +int omp_get_num_procs(void); +\end{lstlisting} + +\subsection{Useful OpenMP Runtime Commands} +toggles the dynamic thread team size +\begin{lstlisting}[language=C] +int omp_in_parallel(void); +void omp_set_dynamic(int dynamics_threads); +\end{lstlisting} + +returns the state of the dynamics thread time size +\begin{lstlisting}[language=C] +int omp_get_dynamic(void); +\end{lstlisting} + +toggles the nested parallelization +\begin{lstlisting}[language=C] +void omp_set_nested(int nested); +\end{lstlisting} + +returns the state of the nested parallelization +\begin{lstlisting}[language=C] +int omp_get_nested(void); +\end{lstlisting} + + +\subsection{Parallel regions: Syntax} + +Clauses +\begin{itemize} +\item \verb+private (list)+ +\item \verb+shared (list)+ +\item \verb+default (shared | none)+ +\item \verb+firstprivate (list)+ +\item \verb+reduction (operator: list)+ +\item \verb+if (scalar-expression)+ +\item \verb+copyin (list)+ +\item \verb+num_threads (integer-expression)+ +\item \verb+proc_bind (master | close | spread)+ +\end{itemize} +\begin{lstlisting}[language=C] +#pragma omp parallel [clause[[,] clause] ...] +structured block +\end{lstlisting} + +\subsection{Execution model} +\begin{itemize} + \item At the start of every parallel region a team of threads is generated + \item Thread 0 is the master thread +\end{itemize} + + \begin{lstlisting}[language=C] + #pragma omp parallel + { + printf("Hello World!\n"); + } + \end{lstlisting} + + \pgfimage[width=\textwidth]{fig_chapter10/nomp_1} + + + +\subsection{Parallel loops} + +\begin{itemize} + \item Main usage of OpenMP + \item Many programs can be parallelized efficiently through loop parallelization + \item Simple to do: Just add directive to loops + \item Not every loop can be parallelized + \item The \verb+for+ directive is doing the job +\end{itemize} + +Syntax: Clauses +\begin{itemize} + \item \texttt{private (list)} + \item \texttt{firstprivate (list)} + \item \texttt{lastprivate (list)} + \item \texttt{reduction (operator: list)} + \item \texttt{schedule (kind [, chunksize])} + \item \texttt{collapse (n)} + \item \texttt{ordered} + \item \texttt{nowait} +\end{itemize} + +Loops have to be in canonical form +\begin{itemize} + \item the number of loop runs has to be known before the start of the loop + \item the loop counter may not be altered inside the loop + \item the program has to end the loop + \item no early exit by \texttt{break} + \item no exceptions inside the loop that are catched outside + \item \texttt{exit} is allowed inside the loop +\end{itemize} + +\subsubsection{Parallel loops - examples} +Exampe: Row sum +\begin{lstlisting}[language=C] +#pragma omp parallel for +for ( i = 0; i < n; i++ ) { +a[i][0] = 0; +for ( j = 0; j < m; j++ ) +a[i][0] = a[i][0] + a[i][j]; +} +\end{lstlisting} + +Example: Smoothing +\begin{lstlisting}[language=C] +for ( i = 1; i < n; i++ ) { +#pragma omp parallel for +for ( j = 1; j < m - 1; j++ ) +a[i][j] = ( a[i-1][j-1] + a[i-1][j] + a[i-1][j+1] ) / 3.0; +} +\end{lstlisting} + +\subsubsection{Parallel loops - collapse} +\begin{itemize} + \item perfectly nested loops can be collapsed + \item all loop variables have to be independent + \item only the innermost loop may contain arbitrary code + \item useful for the iteration over multidimensional fields +\end{itemize} +\verb+#pragma omp parallel for collapse(n)+\\ +$n$ is the number of collapsed for loops + +\begin{lstlisting}[language=C] +#pragma omp parallel for collapse(3) +for(int l=0; l<10; ++l) +for(int j=0; j<3; ++j) +for(int k=0; k<7; ++k){ +/* Only here is arbitrary code */ +foo[l][j][k] = 0; +} +\end{lstlisting} + + + +\subsection{Ordered execution} +Ordered execution with \texttt{ordered} +\begin{itemize} +\item The \texttt{ordered} directive will execute the following block in the original sequential order +\item This allows sequential writing of data into a filee +\item Code in the ordered region is sequentialized +\end{itemize} +\texttt{\#pragma omp ordered} +\begin{itemize} + \item When parts of a loop have to be executed ordered the keyword has to be put in as directive and as clause +\end{itemize}strukturierter Block + +\begin{lstlisting}[language=C] +/* ordered as clause */ +#pragma omp parallel for ordered +for ( i=0; i; +int main(int argc, char** argv) { + // Initialize the MPI environment + MPI_Init(NULL, NULL); + // Get the number of processes + int world_size; + MPI_Comm_size(MPI_COMM_WORLD, &world_size); + // Get the rank of the process + int world_rank; + MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); + // Get the name of the processor + char processor_name[MPI_MAX_PROCESSOR_NAME]; + int name_len; + MPI_Get_processor_name(processor_name, &name_len); + // Print off a hello world message + printf("Hello world from processor %s, rank %d" + " out of %d processors\n", + processor_name, world_rank, world_size); + // Finalize the MPI environment. + MPI_Finalize(); +} +\end{lstlisting} + + +\subsection{MPI - Basic commands} + +\begin{lstlisting}[language=C] +MPI_Init(int* argc, char*** argv) +\end{lstlisting} +\vspace{-10mm} +During \verb+MPI_Init+, all of MPI's global and internal variables are constructed. For example, a communicator is formed around all of the processes that were spawned, and unique ranks are assigned to each process. Currently, \verb+MPI_Init+ takes two arguments that are not necessary, and the extra parameters are simply left as extra space in case future implementations might need them. + + +\begin{lstlisting}[language=C] +MPI_Get_processor_name(char* name, int* name_length) +\end{lstlisting} +\vspace{-10mm} +\verb+MPI_Get_processor_name+ obtains the actual name of the processor on which the process is executing. + +The final call in this program is: +\begin{lstlisting}[language=C] +MPI_Finalize() +\end{lstlisting} +\vspace{-10mm} +\verb+MPI_Finalize+ is used to clean up the MPI environment. No more MPI calls can be made after this one. + +\subsection{MPI - Communicators} +MPI utilizes so called communicators. At the start \verb+MPI_COMM_WORLD+ is constructed, which consists of all processors +\begin{lstlisting}[language=C] +MPI_Comm_size(MPI_Comm communicator,int* size) +\end{lstlisting} +\vspace{-10mm} +\verb+MPI_Comm_size+ returns the size of a communicator. For \verb+MPI_COMM_WORLD+ this returns the total number of processes +\begin{lstlisting}[language=C] +MPI_Comm_rank(MPI_Comm communicator,int* rank) +\end{lstlisting} +\vspace{-10mm} +\verb+MPI_Comm_rank+ returns the rank of a process in a communicator. Each process inside of a communicator is assigned an incremental rank starting from zero. The ranks of the processes are primarily used for identification purposes when sending and receiving messages. + +For almost all purposes two communicators are relevant +\begin{itemize} + \item \verb+MPI_COMM_WORLD+ with all processes and no topological information + \item \verb+MPI_CART_COMM+ a communicator with cartesian topology +\end{itemize} +For any multi-dimensional application, the Cartcomm simplifies life. + +\subsubsection{MPI - CartCommunicators} +\begin{lstlisting}[language=C] +MPI_Dims_create( nnodes, ndims, dims ) +\end{lstlisting} +\vspace{-10mm} +yields a balanced processor number for a cartesian communicator\\ +Input Parameter: +\begin{itemize} + \item \texttt{nnodes} number of processes to be distributed (integer) + \item \texttt{ndims} number of dimensions (integer) +\end{itemize} +Inout Parameter +\begin{itemize} + \item \texttt{dims} array of the size \texttt{ndims} which defines the number of processes in each dimension (array of integer)\\ Values $>0$ are used as given input, 0 will be calculated newly +\end{itemize} + +\begin{lstlisting}[language=C] +int MPI_Cart_create(MPI_Comm comm_old, int ndims, const int dims[], + const int periods[], int reorder, MPI_Comm *comm_cart) +\end{lstlisting} +\vspace{-10mm} +creates a new communicator with topological communicator\\ +Input Parameters +\begin{itemize} +\item \verb+comm_old+ input communicator (handle, typically \verb+MPI_COMM_WORLD+) +\item \verb+ndims+ number of dimensions of cartesian grid (integer) +\item \verb+dims+ integer array of size \verb+ndims+ specifying the number of processes in each dimension (output of \verb+MPI_Dims_create+ can and should be used) +\item \verb+periods+ logical array of size \verb+ndims+ specifying whether the grid is periodic (true) or not (false) in each dimension +\item \verb+reorder+ ranking may be reordered (true) or not (false) (logical) +\end{itemize} +Output Parameters +\begin{itemize} +\item \verb+comm_cart+ communicator with new cartesian topology (handle) +\end{itemize} + +\begin{lstlisting}[language=C] +int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[]) +\end{lstlisting} +\vspace{-10mm} +Determines process coords in cartesian topology given rank in group\\ +Input Parameters +\begin{itemize} +\item \verb+comm+ + communicator with cartesian structure (handle) +\item \verb+rank+ + rank of a process within group of comm (integer, from \verb+MPI_Cart_Rank+) +\item \verb+maxdims+ + length of vector coords in the calling program (integer) +\end{itemize} +Output Parameters +\begin{itemize} +\item \verb+coords+ + integer array (of size \verb+ndims+) containing the Cartesian coordinates of specified process (integer) +\end{itemize} + + + +\begin{lstlisting}[language=C] +int MPI_Cart_shift(MPI_Comm comm, int direction, int disp, int *rank_source, + int *rank_dest) +\end{lstlisting} +\vspace{-10mm} +Returns the shifted source and destination ranks, given a shift direction and amount +Synopsis\\ +Input Parameters +\begin{itemize} +\item \verb+comm+ + communicator with cartesian structure (handle) +\item \verb+direction+ + coordinate dimension of shift (integer) +\item \verb+disp+ + displacement (> 0: upwards shift, < 0: downwards shift) (integer) +\end{itemize} +Output Parameters +\begin{itemize} +\item \verb+rank_source+ + rank of source process (integer) +\item \verb+rank_dest+ + rank of destination process (integer) +\end{itemize} + + +\subsection{MPI - Send \& Receive} +\begin{lstlisting}[language=C] +MPI_Send(void* data, int count, MPI_Datatype datatype, + int destination, int tag, MPI_Comm communicator) +MPI_Recv(void* data, int count, MPI_Datatype datatype, int source, + int tag, MPI_Comm communicator, MPI_Status* status) +\end{lstlisting} +\vspace{-10mm} +Processes can send data to \verb+destination+ with a given \verb+datatype+ (cf. next slide)\\ +Data has certain tags to identify them.\\ +The receiver has to be actively expecting the data with that tag\\ +Since the rank of process depends on the communicator, this \verb+communicator+ has to be given explicitly. + + +Datatypes\\ +\begin{tabular}{ll} +\verb+MPI datatype+ & C equivalent\\ +\verb+MPI_SHORT+ & short int\\ +\verb+MPI_INT+ & int\\ +\verb+MPI_LONG+ & long int\\ +\verb+MPI_LONG_LONG+ & long long int\\ +\verb+MPI_UNSIGNED_CHAR+ & unsigned char\\ +\verb+MPI_UNSIGNED_SHORT+& unsigned short int\\ +\verb+MPI_UNSIGNED+ & unsigned int\\ +\verb+MPI_UNSIGNED_LONG+ & unsigned long int\\ +\verb+MPI_UNSIGNED_LONG_LONG+ & unsigned long long int\\ +\verb+MPI_FLOAT+ & float\\ +\verb+MPI_DOUBLE+ & double\\ +\verb+MPI_LONG_DOUBLE+ & long double\\ +\verb+MPI_BYTE+ & char +\end{tabular} + +\subsubsection{MPI Barriers} +\begin{lstlisting}[language=C] +int MPI_Barrier( MPI_Comm comm ) +\end{lstlisting} +Input Parameters +\begin{itemize} +\item \verb+comm+ communicator (handle) +\end{itemize} +Blocks the caller until all processes in the communicator have called it; that is, the call returns at any process only after all members of the communicator have entered the call. + + + +\subsubsection{MPI - Send \& Receive Minimal example} + +\begin{lstlisting}[language=C] +// Find out rank, size +int world_rank; +MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); +int world_size; +MPI_Comm_size(MPI_COMM_WORLD, &world_size); + +int number; +if (world_rank == 0) { + number = -1; + MPI_Send(&number, 1, MPI_INT, 1, 0, MPI_COMM_WORLD); +} else if (world_rank == 1) { + MPI_Recv(&number, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, + MPI_STATUS_IGNORE); + printf("Process 1 received number %d from process 0\n", + number); +} +\end{lstlisting} + + +\subsection{MPI - Reduction} +\begin{lstlisting}[language=C] +int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) +\end{lstlisting} +\vspace{-10mm} +Reduces values on all processes to a single value + +Input Parameters +\begin{itemize} +\item \verb+sendbuf+ + address of send buffer (choice) +\item \verb+count+ + number of elements in send buffer (integer) +\item \verb+datatype+ + data type of elements of send buffer (handle) +\item \verb+op+ + reduce operation (handle) +\item \verb+root+ + rank of root process (integer) +\item \verb+comm+ + communicator (handle) +\end{itemize} +Output Parameters +\begin{itemize} +\item \verb+recvbuf+ + address of receive buffer (choice, significant only at root) +\end{itemize} + +Operators +\begin{tabular}{ll} +\verb+MPI_LAND+ & logical \verb+AND+\\ +\verb+MPI_LOR+ & logical \verb+OR+\\ +\verb+MPI_LXOR+ & logical \verb+XOR+\\ +\verb+MPI_BAND+ & binary \verb+AND+\\ +\verb+MPI_BOR+ & binary \verb+OR+\\ +\verb+MPI_BXOR+ & binary \verb+XOR+\\ +\verb+MPI_MIN+ & minimum\\ +\verb+MPI_MAX+ & maximum\\ +\verb+MPI_SUM+ & sum\\ +\verb+MPI_PROD+ & product\\ +\verb+MPI_MINLOC+ & maximum and index \\ +\verb+MPI_MAXLOC+ & minimum and index \\ +\end{tabular} + + +\subsection{MPI Example: Burgers} +\begin{lstlisting}[language=C] +#include +#include +#include +#include +#include +#include +#define DIM 1 +//Define constants for directions +#define LEFT 0 +#define RIGHT 1 +#define B 2 +//Namespaces +using namespace blitz; +using namespace std; +//Some constants +const int N=1000; +const int tend=1000; +const int outputstep=50; +const double dx=1.; +const double dt=0.1; +int main(int argc, char *argv[]) { + +blitz::Array un, unp; + +//Buffers for data transfer +double in[B], out[B]; + +int localsize, localindex, localmin, localmax; +//MPI variables +int size, rank, dims[DIM]; +int periods[DIM], coords[DIM]; +int neighbours[2]; +MPI_Comm cartcomm; +MPI_Status status; +//Initialize MPI +MPI_Init(&argc,&argv); +//Find out how many processes are available +MPI_Comm_size(MPI_COMM_WORLD,&size); +MPI_Comm_rank(MPI_COMM_WORLD,&rank); +cerr <<"CPU " < $filename +echo "#PBS -N $jobname -q infiniband" >> $filename +echo "#PBS -l nodes=$i:ppn=16 -l walltime=10:30,mem=200Mb" >> $filename +echo "#PBS -w /scratch/large/fspanier -d /scratch/large/fspanier" >> $filename +echo "#PBS -u fspanier" >> $filename +echo "#PBS -m be" >> $filename +echo "#PBS -M felix@fspanier.de" >> $filename +echo "echo 'Strong scaling, $j grid cells on $k CPUs'" >> $filename +echo "time mpirun -np $k -hostfile " '$PBS_NODEFILE' " -mca btl self,sm,openib,tcp --bind-to-socket --bysocket ./burgers_mpi_bench $j" >> $filename +echo "echo 'Run complete!'" >> $filename +done +done +\end{lstlisting} + +\subsubsection{OpenMP jobs} + +OpenMP jobs are typically run on one node (really!), so 'nodes' has to be 1. 'ppn' can be any value from 1 to 16. Select the 'shmem' queue. The program can be run immediately, but '\verb+OMP_NUM_TASKS+' has to be set, otherwise all cores of the node will be used. +\begin{lstlisting}[language=bash] +#!/bin/bash +#PBS -N jobname -q shmem +#PBS -l nodes=1:ppn=16 -l walltime=30:00:00 +#PBS -u user +#PBS -m be +#PBS -M email@nwu.ac.za +#PBS -d /scratch/large/user/dir -w /scratch/large/user/dir +tasks=`cat $PBS_NODEFILE | wc -l` +hostname=`hostname` +echo "Running on $hostname with $tasks tasks." +export OMP_NUM_TASKS=$tasks +./program +\end{lstlisting} +\vspace{-10mm} +The wall time is set to 30 hours in this case. It is advisable to set a time which is more realistically to avoid zombie jobs blocking the cluster more than necessary (so set something like one hour more than your expected runtime). + +\subsubsection{Infiniband jobs} + +Infiniband jobs are in some aspects different: +\begin{itemize} + \item Of course the number of 'nodes' can be higher + \item 'ppn' should always be 16. + \item The 'infiniband' queue should be used + \item The program has to be run with mpirun. PBS defines a shell variable for the host file, that has to be passed to mpirun. If shell variable are to be exported this is done with the \verb+-x+ option of mpirun. +\end{itemize} + +\begin{lstlisting}[language=bash] +#!/bin/bash +#PBS -N jobname -q infiniband +#PBS -l nodes=32:ppn=16 -l walltime=30:00:00 +#PBS -u username +#PBS -m be +#PBS -M email@nwu.ac.za +#PBS -d /scratch/large/user/dir -w /scratch/large/user/dir +tasks=`cat $PBS_NODEFILE | wc -l` +hostname=`hostname` +echo "Running on $hostname with $tasks tasks." +export var1=value1 +export var2=value2 +mpirun -x var1 -x var2 -hostfile $PBS_NODEFILE -np $tasks + -mca btl self,sm,openib,tcp --bind-to-socket --bysocket ./program +\end{lstlisting} + + + +\subsubsection{Running a job} +\begin{itemize} + \item \texttt{qsub} submits the job + \item \texttt{qstat} shows the jobs run by the user + \item \texttt{qdel} remove a job from the queue +\end{itemize} + \begin{lstlisting}[language=bash] +fspanier@fsk-serval:/scratch/large/fspanier/burgers$ qsub strong_64_1000000.job +1478.fsk-caracal.puk.ac.za +fspanier@fsk-serval:/scratch/large/fspanier/burgers$ qstat +Job id Name User Time Use S Queue +------------------ ---------------- ---------- -------- - ----- +1478.fsk-caracal ...ng_64_1000000 fspanier 0 Q infiniband +fspanier@fsk-serval:/scratch/large/fspanier/burgers$ qdel 1478 + + \end{lstlisting} + +\subsection{More cluster info} +\begin{itemize} + \item \texttt{showq} on fsk-caracal prints a more detailed list of jobs +\end{itemize} + \begin{lstlisting}[language=bash] +fspanier@fsk-caracal:~$ showq +ACTIVE JOBS-------------------- +JOBNAME USERNAME STATE PROC REMAINING STARTTIME + +1477 aivascenko Running 512 18:45:41 Wed Apr 8 16:55:21 + + 1 Active Job 512 of 560 Processors Active (91.43%) + 32 of 36 Nodes Active (88.89%) + +IDLE JOBS---------------------- +JOBNAME USERNAME STATE PROC WCLIMIT QUEUETIME +0 Idle Jobs + +BLOCKED JOBS---------------- +JOBNAME USERNAME STATE PROC WCLIMIT QUEUETIME + +Total Jobs: 1 Active Jobs: 1 Idle Jobs: 0 Blocked Jobs: 0 + \end{lstlisting} + + +\subsection{http://fsk-caracal/ganglia} + + \begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/ganglia1} + \end{center} + + \begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/ganglia2} + \end{center} + + \begin{center} + \pgfimage[width=0.9\textwidth]{fig_chapter10/ganglia3} + \end{center} + + + + + + + + + + + + + + \bibliographystyle{natdin} -\bibliography{./literatur.bib} +\bibliography{literatur} \end{document}