Abstract. A compiler approach for generating low-level computer code from high-level input for discontinuous Galerkin finite element forms is presented. The input language mirrors conventional mathematical notation, and the compiler generates efficient code in a standard programming language. This facilitates the rapid generation of efficient code for general equations in varying spatial dimensions. Key concepts underlying the compiler approach and the automated generation of computer code are elaborated. The approach is demonstrated for a range of common problems, including the Poisson, biharmonic, advection-diffusion and Stokes equations. Key words. Variational forms, discontinuous Galerkin methods, finite element, form compiler, code generation. AMS subject classifications. 65N30, 68N20. 1. Introduction. Discontinuous Galerkin methods in space have emerged as a generalisation of finite element methods for solving a range of partial differential equations. While historically used for first-order hyperbolic equations, discontinuous Galerkin methods are now applied to a range of hyperbolic, parabolic and elliptic problems. In addition to the usual integration over cell volumes that characterises the conventional finite element method, discontinuous Galerkin methods also involve the integration of flux terms over interior facets. Discontinuous Galerkin methods exist in many variants, and are generally distinguished by the form of the flux on facets. A sample of fluxes for elliptic problems can be found in [4] . We present here a compiler approach for generating computer code for discontinuous Galerkin forms. From a high-level input language which resembles conventional mathematical notation, low-level computer code is generated automatically. The generated code is called by an assembler to construct global sparse tensors, commonly known as the 'stiffness matrix' and the 'load vector'. The compiler approach affords a number of interesting possibilities. It permits the rapid prototyping and testing of new methods, as well as providing scope for producing optimised code. The latter can be achieved through the compiler by precomputing various terms which are traditionally evaluated at run time, and by deploying procedures for analysing the structure of forms which facilitates various a priori optimisations which may not be tractable when developing computer code in a conventional fashion. In addition, the representations of element tensors (element stiffness matrices) for a given variational form are not limited to the usual quadrature-loop approach. For many forms, computationally more efficient representations can be employed. In essence, the form compiler approach allows a high level of generality, while competing in terms of performance with specialised, dedicated code, as will be elaborated in this work. The use of a form compiler is particularly attractive for mixed problems, where one may wish to work with a combination of continuous and discontinuous function
The FEniCS REF project defines a high-level language, UFL, for the specification of finite element algorithms.
Automated code generation for discontinuous Galerkin methods
SIAM J. Sci. Comput. 31(2), 2008, pp. 849-864
Mathematics Computer Science