diff --git a/docs/paper/the-karl-code/paper.tex b/docs/paper/the-karl-code/paper.tex index 0df80b0..a5fb2d1 100755 --- a/docs/paper/the-karl-code/paper.tex +++ b/docs/paper/the-karl-code/paper.tex @@ -171,7 +171,7 @@ Two different methods of descriptions seem obvious: a description through the te \section{Description of the method} \label{sec:method} -\changed{In the KARL code, particles are tracked from interaction to interaction. The distance between the interactions is determined from the mean free path to sample a Poisson process. The performed interaction is then drawn from a user-specified list of possible interactions. During the simulation new particles are created either through beta decay or through interaction between particles. All particles are put into a list, from where they are processed until they terminate. In case the list is empty new decay particles are created and inserted. The energy distribution of electrons created by the decay process is relatively simple to describe, since it follows the Fermi statistics of beta decay \citep{Fermi:1934aa}.} +\changed{In the KARL code, particles are tracked from interaction to interaction. The distance between the interactions is determined from the mean free path (MFP) to sample a Poisson process. The performed interaction is then drawn from a user-specified list of possible interactions. During the simulation new particles are created either through beta decay or through interaction between particles. All particles are put into a list, from where they are processed until they terminate. In case the list is empty new decay particles are created and inserted. The energy distribution of electrons created by the decay process is relatively simple to describe, since it follows the Fermi statistics of beta decay \citep{Fermi:1934aa}.} %\changed{The general setup of the code is such that in the first place incident particles from tritium beta decay are tracked. In the simulation decay events are successively processed. Meaning that each decay particle is followed until its destruction, during which it might produce new, secondary particles. All primary and secondary particles are processed until termination before new decay particles are added. %The initial energy spectrum for electrons created by the tritium beta decay is comparably simple to describe, as it follows the Fermi statistics of beta decay \citep{Fermi:1934aa}. %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, user-specified interactions. @@ -265,16 +265,16 @@ The second main objective of the code is to determine the particle currents in t \begin{equation} j = \frac{N^+ - N^-}{A \, t_\text{sim}} \commaeq \end{equation} -where $N^+$ and $N^-$ are the number of particles crossing the faces in positive and negative direction respectively, $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^-$ are the number of particles crossing the faces in positive and negative direction respectively, $A$ is the area of the face and $t_\text{sim}$ the simulated time, see equation~\eqref{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}. -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 behavior of each particle type (\changed{e.g.} 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 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 behavior of each particle type (\changed{e.g.} electrons) in the simulation. -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 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. +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 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 fulfills 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 behavior 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. @@ -282,7 +282,7 @@ The tracked specie class is composed of different classes, providing access to t \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 \changed{its} position, given the integrated distance a particle will move, see section~\ref{ssec:general_diagram}. The movement itself is divided into 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}. +The movement of particles is outsourced to the mover class. It moves the particle dependent on the E/B fields at \changed{its} position, given the integrated distance a particle will move, see equation~\eqref{eq:distance_from_mfp}. The movement itself is divided into 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}. \changed{In this case} no interaction will be performed, but a new distance will be drawn from the MFP at the new position of the particle, \changed{according to} 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 \changed{a higher resolution than the scale length of 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. @@ -332,7 +332,7 @@ The timestep has to be provided by the user. \changed{In order to resolve the gy \label{eq:boris_timestep_requirement} \Delta t < \frac{1}{\Omega_{g,\text{max}}} \end{equation} -\changed{should be fulfilled. Additionally one has to consider that the distance moved during one timestep is small enough that no segments might be skipped.} +\changed{should be fulfilled. Additionally one has to consider that the maximal distance moved during one timestep is small enough that no segments might be skipped.} This timestep is also used for the determination of the time a particle spends in a density field segment, see previous section. The Boris push algorithm was chosen, because it is numerically stable with high precision and efficiency \citep{Kilian.2015}. The method can be used for low relativistic particles, up to a gamma factor of $\gamma \approx 1000$ \citep{Vay.2008}. At the KATRIN experiment, only electrons of energies up to \SI{32}{keV} (Krypton conversion electrons) are created. This results in a gamma factor of $\gamma = 1.06$, which is well below the limit of the Boris push. @@ -403,7 +403,7 @@ The choice of which mover algorithm with which parameters should be used for whi The distance $d_\text{Boris}$ can be estimated using the timestep $\Delta t$ and the typical velocity $v_{typ}$ of the considered particle species through \begin{equation} \label{eq:boris_distance_estimate} -d_\text{Boris} \approx v_{typ}\Delta t \overset{Eq. \ref{eq:boris_timestep_requirement}}{<} \frac{v_{typ}}{\Omega_{g, \text{max}}} \fullstop +d_\text{Boris} \approx v_{typ}\Delta t \overset{Eq.\, \eqref{eq:boris_timestep_requirement}}{<} \frac{v_{typ}}{\Omega_{g, \text{max}}} \fullstop \end{equation} Using the requirement $d_\text{Drift} < d_\text{Boris}$ and the formula for the gyro-frequency one arrives at \begin{equation} @@ -449,7 +449,7 @@ In addition to the terminator class, the user can choose to add a deletion logge \label{fig:t3p_interactions} \end{figure} -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 \changed{target-density scaled} cross section, which \changed{is} used in the calculation of the MFP, \changed{see equation \eqref{eq:mean_free_path}}, and in the selection of the interaction%, see section~\ref{ssec:general_diagram}. +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 \changed{target-density scaled} cross section, which \changed{is} used in the calculation of the MFP, \changed{see equation \eqref{eq:mean_free_path}}, 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 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, or provide an own function in the configuration file, see section~\ref{ssec:initialization}. The target specie can either be a tracked or background specie, \changed{with some restrictions dependent on the specific interaction}. %This allows for a high flexibility of the interaction class. @@ -510,7 +510,7 @@ The clustering class is initiated using these \changed{approximated} cross secti \paragraph{Recombination} \changed{ -Recombination is the interaction in which an ion species and an electron species form a neutral particle: +Recombination is the interaction in which an ion species and an electron species form a neutral particle. Only two body processes are considered for this case: \begin{equation} \label{eq:recombination} \text{H}^+ + e^- \rightarrow \text{H} + h\nu \fullstop @@ -526,9 +526,9 @@ The free movement interaction is only a helper class, which is necessary if no o Only the following type of charge exchange interactions is considered \begin{equation} \label{eq:charge_exchange} -\text{H}_2^+ + \text{H}_2 \rightarrow \text{H}_2 + \text{H}_2^+ \fullstop +\text{H}_2^+ + \text{H}_2 \rightarrow \text{H}_2 + \text{H}_2^+ \commaeq \end{equation} -I.e. charge exchange processes are only possible between a background species and the corresponding singly charged ion. +i.e. charge exchange processes are only possible between a background species and the corresponding singly charged ion. } The charge exchange class is initiated using the cross section and the target specie. No product specie is necessary, because product and impact specie are the same. In the interaction, only the velocity of a target particle is determined, analogue its calculation in elastic scattering. This velocity is then used as the new velocity of the impact particle. Cross sections for this process class can be found in \citep{Janev.2003} \changed{ and are plotted in Figure~\ref{fig:t2p_interactions}}.