Skip to content

Commit

Permalink
Added assignment 4 and small bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tbetcke committed Dec 7, 2023
1 parent 0662b02 commit c6fb39d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
19 changes: 19 additions & 0 deletions hpc_lecture_notes/2023-assignment_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Assignment 4 - Time-dependent problems

This assignment makes up 30% of the overall marks for the course. The deadline for submitting this assignment is **5pm on 14 December 2023**.

Coursework is to be submitted using the link on Moodle. You should submit a single pdf file containing your code, the output when you run your code, and your answers
to any text questions included in the assessment. The easiest ways to create this file are:

- Write your code and answers in a Jupyter notebook, then select File -> Download as -> PDF via LaTeX (.pdf).
- Write your code and answers on Google Colab, then select File -> Print, and print it as a pdf.

Consider a square plate with sides $[−1, 1] × [−1, 1]$. At time t = 0 we are heating the plate up
such that the temperature is $u = 5$ on one side and $u = 0$ on the other sides. The temperature
evolves according to $u_t = \Delta u$. At what time $t^*$ does the plate reach $u = 1$ at the center of the plate?
Implement a finite difference scheme and try with explicit and implicit time-stepping. Numerically investigate the stability of your schemes.
By increasing the number of discretisation points demonstrate how many correct digits you can achieve. Also,
plot the convergence of your computed time $t^*$ against the actual time. To 12 digits the wanted
solution is $t^* = 0.424011387033$.

A GPU implementation of the explicit time-stepping scheme is not necessary but would be expected for a very high mark beyond 80%.
1 change: 1 addition & 0 deletions hpc_lecture_notes/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ parts:
- file: 2023-assignment_1
- file: 2023-assignment_2
- file: 2023-assignment_3
- file: 2023-assignment_4
# - file: 2022-assignment_4
#- caption: LSA
# chapters:
Expand Down
12 changes: 9 additions & 3 deletions hpc_lecture_notes/simple_time_stepping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,19 @@
"$$\n",
"\n",
"with $A\\in\\mathbb{R}^{n\\times n}$ diagonalizable. For any eigenpair $(\\lambda, \\hat{U})$ of $A$ satisfying $A\\hat{U} = \\lambda\\hat{U}$ the function $U(t) = e^{\\lambda t}\\hat{U}$ is a solution for this problem.\n",
"Therefore, for forward Euler to converge we require that\n",
"If the eigenvalues are real and negative we require for forward Euler to converge that\n",
"\n",
"$$\n",
"\\Delta t < \\frac{2}{|\\lambda_{max}(A)|},\n",
"$$\n",
"\n",
"where $\\lambda_{max}$ is the largest eigenvalue by magnitude.\n",
"where $\\lambda_{max}$ is the largest eigenvalue by magnitude. Note that if the eigenvalues are complex the condition becomes\n",
"\n",
"$$\n",
"\\Delta t < \\frac{2|\\text{Re}(\\lambda)|}{|\\lambda(A)|},\n",
"$$\n",
"\n",
"where $\\lambda$ is the eigenvalue with largest negative real part by magnitude.\n",
"\n",
"As example let us take a look at the problem\n",
"\n",
Expand Down Expand Up @@ -266,7 +272,7 @@
"\\end{align}\n",
"$$\n",
"\n",
"We now require that $|(1-\\alpha \\Delta t)^{-1}| < 1$. But for $\\alpha>0$ this is always true. Hence, the backward Euler method is unconditionally stable."
"We now require that $|(1-\\alpha \\Delta t)^{-1}| < 1$. But for $\\alpha<0$ this is always true. Hence, the backward Euler method is unconditionally stable."
]
},
{
Expand Down

0 comments on commit c6fb39d

Please sign in to comment.