Cours
Course — Numerical methods
Lecture notes on numerical methods: finite differences, finite elements, finite volumes…
Introduction
This course introduces the main numerical methods used to solve the partial differential equations (PDEs) arising in fluid mechanics and physics. It covers finite differences, finite elements and finite volumes.
These notes are a living document: they grow chapter by chapter.
1. Finite differences
The idea is to approximate derivatives by differences on a grid. For a function , the centered approximation of the second derivative reads:
Applied to the heat equation , this gives an explicit scheme:
stable under the condition .
import numpy as np
def heat_step(u, alpha, dx, dt):
lap = (np.roll(u, -1) - 2*u + np.roll(u, 1)) / dx**2
return u + alpha * dt * lap
2. Finite elements
The finite element method (FEM) starts from the weak formulation. For the Poisson problem on with on , we look for such that:
Discretizing over a basis of functions leads to the linear system , where is the stiffness matrix.
3. Comparing the methods
| Method | Complex geometries | Conservation | Implementation |
|---|---|---|---|
| Finite differences | ✗ | ✗ | Simple |
| Finite elements | ✓ | ~ | Advanced |
| Finite volumes | ✓ | ✓ | Medium |
Going further
Upcoming chapters will cover finite volumes, spectral methods and schemes for multiphase flows. (coming soon)