Minor grammar corrections
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
\subsection*{Penning trap}
|
||||
Penning traps use a combination of a magnetic and electric field to confine the trajectory of a charged particle to a finite volume over long periods of time\cite[p.~9-10]{vogel_particle_2024}. Finite volume in this context refers to volumes in the order of \unit{\mm \cubed} up to \unit{\cm \cubed}. Long time ranges imply a period that exceeds the period of motion of the particle by multiple orders. For the studied case we will use an ideal Penning trap, i.e. there are no inhomogenities in the fields. The magnetic field will be defined as
|
||||
Penning traps use a combination of a magnetic and electric field to confine the trajectory of a charged particle to a finite volume over long periods of time \cite[p.~9-10]{vogel_particle_2024}. Finite volume in this context refers to volumes in the order of \unit{\mm \cubed} up to \unit{\cm \cubed}. Long time ranges imply a period that exceeds the period of motion of the particle by multiple orders. For the studied case we will use an ideal Penning trap, i.e. there are no inhomogenities in the fields. The magnetic field will be defined as
|
||||
\begin{equation} \label{eq:B_field}
|
||||
B(\vec r, t) = B_0 \Theta\left(d - |\vec r |\right) \cdot \vec e_z,
|
||||
\end{equation}
|
||||
@@ -23,7 +23,7 @@ In the transversal plane, the equations of motion are coupled due to the Lorentz
|
||||
\ddot x - \omega_0 \dot y - \frac{1}{2} \omega_z^2 x &\equiv \ddot x - \frac{q B_0}{m} \dot y - \frac{q V_0}{m d^2} x = 0, \label{eq:transv_eom_x}\\
|
||||
\ddot y + \omega_0 \dot x - \frac{1}{2} \omega_z^2 y &\equiv \ddot y + \frac{q B_0}{m} \dot x - \frac{q V_0}{m d^2} y = 0 \label{eq:transv_eom_y}.
|
||||
\end{align}
|
||||
Using the sum of equations: $\eqref{eq:transv_eom_x} + i \eqref{eq:transv_eom_y}$, we can use the general definition $f(t) \equiv x(t) + i y(t)$ to derive a single complex differential equation for the transversal motion
|
||||
Using the sum of equations: $\eqref{eq:transv_eom_x} + i \eqref{eq:transv_eom_y}$, we can utilize the general definition $f(t) \equiv x(t) + i y(t)$ to derive a single complex differential equation for the transversal motion
|
||||
\begin{equation} \label{eq:complex_transv_eom}
|
||||
\ddot f + i \omega_0 \dot f - \frac{1}{2} \omega_z^2 f = 0.
|
||||
\end{equation}
|
||||
@@ -40,7 +40,7 @@ This solution is valid for $\omega_0^2 > 2 \omega_z^2$. In the case of $\omega_0
|
||||
\begin{equation}
|
||||
\frac{q}{m} B_0^2 > \frac{2 V_0}{d^2}.
|
||||
\end{equation}
|
||||
Given this condition, the solution for the transversal motion will be bound, i.e. $|f(t)| < \infty$ for all $t > 0$. Given the stability criterion, the two terms in \cref{eq:general_transv_solution} can be identified as sinusoidal motions with amplitudes $A_\pm$. If the two terms are in phase the upper limit of $|f| \equiv R_+$ will be $R_+ = A_+ + A_-$, while the lower limit for the case of antiparallel phases will be the absolute of the difference in the two amplitudes, $R_- = |A_+ - A_-|$. A analytical solution for a special case of initial conditions is derived in \cref{app:special_case_analytical_solution}.
|
||||
Given this condition, the solution for the transverse motion will be bounded, i.e. $|f(t)| < \infty$ for all $t > 0$. According to the stability criterion, the two terms in \cref{eq:general_transv_solution} can be identified as sinusoidal motions with amplitudes $A_\pm$. If the two terms are in phase the upper limit of $|f| \equiv R_+$ will be $R_+ = A_+ + A_-$, while the lower limit for the case of antiparallel phases will be the absolute of the difference in the two amplitudes, $R_- = |A_+ - A_-|$. A analytical solution for a special case of initial conditions is derived in \cref{app:special_case_analytical_solution}.
|
||||
|
||||
\subsubsection*{Multiple particles}
|
||||
For the case of multiple particles, it is important to include the particle-particle interactions. For this analysis we will only consider the Coulomb interaction between the particles, neglecting magnetic interactions. The force on particle $i$ due to all other particles $j$ is then given by
|
||||
@@ -50,7 +50,7 @@ For the case of multiple particles, it is important to include the particle-part
|
||||
|
||||
\subsection*{Numerical Integration Methods}
|
||||
\subsubsection*{Forward Euler method}
|
||||
The simplest numerical method to solve the ordinary differential equation system is the Forward Euler method. It is a first order method, meaning that the local truncation error per step is on the order of $\mathcal{O}(h^2)$, with $h$ being the step size. The global error after $N$ steps is therefore on the order of $\mathcal{O}(h)$ \cite{fjordholm_numerical_nodate}. The method is explicit, meaning that the state of the system at the next time step can be calculated directly from the current state. Given a general ordinary differential equation of the form
|
||||
The simplest numerical method to solve the ordinary differential equation system is the Forward Euler method. It is a first order method, meaning that the local truncation error per step is on the order of $\mathcal{O}(h^2)$, with $h$ being the step size. The global error after $N$ steps is therefore on the order of $\mathcal{O}(h)$ \cite{fjordholm_numerical_nodate}. This is an explicit method, meaning the state of the system at the next time step can be calculated directly from the current state. Given a general ordinary differential equation of the form
|
||||
\begin{equation}
|
||||
\dot y(t) = f(t, y(t)),
|
||||
\end{equation}
|
||||
@@ -63,7 +63,7 @@ For our second order differential equations, we first rewrite them as a system o
|
||||
\vec r_{n+1} &= \vec r_n + h \vec v_n, \\
|
||||
\vec v_{n+1} &= \vec v_n + h \frac{\vec F(\vec r_n, \vec v_n, t_n)}{m}.
|
||||
\end{align}
|
||||
This method is computationally inexpensive, as we only need a single force evaluation per time step. However, it is known to be not very accurate.
|
||||
The computational expense of this method is minimal, as only a single force evaluation is required at each time step. However, it is acknowledged that this method is not particularly precise.
|
||||
\subsubsection*{Runge-Kutta 4 method}
|
||||
The Runge-Kutta 4 (RK4) method is a popular and more accurate method for solving ordinary differential equations. It is a fourth-order method, meaning that the local truncation error per step is on the order of $\mathcal{O}(h^5)$, and the global error after $N$ steps is on the order of $\mathcal{O}(h^4)$ \cite{fjordholm_numerical_nodate}. The RK4 method calculates the next state of the system using a weighted average of four different estimates of the slope (the derivative) at different points within the time step. Given a general ordinary differential equation of the form
|
||||
\begin{equation}
|
||||
@@ -77,7 +77,7 @@ the RK4 method updates the state of the system as follows \cite{cheever_fourth_2
|
||||
k_4 &= h f(t_n + h, y_n + k_3), \\
|
||||
y_{n+1} &= y_n + \frac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4).
|
||||
\end{align}
|
||||
As this method is again a generalized solver for ODE of the first order, we again rewrite our second order differential equations as a system of first order equations.
|
||||
As this method is, once more, a generalised solver for ODE of the first order, the second order differential equations are to be rewritten as a system of first order equations.
|
||||
|
||||
\subsubsection*{Velocity-Verlet method}
|
||||
In contrast to the previous two methods, the Velocity-Verlet method is a symplectic integrator which is specifically designed for second order differential equations of the form
|
||||
@@ -90,11 +90,11 @@ The method is time-reversible and conserves energy better over long time periods
|
||||
\vec a_{n+1} &= \frac{\vec F(\vec r_{n+1}, t_{n+1})}{m}, \\
|
||||
\vec v_{n+1} &= \vec v_n + \frac{h}{2} (\vec a_n + \vec a_{n+1}),
|
||||
\end{align}
|
||||
It is important to note that the Velocity-Verlet integrator requires forces to be independent of velocity. In the case, that the algorithm is applicable, it is a very efficient method, as it only requires a single force evaluation per time step, while still being a second order method with a local truncation error per step on the order of $\mathcal{O}(h^3)$ and a global error after $N$ steps on the order of $\mathcal{O}(h^2)$\cite{kubar_lecture_2025}.
|
||||
Because of the symplectic nature, the low number of force evaluations and the good energy conservation properties, the Velocity-Verlet method is widely used and the quasi-standard in molecular dynamics simulations\cite{kubar_lecture_2025}.
|
||||
It is important to note that the Velocity-Verlet integrator requires forces to be independent of velocity. In the case, that the algorithm is applicable, it is a very efficient method, as it only requires a single force evaluation per time step, while still being a second order method with a local truncation error per step on the order of $\mathcal{O}(h^3)$ and a global error after $N$ steps on the order of $\mathcal{O}(h^2)$ \cite{kubar_lecture_2025}.
|
||||
Because of the symplectic nature, the low number of force evaluations and the good energy conservation properties, the Velocity-Verlet method is widely used and the quasi-standard in molecular dynamics simulations \cite{kubar_lecture_2025}.
|
||||
|
||||
\subsubsection*{Boris algorithm}
|
||||
The Boris algorithm is a widely used method for integrating the equations of motion of charged particles in electromagnetic fields \cite{webb_symplectic_2014,noauthor_pdf_2025}. It is particularly well-suited for problems where the Lorentz force plays a significant role, as it is designed to handle the velocity-dependent nature of the magnetic force. The Boris algorithm is a symplectic integrator\cite{webb_symplectic_2014}\footnote{The simplecticity of Boris algorithm is controversial with disagreement between papers \cite{noauthor_pdf_2025}. All publications agree on the fact, that Boris algorithm is phase-space preserving at the very least.}, which means it conserves the phase space volume and exhibits good long-term energy conservation properties. The algorithm updates the position and velocity of a charged particle in a magnetic field as follows:
|
||||
The Boris algorithm is a widely utilised technique for integrating the equations of motion of charged particles in electromagnetic fields \cite{webb_symplectic_2014,noauthor_pdf_2025}. The device is especially well-suited to problems in which the Lorentz force is significant, as it is designed to handle the velocity-dependent nature of the magnetic force. The Boris algorithm is a symplectic integrator \cite{webb_symplectic_2014}.\footnote{However, there is a lack of consensus on the symplecticity of the Boris algorithm, with different papers providing contradictory evidence \cite{noauthor_pdf_2025}. It is an irrefutable conclusion that all publications concur on the fact that the Boris algorithm is phase-space preserving at the very least.} This signifies that it conserves the phase space volume and exhibits favourable long-term energy conservation properties. The algorithm responsible for this calculation updates the position and velocity of a charged particle in a magnetic field as follows:
|
||||
We define two auxiliary velocities $\vec v^-$ and $\vec v^+$, which represent the velocity before and after the magnetic field rotation, respectively. The algorithm proceeds in the following steps \cite{hoppock_iwhoppockboris-algorithm_2025}:
|
||||
\begin{align}
|
||||
\vec v^- &= \vec v_n + \frac{q \vec E h}{2m}\\
|
||||
@@ -116,7 +116,7 @@ The final update of the velocity and position is then given by
|
||||
The basic framework for the numerical analysis is based on a \texttt{PenningTrap} class, which contains all the particles present in the trap, as well as a parametrization of the electric and magnetic fields. The particles are represented by a \texttt{Particle} class, which contains the physical properties of the particle, as well as its current position and velocity. With this information, the \texttt{PenningTrap} class can calculate the forces acting on each particle, including the external fields and the particle-particle interactions. The particle-particle interactions can be toggled on and off, allowing for a simulation of both scenarios. The external fields can be modified by supplying a field-method of the form \texttt{external\_field(const arma::vec\& r, double t, const PenningTrap\& trap)}. The reference to the \texttt{PenningTrap} allows for the parameters of the field to be stored in the trap object. The implementation of the \texttt{Particle} and \texttt{PenningTrap} classes can be found in \texttt{/src/project3/include/classes.hpp} of the project repository, as well as in the corresponding source file \texttt{/src/project3/src/classes.cpp}.
|
||||
|
||||
\subsection*{Numerical Methods Implementation}
|
||||
All numerical methods are implemented as classes inheriting from a base class \texttt{Solver}. The base class contains a reference to the \texttt{PenningTrap} object, as well as the time step size. The recording of particle properties over time, like position and velocity is part of the general \texttt{Solver} class. Each derived class implements the \texttt{step()} method, which updates the state of the system by one time step using the respective numerical method. The implementation of the \texttt{Solver} class and its derived classes can be found in \texttt{/src/project3/include/solvers.hpp} of the project repository, as well as in the corresponding source file \texttt{/src/project3/src/solvers.cpp}. The following solvers are implemented:\texttt{Forward\-Euler\-Solver}, \texttt{RK4\-Solver}, \texttt{Velocity\-Verlet\-Solver} and \texttt{Analytical\-Solver}, which implements the analytical solution for a special case of initial conditions (see \cref{app:special_case_analytical_solution}).
|
||||
All numerical methods are implemented as classes inheriting from a base class \texttt{Solver}. The base class contains a reference to the \texttt{PenningTrap} object, as well as the time step size. The recording of particle properties over time, like position and velocity is part of the general \texttt{Solver} class. Each derived class implements the \texttt{step()} method, which updates the state of the system by one time step using the respective numerical method. The implementation of the \texttt{Solver} class and its derived classes can be found in \texttt{/src/project3/include/solvers.hpp} of the project repository, as well as in the corresponding source file \texttt{/src/project3/src/solvers.cpp}. The following solvers are implemented: \texttt{Forward\-Euler\-Solver}, \texttt{RK4\-Solver}, \texttt{Velocity\-Verlet\-Solver} and \texttt{Analytical\-Solver}, which implements the analytical solution for a special case of initial conditions (see \cref{app:special_case_analytical_solution}).
|
||||
|
||||
Unless otherwise specified, the simulations are run with the following parameters:
|
||||
\begin{itemize}
|
||||
@@ -125,9 +125,9 @@ Unless otherwise specified, the simulations are run with the following parameter
|
||||
\item Simulation parameters: $T = n_\mathrm{steps} \cdot h = \qty{50}{\us}$.
|
||||
\end{itemize}
|
||||
\subsection*{Tools}
|
||||
All simulations are written in C++ and compiled using \texttt{g++ (GCC) 15.2.1 20250808 (Red Hat 15.2.1-1)}. For optimization, the \texttt{-O3} flag is used. The code makes use of the Armadillo library\cite{sanderson_armadillo_2025,sanderson_practical_2019} for linear algebra operations and the argparse library\cite{pranav_p-ranavargparse_2025} for command line argument parsing.
|
||||
To visualize the results and analyze the data, Python 3.13.7 with the libraries \texttt{numpy} \cite{harris_array_2020}, \texttt{matplotlib} \cite{hunter_matplotlib_2007} and \texttt{pandas} \cite{team_pandas-devpandas_2025} is used. To create easy to use command line interfaces for the Python scripts, the \texttt{typer} library\cite{ramirez_typer_nodate} is used.
|
||||
All simulations are written in C++ and compiled using \texttt{g++ (GCC) 15.2.1 20250808 (Red Hat 15.2.1-1)}. For optimization, the \texttt{-O3} flag is used. The code makes use of the Armadillo library \cite{sanderson_armadillo_2025,sanderson_practical_2019} for linear algebra operations and the argparse library \cite{pranav_p-ranavargparse_2025} for command line argument parsing.
|
||||
To visualize the results and analyze the data, Python 3.13.7 with the libraries \texttt{numpy} \cite{harris_array_2020}, \texttt{matplotlib} \cite{hunter_matplotlib_2007} and \texttt{pandas} \cite{team_pandas-devpandas_2025} is used. To create easy to use command line interfaces for the Python scripts, the \texttt{typer} library \cite{ramirez_typer_nodate} is used.
|
||||
|
||||
As a large number of simulations need to be run for different parameters, a bash script is used to automate the process. The script can be found in \texttt{/src/project3/generate\_results.sh} of the project repository. It uses the \texttt{pueue} task management tool\cite{beer_nukesorpueue_2025} to run multiple simulations in parallel, making use of all available CPU cores. To automate the plot generation, the script \texttt{generate\_plots.sh} is used, which can be found in the same directory.
|
||||
As a large number of simulations need to be run for different parameters, a bash script is used to automate the process. The script can be found in \texttt{/src/project3/generate\_results.sh} of the project repository. It uses the \texttt{pueue} task management tool \cite{beer_nukesorpueue_2025} to run multiple simulations in parallel, making use of all available CPU cores. To automate the plot generation, the script \texttt{generate\_plots.sh} is used, which can be found in the same directory.
|
||||
|
||||
To aid in the development process, the large language model GitHub Copilot\cite{noauthor_github_2025} was used to generate code snippets and provide suggestions for code completion. Other large language models were not used in the writing of this report.
|
||||
To aid in the development process, the large language model GitHub Copilot \cite{noauthor_github_2025} was used to generate code snippets and provide suggestions for code completion. Other large language models were not used in the writing of this report.
|
||||
Reference in New Issue
Block a user