# Summer term 2020

## Lecture “Numerical Methods for PDEs – Galerkin Methods”

### Course Content

In this course I will give an introduction to the  finite element Method (FEM). The FEM is – in contrast to, e.g., finite difference methods – based on the variational form a PDE and approximates the solution (which lives in an infinite dimensional space) in finite dimensional subspaces of the infinite-dimensional solution space (this makes it a Galerkin method). The approximation space is spanned by a suitable basis constructed on a decomposition of the domain into simple building blocks (finite elements) such as triangles. This makes the method accessible by methods from functional analysis and approximation theory.

FEM theory is rich of both theory and (real world) applications and I will have to make a compromise between the two here. I thought about the following topics (but may change it during the course):

1. Introduction to ideas of FEM using a classical mathematical toy example (Laplace equation)
2. Recapturing basic notions for elliptic PDEs (integration by parts, Sobolev spaces, variational form, Lax-Milgram, etc)
3. General insights for Galerkin Methods
4. Common finite elements
5. Some Approximation theorems and error estimates for elliptic problems
6. Practical aspects:
• Implementation aspects (How could you do it and how shouldn’t you? Ingredients and tools.)
• Practical implementation of a model problem (either in C++ or Python, we will see)
• Applications (probably focusing on linear elasticity)
7.  If time permits we will either talk about Petrov-Galerkin methods, saddle-point problems or more exotic finite elements  (Nedelec, Raviart-Thomas, Brezzi-Douglas-Marini, PEERS, …) for systems of PDEs such as Maxwell, flow or mechanical applications

### Prerequisites

• Integration and calculus in n dimensions (necessary)
• Basic programming skills and Linux (I recommend Ubuntu since it is easy for beginners, Mac is also possible, or Linux subsystem for windows)
• Basic understanding of PDEs (advantageous)
• Basics in functional analysis (advantageous)

### Dates/Organization

The course will start in the week on July 8th after the Pentecost break.

I will give material as reading assignments supported by video lectures that you will find here. These will be uploaded twice a week, mostly Tuesdays and Fridays.

Once a week we will have an interactive session in which I will answer questions, talk about homework or show you how to deal with coding.

You also have a forum where you can freely exchange ideas for homework, questions and other stuff. The forum is only visible for course members as is the rest of the course incl. its material. (Also: I am sure I do not need to tell you but please adhere to the rules of a respectful and friendly communication in the forum.)

The lectures will be accompanied by homeworks that contain theory and practical tasks (programming in either Python 3 or C++, see below for instructions). Each student is required to hand in at least three homework sheets (with reasonable tries of the exercises…) to be able to take an (oral) exam at the end of the course. The homeworks will not be relevant to the final grade of the course.

### Literature

• Brenner, S., & Scott, R., 2007. The mathematical theory of finite element methods (Vol. 15). Springer Science & Business Media.
• Braess, D., 2007. Finite elements: Theory, fast solvers, and applications in solid mechanics. Cambridge University Press.
• Ern, A. and Guermond, J.L., 2013. Theory and practice of finite elements (Vol. 159). Springer Science & Business Media.
• Girault, V. and Raviart, P.A., 2012. Finite element methods for Navier-Stokes equations: theory and algorithms (Vol. 5). Springer Science & Business Media.
I can provide only parts of the books and send them as PDFs if you wish. Some may be available through the library system of the university as PDF (you need to be either on campus or logged in through a VPN).

### Exercises

• Exercises are not part of the overall grade
• You are required to submit at least three sheets with reasonable tries
• You can (but do not need to) submit in groups of maximum 3 people

### Exams

Oral exams for the Mathmods students will be on the 23rd of July. Another date will be in the end of August.

Regular TU/UHH students please turn to me by email.

About some things that I deem important to know and that I possibly ask:
• One or two examples of PDEs (but for sure the standard models of PDEs that we talked about… so Poisson and general elliptic problems)
• How do we derive the variational form of a PDE? (Maybe with a simple example such as Poisson or so…)
• Why do we work in Sobolev spaces and not in spaces of (classically) differentiable functions? There was an example in Chapter 2…
• Functional analysis: What are Hilbert spaces? Projections, Riesz representation, symmetric and nonsymmetric variational forms, Well-posedness in both cases (application of Riesz vs. Lax-Milgram), Abstract error estimates (Galerkin orthogonality, Cea Lemma)
• weak derivatives; definition of gradient, divergence, curl and Laplace operator; Sobolev spaces
• Gauss theorem; integration by parts formulae (see also exercises); transformation formulae
• What is a finite element?
• Examples of finite elements
• Interpolation in Sobolev spaces
• Error estimates for the model problem in H1 and L^2 for Lagrange FEMs
General hint: learn the definitions and the imortant theorems, try to understand the story line and not every detail of the proofs (if you do understand it is of course great but the focus is on results and ideas)

### Software (Linux only)

We will – as should be customary in applied math – compute some simple finite element solutions. But even simple (but not too simple) finite element codes are complex and it takes a long time until one can compute and test interesting sets of examples. Therefore, while you can of course implement your own FEM code it is likely to take time. Hence, I will give guidance of how to use two FEM programming tool boxes that are great for learning and even larger computations (since complicated details in the implementations are hidden and optimized by experts).

Suitable (but not the only) choices are either the Python framework Firedrake or the C++ framework Deal.ii. Both have an excellent documentation but for beginners not familiar with C++ I recommend Firedrake (but I do not want to discourage you from ignoring my advice).

Both are written for the Linux operating system and work well with Ubuntu 20.04. Fortunately, this is easy to install – and even usable in Windows 10 through the Windows Subsystem for Linux (WSL).  Hence you have two options:
1. either you already have a Linux system and everything is fine or
2. you install it – I recommend Ubuntu 20.04 – parallel to windows or as a virtual machine (slow) or
3. you have a Windows 10 system and then you can use Ubuntu 20.04 through the Windows Subsystem for Linux (instructions below)

### Installation of Windows Subsystem for Linux (Mandatory if you have Windows 10)

The Windows Subsystem for Linux (WSL) is a so-called compatibility layer that allows to run native Linux applications under Windows 10. It can easiliy be installed and used to run even graphical applications as follows

1. Open a Windows PowerShell as Admin from the Start-menu: For this, locate the Windows PowerShell in your Start menu (`Start` -> `Windows PowerShell`), right click on `Windows PowerShell` -> `More` -> `Run as administrator`
2. Install the subsystem by using the command
`Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux`
3. You may need to restart your computer.
4. Open the Microsoft Store to install the app: Ubuntu 20.04 LTS
5. Start the app Ubuntu 20.04 LTS
6. Refresh the software repositories and upgrade with the commands (sudo means “run as administrator”)
`sudo apt update`
`[...]`
`sudo apt upgrade`
```[...]
Do you want to continue? [Y/n] <Enter>
[...]```
7. The WSL is now installed.
8. Let us install a number of useful tools:
```sudo apt install gcc g++ gfortran xterm gnuplot curl ssh libgtk-3-0 zip unzip rsync git-core doxygen graphviz build-essential gdb cmake ninja-build gdb clang clang-format
[...]
Do you want to continue? [Y/n] <Enter>
[...]```

### Installing an X-Server on WSL (recommended)

In order to run graphical applications from within the Linux Subsystem a so-called X-server has to be installed. This step is in particular necessary, if you plan to install IDEs such as Eclipse, or if you want any graphical output from Python.

2. Start XMing. A stylish X should appear in the task bar.

3. Open a Linux terminal and try to run xterm:

4. Run these three commands
`cd \$HOMEecho "export DISPLAY=:0" >> .bashrcsource .bashrc`
5. The last command added a line to the file .bashrc which resides in your home directory. It is being read everytime you start a bash terminal

6. Try if the X-server works with the command
`xterm &`
Another terminal window should open. If so: good. Simply close it again.
7. Remember to start XMing from Windows every time you want to use the WSL

### Installing Deal.ii under Ubuntu 20.04 (incl. WSL)

To install deal.ii from the repositories (v9.1.1 is only available in Ubuntu 20.04) run

```apt install libdeal.ii-dev libdeal.ii-doc
[... long list ...]
0 upgraded, 443 newly installed, 0 to remove and 0 not upgraded.
Need to get 441 MB of archives.
After this operation, 2,016 MB of additional disk space will be used.
Do you want to continue? [Y/n] <Enter>
[...]```

To test the installation with examples from the lecture follow these instructions.

If you want to use an IDE (maybe even from within WSL) such as Eclipse you may need to install a JRE (Java runtime environment):

`sudo apt install default-jdk`

To install Eclipse check the homepage, download and install in some folder.

### Installing Firedrake on Linux (incl. WSL)

1. We first need to install Python 3 and some packages:
``sudo apt install python3 python3-matplotlib python3-scipy python3-numpy``
2.  These commands will install Firedrake in a virtual environment. This does not mess with your system. Note that the installation might take quite some time (2 hours on my old machine). (Compare also to the installation instructions of Firedrake.):
`cd \$HOMEcurl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install`
``python3 firedrake-install --minimal-petsc``
3. Before running any code that uses Firedrake you need to activate the virtual environment with
`source firedrake/bin/activate`
4. To test the installation with the demo of the lecture follow these instructions.

## Seminar “Finite Element Exterior Calculus”

This seminar is organized jointly with Jörn Behrens.

The seminar will be postponed and is planned to be given in a block format by the end of the semester.