Preface
Preliminaries
The FEniCS Project
What you will learn
Working with this tutorial
Obtaining the software
Installation using Docker containers
Installation using Ubuntu packages
Testing your installation
Obtaining the tutorial examples
Background knowledge
Programming in Python
The finite element method
Fundamentals: Solving the Poisson equation
Mathematical problem formulation
Finite element variational formulation
Abstract finite element variational formulation
Choosing a test problem
FEniCS implementation
The complete program
Running the program
Dissection of the program
The important first line
Generating simple meshes
Defining the finite element function space
Defining the trial and test functions
Defining the boundary conditions
Defining the source term
Defining the variational problem
Forming and solving the linear system
Plotting the solution using the plot
command
Plotting the solution using ParaView
Computing the error
Examining degrees of freedom and vertex values
Deflection of a membrane
Scaling the equation
Defining the mesh
Defining the load
Defining the variational problem
Plotting the solution
Making curve plots through the domain
A Gallery of finite element solvers
The heat equation
PDE problem
Variational formulation
FEniCS implementation
A nonlinear Poisson equation
PDE problem
Variational formulation
FEniCS implementation
The equations of linear elasticity
PDE problem
Variational formulation
FEniCS implementation
The Navier–Stokes equations
PDE problem
Variational formulation
FEniCS implementation
A system of advection–diffusion–reaction equations
PDE problem
Variational formulation
FEniCS implementation
Subdomains and boundary conditions
Combining Dirichlet and Neumann conditions
PDE problem
Variational formulation
FEniCS implementation
Setting multiple Dirichlet conditions
Defining subdomains for different materials
Using expressions to define subdomains
Using mesh functions to define subdomains
Using C++ code snippets to define subdomains
Setting multiple Dirichlet, Neumann, and Robin conditions
Three types of boundary conditions
PDE problem
Variational formulation
FEniCS implementation
Test problem
Debugging boundary conditions
Generating meshes with subdomains
PDE problem
Variational formulation
FEniCS implementation
Extensions: Improving the Poisson solver
Refactoring the Poisson solver
A more general solver function
Writing the solver as a Python module
Verification and unit tests
Parameterizing the number of space dimensions
Working with linear solvers
Choosing a linear solver and preconditioner
Choosing a linear algebra backend
Setting solver parameters
An extended solver function
A remark regarding unit tests
List of linear solver methods and preconditioners
High-level and low-level solver interfaces
Linear variational problem and solver objects
Explicit assembly and solve
Examining matrix and vector values
Degrees of freedom and function evaluation
Examining the degrees of freedom
Setting the degrees of freedom
Function evaluation
Postprocessing computations
Test problem
Flux computations
Computing functionals
Computing convergence rates
Taking advantage of structured mesh data
Taking the next step
Bibliography