You are here

PETSc for Partial Differential Equations: Numerical Solutions in C and Python

Ed Bueler
Publication Date: 
Number of Pages: 
Software Environments Tools
[Reviewed by
BIll Satzer
, on
Solving partial differential equations (PDEs) numerically has always been a challenging business. Practitioners of the art have used a variety of tools beginning with mechanical and electronic calculators and proceeding to the most advanced computers with the best available software. 
This book describes a tool for solving PDEs numerically by writing C and Python codes that call the Portable Extensible Toolkit for Scientific computation (PETSc). The author concentrates on PDE problems where large systems of algebraic equations – often nonlinear – arise from discretization. He looks at systems that are either solved once, to get a steady-state solution, or solved repeatedly for solutions with implicit time stepping.
The PETSc software is not new. Its development began in the 1990s, but it is getting more attention now with its increased sophistication and relative ease of use. PETSc is freely available. It is supported by Argonne National Laboratory and is still under active development. It has become a powerful tool with a very large application program interface (API). In essence PETSc is an open source mathematical software library capable of distributed-memory parallel computation on current supercomputers with thousands of cores, but which will also run on a standard laptop.
This book is not a manual for PETSc software. Instead it illustrates concepts using increasingly complex examples that introduce the algorithms and components of PETSc. To find this book useful the reader needs at least background with PDEs and some basic numerical mathematics, especially numerical linear algebra. Some programming skills are necessary too, particularly with the standard C language. (This includes experience writing and compiling C programs.) More experience in each of these areas would be very desirable.
The author assumes that a reader wants to solve linear and nonlinear PDEs. To accomplish this, he sets out a plan: first discretize the PDE problem, and then apply a class of numerical solvers to the resulting system of algebraic equations using preconditioned Newton- Krylov methods. This is not as restrictive as it might sound. It incorporates many ways to construct a near-optimal multigrid solver at the command line with runtime options when invoking PETSc. 
The examples of the first twelve chapters are key. They solve mostly elliptic and parabolic PDE problems, and are ordered by ease of introduction of algorithms and components of PETSc. The first example considers the Poisson equation on a square, and uses this to introduce the main aspects of the software. Subsequent examples consider reaction-diffusion equations, advection diffusion equations, the Stokes equation and several others. The examples share several features: every problem is nonlinear; numerical computations are designed to be parallel; choices of solvers are open and never hard-coded; and careful choices of preconditioners demonstrate a strong influence on performance. Scalability and performance are primary goals.
The book is intended for researchers and graduate students looking for a fast track introduction to PETSc programming. It emphasizes practice over theory and proves almost nothing, but it does not ignore theoretical issues. 


Bill Satzer (, now retired from 3M Company, spent most of his career as a mathematician working in industry on a variety of applications ranging from speech recognition and network modeling to optical films, material science and the odd bit of high performance computing. He did his PhD work in dynamical systems and celestial mechanics.