MSApr 25, 2013Code
Unified Form Language: A domain-specific language for weak formulations of partial differential equationsMartin S. Alnaes, Anders Logg, Kristian B. Oelgaard et al.
We present the Unified Form Language (UFL), which is a domain-specific language for representing weak formulations of partial differential equations with a view to numerical approximation. Features of UFL include support for variational forms and functionals, automatic differentiation of forms and expressions, arbitrary function space hierarchies for multi-field problems, general differential operators and flexible tensor algebra. With these features, UFL has been used to effortlessly express finite element methods for complex systems of partial differential equations in near-mathematical notation, resulting in compact, intuitive and readable programs. We present in this work the language and its construction. An implementation of UFL is freely available as an open-source software library. The library generates abstract syntax tree representations of variational problems, which are used by other software libraries to generate concrete low-level implementations. Some application examples are presented and libraries that support UFL are highlighted.
MSMar 31, 2011
DOLFIN: Automated Finite Element ComputingAnders Logg, Garth N. Wells
We describe here a library aimed at automating the solution of partial differential equations using the finite element method. By employing novel techniques for automated code generation, the library combines a high level of expressiveness with efficient computation. Finite element variational forms may be expressed in near mathematical notation, from which low-level code is automatically generated, compiled and seamlessly integrated with efficient implementations of computational meshes and high-performance linear algebra. Easy-to-use object-oriented interfaces to the library are provided in the form of a C++ library and a Python module. This paper discusses the mathematical abstractions and methods used in the design of the library and its implementation. A number of examples are presented to demonstrate the use of the library in application code.
NAJun 9, 2012
A stabilized Nitsche fictitious domain method for the Stokes problemAndre Massing, Mats G. Larson, Anders Logg et al.
We develop a Nitsche fictitious domain method for the Stokes problem starting from a stabilized Galerkin finite element method with low order elements for both the velocity and the pressure. By introducing additional penalty terms for the jumps in the normal velocity and pressure gradients in the vicinity of the boundary, we show that the method is inf-sup stable. As a consequence, optimal order a priori error estimates are established. Moreover, the condition number of the resulting stiffness matrix is shown to be bounded independently of the location of the boundary. We discuss a general, flexible and freely available implementation of the method in three spatial dimensions and present numerical examples supporting the theoretical results.
NADec 2, 2011
A compiler for variational formsRobert C. Kirby, Anders Logg
As a key step towards a complete automation of the finite element method, we present a new algorithm for automatic and efficient evaluation of multilinear variational forms. The algorithm has been implemented in the form of a compiler, the FEniCS Form Compiler FFC. We present benchmark results for a series of standard variational forms, including the incompressible Navier-Stokes equations and linear elasticity. The speedup compared to the standard quadrature-based approach is impressive; in some cases the speedup is as large as a factor 1000.
NAMay 14, 2012
Unified Framework for Finite Element AssemblyMartin Sandve Alnæs, Anders Logg, Kent-Andre Mardal et al.
At the heart of any finite element simulation is the assembly of matrices and vectors from discrete variational forms. We propose a general interface between problem-specific and general-purpose components of finite element programs. This interface is called Unified Form-assembly Code (UFC). A wide range of finite element problems is covered, including mixed finite elements and discontinuous Galerkin methods. We discuss how the UFC interface enables implementations of variational form evaluation to be independent of mesh and linear algebra components. UFC does not depend on any external libraries, and is released into the public domain.
NADec 2, 2011
Automating the Finite Element MethodAnders Logg
The finite element method can be viewed as a machine that automates the discretization of differential equations, taking as input a variational problem, a finite element and a mesh, and producing as output a system of discrete equations. However, the generality of the framework provided by the finite element method is seldom reflected in implementations (realizations), which are often specialized and can handle only a small set of variational problems and finite elements (but are typically parametrized over the choice of mesh). This paper reviews ongoing research in the direction of a complete automation of the finite element method. In particular, this work discusses algorithms for the efficient and automatic computation of a system of discrete equations from a given variational problem, finite element and mesh. It is demonstrated that by automatically generating and compiling efficient low-level code, it is possible to parametrize a finite element code over variational problem and finite element in addition to the mesh.
NAMay 29, 2012
A stabilized Nitsche overlapping mesh method for the Stokes problemAndré Massing, Mats G. Larson, Anders Logg et al.
We develop a Nitsche-based formulation for a general class of stabilized finite element methods for the Stokes problem posed on a pair of overlapping, non-matching meshes. By ex- tending the least-squares stabilization to the overlap region, we prove that the method is stable, consistent, and optimally convergent. To avoid an ill-conditioned linear algebra system, the scheme is augmented by a least-squares term measuring the discontinuity of the solution in the overlap region of the two meshes. As a consequence, we may prove an estimate for the condition number of the resulting stiffness matrix that is independent of the location of the interface. Finally, we present numerical examples in three spatial dimensions illustrating and confirming the theoretical results.
NAMay 14, 2012
Efficient Assembly of H(div) and H(curl) Conforming Finite ElementsMarie Rognes, Robert C. Kirby, Anders Logg
In this paper, we discuss how to efficiently evaluate and assemble general finite element variational forms on H(div) and H(curl). The proposed strategy relies on a decomposition of the element tensor into a precomputable reference tensor and a mesh-dependent geometry tensor. Two key points must then be considered: the appropriate mapping of basis functions from a reference element, and the orientation of geometrical entities. To address these issues, we extend here a previously presented representation theorem for affinely mapped elements to Piola-mapped elements. We also discuss a simple numbering strategy that removes the need to contend with directions of facet normals and tangents. The result is an automated, efficient, and easy-to-use implementation that allows a user to specify finite element variational forms on H(div) and H(curl) in close to mathematical notation.
NAAug 26, 2018
MultiMesh Finite Element Methods: Solving PDEs on Multiple Intersecting MeshesAugust Johansson, Benjamin Kehlet, Mats G. Larson et al.
We present a new framework for expressing finite element methods on multiple intersecting meshes: multimesh finite element methods. The framework enables the use of separate meshes to discretize parts of a computational domain that are naturally separate; such as the components of an engine, the domains of a multiphysics problem, or solid bodies interacting under the influence of forces from surrounding fluids or other physical fields. Such multimesh finite element methods are particularly well suited to problems in which the computational domain undergoes large deformations as a result of the relative motion of the separate components of a multi-body system. In the present paper, we formulate the multimesh finite element method for the Poisson equation. Numerical examples demonstrate the optimal order convergence, the numerical robustness of the formulation and implementation in the face of thin intersections and rounding errors, as well as the applicability of the methodology. In the accompanying paper~\cite{mmfem-2}, we analyze the proposed method and prove optimal order convergence and stability.
NAMay 14, 2012
Optimizing the Evaluation of Finite Element MatricesRobert C. Kirby, Matthew Knepley, Anders Logg et al.
Assembling stiffness matrices represents a significant cost in many finite element computations. We address the question of optimizing the evaluation of these matrices. By finding redundant computations, we are able to significantly reduce the cost of building local stiffness matrices for the Laplace operator and for the trilinear form for Navier-Stokes. For the Laplace operator in two space dimensions, we have developed a heuristic graph algorithm that searches for such redundancies and generates code for computing the local stiffness matrices. Up to cubics, we are able to build the stiffness matrix on any triangle in less than one multiply-add pair per entry. Up to sixth degree, we can do it in less than about two. Preliminary low-degree results for Poisson and Navier-Stokes operators in three dimensions are also promising.
NAMay 14, 2012
Efficient Compilation of a Class of Variational FormsRobert C. Kirby, Anders Logg
We investigate the compilation of general multilinear variational forms over affines simplices and prove a representation theorem for the representation of the element tensor (element stiffness matrix) as the contraction of a constant reference tensor and a geometry tensor that accounts for geometry and variable coefficients. Based on this representation theorem, we design an algorithm for efficient pretabulation of the reference tensor. The new algorithm has been implemented in the FEniCS Form Compiler (FFC) and improves on a previous loop-based implementation by several orders of magnitude, thus shortening compile-times and development cycles for users of FFC.
NAMay 12, 2012
Multi-Adaptive Galerkin Methods for ODEs IAnders Logg
We present multi-adaptive versions of the standard continuous and discontinuous Galerkin methods for ODEs. Taking adaptivity one step further, we allow for individual time-steps, order and quadrature, so that in particular each individual component has its own time-step sequence. This paper contains a description of the methods, an analysis of their basic properties, and a posteriori error analysis. In the accompanying paper [A. Logg, SIAM J. Sci. Comput., 27 (2003), pp. 741-758], we present adaptive algorithms for time-stepping and global error control based on the results of the current paper.
NAMay 14, 2012
Efficient Representation of Computational MeshesAnders Logg
We present a simple yet general and efficient approach to representation of computational meshes. Meshes are represented as sets of mesh entities of different topological dimensions and their incidence relations. We discuss a straightforward and efficient storage scheme for such mesh representations and efficient algorithms for computation of arbitrary incidence relations from a given initial and minimal set of incidence relations. The general representation may harbor a wide range of computational meshes, and may also be specialized to provide simple user interfaces for particular meshes, including simplicial meshes in one, two and three space dimensions where the mesh entities correspond to vertices, edges, faces and cells. It is elaborated on how the proposed concepts and data structures may be used for assembly of variational forms in parallel over distributed finite element meshes. Benchmarks are presented to demonstrate efficiency in terms of CPU time and memory usage.
NAMay 12, 2012
Multi-Adaptive Time-IntegrationAnders Logg
Time integration of ODEs or time-dependent PDEs with required resolution of the fastest time scales of the system, can be very costly if the system exhibits multiple time scales of different magnitudes. If the different time scales are localised to different components, corresponding to localisation in space for a PDE, efficient time integration thus requires that we use different time steps for different components. We present an overview of the multi-adaptive Galerkin methods mcG(q) and mdG(q) recently introduced in a series of papers by the author. In these methods, the time step sequence is selected individually and adaptively for each component, based on an a posteriori error estimate of the global error. The multi-adaptive methods require the solution of large systems of nonlinear algebraic equations which are solved using explicit-type iterative solvers (fixed point iteration). If the system is stiff, these iterations may fail to converge, corresponding to the well-known fact that standard explicit methods are inefficient for stiff systems. To resolve this problem, we present an adaptive strategy for explicit time integration of stiff ODEs, in which the explicit method is adaptively stabilised by a small number of small, stabilising time steps.
NAMay 12, 2012
Multi-Adaptive Galerkin Methods for ODEs II: Implementation and ApplicationsAnders Logg
Continuing the discussion of the multi-adaptive Galerkin methods mcG(q) and mdG(q) presented in [A. Logg, SIAM J. Sci. Comput., 24 (2003), pp. 1879-1902], we present adaptive algorithms for global error control, iterative solution methods for the discrete equations, features of the implementation Tanganyika, and computational results for a variety of ODEs. Examples include the Lorenz system, the solar system, and a number of time-dependent PDEs.
NAOct 26, 2012
Efficient implementation of finite element methods on non-matching and overlapping meshes in 3DAndré Massing, Mats G. Larson, Anders Logg
In recent years, a number of finite element methods have been formulated for the solution of partial differential equations on complex geometries based on non-matching or overlapping meshes. Examples of such methods include the fictitious domain method, the extended finite element method, and Nitsche's method. In all of these methods, integrals must be computed over cut cells or subsimplices which is challenging to implement, especially in three space dimensions. In this note, we address the main challenges of such an implementation and demonstrate good performance of a fully general code for automatic detection of mesh intersections and integration over cut cells and subsimplices. As a canonical example of an overlapping mesh method, we consider Nitsche's method which we apply to Poisson's equation and a linear elastic problem.
NAMay 14, 2012
An Adaptive Finite Element Splitting Method for the Incompressible Navier-Stokes EquationsKristoffer Selim, Anders Logg, Mats G. Larson
We present an adaptive finite element method for the incompressible Navier--Stokes equations based on a standard splitting scheme (the incremental pressure correction scheme). The presented method combines the efficiency and simplicity of a splitting method with the powerful framework offered by the finite element method for error analysis and adaptivity. An a posteriori error estimate is derived which expresses the error in a goal functional of interest as a sum of contributions from spatial discretization, time discretization and a term that measures the deviation of the splitting scheme from a pure Galerkin scheme (the computational error). Numerical examples are presented which demonstrate the performance of the adaptive algorithm and high quality efficiency indices. It is further demonstrated that the computational error of the Navier--Stokes momentum equation is linear in the size of the time step while the computational error of the continuity equation is quadratic in the size of the time step.
NAMay 14, 2012
Topological Optimization of the Evaluation of Finite Element MatricesRobert C. Kirby, Anders Logg, L. Ridgway Scott et al.
We present a topological framework for finding low-flop algorithms for evaluating element stiffness matrices associated with multilinear forms for finite element methods posed over straight-sided affine domains. This framework relies on phrasing the computation on each element as the contraction of each collection of reference element tensors with an element-specific geometric tensor. We then present a new concept of complexity-reducing relations that serve as distance relations between these reference element tensors. This notion sets up a graph-theoretic context in which we may find an optimized algorithm by computing a minimum spanning tree. We present experimental results for some common multilinear forms showing significant reductions in operation count and also discuss some efficient algorithms for building the graph we use for the optimization.
NAApr 30, 2012
Automated goal-oriented error control I: stationary variational problemsMarie E. Rognes, Anders Logg
This article presents a general and novel approach to the automation of goal-oriented error control in the solution of nonlinear stationary finite element variational problems. The approach is based on automated linearization to obtain the linearized dual problem, automated derivation and evaluation of a posteriori error estimates, and automated adaptive mesh refinement to control the error in a given goal functional to within a given tolerance. Numerical examples representing a variety of different discretizations of linear and nonlinear partial differential equations are presented, including Poisson's equation, a mixed formulation of linear elasticity, and the incompressible Navier-Stokes equations.
NAMay 14, 2012
Benchmarking Domain-Specific Compiler Optimizations for Variational FormsRobert C. Kirby, Anders Logg
We examine the effect of using complexity-reducing relations to generate optimized code for the evaluation of finite element variational forms. The optimizations are implemented in a prototype code named FErari, which has been integrated as an optimizing backend to the FEniCS Form Compiler, FFC. In some cases, FErari provides very little speedup, while in other cases, we obtain reduced local operation counts of a factor of as much as 7.9 and speedups for the assembly of the global sparse matrix of as much as a factor of 2.8.
NAMay 12, 2012
Computational Modeling of Dynamical SystemsJohan Jansson, Claes Johnson, Anders Logg
In this short note, we discuss the basic approach to computational modeling of dynamical systems. If a dynamical system contains multiple time scales, ranging from very fast to slow, computational solution of the dynamical system can be very costly. By resolving the fast time scales in a short time simulation, a model for the effect of the small time scale variation on large time scales can be determined, making solution possible on a long time interval. This process of computational modeling can be completely automated. Two examples are presented, including a simple model problem oscillating at a time scale of 1e-9 computed over the time interval [0,100], and a lattice consisting of large and small point masses.
NAMay 14, 2012
Multiadaptive Galerkin Methods for ODEs III: A Priori Error EstimatesAnders Logg
The multiadaptive continuous/discontinuous Galerkin methods mcG(q) and mdG(q) for the numerical solution of initial value problems for ordinary differential equations are based on piecewise polynomial approximation of degree q on partitions in time with time steps which may vary for different components of the computed solution. In this paper, we prove general order a priori error estimates for the mcG(q) and mdG(q) methods. To prove the error estimates, we represent the error in terms of a discrete dual solution and the residual of an interpolant of the exact solution. The estimates then follow from interpolation estimates, together with stability estimates for the discrete dual solution.
NAApr 30, 2018
A MultiMesh Finite Element Method for the Stokes ProblemAugust Johansson, Mats G. Larson, Anders Logg
The multimesh finite element method enables the solution of partial differential equations on a computational mesh composed by multiple arbitrarily overlapping meshes. The discretization is based on a continuous--discontinuous function space with interface conditions enforced by means of Nitsche's method. In this contribution, we consider the Stokes problem as a first step towards flow applications. The multimesh formulation leads to so called cut elements in the underlying meshes close to overlaps. These demand stabilization to ensure coercivity and stability of the stiffness matrix. We employ a consistent least-squares term on the overlap to ensure that the inf-sup condition holds. We here present the method for the Stokes problem, discuss the implementation, and verify that we have optimal convergence.
NAMay 14, 2012
Algorithms and Data Structures for Multi-Adaptive Time-SteppingJohan Jansson, Anders Logg
Multi-adaptive Galerkin methods are extensions of the standard continuous and discontinuous Galerkin methods for the numerical solution of initial value problems for ordinary or partial differential equations. In particular, the multi-adaptive methods allow individual and adaptive time steps to be used for different components or in different regions of space. We present algorithms for efficient multi-adaptive time-stepping, including the recursive construction of time slabs and adaptive time step selection. We also present data structures for efficient storage and interpolation of the multi-adaptive solution. The efficiency of the proposed algorithms and data structures is demonstrated for a series of benchmark problems.
NAMay 2, 2015
High Order Cut Finite Element Methods for the Stokes ProblemAugust Johansson, Mats G. Larson, Anders Logg
We develop a high order cut finite element method for the Stokes problem based on general inf-sup stable finite element spaces. We focus in particular on composite meshes consisting of one mesh that overlaps another. The method is based on a Nitsche formulation of the interface condition together with a stabilization term. Starting from inf-sup stable spaces on the two meshes, we prove that the resulting composite method is indeed inf-sup stable and as a consequence optimal \emph{a~priori} error estimates hold.
NAApr 25, 2015
A posteriori error analysis of round-off errors in the numerical solution of ordinary differential equationsBenjamin Kehlet, Anders Logg
We prove sharp, computable error estimates for the propagation of errors in the numerical solution of ordinary differential equations. The new estimates extend previous estimates of the influence of data errors and discretisation errors with a new term accounting for the propagation of numerical round-off errors, showing that the accumulated round-off error is inversely proportional to the square root of the step size. As a consequence, the numeric precision eventually sets the limit for the pointwise computability of accurate solutions of any ODE. The theoretical results are supported by numerically computed solutions and error estimates for the Lorenz system and the van der Pol oscillator.
NAApr 14, 2015
A Nitsche-based cut finite element method for a fluid--structure interaction problemAndre Massing, Mats G. Larson, Anders Logg et al.
We present a new composite mesh finite element method for fluid--structure interaction problems. The method is based on surrounding the structure by a boundary-fitted fluid mesh which is embedded into a fixed background fluid mesh. The embedding allows for an arbitrary overlap of the fluid meshes. The coupling between the embedded and background fluid meshes is enforced using a stabilized Nitsche formulation which allows us to establish stability and optimal order \emph{a priori} error estimates, see~\cite{MassingLarsonLoggEtAl2013}. We consider here a steady state fluid--structure interaction problem where a hyperelastic structure interacts with a viscous fluid modeled by the Stokes equations. We evaluate an iterative solution procedure based on splitting and present three-dimensional numerical examples.
NAMay 12, 2012
Explicit Time-Stepping for Stiff ODEsKenneth Eriksson, Claes Johnson, Anders Logg
We present a new strategy for solving stiff ODEs with explicit methods. By adaptively taking a small number of stabilizing small explicit time steps when necessary, a stiff ODE system can be stabilized enough to allow for time steps much larger than what is indicated by classical stability analysis. For many stiff problems the cost of the stabilizing small time steps is small, so the improvement is large. We illustrate the technique on a number of well-known stiff test problems.