This repository contains the content and codes of the great open-source ebook "Introduction to Numerical Methods for Variational Problems", written by H.P. Langtangen and K.A. Mardal (appropriate permissions already granted). The original description and repository can be found here and here. This is, by far, the best book I've seen for learning the concepts of finite element formulation, suitable for students/researchers without a strong background in mathematics and numerical methods. Unfortunately, the ebook is not fully finished as the main author passed away (you don't notice this when you read the book, but a closer look reveals unfinished communications of authors on the topics).
As the book is open-source, I converted it to a set of easy-to-follow Jupyter notebooks. I did this using the tool Prof. Langtangen had developed for scientific writing: doconce (document once, include anywhere). Additionally, all the codes, including the accompanying codes for exercises, are ported to Python 3.
The text you find here is not exactly what presented in the book. I have removed about 20% of the content I found very mathematical or complicated to follow. I did this based on my PhD experience, which involved me in spending lots of time doing variational formulation and computational modeling using the finite element method in FreeFEM and FEniCS. Deriving the variational formulation of partial differential equations is the primary step for using such languages and libraries. From this perspective, I removed the irrelevant parts, so the reader can focus only on the content related to finite element modeling of partial differential equations. I have also added several FreeFEM tutorial codes to demonstrate real-world application/implementation of the topics of each chapter.
Here is my selected topics of the book, presented in Jupyter notebook format:
-
3- Function approximation by finite elements
FreeFEM tutorial - function approximation -
5- Variational formulations with finite elements
FreeFEM tutorial - variational formulation and solution of Poisson equation -
6- Time-dependent variational forms
FreeFEM tutorial - time dependent diffusion equation with variable diffusion coefficient -
7- Variational forms for systems of PDEs
FreeFEM tutorial - Stokes equations for lid cavity problem -
8- Dealing with nonlinearity
FreeFEM tutorial - Picard method for nonlinear Poisson equation
FreeFEM tutorial - Picard-relaxation for nonlinear Poisson equation
FreeFEM tutorial - Newton method for nonlinear Poisson equation -
9- Iterative solvers and preconditioning
FreeFEM tutorial - high-performance solution of Poisson equation using PETSc
You may decide to clone the repository and explore the notebooks and codes offline (recommended) or view the content online using nbviwer (links above).