Add parameters for python script, edit method, and add result for problem 7.
This commit is contained in:
@@ -68,11 +68,15 @@ We get the Crank-Nicolson method (CN) when $\theta = 1/2$ gives Crank-Nicolson
|
||||
\end{align} %
|
||||
Using CN, we derive the discretized Schrödinger equation given by
|
||||
\begin{align*}
|
||||
& u_{\ivec, \jvec}^{n+1} - \frac{i \Delta t}{2 \Delta x^{2}} \big[ u_{\ivec+1, \jvec}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec-1, \jvec}^{n+1} \big] \\
|
||||
& - \frac{i \Delta t}{2 \Delta y^{2}} \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} \\
|
||||
&= 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} \numberthis \ .
|
||||
\label{eq:schrodinger_discretized}
|
||||
& 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} \\
|
||||
&= u_{\ivec, \jvec}^{n} + r \big[ u_{\ivec+1, \jvec}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec-1, \jvec}^{n} \big] \\
|
||||
& \quad + r \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} \numberthis \ ,
|
||||
\label{eq:schrodinger_discretized}
|
||||
\end{align*} %
|
||||
where $r$ is defined as
|
||||
\begin{align*}
|
||||
r \equiv \frac{i \Delta t}{2 \Delta h^{2}}
|
||||
\end{align*} %
|
||||
The full derivation of both Equation \eqref{eq:crank_nicolson_method} and Equation \eqref{eq:schrodinger_discretized}
|
||||
can be found in Appendix \ref{ap:crank_nicolson}.
|
||||
@@ -97,8 +101,20 @@ A, B are sparse csc matrix
|
||||
% & \bullet & \bullet & & & \bullet & & &
|
||||
% \end{pNiceArray}
|
||||
% \end{equation*}
|
||||
|
||||
\begin{equation*}
|
||||
We use Dirichlet boundary conditions, as given in Table \ref{tab:boundary_conditions},
|
||||
which allows us to express Equation \eqref{eq:schrodinger_discretized} as a matrix
|
||||
equation
|
||||
\begin{align}
|
||||
A u^{n+1} = B u^{n} \ .
|
||||
\end{align}
|
||||
Here, both $u^{n+1}$ and $u^{n}$ are column vectors containing the internal points
|
||||
of the $xy$ grid at time step $n+1$ and $n$, respectively. Since we have $M$ points
|
||||
in $x$- and $y$-direction, we have $M-2$ internal points. Both $u$ vectors have
|
||||
length $(M-2)^{2}$, and the matrices $A$ and $B$ have size $(M-2)^{2} \times (M-2)^{2}$.
|
||||
The matrices can be decomposed as submatrices of size $(M-2) \times (M-2)$, with
|
||||
the following pattern
|
||||
\begin{align*}
|
||||
A, B =
|
||||
\begin{bmatrix}
|
||||
\begin{matrix}
|
||||
\bullet & \bullet & \phantom{\bullet} \\
|
||||
@@ -154,7 +170,13 @@ A, B are sparse csc matrix
|
||||
\phantom{\bullet} & \bullet & \bullet
|
||||
\end{matrix}
|
||||
\end{bmatrix}
|
||||
\end{equation*}
|
||||
\end{align*}
|
||||
To fill the matrices $A$ and $B$, we used
|
||||
\begin{align*}
|
||||
a_{k} &= 1 + 4r + \frac{i \Delta t}{2} v_{\ivec, \jvec} \\
|
||||
b_{k} &= 1 - 4r - \frac{i \Delta t}{2} v_{\ivec, \jvec} \ .
|
||||
\end{align*}
|
||||
An example of filled matrices can be found in Appendix \ref{ap:matrix_structure}.
|
||||
|
||||
Notations:
|
||||
In addition, we use an equal step size in x- and y-direction, $h$ such that
|
||||
@@ -172,7 +194,7 @@ which gives a matrix $U^{n}$ that contains elements $u_{\ivec, \jvec}^{n}$, and
|
||||
a matrix $V$ that contains elements $v_{\ivec, \jvec}$.
|
||||
\begin{table}[H]
|
||||
\centering
|
||||
\begin{tabular}{l l l} % @{\extracolsep{\fill}}
|
||||
\begin{tabular}{l r} % @{\extracolsep{\fill}}
|
||||
\hline
|
||||
Position & Value \\
|
||||
\hline
|
||||
@@ -189,7 +211,7 @@ a matrix $V$ that contains elements $v_{\ivec, \jvec}$.
|
||||
For the general setup of the wall, we used
|
||||
\begin{table}[H]
|
||||
\centering
|
||||
\begin{tabular}{l l} % @{\extracolsep{\fill}}
|
||||
\begin{tabular}{l r} % @{\extracolsep{\fill}}
|
||||
\hline
|
||||
Parameter & Value \\
|
||||
\hline
|
||||
@@ -205,7 +227,7 @@ For the general setup of the wall, we used
|
||||
|
||||
\begin{table}[H]
|
||||
\centering
|
||||
\begin{tabular}{l l l} % @{\extracolsep{\fill}}
|
||||
\begin{tabular}{l r r} % @{\extracolsep{\fill}}
|
||||
\hline
|
||||
Simulation & $1$ & $2$ \\
|
||||
\hline
|
||||
|
||||
Reference in New Issue
Block a user