In December 2018, MPE CDT Cohort Charlie student Joe Wallwork returned from a four month internship at Argonne National Laboratory (ANL), just outside Chicago, USA.

At ANL, Joe worked in the Mathematics and Computer Science division, under the supervision of Prof. Paul Hovland and Dr. Hong Zhang, as part of the Portable, Extensible Toolkit for Scientific Computation (PETSc) project. PETSc is well-known in the scientific computing community for its linear and nonlinear solvers. More recently, PETSc has been extended to include its own time integration schemes and adjoint solver, to allow the solution of time dependent PDEs and optimisation problems. The core of Joe’s work involved applying automatic differentiation (AD) techniques to existing PETSc codes.

Many of the geophysical systems studied by MPE CDT students may be described by nonlinear PDEs, such as the nonlinear shallow water, Euler or Navier-Stokes equations. In order to obtain a numerical solution of a nonlinear PDE using a Newton-type method, the Jacobian must be either hand-coded, or approximated using a method such as finite differences. For some PDEs, deriving and coding this derivative matrix by hand can be work-intensive and error-prone and, if a high quality solution is required, then approximating the Jacobian may not be sufficient. AD enables the automatic generation of the same derivative matrices as would be obtained by a (correct!) hand derivation. This is done by interpreting the PDE residual as a composition of elementary operations (for example), such as additions, multiplications and exponentiations. Having made this interpretation, the chain rule of calculus may be applied in order to extract the required derivative information.

Whilst interning at ANL, Joe gave a hands-on tutorial on how to use the Firedrake finite element package, which has many developers at Imperial College, including MPE CDT’s David Ham and Thomas Gibson.