Summary: | Efficient numerical solvers for partial differential equations are critical to vast fields of engineering and scientific research, including weather and climate prediction. State-of-the-art finite element discretisations, although offering many desirable properties, are often difficult to implement. Consequently, many developers of complicated finite element discretisations use code generation based software platforms. The form compiler is a key component of such software: it takes a high-level description of the weak form of partial differential equations and produces low-level code that carries out the finite element assembly. This thesis presents a novel, multi-stage code generation framework for the finite element method, implemented in the Two-Stage Form Compiler (TSFC). A core idea of TSFC is the introduction of a tensor algebra language as its intermediate representation. This creates a clean separation between the implementation of finite element objects and geometric terms as well as the problem of efficient code generation for tensor algebra expressions, which enables the maintenance of the structure of the input expression longer in the compiler pipeline than previous form compilers, and thus helps to facilitate the application of optimisations at the highest possible level of abstraction. The intermediate language is also proven to be a suitable medium and level of abstraction for numerous optimisations, including the expression and exploitation of structure intrinsic to some finite elements. This includes sum factorisation on cuboid cells for continuous, discontinuous, H(div) and H(curl) conforming elements. My experiments confirm optimal algorithmic complexity for high-order finite element assembly. This is achieved through several novel contributions: the introduction of a more powerful interface between the form compiler and the library providing the finite elements; a more abstract, smarter library of finite elements that explicitly communicates the structure of elements; and form compiler algorithms to automatically exploit this exposed structure.
|