diff --git a/docs/paper/the-karl-code/figures/maxInteractions_vs_density_2e22.pdf b/docs/paper/the-karl-code/figures/maxInteractions_vs_density_2e22.pdf new file mode 100644 index 0000000..3068872 Binary files /dev/null and b/docs/paper/the-karl-code/figures/maxInteractions_vs_density_2e22.pdf differ diff --git a/docs/paper/the-karl-code/paper.tex b/docs/paper/the-karl-code/paper.tex index 06c0e22..959bff9 100755 --- a/docs/paper/the-karl-code/paper.tex +++ b/docs/paper/the-karl-code/paper.tex @@ -270,7 +270,7 @@ where $N^+$ and $N^-$ are the number of particles crossing the faces in positive \section{Description of the implementation} \label{sec:implementation} -For the simulation, we decided to use C++ as a programming language for several reasons. First, it can be used for object oriented programming. This makes the code easier to read, because the classes were closely modelled after their physical representation. Secondly, the accuracy of the simulation relies on high statistics. Thus, many particle decays need to be simulated, which requires a fast calculation.\changed{C++ combines object orientation and fast execution and is widely used and well standardized.} For the same reason, we decided to employ parallel calculation, see section~\ref{ssec:parallelization}. +For the simulation, we decided to use C++ as a programming language for several reasons. First, it can be used for object oriented programming. This makes the code easier to read, because the classes were closely modelled after their physical representation. Secondly, the accuracy of the simulation relies on high statistics. Thus, many particle decays need to be simulated, which requires a fast calculation. For the same reason, we decided to employ parallel calculation, see section~\ref{ssec:parallelization}. There are three basic building blocks of the simulation. First, the simulation itself is treated as a class, which is responsible for initialization of the simulation environment, see section~\ref{ssec:initialization} and guiding through the flow of the simulation, see Figure~\ref{fig:simulation_flow}. Second, the particle class, which represents the simulated physical particles through their physical position, velocity and type of specie. Third, the specie class, which encapsulates the general behavior of each particle type (\changed{e.g.} electrons) in the simulation. @@ -525,7 +525,7 @@ where the $H$ might also be left in an excited state. The ionization class is initiated using the cross section, the target specie, the new electron specie, the new ion specie, the ionization energy, \changed{the ionization energy distribution} and the scattering angle distribution. It is developed for ionization of the target specie by impact of a particle, which is much lighter than the target. However, the code does not check for this condition. In the interaction, first the velocity of a target particle is determined \changed{analogous} to its calculation in elastic scattering. Then, the impact energy in the \changed{center of mass} frame $E_\text{i}$ is calculated. If the impact energy is below the ionization energy $E_\text{ion}$, no ionization could occur and a new target particle velocity is drawn. This procedure can take a long time. However, the cross section of ionization decreases significantly \changed{close to} the ionization energy. Thus, very few particles with energies close to the ionization energy will undergo ionization, which will therefore not increase the simulation time significantly. \changed{Once} a suitable target particle velocity is determined, the impact energy is used in the ionization energy distribution -% Note: should probably be cited and plotted... +% Note: should probably be plotted... % Note: mention how the particles are actually differentiated? (fast->impact, slow->ejected) to draw the impact energy after collision $E_\text{i}^\text{new}$. The energy of the new electron $E_\text{e}$, also called ejected electron in the following, then follows \changed{from} \begin{equation} @@ -552,7 +552,7 @@ The calculation of the density also needs the physical time, see equation~\ref{e The current collector is structured similar to the density field class. The difference being, that it holds the crossings in positive and negative direction through the predefined faces in three dimensional arrays for crossings in longitudinal, azimuthal and radial direction instead. The faces can be aligned \changed{with} the segmentation of the density fields, but can in general be set \changed{arbitrarily}. % Next sentence is a lie, only the binning of the density field is used, the current collector does not even have the functions to perform the corresponding checks -However, the mover uses both the density fields and current collectors to evaluate possible endpoints of movement, see section~\ref{ssec:movement}. Thus, a different segmentation will lead to a longer simulation time. +%However, the mover uses both the density fields and current collectors to evaluate possible endpoints of movement, see section~\ref{ssec:movement}. Thus, a different segmentation will lead to a longer simulation time. \subsection{Injection} @@ -703,26 +703,27 @@ Figure~\ref{fig:ionization_test} shows the electron spectrum at two different $z \end{figure} \paragraph{Excitation} -\changed{The excitation process is quite similar to the ionization process, in that the interaction requires a minimum amount of energy of the impact particle. The main difference is that no new particles are created. Due to the assumption made on the scattering angle distribution in the excitation process (see section~\ref{ssec:interactions}), it is quite simple to formulate an analytic example if only a single interaction is possible during the propagation of the particle.\\ +\changed{The excitation process is quite similar to the ionization process, in that it requires a threshold energy of the impact particle. The main difference is that no new particles are created. Due to the assumption made on the scattering angle distribution in the excitation process (see section~\ref{ssec:interactions}), it is quite simple to formulate an analytic example if only a single interaction is possible during propagation.\\ There is a high amount of potential excitation interactions that electrons can have with molecular tritium. However, the only major difference between these different interactions are the energy threshold $E_\text{th}$ and the cross section of the interaction. Therefore it is sufficient to only consider a single implemented excitation process in order to test the validity of the approach.\\ -Three different simulations were chosen to be performed, all with the same setup. The electrons were injected at the left side of the simulation domain with a specific energy and their velocity directed with the $z$-axis. The neutral density $n_\text{b}$ is chosen to be uniformly distributed within the source starting from a position $z_\text{neutral} > 0$ in order to allow for a distance of free propagation. The value of $n_\text{b}$ is chosen to be \SI{3.21e21}{\per\cubic\m} in order to allow for an appropriate MFP. The used interaction (or rather the specific cross section) has an threshold energy $E_\text{th} = \SI{12.754}{eV}$. Therefore the three energies considered are \SI{12}{eV}, \SI{20}{eV} and \SI{500}{eV}. The first energy was chosen such as to test for the threshold energy, the second one allows for a singular interaction and the third one allows for many interaction. For each case a number of \num{8e5} particles are simulated.\\ +In the setup of the simulations, the electrons were injected at the left side of the simulation domain with a specific energy and their velocity directed with the $z$-axis. The neutral density $n_\text{b}$ is chosen to be uniformly distributed within the source starting from a position $z_\text{neutral} > 0$ in order to allow for a distance of free propagation. The value of $n_\text{b}$ is chosen to be \SI{3.21e21}{\per\cubic\m} in order to allow for an appropriate MFP. The used interaction (or rather the specific cross section) has a threshold energy $E_\text{th} = \SI{12.754}{eV}$. The injection energies considered were \SI{12}{eV}, \SI{20}{eV}, \SI{33}{eV} and \SI{500}{eV}. The first energy was chosen such as to test for the threshold energy, the second one allows for a singular interaction, the third for at most two interactions and the fourth one allows for many interactions. For each case a number of \num{8e5} particles are simulated.\\ The density of the injected particles $n_u$ is expected to follow an exponential distribution, depending on the mean free path of the interaction \begin{equation} \label{eq:density_injected} n_u = n_0 \exp\left(-\frac{z - z_\text{neutral}}{\lambda_\text{mfp}(E_\text{inj})}\right) \commaeq \end{equation} -with $n_0$ being the density in case no interaction would be performed. +with $n_0$ being the density in case no interaction would have been performed. This is valid for any injection energy $E_\text{inj}$.\\ In case only a single scattering is possible the density of the scattered particles $n_s$ is given by \begin{equation} n_s \propto \left(1-\exp\left(-\frac{z - z_\text{neutral}}{\lambda_\text{mfp}(E_\text{inj})}\right)\right) n_0 \fullstop \end{equation} -Due to the predictable change in velocity as well as the conserved direction of movement it is possible to predict the proportionality factor from equation~\ref{eq:target_field_density}. This leads to +Due to the predictable change in velocity as well as the conserved direction of motion it is possible to predict the proportionality factor from equation~\ref{eq:target_field_density}. This leads to \begin{equation} \label{eq:density_single_scattering} n_s = \left(1-\exp\left(-\frac{z - z_\text{neutral}}{\lambda_\text{mfp}(E_\text{inj})}\right)\right) \sqrt{\frac{E_\text{inj}}{E_\text{inj} - E_\text{th}}}n_0 \fullstop \end{equation} -Adding $n_u$ and $n_s$ yields the expected density profile.\\ +Adding $n_u$ and $n_s$ yields the expected density profile.\\\\ +TODO: Add way double scattering is calculated\\\\ Similar calculations can be done for the case of a maximum of two interactions, but for higher interaction counts this becomes increasingly more difficult. Therefore only the case for a single scattering are shown in Figure~\ref{fig:excitation_test_densities}. In this plot the \SI{12}{eV} is also shown to indicate the value of $n_0$. Furthermore, the density for the \SI{20}{eV} case has been scaled such that it fits to $n_0$ in the non-interaction region. It can be seen that the data fits the expectation very well, with the relative error being below 0.5\% everywhere. In Figures~\ref{fig:excitation_double_scattering_unscattered}, \ref{fig:excitation_double_scattering_singly} and \ref{fig:excitation_doubly_scattering_doubly} the densities for the electrons that have scattered a different amount of time is shown. While the unscattered electrons follow the expectation quite well, the singly and doubly scattered electrons deviate somewhat from the expectation. This might be due to differences in the calculated cross section with the one calculated in the code. In Figure~\ref{fig:excitation_spectrum_500eV} the energy spectrum for an injection energy of $E_\text{inj} = \SI{500}{eV}$ is shown. Overall, it can be seen that the length of the simulation domain is not large enough for any electron to scatter down to below the threshold energy. However a shift in the energy with the maximal density can be seen, as would be expected. } @@ -818,7 +819,7 @@ The energy spectrum for the ions is shown in Figure~\ref{fig:charge_exchange} cl \begin{figure} \centering \includegraphics[width=1\textwidth]{figures/spectrum_z1.44e+00m.pdf} -\caption{Energy spectrum of T$_2^+$ with the only interaction being charge exchange with the T$_2$ background gas. The Maxwell Boltzmann distribution is not met, but scaled with $1/\sigma(E)$ yields a near perfect fit. This is due to a higher likelihood of scattering for lower energetic particles due to the cross section. A population of un-scattered ions can be seen at \SI{10}{eV}.} +\caption{Energy spectrum of T$_2^+$ with the only interaction being charge exchange with the T$_2$ background gas. The Maxwell Boltzmann distribution is not met, but scaled with $1/\sigma(E)$ yields a near perfect fit. This is due to a higher likelihood of scattering for lower energetic particles due to the cross section. A population of unscattered ions can be seen at \SI{10}{eV}.} \label{fig:charge_exchange} \end{figure} @@ -836,7 +837,7 @@ Since only the equilibrium is of interest, the time derivative will vanish. This n_e = \frac{\sigma(E_e)}{\sigma(E_i)}n_i + c \commaeq \end{equation} where $c$ is an integration constant. Ideally the fraction of the cross sections is one. However due to different simplifications taken in the code to speed up calculation of the cross section for both the electron and ion species this is not the case, but it is nonetheless close to one.\\ -The three test case simulations all share the same setup. The electrons and ions are both injected from the left side of the simulation domain and propagate to the right. The ion energy was set to \SI{1e-1}{eV} and the electron energy to \SI{9.1e-6}{eV} in order to achieve a similar density in the absence of any interaction. In total a number of 80000 events were simulated.\\ +The three test case simulations all share the same setup. The electrons and ions are both injected from the left side of the simulation domain and propagate to the right. The ion energy was set to \SI{0.1}{eV} and the electron energy to \SI{9.1e-6}{eV} in order to achieve a similar density in the absence of any interaction. In total a number of 80000 events were simulated.\\ The densities and their corresponding expectations are shown in Figures~\ref{fig:recombination_e_only} and \ref{fig:recombination_t2p_only}. It can be seen that fit quite well and only small statistical uncertainty. From the simulation results the cross sections can be inferred as well. These deviate less than 2\% for both cases from the expected values.\\ The dependence of the electron density on the ion density are shown in Figure~\ref{fig:recombination_ne_nt2p}. Both the ideal slope and the expected slope as defined in equation~\ref{eq:ne_nt2p} can be seen and it is apparent that the data points follow this relation quite well. The expected value of the slope is $\sigma_e/\sigma_{\text{T}_2^+} = 0.973$. } @@ -862,16 +863,28 @@ The dependence of the electron density on the ion density are shown in Figure~\r \end{figure} \paragraph{Maximum Interaction Count} -\changed{TBD} +\changed{Removing particles form the simulation before they physically leave the domain or are lost due to an interaction introduces an error in the simulation. However, it can be a necessary process in order to make the simulation time be sensible. It is nonetheless necessary to to investigate the influence of the maximum number of interactions on the density of the simulated particles.\\ +It is obvious that the optimal number of maximum interactions depends on multiple factors, i.e. the electric and magnetic background fields as well as the mean free path of the particle. Since the presence of electromagnetic fields that cause the trapping of a particle is relatively unlikely to occur on their own, the neutral density will have the major impact on the time a particle spends in the simulation. \\ +Therefore two sets of simulations with a different neutral density $n_n$ were performed. Apart from the number of maximum interactions and the neutral density, the remaining parameters were not changed. The simulation domain was chosen to have a radius $R = \SI{0.4}{cm}$ and a length of $L = \SI{3}{cm}$. The temperature for the background gas was chosen to be at \SI{300}{\K}. The reason being that in a small simulation domain particles terminate quicker at one of the boundary walls and thus speed up computation time a bit. For the same reason it was chosen to not use a magnetic field. All implementations interactions were enabled during the simulation. The two chosen neutral density values are \SI{2.41e24}{\per\cubic\m} and \SI{2.41e22}{\per\cubic\m}.\\ %mention total simulated particles for each value and how the points are calculated and the density distribution of the neutral gas +Figure~\ref{fig:maxInteractions_vs_density_2e24} shows the density and the fraction of particles that are deleted due to reaching their maximum number of interactions for the \SI{2.41e24}{\per\cubic\m} case. It can be seen that for the T$_2^+$ population a maximum interaction count of about 10 would suffice for all particles to terminate before reaching that limit. This is due to the high clustering cross section with the background gas. Both for T$^+$ and T$_2^+$ the densities converge relatively quickly, i.e. within a limit of \num{1e3} interactions. Some fluctuation is still visible afterwards but that is likely due to more electrons being able to ionize and thus creating more of these species. For both T$_3^+$ and e$^-$ the simulated limit of \num{1e5} maximum interactions is to low for the density to have converged or the fraction of particles that are deleted due to the interaction restriction to have reached zero. This effect is especially pronounced for the T$_3^+$ population due to the high interaction probability at thermal energies. \\ +Figure~\ref{fig:maxInteractions_vs_density_2e22} shows the same plot as before but now with the second, lower density. The main difference are that this time all densities converge and that it takes longer for T$^+$ to reach convergence. This is due to the reduced cross section for clustering, which increases the effect of interactions in which the ion is not destroyed. For this case a maximum interaction count of \num{1e5} would be sufficient to capture the correct densities.} \begin{figure} \centering \includegraphics[width=1\textwidth]{figures/maxInteractions_vs_density.pdf} \caption{Dependence of the densities of different tracked species on the number of maximal interactions. Simulation has been performed using a neutral background specie density of \SI{2.41e24}{\per\cubic\metre}. The densities of the shown species have been averaged over the whole simulation domain.} -\label{fig:maxInteractions_vs_density} +\label{fig:maxInteractions_vs_density_2e24} \end{figure} +\begin{figure} +\centering +\includegraphics[width=1\textwidth]{figures/maxInteractions_vs_density_2e22.pdf} +\caption{Dependence of the densities of different tracked species on the number of maximal interactions. Simulation has been performed using a neutral background specie density of \SI{2.41e22}{\per\cubic\metre}. The densities of the shown species have been averaged over the whole simulation domain.} +\label{fig:maxInteractions_vs_density_2e22} +\end{figure} + + \section{Results} \label{sec:results}