From f50eea7707d0a318206d5bd59d7dd8d6d4a1f7cf Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 27 Aug 2019 11:02:46 +0200 Subject: [PATCH] Added hlrs_testzugang201908. --- .../hlrs_testzugang201908/hpc_antrag.tex | 121 +++++++++++++++++ .../hlrs_testzugang201908/single_core.tex | 126 ++++++++++++++++++ 2 files changed, 247 insertions(+) create mode 100644 docs/antraege/hlrs_testzugang201908/hpc_antrag.tex create mode 100644 docs/antraege/hlrs_testzugang201908/single_core.tex diff --git a/docs/antraege/hlrs_testzugang201908/hpc_antrag.tex b/docs/antraege/hlrs_testzugang201908/hpc_antrag.tex new file mode 100644 index 0000000..ccdce98 --- /dev/null +++ b/docs/antraege/hlrs_testzugang201908/hpc_antrag.tex @@ -0,0 +1,121 @@ +\documentclass[10pt,a4paper,final]{article} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{graphicx} +\usepackage{siunitx} +\usepackage{upgreek} +\usepackage{titling} +\usepackage{comment} +\usepackage{standalone} +\usepackage{tikz} +\usetikzlibrary{shapes,arrows,chains} + +\title{Monte Carlo simulation of electron energy distribution for the KATRIN experiment} +\author{Christian Reiling} +\date{26. August 2019} +\setlength{\droptitle}{-10em} + +\begin{document} + \maketitle +\begin{abstract} +The KATRIN experiment aims to measure the electron neutrino mass by $\upbeta$-decay spectroscopy of tritium. To satisfy for the error budget of plasma effect it is required to examine the possible interactions of electrons and tritium with high precision. +Previous simulation already showed the need of examining these effects qualitatively. +This next generation Monte Carlo simulation examines these effect with higher statistics and spatial resolution. +\end{abstract} +\section*{Intention} + +\section*{Simulation Algorithm} +\begin{figure}[tb] + \includestandalone[width=\textwidth]{single_core}% without .tex extension + % or use \input{mytikz} + \caption{Flowchart of the Simulation Algorithm. Parallelization Strategy is not represented in this chart.} + \label{fig:flowchart} +\end{figure} +The Windowless Gaseous Tritium Source (WGTS) of the KATRIN experiment is implemented as \SI{16}{\meter} long tube with \SI{90}{\milli \meter} diameter. The molecular tritium $\mathrm{T}_2$ density profile and velocity distribution are implemented as constants in time as variations are neglible. For each relevant particle species a numeric density field is implemented for which the WGTS is sliced into cells. +The initial densities are set to zero and calulated within the simulation as discussed in the subsequent paragraphs. + +The final electron energy distribution can be extracted from the density field at the end of the simulation. For more precise resolution "logging barriers" are implemented where passing electrons are logged with their exact energy. These passing electron can be calculated to a high precision electron energy distrubtion. + +Particles are injected into the simulation by $\upbeta$-decay and by subsequent physical processes creating secondary particles. +$\upbeta$-electrons are injected using standard Monte Carlo simulation methods sampling location from the $\mathrm{T}_2$ density profile and the energy from the $\upbeta$-decay energy distribution. +Secondary particles are created within the simulation and appended to the "particle queue". New $\upbeta$-electrons are only injected once all particles in the "particle queue" are processed and until the target number of decays is met. + +Particle simulation is done by iterating propagation and interaction until a terminalization condition is met. +The terminalization conditions for the particles are leaving the WGTS and reaching thermal equilibrium with $\mathrm{T}_2$. Particles can also be terminalized by physical processes though various loss channels. + +Propagation is done by movement by one free mean path length (MFP). +The MFP is calculated from the interaction probabilty with relevant interaction partners at the inital position. The particle is then moved using Drift Approximation or Boris Push depending on user preference. Drift Approximation is more cost efficient but does not resolve the electric and magnetic fields as good as Boris Push. +During propagation the numeric density field is updated. +For electrons it is checked whether a "logging barrier" is crossed and if so the electron's properties are being logged to the output file. + +After propagation the particle interacts. +Therefore interaction partner and process is rolled at the final position. +The rolled interaction is then performed using standard Monte Carlo methods and changing the properties of the initial particle. +Particles created by the interaction are appended to the "particle queue" and if interaction partners are annhilated the corresponding density field is being updated. +If the current particle is not annhilated in the process or another terminalization condition is met the particle reruns the loop of moving and interacting again and so forth. + +Primary $\upbeta$-electrons usually loop $\mathcal{O}(10^2)$ times though the loop. +Secondary particles have much lower energies and usually thermalize. Therefore they loop $\mathcal{O}(10^6)$ times. + + +\section*{Parallelization Strategy} +Plain Monte Carlo simulations can be operated without communicating between the cores by combining the output in the postprocessing. +For this simulation it is important to synchronize the density fields across all cores. Therefore the density fields are averaged over all cores using standard MPI\_ALLGATHER average operations after a given number of $\upbeta$-decays. + +As scaling effects are still being investigated a shift to a more efficient strategy might be required. +Averaging after fix number of $\upbeta$-decays can slow down the simulation if the duration on the cores varies largly. A sufficient strategy can be averaging after fixed simulation time. + +The IO-strategy is rather simple as output is written to HDF5 files per core and the files are merged in the postprocessing. + + + +\begin{comment} +\newpage +\section*{Simulation Strategy} +The Windowless Gaseous Tritium Source (WGTS) of the KATRIN experiment is implemented as \SI{16}{\meter} long tube with \SI{90}{\milli \meter} diameter. The molecular tritium $\mathrm{T}_2$ density profile and velocity distribution are implemented as constants in time as variations are neglible. For each relevant particle species a numeric density field is implemented for which the WGTS is sliced into cells. +The initial densities are set to zero and calulated within the simulation as discussed in the next subsections. + +The final electron energy distribution can be extracted from the density field at the end of the simulation. For more precise resolution "logging barriers" are implemented where passing electrons are logged with their exact energy. These passing electron can be calculated to a high precision electron energy distrubtion. + +\subsection*{Parallelization strategy} +Plain Monte Carlo simulations can be operated without communicating between the cores by combining the output in the postprocessing. +For this simulation it is important to synchronize the density fields across all cores. Therefore the density fields are averaged over all cores using standard MPI\_ALLGATHER average operations after a given number of $\upbeta$-decays. + +As scaling effects are still being investigated a shift to a more efficient strategy might be required. +Averaging after fix number of $\upbeta$-decays can slow down the simulation if the duration on the cores varies largly. A sufficient strategy can be averaging after fixed simulation time. + +The IO-strategy is rather simple as output is written to HDF5 files per core and the files are merged in the postprocessing. + +\subsection*{Single core strategy} +In order to properly process secondary particles a "particle queue" is implemented where particles are held. +If the "particle queue" is not empty the first particle of the queue is being processed. +During processing further new particles can be created. Details on the Single particle processing will be discussed in the subsequent subsection. +When the particle queue is empty new primary $\upbeta$-electrons are injecting using standard Monte Carlo simulation methods. +The location is sampled from the $\mathrm{T}_2$ density profile and the energy from the $\upbeta$-decay energy distribution. + +The process of either processing the first particle or injecting a new $\upbeta$-electron is repeated until the target number of $\upbeta$-decays is met. + +After processing each particle the particle densities are being logged to the outputfile for anayslis purposes. + +\subsection*{Single particle processing} +Each particles is simulated until leaving the WGTS, disintegration through physical processes or when reaching thermal equilibrium with the tritium molecules. + +Processing starts with propagation by one free mean path length (MFP). +The MFP is calculated from the interaction probabilty with relevant interaction partners at the inital position. The particle is then moved using Drift Approximation or Boris Push depending on user preference. Drift Approximation is more cost efficient but does not resolve the electric and magnetic fields as good as Boris Push. +During propagation the numeric density field is updated. +For electrons it is checked whether a "logging barrier" is crossed and if so the electron's properties are being logged to the output file. + +After propagation the particle interacts. +Therefore interaction partner and process is rolled at the final position. +The rolled interaction is then performed using standard Monte Carlo methods and changing the properties of the initial particle. +Particles created by the interaction are appended to the "particle queue" and if interaction partners are annhilated the corresponding density field is being updated. +If the current particle is not annhilated in the process or another terminalization condition is met the particle reruns the loop of moving and interacting again and so forth. + +Primary $\upbeta$-electrons usually loop $\mathcal{O}(10^2)$ times though the loop. +Secondary particles have much lower energies and usually thermalize. Therefore they loop $\mathcal{O}(10^6)$ times. +\end{comment} + +\end{document} \ No newline at end of file diff --git a/docs/antraege/hlrs_testzugang201908/single_core.tex b/docs/antraege/hlrs_testzugang201908/single_core.tex new file mode 100644 index 0000000..4997373 --- /dev/null +++ b/docs/antraege/hlrs_testzugang201908/single_core.tex @@ -0,0 +1,126 @@ +% http://www.texample.net/tikz/examples/flexible-flow-chart/ +\documentclass{standalone} +\usepackage{tikz} +\usetikzlibrary{shapes,arrows,chains} +\begin{document} +% ------------------------------------------------- +% Color definition +\definecolor{myblue}{HTML}{2B86C0} +\definecolor{myred}{HTML}{C14400} +\definecolor{myyellow}{HTML}{FFD700} +\definecolor{mygreen}{HTML}{3F681C} + +%https://www.schemecolor.com/cute-lights.php +\definecolor{startstopcolor}{HTML}{FF555E} +\definecolor{testcolor}{HTML}{FFE981} +\definecolor{proccolor}{HTML}{83B2FF} +% ------------------------------------------------- +% Debugging Layer +% top +\pgfdeclarelayer{marx} +\pgfsetlayers{main,marx} +% A macro for marking coordinates (specific to the coordinate naming +% scheme used here). Swap the following 2 definitions to deactivate +% marks. +\providecommand{\cmark}[2][]{\relax} +\providecommand{\cmark}[2][]{% +\begin{pgfonlayer}{marx} +\node [nmark] at (c#2#1) {#2}; +\end{pgfonlayer}{marx} +} + +% ------------------------------------------------- +% Start the picture +\begin{tikzpicture}[% +>=triangle 60, % Nice arrows; your taste may be different +start chain=going below, % General flow is top-to-bottom +node distance=6mm and 60mm, % Global setup of box spacing +every join/.style={arrow}, % Default linetype for connecting boxes +] +% ------------------------------------------------- +% Box styles +\tikzset{ + base/.style={draw, on chain, on grid, align=center, minimum height=4ex, font=\sffamily, draw=none}, + proc/.style={base, rectangle, text width=10em, fill=proccolor}, + test/.style={base, diamond, aspect=3, text width=5em, fill=testcolor}, + startstop/.style={proc, minimum height=6ex, fill=startstopcolor}, +%base/.style={draw, on chain, on grid, align=center, minimum height=4ex, font=\sffamily}, +%proc/.style={base, rectangle, text width=10em}, +%test/.style={base, diamond, aspect=3, text width=5em}, +%startstop/.style={proc, minimum height=6ex}, +% Debug styles +coord/.style={coordinate, on chain, on grid, node distance=6mm and 25mm}, +nmark/.style={draw, cyan, circle, font={\sffamily}}, +% Line styles +arrow/.style={->, draw, black}, +slabel/.style={near start, xshift=1em, font=\sffamily}, +welabel/.style={near start, yshift=-0.8em, font=\sffamily}, +} +% ------------------------------------------------- +% Nodes +\node [startstop] (start) {Start of Processing}; +\node [proc, join] (injection) {Injection to PQ}; +\node [proc, join] (extract) {Extract PQ[0] $\rightarrow$ CP}; +\node [test] (empty) {PQ empty?}; +\node [test] (target) {Target decays?}; +\node [startstop] (end) {End of Processing}; + + +\node [test, right=of start] (terminate) {Termination?}; +\node [proc, join] (move) {Move by MFP\\ +$\rightarrow$ Update densities \\ +$\rightarrow$ Log to file }; +\node [test, join] (wall) {Wallhit?}; +\node [proc] (interaction) {Do Interaction \\ +$\rightarrow$ Update densities \\ +$\rightarrow$ Update queue }; +\node [test, join] (disint) {Disintegration?}; +% ------------------------------------------------- +% Coordinate markers +\node [coord, right=of extract] (c0) {}; \cmark{0} +\node [coord, above=of terminate, yshift = 1em] (c1) {}; \cmark{1} +\node [coord, left=of empty] (c2) {}; \cmark{2} +\node [coord, left=of target, xshift = -2.5em] (c3) {}; \cmark{3} + + +\node [coord, left=of terminate] (c4) {}; \cmark{4} +\node [coord, left=of wall] (c5) {}; \cmark{5} +\node [coord, left=of disint] (c6) {}; \cmark{6} +\node [coord, right=of empty] (c7) {}; \cmark{7} + +\node [coord, right=of disint] (c8) {}; \cmark{8} +% ------------------------------------------------- +% Annotations +%\node [above=0mm of p4, it] {(Queue was empty)}; +%\node [above=0mm of p8, it] {(Queue was not empty)}; +% ------------------------------------------------- +% North south connectors +\path (empty.south) to node [slabel] {yes} (target); +\draw [arrow] (empty.south) -- (target); +\path (target.south) to node [slabel] {yes} (end); +\draw [arrow] (target.south) -- (end); +\path (terminate.south) to node [slabel] {no} (move); +\draw [arrow] (terminate.south) -- (move); +\path (wall.south) to node [slabel] {no} (interaction); +\draw [arrow] (wall.south) -- (interaction); +% ------------------------------------------------- +% Complicated connectors +\draw [arrow] (extract.east) -- (c0) |- (c1) -- (terminate.north); + +\path (empty.west) to node [welabel] {no} (c2); +\draw [arrow] (empty.west) -- (c2) |- (extract.west); +\path (target.west) to node [welabel] {no} (c3); +\draw [arrow] (target.west) -- (c3) |- (injection.west); + +\path (wall.west) to node [welabel] {yes} (c5); +\draw [arrow] (wall.west) -| (c7) -- (empty); +\path (disint.west) to node [welabel] {yes} (c6); +\draw [arrow] (disint.west) -- (c6) -| (c5); +\path (terminate.west) to node [welabel] {yes} (c4); +\draw [arrow] (terminate.west) --(c4) -| (c5); + +\path (disint.east) to node [welabel] {no} (c8); +\draw [arrow] (disint.east) -- (c8) |- (terminate.east); + +\end{tikzpicture} +\end{document} \ No newline at end of file