From 2f6d54043d2212dedb6ce49079db72c88fffffbc Mon Sep 17 00:00:00 2001 From: csendlinger Date: Mon, 9 Dec 2024 16:14:08 +0100 Subject: [PATCH] more changes --- docs/paper/the-karl-code/paper.tex | 51 +++++++++++--------- docs/paper/the-karl-code/referee_report_1.md | 17 ++++--- docs/paper/the-karl-code/referee_report_2.md | 8 +-- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/docs/paper/the-karl-code/paper.tex b/docs/paper/the-karl-code/paper.tex index 3da13c8..1d7af87 100755 --- a/docs/paper/the-karl-code/paper.tex +++ b/docs/paper/the-karl-code/paper.tex @@ -152,7 +152,12 @@ A new parallelized simulation code is presented, which uses a semi classical Mon The KATRIN experiment is designed to measure the electron anti-neutrino mass to unprecedented sensitivity down to \SI{0.2}{eV} \citep{KATRIN2005}. At the experiment, the mass is inferred from the shape of the $\upbeta$-decay spectrum of tritium. The contribution of the mass on the shape is most dominant in the endpoint region. The experiment can be divided into two parts: the source section and the detector section. In the source section, tritium gas is circulated which provides a high luminosity stream of beta electrons. These electrons are magnetically guided to the detector section. There they are separated by their kinetic energy: one small stream being recorded by the detector, the other larger one reflected back to the source. -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}. \changed{This plasma influences the high energy spectrum through its self generated inhomogeneous electric potential.} A precise knowledge of the electron and ion energy spectrum and density is necessary for any plasma analysis. +Both the initial and reflected stream of electrons interact with the gas in the source. + +\changed{These interactions include among others elastic scattering, ionization and excitation processes. For electrons below \SI{100}{eV} elastic scattering is the dominant process, while for electrons above that energy ionization becomes dominant. This can lead to a large amount of electrons being created if the neutral gas density is high enough.} + +%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}. \changed{This plasma influences the high energy spectrum through its self generated inhomogeneous electric potential.} A precise knowledge of the electron and ion energy spectrum and density is necessary for any plasma analysis. The incident electron spectrum originating from tritium beta decay before any scattering 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 chain of events, with further branching event chains. First, new particles are created through ionization. \changed{Ionization produces two indistinguishable electrons with energies between 0 eV and the impact energy.} 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. @@ -162,7 +167,7 @@ The incident electron spectrum originating from tritium beta decay before any sc 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 \citep{MOBUS2001519}. \changed{The first method impresses with a high resolution in space and velocity but is very computational intensive, especially with many different interaction types and species. A comparison with Monte Carlo type simulations is complicated: Since this would not be a statistical method the noise is negligble, but the requirements to save the phase-space distribution (specifically for high velocities) are extremely high. 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 this 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 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. \changed{It can therefore also be used to calculate the MFP of interactions between simulated particles, e.g. for recombination of electrons with any of the present ions.} +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. \changed{It can therefore also be used to calculate the MFP of interactions between simulated particle species, e.g. for recombination of electrons with ions.} 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. @@ -183,10 +188,11 @@ For each movement step, the mean free path $\lambda_\text{mfp}$ of the correspon \end{equation} where $E$ is the kinetic energy of the particle in the lab frame, $\sigma_i$ is the cross section of a specific interaction, and $n_i$ the particle number density of the interaction partner. In the lab frame, the neutral gas has a non-zero drift velocity. The cross sections are evaluated from predefined functions. The particle number density of the interaction partner is calculated either from a predefined function for background species, or from the density field for tracked species, see section~\ref{ssec:denstiy_fields} and \ref{sec:implementation} for more information. The actual moved distance $d$ is a statistical quantity, which can be derived from the MFP through +\changed{ \begin{equation} - d = \lambda_\text{mfp} \cdot \log \frac{1}{\eta} \commaeq + d = -\lambda_\text{mfp} \cdot \log \eta \commaeq \label{eq:distance_from_mfp} -\end{equation} +\end{equation}} where $\eta \in (0, 1]$ is an uniform random number. This is due to an assumed Poisson random process, that results in an exponential probability distribution. 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. @@ -238,7 +244,8 @@ For the simulation, we decided to use C++ as a programming language for several 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 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 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. @@ -269,59 +276,59 @@ The drift mover is based on the description of the movement of the particle thro 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 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 position change is described by the movement around the gyrocenter $\Delta \mathbf{x}_\text{c}$, the movement of the gyrocenter parallel to the magnetic field $\Delta \mathbf{x}_\parallel$ and the drift movement of the gyrocenter $\Delta \mathbf{x}_\text{D}$. 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}}^2} + \mathbf{v}_\text{D} = \frac{\mathbf{E}\times \mathbf{B}}{\abs{\mathbf{B}}^2} \end{equation} and the timestep length $\Delta t$ \begin{equation} - \Delta t = \frac{\Delta x}{\abs{\vec{v}_\parallel} + \abs{\vec{v}_\perp} + \abs{\vec{v}_\text{D}}} \commaeq + \Delta t = \frac{\Delta x}{\abs{\mathbf{v}_\parallel} + \abs{\mathbf{v}_\perp} + \abs{\mathbf{v}_\text{D}}} \commaeq \end{equation} -where $\Delta x$ is the step length of the movement step and $\vec{v}_\parallel$ and $\vec{v}_\perp$ the velocity parallel and perpendicular to the magnetic field. The moved distance through the drift motion evaluates the to +where $\Delta x$ is the step length of the movement step and $\mathbf{v}_\parallel$ and $\mathbf{v}_\perp$ the velocity parallel and perpendicular to the magnetic field. The moved distance through the drift motion evaluates the to \begin{equation} - \Delta \vec{x}_\text{D} = \Delta t \cdot \vec{v}_\text{D} \fullstop + \Delta \mathbf{x}_\text{D} = \Delta t \cdot \mathbf{v}_\text{D} \fullstop \end{equation} 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 + \Delta \mathbf{x}_\parallel = \Delta t \cdot \mathbf{v}_\parallel \fullstop \end{equation} 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 + r_\text{g} = \frac{m \abs{\mathbf{v}_\perp}}{q \abs{\mathbf{B}}} \commaeq \end{equation} -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}$ +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 $\mathbf{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 + \mathbf{x}_\text{pc} = - r_\text{g} \frac{\mathbf{v}_\parallel \times \mathbf{v}_\perp}{\abs{\mathbf{v}_\parallel \times \mathbf{v}_\perp}} \fullstop \end{equation} Second, the gyro frequency is calculated through \begin{equation} - \omega_\text{g} = \frac{q \cdot \abs{\vec{B}}}{m} \fullstop + \omega_\text{g} = \frac{q \cdot \abs{\mathbf{B}}}{m} \fullstop \end{equation} 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 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 +Third, the movement of the gyrocenter is calculated by the rotation of $\mathbf{x}_\text{pc}$ around $\mathbf{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 + \Delta \mathbf{x} = \Delta \mathbf{x}_\text{c} + \Delta \mathbf{x}_\parallel + \Delta \mathbf{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 gyrocenter $\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 \mathbf{v}_\text{E}$, through the rotation of the perpendicular velocity around the gyrocenter $\mathbf{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 \mathbf{v} = \mathbf{v}_\parallel + \Delta \mathbf{v}_\text{E} + \mathbf{v}_{\perp,\text{rot}} \fullstop \end{equation} The acceleration through the electric fields calculates to \begin{equation} - \Delta \vec{v}_\text{E} = \Delta t \frac{q \vec{E}_\parallel}{m} \commaeq + \Delta \mathbf{v}_\text{E} = \Delta t \frac{q \mathbf{E}_\parallel}{m} \commaeq \end{equation} -where $\vec{E}_\parallel$ is the electric field parallel to the magnetic field. +where $\mathbf{E}_\parallel$ is the electric field parallel to the magnetic field. -The rotation of the perpendicular velocity is again calculated using Rodriges' rotation formula with the axis of rotation $\vec{v}_\parallel$ and angle of rotation $\Delta \theta$. +The rotation of the perpendicular velocity is again calculated using Rodriges' rotation formula with the axis of rotation $\mathbf{v}_\parallel$ and angle of rotation $\Delta \theta$. \subsection{Termination} \label{ssec:termination} diff --git a/docs/paper/the-karl-code/referee_report_1.md b/docs/paper/the-karl-code/referee_report_1.md index 73e0b97..d5b60e7 100644 --- a/docs/paper/the-karl-code/referee_report_1.md +++ b/docs/paper/the-karl-code/referee_report_1.md @@ -7,6 +7,7 @@ fs { color: Yellow; background-color: Black} csfs {color: Orange; background-color: #5f6a6a } done {color: green} reply {color: blue; font-weight: bold} +note {color: red; background-color: Black; font-style: italic; font-weight: bold} KARL - A Monte Carlo model for atomic and molecular processes in the tritium atmo- @@ -27,23 +28,23 @@ Apart from that, I have pointed out several drawbacks, which I list below. Consequently, I do not recommend publication of this manuscript. 1. Abstract. - - ?: What is described in the Abstract is exactly the same simulation logic of any Monte Carlo code that simulates the particle transport in a medium. I should expect some information concerning the actual novelties of the new code. + - ?: What is described in the Abstract is exactly the same simulation logic of any Monte Carlo code that simulates the particle transport in a medium. I should expect some information concerning the actual novelties of the new code. - C: “The code is parallelized using ... terminator, interaction types, movers and initialization.” This is difficult to understand and refers to details that are too specific.
Some of the comments are also obvious: the input of a program is expected to provide information about the simulation that the program is to carry out. What is the “resolution of the simulation domain”? What are the “user defined species”? What are the terminator and the movers?
1. F: Again, most of the information provided in sections 2 and 3 refer to the standard logic followed by all Monte Carlo codes simulating radiation-matter interaction that I know. A clear description of the novelties of the new code should be done making the corresponding comparisons with other available Monte Carlo codes that would be unable to do the same work. 2. C: Concerning equation (1): What is an “interaction partner”? Where is entering the drift velocity of the neutral gas? What are the predefined functions used to calculate the cross sections? -3. C: Equation (2) is not the most efficient way to calculate the “moved distance”. You should use d = −λmfp ·log η because this saves a division. In addition, and concerning the comment just after this equation, it is worth noting that the number of collisions in a given path length follows a Poisson distribution, but distances moved are distributed exponentially. -4. ?: Figure 2, without dimensions and no further explanations, seems to me not much +3. C: Equation (2) is not the most efficient way to calculate the “moved distance”. You should use d = −λmfp ·log η because this saves a division. In addition, and concerning the comment just after this equation, it is worth noting that the number of collisions in a given path length follows a Poisson distribution, but distances moved are distributed exponentially. Changed (in text not [yet] in the code); would not be a bottleneck in any case +4. ?: Figure 2, without dimensions and no further explanations, seems to me not much useful. -1. ? First paragraph of section 3: I should say that the characteristics mentioned are not exclusive of C++ and that, in my opinion, any modern programming language could +1. ? First paragraph of section 3: I should say that the characteristics mentioned are not exclusive of C++ and that, in my opinion, any modern programming language could do the job. 1. Some information about details of the simulation would be akcnowledged. - As an example I mention: “The movement itself is subdivided into in smaller steps. How big are these steps or how are they defined? - - ?: But the question is more general. There are not details about elements that are usual in any Monte Carlo simulation of the transport of particles in materials: absorption + - ?: But the question is more general. There are not details about elements that are usual in any Monte Carlo simulation of the transport of particles in materials: absorption energies, tracking parameters, simulation geometry construction and management, etc. 1. C: In figure 3, a red line indicates an “ideal scaling”. This is not mentioned at all in the text: what is its purpose? -2. F, C: Figure 4 shows data and a fit of them. No information of the function used for the fit is given, no information about the values of the best fit parameters is given, and no information about the goodness of the fit is given. In addition, no information about the details of the simulations carried out is given. The figure caption informs that the uncertainties have been calculated from a total of six simulations. Apart from the small and “strange” number (why not 5 or 3 or 10), there is no information about the number of histories simulated in each run and the simulation parameters chosen. -1. F: A comparison with other codes for the spectra shown in figure 5 lacks in order to judge the advantages of the new code. Here there is no information about the simulations geometry (dimensions, materials, compositions, densities, ...) and about the simulation carried out. Concerning the spectra in this figure, the last sentence of the section says: “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. Apart from the fact that the sentence is not correct (it seems that something lacks), I have difficulties to understand how the spectra shown actually provide the information about all interaction processes as stated. +2. F, C: Figure 4 shows data and a fit of them. No information of the function used for the fit is given, no information about the values of the best fit parameters is given, and no information about the goodness of the fit is given. In addition, no information about the details of the simulations carried out is given. The figure caption informs that the uncertainties have been calculated from a total of six simulations. Apart from the small and “strange” number (why not 5 or 3 or 10), there is no information about the number of histories simulated in each run and the simulation parameters chosen. +1. F: A comparison with other codes for the spectra shown in figure 5 lacks in order to judge the advantages of the new code. Here there is no information about the simulations geometry (dimensions, materials, compositions, densities, ...) and about the simulation carried out. Concerning the spectra in this figure, the last sentence of the section says: “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. Apart from the fact that the sentence is not correct (it seems that something lacks), I have difficulties to understand how the spectra shown actually provide the information about all interaction processes as stated. 2. F, C: Throughout the text, the reader is made to go back and forth in the reading, with continuous references to different sections (previous and subsequent), making it a practically impossible task. 3. F: In addition, there is a continuous reference to the Ph. D. thesis of one of the authors and to the paper above mentioned when some, may be relevant, details of the simulation should be provide. As an example, the paragraph “In some cases, there is not enough data ... ”, in pg.14 when elastic scattering is described, does not explain nothing and mentions things like “external simulations” that are incomprehensible. -4. C: In modern physics texts, vector quantities are usually written in boldface instead of using an arrow on top of the symbol. \ No newline at end of file +4. C: In modern physics texts, vector quantities are usually written in boldface instead of using an arrow on top of the symbol. irrelevant change; not colorcoded in the text \ No newline at end of file diff --git a/docs/paper/the-karl-code/referee_report_2.md b/docs/paper/the-karl-code/referee_report_2.md index 390ee6f..145f5a3 100644 --- a/docs/paper/the-karl-code/referee_report_2.md +++ b/docs/paper/the-karl-code/referee_report_2.md @@ -41,7 +41,7 @@ I now proceed to give some line-by-line comments - Page 3: Line 27: C: Please define what is meant by "high" energy electrons. How dominant is elastic scattering over inelastic in this energy range? - + changed these sentences completely Line 32: I don't know what is meant by "ab initio" in this sentence.
We have omitted "ab initio" preserving the original meaning @@ -62,7 +62,7 @@ Line 13: F: "High resolution" -> resolution in what quantity? What does hi Line 24: C: mention the mean free path used to sample a poisson process (as written it suggests a fixed distance step) -Line 28: C: "density is proportional to cumulated time" - presumably it depends not only on the time but also on the flux into the segment and also the volume of the segment? How large are the segments? Is there variability of density across those segments? +Line 28: C: "density is proportional to cumulated time" - presumably it depends not only on the time but also on the flux into the segment and also the volume of the segment? How large are the segments? Is there variability of density across those segments? text changes necessary? Stuff is explaned in the non-introduction part Line 31: C: "likeliness of recombination" → "rate of recombination"? Reworded the sentence to make the original intent clearer @@ -71,7 +71,7 @@ Page 5: Line 21: C: mean free path has been used earlier, introduce the acronym then. Page 9: -C: "Additionally, the particle class only accepts…" → the relevance of this comment is not clear to me. What would be the alternative? +C: "Additionally, the particle class only accepts…" → the relevance of this comment is not clear to me. What would be the alternative? removed that sentence Page 10: F: "The density fields need a higher resolution than the density difference". Why? Can you be quantitative about the scale of error introduced with some different resolutions? Perhaps a plot showing the accuracy for a few choices? @@ -122,7 +122,7 @@ Figure 3: C: Please explain "weak scaling" and "Ideal" in this figure.C: less than 1Gb, but for how many events? +Line 16: C: less than 1Gb, but for how many events? text change necessary? It is mentioned that only derived properties (density, current, deletions) are stored, for which the size does not depend on the number of events. Maybe mention the parameters for the largest output? Lines 20-21: ?: I find it hard to understand what this sentence is trying to tell me.