Imperial College London


Faculty of Natural SciencesDepartment of Mathematics

Reader in Computational Mathematics



+44 (0)20 7594 5003david.ham Website CV




753Huxley BuildingSouth Kensington Campus




Research areas

FIREDRAKE: performance portable Automated code generation for simulation sofware


The current revolution in hardware towards multi-core and many-core platforms presents a huge challenge to the scientific computing community. To make effective use of emerging architectures,the low level implementation of scientific code must change. However regularly rewriting sophisticated numerical software for new platforms using conventional software development is infeasible: many scientific codes take millions of pounds and many years to perfect. Instead, in collaboration with Prof. Paul Kelly, I am leading a large project on the automatic generation of scientific models for multiple different massively parallel architectures from a single high-level mathematical specification in a domain specific language.

By generating rather than hand-writing the finite element code, the application of finite element as an abstraction breaking the link between discretisation and implementation becomes much more complete. A finite element-specific programming language provides an ideal abstraction above which numerics for computational science and engineering can be developed essentially independent of their implementation and below which compiler technology, scheduling algorithms and different approaches to concurrency can be applied . The initial results of this research indicate that we can successfully exploit both conventional CPU architectures and GPUs from the same high-level source. 

Dolfin-adjoint: automatic adjoints for finite element simulations

Inverse problems are pervasive across science and engineering, from data assimilation in weather forecasting to product design based on external constraints. However, simulation software capable of solving the inverse problem is rare in many application fields. This is the result of two mathematical software challenges: the need to differentiate the operators of the primary model and the need to record theactions and data of the primary model so that these can be unwound in the adjoint model, which runs backwards in time.

Dolfin-adjoint auotmatically generates highly efficient adjoint and tangent-linear models to finite element simulations written in the dolfin problem solving environment. The key difference between dolfin-adjoint and conventional algorithmic (automatic) differentiation is that the conventional approach operates on the model source code at a primitive operation level. In contrast, dolfin-ajoint differentiates and adjoins the model based on its high-level mathematical structure. This is a much more simple and robust process. This is a seminal example of the use of the right mathematical abstraction to design software which makes a previously intractable problem tractable. The dolfin-adjoint paper has been accepted for publication in the SIAM Journal on Scientific Computing.

Gung Ho: the next UK Met Office dynamical core


I play a core role in the design of the computational systems which will underpin the next generation weather and climate systems model developed by the UK Met office. By using novel programming models and code generation, we will deliver a system which facilitates the long-term use of finely tuned numerics on constantly changing massively parallel hardware. The Gung Ho data model will exploit the vertical structure of atmospheric meshes in combination with anunstructured horizontal representation to deliver both flexibility and near-optimal memory performance.

Automated validating interfaces for scientific software

I am a developer of the Spud system for defining, writing and processing options files for scientific computer models.

The interfaces to scientific computer models are frequently primitive, under-documented and ad-hoc text files. This makes using and developing the model in question difficult and error-prone.In contrast, Spud provides a mechanism for automatically generating user interfaces which validate input and inform the user of errors. It also handles the reading of options files and making them available to individual code units.

I hope that future work on Spud will transform it into a full model provenance system which enables the tracing of simulation results back to model code and input data. This is an important need for simulation software if reliance is to be placed on the simulation outcomes.

Research Funding

show research

NERC Independent Research Fellowship NE/K008951/1 “Abstracting the environment: automating geoscientific simulation”

NERC Grant NE/K006789/1 “Gung Ho Phase 2” - developing a new UK weather and cli-mate model.

EPSRC Grant EP/L000407/1 “Platform: underpinning technologies for finite element simulation”

EPSRC Grant EP/K008730/1 “PAMELA: a Panoramic Approach to the Many-CorE LAnd-sape - from end-user to end-device: a holistic game-changing approach.”

EPSRC Grant EP/I00677X/1 "Multi-layered abstractions for PDEs"

NERC Grant NE/I001360/1 "Automated adjoints: how much do we really know about the source of the Indian Ocean Tsunami?

NERC Grant NE/I000747/1 "Unstructured mesh dynamical core for atmospheric modelling using geophysically-optimal finite elements"

NERC Grant  NE/I021098/1 "Abstracting the hardware: Assembly algorithms for numerical weather prediction on emerging massively parallel architectures"

Research Student Supervision



Markall,G, Multilayered Abstractions for Partial Differential Equations


Rathgeber,F, Performance-portable finite element assembly