diff --git a/docs/paper/the-karl-code/paper.tex b/docs/paper/the-karl-code/paper.tex index 99c8eee..714fbc7 100755 --- a/docs/paper/the-karl-code/paper.tex +++ b/docs/paper/the-karl-code/paper.tex @@ -195,7 +195,7 @@ The KARL code is customized to the special conditions in the KATRIN source. Henc \changed{The main simulation cycle of the code consists of three subcycles, as shown in Figure~\ref{fig:simulation_flow}.} %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. +The first addresses how many primary particles/events are processed, which is predefined by the user. It adds primary particles to the particle list, if it is empty. In the second subcycle a particle is selected at random from the particle list. This particle is processed until its termination and a new particle is selected from the list. Within the third subcycle, the \changed{particle movement and any interactions are performed}. %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. @@ -223,7 +223,7 @@ The particle is then moved by this distance $d$ \changed{taking} the electromagn 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 \changed{then} performed and the interaction products, \changed{not including the incident 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. +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 \changed{then} performed and the interaction products, \changed{not including the incident particle}, are added to the particle list. If the particle does no longer exist after the interaction (through recombination or clustering) it is terminated, otherwise the next movement step is performed. \changed{The details of the implementation of the described components are described later in section~\ref{sec:implementation}.} @@ -240,7 +240,7 @@ If the particle is still alive, a random interaction is selected from the list o 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 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 in the selection of the interaction type. -In the simulation, the source is \changed{split} into evenly spaced intervals in longitudinal, radial and azimuthal direction, predefined by the user, see Figure~\ref{fig:segmentation} for a schematic representation \changed{of the segmentation}. In each iteration step of the particle queue, it is recorded how long a particle with index $i$ stays in one of the segments, labeled 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 \changed{split} into evenly spaced intervals in longitudinal, radial and azimuthal direction, predefined by the user, see Figure~\ref{fig:segmentation} for a schematic representation \changed{of the segmentation}. In each iteration step of the particle list, it is recorded how long a particle with index $i$ stays in one of the segments, labeled 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} @@ -592,7 +592,7 @@ The current collector is structured similar to the density field class. The diff \subsection{Injection} \label{ssec:injection} -The injection of new \changed{decay} particles to the particle queue is managed by the injector class. It is initiated by providing the event position distribution, the mother drift velocity and a list of species, with their energy and injection angle distribution. The event position distribution is used to determine the position, at which the new particles are to be injected. For each injected specie, the kinetic energy is drawn from the energy distribution. The corresponding velocity vector is drawn from the injection angle distribution and scaled by the kinetic energy. This velocity is then boosted by the mother drift velocity, which represents the movement of the decaying gas. +The injection of new \changed{decay} particles to the particle list is managed by the injector class. It is initiated by providing the event position distribution, the mother drift velocity and a list of species, with their energy and injection angle distribution. The event position distribution is used to determine the position, at which the new particles are to be injected. For each injected specie, the kinetic energy is drawn from the energy distribution. The corresponding velocity vector is drawn from the injection angle distribution and scaled by the kinetic energy. This velocity is then boosted by the mother drift velocity, which represents the movement of the decaying gas. 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. T$_2^+$ is used instead of HeT$^+$ due to the fact that both molecules have almost the same mass and no cross section data could be found in the literature for the latter. Nuclear recoil from the $\upbeta$-decay is not considered. This is again due to the higher interaction probability of the ions with the neutral gas, which thermalizes them more quickly. The mother drift velocity is provided by the drift velocity of the neutral tritium gas. @@ -704,10 +704,10 @@ In the random numbers section, the seed for the pseudo random numbers is set. It 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} +\subsection{Particle list} +\label{ssec:particle_list} -The queue used in the simulation to keep track of the simulated particles is no queue in the classical sense. Similar to a classical queue, particles are added to the end of the queue, when they are created through injection or by interactions like ionization. However, the next particle to simulate after the old one was deleted is not drawn from the front of the queue but at random from all particles in the queue. This decision was made, because the single events can be dependent on each other through the density fields and a bias towards injected particles should be avoided, especially because the injected particles have mostly higher energies than the others. Hence, it was decided to store the particles in a standard library vector \citep{Josuttis.2012}. To save computation time, the vector is initialized with a size of 100 elements, which marks a rough estimate of an upper limit on new particle per particle loop at standard KATRIN conditions. +The list used in the simulation to keep track of the simulated particles. Particles are added to the end of the list, when they are created through injection or by interactions like ionization. However, the next particle to simulate after the old one was deleted is not drawn from the front of the list but at random from all particles in the list. This decision was made, because the single events can be dependent on each other through the density fields and a bias towards injected particles should be avoided, especially because the injected particles have mostly higher energies than the others. Hence, it was decided to store the particles in a standard library vector \citep{Josuttis.2012}. To save computation time, the vector is initialized with a size of 100 elements, which marks a rough estimate of an upper limit on new particle per particle loop at standard KATRIN conditions. diff --git a/docs/paper/the-karl-code/referee_report_2.md b/docs/paper/the-karl-code/referee_report_2.md index 727eef4..163fb9e 100644 --- a/docs/paper/the-karl-code/referee_report_2.md +++ b/docs/paper/the-karl-code/referee_report_2.md @@ -134,8 +134,8 @@ Line 37: Value has to be provided by its value and its unit; dual use of t Line 42: More generally in this section it seems far too many words are spent explaining concepts that any user of this code will already know, and can be easily inferred from reading the source code, for example, explaining what a scalar or vector field is. It seems that lines P21 L42 - Page 22 L33 could be replaced with a single sentence, "the code implements utility classes for functions returning scalar fields, and three kinds of vector fields (constant vector, Z-pointing vector, and generic vector)", for example.
We agree that the explanation of these concepts is unnecessary, so we have removed the corresponding parts. However, this section is intended to show the possible options the user can choose within a parameter file. And while the names of the options were chosen to imply their respective function, we think it is still beneficial to state it explicitly. Page 24: - -The particle queue is introduced, and then it is clarified that it is not a queue. The code design seems appropriate, but can't the authors then rename it to something other than a queue, since it is not one?? Queue2List + +The particle queue is introduced, and then it is clarified that it is not a queue. The code design seems appropriate, but can't the authors then rename it to something other than a queue, since it is not one??
The queue is now a list Test cases section: