Coryab/code #10

Merged
coryab merged 37 commits from coryab/code into develop 2023-10-24 10:45:33 +00:00
24 changed files with 608 additions and 203 deletions
Showing only changes of commit 3eb652be83 - Show all commits

View File

@ -1,44 +0,0 @@
\documentclass[../main.tex]{subfiles}
\graphicspath{{\subfix{../images/}}}
\begin{document}
\appendix
\section*{Appendix A}\label{sec:appendix_a}
Equations given
\begin{equation}\label{eq:newton_second}
m \ddot{\mathbf{r}} = \sum_{i} \mathbf{F}_{i}
\end{equation}
%
%
\begin{equation}\label{eq:e_field_point}
\mathbf{E} = k_{e} \sum_{j=1}^{n} q_j \frac{\mathbf{r} - \mathbf{r}_{j}}{|\mathbf{r} - \mathbf{r}_{j}|^{3}}
\end{equation}
%
\begin{equation}\label{eq:e_field_potential}
\mathbf{E} = - \nabla V
\end{equation}
\section*{Appendix B}\label{sec:appendix_b}
Sum of all forces
\begin{align*}
sum
\end{align*}
We find the physical coordinates from $x(t) = \text{Re} f(t)$ and $y(t) = \text{Im} f(t)$, where $f(t)$ is given by equation \eqref{eq:general_solution}.
We can rewrite $f(t)$ using the definition as
\begin{align*}
% f(t) =& A_{+}e^{-i(\omega_{+} t + \phi_{+})} + A_{-}e^{-i(\omega_{-} t + \phi_{-})} \\
f(t) =& A_{+}(\cos{\omega_{+} t + \phi_{+}} - i \sin{\omega_{+} t + \phi_{+}}) \\
\numberthis \label{eq:general_solution_trig}
&+ A_{-}(\cos{\omega_{-} t + \phi_{-}} - i \sin{\omega_{-} t + \phi_{-}})
\end{align*}
%
If we rearrange the right side of equation \eqref{eq:general_solution_trig}, we find the physical coordinates
\begin{align}\label{eq:physical_coord}
x(t) &= A_{+}(\cos{\omega_{+} t + \phi_{+}}) + A_{-}(\cos{\omega_{-} t + \phi_{-}}) \\
y(t) &= - A_{+}(i \sin{\omega_{+} t + \phi_{+}}) - A_{-}(i \sin{\omega_{-} t + \phi_{-}})
\end{align}
\end{document}

View File

@ -0,0 +1,29 @@
\documentclass[../main.tex]{subfiles}
\graphicspath{{\subfix{../images/}}}
\begin{document}
\section{Equations of electrodynamics and classical mechanics}\label{sec:appendix_a}
Newton's second law
\begin{equation}\label{eq:newton_second}
m \ddot{\mathbf{r}} = \sum_{i} \mathbf{F}_{i}
\end{equation}%
%
Lorentz force
\begin{equation}\label{eq:lorentz_force}
\mathbf{F} = q \mathbf{E} + q \mathbf{v} \times \mathbf{B},
\end{equation}%
%
Electric field
\begin{equation}\label{eq:e_field_potential}
\mathbf{E} = - \nabla V
\end{equation} %
%
Electric field at a point $\mathbf{r}$
\begin{equation}\label{eq:e_field_point}
\mathbf{E} = k_{e} \sum_{j=1}^{n} q_j \frac{\mathbf{r} - \mathbf{r}_{j}}{|\mathbf{r} - \mathbf{r}_{j}|^{3}}
\end{equation}
\end{document}

View File

@ -0,0 +1,145 @@
\documentclass[../main.tex]{subfiles}
\graphicspath{{\subfix{../images/}}}
\begin{document}
\section{Derivation of equations}\label{sec:appendix_b}
% Problem 1
\subsection{Equations of motion}\label{sec:eq_motion} %
First, we need to define the velocity of the particle
\begin{align*}
\mathbf{v} \equiv \frac{d \mathbf{r}}{dt} &= \bigg( \frac{dx}{dt}, \frac{dy}{dt}, \frac{dz}{dt} \bigg).
\end{align*} %
We can rewrite the velocity as $\dot{r} = (\dot{x}, \dot{y}, \dot{z})$, and find the cross product
\begin{align*}
q \mathbf{v} \cross \mathbf{B} &=
q \begin{vmatrix}
\hat{e}_{x} & \hat{e}_{y} & \hat{e}_{z} \\
\dot{x} & \dot{y} & \dot{z} \\
0 & 0 & B_{0}
\end{vmatrix}
= q \big( B_{0} \dot{y}, -B_{0} \dot{x}, 0 \big).
\end{align*} %
We are considering an ideal Penning traps, where we define the electric potential as
\begin{align*}
V(x, y, z) &= \frac{V_{0}}{2 d^{2}}(2z^{2} - x^{2} - y^{2}).
\end{align*} %
The relationship between the electric field $\mathbf{E}$ and the electric potential of the field is given by
\begin{align*}
\mathbf{E} &= - \nabla V \\
&= - \bigg( \frac{dV}{dx}, \frac{dV}{dy} \frac{dV}{dz} \bigg) \\
&= \frac{V_{0}}{d^{2}} \big( x, y, -2z \big).
\end{align*} %
We can now express the Lorentz force as
\begin{align*}
\mathbf{F} &= q \mathbf{E} + q \mathbf{v} \cross \mathbf{B} \\
&= \frac{q V_{0}}{d^{2}} \big( x, y, -2z \big) + \big(q B_{0} \dot{y}, -q B_{0} \dot{x}, 0 \big),
\end{align*} %
and insert it into Newtons equation \eqref{eq:newton_second}. We get
\begin{align*}
\ddot{\mathbf{r}} &= \bigg( \frac{q V_{0}}{m d^{2}} x, \frac{q V_{0}}{m d^{2}} y, -\frac{2 q V_{0}}{m d^{2}} z \bigg) + \bigg(\frac{q B_{0}}{m} \dot{y}, -\frac{q B_{0}}{m} \dot{x}, 0 \bigg),
\end{align*} %
which can be written as
\begin{align*}
\ddot{x} &= \frac{q V_{0}}{m d^{2}} x + \frac{q B_{0}}{m} \dot{y}, \\
\ddot{y} &= \frac{q V_{0}}{m d^{2}} y - \frac{q B_{0}}{m} \dot{x}, \\
\ddot{z} &= -\frac{2 q V_{0}}{m d^{2}} z.
\end{align*}
If we define
\begin{equation*}
\omega_{0} \equiv \frac{q B_{0}}{m}, \quad \omega_{z}^{2} \equiv \frac{2 q V_{0}}{m d^{2}},
\end{equation*}
the equations of motion can be written as
\begin{align*}
\ddot{x} &= \frac{1}{2} \omega_{z}^{2} x + \omega_{0} \dot{y}, \\
\ddot{y} &= \frac{1}{2} \omega_{z}^{2} y - \omega_{0} \dot{x}, \\
\ddot{z} &= -\omega_{z}^{2} z. \\
\end{align*}
\subsection{General solution}\label{sec:eq_general}
We consider the characteristic equation of a second order differential equation \cite{lindstrom:2016:ch10:5},
\begin{align*}
r^{2} + \omega_{z}^{2} &= 0 \\
r &= \pm \sqrt{- \omega_{z}^{2}}.
\end{align*} %
The characteristic equation has two complex roots
\begin{equation*}
r_{1} = - i \omega_{z}, \quad r_{2} = i \omega_{z},
\end{equation*}
which give us solutions in the general form
\begin{equation*}
z = c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t}.
\end{equation*}
In addition, for a complex number $z = a + ib$, we can define $e^{z} \equiv e^{a} (\cos{b} + i \sin{b})$ \cite{lindstrom:2016:ch3}. We can rewrite the general solution as
\begin{align*}
c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t} &= c_{1} (\cos{\omega_{z} t} + i \sin{\omega_{z} t}) \\
& \quad + c_{2} (\cos{\omega_{z} t} - i \sin{\omega_{z} t} \\
&= E \cos{\omega_{z} t} + i F \sin{\omega_{z} t}.
\end{align*} %
%
\subsection{Complex function}\label{sec:eq_complex} %
In sec. \ref{sec:eq_motion} we found the differential equations for $\ddot{x}$ and $\ddot{y}$. To derive a single differential equation, we introduce the complex function $f(t) = x(t) + iy(t)$, which gives us
\begin{align*}
0 &= \Big(\ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x \Big) + i \Big(\ddot{y} + \omega_{0} \dot{x} - \frac{1}{2} \omega_{z}^{2} y \Big) \\
&= \ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x + i\ddot{y} + i\omega_{0} \dot{x} - i \frac{1}{2} \omega_{z}^{2} y \\
&= \ddot{x} + i\ddot{y} + i\omega_{0} \dot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x - i \frac{1}{2} \omega_{z}^{2} y. \\
\end{align*}
Using the definition $i = \sqrt{-1}$, we can rewrite
\begin{equation*}
i \omega_{0} \dot{x} + (-1) \omega_{0} \dot{y} = i \omega_{0} \dot{x} + i^{2} \omega_{0} \dot{y}.
\end{equation*}
This gives us a single differential equation
\begin{align*}
0 &= \ddot{x} + i\ddot{y} + i\omega_{0} (\dot{x} + i \dot{y}) - \frac{1}{2} \omega_{z}^{2} x - i \frac{1}{2} \omega_{z}^{2} y \\
&= \ddot{f} + i \omega_{0} \dot{f} - \frac{1}{2} \omega_{z}^{2} f.
\end{align*}
%
\subsection{Physical coordinates}\label{sec:eq_coord}
We can rewrite eq. \eqref{eq:general_solution}, as
\begin{align*}
f(t) &= A_{+}e^{-i(\omega_{+} t + \phi_{+})} + A_{-}e^{-i(\omega_{-} t + \phi_{-})} \\
&= A_{+}(\cos{(\omega_{+} t + \phi_{+})} - i \sin{(\omega_{+} t + \phi_{+})}) \\
% \numberthis \label{eq:general_solution_trig}
& \quad + A_{-}(\cos{(\omega_{-} t + \phi_{-})} - i \sin{(\omega_{-} t + \phi_{-})}).
\end{align*} %
%
\subsection{Upper and lower bounds}\label{sec:upper_lower_bound}
To obtain the upper and lower bounds of the particle's distance from the origin, we first find an expression for the second norm (?) defined as $|f(t)| = \sqrt{(x(t))^{2} + (y(t))^{2}}$.
\begin{align*}
(x(t))^{2} &= \big( A_{+}\cos(\omega_{+} t + \phi_{+}) + A_{-}\cos(\omega_{-} t + \phi_{-}) \big)^{2} \\
&= A_{+}^{2} \cos^{2}(\omega_{+} t + \phi_{+}) \\
& \quad + 2 A_{+}A_{-} \cos(\omega_{+} t + \phi_{+})\cos(\omega_{-} t + \phi_{-}) \\
& \quad + A_{-}^{2}\cos^{2}(\omega_{-} t + \phi_{-}), \\
\end{align*} %
\begin{align*}
(y(t))^{2} &= \big( - A_{+} \sin(\omega_{+} t + \phi_{+}) - A_{-} \sin(\omega_{-} t + \phi_{-}) \big)^{2} \\
&= A_{+}^{2} \sin^{2}(\omega_{+} t + \phi_{+}) \\
& \quad + 2 A_{+}A_{-} \sin(\omega_{+} t + \phi_{+})\sin(\omega_{-} t + \phi_{-}) \\
& \quad + A_{-}^{2} \sin^{2}(\omega_{-} t + \phi_{-}).
\end{align*} %
We insert these expressions, and find
\begin{align*}
|f(t)| &= \sqrt{(x(t))^{2} + (y(t))^{2}} \\
&= \sqrt{A_{+}^{2} + 2 A_{+} A_{-} \cos^{2}(\alpha) + A_{-}^{2}},
\end{align*} %
where $\alpha = (\omega_{+} - \omega_{-}) t +( \phi_{+} - \phi_{-})$. If we set $\alpha = 0$ we get $\cos(0) = 1$, and obtain the upper bound
\begin{align*}
R_{+} &= \sqrt{A_{+}^{2} + 2 A_{+} A_{-} + A_{-}^{2}} \\
&= \sqrt{(A_{+} + A_{-})^{2}} \\
&= A_{+} + A_{-}.
\end{align*}
If $\alpha = \pi$ we get $\cos(\pi) = -1$, and find the lower bound
\begin{align*}
R_{-} &= \sqrt{A_{+}^{2} - 2 A_{+} A_{-} + A_{-}^{2}} \\
&= \sqrt{(A_{+} - A_{-})^{2}} \\
&= |A_{+} - A_{-}|.
\end{align*} %
%
\subsection{Bounded solution}\label{sec:bounded_solution}
\end{document}
% \begin{align*}
% \omega_{+} - \omega_{-} &= \frac{\omega_{0} + \sqrt{\omega_{0}^{2} - 2 \omega_{z}^{2}}}{2} - \frac{\omega_{0} - \sqrt{\omega_{0}^{2} - 2 \omega_{z}^{2}}}{2} \\
% &=
% \end{align*}

View File

@ -0,0 +1,21 @@
\documentclass[../main.tex]{subfiles}
\graphicspath{{\subfix{../images/}}}
\begin{document}
\section{Numbers and units}\label{sec:appendix_c}
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
Constant & Value & Unit \\
\hline
$k_{e}$ (Coulomb) & $1.38935333 \cross 10^{5}$ & $\frac{u (\mu m)^{3}}{(\mu s)^{2} e^{2}}$ \\
T (Tesla) & $9.64852558 \cross 10^{1}$ & $\frac{u}{(\mu s) e}$ \\
V (Volt) & $9.64852558 \cross 10^{7}$ & $\frac{u (\mu m)^{2}}{(\mu s)^{2} e}$ \\
\hline
\end{tabular}
\caption{Value of the Coulomb constant ($k_{e}$), and the SI units for magnetic field strength ($T$) and electric potential ($V$). The base units are given by length in micrometre ($\mu m$), time in microseconds ($\mu s$), mass in ($u$), and charge in elementary charge ($e$).}
\label{tab:constants}
\end{table}
\end{document}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,6 +10,7 @@
% Allows special characters (including æøå)
\usepackage[utf8]{inputenc}
\usepackage{fontawesome}
% \usepackage{tabularx}
% \usepackage[english]{babel}
%% Note that you may need to download some of these packages manually, it depends on your setup.
@ -24,12 +25,12 @@
\usepackage{listings} % display code
\usepackage{subfigure} % imports a lot of cool and useful figure commands
% \usepackage{float}
% \usepackage[section]{placeins}
%\usepackage[section]{placeins}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{subfigure}
\usepackage{tikz}
% \usetikzlibrary{quantikz2}
\usetikzlibrary{quantikz2}
% defines the color of hyperref objects
% Blending two colors: blue!80!black = 80% blue and 20% black
\hypersetup{ % this is just my personal choice, feel free to change things
@ -63,9 +64,6 @@
% Introduction
\subfile{sections/introduction}
% Theory
\subfile{sections/theory}
% Methods
\subfile{sections/methods}
@ -76,7 +74,10 @@
\subfile{sections/conclusion}
\subfile{appendix/appendix}
\appendix
\subfile{appendix/appendix_a}
\subfile{appendix/appendix_b}
\subfile{appendix/appendix_c}
\onecolumngrid

View File

@ -24,10 +24,10 @@
subtitle = {An Introduction},
publisher = {Springer Cham},
year = {2018},
edition = {1--6}
edition ={1--6}
}
@article{hunter:2007,
@article{hunter:2007:matplotlib,
author = {Hunter, J. D.},
title = {Matplotlib: A 2D graphics environment},
journal = {Computing in Science \& Engineering},
@ -60,7 +60,7 @@
pages = {589--606}
}
@article{britannica:2023:matter,
@online{britannica:2023:matter,
author = {The Editors of Encyclopaedia Britannica},
title = {matter},
year = {2023},
@ -76,12 +76,29 @@
pages = {162--163}
}
@article{waskom:2021:seaborn,
author = {Michael L. Waskom},
title = {seaborn: statistical data visualization},
journal = {Journal of Open Source Software},
volume = {6},
number = {60},
publisher = {The Open Journal},
year = {2021},
doi = {10.21105/joss.03021},
url = {https://doi.org/10.21105/joss.03021},
pages = {3021}
}
@article{rk4_method,
author = "Morten Hjorth-Jensen",
title = "Computational Physics, Lecture Notes Fall 2015",
journal = "Department of Physics, University of Oslo",
year = "2015",
chapter = "8.4",
pages = "250--252",
@online{openmp:2018,
author = {OpenMP},
title = {OpenMP Application Programming Interface},
year = {2018},
url = {https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf},
urldate = {2023-10-22}
}
@misc{penning:fig,
key = ,
url = {https://www.med.physik.uni-muenchen.de/research/nuclear-science/nuclear-masses/mlltrap/layout/traps/index.html}
note = {Configuration figure a}
}

View File

@ -2,12 +2,12 @@
\graphicspath{{\subfix{../images/}}}
\begin{document}
%
\section{Introduction}
We are surrounded by matter, which are made up of elementary particles. In the field of physics we want to understand the properties of these particles, measure their physical quantities, not to mention explain the origin of mass \cite{britannica:2023:matter}.
However, to study a particle, it is necessary isolate and contain it over time. The Penning trap is a device, able to confine charged particles for a period of time. This concept was evolved from F. M. Penning's implementation of magnetic fiels to a vaccum gauge, and J. R. Pierce's work with electron beams, and put into practice by Hans Dehmelt. In 1973 Dehmelt and his group of researchers were able to confine a particle and store it over several months \cite{vogel:2018:ch1}.
In practice, a Penning trap is not easy to obtain, and an experiment is both time consuming and expensive. A numerical approach, allow us to study the effects of the Penning trap on a charged particle, without the cost. We can use ordinary differential equations to model the particle's movement, confined within an Penning trap. Our focus will be on an ideal Penning trap, where an electrostatic field confines the particle in z-direction, and a magnetic field confines it in the radial direction. We will use numerical methods to model a single particle, and study the particle motion in radial direction. In addition, we will model a system of particles, and study their motion both with and without particle interaction.
%
\end{document}

BIN
latex/sections/methods.pdf Normal file

Binary file not shown.

View File

@ -3,39 +3,100 @@
\begin{document}
\section{Methods}
% Problem 1
When we study the Penning traps effect on a particle with a charge $q$, we need to consider the forces acting on the particle. We can use Newton's second law \eqref{eq:newton_second} to determine the position of a particle as a function of time. In addition, we introduce the Lorentz force \eqref{eq:lorentz_force}, which describes the force on the particle. The position can be described by %
%
\begin{equation}\label{eq:newton_lorentz}
m \ddot{\mathbf{r}} = (q \mathbf{E} + q \mathbf{v} \times \mathbf{B}).
\end{equation}
%
Using eq. \eqref{eq:newton_lorentz} we derive the differential equations in sec. \ref{sec:eq_motion}, and can rewrite them as
\begin{align}
\label{eq:motion_x}
\ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x &= 0, \\
\label{eq:motion_y}
\ddot{y} - \omega_{0} \dot{x} - \frac{1}{2} \omega_{z}^{2} y &= 0, \\
\label{eq:motion_z}
\ddot{z} + \omega_{z}^{2} z &= 0,
\end{align} %
%
We find the general solution for eq. \eqref{eq:motion_z}
\begin{equation}\label{eq:eq_general}
z(t) = c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t},
\end{equation} %
derived in sec. \ref{sec:eq_general}. Continuing, we will use a Calcium ion with a single positive charge. That is, we assume the charge of the particle is $q > 0$.
% Problem 2
Since eq. \eqref{eq:motion_x} and eq. \eqref{eq:motion_y} are coupled, we want to rewrite them as a single differential equation. We derive this in sec. \ref{sec:eq_complex}, and the resulting equation is given by
\begin{equation}\label{eq:single_differential}
\ddot{f} + i \omega_{0} \dot{f} - \frac{1}{2} \omega_{z}^{2} f = 0.
\end{equation}
% Problem 3
Eq. \eqref{eq:single_differential} has a general solution given by
\begin{equation}\label{eq:general_solution}
f(t) = A_{+}e^{-i(\omega_{+} t + \phi_{+})} + A_{-}e^{-i(\omega_{-} t + \phi_{-})}.
\end{equation} %
The amplitude $A_{+}$ and $A_{-}$ are positive, the phases $\phi_{+}$ and $\phi_{-}$ are constant, and the rate is given by
\begin{equation*}
\omega_{\pm} = \frac{\omega_{0} \pm \sqrt{\omega_{0}^{2} - 2 \omega_{z}^{2}}}{2}.
\end{equation*}
We find the physical coordinates at a given time $t$ using
\begin{equation*}
x(t) = \text{Re}f(t), \quad y(t) = \text{Im}f(t),
\end{equation*} %
and eq. \eqref{eq:general_solution}. We can rearrange the right hand side of the derived expression in \ref{sec:eq_coord}, and find the physical coordinates
\begin{align}\label{eq:physical_coord}
x(t) &= A_{+} \cos(\omega_{+} t + \phi_{+}) + A_{-} \cos(\omega_{-} t + \phi_{-}) \\
y(t) &= - A_{+} \sin(\omega_{+} t + \phi_{+}) - A_{-} \sin(\omega_{-} t + \phi_{-})
\end{align} %
% Problem 4
However, to obtain a bound on the particle's movement in the radial direction, we have to ensure that
\begin{align*}
|f(t)| &= \sqrt{(x(t))^{2} + (y(t))^{2}}. \\
\end{align*} %
When $t \rightarrow \infty$, the upper and lower limits are
\begin{align}
R_{+} &= A_{+} + A_{-} \\
R_{-} &= |A_{+} - A_{-}|,
\end{align}
derived in sec. \ref{sec:bounded_solution}.
% Problem 3
To obtain the bounded solution, we need to consider the expression
\begin{equation*}
\alpha = (\omega_{+} - \omega_{-}) t +( \phi_{+} - \phi_{-}).
\end{equation*}
When $t \rightarrow \infty$ the constant phases will not affect the expression, we obtain a bounded solution if we consider the rate such that $|f(t)| < \infty$. That is, we need $\omega_{0}^{2} - 2 \omega_{z}^{2}$ in eq. \eqref{eq:angular_rate} to be real.
\begin{align*}
\omega_{0}^{2} - 2 \omega_{z}^{2} = 0, \quad \omega_{0} > 2 \omega_{z}
\end{align*}
\begin{equation}\label{eq:angular_rate}
\omega_{\pm} = \frac{\omega_{0} \pm \sqrt{\omega_{0}^{2} - 2 \omega_{z}^{2}}}{2}
\end{equation}
We find the solution
Physical properties given by newtons second law \eqref{eq:newton_second}
The particle moves and its position can be determined using newton. where the electric field
\subsection{Units and constants}
Before continuing, we need to define the units we'll be working with.
Since we are working with particles, we need small units to work with so the
numbers we are working with aren't so small that they could potentially lead
to large round-off errors in our simulation. The units that we will use are listed in Table~\ref{tab:units}.
\begin{table}[H]
\begin{center}
\centering
\begin{tabular}[c]{lll}
Dimension & Unit & Symbol \\
Constant & Value & \\
\hline
Length & micrometer & $\mu m$ \\
Time & microseconds & $\mu s$ \\
Mass & atomic mass unit & $u$ \\
Charge & the elementary charge & $e$ \\
$B_{0}$ & $1.00 T$ & $9.65 \cross 10^{1} \frac{u}{(\mu s) e}$ \\
$V_{0}$ & $25.0 mV$ & $2.41 \cross 10^{6} \frac{u (\mu m)^{2}}{(\mu s)^{2} e}$ \\
$d$ & $500 \ \mu m$ & \\
\hline
\end{tabular}
\end{center}
\caption{The set of units we'll be working with.}\label{tab:units}
\caption{Default configuration of the Penning trap, where the value of T and V can be found in table \ref{tab:constants}.}
\label{tab:penning_config}
\end{table}
With these base units, we get
\begin{equation}
k_e = 1.3893533 \cdot 10^5 \frac{u(\mu m)^3}{(\mu s)^2 e},
\end{equation}
and we get that the unit for magnetic field strength (Tesla, $T$) and electric potential (Volt, $V$) are
\begin{equation}
\begin{split}
T &= 9.64852558 \cdot 10^1 \frac{u}{(\mu s) e} \\
V &= 9.64852558 \cdot 10^7 \frac{u (\mu m)^2}{(\mu s)^2 e}. \\
\end{split}
\label{eq:}
\end{equation}
\subsection{Dealing with a multi--particle system}
@ -230,7 +291,6 @@ and would reduce the required amount of loops down to 4.
\subsection{Relative error and error convergance rate}
\subsection{Tools}
We used matplotlib
The numerical methods implemented in C++, are parallelized using OpenMP \cite{openmp:2018}. We used the Python library matplotlib \cite{hunter:2007:matplotlib} to produce all the plots, and seaborn \cite{waskom:2021:seaborn} to set the theme in the figures.
%\biblio
\end{document}

View File

@ -4,7 +4,86 @@
\begin{document}
\section{Results and Discussion}
From equation \eqref{eq:general_solution} we can find
% Single particle
We simulated the movement of particles confined in a Penning trap. All simulations used the initial conditions for particle 1 and 2 given in table \ref{tab:initial_condition_particles}.
Problem 9: we have to deal with $|\mathbf{r}| = d$
First we simulated a single particle for $50 \mu s$, approximating the particle's motion using the RK4 method. In addition we compared the motion of particle 1 with the analytical solution in figure \ref{fig:single_particle}. What we see is a complete overlap of the analytical solution completely overlap the approximated, suggest that the simulation result is good.
% Add something about why the simulated result is good, cos(wt) when w is
%
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
Particle & Position & Velocity \\
\hline
$p_{1}$ & $(20, 0, 20) \mu m$ & $(0, 25, 0) \mu m/ \mu s$ \\
$p_{2}$ & $(25, 25, 0) \mu m$ & $(0, 40, 5) \mu m/ \mu s$ \\
\hline
\end{tabular}
\caption{Initial position and velocity of particle 1 ($p_{1}$) particle 2 ($p_{2}$), where the analytical solution is given by $z(t) = z_{0} \cos (\omega_{z} t)$}
\label{tab:initial_condition_particles}
\end{table}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/single_particle.pdf}
\caption{A single particle in the Penning trap, approximated and analytical motion in z-direction.}
\label{fig:single_particle}
\end{figure}
% Add equations of motion for particle with interaction eq. (18, 19, 20)
% Multiple particles
% Add initial condition of Penning trap
We will now consider the Penning trap with initial conditions given in table \ref{tab:initial_condition_penning}, and simulate using one or two particles. In addition, we simulate two particles both with and without interactions, the result is found in figure \ref{fig:two_particles}. When we add interaction between the particles, they both still follow the same inherent path. However, we observe a small shift in both particle's movement.
\begin{table}[H]
\centering
\begin{tabular}{lll}
$B_0$ & $V_{0}$ & $d$ \\
\hline
\end{tabular}
\caption{Caption}
\label{tab:initial_condition_penning}
\end{table}
%
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/plot_2_particles_xy.pdf}
\caption{Movement of two particles in the xy-plane. $\hat{p}_{1}$ and $\hat{p}_{2}$ include particle interaction, whereas $p_{1}$ and $p_{2}$ does not include particle interaction.}
\label{fig:two_particles}
\end{figure}
% Phase space plot
When we simulate two particles, we can see the effect of interaction between the particles in the xy-plane in fig. \ref{fig:phase_space_2x} and in the z-direction in fig. \ref{fig:phase_space_2z}. What we observe is a very small shift in position for particle 1 in x-direction, whereas particle 2 does not have a visible shift. In the z-direction, however, the oscillation of particle 2 experience a greater shift. Particle 2 experience the force of particle 1 such that particle 2 moves larger distance.
%
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/phase_space_2_particles_x.pdf}
\caption{Phase space plot of two particles in x-direction.}
\label{fig:phase_space_2x}
\end{figure}
%
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/phase_space_2_particles_z.pdf}
\caption{Phase space plot of two particles in z-direction.}
\label{fig:phase_space_2z}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/3d_plot.pdf}
\caption{3D plot of particles-}
\label{fig:3d_particles}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/phase_space_2_particles.pdf}
\caption{Phase space plot of two particles.}
\label{fig:phase_space_2}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/particles_left.pdf}
\caption{Fraction of particles left in the Penning trap, with a given amplitude $f$.}
\label{fig:particles_left}
\end{figure}
\end{document}

View File

@ -1,5 +1,19 @@
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set_theme()
params = {
"font.family": "Serif",
"font.serif": "Roman",
"text.usetex": True,
"axes.titlesize": "large",
"axes.labelsize": "large",
"xtick.labelsize": "large",
"ytick.labelsize": "large",
"legend.fontsize": "medium"
}
plt.rcParams.update(params)
def main():
files = [
@ -9,30 +23,34 @@ def main():
"output/simulate_2_particles/with_interaction/particle_1_r.txt"
]
labels = [
"particle 1 no interaction",
"particle 2 no interaction",
"particle 1 with interaction",
"particle 2 with interaction",
r"$p_1$",
r"$p_2$",
r"$\hat{p}_1$",
r"$\hat{p}_2$",
]
colors = [
"lightskyblue",
"lightskyblue",
"mediumaquamarine",
"salmon",
"salmon"
"seagreen",
"darkred"
]
start_pos = set()
for label, color, file in zip(labels, colors, files):
with open(file) as f:
lines = f.readlines()
t = np.linspace(0, 50, len(lines))
r = np.array([list(map(float, line.strip().split(","))) for line in lines])
plt.plot(r[:,0], r[:,1], label=label, color=color)
start_pos.add((r[0,0],r[0,1]))
for pos in start_pos:
plt.plot(*pos, "o", color="black")
plt.xlabel(r"x $(\mu m)$")
plt.ylabel(r"y $(\mu m)$")
plt.title(r"2 particles with and without interactions.")
# plt.legend()
# plt.show()
plt.savefig("../latex/images/plot_2_particles_xy.pdf")
plt.legend(loc="upper right")
plt.axis("equal")
plt.savefig("../latex/images/plot_2_particles_xy.pdf", bbox_inches="tight")
if __name__ == "__main__":

View File

@ -1,5 +1,20 @@
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set_theme()
params = {
"font.family": "Serif",
"font.serif": "Roman",
"text.usetex": True,
"axes.titlesize": "large",
"axes.labelsize": "large",
"xtick.labelsize": "large",
"ytick.labelsize": "large",
"legend.fontsize": "medium",
"figure.autolayout": True
}
plt.rcParams.update(params)
def main():
files = [
@ -9,15 +24,15 @@ def main():
"output/simulate_2_particles/with_interaction/particle_1_r.txt"
]
labels = [
"particle 1 no interaction",
"particle 2 no interaction",
"particle 1 with interaction",
"particle 2 with interaction",
r"$p_1$",
r"$p_2$",
r"$\hat{p}_1$",
r"$\hat{p}_2$",
]
colors = [
"lightskyblue",
"deepskyblue",
"mediumaquamarine",
"salmon",
"seagreen",
"darkred"
]
ax = plt.figure().add_subplot(projection="3d")
@ -31,6 +46,8 @@ def main():
ax.set_xlabel(r"x $(\mu m)$")
ax.set_ylabel(r"y $(\mu m)$")
ax.set_zlabel(r"z $(\mu m)$")
ax.view_init(10,-35)
plt.title(r"2 particles with and without interactions.")
plt.legend()
plt.savefig("../latex/images/3d_plot.pdf")

View File

@ -29,9 +29,9 @@ def main():
"output/time_dependent_potential/narrow_sweep_interactions.txt",
]
outputs = [
"../latex/images/wide_sweep.pdf",
"../latex/images/narrow_sweep.pdf",
"../latex/images/narrow_sweep_interactions.pdf",
"../latex/images/particles_left_wide_sweep.pdf",
"../latex/images/particles_left_narrow_sweep.pdf",
"../latex/images/particles_left_narrow_sweep_interactions.pdf",
]
for file, output in zip(files, outputs):
with open(file) as f:

View File

@ -1,26 +1,32 @@
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set_theme()
params = {
"font.family": "Serif",
"font.serif": "Roman",
"text.usetex": True,
"axes.titlesize": "large",
"axes.labelsize": "large",
"xtick.labelsize": "large",
"ytick.labelsize": "large",
"legend.fontsize": "medium"
}
plt.rcParams.update(params)
def main():
directories = {
"output/simulate_2_particles/no_interaction/",
"output/simulate_2_particles/with_interaction/",
}
titles = {
"particles without interaction",
"particles with interaction"
}
files = [
"particle_0_r.txt",
"particle_0_v.txt",
"particle_1_r.txt",
"particle_1_v.txt",
"particle_0",
"particle_1",
]
labels = [
r"particle 1 r",
r"particle 1 v",
r"particle 2 r",
r"particle 2 v",
[r"$p_1$", r"$\hat{p}_1$"],
[r"$p_2$", r"$\hat{p}_2$"]
]
colors = [
"lightskyblue",
@ -28,25 +34,42 @@ def main():
"salmon",
"tomato",
]
fig1, axs1 = plt.subplots(2,1)
fig2, axs2 = plt.subplots(2,1)
for i, (dir, title) in enumerate(zip(directories, titles)):
for label, color, file in zip(labels, colors, files):
with open(dir+file) as f:
linestyles = [
"solid",
"dotted"
]
fig1, axs1 = plt.subplots(2,1,sharex=True)
fig2, axs2 = plt.subplots(2,1,sharex=True)
for i, (file, label) in enumerate(zip(files, labels)):
for j, (dir, linestyle) in enumerate(zip(directories, linestyles)):
r = []
v = []
with open(dir+file+"_r.txt") as f:
lines = f.readlines()
t = np.linspace(0, 50, len(lines))
r = np.array([list(map(float, line.strip().split(","))) for line in lines])
axs1[i].plot(t, r[:,0], label=label, color=color)
axs2[i].plot(t, r[:,2], label=label, color=color)
axs1[i].set(xlabel=r"t $(\mu s)$", ylabel = r"z $(\mu m)$")
with open(dir+file+"_v.txt") as f:
lines = f.readlines()
v = np.array([list(map(float, line.strip().split(","))) for line in lines])
axs1[i].plot(r[:,0], v[:,0], label=label[j])
axs2[i].plot(r[:,2], v[:,2], label=label[j])
axs1[i].axis("equal")
axs2[i].axis("equal")
axs1[i].legend()
axs1[i].set_title(title)
axs1[1].set(xlabel=r"t $(\mu s)$", ylabel = r"x $(\mu m)$")
axs1[0].set(ylabel = r"x $(\mu m)$")
axs2[1].set(xlabel=r"t $(\mu s)$", ylabel = r"z $(\mu m)$")
axs2[0].set(ylabel = r"z $(\mu m)$")
axs1[i].legend(loc="upper right")
# axs1[i].set_title(title)
axs2[i].legend(loc="upper right")
# axs2[i].set_title(title)
fig1.savefig("../latex/images/phase_space_2_particles_x.pdf", bbox_inches="tight")
fig2.savefig("../latex/images/phase_space_2_particles_z.pdf", bbox_inches="tight")
# plt.show()
fig1.savefig("../latex/images/phase_space_2_particles_x.pdf")
fig2.savefig("../latex/images/phase_space_2_particles_z.pdf")
if __name__ == "__main__":

View File

@ -1,5 +1,19 @@
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set_theme()
params = {
"font.family": "Serif",
"font.serif": "Roman",
"text.usetex": True,
"axes.titlesize": "large",
"axes.labelsize": "large",
"xtick.labelsize": "large",
"ytick.labelsize": "large",
"legend.fontsize": "medium"
}
plt.rcParams.update(params)
def main():
directories = [
@ -13,10 +27,10 @@ def main():
"32000_steps.txt",
]
labels = [
r"4000 steps",
r"8000 steps",
r"16000 steps",
r"32000 steps",
r"$n_1$",
r"$n_2$",
r"$n_3$",
r"$n_4$",
]
titles = [
"Relative error for the RK4 method",

View File

@ -1,5 +1,19 @@
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set_theme()
params = {
"font.family": "Serif",
"font.serif": "Roman",
"text.usetex": True,
"axes.titlesize": "large",
"axes.labelsize": "large",
"xtick.labelsize": "large",
"ytick.labelsize": "large",
"legend.fontsize": "medium"
}
plt.rcParams.update(params)
def z(t):
V_0 = 25.*9.64852558 * 10**4
@ -9,6 +23,14 @@ def z(t):
return 20.*np.cos(w_z*t)
def main():
colors = [
"lightskyblue",
"deepskyblue",
"salmon",
"tomato",
"mediumaquamarine",
"mediumseagreen"
]
filename = "output/simulate_single_particle/particle_0_r.txt"
r = t = []
with open(filename) as f:
@ -16,14 +38,17 @@ def main():
t = np.linspace(0, 50, len(lines))
r = np.array([list(map(float, line.strip().split(","))) for line in lines])
plt.plot(t, r[:, 2], label="approximation")
plt.plot(t, z(t), label="analytical")
plt.xlabel(r"time $(\mu s)$")
plt.ylabel(r"z $(\mu m)$")
plt.title(r"Movement of a single particle in the x direction")
plt.legend()
# plt.savefig("../latex/images/single_particle.pdf")
plt.show()
fig, ax = plt.subplots()
ax.plot(t, r[:, 2], label="approximation", color="mediumseagreen")
ax.plot(t, z(t), label="analytical", color="black", linestyle="dotted")
ax.set_xlabel(r"t $(\mu s)$")
ax.set_xlim((-5, 55))
ax.set_ylabel(r"z $(\mu m)$")
ax.set_ylim((-25, 25))
# plt.title(r"Movement of a single particle in the x direction")
ax.legend(loc="upper right")
fig.savefig("../latex/images/single_particle.pdf", bbox_inches="tight")
# plt.show()
if __name__ == "__main__":