Final version of thesis

This commit is contained in:
Christian
2019-12-09 10:29:31 +01:00
parent a855e25194
commit bfdcd9d0ba
48 changed files with 32545 additions and 3388 deletions
+70 -72
View File
@@ -13,18 +13,18 @@
%%
%% Version 1.3.3, 2018-04-17
\chapter{The Karl Code}
\chapter{The KARL Code}
\label{ch:cod}
The \textbf{KARL} - \textbf{KA}trin WGTS elect\textbf{R}on and ion spectrum Monte Car\textbf{L}o simulation code was developed from scratch within this thesis to simulate the electron and ion distributions of the \ac{wgts} (\autoref{sec:kat:sts}).
The resulting distributions of charged particles are a key factor in the plasma studies of the KATRIN experiment (\autoref{sec:kat:plasma}).
The current overall plasma simulation strategy for the KATRIN experiment is summarized in \autoref{sec:cod:intention}.
The entire KARL code is implemented in C\texttt{++} and uses several libraries for optimizing efficiency.
The entire KARL code is implemented in C\texttt{++} and uses several libraries for optimal efficiency.
These and further technical concepts used in KARL are presented in \autoref{sec:cod:tech}.
The basic concept of the simulation is the repetitive physical simulation of single particles.
The general simulation strategy is covered in \autoref{sec:cod:strat} and the simulation of a single kinetic particle with focus on physics is treated in \autoref{sec:cod:phys}.
The general simulation strategy is covered in \autoref{sec:cod:strat} and the simulation of a single kinetic particle with focus on physics is treated in \autoref{sec:cod:phys}.
For better comprehensibility in the further discussion the single particle, that is being actively simulated, will be abbreviated by \ac{csp}.
The KARL code only simulates one \ac{csp} at a time.
@@ -37,7 +37,7 @@ The calculation and implementation of \acp{rdf} is presented in \autoref{sec:cod
The overall interaction probability is measured by \acfp{mcs}.
The calculation of the \acp{mcs} for interactions of \acp{csp} with \acp{rdf} is covered in \autoref{sec:cod:macro}.
The final electron and ion distributions are obtained using the logging barrier strategy.
The final electron and ion distributions are obtained using the \acf{lbm}.
Therefore virtual barriers are implemented throughout the \ac{wgts}.
Particles passing these barriers are logged.
The link between this logged data and the desired electron and ion distribution is presented in \autoref{sec:cod:log}.
@@ -46,8 +46,8 @@ Statistically significant results can only be gained when a large number of part
Thus parallel computation is inevitable.
The parallelization strategy of the KARL code is presented in \autoref{sec:cod:parallel}.
Prior to every simulation with KARL a number of simulation parameters allows for adjusting the simulation to one's needs.
Throughout this and the subsequent chapter (\autoref{ch:cod} and \autoref{ch:mod}) the function of each individual parameter will be explained in detail in the respective section.
At the beginning of every simulation with KARL a number of simulation parameters allows for adjusting the simulation to one's needs.
Throughout this and the subsequent chapter (\autoref{ch:cod} and \autoref{ch:mod}) the function of each individual parameter will be explained in detail in the respective section.
An overall overview of the parameters and details on setting them is given in \autoref{sec:cod:parameters}.
\section{Code intention} \label{sec:cod:intention}
@@ -61,19 +61,19 @@ In order for the KATRIN experiment to reach the target sensitivity of \SI{0.2}{\
In terms of plasma effects the arising spatial electric fields are of interest (\autoref{sec:kat:plasma}).
Experimental observation and analytical modeling of plasma effects is only partly possible and not sufficient for final quantification of plasma effects.
Thus simulations are needed to gain a extensive understanding of the plasma.
Due to the complexity of the system a full plasma simulation, where electric field calculations and particle chemical process are combined, is not feasible.
Thus simulations are needed to gain an extensive understanding of the plasma.
Due to the complexity of the system a full plasma simulation, where electric field calculations and particle interactions are combined, is not feasible.
Hence a twofold simulation strategy is chosen (\autoref{fig:cod:logic}).
A \acf{pic} simulation based on the ACRONYM code \cite{Kilian:2012aa}, which will be presented in the scope of a PhD thesis by J. Kellerer, calculates the electric fields arising from charged particles in the \acs{wgts}.
A \acf{pic} simulation based on the ACRONYM code \cite{Kilian:2012aa}, which will be presented in the scope of a PhD thesis by J. Kellerer, calculates the electric fields arising from charged particles in the \acs{wgts}.
Electrons are implemented from an initial distribution and are modeled fully kinetically.
Ions can not be resolved kinetically due the much larger mass.
Since ions are moving much slower than electrons, kinematics of ions on plasma time scales are negligible.
Thus ions are implemented as time constant fluxes of charge.
The initial electron distribution and constant ion fluxes for the \ac{pic} simulation are provided by simulations using the KARL code.
The KARL code simulates all relevant particle chemical interactions in the \ac{wgts} to obtain the electron and ion distribution throughout the \ac{wgts}.
In contrast to the \ac{pic} simulation, the KARL code cannot calculate electric and magnetic fields from asymmetries in particle distribution, as each particle is simulated individualy.
The KARL code simulates all relevant particle interactions in the \ac{wgts} to obtain the electron and ion distribution throughout the \ac{wgts}.
In contrast to the \ac{pic} simulation, the KARL code cannot calculate electric and magnetic fields from the particle distributions, as each particle is simulated individually.
Thus the KARL code implements constant electric and magnetic fields prior to simulation.
These fields are provided from the \ac{pic} simulation.
@@ -84,7 +84,7 @@ These fields can be taken into account in the neutrino mass deduction.
\section{Technical details} \label{sec:cod:tech}
The entire KARL code is implemented in C\texttt{++11}.
C\texttt{++} provides high computation efficiency, allows for easy optimizations and has many libraries specialized on scientific tasks.
Additionally C\texttt{++} allows for runtime and compile time polymorphism.
Additionally, C\texttt{++} allows for runtime and compile time polymorphism.
This allows for very efficient implementation of various interactions and proper handling of different particle species at runtime.
Vector operations and \ac{rng} are handled using the Blitz\texttt{++} \cite{Veldhuizen:2000aa} library.
@@ -96,19 +96,18 @@ Additionally the KARL code buffers output internally to optimize IO-speed.
The parallelization strategy of KARL (\autoref{sec:cod:parallel}) uses a distributed memory system.
This is realized using Open MPI \cite{Gabriel:2004aa}, allowing for communication between cores (\autoref{sec:mon:mpi}).
The parallelization strategy is covered in \autoref{sec:cod:parallel}.
Throughout the entire KARL code linear and logarithmic binning of physical quantities are used.
Throughout the entire KARL code linear and logarithmic binning of physical quantities is used.
Efficient memory access is only possible if each quantity is directly mapped to an address.
For a linear scale of a quantity $x$, that is binned into $n_x$ bins on $[x_\mathrm{min},x_\mathrm{max})$ the corresponding index of the memory address can than be calculated from
For a linear scale of a quantity $x$, that is binned into $n_x$ bins on $[x_\mathrm{min},x_\mathrm{max}]$ the corresponding index of the memory address can than be calculated from
\begin{equation}
i_x = ceil\big(\frac{x-x_\mathrm{min}}{\Delta x} \big) - 1 \, ,
i_x = \mathop{ceil}\big(\frac{x-x_\mathrm{min}}{\Delta x} \big) - 1 \, ,
\end{equation}
where $\Delta x = \frac{x_\mathrm{max} - x_\mathrm{min}}{n_x}$ is the width of each bin.
Logarithmic binning is obtained from logarithmizing $x$, $x_\mathrm{min}$ and $x_\mathrm{max}$.
Internally the KARL codes uses a Cartesian coordinate system with coordinates $x, y, z$.
The $z$-axis is aligned along the magnetic field lines. Positive $z$- direction points towards the spectrometers and negative $z$-direction towards the rear wall.
The $z$-axis is aligned along the magnetic field lines. Positive $z$- direction points towards the spectrometers and negative $z$-direction towards the \ac{rw}.
For the exact definition of the Cartesian coordinate system see \autoref{sec:mod:wgts}.
For certain application the use of cylindric coordinates $r, \varphi, z$ is handy.
These are linked to the Cartesian coordinate system by
@@ -120,14 +119,14 @@ z &= z \, .
\end{split}
\end{equation}
The entire Karl code uses classical energy-velocity relation $E=\frac{m}{2} v^2$, as particles of interest are non relativistic.
The entire KARL code uses classical energy-velocity relation $E=\frac{m}{2} v^2$, as particles of interest are non relativistic.
Thus transformation of coordinate systems is calculated using Galileo transformation.
\section{Simulation strategy} \label{sec:cod:strat}
\begin{figure}[tb]
\centering
\includestandalone{pics/code/algorithm}
\caption{Flowchart of the simulation algorithm. Algorithm starts with injection of $\upbeta$-\ce{e-}. Consecutively the $\upbeta$-\ce{e-} and all arising particles are being simulated. New $\upbeta$-decays are performed until the number of target decays is reached. \mbox{\acs{pq}: \acl{pq}}.}
\caption{Flowchart of the simulation algorithm. Algorithm starts with injection of one $\upbeta$-electron. Consecutively the $\upbeta$-electron and all arising particles are being simulated. New $\upbeta$-decays are performed until the number of target decays is reached. \mbox{\acs{pq}: \acl{pq}}.}
\label{fig:cod:algo}
\end{figure}
KARL simulates the electron and ion distribution in the \ac{wgts} (\autoref{sec:kat:sts}) by repetitive kinetic simulation of single particles.
@@ -136,8 +135,8 @@ As explained in \autoref{sec:cod:intention} electric and magnetic fields are imp
The density and velocity profile of molecular tritium \ce{T2} is implemented as time constant because kinetic simulation exceeds the computation budget and variations of \ce{T2}-distribution caused by effects treated in the simulation are negligible.
For details on the implementation of the \ac{wgts} and \ce{T2} see \autoref{sec:mod:wgts}.
The starting point of the simulation are $\upbeta$-decays injecting kinetic $\upbeta$-\ce{e-} into the simulation (\autoref{fig:cod:algo}).
By processes such as ionization new particles are created within the physical simulation of the $\upbeta$-\ce{e-}.
The starting point of the simulation is a $\upbeta$-decay injecting an energetic $\upbeta$-electron into the simulation (\autoref{fig:cod:algo}).
By processes such as ionization new particles are created within the physical simulation of the $\upbeta$-electron.
This actual physical simulation is covered in \autoref{sec:cod:phys}.
Particles created within the physical simulation are stored in the \ac{pq} and are processed subsequently.
@@ -148,7 +147,7 @@ Further particle species can be easily added in further version of KARL if found
As long as the \ac{pq} is filled, particles from the \ac{pq} are physically processed one by one.
New \acp{csp} are selected from the \ac{pq} randomly to reduce correlation effects.
Once all particles emerging from one $\upbeta$-\ce{e-}, including particles from secondary and higher order particles, are processed, a new $\upbeta$-\ce{e-} is injected and the algorithm is repeated.
Once all particles emerging from one $\upbeta$-electron, including particles from secondary and higher order particles, are processed, a new $\upbeta$-electron is injected and the algorithm is repeated.
This process is repeated until the target number of $\upbeta$-decays is reached.
The target number of $\upbeta$-decays is set by the DECAYS parameter.
@@ -163,7 +162,7 @@ T_\text{sim} = \frac{N_\upbeta} {A_\upbeta} \, .
\begin{figure}[tb]
\centering
\includestandalone{pics/code/physsim}
\caption{Flowchart of the physical simulation algorithm for a \ac{csp}. Particles simulation alternates between propagation by a \acf{mfp} and performing interactions until a termination condition is met.}
\caption{Flowchart of the physical simulation algorithm for a \ac{csp}. Particles simulation alternates between propagation by the \acf{mfp} and performing interactions until a termination condition is met.}
\label{fig:cod:particle_flow}
\end{figure}
For the physical simulation of the \acf{csp} a semi classical approach is chosen.
@@ -172,7 +171,7 @@ An overview of the algorithm is displayed in \autoref{fig:cod:particle_flow}.
Particles for the physical processing emerge from either $\upbeta$-decay or are created within this physical simulation from another \ac{csp} by processes such as ionization.
The semi classical approach processes propagation and interactions separately.
In alternation the \ac{csp} is propagated classically by one \ac{mfp} and interacts afterwards with one \ac{rdf}.
In alternation the \ac{csp} is propagated classically by its \ac{mfp} and interacts afterwards with one \ac{rdf}.
Between and during each step the \ac{csp}'s properties are checked for physical and simulational termination.
In the subsequent subsections all relevant processes are described in detail with focus on the realization of physical laws.
@@ -183,32 +182,32 @@ The implemented \ce{T2}-density is only dependent on the longitudinal position $
Thus $r$ and $\varphi$ are sampled using the inverse sampling theorem for uniform distributions (\autoref{eq:mon:inversion}) resulting in
\begin{align}
\label{eq:cod:iso}
r &= \eta_1 \cdot r_\text{WGTS} \, , \\
\varphi &= \eta_2 \cdot 2\pi \, ,
r &= \eta_1 \cdot r_\text{WGTS} \, , \\
\varphi &= \eta_2 \cdot 2\pi \, ,
\end{align}
where $\eta_{1,2}$ are uniform random numbers on $[0,1)$ and $r_\text{WGTS}$ is the radius of the \ac{wgts}.
The longitudinal position $z$ is sampled from the implemented \ce{T2}-density using rejection method (\autoref{sec:mon:sample}).
The energy of the $\upbeta$-\ce{e-} is sampled from the $\upbeta$-decay spectrum (\autoref{eq:neu:beta}) also using rejection method (\autoref{sec:mon:sample}).
The energy of the $\upbeta$-electron is sampled from the $\upbeta$-decay spectrum (\autoref{eq:neu:beta}) also using rejection method (\autoref{sec:mon:sample}).
The effect of the neutrino mass on the entire $\upbeta$-spectrum is negligible.
The initial direction of motion is assumed to be isotropic.
Thus it is sampled analogous to \autoref{eq:cod:iso}.
The usage of rejection method at this point does not reduce efficiency, since $\upbeta$-injection is only performed scarce in comparison to the number of operation for each \ac{csp} simulation times the number of secondary particles.
The usage of rejection method at this point does not reduce efficiency, since $\upbeta$-injection is only performed scarcely in comparison to the number of operation for each \ac{csp} simulation times the number of secondary particles.
Ions emerging from $\upbeta$-decays are implemented as thermal \ce{T2+}.
Ions emerging from $\upbeta$-decays are implemented as thermal \ce{T2+} (\autoref{sec:mod:ions}).
Thus the initial momentum is sampled from the \ce{T2}-distribution.
Kinetic ions and other decay channels are not included in the simulation (\autoref{sec:mod:ions}).
Further injection methods beside $\upbeta$-injection are implemented in KARL for testing purposes.
The injection of the tritium ions can be muted with the INJ\_TI parameter, where 0 deactivates and 1 activates the injection.
By specifying the INJECTION and INJ\_E parameter further energy spectra for the initial \ce{e-} are definable.
By specifying the INJECTION and INJ\_E parameter further energy spectra for the initial electrons are definable.
The default method for sampling from the $\upbeta$-spectrum is \mbox{INJECTION = 0}.
In this case the INJ\_E parameter is ignored.
For INJECTION = 1 all \ce{e-} are injected with constant energy.
For INJECTION = 1 all electrons are injected with constant energy.
Here the INJ\_E specifies the energy in \si{\eV}.
INJECTION = 2 injected the \ce{e-} from a Maxwell Boltzmann distribution.
INJECTION = 2 injectes the electrons from a Maxwell Boltzmann distribution.
The temperature $T$ of the distribution is linked to the energy specified by the INJ\_E in \si{\eV} through $E = k_\mathrm{B} T$. $k_\mathrm{B}$ is the Boltzmann constant.
\subsection*{Propagation}
@@ -220,20 +219,20 @@ For calculating propagation the Boris Push algorithm (\autoref{sec:mon:boris}) a
Drift Approximation is recommended, as the computation efficiency is drastically increased and the simulation is performed in a constant magnetic field.
Both solvers allow for propagation of charged particles in electric and magnetic fields.
The solver can be specified using the PROPAGATION parameter.
For PROPAGATION = 0 the Drift Approximation is used and for PROPAGATION = 1 Boris Push is used.
For PROPAGATION = 0 the Drift Approximation is used and for PROPAGATION = 1 Boris Push is used.
If Boris Push is chosen additionally the parameter BORIS\_T needs to be set.
This specifies the time stepping of the Boris Push algorithm.
Particles reaching the rear wall or radial walls of the \ac{wgts} during propagation are passed to the terminator and terminated from physical simulation.
Particles reaching the \ac{rw} or radial walls of the \ac{wgts} during propagation are passed to the terminator and terminated from physical simulation.
The boundary condition in positive $z$ direction differ for electrons and ions.
Ions are removed from the simulation at this point (\autoref{sec:kat:sts}), whereas electrons are reflected.
The number electrons that surpass the spectrometers and reach the detector during operation of the KATRIN experiment is negligible.
During each propagation step the \acp{rdf} are updated (\autoref{sec:cod:dens}) and \acp{csp} passing a logging barrier are tracked (\autoref{sec:cod:log}).
During each propagation step the \acp{rdf} are updated (\autoref{sec:cod:dens}) and \acp{csp} passing a Logging Barrier are tracked (\autoref{sec:cod:log}).
\subsection*{Interaction}
At every interaction step only one interaction is performed.
Thus in the first step a \ac{ic} must be sampled.
Thus in the first step an \ac{ic} must be sampled.
The probability for each \ac{ic} is
\begin{equation}
w_i(E) = \frac{\Sigma_i(E)}{\Sigma_\mathrm{tot}(E)} \, ,
@@ -253,13 +252,13 @@ The scattering angles are sampled from the corresponding \acp{dcs}.
The calculation of final kinematics is performed following \cite{Landau:2011aa} and \autoref{eq:mon:dir}.
\paragraph{Ionization}
In case of electron impact ionization, the primary electron transfers enough energy to a bound secondary electron, so that it can overcome the binding energy of its atom or molecule.
Thus impact ionization is only possible if the primary electron's initial energy $E_\mathrm{tot}$ exceeded the binding energy $B$.
Following the process a second free electron and an ion is created, which are are appended to the \ac{pq}.
In case of electron impact ionization, the primary electron transfers enough energy to a bound secondary electron so that it can overcome the binding energy of its atom or molecule.
Thus impact ionization is only possible if the primary electron's initial energy $E_\mathrm{tot}$ exceeds the binding energy $B$.
Following the process a second free electron and an ion are created, which are appended to the \ac{pq}.
Due to the sheer number of degrees of freedom the process can not be fully specified by \acp{dcs}.
It is assumed that the ion adopts the properties of the atom/molecule.
The energy of the secondary electron $E_2$ is sampled from the corresponding \ac{dcs}.
Generally conversation of energy must be satisfied:
Generally conservation of energy must be satisfied:
\begin{equation}
E_\text{tot} = E_1 + E_2 + B \, ,
\end{equation}
@@ -267,8 +266,8 @@ where $E_1$ is the energy of the initial electron after the interaction.
Direction of momenta of primary and secondary electron after interaction are sampled from the corresponding \acp{dcs}.
\paragraph{Excitation}
A very efficient \ac{ic} for cooling electrons are excitations of the atoms or molecules.
In these processes the \ac{csp}-\ce{e-} loses a quantized amount of energy in order to excite a certain excitation level of the atom/molecules.
A very efficient \ac{ic} for cooling electrons are excitations of the atoms or mo\-le\-cules.
In these processes the \ac{csp}-electron loses a quantized amount of energy in order to excite a certain excitation level of the atom/molecules.
Generally it is assumed that no further energy is being transfered.
Thus the electron's final energy is specified by the initial energy and the excitation level.
The final direction of motion is sampled from the corresponding \ac{dcs}.
@@ -286,21 +285,21 @@ Since ions and molecules are only implemented thermally (\autoref{sec:mod:ions})
Physical termination by wall interactions or particle interactions are handled during the processing of propagation and interaction.
Additional simutational termination conditions are implemented in order to prevent continuous loops and excessive computational effort.
The TERM\_E parameter allows for specifying a minimum threshold energy in \si{\eV} removing \ac{csp} with lower energies.
The TERM\_E parameter allows for specifying a minimum threshold energy in \si{\eV}, removing \ac{csp} with lower energies.
The TERM\_MAX parameter defines a maximum number of interactions before each \ac{csp} is terminated.
The TERM\_DI\_E parameter allows to set a threshold energy in \si{eV} for termination at positive $z$-direction.
In normal operation \ce{e-} are reflected at this point. Electrons with lower energies than this threshold are terminated.
In normal operation electrons are reflected at this point. Electrons with lower energies than this threshold are terminated.
In high quality simulations the number of non physical terminations should be negligible.
To guarantee this, statistics about the termination channels is tracked.
All possible loss channels and corresponding labels are summarized in \autoref{tab:cod:term}.
\begin{table}[t]
\caption{Overview of termination channels.}
\caption{Overview of all possible termination channels.}
\label{tab:cod:term}
\centering
\begin{tabular}{ll} \toprule
label & description \\ \midrule
n\_rw & Termination at rear wall (negative $z$) \\
n\_rw & Termination at \ac{rw} (negative $z$) \\
n\_dipole & Termination at dipoles (positive $z$) \\
n\_radial & Termination at \ac{wgts} walls (radial) \\
n\_max & Termination due to maximum interaction \\
@@ -331,7 +330,7 @@ The \acp{rdf} are spliced into multiple spatial bins using cylindric coordinates
Setting of the POP\_N\_Z, POP\_N\_R, POP\_N\_PHI parameters allows for specifying the number of bins in $z$, $r$ and $\varphi$.
Ion \acp{rdf} are implemented without energy resolution.
They adapt the velocity-distribution of \ce{T2}.
They adapt the velocity-dis\-tri\-bu\-ti\-on of \ce{T2}.
This is a superposition of a constant drift speed $\vec{v}_\mathrm{drift}$ and an isotropic Maxwell-Boltzmann distribution specified by \ac{wgts} temperature and mass of species particle (\autoref{sec:mod:wgts}).
The electron \ac{rdf} is additionally sliced into energy bins.
@@ -342,6 +341,7 @@ A number of pre-run decays to reach equilibrium before taking statistics can be
POP\_DECAYS is the total number of decays to perform before the actual run.
The POP\_STEP parameters specifies the number of $\upbeta$-injections to performe on each core before synchronizing the density fields across all cores (\autoref{sec:cod:parallel}).
\section{Macroscopic cross section (MCS) calculation} \label{sec:cod:macro}
\begin{figure}[tb]
\centering
@@ -349,7 +349,6 @@ The POP\_STEP parameters specifies the number of $\upbeta$-injections to perform
\caption{Sketch of shift from simulation coordinate system to laboratory frame. $\vec{v}_1$ is the velocity of bombarding particle in the simulation system. $\vec{v}_2(\vartheta, \varphi)$ is the velocity of the target particle in the simulation system. In the simulation integration over all possible $\vartheta$ and $\varphi$ is performed. The integration is independent of $\varphi$. $\vartheta$ is displayed in blue. The resulting velocity of the bombarding particle is displayed in red and labeled as $\vec{v}_\mathrm{lab}$.}
\label{fig:cod:theta_int}
\end{figure}
The \acf{mcs} $\Sigma_\mathrm{tot}(E)$ is a measure for the interaction probability of a \ac{csp}.
In the simulation \acp{mcs} determine the distance of free propagation between each interaction and are essential for performing interactions (\autoref{sec:cod:phys}).
@@ -365,7 +364,7 @@ The \ac{mcs} of one specific \ac{ic} is defined as product of the corresponding
where $\Elab$ is the energy in the laboratory frame and $\vec{x}$ the position of the \ac{csp}.
The density of interaction partners $n_i (\vec{x})$ are obtained from the \ac{rdf} and the \ac{tcs} $\sigma_i(\Elab)$ from the implemented theory.
Generally \acp{tcs} are described in the laboratory system, where a kinetic bombarding particle with energy $\Elab$ approaches a fixed target particle.
In the \ac{mcs} calculation it must be differentiated whether the \ac{csp} is bombarding or target particle in the \ac{tcs} definition.
In the \ac{mcs} calculation it must be differentiated whether the \ac{csp} is bombarding or target particle in the \ac{tcs} definition.
The actual models implemented for specific \acp{tcs} are presented in \autoref{ch:mod}.
In the following methods for calculating the \ac{tcs} for different matches of \acp{csp} and \acp{rdf} with consideration of the laboratory frame definition
@@ -380,7 +379,7 @@ Then neither thermal nor kinetic \acp{rdf} specify the direction of their partic
Thus an isotropic distribution is assumed.
For the calculation of the \ac{tcs} the possible constellations between the velocity of a \ac{csp}
$\vec{v_1} = \hat{n}_1 \cdot v_1$ and the velocity $\vec{v_2}$ of a interaction partner from \ac{rdf} must be considered.
$\vec{v_2}$ can be parameterized using $\vartheta = [0,\pi)$ and $\varphi = [0,2\pi)$ in respect to $\hat{n}_1$ (\autoref{fig:cod:theta_int}), which results in
$\vec{v_2}$ can be parameterized using $\vartheta = [0,\pi[$ and $\varphi = [0,2\pi[$ in respect to $\hat{n}_1$ (\autoref{fig:cod:theta_int}), which results in
\begin{equation}
\vec{v_2} (\vartheta, \varphi) = v_2 \cdot \hat{n}_1 \cdot \begin{pmatrix}\sin(\vartheta) \cos(\varphi)\\ \sin(\vartheta) \sin(\varphi) \\ \cos(\vartheta)\end{pmatrix} \, .
\end{equation}
@@ -391,21 +390,21 @@ Shifting to the laboratory frame, where the \ac{csp} is the bombarding particle
\Elab (\vartheta) = \frac{m}{2} \cdot |\vec{v}_\mathrm{lab}(\vartheta, \varphi)|^2 &= \frac{m}{2} \cdot \Big(v_1^2 + v_2^2 - 2 v_1 v_2 \cos(\vartheta) \Big) \label{eq:cod:Elab} \, ,
\end{align}
where $m$ is the mass of the \ac{csp}.
Since \autoref{eq:cod:Elab} is independent of $\varphi$ the \ac{tcs} results in
Since \autoref{eq:cod:Elab} is independent of $\varphi$ the \ac{tcs} results in
\begin{equation}
\label{eq:cod:sigone}
\sigma(v_1, v_2) = \frac{1}{\pi} \int_0^\pi \upd \vartheta \sigma\big(\Elab (v_1, v_2, \vartheta)\big) \, .
\end{equation}
In the KARL code this one dimensional integral is solved numerically using Simpson's rule following \cite{Press:1992aa}.
Opposite laboratory frame definition, where the \ac{csp} is the target particle, can be easily adjusted by redefinition of $m$ due to the symmetry of \autoref{eq:cod:Elab}.
The opposite laboratory frame definition, where the \ac{csp} is the target particle, can be easily adjusted by redefinition of $m$ due to the symmetry of \autoref{eq:cod:Elab}.
In that case $m$ is the mass of a \ac{rdf} particle.
For interactions of the \ac{csp} with a kinetic \ac{rdf}, the absolute velocity $v_2$ is determined by the energy bin.
Thus the \ac{mcs} of a particular energy bin is obtained using \autoref{eq:cod:sigone} and multiplying with the density of corresponding energy bins.
The total \ac{mcs} for that \ac{ic} is obtained by summation over all energy bins.
For interactions with thermal density fields the sub lying Maxwell Boltzmann distribution must be considered.
For interactions with thermal density fields the underlying Maxwell Boltzmann distribution must be considered.
Integration over the $v_2$ distribution must be performed and the \ac{tcs} results in
\begin{equation}
\sigma(v_1) = \frac{1}{\pi} \int_0^\pi \upd \vartheta \int_0^\infty \upd v_2 \, f_\mathrm{MB}(v_2) \cdot \sigma\big(\Elab (v_1, v_2, \vartheta)\big) \, .
@@ -417,7 +416,7 @@ v_{2,\mathrm{up}} = 3\cdot \sqrt{\frac{2 k_\mathrm{B} T}{m_t}} \, ,
\end{equation}
which represents \SI{99.96}{\percent} of the integral.
For higher computation efficiency, integration is ignored, if either one of the velocities is much larger than the other.
For higher computational efficiency, integration is ignored, if either one of the velocities is much larger than the other.
In that case \autoref{eq:cod:Elab} can be replaced using the classical energy-velocity relationship.
In the simulation this condition was formulated as
\begin{equation}
@@ -439,25 +438,26 @@ Since temperature of \ac{wgts} and properties of energy bins of kinetic \acp{rdf
Setting INT\_PRE\_START and INT\_PRE\_END parameter define the lower and upper end for the precomputed energy scale and the INT\_PRE\_N specifies the number of precomputed points.
The precomputed energies are calculated on a logarithmic scale.
\section{Logging barrier method} \label{sec:cod:log}
\pagebreak
\section{\acl{lbm}} \label{sec:cod:log}
\begin{figure}[tb]
\centering
\includestandalone{pics/code/log_bar_time}
\caption{Sketch of a particle with longitudinal speed $v_z$ passing a logging barrier.
The particle is displayed in blue. The logging barrier is displayed as thick red line. Dashed box with surface $A$ and thickness $\upd l$ represent volume the particle passes with constant speed $v_z$. Velocity components of the particle parallel to the logging barrier are not displayed in this sketch.}
\caption{Sketch of a particle with longitudinal speed $v_z$ passing a Logging Barrier.
The particle is displayed in blue. The Logging Barrier is displayed as thick red line. Dashed box with surface $A$ and thickness $\upd l$ represent volume the particle passes with constant speed $v_z$. Velocity components of the particle parallel to the Logging Barrier are not displayed in this sketch.}
\label{fig:cod:log}
\end{figure}
Using logging barriers, particle densities and fluxes with high energy resolution are obtained at predefined $z$-positions in the \ac{wgts}.
The positions are specified by the LOG\_BARS parameter, which indicate the number of logging barriers.
Using the \acf{lbm}, particle densities and fluxes with high energy resolution are obtained at predefined $z$-positions in the \ac{wgts}.
The positions are specified by the LOG\_BARS parameter, which indicate the number of Logging Barriers.
The barriers are evenly spaced in the \ac{wgts} including the minimum and maximum $z$-value.
If LOG\_BARS = 1 only particles reaching the minimum $z$-value (rear wall) are logged.
If LOG\_BARS = 1 only particles reaching the minimum $z$-value (\ac{rw}) are logged.
During each propagation step of a particle the simulation checks whether a logging barrier was passed and if a barrier was passed the phase-space coordinates $(\vec{x}, \vec{v})$ of the particle are written to the output.
During each propagation step of a particle the simulation checks whether a Logging Barrier was passed and if a barrier was passed, the phase-space coordinates $(\vec{x}, \vec{v})$ of the particle are written to the output.
From this data detailed particle densities and particle fluxes can be calculated in the post processing.
This calculation will be shown in the following.
The contribution of a single particle to the total density $n_i$ can be calculated from its longitudinal speed $v_{z,i}$.
When treating a logging barrier as a three dimensional disk with thickness $\upd l$ and surface $A$, the particle spends the time $\upd t_i = \frac{\upd l}{v_{z,i}}$ in the volume $\upd V = \upd l \cdot A$ (\autoref{fig:cod:log}).
When treating a Logging Barrier as a three dimensional disk with thickness $\upd l$ and surface $A$, the particle spends the time $\upd t_i = \frac{\upd l}{v_{z,i}}$ in the volume $\upd V = \upd l \cdot A$ (\autoref{fig:cod:log}).
Thus the density in respect to the total simulation time $T_\mathrm{sim}$ of one particle results in
\begin{equation}
\label{eq:cod:log}
@@ -465,7 +465,7 @@ n_i = \frac{t_i}{V \cdot T_\mathrm{sim}} = \frac{1}{A \cdot T_\mathrm{sim} \cdot
\end{equation}
The total density is obtained by summing over all density contributions.
The differential spectrum in energy $\frac{\upd n}{\upd E}$ is obtained by grouping the data in energy bins prior summation and normalizing by the bin width.
The differential spectrum in energy $\frac{\upd n}{\upd E}$ is obtained by grouping the data in energy bins prior summation and normalizing by the bin width.
For better statistics logarithmic binning is recommended.
The longitudinal particle flux $j_z$ is obtained by counting the number of particles passing the barrier with respect to the passing direction.
@@ -476,8 +476,6 @@ j_z = \frac{N_+ - N_-}{A \cdot t_\mathrm{sim}} \, ,
where $N_+$ is the number of particles with positive $v_z$ and $N_-$ with negative $v_z$.
The differential particle flux $\frac{\upd j_z}{\upd E}$ is obtained analogous to the differential density $\frac{\upd n}{\upd E}$ calculation.
Additionally radial effects can be examined by subdividing the logging barrier into several sub discs. In that case the the surface $A$ must be adjusted accordingly.
\section{Parallelization strategy} \label{sec:cod:parallel}
\begin{figure}[tb]
\centering
@@ -509,7 +507,7 @@ The location of the file is passed by setting the environment variables
A parameter is set in the file by starting a row with the name of the parameter and specifying the parameter value with whitespace delimiter.
Empty rows or rows starting with '\#' are ignore.
Also '=' and ';' are ignored.
Also '=' and ';' are ignored.
A sample parameter file using recommended parameters is displayed in \autoref{lst:app:para}.
\begin{table}[tp]
@@ -518,12 +516,12 @@ A sample parameter file using recommended parameters is displayed in \autoref{ls
\centering
\begin{tabular}{p{3cm} p{1.3cm} p{10cm}} \toprule
Parameter & Rec. & Description \\ \midrule
SEED & & Seed of \acs{prng} (\autoref{sec:mon:rng}) \\
SEED & & Seed of \acs{prng} (\autoref{sec:mon:rng}) \\
POP\_DECAYS & & Number of decays for initial population calculation \\
POP\_STEP & & Stepwidth for initial population calculation \\
POP\_STEP & & Stepwidth for initial population calculation \\
DECAYS & & Number of target $\upbeta$-decays \\
STEP & 14 & Stepwidth before synchronizing densities across cores \\
LOG\_BARS & & Number logging barriers \\
LOG\_BARS & & Number Logging Barriers \\
PROPAGATION & 0 & 0 = Drift app. (\autoref{sec:mon:drift}), 1 = Boris Push (\autoref{sec:mon:boris}) \\
BORIS\_T & \num{{}e-9} & Step width for Boris Push in \si{\second} \\
\midrule
@@ -538,7 +536,7 @@ A sample parameter file using recommended parameters is displayed in \autoref{ls
\midrule
TERM\_E & \num{{}e-7} & Energy threshold for terminating particles \\
TERM\_DI\_E & 0 & Energy threshold for electron termination at $z=10$ \\
TERM\_MAX & \num{{}e6} & Maximum number of interactions before termination \\
TERM\_MAX & \num{{}e6} & Maximum number of interactions before termination \\
\midrule
eT2\_ELA & 1& elastic scattering - 0: off, 1: on \\
INT\_ELA\_DIR & 0 & \acs{dcs} model for ela. sca. - 0: from \cite{Salvat:2005aa}, 1: $4\pi$, 2: $0 \pi$ \\
@@ -551,11 +549,11 @@ A sample parameter file using recommended parameters is displayed in \autoref{ls
INT\_N & 100& Number of points for numeric integration \\
INT\_PRE\_START & \num{{}e-7} & Start energy for precomputed \ac{tcs} in \si{\eV} \\
INT\_PRE\_END & \num{{}e0} & End energy for precomputed \ac{tcs} in \si{\eV} \\
INT\_PRE\_N & \num{{5}e3} & Number of precomputed \ac{tcs} values \\
INT\_PRE\_N & \num{{5}e3} & Number of precomputed \ac{tcs} values \\
\midrule
POP\_N\_R & 5 & Number of $r$-bins for density fields \\
POP\_N\_PHI & 1 & Number of $\varphi$-bins for density fields \\
POP\_N\_Z & 13 & Number of $z$-bins for density fields \\
POP\_N\_Z & 13 & Number of $z$-bins for density fields \\
POP\_N\_E & 50 & Number of energy bins for density fields \\
POP\_E\_START & \num{{}e-7} & Minimum energy for kinetic density fields \\
POP\_E\_END & \num{{2}e4} & Maximum energy for kinetic density fields \\