diff --git a/docs/paper/the-karl-code/paper.tex b/docs/paper/the-karl-code/paper.tex
index f2b6ad2..c284eae 100755
--- a/docs/paper/the-karl-code/paper.tex
+++ b/docs/paper/the-karl-code/paper.tex
@@ -619,8 +619,8 @@ The simplicity of the method also produces some drawbacks. First, the load on th
%The simulation code used for this study was parallelized to improve the efficiency of the computation, as described in the previous paragraph.
The effectiveness of this parallelization strategy can be seen in the scaling graph shown in Figure~\ref{fig:scaling_graph}.
\changed{The graph shows the weak scaling behavior of the code, i.e. the number of events per core is kept constant and the number of cores is varied. In an ideal scenario the wallclock time needed until completion depends only on the number of events per CPU core, meaning that the number of events processed per second should increase linearly with the number of tasks. It can be seen that the graph follows this behavior quite well, except for the first data point, which is slower due to the initialization step that cannot be parallelized.}
-%The graph illustrates the time it took for the simulation to complete for different numbers of events and CPU cores. As can be seen, the scaling is linear except for the first data point, which is slightly slower. This is due to the initialization of the simulation and the distribution of events to the different CPU cores.
-Once the simulation is properly initialized, the linear scaling is observed for all subsequent data points. This behavior is expected and is a common characteristic of parallelized simulations.
+%The graph illustrates the time it took for the simulation to complete for different numbers of events and CPU cores. As can be seen, the scaling is linear except for the first data point, which is slightly slower. This is due to the initialization of the simulation and the distribution of events to the different CPU cores. Once the simulation is properly initialized, the linear scaling is observed for all subsequent data points.
+This behavior is expected and is a common characteristic of parallelized simulations.
\begin{figure}[tbp]
\centering
@@ -640,9 +640,10 @@ Overwriting saves disk space. Nevertheless, the size of the output file is compa
\subsection{Initialization}
\label{ssec:initialization}
-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 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.
+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 \changed{major section} is provided together with the code for easy usage. A selection of \changed{the most important sections} will be discussed in the following.
\changed{
For input quantities that have a physical unit attached to them, e.g. the height and radius of the cylinder, the user can choose the units in the JSON file. During the parsing of the file an automatic conversion to SI units is performed. The conversion currently supports \si{mm}, \si{cm} and \si{m} for length units and \si{J} and \si{eV} for energy units.}
@@ -660,7 +661,7 @@ The general input of coordinates are transformed to cylinder coordinates $(r, \p
\paragraph{Vector field}
% Vector fields represent the idea, that for every point in space a certain three dimensional vector can be assigned.
-A vector field can be initiated through three different options: \textit{VectorFieldConstant}, \textit{VectorFieldFunctionInZ} and \textit{VectorFieldFromArray}. \changed{Any vector field object takes either a position as a Cartesian or cylinder vector and returns the value at that position as a cylinder vector.}
+A vector field can be initiated through three different options: \textit{VectorFieldConstant}, \textit{VectorFieldFunctionInZ} and \textit{VectorFieldFromArray}. %\changed{Any vector field object takes either a position as a Cartesian or cylinder vector and returns the value at that position as a cylinder vector.}
%For all three types, the general input of coordinates are transformed in the class to cylinder coordinates $(r, \phi, z)$ and the corresponding vector is calculated and returned.
\begin{itemize}
@@ -672,7 +673,7 @@ If the given coordinates is outside of the defined binning, a zero vector is ret
\paragraph{Velocity distribution}
%The velocity distribution represents the idea, that a velocity vector can be sampled for each point in space.
-Currently there is only one type of distribution implemented, the \textit{VelocityDistributionFromFunction}. However, in cases, where a velocity distribution is needed for a constructor but never will be used a `null' option is also available. For the \textit{VelocityDistributionFromFunction}, the velocity is sampled from a predefined function, the \textit{VelocityDistributionFunction}. Here, two options are available, the \textit{IsotropicDistribution} and the \textit{DirectedDistribution}. Both have in common, that first an energy is sampled from an given energy distribution. However, for the \textit{DirectedDistribution} this energy is used to scale a predefined direction vector using a predefined mass. For the \textit{IsotropicDistribution} the direction of movement is sampled from an isotropic distribution and then scaled to represent the correct energy. The mass can either be derived from a given particle type, or directly given as a \changed{numerical} value.
+Currently there is only one type of distribution implemented, the \textit{VelocityDistributionFromFunction}. However, in cases, where a velocity distribution is needed for a constructor but never will be used a `null' option is also available. For the \textit{VelocityDistributionFromFunction}, the velocity is sampled from a predefined function, the \textit{VelocityDistributionFunction}. Here, two options are available, the \textit{IsotropicDistribution} and the \textit{DirectedDistribution}. Both have in common, that first an energy is sampled from an given energy distribution. However, for the \textit{DirectedDistribution} this energy is used to scale a predefined direction vector using a predefined mass. For the \textit{IsotropicDistribution} the direction of movement is sampled from an isotropic distribution and then scaled to represent the correct energy. The mass can either be derived from a given particle type, or directly given as a \changed{arbitrary} value.
There are three different energy distributions available in the code, the electron energy distribution of tritium decay (\textit{TritiumBetaDecay}), the Maxwell Boltzmann distribution (\textit{MaxwellBoltzmann}) and a constant distribution (\textit{Constant}).
\begin{itemize}
@@ -768,11 +769,11 @@ n_s = \left(1-\exp\left(-\frac{z - z_\text{neutral}}{\lambda_\text{mfp}(E_\text{
Adding $n_u$ and $n_s$ yields the expected density profile.\\
In case the impact energy allows for at most two excitation events to be performed, the density for the twice scattered electrons $n_{s,2}$ can be calculated as well. In order to do so, one just has to calculate the probability $p(z)$ for a single particle to scatter twice within the length $z$:
\begin{equation}
-p(z) = \int_0^z dx \int_0^{z-x} dy p_1(x) p_2(y) \commaeq
+p(z) = \int_0^z dx \int_0^{z-x} dy\, p_1(x) p_2(y) \commaeq
\end{equation}
where $p_1(x)$ is the probability for a particle to scatter after a distance $x$ and $p_2(y)$ is the same at the new energy after the first scattering. Since the distribution of distances follows an exponential distribution, this leads to
\begin{equation}
-p(z) = \int_0^zdx \int_0^{z-x}dy \left[\frac{1}{\lambda_1} \exp\left(-\frac{x}{\lambda_1}\right)\right] \left[\frac{1}{\lambda_2} \exp\left(-\frac{y}{\lambda_2}\right)\right] \commaeq
+p(z) = \int_0^zdx \int_0^{z-x}dy\, \left[\frac{1}{\lambda_1} \exp\left(-\frac{x}{\lambda_1}\right)\right] \left[\frac{1}{\lambda_2} \exp\left(-\frac{y}{\lambda_2}\right)\right] \commaeq
\end{equation}
where $\lambda_1$ is the mean free path for the injected electron energy $E_{inj}$ and $\lambda_2$ for $E_{inj} - E_{th}$. Together with the requirement that a particle has to either scatter once, twice or not at all leads to
\begin{equation}
diff --git a/docs/paper/the-karl-code/referee_report_1.md b/docs/paper/the-karl-code/referee_report_1.md
index 83d068b..20adc02 100644
--- a/docs/paper/the-karl-code/referee_report_1.md
+++ b/docs/paper/the-karl-code/referee_report_1.md
@@ -40,11 +40,11 @@ Consequently, I do not recommend publication of this manuscript.
We have tried to sharpen the profile of sections 2 and 3. The comparison to other codes is done in a later section. As outlined before in this reply we are not aware of any publicly available code which solves the problem of tritium interactions.
2. 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?
We tried to clarify the meaning of "interaction partner" in the text. "Predefined functions" are (as the name implies) functions that are defined within the code to evaluate the cross sections for the different types of interactions.
3. 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.
We have added a sentence specifying the exponential distribution of distances moved and adapted the calculation. It should be mentioned however, that for the equation itself there is no difference between original and new version and that within the code the additional division would not create a noticable overhead since a large part of the computational time is spent in the movement step.
-4. Figure 2, without dimensions and no further explanations, seems to me not much useful.
We believe the sketch gives some insight into the grid used for the source. The content could be spelled out also but the graphic representation seems more self-explanatory.
+4. Figure 2, without dimensions and no further explanations, seems to me not much useful.
We believe the sketch gives some insight into the grid used for the source. The content could be spelled out also but the graphic representation seems more self-explanatory.
5. 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.
C++ is not the only choice, but when looking for a fast, object-oriented language which is widely used it is in our view the first choice. We have clarified this.
6. Some information about details of the simulation would be acknowledged.
- - As an example I mention: “The movement itself is subdivided into in smaller steps. How big are these steps or how are they defined?
The step size is defined by the user in the parameter file. We have added some more information about how the size should be chosen.
+ - As an example I mention: “The movement itself is subdivided into in smaller steps. How big are these steps or how are they defined?
The step size is defined by the user in the parameter file. We have added some more information about how the size should be chosen.
- 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.
We are not exactly sure whether we understand this correctly, we can only guess that the referee infers the logic used in Monte Carlo simulation frameworks like GEANT, where e.g. detectors are simulated. To our understanding some of these concepts are not relevant to the type of simulation we are pursuing: Absorption energies are not used since particle-particle interactions are simulated inside the tritium gas directly using the single processes (and particles leaving the source through the wall are out of the equation). Particle tracks are essentially followed, but not recorded only cumulative parameters are considered. If we are in the logic of GEANT the only parameter for the track of a particle is its maximum interaction number. The geometry is a cylinder for all cases anyway.
1. In figure 3, a red line indicates an “ideal scaling”. This is not mentioned at all in the text: what is its purpose?
The text now mentions this explicitly and its purpose is now explained.
2. 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.
diff --git a/docs/paper/the-karl-code/referee_report_2.md b/docs/paper/the-karl-code/referee_report_2.md
index 08e81e8..eda7e43 100644
--- a/docs/paper/the-karl-code/referee_report_2.md
+++ b/docs/paper/the-karl-code/referee_report_2.md
@@ -35,7 +35,7 @@ The paper omits much of the information that is the most interesting about this
We have written extensive comments for the source code. Our main objective was to make the functions readable, some of the inner workings are not that well documented.
5. There are some example scripts given in the codebase, but they are not referenced in the paper, do not come with documentation, and it is not clear what they do in terms of expected input, processing and output. Somewhere it should be made clear how one should run these examples, what they do, and what the expected output is. Furthermore, the examples should contain at least some semi-realistic use cases of the code for addressing relevant physics questions for tritium experiments.
-
We have added a section to the README in karl that explains a bit what the different given json files are. A semi-realistic use case is always included with katrin_parameter_example.json.
+
We have added a section to the README in karl that explains a bit what the different given json files are. A semi-realistic use case is included with the katrin_parameter_example.json file in the simulation_config/ directory.
I now proceed to give some line-by-line comments -
@@ -69,7 +69,7 @@ Line 31: "likeliness of recombination" → "rate of recombination"?
Page 5:
-Line 21: mean free path has been used earlier, introduce the acronym then.
We have removed the acronym earlier in the text.
+Line 21: mean free path has been used earlier, introduce the acronym then.
We have introduced the acronym earlier in the text.
Page 9:
"Additionally, the particle class only accepts…" → the relevance of this comment is not clear to me. What would be the alternative?
We have removed that sentence since it was indeed superfluous.
@@ -81,7 +81,7 @@ Page 11-12: It reads oddly that the drift mover is treated in so much mor
Page 13:
I see that trapped particles are killed by the simulation. But doesnt this invalidate the density field calculation, since trapped particles should have a very long retention time and hence contribute a lot to the density? Do trapped particles also
You are essentially correct: Dumping particles could invalidate the density fields. This is a somewhat delicate choice of the max interaction counter. We have added some plots showing which max interaction numbers yield correct density fields.
-Line 36: what does "macroscopic" mean in this sentence?
We have removed the mention of the "macroscopic cross section" entirely and have specified, that it is the cross section scaled by the density of the target specie.
+Line 36: what does "macroscopic" mean in this sentence?
We have removed the mention of the "macroscopic cross section" entirely and have specified that it is the cross section scaled by the density of the target specie.
Figure 1: Don't the ions and electrons - especially trapped ones - contribute to the space charge in the volume, and hence affect the E and B fields? So shouldn't there be a line "into" the E and B fields box from somewhere? How are the effects of space charge handled in general?
KARL itself currently has no capability to solve the poisson equation to obtain the electric field from the space charge. Both the electric and magnetic fields created by the charged particles have to be calculated from external plasma simulations (as mentioned at the end of section 1) and be used as an input for a following simulation with KARL.
@@ -109,7 +109,7 @@ Page 17: "the fastest axis refers to the axis for which the entry can be
On this page the text is quite verbose with some things being repeated in multiple sentences. I recommend to edit and condense this section.
Page 18:
First paragraph of this section seems verbose, can be trimmed down.
-
Line 41: I don't understand why the sentence begins "However," -this seems to imply something in contradiction to the previous paragraph, but it is not. Instead consider "Alternatively,"
+
Line 41: I don't understand why the sentence begins "However," -this seems to imply something in contradiction to the previous paragraph, but it is not. Instead consider "Alternatively,"
We have rephrased this paragraph.
Line 53: what is the meaning of either "reasonable" and "robust" in this context?
We have changed this to physically correct and low-noise
@@ -125,7 +125,7 @@ Page 21:
Line 16: less than 1Gb, but for how many events?
As mentioned in the text of the paper, the output size does not (directly) depend on the number of events. It mainly depends on the resolution of the simulation domain, as that dictates the size of the arrays to be stored. Furthermore it also depends on the number of output steps the user wants to keep.
-Lines 20-21: I find it hard to understand what this sentence is trying to tell me.
We are unsure which sentence was meant here
+Lines 20-21: I find it hard to understand what this sentence is trying to tell me.
The mentioned generators are pieces of code responsible for creating specific objects. Since they are just an implementation detail, that is unimportant wrt to the the creation of an JSON parameter file, the mention of the generators has been removed.
Line 37: Value has to be provided by its value and its unit; dual use of the word value, seems circular?
We have rephrased this sentence to be more clear in the division of physical vs numerical value.