%\documentstyle[11pt,epsfig,psfig,times]{article}

%\textheight 9in
%\topmargin 1in
%\footheight 0.5in
%\textwidth 6.8in
%\oddsidemargin -0.2in

%\usepackage{latex8}
%\usepackage{psfig}
%\usepackage{epsfig}
%\usepackage{latexsym}
%\usepackage{amssymb}

%\begin{document}

Let ${\tt preset}(t)$ and ${\tt postset}(t)$ denote the preset and postset of
a transition $t$.  ${\tt preset}(p)$ and ${\tt postset}(p)$ are similarly
defined for a place $p$.

\subsection{Transform 0: Merge Parallel Places}
\label{reduce0}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform0-a,width=27.5mm} \hspace{5mm} &
\psfig{figure=xform0-b,width=22.5mm} \\
(a) \hspace{6mm} & (b)
\end{tabular}
{\caption{\label{xform0}Transform 0. Merge parallel places.}}
\end{center}
\end{figure}

Figure~\ref{xform0}(a) shows two places in parallel.  They can be
merged into a single place as shown in Figure~\ref{xform0}(b) if the following requirements hold:
\begin{itemize}
\item {\tt preset(p1) = preset(p2)}.
\item {\tt postset(p1) = postset(p2)}.
\item {\tt marking(p1) = marking(p2)}
\end{itemize}

%\clearpage

\subsection{Transform 1: Remove a Place in a Self Loop}
\label{reduce}

\begin{figure}[!tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform1-a,width=31.25mm} \hspace{5mm} &
\psfig{figure=xform1-b,width=35mm} \\
(a) \hspace{6mm} & (b)
\end{tabular}
{\caption{\label{xform1}Transform 1. Remove a self loop on a
    transition.}}
\end{center}
\end{figure}

Figure~\ref{xform1}(a) shows a transition $t$ with a self loop, where a
place $p$ is in ${\tt preset}(t)$ and ${\tt postset}(t)$, and is marked.
The transformation removes $p$ and its incoming and outgoing flow relations.
Then, the upper bound delay of the flow relations entering $t$ are
modified such that the upper bound is the maximum of the current max
and that of the flow relation between $p$ and $t$.
The new TPN is shown in Figure~\ref{xform1}(b).  If there is only the
same one place in the preset and postset of $t$, this place is not
removed as shown in Figure~\ref{bad}(c).

%\clearpage

\subsection{Transform 2: (BAD TRANSFORM) Remove a Transition in a Loop}
\label{reduce1}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform2-a,width=27.5mm} \hspace{5mm} &
\psfig{figure=xform2-b,width=22.5mm} \\
(a) \hspace{6mm} & (b)
\end{tabular}
{\caption{\label{xform2}Transform 2. Remove a transition in a loop.}}
\end{center}
\end{figure}

Figure~\ref{xform2}(a) shows a loop formed by a transition $t_3$, where the size
of the preset and postset of $t_3$ is 1. The semantics
of this TPN can be interpreted as transition $t_4$ can fire after the
infinite number of times of firings of transition $t_2$ and $t_3$.
If ${\tt u}(p_1) + {\tt u}(p_2) > 0$, by changing ${\tt u}(p2)$ to $\infty$,
the timing of $t_4$ is preserved.  The new TPN after removing transition
$t_3$ and its incoming and outgoing flow relations is shown in
Figure~\ref{xform2}(b).

The code implemented the above transformation is in the function call
{\em xform\_1} in postproc.cc.

%\clearpage

\subsection{Transform 3: Remove a Transition With a Single Place in the Postset}
\label{reduce2}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform3a-a,width=35mm} \hspace{10mm} &
\psfig{figure=xform3a-b,width=50mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform3a}Transform 3a. Remove the transition with
    the size of postset of 1.}}
\end{center}
\end{figure}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform3b-a,width=37.5mm} \hspace{10mm} &
\psfig{figure=xform3b-b,width=62.5mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform3b}Transform 3b. The transformation in
    Figure~\ref{xform3a} without the restriction that places in preset(t)
    have postset sizes of 1.}}
\end{center}
\end{figure}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform3c-a,width=35mm} \hspace{10mm} &
\psfig{figure=xform3c-b,width=57.5mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform3c}Transform 3c.  The transformation in
    Figure~\ref{xform3a} without the restriction that the place in
    postset(t) have preset size of 1.}}
\end{center}
\end{figure}

Figure~\ref{xform3a}(a) shows a transition $t$ with only one place in its
postset.  Suppose $t$ is removed.  The incoming and outgoing flow relations
of $t$ are also removed.  Then the place in ${\tt postset}(t)$ is
merged with those in ${\tt preset}(t)$.  The delay bounds of the place in
${\tt postset}(t)$ are added to the delay bounds of the places in
${\tt preset}(t)$, as shown in Figure~\ref{xform3a}(b).
The transformation in Figure~\ref{xform3a}  has the restrictions that
for each place $p$ in
${\tt preset}(t)$, the size of ${\tt postset}(p)$ equals 1 and  for the
place $p$ in ${\tt postset}(t)$, the size of ${\tt preset}(p)$ equals
1.  Figures \ref{xform3b} and \ref{xform3c} show the same
transformations without each restriction respectively.

Figure~\ref{bad}(a) and (b) show where these above transformations
cannot be applied.

All places in preset(t) must have same marking (all marked or all
unmarked) and place in postset(t) can be marked.  If either preset(t)
or postset(t) is marked, new combined places are marked.

%\clearpage

\subsection{Transform 4: Remove A Transition With A Single Place in the Preset}
\label{xform-3}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform4a-a,width=40mm} \hspace{10mm} &
\psfig{figure=xform4a-b,width=41.25mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform4a}Transform 4a. Remove a transition with
    preset of size 1.}}
\end{center}
\end{figure}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform4b-a,width=37.5mm} \hspace{10mm} &
\psfig{figure=xform4b-b,width=40mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform4b}Transform 4b. Transformation in Figure~\ref{xform4a}
    without restriction that the places in preset(t) have a preset of
    size 0.}}
\end{center}
\end{figure}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform4c-a,width=40mm} \hspace{10mm} &
\psfig{figure=xform4c-b,width=45mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform4c}Transform 4c. Transformation in Figure~\ref{xform4a}
    without restriction that the places in postset(t) each have a preset of
    size 1.}}
\end{center}
\end{figure}

Figure~\ref{xform4a}(a) shows a transition $t$ with only one place in its
preset.  Suppose $t$ is removed.  The incoming and outgoing flow relations
of $t$ are also removed.  The the place in ${\tt preset}(t)$ is
merged with those in ${\tt postset}(t)$.  The delay bounds of the place in
${\tt preset}(t)$ are added to the delay bounds of the places in
${\tt postset}(t)$, as shown in Figure~\ref{xform4a}(b).
The transformation in Figure~\ref{xform4a} as the restrictions that
for the place $p$ in
${\tt preset}(t)$, the size of ${\tt postset}(p)$ equals 1 and for each
place $p$ in ${\tt postset}(t)$, the size of ${\tt preset}(p)$ equals
1, too.  Figures~\ref{xform4b} and \ref{xform4c} demonstrate the same
transform where these restrictions are loosened.

The above transformations are also
restricted by the conditions shown in Figure~\ref{bad}(a) and (b).

All places in postset(t) must have same marking (all marked or all
unmarked) and place in preset(t) can be marked.  If anything is
marked, new combined places are marked.

%\clearpage

\subsection{Transform 5: Merge Transitions With the same preset and postset}
\label{merge-1}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform5a-a,width=58.75mm} \hspace{10mm} &
\psfig{figure=xform5a-b,width=48.75mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform5a}Transform 5a. Merge transitions with the same
    preset and postset}}
\end{center}
\end{figure}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform5b-a,width=48.75mm} \hspace{10mm} &
\psfig{figure=xform5b-b,width=46.25mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform5b}Transform 5b. Merge transitions where the
    places in their preset and postset have the same preset and
    postset.}}
\end{center}
\end{figure}

Figure~\ref{xform5a}(a) shows two transitions $t_6$ and $t_7$ with
the same preset and postset.  Those two transitions can be merged together
without affecting the behavior on transitions $t_{10}$, $t_{11}$, and
$t_{12}$ as shown in Figure~\ref{xform5a}(b).  Since no places are
being removed, no marking restrictions apply.

%Note: Transform 5b is not turned on by default.  It was found to have
%minimal effect except for in a few examples and was computationaly
%intensive.  Additionally, the correctness of this transformation in
%its current form is in question.

Another case is where the two transitions do not have the same preset
and postset, but the places in their preset and postset have the same
preset and postset as shown in Figure~\ref{xform5b}(a).  The two
transitions can still be merged along with the places in their preset
and postset. This transformation is depicted in Figure~\ref{xform5b}.
In order for the transformation to be applied certain timing
constraints must be satisfied.  Specifically, arcs between the places
in the postset to transitions in the postsets of the postset must have
the same timing bounds.  Furthermore, the place to transition arcs
feeding the transitions to be merged must have the same timing
constraints.

%There is also requirement on this transformation that the places in
%the preset of the merged two transitions must have same postset
%excluding the merging transitions, and the places in the postset of
%the merged two transitions must have same preset excluding the merging
%transitions.  For example, in Figure~\ref{xform5b}(a), the places in
%the preset of $t_3$ and $t_4$ are $p_1$ and $p_2$.  The postset of
%$p_1$ and $p_2$ contains only $t_2$, excluding $t_3$ and $t_4$.  The
%places in the postset of $t_3$ and $t_4$ are $p_3$ and $p_4$.  The
%preset of $p_3$ and $p_4$ contains only $t_5$, excluding $t_3$ and
%$t_4$.

%\clearpage

\subsection{Transform 6: Merge Transitions With the same preset}
\label{merge-2}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform6-a,width=57.5mm} \hspace{5mm} &
\psfig{figure=xform6-b,width=50mm} \\
(a) \hspace{5mm} & (b)
\end{tabular}
{\caption{\label{xform6}Transform 6. Merge transitions with the same
    preset.}}
\end{center}
\end{figure}

Figure~\ref{xform6}(a) shows two transitions $t_1$ and $t_2$ with
the same preset.  It is also required that the places in the postset of
$t_1$ and $t_2$ must have the same preset aside from the two
transitions being merged.  Additionally, there can only be one place
in the postsets of t1 and t2.  Those two
transitions can be merged together without affecting the behavior on
transitions $t_3$, $t_4$, and $t_5$ as shown in Figure~\ref{xform6}(b).

Since the places in the postset of the merging transitions will be
merged, they must have a consistent marking.  The newly merged place
will have the same marking as the places being merged.
%\clearpage

\subsection{Transform 7: Merge Transitions With the same postset}
\label{merge-3}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=xform7-a,width=51.25mm} \hspace{10mm} &
\psfig{figure=xform7-b,width=51.25mm} \\
(a) \hspace{10mm} & (b)
\end{tabular}
{\caption{\label{xform7}Transform 7. Merge transitions with the same
    postset.}}
\end{center}
\end{figure}

Figure~\ref{xform7}(a) shows two transitions $t_1$ and $t_2$ with
the same postset.  It is also required that the places in the preset of
$t_1$ and $t_2$ must have the same postset aside from $t_1$ and $t_2$.
Those two
transitions can be merged together without affecting the behavior on
transitions $t_3$, $t_4$, and $t_5$ as shown in
Figure~\ref{xform7}(b).  Additionally, the transitions being merged
may each only have one place in their presets.  The places in the
preset of the transitions
being merged should have consistent markings.  The newly merged place
in the transformed net should have the same marking as the places that
are merged.

%\clearpage

\subsection{Illegal Transformations}

\begin{figure}[tbh]
\begin{center}
\begin{tabular}{cc}
\psfig{figure=bad-1,width=25mm} \hspace{5mm} &
\psfig{figure=bad-2,width=32.5mm} \\
(a) \hspace{6mm} & (b) \\
\psfig{figure=bad-3,width=20mm} \hspace{5mm} &
\psfig{figure=bad-4,width=12.5mm} \\
(c) \hspace{6mm} & (d)
\end{tabular}
{\caption{\label{bad}Illegal transformations.}}
\end{center}
\end{figure}

Figure~\ref{bad} shows several illegal transformations. In Figure~\ref{bad}(a),
neither $t_1$ nor $t_2$ can be removed using transformations in
section~\ref{reduce1} and \ref{reduce2}.
They may be merged by transformations insection~\ref{merge-1},
\ref{merge-2}, or \ref{merge-3}.  In Figure~\ref{bad}(b), $t_3$ cannot be
removed in that it is impossible to have two places connected without a
transition in between. Figure~\ref{bad}(c) shows a stand-alone self loop which
is not removed for some reason.  I think it can be removed if the wire of
that transition is not used in any levels.  Figure~\ref{bad}(d) shows a
dangling transition $t_2$.  It cannot be removed because safety failure
maybe hidden; otherwise.

%\clearpage

\subsection{To Do and Notes}

\begin{itemize}
\item Transforms 3d and 4d.  Same As 3a and 4a but with both
  restrictions removed.
\end{itemize}

%\end{document}


% !TEX root = ../thesis.tex

\chapter{Theoretical Background}
% \label{cha:eva_theory}
In this chapter, I will present the theory behind evaporative cooling and the simulation of gas dynamics in a rarefied atomic gas.

I will first explain the concept of evaporative cooling in an arbitrary power law potential, including the conditions that need to be reached to achieve efficient evaporation. In the second section, I will describe the general problem of a molecular dynamics simulation and the simulation method used in this work.

\section{Theory of Evaporative Cooling}
% \label{sec:evaporative_cooling_theory}
Evaporative cooling is a method to reach temperatures below the recoil limit as well as high phase space densities, which is a requirement for the onset of Bose-Einstein condensation~\cite{pethick_smith_2008}. The concept of evaporative cooling is illustrated in \cref{fig:evaporative_cooling_sketch}. A gas of atoms with temperature $T_0$ is trapped in potential with depth $U_0$. In equilibrium, the speeds in the gas are distributed according to a Maxwell-Boltzmann distribution. If the potential depth is then lowered to $U'$, a portion of atoms with energies above $U'$ can leave the trap. The remaining atoms then thermalise to a lower temperature $T'$.

\vfill
\begin{figure}[htbp]
    \centering
    \includegraphics[clip, trim=0 4px 0 0]{Evap/EvaporationSketch1}
    % \input{TexContents/Figures/Evap/EvaporationSketch.pgf}
    \caption[Concept of evaporative cooling]{By selectively removing the hottest atoms from a gas, the remaining portion will have a lower temperature than before, after equilibrium is reached.}
    \label{fig:evaporative_cooling_sketch}
\end{figure}
\vfill

% Many textbooks constrain themselves to a harmonic potential for a model of evaporative cooling\insertcite{}. However, as we want to simulate a box potential, I will use a generalised power-law potential to derive basic scaling laws for the evaporation process.

\subsection{The Ideal Gas in a Power-Law-Potential}
We look at an ideal gas in a general power-law-potential
%
\begin{equation*}
    U(\vec{r}) = U_x \left| \frac{x}{x_0} \right|^{\alpha_x} + U_y \left| \frac{y}{y_0} \right|^{\alpha_y} + U_z \left| \frac{z}{z_0} \right|^{\alpha_z}
\end{equation*}
where $\vec{r}^\mathsf{T} = (x,y,z)$ is the spatial coordinate.
%
The density of states in such a potential has been derived in \cite{PhysRevA.35.4354}, but because there is a slight error in their derivation, making it incorrect for any odd $\alpha_x$, $\alpha_y$ or $\alpha_z$, the complete and correct derivation is presented in \cref{sec:appendix_dos}. The result is
%
\begin{equation*} %\label{eq:general_dos}
    D(E) = \left(\frac{2m}{\pi\hbar^2}\right)^\frac{3}{2} \frac{x_0 y_0 z_0}{U_x^{1/\alpha_x} U_y^{1/\alpha_y} U_z^{1/\alpha_z}} \frac{F(\alpha_x,\alpha_y,\alpha_z)}{\Gamma(\xi)} \times E^{\xi - 1}
\end{equation*}
with the energy $E$,
\begin{equation*}
    \xi = \frac{3}{2} + \frac{1}{\alpha_x} + \frac{1}{\alpha_y} + \frac{1}{\alpha_z} \quad \text{and} \quad F(\alpha_x, \alpha_y, \alpha_z) = \prod_{i \in \{x,y,z\}} \Gamma\!\left(1 + \frac{1}{\alpha_i}\right).
\end{equation*}
%
From the density of states, we can calculate the partition function $Z$ as
\begin{align*}
    Z &= \int_0^\infty D(E)\exp{\!\left(-\frac{E}{\kB T}\right)} \diff{E} \nonumber \\
      &= \left(\frac{2m}{\pi\hbar^2}\right)^\frac{3}{2} \frac{x_0 y_0 z_0}{U_x^{1/\alpha_x} U_y^{1/\alpha_y} U_z^{1/\alpha_z}} F(\alpha_x, \alpha_y, \alpha_z) \times (\kB T)^\xi
\end{align*}
and using the relation
\begin{equation}
    U = -N \frac{\partial \ln Z}{\partial \beta} \quad \text{with} \quad \beta = \frac{1}{\kB T} \nonumber
\end{equation}
from \cite{laurendeau_2005}, we can write down the internal energy $U$:
\begin{equation*}
    U = N \xi \kB T.
\end{equation*}
This is consistent with the well known results of $U = 3N\kB T$ for the harmonic oscillator potential and $U = \frac{3}{2} N \kB T$ for the 3D box potential.

By integrating out parts of the phase space distribution function
\begin{equation*}
    f(\vec{r},\vec{p}) = Z^{-1}\exp\!{\left(-\frac{\frac{\vec{p}^2}{2m} + U(\vec{r})}{\kB T}\right)}
\end{equation*}
we can calculate both the spatial density $n(\vec{r})$ and the momentum distribution $n(\vec{p})$.

Integrating out the momenta and multiplying with the atom number $N$ gives us the spatial density
\begin{align}
    n(\vec{r}) &= N\int_{-\infty}^\infty \frac{\multidiff{3}{p}}{(2\pi\hbar)^3} f(\vec{r},\vec{p}) \nonumber \\
    %
    &= 4\pi N Z^{-1} (2\pi\hbar)^{-3} \int_0^\infty \diff{p}\, p^2 \exp\!\left(-\frac{\frac{\vec{p}^2}{2m} + U(\vec{r})}{\kB T}\right) \nonumber \\
    %
    &= N \left(\frac{m\kB T}{2\pi\hbar^2}\right)^{\frac{3}{2}} Z^{-1} \exp\!\left(-\frac{U(\vec{r})}{\kB T}\right) \nonumber \\
    %
    &= \underbrace{\underbrace{\frac{N}{8x_0y_0z_0}}_{=n_\text{Box}}\frac{1}{F(\alpha_x\alpha_y\alpha_z)}\prod_{i\in\{x,y,z\}}\left(\frac{U_i}{\kB T}\right)^{\frac{1}{\alpha_i}}}_{\equiv\, n_0} \exp\!\left(-\frac{U(\vec{r})}{\kB T}\right) \label{eq:spatial_density}
\end{align}
where we have defined the peak density $n_0$. In the case of a 3D box potential where $\alpha_x = \alpha_y = \alpha_z \rightarrow \infty$, the density is constant and given by $n_\text{Box} = \frac{N}{8x_0y_0z_0}$.

For future reference, we also want to calculate the average density $\langle n\rangle$ here. The average of any quantity $Q$ over a given density distribution $n(\vec{r})$ is given by
\[\langle Q\rangle = \frac{\int_{-\infty}^\infty \multidiff{3}{r}\; Q n(\vec{r})}{\int_{-\infty}^\infty \multidiff{3}{r}\; n(\vec{r})} = \frac{1}{N} \int_{-\infty}^\infty \multidiff{3}{r}\; Q n(\vec{r})\]
so for the average density we put
\begin{align}
    \langle n\rangle &= \frac{1}{N} \int_{-\infty}^{\infty} \multidiff{3}{r} \left(n(\vec{r})\right)^2 \nonumber \\
    &= \frac{N}{(8x_0y_0z_0)^2} \frac{1}{\left(F(\alpha_x,\alpha_y,\alpha_z)\right)^2} \left(\prod_{i\in\{x,y,z\}} \left(\frac{U_i}{\kB T}\right)^{\frac{1}{\alpha_i}} \right)^2 \int_{-\infty}^{\infty} \multidiff{3}{r} \exp\!\left(-\frac{2U(\vec{r})}{\kB T}\right) \nonumber \\
    &= \frac{N}{(8x_0y_0z_0)^2} \frac{1}{\left(F(\alpha_x,\alpha_y,\alpha_z)\right)^2} \left(\prod_{i\in\{x,y,z\}} \left(\frac{U_i}{\kB T}\right)^{\frac{1}{\alpha_i}} \right)^2 \nonumber \\
    &\phantom{=} \times 8x_0y_0z_0 \prod_{i\in\{x,y,z\}} \left(\frac{\kB T}{2 U_i}\right)^{\frac{1}{\alpha_i}} F(\alpha_x,\alpha_y,\alpha_z) \nonumber \\
    &= \frac{N}{8x_0y_0z_0} \frac{2^{\frac{3}{2} - \xi}}{F(\alpha_x,\alpha_y,\alpha_z)} \prod_{i\in\{x,y,z\}} \left(\frac{U_i}{\kB T}\right)^{\frac{1}{\alpha_i}} \nonumber \\
    &= \frac{1}{2^{\xi - \frac{3}{2}}} n_0. \label{eq:mean_density}
\end{align}
For example, in the harmonic oscillator potential, this is $\langle n\rangle = \frac{n_0}{\sqrt{8}}$.

Similarly, if we integrate out the spatial coordinates, we get the momentum distribution
\begin{align}
    n(\vec{p}) &= Z^{-1} \left[\int_{-\infty}^\infty \frac{\multidiff{3}{r}}{(2\pi\hbar)^3} \exp\!\left(-\frac{U(\vec{r})}{\kB T}\right) \right]\exp\!\left(-\frac{\vec{p}^2}{2m\kB T}\right)\nonumber \\
    %
    &= \frac{8x_0y_0z_0}{Z(2\pi\hbar)^3} \prod_{i\in\{x,y,z\}} \left(\frac{\kB T}{U_i}\right)^{\frac{1}{\alpha_i}} F(\alpha_x,\alpha_y,\alpha_z) \exp\!\left(-\frac{\vec{p}^2}{2m\kB T}\right) \nonumber \\
    %
    &= \frac{1}{(2\pi m \kB T)^\frac{3}{2}} \exp\!\left(-\frac{\vec{p}^2}{2m\kB T}\right), \nonumber
\end{align}
recovering the Maxwell-Boltzmann distribution.
From this, the mean speed $\langle c\rangle$ follows as
\begin{equation}
    \langle c\rangle = \frac{\langle |\vec{p}| \rangle}{m} = \frac{1}{m}\int \multidiff{3}{p} |\vec{p}|n(\vec{p}) = \sqrt{\frac{8\kB T}{\pi m}}.
\end{equation}

\subsection{Model for Evaporative Cooling}
Following the simple model explained above, we describe evaporative cooling as a sequence of infinitesimal steps in which a number \diff{N} of atoms is removed from the cloud by reducing the trap depth to a value $\eta \kB T$. Evaporative cooling is described for example in \cite{KETTERLE1996181}. Assuming $\eta \gg 1$, the loss in internal energy can be approximated as
\begin{equation}
    \diff{U} \simeq \eta \kB T \diff{N}
\end{equation}
which reduces the temperature after thermalisation by \diff{T} and the internal energy to the final value
\begin{equation}
    U_\text{f} = \xi (N - \diff{N}) \kB (T - \diff{T}).
\end{equation}
By subtracting the change in internal energy from the initial value $U_\text{i}$, we can get a relation between the change in atom number and the change in temperature:
\begin{align}
    U_\text{i} - \diff{U} &= U_\text{f} \nonumber \\
    \xi N \kB T - \eta \kB T \diff{N} &= \xi (N - \diff{N}) \kB (T - \diff{T}) \nonumber \\
    &\simeq \xi (TN - N\diff{T} - T\diff{N})\kB \nonumber
\end{align}
omitting second order terms in \diff{T} and \diff{N}.
This can be reduced to
\begin{equation*}
    \frac{\frac{\diff{T}}{T}}{\frac{\diff{N}}{N}} = \frac{\diff{\ln T}}{\diff{\ln N}} = \frac{\eta}{\xi} -1 \equiv \nu
\end{equation*}
where we define the parameter $\nu$. Trivially, for certain starting conditions $N_0$ and $T_0$ we get
\begin{equation*}
    \frac{T}{T_0} = \left(\frac{N}{N_0}\right) ^\nu.
\end{equation*}
Because the goal of evaporative cooling is to reach quantum degeneracy, cooling alone is not enough. It is also necessary to increase the phase space density \PSD which is given by
\begin{equation*}
    \PSD = n_0(N,T)\cdot \left(\lambdadB(T)\right)^3
\end{equation*}
with the de Broglie wavelength
\begin{equation*}
    \lambdadB = \sqrt{\frac{2\pi\hbar^2}{m\kB T}}.
\end{equation*}
Plugging in our result for $n_0$ from \cref{eq:spatial_density} and the scaling of temperature with atom number, we find
\begin{equation*}
    \PSD \propto NT^{-\left(\xi - \frac{3}{2}\right)} \cdot T^{-\frac{3}{2}} \propto N^{1 - \xi\nu} = N^{1 + \xi - \eta}.
\end{equation*}

The decrease in temperature is achieved by thermalisation, which relies on elastic collisions. In an ideal gas, the elastic collision rate \Rcoll is given by \cite[8]{bird1994}
\begin{equation*}
   \Rcoll = n \meanProb
\end{equation*}
where $n$ is the density and \meanProb the ensemble average of the product of cross section and relative velocity. As we are dealing with low temperatures, only s-wave scattering needs to be considered \cite{joachain}. For this simple model, we also set the cross section to be constant. Furthermore, the mean relative speed is proportional to the mean speed. Inserting our result for the mean density from above, we find
% \begin{align}
%     \langle \Rcoll\rangle &= \langle n\rangle\cdot \meanProb = \langle n\rangle \cdot \sigma \cdot \langle\crel\rangle \nonumber \\
%     &\propto NT^{-\left(\xi - \frac{3}{2}\right)} \cdot \text{const.} \cdot T^{\frac{1}{2}} \nonumber = NT^{1-\xi} \nonumber \\
%     &\propto N^{\eta \left(\frac{2}{\xi} - 1\right) + \xi - 1}. \nonumber
% \end{align}
\begin{equation*}
    \langle \Rcoll\rangle = \langle n\rangle \cdot \sigma \cdot \langle\crel\rangle \propto N^{\eta \left(\frac{2}{\xi} - 1\right) + \xi - 1}.
\end{equation*}

\subsubsection*{Conditions for Efficient Evaporation}
Necessary conditions to achieve evaporation are that the temperature decreases and the phase space density increases with decreasing atom number. The collision rate should at least stay constant, if it increases with atom number, \emph{runaway evaporation} occurs. As we know the scaling behaviour of these quantities with $N$, we can give the requirements for $\eta$ that have to be fulfilled to achieve each of these conditions. These are calculated in \cref{tab:eva_scalings} for a linear trap (e.g.\ quadrupole trap, $\xi = 4.5$), a harmonic trap (e.g.\ Ioffe-Pritchard trap, $\xi = 3$) and a box trap ($\xi = 1.5$).
\begin{table}[htbp]
    \centering
    \caption{Scaling laws and requirements for the parameter $\eta$ to achieve (runaway) evaporation}
    \begin{tabular}{lcccl}
        \toprule
        Quantity & Scaling $N^{\{\ \}}$ & \multicolumn{3}{c}{Requirement for $\eta$} \\
        \cmidrule{3-5}
        & & \multicolumn{1}{c}{Linear} & \multicolumn{1}{c}{Harmonic} & \multicolumn{1}{c}{Box} \\
        \midrule
        Temperature $T$ & $-1 + \frac{\eta}{\xi}$ & $\eta > \num{4.5}$ & $\eta > \num{3}$ & $\eta > \num{1.5}$ \\
        Phase space density $\PSD$ & $1 + \xi - \eta$ & $\eta > \num{5.5}$ & $\eta > \num{4}$ & $\eta > \num{2.5}$ \\
        Collision rate \Rcoll & $\xi - 1 + \eta\left(\frac{2}{\xi} - 1\right)$ & $\eta > \num{6.3}$ & $\eta > \num{6}$ & $\eta < \num{-1.5}$ \\
        \bottomrule
    \end{tabular}
    \label{tab:eva_scalings}
\end{table}
As we can see, efficient evaporation in a stationary box potential cannot be achieved. This result is very intuitive as the local density is independent of the position in this case, which means it can only decrease with a decrease in atom number. Therefore, thermalisation times increase exponentially.
This adverse interplay between density and the thermalisation rate also plays a role for other trapping configurations and several papers have been published about methods to circumvent this problem in optical dipole traps (dimple trap \cite{Jacob_2011}, tilted trap \cite{PhysRevA.78.011604, PhysRevA.79.061406}, crossed beam trap \cite{ARNOLD20113288}, zoom lenses \cite{PhysRevA.71.011602}).

% Our concept, as explained in \cref{char:eva_motivation} is a very similar ansatz, but for a box potential instead.
% It should be immediately obvious that evaporative cooling in a box potential is not something that could be meaningfully pursued. However, all the previous considerations assumed that the parameters $U_{\{x,y,z\}}$ and $x_0,y_0,z_0$ stay constant during the evaporation trajectory. If the volume of a hypothetical box potential could shrink while evaporation is performed, the adverse effect of the decreasing density could be conquered. Similar\insertcite{}, concepts have been developed and are frequently implemented with optical evaporation, where two traps with different confinement overlap or where zoom lenses are used to compress the atomic cloud during the cooling stage.

\subsection{Inelastic Atom Loss}
\label{sec:inelastic_losses}
Up until now we only considered elastic collisions between atoms from the cold cloud, because these are the driving mechanism behind evaporative cooling. Elastic collisions with the background gas as well as inelastic collisions between the atoms however are detrimental to the cooling effect. Atoms removed through these are not exclusively from the high-temperature end of the Maxwell-Boltzmann distribution. Since inelastic losses occur through density dependent effects, atoms are more likely to be lost from high-density regions. In non-uniform potentials, this is where cold atoms are usually accumulated.

\subsubsection*{Background Collisions}
Collisions with the background gas in the vacuum chamber lead to atom loss because the background atoms (being in equilibrium with the walls of the chamber) are usually at room temperature (\SI{300}{K}), which means that a collision often imparts more kinetic energy onto the trapped atom than the trap depth. The collision rate with the background gas atoms is calculated via
\begin{equation*}
    \Gamma_\text{BG} = \sum_i n_i \langle \sigma v \rangle_{X,i}
\end{equation*}
where the indices $i$ represent the different atomic species in the background gas and $X$ is the trapped atomic species. The densities $n_i$ are related to the partial pressures $P_i$ by
\begin{equation}
    n_i = \frac{P_i}{\kB T}. \nonumber
\end{equation}
For ultracold atoms, the background loss rate is simply the trap lifetime at low density~\cite{PhysRevLett.91.123201}.

\subsubsection*{Two-Body Collisions -- Spin Relaxation}
Collisions of two trapped atoms can only be inelastic if the spin projections of the involved atoms change during the collisions.
This process is called spin relaxation and in magnetic traps, one of the departing states can be untrapped. However, these kinds of processes can usually be suppressed by preparing the atomic cloud in a stretched spin state \cite{PhysRevLett.99.223201}.

\subsubsection*{Three-Body Collisions -- Molecule Formation}
The final process we include is the three-body collision, where two atoms form a bound state and transfer the binding energy and momentum difference to a third atom \cite{PhysRevLett.91.123201}. Usually, this leads to all three atoms being lost from the trap.

The loss rate for three-body recombination depends roughly on the square of the local density as three atoms need to be present. This also means that it can often be neglected at low densities but becomes dominant at very high densities, limiting the maximum achievable density \cite{PhysRevA.85.053647}.

\subsubsection*{Loss Rate Equation}
If the rates for background ($K_1$), 2-body ($K_2$) and 3-body ($K_3$) losses are known, the local\footnote{If we wanted to describe losses for the whole sample, we would need to take the averages $\langle n\rangle$ and $\langle n^2 \rangle$ instead.} loss rate can be expressed as
\begin{align} \label{eq:lossrate}
    \frac{1}{N}\frac{\diff{N}}{\diff{t}} = - K_1 - K_2 n - K_3 n^2.
\end{align}
where $\frac{\diff{N}}{N}$ represents the probability of an individual atom to be lost in an infinitesimal timestep $\diff{t}$.

% \section{Scattering Theory}
% \todo[inline]{derive the cross section formula used later and the mean collision rate}

\section{Numerical Simulation of Gas Dynamics}
% \label{sec:dsmc_theory}

Simulating evaporative cooling is, in a bigger picture, the same as simulating any gas flow. A large number $N$ of particles, atoms or molecules, move according to a set of equations, can collide with each other and may or may not have interactions with a confining potential. A parameter that decides which model is best used to describe a gas flow is the Knudsen number \Kn
\begin{equation*}
    \Kn = \frac{\lambda}{L}
\end{equation*}
where $\lambda$ is the mean free path and $L$ is the length scale of the surrounding environment, in our case the side length of the volume in which the atoms are confined. Based only on this ratio, gas flows can be separated roughly into four different regimes \cite{schaaf:1958}:
\begin{itemize}
    \item $\Kn < \num{.01}$: Continuum regime
    \item $\num{.01} < \Kn < \num{.1}$: Slip regime
    \item $\num{.1} < \Kn < \num{10}$: Transition regime
    \item $\Kn > 10$: Free molecular flow
\end{itemize}

Ultracold atomic gases, as they are present during evaporative cooling, usually exhibit a high Knudsen number. For example, a gas of $^{87}$Rb (scattering length $a\sim 100\, a_0$ \cite{PhysRevA.87.053614}) atoms confined in a box with a side length of \SI{2}{mm} with a density of \SI{e11}{\per\centi\meter\cubed} would have a Knudsen number of $\Kn = \num{7.1}$. For this calculation, a constant cross section $\sigma = 8\pi a^2$ was assumed, which is justified at low temperatures. The more correct s-wave scattering cross section for identical bosons is given by \cite{dalibardCollision}
\begin{equation}  \label{eq:crosssection}
    \sigma(k) = \frac{8\pi a^2}{1 + (ak)^2}
\end{equation}
where $k=\frac{m\crel}{2\hbar}$ is the absolute value of the collision wave vector. This cross section will be used in the full simulation. For low collision energies, it approaches the constant value $8\pi a^2$.

We can therefore safely assume a rarefied or highly rarefied gas flow that fulfills the conditions of the transition or even free molecular regimes. The simulation method most appropriate for these regimes is the Direct Simulation Monte Carlo (DSMC) method originally developed by G.~A.~Bird \cite{bird1994}.
% In a very simple, but near complete model, interparticle dynamics are described as forces acting between the particles. This gives the complete force $\vec{F}$ acting on one particle denoted with the index $i$:
% %
% \begin{equation}
%     \vec{F}_i = -\nabla U(\vec{r}_i) + \sum_{j = 0,\, i\neq j}^N \vec{F}_{ij}
% \end{equation}
% %
% Here, $U$ is the external potential and $\vec{F}_{ij}$ is the interparticle force between particles $i$ and $j$. Naively, one could program a simulation that would calculate each of these forces at discretised timesteps and integrate the system with any differential equation solver. It is however immediately obvious why this is not feasible, at least as soon the system is a many-particle system. With ultracold gases, atom numbers $\sim$\num{E8} are not uncommon\insertcite{}. This means, there are $\sim$\num{E16} calculations necessary to get all interparticle forces, and this has to be repeated in each step. Current computer hardware is simply not powerful enough to handle extensive calculations like this. However, evaporative cooling is an example of a rarefied gas flow. The classical mean free path is given by
% \begin{equation}
%     \lambda = \frac{1}{n\sigma}
% \end{equation}
% and from, the Knudsen number $\text{Kn}$ is derived as
% \begin{equation}
%     \text{Kn} = \frac{\lambda}{L}
% \end{equation}
% where $L$ is the characteristic length scale of the medium. For an ultracold gas at typical conditions during evaporative cooling, i.e.\ a temperature of \SI{1}{\micro\kelvin}, a density of \SI{e11}{\per\cubic\centi\metre}, and a scattering length on the order of $200a_0$ that has a diameter of \SI{1}{mm}, the Knudsen number would be
% \[\text{Kn} > 1 \]
% which puts us into the transition regime or almost into the regime of free molecular flow. When a gas is rarefied like this, numerical methods can be used to limit the computational expense necessary. Specifically, we will use the DSMC (Direct Simulation Monte Carlo) method, which is valid for Knudsen numbers $\text{Kn} > \num{0.1}$.\insertcite{MULTIPLES}

\section{The DSMC Method}
Simulating the flow of a gas with upwards of \num{e8} particles is a computational expensive task. Over a certain time $\Dt$, the probability of two particles colliding with each other is proportional to the cross section and the relative velocity. This can be imagined as the cylindrical volume that a circle with an area equal to the cross section traces out while moving with the relative velocity \cite[7]{bird1994}. As the number of possible particle pairs scales quadratically with the number of particles, calculating the probabilities for all pairs becomes a virtually impossible task.

In DSMC, several measures are taken that reduce the computational expense significantly, making it possible to run a simulation on a home desktop or a laptop.

Time is discretised into small timesteps that are much smaller than the mean collision time. The simulation volume is divided into cells, each of which is treated separately for the collision handling. The number of particles in the simulation is far lower than the number of simulated real particles. For the sake of better readability and because our simulation only deals with monatomic gases, a particle in the real world will be described as an \emph{atom} from now on, while particles present in the simulation will be described as \emph{particles}. A particle in the simulation represents a certain number of atoms in the real world. This number is called the statistic weight $W$ and plays an important role in the collision handling. Over one timestep, the particle movement is uncoupled from the collisions. The process of a DSMC simulation is sketched in \cref{fig:dsmc_flowchart}. The following subsections will go into more detail on each of the steps.
\vfill
\begin{figure}[htbp]
    \centering
    \input{TexContents/Figures/Evap/DSMCFlowchart/DSMCFlowchart.tikz}
    \caption[The process of a DSMC simulation]{The steps outlined in the flowchart are further described in the following sections of this and the following chapter.}
    \label{fig:dsmc_flowchart}
\end{figure}
\vfill

\subsection{Particle Motion}
The motion of particles of mass $m$ in a potential $U(\vec{r})$ is a well known problem with equally well known solutions. If every particle is treated separately, the problem reduces to the single-particle equation of motion
\begin{equation*}
    \ddot{\vec{r}} = -\frac{1}{m}\nabla U(\vec{r})
\end{equation*}
with known starting conditions for the velocity $\dot{\vec{r}}$ and position $\vec{r}$. In many cases, a very simple method like leapfrog etc.\ is sufficient. However, with a surrounding potential that is highly dependent on the position of the particles, more advanced methods are required to preserve energy as well as possible.

\subsection{Boundary Conditions}
In evaporative cooling, particle loss is an essential step. After all particles have been moved, it is checked if they have moved outside a certain boundary. If they have, they get removed from the simulation.

Because the total number of atoms usually decreases by a few orders of magnitude during evaporation, after some time a large number of particles would be lost from the simulation. However, the number of particles in a collisional cell should stay above a certain threshold for accurate collision numbers \cite{SUN20111}. To circumvent this problem, we impose a threshold on the number of simulated particles $N$. Once this threshold is reached, all particles still present are copied and the statistic weight is halved. Of course, this means that we have to start with a certain power of 2 as the statistic weight. To copy the particles, the $x$ and $y$ values of their position and velocity are mirrored across the origin and the $z$ value is kept the same. This imposes the restriction on the surrounding potential that it has to be conforming to this symmetry. The $z$ values are explicitly not mirrored to retain the possibility of having gravity as a potential in the simulation.

\subsection{Collisions}
\label{sec:eva_theory_collisions}
In each collision step, a number of particle pairs is calculated in every cell, given by
\begin{equation} \label{eq:ntc_npairs}
    N_\text{P} = \frac{1}{\VCell} \NCell \overline{\NCell} \maxProb \Dt
\end{equation}
where $\VCell$ is the volume of one cell, $\NCell$ is the instantaneous number of particles in this cell, $\overline{\NCell}$ is the corresponding time averaged value and \maxProb is the maximum value of the product of cross section and relative velocity over all particle pairs.
Then, $N_\text{P}$ particle pairs are chosen randomly from the cell and a collision between them is performed if
\begin{equation*} %\label{eq:ntc_fraction}
    \frac{\sigma \crel}{\maxProb} > R
\end{equation*}
where $R$ is a random number between 0 and 1.
If \maxProb was to be calculated in every step, this would still be very inefficient as it would again require iterating over all possible particle pairs. However, because the number of pairs is proportional to \maxProb and the probability is antiproportional to it, it suffices to calculate (or even guess) \maxProb only once at the beginning. If a higher value is encountered subsequently, it can be updated. Even more, the true value of the maximum for $\sigma \crel$ is only a lower bound for the \maxProb parameter. In our simulation, we will prefer better statistics by artificially increasing the number of pairs chosen through a higher than necessary value of \maxProb.

\subsubsection*{Transient Adaptive Sub-Cell Technique}
To enforce near neighbor collisions, every cell is even further subdivided into sub-cells during every step. This technique has been described in \cite{SU20101136}. When a particle pair is chosen for a collision attempt, the first particle is chosen from the whole cell. If the sub-cell with this particle contains other particles, the collision partner is chosen from the same sub-cell. Otherwise, sub-cells are gradually searched outwards to select a viable collision partner. We also perform collision tracking meaning that a particle $j$ is not viable for a collision with particle $i$ if $i$ and $j$ have been each other's last collision partner.

This technique is called transient, because the sub-cell division happens locally in each step and adaptive, because the number of sub-cells is chosen such that each sub-cell contains a certain number of particles on average. In practice, we aim for maximum 2 particles per sub-cell. This means that the total number of sub-cells in $x$, $y$ and $z$ direction is given by
\begin{equation} \label{eq:tas_ncells}
    N_i = \lfloor\sqrt[3]{\NCell / 2}\rfloor + 1.
\end{equation}
In almost all cases, this means there are fewer than 2 particles in each sub-cell.

\subsubsection*{Calculation of the Post-Collision Velocities}
It has been mentioned before that only s-wave scattering is considered. Therefore, the collisions are isotropic and the post-collision velocities can be calculated trivially. The absolute value of the relative velocity of the two particles does not change, only its direction.

The centre-of-mass $\vec{c}_\text{COM}$ and relative velocity $\vec{c}_\text{r}$ before the collision are given by
\begin{equation*}
    \vec{c}_\text{COM} = \frac{1}{2}(\vec{c}_1 + \vec{c}_2), \quad \vec{c}_\text{r} = \vec{c}_1 - \vec{c}_2.
\end{equation*}
We calculate a unit vector of random direction as
\begin{equation*}
    \hat{\vec{R}} = \begin{pmatrix}
        \cos(\theta) \\ \sin(\theta) \cos(\phi) \\ \sin(\theta) \sin(\phi)
    \end{pmatrix}
\end{equation*}
where $\phi$ is randomly chosen between $0$ and $2\pi$ and $\cos(\theta)$ is randomly chosen between $-1$ and $1$.
Then the post collision velocities $\vec{c}_1'$ and $\vec{c}_2'$ are simply
\begin{equation*}
    \vec{c}_1' = \vec{c}_\text{COM} + \frac{1}{2} |\vec{c}_\text{r}| \cdot \hat{\vec{R}}, \quad \vec{c}_2' = \vec{c}_\text{COM} - \frac{1}{2} |\vec{c}_\text{r}| \cdot \hat{\vec{R}}.
\end{equation*}

% One possible approach in order to reduce the computational complexity of the task at hand is to decouple the particle motion from the collisions over a small timestep, i.e.\ calculating and applying the motion first and then handling the collisions in a separate step. To get accurate collision numbers, the domain of the simulaion is separated into smaller cells such that in each cell, a constant density can be assumed. The size of the cells also needs to be smaller than the local mean free path\insertcite{}. With a sufficiently small timestep only near neighbor collisions, i.e.\ collisions inside the same cell, are possible. Then, the probability of a collision between two particles is given by
% %
% \begin{equation}
%     P = \sigma \crel \Dt / \Vcell.
% \end{equation}
% %
% Here, $\sigma$ is the collisional cross-section, \crel the relative speed of the particles and \Vcell the volume of the cell. One could then compute the expected number of collisions in one timestep from the collision rate, choose particle pairs at random and evaluate collisions between them based on an acceptance-rejection method. This involves choosing a random number and accepting a collision if the probability $P$ exceeds this random number and rejecting it if it does not. This approach brings the problem that $P$ is usually a very small quantity, meaning a very large number of pairs would have to be tested for collisions in each step to reach the expected collision numbers.

% G.~A.~Bird first proposed and developed many of the algorithms that this work is based on\insertcite{}. In his \enquote{No-Time-Counter} (NTC) method, the problem mentioned above is solved the following way: A number of particle pairs is selected from each cell and the collisions are then sampled among them. Specifically,
% %
% \begin{equation} \label{eq:ntc_npairs_incomplete}
%     \frac{1}{2\Vcell} N (N - 1) \maxProb \Dt
% \end{equation}
% %
% pairs are chosen. Here, $N$ is the number of particles in the cell and \maxProb represents the maximum value of the product of cross-section and relative speed over all particle pairs in the cell. A collision of a pair $(ij)$ is accepted if
% %
% \begin{equation} \label{eq:ntc_fraction}
%     \frac{(\sigma\crel)_{ij}}{\maxProb} > R
% \end{equation}
% %
% with a random number $0 \leq R \leq 1$. Now the value of the deciding fraction in \cref{eq:ntc_fraction} is much closer to 1 than if the probability $P$ had been calculated for each pair separately. This means that a lower number of pairs tested get's rejected, reducing the time necessary to complete one collision time step in one cell. The value of \maxProb also does not have to be calculated in each step which would take the benefits away again. Instead, it is calculated once in the beginning of the simulation and then subsequently updated if a larger value is encountered.

% Up until now we are still dealing with an enormous amount of calculations if both the motion and collision processing have to be done for $\sim$\num{1e8} particles. Arguably the most important step to achieving lower computation times is to let each particle in the simulation be representative of a number of actual physical particles. The simulated particles are called \emph{macro}-particles from now on to avoid confusion. The number of particles represented by one macro-particle is called the statistic weight $W$. In simulations where the average number of particles is approximately constant over the simulated duration, this weight can be chosen almost arbitrarily\footnote{of cource, lower values for $W$ result in better statistic accuracy.}. However, in evaporative cooling, particle loss is inherent to the process. This means that we have to choose the weight as a power of $2$. If the number of macro-particles drops below a threshold during the simulation, the weight is halved and each macro-particle is duplicated. During this duplication procedure, the velocity and position are mirrored along at least one axis to make it impossible for the duplicated particles to collide with the \enquote{old} ones immediately after the duplication process. [\textbf{NOTE:} This requires the external potential to have spatial symmetry in at least one direction, otherwise potential energy would not be conserved.]
% With this technique, the behaviour of \num{E8} particles can be simulated using only e.g.\ $\sim$\num{12000} macro-particles, each with a statistic weight of $W=2^{13} = \num{8192}$.
% With the inclusion of the statistic weight, equation \cref{eq:ntc_npairs_incomplete} becomes
% %
% \begin{equation} \label{eq:ntc_npairs}
%     N_\text{pairs} = \frac{1}{2\Vcell} W N (N-1) \maxProb \Dt.
% \end{equation}
% %

% \paragraph{Transient Adaptive Sub-Cell Technique} ~\\
% Because the macroscopic parameters of an atomic cloud change rapidly during evaporative cooling, a fixed number of cells might not always guarantee the conditions that the cell size should be about $1/2$ - $1/3$ the local mean free path. However, the accuracy of the simulation can be maintained by introducing sub-cells \insertcite{}. In each step, every cell gets subdivided into sub-cells, such that each sub-cell contains a previously specified number of macro-particles. During the collision procedure, first collision partner is chosen from the whole cell. If the sub-cell of this contains other macro-particles, the second collision partner is chosen from the same sub-cell. Otherwise, the adjacent sub-cells are searched for a collision partner.

% The technique is called \enquote{transient} because the sub-cells are created in every step and \enquote{adaptive} because the number of sub-cells can change between steps, depending on the number of macro-particles present.

% \subsection{Collisions}
% \label{sec:eva_theory_collisions}
% In ultracold gases, only s-wave collisions are possible due to the very low temperatures. This simplifies the calculation of the velocities in a particle pair after a collision significantly, as a hard-sphere model can be applied. This means that the magnitude of the relative velocity between the particles does not change during the collision, only its direction is reassigned at random. In a gas with identical atoms, the centre-of-mass velocity is simply given by
% %
% \begin{equation}
%     \cCOM = \frac{1}{2}(\vec{c}_1 + \vec{c}_2)
% \end{equation}
% %
% and the relative velocity is
% %
% \begin{equation}
%     \vec{c}_\text{rel} = \vec{c}_1 - \vec{c}_2.
% \end{equation}
% %
% The velocities after the collision are then calculated as
% %
% \begin{align}
%     \vec{c}_1^* &= \cCOM + \frac12 |\vec{c}_\text{rel}|\cdot\vec{\hat{R}} \\
%     \vec{c}_2^* &= \cCOM - \frac12 |\vec{c}_\text{rel}|\cdot\vec{\hat{R}}
% \end{align}
% %
% where $\vec{\hat{R}}$ is a unit vector of random direction.

% \iffalse
% \subsection{Summary}
% A number of particles is represented as a smaller number of macro-particles, each with a the number of particles per macro-particle as a statistic weight. The domain is divided into smaller cells for near neighbour collisions.
% In one timestep, the following steps are executed:
% \begin{enumerate}
%     \item move all particles according to the external forces.
%     \item apply boundary conditions (e.g.\ eject particles that have moved outside of the domain).
%     \item perform collisions in each cell seperately according to the scheme described above.
% \end{enumerate}
% \fi