$$ \newcommand{\half}{\frac{1}{2}} \newcommand{\tp}{\thinspace .} \newcommand{\uex}{{u_{\small\mbox{e}}}} \newcommand{\Aex}{{A_{\small\mbox{e}}}} \newcommand{\E}[1]{\hbox{E}\lbrack #1 \rbrack} \newcommand{\Var}[1]{\hbox{Var}\lbrack #1 \rbrack} \newcommand{\normalvec}{\boldsymbol{n}} \newcommand{\Oof}[1]{\mathcal{O}(#1)} \newcommand{\x}{\boldsymbol{x}} \renewcommand{\u}{\boldsymbol{u}} \renewcommand{\v}{\boldsymbol{v}} \newcommand{\f}{\boldsymbol{f}} \newcommand{\q}{\boldsymbol{q}} \newcommand{\g}{\boldsymbol{g}} \newcommand{\dfc}{\alpha} % diffusion coefficient \newcommand{\ii}{\boldsymbol{i}} \newcommand{\jj}{\boldsymbol{j}} \newcommand{\kk}{\boldsymbol{k}} \newcommand{\dx}{\, \mathrm{d}x} \newcommand{\ds}{\, \mathrm{d}s} $$

Finite difference methods for diffusion processes

Hans Petter Langtangen [1, 2]
Svein Linge [3, 1]

[1] Center for Biomedical Computing, Simula Research Laboratory
[2] Department of Informatics, University of Oslo
[3] Department of Process, Energy and Environmental Technology, University College of Southeast Norway

Jul 14, 2016


Note: PRELIMINARY VERSION

Table of contents

An explicit method for the 1D diffusion equation
      The initial-boundary value problem for 1D diffusion
      Forward Euler scheme
      Implementation
      Verification
      Numerical experiments
Implicit methods for the 1D diffusion equation
      Backward Euler scheme
      Sparse matrix implementation
      Crank-Nicolson scheme
      The unifying \( \theta \) rule
      Experiments
      The Laplace and Poisson equation
Analysis of schemes for the diffusion equation
      Properties of the solution
      Analysis of discrete equations
      Analysis of the finite difference schemes
      Analysis of the Forward Euler scheme
      Analysis of the Backward Euler scheme
      Analysis of the Crank-Nicolson scheme
      Analysis of the Leapfrog scheme
      Summary of accuracy of amplification factors
      Analysis of the 2D diffusion equation
      Explanation of numerical artifacts
Exercises
      Exercise 1: Explore symmetry in a 1D problem
      Exercise 2: Investigate approximation errors from a \( u_x=0 \) boundary condition
      Exercise 3: Experiment with open boundary conditions in 1D
      Exercise 4: Simulate a diffused Gaussian peak in 2D/3D
      Exercise 5: Examine stability of a diffusion model with a source term
Diffusion in heterogeneous media
      Discretization
      Implementation
      Stationary solution
      Piecewise constant medium
      Implementation of diffusion in a piecewise constant medium
      Axi-symmetric diffusion
      Spherically-symmetric diffusion
Diffusion in 2D
      Discretization
      Numbering of mesh points versus equations and unknowns
      Algorithm for setting up the coefficient matrix
      Implementation with a dense coefficient matrix
      Verification: exact numerical solution
      Verification: convergence rates
      Implementation with a sparse coefficient matrix
      The Jacobi iterative method
      Implementation of the Jacobi method
      Test problem: diffusion of a sine hill
      The relaxed Jacobi method and its relation to the Forward Euler method
      The Gauss-Seidel and SOR methods
      Scalar implementation of the SOR method
      Vectorized implementation of the SOR method
      Direct versus iterative methods
      The Conjugate gradient method
      What is the recommended method for solving linear systems?
Random walk
      Random walk in 1D
      Statistical considerations
      Playing around with some code
      Equivalence with diffusion
      Implementation of multiple walks
      Demonstration of multiple walks
      Ascii visualization of 1D random walk
      Random walk as a stochastic equation
      Random walk in 2D
      Random walk in any number of space dimensions
      Multiple random walks in any number of space dimensions
Applications
      Diffusion of a substance
      Heat conduction
      Porous media flow
      Potential fluid flow
      Streamlines for 2D fluid flow
      The potential of an electric field
      Development of flow between two flat plates
      Flow in a straight tube
      Tribology: thin film fluid flow
      Propagation of electrical signals in the brain
Exercises
      Exercise 6: Stabilizing the Crank-Nicolson method by Rannacher time stepping
      Project 7: Energy estimates for diffusion problems
      Exercise 8: Splitting methods and preconditioning
      Problem 9: Oscillating surface temperature of the earth
      Problem 10: Oscillating and pulsating flow in tubes
      Problem 11: Scaling a welding problem
      Exercise 12: Implement a Forward Euler scheme for axi-symmetric diffusion
Bibliography

© 2016, Hans Petter Langtangen, Svein Linge. Released under CC Attribution 4.0 license