Report ready for proofreading and review.

This commit is contained in:
Janita Willumsen 2024-01-01 15:34:19 +01:00
parent 857fb86301
commit 58806b28db
6 changed files with 75 additions and 37 deletions

Binary file not shown.

View File

@ -102,7 +102,7 @@
\subfile{sections/results} \subfile{sections/results}
% Conclusion % Conclusion
% \subfile{sections/conclusion} \subfile{sections/conclusion}
% Notes % Notes
% \subfile{draft} % \subfile{draft}

View File

@ -3,7 +3,8 @@
\begin{document} \begin{document}
\appendix \appendix
\section{The Crank-Nicholson method}\label{ap:crank_nicolson} \section{The Crank-Nicholson method}\label{ap:crank_nicolson}
The Crank-Nicolson (CN) approach consider both the forward difference, an explicit scheme, The Crank-Nicolson (CN) approach consider both the forward difference, an explicit
scheme,
\begin{equation*} \begin{equation*}
\frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} = F_{\ivec, \jvec}^{n} \ , \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} = F_{\ivec, \jvec}^{n} \ ,
\end{equation*} \end{equation*}
@ -20,9 +21,11 @@ The parameter $\theta$ is introduced for a general approach, however, for CN $\t
\frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} &= \frac{1}{2} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \\ \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} &= \frac{1}{2} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \\
\end{align*} \end{align*}
We need the first derivative in respect to both time and position, as well as the second derivative in respect to position. Taylor expanding will result in a discretized version, assume this is known... We need the first derivative in respect to both time and position, as well as the
second derivative in respect to position. Taylor expanding will result in a discretized
version.
Schrödinger contain $i$ at the lhs, factor it as The Schrödinger equation contains $i$ on the left hand side, we rewrite it as
\begin{align*} \begin{align*}
\frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} &= \frac{1}{2i} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \\ \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} &= \frac{1}{2i} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \\
&= -\frac{i}{2} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \ , &= -\frac{i}{2} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \ ,
@ -44,8 +47,7 @@ the left hand side, and the terms containing $n$ time step on the right hand sid
&= u_{\ivec, \jvec}^{n} + \frac{i \Delta t}{2 \Delta x^{2}} \big[ u_{\ivec+1, \jvec}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec-1, \jvec}^{n} \big] \\ &= u_{\ivec, \jvec}^{n} + \frac{i \Delta t}{2 \Delta x^{2}} \big[ u_{\ivec+1, \jvec}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec-1, \jvec}^{n} \big] \\
& \quad + \frac{i \Delta t}{2 \Delta y^{2}} \big[ u_{\ivec, \jvec+1}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec, \jvec-1}^{n} \big] - \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n} & \quad + \frac{i \Delta t}{2 \Delta y^{2}} \big[ u_{\ivec, \jvec+1}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec, \jvec-1}^{n} \big] - \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n}
\end{align*} \end{align*}
In addition, since we will use an equal step size $h$ in both $x$ and $y$ direction, Since we will use an equal step size $h$ in both $x$ and $y$ direction, we can use
we can use
\begin{align*} \begin{align*}
\frac{i \Delta t}{2 \Delta h^{2}} = \frac{i \Delta t}{2 \Delta x^{2}} = \frac{i \Delta t}{2 \Delta y^{2}} \ , \frac{i \Delta t}{2 \Delta h^{2}} = \frac{i \Delta t}{2 \Delta x^{2}} = \frac{i \Delta t}{2 \Delta y^{2}} \ ,
\end{align*} \end{align*}
@ -53,7 +55,7 @@ and define
\begin{align*} \begin{align*}
r \equiv \frac{i \Delta t}{2 \Delta h^{2}} r \equiv \frac{i \Delta t}{2 \Delta h^{2}}
\end{align*} \end{align*}
Now, the discretized Schrödinger equation can be written as Now, the discretized Schrödinger equation can be rewritten as
\begin{align*} \begin{align*}
& u_{\ivec, \jvec}^{n+1} - r \big[ u_{\ivec+1, \jvec}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec-1, \jvec}^{n+1} \big] \\ & u_{\ivec, \jvec}^{n+1} - r \big[ u_{\ivec+1, \jvec}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec-1, \jvec}^{n+1} \big] \\
& - r \big[ u_{\ivec, \jvec+1}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec, \jvec-1}^{n+1} \big] + \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n+1} \\ & - r \big[ u_{\ivec, \jvec+1}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec, \jvec-1}^{n+1} \big] + \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n+1} \\
@ -97,6 +99,8 @@ $(M-2)^{2} \times (M-2)^{2} = 9 \times 9$ given by
\section{Figures}\label{ap:figures} \section{Figures}\label{ap:figures}
We created colormap plots of the real and imaginary part of $u_{\ivec, \jvec}$,
in Figure \ref{fig:colormap_real_imag}.
\begin{figure*} \begin{figure*}
\centering \centering
\begin{subfigure}[b]{0.3\textwidth} \begin{subfigure}[b]{0.3\textwidth}
@ -119,9 +123,7 @@ $(M-2)^{2} \times (M-2)^{2} = 9 \times 9$ given by
\caption{Re$(u_{\ivec, \jvec})$ at time $t=0.002$.} \caption{Re$(u_{\ivec, \jvec})$ at time $t=0.002$.}
\label{fig:colormap_2_real} \label{fig:colormap_2_real}
\end{subfigure} \end{subfigure}
\newline \newline
\begin{subfigure}[b]{0.3\textwidth} \begin{subfigure}[b]{0.3\textwidth}
\centering \centering
\includegraphics[width=\textwidth]{images/color_map_0_imag.pdf} \includegraphics[width=\textwidth]{images/color_map_0_imag.pdf}
@ -142,7 +144,17 @@ $(M-2)^{2} \times (M-2)^{2} = 9 \times 9$ given by
\caption{Im$(u_{\ivec, \jvec})$ at time $t=0.002$.} \caption{Im$(u_{\ivec, \jvec})$ at time $t=0.002$.}
\label{fig:colormap_2_imag} \label{fig:colormap_2_imag}
\end{subfigure} \end{subfigure}
\caption{The time evolution of the probability function $p_{\ivec, \jvec}^{n}$.} \caption{The time evolution of Re($u_{\ivec, \jvec}$) and Im($u_{\ivec, \jvec}$),
\label{fig:colormap} for time steps $t=[0, 0.001, 0.002]$.}
\label{fig:colormap_real_imag}
\end{figure*} \end{figure*}
% \begin{figure*}
% \centering
% \includegraphics[width=0.9\textwidth]{images/color_map_all.pdf}
% \caption{The time evolution of the probability function $p_{\ivec, \jvec}^{n}$ (top row),
% Re($u_{\ivec, \jvec}^{n}$) (middle row), and Im($u_{\ivec, \jvec}^{n}$) (bottom row).
% Time step $t=0$ in the left column, $t=0.001$ in the middle column, and $t=0.002$
% in the right column.}
% \label{fig:colormap_all}
% \end{figure*}
\end{document} \end{document}

View File

@ -273,8 +273,8 @@ and for the simulations, we used the parameter settings in Table \ref{tab:sim_se
To check if the total probability is conserved over time, and that the implementation To check if the total probability is conserved over time, and that the implementation
was correct, we computed the deviation from $1.0$ given by was correct, we computed the deviation from $1.0$ given by
\begin{align*} \begin{align*}
s^{n} &= |\sum_{\ivec , \jvec} p_{\ivec , \jvec}^{n} - 1| \\ s^{n} &= |1.0 - \sum_{\ivec , \jvec} p_{\ivec , \jvec}^{n}| \\
&= |\sum_{\ivec , \jvec} u_{\ivec , \jvec}^{n*} u_{\ivec , \jvec}^{n} - 1| \ . &= |1.0 - \sum_{\ivec , \jvec} u_{\ivec , \jvec}^{n*} u_{\ivec , \jvec}^{n}| \ .
\end{align*} \end{align*}
\subsection{Tools}\label{ssec:tools} % \subsection{Tools}\label{ssec:tools} %

View File

@ -74,6 +74,20 @@ areas at both sides of the barries. Some of the probability function is reflecte
by the barrier, while the the rest spread out after passing the barrier. This is by the barrier, while the the rest spread out after passing the barrier. This is
a consequence of the wave-particle duality. a consequence of the wave-particle duality.
To compare the probability function $p_{\ivec, \jvec}$ for all the time steps in
a colormap plot, with the real and imaginary part of $u_{\ivec, \jvec}$, we created
Figure \ref{fig:colormap_all}. Where we excluded all x- and y-ticks, and labels, to
better visualize the diffraction pattern.
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/color_map_all.pdf}
\caption{The time evolution of the probability function $p_{\ivec, \jvec}^{n}$ (top row),
Re($u_{\ivec, \jvec}$) (middle row), and Im($u_{\ivec, \jvec}$) (bottom row).
Time step $t=0$ in the left column, $t=0.001$ in the middle column, and $t=0.002$
in the right column.}
\label{fig:colormap_all}
\end{figure}
\subsection{Particle detection}\label{ssec:particle_detection} \subsection{Particle detection}\label{ssec:particle_detection}
% Problem 9: Plot detection probability for single-, double- and triple-slit % Problem 9: Plot detection probability for single-, double- and triple-slit

View File

@ -9,17 +9,23 @@ params = {
"font.family": "Serif", "font.family": "Serif",
"font.serif": "Roman", "font.serif": "Roman",
"text.usetex": True, "text.usetex": True,
"axes.titlesize": "large", "xtick.bottom": False,
"axes.labelsize": "large", "xtick.labelbottom": False,
"xtick.labelsize": "large", "ytick.left": False,
"ytick.labelsize": "large", "ytick.labelleft": False,
"legend.fontsize": "medium", "axes.grid": False,
# "figure.autolayout": True
# "figure.constrained_layout.use": False,
# "figure.constrained_layout.h_pad": 0.04167,
# "figure.constrained_layout.w_pad": 0.04167
# "figure.subplot.wspace": 0,
# "figure.subplot.hspace": 0
} }
plt.rcParams.update(params) plt.rcParams.update(params)
def plot(): def plot():
fig, axes = plt.subplots(nrows=3, ncols=3) fig, axes = plt.subplots(figsize=(6,6), nrows=3, ncols=3)
with open("data/color_map.txt") as f: with open("data/color_map.txt") as f:
lines = f.readlines() lines = f.readlines()
size = int(lines[0]) size = int(lines[0])
@ -35,39 +41,45 @@ def plot():
arr = arr.reshape(size, size).T arr = arr.reshape(size, size).T
# Plot color maps # Plot color maps
color_map1 = axes[i,0].imshow( color_map1 = axes[0, i].imshow(
np.multiply(arr, arr.conj()).real, np.multiply(arr, arr.conj()).real,
interpolation="nearest", interpolation="nearest",
cmap=sns.color_palette("mako", as_cmap=True) cmap=sns.color_palette("mako", as_cmap=True)
) )
color_map2 = axes[i,1].imshow( color_map2 = axes[1, i].imshow(
arr.real, arr.real,
interpolation="nearest", interpolation="nearest",
cmap=sns.color_palette("mako", as_cmap=True) cmap=sns.color_palette("mako", as_cmap=True)
) )
color_map3 = axes[i,2].imshow( color_map3 = axes[2, i].imshow(
arr.imag, arr.imag,
interpolation="nearest", interpolation="nearest",
cmap=sns.color_palette("mako", as_cmap=True) cmap=sns.color_palette("mako", as_cmap=True)
) )
# Create color bar # Create color bar
fig.colorbar(color_map1, ax=axes) fig.subplots_adjust(wspace=0, hspace=0)
# fig2.colorbar(color_map2, ax=ax2) # fig.colorbar(color_map1, ax=axes[0, 2])
# fig3.colorbar(color_map3, ax=ax3) # fig.colorbar(color_map2, ax=axes[1, 2])
# fig.colorbar(color_map3, ax=axes[2, 2])
# # Remove grids # Remove grids
axes.grid(False) # for i in range(3):
# ax2.grid(False) # axes[i, 0].set_xticks([])
# ax3.grid(False) # axes[i, 0].set_yticks([])
# axes[i, 0].
# axes[i, 1].set_xticks([])
# axes[i, 1].set_yticks([])
# axes[i, 2].set_xticks([])
# axes[i, 2].set_yticks([])
# # Set custom ticks
# ax1.set_xticks(ticks) # axes[0].set_xticks([])
# ax1.set_yticks(ticks) # axes[0].set_yticks([])
# ax2.set_xticks(ticks) # axes[1].set_xticks([])
# ax2.set_yticks(ticks) # axes[].set_yticks([])
# ax3.set_xticks(ticks) # axes[].set_xticks([])
# ax3.set_yticks(ticks) # axes[].set_yticks([])
# # Set labels # # Set labels
# ax1.set_xlabel("x-axis") # ax1.set_xlabel("x-axis")
@ -78,7 +90,7 @@ def plot():
# ax3.set_ylabel("y-axis") # ax3.set_ylabel("y-axis")
# # Save the figures # # Save the figures
fig.savefig(f"latex/images/color_map_all.pdf", bbox_inches="tight") plt.savefig(f"latex/images/color_map_all.pdf", bbox_inches="tight")
# fig2.savefig(f"latex/images/color_map_{i}_real.pdf", bbox_inches="tight") # fig2.savefig(f"latex/images/color_map_{i}_real.pdf", bbox_inches="tight")
# fig3.savefig(f"latex/images/color_map_{i}_imag.pdf", bbox_inches="tight") # fig3.savefig(f"latex/images/color_map_{i}_imag.pdf", bbox_inches="tight")