From cc9b0bf655758151d72c8605e19aca4aca2d4419 Mon Sep 17 00:00:00 2001 From: csendlinger Date: Tue, 6 Aug 2024 15:09:01 +0200 Subject: [PATCH] further spelling checks and minor additions --- docs/paper/the-karl-code/paper.bib | 13 +++- docs/paper/the-karl-code/paper.tex | 96 ++++++++++++++++-------------- 2 files changed, 60 insertions(+), 49 deletions(-) diff --git a/docs/paper/the-karl-code/paper.bib b/docs/paper/the-karl-code/paper.bib index 8cbb2dd..cae6407 100755 --- a/docs/paper/the-karl-code/paper.bib +++ b/docs/paper/the-karl-code/paper.bib @@ -11,7 +11,7 @@ @article{Fermi:1934aa, author = {E. Fermi}, - title = {Versuch einer Theorie der {$\beta$-Strahlen}.}, + title = {{Versuch einer Theorie der {$\beta$-Strahlen}.}}, journal = {Zeitschrift f{\"u}r Physik}, volume = {88}, number = {3--4}, @@ -119,7 +119,7 @@ @phdthesis{Kilian.2015, author = {Kilian, Patrick}, year = {2015}, - title = {Teilchenbeschleunigung an kollisionsfreien Schockfronten}, + title = {{Teilchenbeschleunigung an kollisionsfreien Schockfronten}}, keywords = {Computersimulation;kinetische Plasmaphysik;Schockfront;Sonnenwind;Sto{\ss}freies Plasma;Sto{\ss}welle;Teilchenbeschleunigung}, address = {W{\"u}rzburg}, school = {{Universit{\"a}t W{\"u}rzburg}} @@ -198,7 +198,7 @@ } @software{jansson, - author = {Petri Lehtinen, et. al}, + author = {{Petri Lehtinen, et. al}}, title = {{Jansson}}, url = {https://github.com/akheron/jansson.git}, version = {2.13}, @@ -212,4 +212,11 @@ address = {Ann Arbor}, publisher = {{Addison-Wesley Professional}}, isbn = {978-0321623218} +} + +@book{hussein2010radiation, + title={Radiation mechanics: Principles and practice}, + author={Hussein, Esam MA}, + year={2010}, + publisher={Elsevier} } \ No newline at end of file diff --git a/docs/paper/the-karl-code/paper.tex b/docs/paper/the-karl-code/paper.tex index 90fb605..2fa4d38 100755 --- a/docs/paper/the-karl-code/paper.tex +++ b/docs/paper/the-karl-code/paper.tex @@ -136,7 +136,7 @@ A new parallelized simulation code is presented, which uses a semi classical Mon {\em Solution method:} Semi-classical Monte Carlo \\ {\em Restrictions:} The geometry of the experiment is currently limited to the KATRIN experiment, but this may easily be changed.\\ {\em Unusual features:} The configuration is stored in JSON files. \\ - {\em Running time:} minutes to hours; Depending on number of simulated decays \\ + {\em Running time:} minutes to hours; depending on number of simulated decays \\ \end{small} @@ -148,25 +148,25 @@ The KATRIN experiment is designed to measure the electron anti-neutrino mass to Both the initial and reflected stream of electrons interact with the gas in the source. For high energy electrons these interactions include mostly elastic scattering, but also ionization. Hence, many more electrons, and therefore also ions, are created in the source than from beta decay alone. The charged particle density is high enough, that a plasma forms in the source \citep{Kuckert.2016}. This plasma influences the high energy spectrum through its self generated, ab initio inhomogeneous electric potential. A precise knowledge of the electron and ion energy spectrum and density is necessary for any plasma analysis. -The electron spectrum for high energy electrons is comparably simple to describe, as it follows the Fermi statistics of beta decay \citep{Fermi:1934aa}. However, it is much more complicated to describe for secondary electrons, leading to a Markov chain of events, with further branching event chains. First, new particles are created through ionization on the whole energy range. This creates a multitude of new possible branches with their own characteristics. Also other interactions become more dominant at lower energies, namely elastic scattering and excitation processes of the tritium molecules through electronic, rotational and vibrational excitation. All of these interactions create new branches with feedback to the initial branches. Additionally, electrons can also recombine the existing ions in the source. This process is not only dependent on the electron spectrum, but the ion spectrum as well. There are many different types of ions, which are created by clustering processes with the neutral gas. The neutral gas density, which is the dominant interaction partner for both electrons and ions, is not constant in the source, but ranges over more than three orders of magnitude over \SI{16}{m} \citep{Kuckert.2018}. Additionally, it has a position dependent mean drift velocity, also covering two orders of magnitude \citep{Kuckert.2018}. +The electron spectrum for high energy electrons is comparably simple to describe, as it follows the Fermi statistics of beta decay \citep{Fermi:1934aa}. However, it is much more complicated to describe for secondary electrons, leading to a Markov chain of events, with further branching event chains. First, new particles are created through ionization on the whole energy range. This creates a multitude of new possible branches with their own characteristics. Also other interactions become more dominant at lower energies, namely elastic scattering and excitation processes of the tritium molecules through electronic, rotational and vibrational excitation. All of these interactions create new branches with feedback to the initial branches. Additionally, electrons can also recombine with the existing ions in the source. This process is not only dependent on the electron spectrum, but the ion spectrum as well. There are many different types of ions, which are created by clustering processes with the neutral gas. The neutral gas density, which is the dominant interaction partner for both electrons and ions, is not constant in the source, but ranges over more than three orders of magnitude over \SI{16}{m} \citep{Kuckert.2018}. Additionally, it has a position dependent mean drift velocity, also covering two orders of magnitude \citep{Kuckert.2018}. Two different methods of descriptions seem obvious: a description through the temporal evolution of phasespace elements and a description through the Monte Carlo method by tracking of single particles. The first method impresses with a high resolution but is very computational intensive, especially with many different interaction types and species. Thus, it was rejected for the simulation of the problem at hand. The Monte Carlo method seems preferable, but in a classical Monte Carlo scheme each of the simulated events is independent on the others. This is not the case for events for electron and ions tracks because of recombination. This problem is addressed in the KARL code, which is presented in the following paper. -In the KARL code, single particles are tracked through the source from one interaction to another. The moved distance between interactions is determined from the mean free path. The performed interactions is drawn from a list of available interactions. During movement it is recorded how long a particle stays within a predefined segment of the source. The density of the particle specie in this segment is then proportional to the cumulated time in that segment. Thus, the density can be determined during simulation. It can therefore also be used to evaluated the likeliness of recombination. +In the KARL code, single particles are tracked through the source from one interaction to another. The moved distance between interactions is determined from the mean free path. The performed interactions are drawn from a list of available interactions. During movement it is recorded how long a particle stays within a predefined segment of the source. The density of the particle specie in this segment is then proportional to the cumulated time in that segment. Thus, the density can be determined during simulation. It can therefore also be used to evaluated the likeliness of recombination. The KARL code is customized to the special conditions in the KATRIN source. Hence, special care is taken to ensure correct movement of particles through the large density gradient. Additionally, all relevant interactions in a tritium gas atmosphere are included for both electrons and ions. \section{Description of the method} \label{sec:method} -In the simulation, decays are successively processed. Meaning that each decay particle is followed until its destruction, with an optional creation of new secondary particles. All primary and secondary particles are processed first, before new decay particles are added. The particle tracking is divided into two alternating steps. First, the particle is moved according to the electromagnetic fields in the source and the mean free path of the particle. Secondly, an interaction is performed. A detailed description of the simulation flow can be found in section~\ref{ssec:general_diagram}. The simulation ends once a predefined number of decays has been processed. During the simulation it is recorded how long a specific particle resides in predefined sections of the source and how often a particle crosses from one section to another. Both quantities can be used to calculate the particle density and particle currents in the source, see section~\ref{ssec:denstiy_fields} and \ref{ssec:current_collection}, which make up the result of the simulation. +In the simulation decays are successively processed. Meaning that each decay particle is followed until its destruction, with an optional creation of new secondary particles. All primary and secondary particles are processed first, before new decay particles are added. The particle tracking is divided into two alternating steps. First, the particle is moved according to the electromagnetic fields in the source and the mean free path of the particle. Secondly, an interaction is performed. A detailed description of the simulation flow can be found in section~\ref{ssec:general_diagram}. The simulation ends once a predefined number of decays has been processed. During the simulation it is recorded how long a specific particle resides in predefined sections of the source and how often a particle crosses from one section to another. Both quantities can be used to calculate the particle density and particle currents in the source, see section~\ref{ssec:denstiy_fields} and \ref{ssec:current_collection}, which make up the result of the simulation. \subsection{General diagram} \label{ssec:general_diagram} -After initialization (see section~\ref{ssec:initialization}), the simulation starts its iterative cycle, which contains three subcycles, see figure~\ref{fig:simulation_flow}. The first addresses how many primary particles/events are processed, which is predefined by the user. It adds primary particles to the particle queue, if it is empty. In the second subcycle a particle is selected at random from the particle queue. This particle is processed until its termination and a new particle is selected from the queue. Within the third subcycle, the actual particle treatment is performed, which includes alternating between the movement step and interaction step. +After initialization (see section~\ref{ssec:initialization}), the simulation starts its iterative cycle, which contains three subcycles, see Figure~\ref{fig:simulation_flow}. The first addresses how many primary particles/events are processed, which is predefined by the user. It adds primary particles to the particle queue, if it is empty. In the second subcycle a particle is selected at random from the particle queue. This particle is processed until its termination and a new particle is selected from the queue. Within the third subcycle, the actual particle treatment is performed, which includes alternating between the movement step and interaction step. -For each movement step, the mean free path (MFP) $\lambda_\text{mfp}$ of the corresponding particle is calculated through +For each movement step, the mean free path (MFP) $\lambda_\text{mfp}$ of the corresponding particle is calculated through \citep{hussein2010radiation} \begin{equation} \lambda_\text{mfp} = \frac{1}{\sum_i \sigma_i(E) n_i} \commaeq \end{equation} @@ -176,7 +176,7 @@ where $E$ is the kinetic energy of the particle in the lab frame, $\sigma_i$ is d = \lambda_\text{mfp} \cdot \log \frac{1}{\eta} \commaeq \label{eq:distance_from_mfp} \end{equation} -where $\eta \in (0, 1]$ is a random number. The particle is then moved by this distance $d$ in dependence on the electromagnetic fields inside the source, see section~\ref{ssec:movement}. During this step the density fields of the corresponding specie are updated. +where $\eta \in (0, 1]$ is an uniform random number. The particle is then moved by this distance $d$ in dependence on the electromagnetic fields inside the source, see section~\ref{ssec:movement}. During this step the density fields of the corresponding specie are updated. After the movement step it is evaluated if the particle needs to be terminated, which is mainly a check if the particle has left the simulation domain, or has hit a wall, see~\ref{ssec:termination}. If the particle is still alive, a random interaction is selected from the list of available interactions, weighted by its probability to occur. The probability scales with the cross section of that interaction and the interaction partner particle density. The corresponding interaction is performed and the interaction products, which are not the current particle are added to the particle queue. If the particle does no longer exist after the interaction (through recombination or clustering) it is terminated, otherwise the next movement step is performed. @@ -193,12 +193,12 @@ After the movement step it is evaluated if the particle needs to be terminated, In a general Monte Carlo simulation, each event is assumed to be independent of the other. However, different particles types can in general interact with each other, for example electrons and ions through recombination. Therefore, each Monte Carlo event in our simulation must be dependent on the other events. This dependence is mimicked in the simulation by so-called density fields. These density fields determine the number density of each particle specie during the simulation. These fields are then used to determine the MFP and are used in the selection of the interaction type. -In the simulation, the source is segmented into evenly spaced intervals in longitudinal, radial and azimuthal direction, predefined by the user, see figure~\ref{fig:segmentation} for a schematic representation. In each iteration step of the particle queue, it is recorded how long a particle with index $i$ stays in one of the predefined segments, labelled by the time $t_i$. The number density $n_\alpha$ of a species $\alpha$ is then proportional to the total time of all particles of the corresponding species spent in the segment $\sum_i t_i$ and the volume $V$ of the segment. In case of recombination, an additional term has to be added corresponding to the number of recombination $N_\gamma$ of the recombination partner $\gamma$ in the segment, resulting in +In the simulation, the source is segmented into evenly spaced intervals in longitudinal, radial and azimuthal direction, predefined by the user, see Figure~\ref{fig:segmentation} for a schematic representation. In each iteration step of the particle queue, it is recorded how long a particle with index $i$ stays in one of the predefined segments, labelled by the time $t_i$. The number density $n_\alpha$ of a species $\alpha$ is then proportional to the total time of all particles of the corresponding species spent in the segment $\sum_i t_i$ and the volume $V$ of the segment. In case of recombination, an additional term has to be added corresponding to the number of recombination $N_\gamma$ of the recombination partner $\gamma$ in the segment, resulting in \begin{equation} n_\alpha = \frac{\sum_i t_i}{t_\text{sim} V} - \frac{N_\gamma}{V} \commaeq \label{eq:target_field_density} \end{equation} -where $t_\text{sim}$ is called the simulated time \citep{Kellerer_2022}. It describes the simulated physical time that is past after simulating a fixed number of primary events $N_\text{prim.}$. In the case of radioactive beta decay at KATRIN, it can be directly determined by the activity $a$ through +where $t_\text{sim}$ is called the simulated time \citep{Kellerer_2022}. It describes the simulated physical time that has past after simulating a fixed number of primary events $N_\text{prim.}$. In the case of radioactive beta decay at KATRIN, it can be directly determined by the activity $a$ through \begin{equation} t_\text{sim} = \frac{N_\text{prim.}}{a}\, . \label{eq:simulated_time} \end{equation} @@ -214,31 +214,31 @@ The activity of the source is not dependent on the interaction of the charged pa \subsection{Current collection} \label{ssec:current_collection} -The second main objective of the code is to determine the particle currents in the source. This task is performed through so-called virtual barriers: predefined planes within the source, where each particle is registered, when it crosses from one side to another. The total current through the segment faces is then given by +The second main objective of the code is to determine the particle currents in the source. This task is performed through so-called virtual barriers: predefined planes within the source, where each particle is registered, when it crosses from one side to another. The total current through the segment faces is then given by \citep{Kellerer_2022} \begin{equation} j = \frac{N^+ - N^-}{A \, t_\text{sim}} \commaeq \end{equation} -(\citep{Kellerer_2022}) where $N^+$ and $N^-$ is the number of particles crossing the faces in positive and negative direction, $A$ is the area of the face and $t_\text{sim}$ the simulated time, see~Eq.~\ref{eq:simulated_time}. For convenience, the location of the virtual barriers are chosen to coincide with the segment boundaries, see figure~\ref{fig:segmentation}, of the density field calculation, see section~\ref{ssec:denstiy_fields}. +where $N^+$ and $N^-$ is the number of particles crossing the faces in positive and negative direction, $A$ is the area of the face and $t_\text{sim}$ the simulated time, see~Eq.~\ref{eq:simulated_time}. For convenience, the location of the virtual barriers are chosen to coincide with the segment boundaries, see Figure~\ref{fig:segmentation}, of the density field calculation, see section~\ref{ssec:denstiy_fields}. \section{Description of the implementation} \label{sec:implementation} -For the simulation, we decided to use c++ as a programming language for several reasons. First, it can be used for object oriented programming. This makes the code easier to read, because the classes were closely modelled after their physical representation. Secondly, the accuracy of the simulation relies on high statistics. Thus, many particle decays need to be simulated, which requires a fast calculation. For the same reason, we decided to employ parallel calculation, see section~\ref{ssec:parallelization}. +For the simulation, we decided to use C++ as a programming language for several reasons. First, it can be used for object oriented programming. This makes the code easier to read, because the classes were closely modelled after their physical representation. Secondly, the accuracy of the simulation relies on high statistics. Thus, many particle decays need to be simulated, which requires a fast calculation. For the same reason, we decided to employ parallel calculation, see section~\ref{ssec:parallelization}. -There are three basic building blocks of the simulation. First, the simulation itself is treated as a class, which is responsible for initialization of the simulation environment, see section~\ref{ssec:initialization} and guiding through the flow of the simulation, see figure~\ref{fig:simulation_flow}. Second, the particle class, which represents the simulated physical particles through their physical position, velocity and type of specie. Third, the specie class, which encapsulates the general behaviour of each particle type (like electrons) in the simulation. +There are three basic building blocks of the simulation. First, the simulation itself is treated as a class, which is responsible for initialization of the simulation environment, see section~\ref{ssec:initialization} and guiding through the flow of the simulation, see Figure~\ref{fig:simulation_flow}. Second, the particle class, which represents the simulated physical particles through their physical position, velocity and type of specie. Third, the specie class, which encapsulates the general behaviour of each particle type (like electrons) in the simulation. -The main feature of the specie class is to provide access to the density, velocity distribution and drift velocity of a specific type of particle. All three quantities are used for the calculation of the MFP and the choice of the interaction partner. However, we decided to distinguish between two types of species, those particles who are tracked throughout the simulation (electrons and ions) and those who act as background (tritium gas). This way, it is more clear which specie fulfils which function, especially in the initialization process. Additionally, the particle class only accepts the tracked specie class as input, reducing programming errors in the development of new injectors or interactions. +The main feature of the species class is to provide access to the density, velocity distribution and drift velocity of a specific type of particle. All three quantities are used for the calculation of the MFP and the choice of the interaction partner. However, we decided to distinguish between two types of species, those particles who are tracked throughout the simulation (electrons and ions) and those who act as background (tritium gas). This way, it is more clear which specie fulfils which function, especially in the initialization process. Additionally, the particle class only accepts the tracked specie class as input, reducing programming errors in the development of new injectors or interactions. The tracked specie class is composed of different classes, providing access to the behaviour of each particle type. Hence, each tracked specie can be tailored to the requirements of the user, either for testing, but also for the inclusion of further particles types. Along these lines, the code can be adapted to other experimental environments, provided the knowledge of the interactions and their cross sections. Each of the class members fulfils a special task, which will be described in detail in the following sections. \subsection{Movement} \label{ssec:movement} -The movement of particles is outsourced to the mover class. It moves the particle dependent on the E/B fields at the position of the particle, given the integrated distance a particle will move, see section~\ref{ssec:general_diagram}. The movement itself is subdivided into in smaller steps. This way, it can be evaluated if the particle has left the simulation domain between the steps, which stops the movement. Apart from the simulation boundary, the movement is stopped if the particle leaves a segment or energy bin of the density fields, see section~\ref{ssec:denstiy_fields}. No interaction will be performed afterwards, but a new distance will be drawn from the MFP at the new position of the particle, see equation~\ref{eq:distance_from_mfp}. This procedure does not increase the mean distance a particle travels, if the traversed density stays the same. However, large gradients will be taken into account in the calculation. Hence, the distance a particle moves is not over- or underrated when moving into higher or lower density regions respectively. However, the density fields need a higher resolution than the density difference, which increases the simulation time. Thus, the user needs to evaluate the trade off between simulation time and accuracy. +The movement of particles is outsourced to the mover class. It moves the particle dependent on the E/B fields at the position of the particle, given the integrated distance a particle will move, see section~\ref{ssec:general_diagram}. The movement itself is subdivided into in smaller steps. This way, it can be evaluated if the particle has left the simulation domain between the steps, which stops the movement. Apart from the simulation boundary, the movement is stopped if the particle leaves a segment or energy bin of the density fields, see section~\ref{ssec:denstiy_fields}. No interaction will be performed afterwards, but a new distance will be drawn from the MFP at the new position of the particle, see equation~\ref{eq:distance_from_mfp}. This procedure does not increase the mean distance a particle travels, if the traversed density stays the same. However, large gradients will be taken into account in the calculation. Hence, the distance a particle moves is not over- or underestimated when moving into higher or lower density regions respectively. However, the density fields need a higher resolution than the density difference, which increases the simulation time. Thus, the user needs to evaluate the trade off between simulation time and accuracy. Stopping the movement if a particle has left a density field segment has an additional benefit: it can be easily evaluated how long a particle has stayed in the segment. Each movement step the particle is alive, a counter variable is increased by the time the movement step took. If the movement is stopped this counter variable can be added to the corresponding density field segment. -Two different kinds of movers are implemented (Boris, Drift), which differ in their calculation of the new position and velocity. In general, the Boris mover provides a high accuracy, because it resolves the gyro motion of the particles, but it therefore needs more calculation time. Vice versa, the drift mover provides a fast calculation time, because it does not resolve the gyro motion, but it therefore less accurate. Both movers will be presented shortly in the following. +Two different kinds of movers are implemented (Boris, drift), which differ in their calculation of the new position and velocity. In general, the Boris mover provides a high accuracy, because it resolves the gyro motion of the particles, but it therefore needs more calculation time. Vice versa, the drift mover provides a fast calculation time, because it does not resolve the gyro motion, but it therefore less accurate. Both movers will be presented shortly in the following. \paragraph{Boris mover} @@ -254,15 +254,15 @@ The Boris push algorithm was chosen, because it is numerically stable with high \paragraph{Drift mover} -The drift mover is based on the description of the movement of the particle through its movement around its gyro centrum and the drift movement of the gyro centrum, see \citep{Chen.1984}. In the current version of the code, the drift mover should only be used for a constant magnetic field. No magnetic field gradients are considered, because the magnetic field at KATRIN is constant over most parts of the source \citep{Kellerer2022_1000143868}. +The drift mover is based on the description of the movement of the particle through its movement around its gyrocenter and the drift movement of the gyrocenter, see \citep{Chen.1984}. In the current version of the code, the drift mover should only be used for a constant magnetic field. No magnetic field gradients are considered, because the magnetic field at KATRIN is constant over most parts of the source \citep{Kellerer2022_1000143868}. In the drift mover, the movement is subdivided into smaller steps, given by the smaller value of the maximal step length $d_\text{max}$ (provided by the user) and the leftover distance the particle has still to move. The movement is ended, when the leftover distance is zero. Each movement step follows the same procedure. It can be subdivided into the change of the particle position and the change of the velocity, both described in the following. -The position change is described by the movement around the gyro centrum $\Delta \vec{x}_\text{c}$, the movement of the gyro centrum parallel to the magnetic field $\Delta \vec{x}_\parallel$ and the drift movement of the gyro centrum $\Delta \vec{x}_\text{D}$. +The position change is described by the movement around the gyrocenter $\Delta \vec{x}_\text{c}$, the movement of the gyrocenter parallel to the magnetic field $\Delta \vec{x}_\parallel$ and the drift movement of the gyrocenter $\Delta \vec{x}_\text{D}$. -The drift movement of the gyro centrum is calculated from the $E \times B$ drift velocity +The drift movement of the gyrocenter is calculated from the $E \times B$ drift velocity \begin{equation} - \vec{v}_\text{D} = \frac{\vec{E}\times \vec{B}}{\abs{\vec{B}}} + \vec{v}_\text{D} = \frac{\vec{E}\times \vec{B}}{\abs{\vec{B}}^2} \end{equation} and the timestep length $\Delta t$ \begin{equation} @@ -273,16 +273,16 @@ where $\Delta x$ is the step length of the movement step and $\vec{v}_\parallel$ \Delta \vec{x}_\text{D} = \Delta t \cdot \vec{v}_\text{D} \fullstop \end{equation} -The movement of the gyro centrum parallel to the magnetic field is calculated from +The movement of the gyrocenter parallel to the magnetic field is calculated from \begin{equation} \Delta \vec{x}_\parallel = \Delta t \cdot \vec{v}_\parallel \fullstop \end{equation} -The position change around the gyro centrum is calculated in three steps. First, the gyro radius is determined +The position change around the gyrocenter is calculated in three steps. First, the gyro radius is determined \begin{equation} r_\text{g} = \frac{m \abs{\vec{v}_\perp}}{q \abs{\vec{B}}} \commaeq \end{equation} -from the perpendicular velocity, the particle mass $m$ and charge $q$, which in turn is then used to determine the vector from the particle to the gyro centrum $\vec{x}_\text{pc}$ +from the magnitude of the perpendicular velocity, the particle mass $m$ and charge $q$, which in turn is then used to determine the vector from the particle to the gyrocenter $\vec{x}_\text{pc}$ \begin{equation} \vec{x}_\text{pc} = - r_\text{g} \frac{\vec{v}_\parallel \times \vec{v}_\perp}{\abs{\vec{v}_\parallel \times \vec{v}_\perp}} \fullstop \end{equation} @@ -290,18 +290,18 @@ Second, the gyro frequency is calculated through \begin{equation} \omega_\text{g} = \frac{q \cdot \abs{\vec{B}}}{m} \fullstop \end{equation} -The gyro frequency is then used to calculate the relative angle change towards the gyro centrum +The gyro frequency is then used to calculate the relative pitch angle change towards the gyrocenter \begin{equation} \Delta \theta = \Delta t \cdot \omega_\text{g} \fullstop \end{equation} -Third, the movement of the gyro centrum is calculated by the rotation of $\vec{x}_\text{pc}$ around $\vec{v}_\parallel$ with the angle of rotation $\Delta \theta$ through Rodriges' rotation formula. In total, the position changes calculates to +Third, the movement of the gyrocenter is calculated by the rotation of $\vec{x}_\text{pc}$ around $\vec{v}_\parallel$ with the angle of rotation $\Delta \theta$ through Rodriges' rotation formula. In total, the position changes calculates to \begin{equation} \Delta \vec{x} = \Delta \vec{x}_\text{c} + \Delta \vec{x}_\parallel + \Delta \vec{x}_\text{D} \fullstop \end{equation} -The velocity after movement is determined by the acceleration of the particle through the electric field $\Delta \vec{v}_\text{E}$, through the rotation of the perpendicular velocity around the gyro centre $\vec{v}_\perp^\text{rot}$ and the initial parallel velocity +The velocity after movement is determined by the acceleration of the particle through the electric field $\Delta \vec{v}_\text{E}$, through the rotation of the perpendicular velocity around the gyrocenter $\vec{v}_{\perp,\text{rot}}$ and the initial parallel velocity \begin{equation} - \Delta \vec{v} = \vec{v}_\parallel + \Delta \vec{v}_\text{E} + \vec{v}_\perp^\text{rot} \fullstop + \Delta \vec{v} = \vec{v}_\parallel + \Delta \vec{v}_\text{E} + \vec{v}_{\perp,\text{rot}} \fullstop \end{equation} The acceleration through the electric fields calculates to @@ -315,22 +315,26 @@ The rotation of the perpendicular velocity is again calculated using Rodriges' r \subsection{Termination} \label{ssec:termination} -The termination of particles is addressed by the terminator class. It checks for three different conditions. First it checks, if the particle has left the simulation geometry. For the KATRIN experiment the geometry can be approximated by a cylinder. However, the radius and height can be provided by the user for special analysis. Second, the terminator class checks if the particle has exceeded the user defined number of maximal interactions. This counter was added, to ensure that no trapped particles are tracked by the simulation. Otherwise the simulation would not end. This trap can occur for example through opposite neutral gas flow and reflection by electric fields. Third, the terminator class checks if the particle has exceeded the user defined lifetime. This counter ensures, that particles are not stored indefinitely. This could occur through special configuration of magnetic and electric fields. +The termination of particles is addressed by the terminator class. It checks for three different conditions. First it checks, if the particle has left the simulation geometry. For the KATRIN experiment the geometry can be approximated by a cylinder. However, the radius and height have be provided by the user for special analysis. Second, the terminator class checks if the particle has exceeded the user defined number of maximal interactions. This counter was added, to ensure that no trapped particles are tracked by the simulation. Otherwise the simulation would not end. This trap can occur for example through opposite neutral gas flow and reflection by electric fields. Third, the terminator class checks if the particle has exceeded the user defined lifetime. This counter ensures, that particles are not stored indefinitely. This could occur through special configuration of magnetic and electric fields. -In addition to the terminator class, the user can choose to add a deletion logger to the specie class. This class is evoked if the particle is deleted. It stores information on the type of deletion, namely if the particle has hit a wall, recombined, formed a cluster, or exceeded the maximum time alive or maximum number of interactions. These values are also added to the output of the simulation. So, the can either be used for debugging, but they can also be used for physical results. For example, the number of recombinations provides an insight if recombination is a dominant process. +In addition to the terminator class, the user can choose to add a deletion logger to the specie class. This class is evoked if the particle is deleted. It stores information on the type of deletion, namely if the particle has hit a wall, recombined, formed a cluster, or exceeded the maximum time alive or maximum number of interactions. These values are also added to the output of the simulation. So, this information can be used for debugging, but it can also be used for physical results. For example, the number of recombinations provides an insight if recombination is a dominant process. \subsection{Interactions} \label{ssec:interactions} Interactions of particles are processed in the interaction class. Additionally, it is used to provide access to the cross section of the interaction and the macroscopic cross section, which can be used in the calculation of the MFP and in the selection of the interaction, see section~\ref{ssec:general_diagram}. The interaction class itself is an interface class. The details of the interaction are implemented in the derived classes. This way it is easy to add more types of interactions in the future. All interactions are initiated using a given cross section and target specie. For the cross section, we decided to use a one dimensional functional. This way the user can either specify an implemented cross section to be used, or can also provide an own function in the configuration file, see section~\ref{ssec:initialization}. The target specie can either be a tracked or background specie. This allows for a high flexibility of the interaction class. -Currently there are seven types of interactions implemented: elastic scattering, clustering, recombination, free movement, charge exchange, excitation, ionization. In general, all types can be added to all species. However, the user has to decide if the specific use is sensible. In the following, the implementation of each interaction will be described. For the physical explanation, please refer to \citep{Kellerer_2022}. +Currently there are seven types of interactions implemented: elastic scattering, clustering, recombination, free movement, charge exchange, excitation and ionization. In general, all types can be added to all species. However, the user has to decide if the specific use is sensible. In the following, the implementation of each interaction will be described. For the physical explanation, please refer to \citep{Kellerer_2022}. \paragraph{Elastic scattering} -The elastic scattering class is initiated using the cross section, the target specie and a scattering angle distribution. This distribution can be used to draw a scattering angle, given the energy of the incoming particle. It can be set to an isotropic distribution, to a distribution provided by a file and a composite of distributions. For the distribution from a file, the angle distribution has to be provided given an energy binning. During evaluation of the scattering angle, the corresponding energy bin is determined and the corresponding angle distribution selected. The composite of distributions is used in cases, where there is data for a certain energy range, but not in the other. This is the case for the scattering of electrons of tritium molecules. At high energies, the scattering angle distribution is determined from external simulation \citep{Kellerer_2022}, at lower energies isotropic scattering is assumed. +The elastic scattering class is initiated using the cross section, the target species and a scattering angle distribution. This distribution can be used to draw a scattering angle, given the energy of the incoming particle. It can be set to an isotropic distribution, to a distribution provided by a file and a composite of distributions. -The interaction itself is performed in multiple steps. First, the velocity of a target particle is determined. It is compound of the drift velocity of the species and a velocity, which is rolled from the underlying velocity distribution. For the tritium gas, the drift velocity is determined in external simulation and the velocity distribution is given by a Maxwell-Boltzmann distribution \citep{Kellerer_2022}. For tracked particles the drift velocity is assumed to be zero and the velocity distribution is given by the density field. The velocity of the target particle is used to determine the impact energy in the laboratory frame. This energy is then used for the evaluation of the azimuthal scattering angle $\theta$. A second scattering angle is drawn in the interval $[0, 2\pi)$, responsible for the change of momentum in polar direction. Both angles and the target velocity are then used to rotate the velocity vector of the impact particle in the centre of mass frame, see \citep{Kellerer_2022} for the full calculation. This rotated velocity is then used as the new velocity of the impact particle. +If the distribution is provided by a file, the angle distribution inside the file has to be provided given an energy binning. During evaluation of the scattering angle, the corresponding energy bin is determined and the corresponding angle distribution selected. The scattering angle is then determined from the selected angle distribution. + +In some cases, there is not enough data from one source alone, to cover the whole impact energy range, but maybe from different sources. This is the case for the scattering of electrons of tritium molecules. At high energies, the scattering angle distribution is determined from external simulation \citep{Kellerer_2022}, at lower energies isotropic scattering can be assumed. For these cases, the angle can be determined through the composite of two distributions. + +The interaction itself is performed in multiple steps. First, the velocity of a target particle is determined. It is compound of the drift velocity of the species and a velocity, which is drawn from the underlying velocity distribution. For the tritium gas, the drift velocity is determined in external simulation and the velocity distribution is given by a Maxwell-Boltzmann distribution \citep{Kellerer_2022}. For tracked particles the drift velocity is assumed to be zero and the velocity distribution is given by the density field. The velocity of the target particle is used to determine the impact energy in the laboratory frame. This energy is then used for the evaluation of the polar scattering angle $\theta$. A second scattering angle is drawn in the interval $[0, 2\pi)$, responsible for the change of momentum in azimuthal direction. Both angles and the target velocity are then used to rotate the velocity vector of the impact particle in the center of mass frame, see \citep{Kellerer_2022} for the full calculation. This rotated velocity is then used as the new velocity of the impact particle. \paragraph{Clustering} The clustering class is initiated using the cross section, the target specie and the specie, which is the result of the clustering process. In the interaction itself it is assumed that the new particle follows the direction of movement of the target particle, but with different absolute velocity. The new absolute velocity is calculated from the velocity of a target particle and the new particles mass. The velocity of a target particle is determined analogue to its calculation in elastic scattering. @@ -354,22 +358,22 @@ In the interaction, first the velocity of a target particle is determined analog \begin{equation} E_\text{e} = E_\text{i} - E_\text{ion} - E_\text{i}^\text{new} \fullstop \end{equation} -Next, the direction of movement has to be determined. For both the impact particle and the ejected electron, the direction of movement is calculated as a rotation of the impact velocity in the laboratory frame by the polar and azimuthal angle, with scaling of their kinetic energy respectively. The polar angle of the impact particle $\phi_\text{i}$ is drawn from the interval $[0,2\pi)$. The ejection direction of the new electron is set to the opposite direction. Thus, the polar angle of the ejected electron $\phi_\text{e}$ is calculated from +Next, the direction of movement has to be determined. For both the impact particle and the ejected electron, the direction of movement is calculated as a rotation of the impact velocity in the laboratory frame by the polar and azimuthal angle, with scaling of their kinetic energy respectively. The azimuthal angle of the impact particle $\phi_\text{i}$ is drawn from the interval $[0,2\pi)$. The ejection direction of the new electron is set to the opposite direction. Thus, the azimuthal angle of the ejected electron $\phi_\text{e}$ is calculated from \begin{equation} \phi_\text{e} = \phi_\text{i} - \pi \fullstop \end{equation} -The azimuth angle of both particles is calculated, using the derivation of Grosswendt and Waibel \citep{Grosswendt:1978aa}. Lastly, the velocity of the ejected ion is set to the velocity of the target particles, assuming no recoil of the target particle in the interaction. As described before, this assumes a large mass difference of the impact particle and the target particle, which is the case for the dominant process in the source: ionization of tritium gas by electron impact. +The polar angle of both particles is calculated, using the derivation of Grosswendt and Waibel \citep{Grosswendt:1978aa}. Lastly, the velocity of the ejected ion is set to the velocity of the target particles, assuming no recoil of the target particle in the interaction. As described before, this assumes a large mass difference of the impact particle and the target particle, which is the case for the dominant process in the source: ionization of tritium gas by electron impact. \subsection{Calculation of fields} \label{ssec:field_calculation} The density fields are implemented as a class. Each specie holds its own member of this class, which simplifies the evaluation of the fields during the simulation, for example for the calculation of the MFP. The class holds its information in member variables, which are the time particles of the species have spent in a segment of the source, the number of recombination in this segment and the derived density itself. They are represented as four dimensional arrays. The fastest axis (third axis) is used for the different energy bins. This reduces the calculation time of the determination of the density in a segment, which is mainly a sum over all energy bins. It is evoked multiple times during the particle update, which requires a fast calculation. The use of the other axis follows the consideration of how often the bin changes in longitudinal, azimuthal and radial direction. The magnetic field is most commonly aligned in longitudinal direction. Thus, the particles mostly travel in longitudinal direction. Therefore, the second fastest axis is used for the longitudinal direction. The other two directions are similar in their usage. Because of the magnetron drift in radial inhomogeneous magnetic fields, it was decided to use the azimuthal direction next, followed by the radial direction. -The size of the arrays is derived from the user input. It is calculated from the desired number of segments and a build in under- and overflow. This way, if a particle can not be classified into one of the segments, the information is still recorded in the simulation. The energy bins are created in logarithmic scale with one bin each for under- and overflow. It can be set differently for each specie. Thus, important effects for each specie can be resolved more easily. In longitudinal direction, the bins are divided evenly with one bin each for under- and overflow. In general, these under- and overflow bins should not be filled during the simulation, because this would mean that a particle has left the simulation domain and is still alive. Hence, they can be used for debugging purposes. In radial direction, there is only an overflow bin, because the radius is lower bound to zero. In azimuthal direction no over- and underflow bins are used, due to the circular nature of the problem. +The size of the arrays is derived from the user input. It is calculated from the desired number of segments and a built in under- and overflow. This way, if a particle can not be classified into one of the segments, the information is still recorded in the simulation. The energy bins are created in logarithmic scale with one bin each for under- and overflow. It can be set differently for each specie. Thus, important effects for each specie can be resolved more easily. In longitudinal direction, the bins are divided evenly with one bin each for under- and overflow. In general, these under- and overflow bins should not be filled during the simulation, because this would mean that a particle has left the simulation domain and is still alive. Hence, they can be used for debugging purposes. In radial direction, there is only an overflow bin, because the radius is lower bound to zero. In azimuthal direction no over- and underflow bins are used, due to the circular nature of the problem. The calculation of the density needs also the physical time, see equation~\ref{eq:target_field_density}. This time is provided by a pointer to a timer class. This class is called, when new particles are injected in the simulation domain, see section~\ref{ssec:injection}, and thus the physical time increases. -The current collector is structured similar to the density field class. The difference being, that it holds instead the crossings in positive and negative direction through the predefined faces in three dimensional arrays for crossings in longitudinal, azimuthal and radial direction. The faces can be aligned to the segmentation of the density fields, but can in general be set to its own segmentation. However, the mover uses both the density fields and current collectors to evaluate possible endpoints of movement, see section~\ref{ssec:movement}. Thus, a different segmentation will lead to a longer simulation time. +The current collector is structured similar to the density field class. The difference being, that it holds the crossings in positive and negative direction through the predefined faces in three dimensional arrays for crossings in longitudinal, azimuthal and radial direction instead. The faces can be aligned to the segmentation of the density fields, but can in general be set to its own segmentation. However, the mover uses both the density fields and current collectors to evaluate possible endpoints of movement, see section~\ref{ssec:movement}. Thus, a different segmentation will lead to a longer simulation time. \subsection{Injection} @@ -379,7 +383,7 @@ The injection of new particles to the particle queue is managed by the injector In the case of the KATRIN source, the injected species are electrons, with an isotropic injection angle distribution and a Fermi energy distribution \citep{Fermi:1934aa} and T$_2^+$ ions, also with an isotropic injection angle distribution, but with a Maxwell-Boltzmann energy distribution. The mother drift velocity is provided by the drift velocity of the neutral tritium gas. -However, the injector class can also be used for the injection of a stream of directed particles. This is necessary, either for the evaluation of the influence of a electron gun in the experiment, or for test purposes. +However, the injector class can also be used for the injection of a stream of directed particles. This is necessary, either for the evaluation of the influence of an electron gun in the experiment, or for test purposes. After the injection of particles, the timer class is provided with a time, which has passed between injections. This time is based on the user defined activity. It can be calculated from the integrated density in the source and the decay constant. @@ -389,7 +393,7 @@ After the injection of particles, the timer class is provided with a time, which In order to obtain reasonable and robust results of the simulation, high statistics is necessary. This is especially the case, if also improbable effects like the excitation by rotation, should be visible in the results. The goal of high statistics can be reached by parallel computation. For the code, a simple parallelization strategy was used. The desired number of decays are distributed evenly on the cores, and each CPU core follows the simulation loop (see section~\ref{ssec:general_diagram}) independent from the others. The general setup of the simulation stays the same between CPU cores. However, an asset of the code is, that the Monte Carlo events of each particle track can be dependent on the other, for example in the case of recombination. In order to obtain this strong point, the number of desired events per CPU core are further subdivided into cycles with a fixed length. After each cycle, a synchronization step between the CPU cores is initiated. During the synchronization step, the data on the density fields is shared among all CPU cores. Since the simulation is set up the same for all CPU cores, this step only needs an additive operation on the array of cumulated times, see section~\ref{ssec:denstiy_fields}, and an additive step, to share the passed time. Additionally to the density field synchronization, also the data of the current borders and deletion loggers are synchronized, which is not strictly necessary, but keeps the data congruent on all CPU cores and makes the output step easier, see section~\ref{ssec:output}. -The benefit of this parallelization scheme lies in its simplicity. It is easy to include more CPU cores for the calculation. Only the synchronization step takes slightly longer. However, the main simulation effort lies in the movement and interaction step. Thus, the synchronization does not play a significant role. Further more, there is no need of a CPU core, which directs tasks to the other CPU cores. Hence, little communication and data exchange is necessary between CPU cores, which saves calculation time. +The benefit of this parallelization scheme lies in its simplicity. It is easy to include more CPU cores for the calculation. Only the synchronization step takes slightly longer. However, the main simulation effort lies in the movement and interaction step. Thus, the synchronization does not play a significant role. Furthermore, there is no need of a CPU core, which directs tasks to the other CPU cores. Hence, little communication and data exchange is necessary between CPU cores, which saves calculation time. The simplicity of the method also produces some drawbacks. First, the load on the CPU cores can be different even though the number of events was set to the same value because of the creation of new particles through ionization. However, if the cycle length is chosen large enough, the load can balance out. The specific choice of cycle length depends on the simulated problem and has to be chosen by the user. @@ -399,19 +403,19 @@ The simulation code used for this study was parallelized to improve the efficien \begin{figure}[tbp] \centering \includegraphics[width=1.0\textwidth]{figures/parallelization.pdf} - \caption{Scaling graph. Simulated using standard KATRIN parameters with increasing number of events. The load was divided evenly between the CPU cores. It was recorded how long the simulation took from start to finish, including output. The result of a single CPU core is used for prognosis of the ideal scaling. The simulations were performed on the bwForCluster NEMO\citep{nemo_cluster}} + \caption{Scaling graph. Simulated using standard KATRIN parameters with increasing number of events. The load was divided evenly between the CPU cores. It was recorded how long the simulation took from start to finish, including output. The result of a single CPU core is used for prognosis of the ideal scaling. The simulations were performed on the bwForCluster NEMO\citep{nemo_cluster}.} \label{fig:scaling_graph} \end{figure} \subsection{Output} \label{ssec:output} -The output of the simulation is written to a single HDF5 file \citep{hdf5}, which allows for extendable, structured data storage. Output is performed in two different modes. First, it is enacted after the initialization phase of the simulation to write non-changing data to file for each of the tracked specie. This includes for example, the mass and charge of the species, the volumes and surface areas of the segmentation and the number of bins. Second, the output is performed to write the simulated data (from density fields, current collector, deletion logger) to file. This step is performed after each CPU synchronization, see section~\ref{ssec:parallelization}. In general, only the last output is of interest for the user. However, the steps in between can be used for debugging. Additionally, if the user has not set the correct wall time at the programming cluster an intermediate result is available. Thus, the user can decide for each specie and output type (density field, current collector, deletion logger) the output interval and if the new data of the step should be saved separately or if the data of the old step should be overwritten. The latter saves disk space. Nevertheless, the size of the output file is comparably small, since it holds only derived properties; Depending of course on the number of segments chosen by the user. +The output of the simulation is written to a single HDF5 file \citep{hdf5}, which allows for extendable, structured data storage. Output is performed in two different modes. First, it is enacted after the initialization phase of the simulation to write non-changing data to the file for each of the tracked specie. This includes for example, the mass and charge of the species, the volumes and surface areas of the segmentation and the number of bins. Second, the output is performed to write the simulated data (from density fields, current collector, deletion logger) to file. This step is performed after each CPU synchronization, see section~\ref{ssec:parallelization}. In general, only the last output is of interest for the user. However, the steps in between can be used for debugging. Additionally, if the user has not set the correct wall time at the computing cluster an intermediate result is available. Thus, the user can decide for each specie and output type (density field, current collector, deletion logger) the output interval and if the new data of the step should be saved separately or if the data of the old step should be overwritten. The latter saves disk space. Nevertheless, the size of the output file is comparably small, since it holds only derived properties; Depending of course on the number of segments chosen by the user. \subsection{Initialization} \label{ssec:initialization} -The initialization of the simulation it administered by the simulation class using generators which are available for classes, requiring special user input. The specific build instructions have to be provided in a JavaScript Object Notation (JSON) file. Due to its hierarchical structure, it is easy to read, test and extend by the user, even with little programming experience. We use the Jansson library \citep{jansson} to read in the file. +The initialization of the simulation is administered by the simulation class using generators which are available for classes, requiring special user input. The specific run instructions have to be provided in a JavaScript Object Notation (JSON) file. Due to its hierarchical structure, it is easy to read, test and extend by the user, even with little programming experience. We use the Jansson library \citep{jansson} to read in the file. The JSON file is structured, such that each of the sections corresponds to one main idea of the code or class. Subsections are used, when the class is a composite of other classes. This way the parameter file stays extensible in the face of new methods and classes, which will be added in the future. A collection of JSON files for each generator is provided together with the code for easy usage. A selections of generators will be discussed in the following. @@ -460,7 +464,7 @@ In the random numbers section, the seed for the pseudo random numbers is set. It \paragraph{Species} -In the species section, all relevant information on the species used in the simulation is provided. It is subdivided into a section for the background species and tracked species. A specie is added to the simulation provided a unique key name and the necessary data, which is different for background species and tracked species. However, both sections need to specify the \textit{ParticleType}, which can either be 'electron', 'T2+', 'T3+', 'T+' or 'T2'. This defines the mass and charge of the specie. Furthermore, background species need three sections to be initialized (\textit{ConstantDensityField}, \textit{VelocityDistribution} and \textit{DriftVelocity}), while tracked species need nine (\textit{Mover}, \textit{Terminator}, \textit{Reflector}, \textit{DensityField}, \textit{VelocityDistribution}, \textit{DriftVelocity}, \textit{Loggers}, \textit{CurrentCollector}, \textit{Interactions}). +In the species section, all relevant information on the species used in the simulation is provided. It is subdivided into a section for the background species and tracked species. A specie is added to the simulation provided a unique key name and the necessary data, which is different for background species and tracked species. However, both sections need to specify the \textit{ParticleType}, which can either be `electron', `T2+', `T3+', `T+' or `T2'. This defines the mass and charge of the specie. Furthermore, background species need three sections to be initialized (\textit{ConstantDensityField}, \textit{VelocityDistribution} and \textit{DriftVelocity}), while tracked species need nine (\textit{Mover}, \textit{Terminator}, \textit{Reflector}, \textit{DensityField}, \textit{VelocityDistribution}, \textit{DriftVelocity}, \textit{Loggers}, \textit{CurrentCollector}, \textit{Interactions}). \subsection{Particle queue} \label{ssec:particle_queue} @@ -472,7 +476,7 @@ The queue used in the simulation to keep track of the simulated particles is no The code was tested thoroughly, including a comparison of specific simulations with expectations. These expectations were formulated for scenarios where an analytical expression of the simulation output can be derived. For these simulations, each interaction was investigated detached from the others. The inclined reader is referred to \citep{Kellerer_2022} for a description of all the tests. Here, only a special test case shall be mentioned, because of its importance: the test of elastic scattering. One can show with this test that the method of density fields, the treatment of interactions in general and movement of particles are implemented correctly because they all are a prerequisite for the correct result. -In this test case, monoenergetic particles are injected into a neutral gas reservoir with a Maxwell-Boltzmann distributed velocity. If elastic scattering is implemented correctly, then these particles will adopt the velocity distribution of the neutral gas independent of the initial energy. The shape can be described by the Maxwell-Boltzmann distribution \citep{peckham.1992}, scaled by the factor $\sqrt{E}$ taking into account the logarithmic binning and the speed of particles leaving the simulation domain. The simulation result and a fit to the data can be found in figure~\ref{fig:boltzmann_test}. +In this test case, monoenergetic particles are injected into a neutral gas reservoir with a Maxwell-Boltzmann distributed velocity. If elastic scattering is implemented correctly, then these particles will adopt the velocity distribution of the neutral gas independent of the initial energy. The shape can be described by the Maxwell-Boltzmann distribution \citep{peckham.1992}, scaled by the factor $\sqrt{E}$ taking into account the logarithmic binning and the speed of particles leaving the simulation domain. The simulation result and a fit to the data can be found in Figure~\ref{fig:boltzmann_test}. It can be seen that the data is well described by the fit with little deviations over a wide range of energies. The deviations can be attributed to the inherent statistical uncertainty of the Monte Carlo method. Simulations with other injection energies resulted in the same distribution (not shown). It can therefore be concluded that elastic scattering, and therefore the general structure of the code is implemented correctly. \begin{figure}[tbp] @@ -485,9 +489,9 @@ It can be seen that the data is well described by the fit with little deviations \section{Results} \label{sec:results} -The simulation tool KARL was designed to determine the charged particle distributions inside of the KATRIN source and to investigate influences of external parameters on this spectrum. Results of charged particle spectra, particle densities and currents at various positions in the source were already presented and discussed in \citep{Kellerer_2022}, including a comparison of results at different source conditions. The inclined reader is referred to this publication for an in depth description. +The simulation tool KARL was designed to determine the charged particle distributions inside of the KATRIN source and to investigate influences of external parameters on this spectrum. Results of charged particle spectra, particle densities and currents at various positions in the source were already presented and discussed in \citep{Kellerer_2022}, including a comparison of results at different source conditions. The inclined reader is referred to this publication for an in-depth description. -Thus, we decided to present at this point only a particle spectrum in the centre of the source, for illustrative purposes only. The spectrum can be found in figure~\ref{fig:katrin_particle_spectrum}. It was calculated using a factor 10 reduced particle density in the source compared to the simulations in \citep{Kellerer_2022}. The specific input file can be found at $\text{simulation\_config}/\text{parameter}/\text{katrin.json}$. +Thus, we decided to present at this point only a particle spectrum in the center of the source, for illustrative purposes only. The spectrum can be found in Figure~\ref{fig:katrin_particle_spectrum}. It was calculated using a factor 10 reduced particle density in the source compared to the simulations in \citep{Kellerer_2022}. The specific input file can be found at $\text{simulation\_config}/\text{parameter}/\text{katrin.json}$. \begin{figure}[tbp] \centering @@ -502,7 +506,7 @@ Electrons are created with energies drawn from the Fermi distribution of $\upbet Ions on the other hand are created with thermal energies of the neutral gas and then perform mostly elastic scatterings, which preserves the Maxwell Boltzmann distribution. The thermal distributions of ions and electrons differ due to different cross sections at lower energies \citep{Kellerer2022_1000143868}. The relative height of the differential density for the different ion species is a result of clustering processes, which will result in the end in T$_3^+$ ions. Clustering is more efficient for T$_2^+$ ions than for T$^+$ ions, which results in a higher density for T$^+$ ions than for T$_2^+$ ions. -The spectrum shows very clearly that all processes for the particles interact in a non-trivial manor. It is therefore necessary to use a sophisticated tool like KARL to simulate their behaviour inside the KATRIN source. +The spectrum shows very clearly that all processes for the particles interact in a non-trivial manner . It is therefore necessary to use a sophisticated tool like KARL to simulate their behaviour inside the KATRIN source. \section{Build instructions}