Skip to main content

2012 | Buch

Automated Solution of Differential Equations by the Finite Element Method

The FEniCS Book

herausgegeben von: Anders Logg, Kent-Andre Mardal, Garth Wells

Verlag: Springer Berlin Heidelberg

Buchreihe : Lecture Notes in Computational Science and Engineering

insite
SUCHEN

Über dieses Buch

This book is a tutorial written by researchers and developers behind the FEniCS Project and explores an advanced, expressive approach to the development of mathematical software. The presentation spans mathematical background, software design and the use of FEniCS in applications. Theoretical aspects are complemented with computer code which is available as free/open source software. The book begins with a special introductory tutorial for beginners. Following are chapters in Part I addressing fundamental aspects of the approach to automating the creation of finite element solvers. Chapters in Part II address the design and implementation of the FEnicS software. Chapters in Part III present the application of FEniCS to a wide range of applications, including fluid flow, solid mechanics, electromagnetics and geophysics.

Inhaltsverzeichnis

Frontmatter
1. A FEniCS tutorial

This chapter presents a FEniCS tutorial to get new users quickly up and running with solving differential equations. FEniCS can be programmed both in C++ and Python, but this tutorial focuses exclusively on Python programming since this is the simplest approach to exploring FEniCS for beginners and it does not compromise on performance. After having digested the examples in this tutorial, the reader should be able to learn more from the FEniCS documentation and from the other chapters in this book.

Hans Petter Langtangen

Methodology

Frontmatter
2. The finite element method

The finite element method has emerged as a universal method for the solution of differential equations. Much of the success of the finite element method can be attributed to its generality and elegance, allowing a wide range of differential equations from all areas of science to be analyzed and solved within a common framework. Another contributing factor to the success of the finite element method is the flexibility of formulation, allowing the properties of the discretization to be controlled by the choice of approximating finite element spaces.

Robert C. Kirby, Anders Logg
3. Common and unusual finite elements

This chapter provides a glimpse of the considerable range of finite elements in the literature. Many of the elements presented here are implemented as part of the FEniCS project already; some are future work. The universe of finite elements extends far beyond what we consider here. In particular, we consider only simplicial, polynomial-based elements. We thus bypass elements defined on quadrilaterals and hexahedra, composite and macro-element techniques, as well as XFEM-type methods. Even among polynomial-based elements on simplices, the list of elements can be extended. Nonetheless, this chapter presents a comprehensive collection of some the most common, and some more unusual, finite elements.

Robert C. Kirby, Anders Logg, Marie E. Rognes, Andy R. Terrel
4. Constructing general reference finite elements

This chapter describes the mathematical framework for constructing a general class of finite elements on reference domains. This framework is used by both the FIAT and SyFi projects, see the Chapters 13 and 15, respectively. Our goal is to provide a framework by which simplicial finite elements with very complicated bases can be constructed automatically. We work from the classic Ciarlet definition of the finite element and its “nodal” basis (an abstract notion far more general and powerful than standard node-oriented Lagrange polynomials).

Robert C. Kirby, Kent-Andre Mardal
5. Finite element variational forms

Much of the FEniCS software is devoted to the formulation of variational forms (UFL), the discretization of variational forms (FIAT, FFC, SyFi) and the assembly of the corresponding discrete operators (UFC, DOLFIN). This chapter summarizes the notation for variational forms used throughout FEniCS.

Robert C. Kirby, Anders Logg
6. Finite element assembly

The finite element method may be viewed as a method for forming a discrete linear system 4064 AU = b or nonlinear system b(U) = 0 corresponding to the discretization of the variational form of a 4065 differential equation.A central part of the implementation of finite element methods is therefore the 4066 computation of matrices and vectors from variational forms.In this chapter, we describe the standard 4067 algorithm for computing the discrete operator (tensor) A.

Anders Logg, Kent-Andre Mardal, Garth N. Wells
7. Quadrature representation of finite element variational forms

This chapter addresses the conventional run-time quadrature approach for the numerical integration of local element tensors associated with finite element variational forms, and in particular automated optimizations that can be performed to reduce the number of floating point operations. An alternative to the run-time quadrature approach is the tensor representation presented in Chapter 8. Both the quadrature and tensor approaches are implemented in FFC (see Chapter 11). In this chapter we discuss four strategies for optimizing the quadrature representation for run-time performance of the generated code and show that optimization strategies lead to a dramatic improvement in run-time performance over a naive implementation. We also examine performance aspects of the quadrature and tensor approaches for different equations, and this will motivate the desirability of being able to choose between the two representations.

Kristian B. Ølgaard, Garth N. Wells
8. Tensor representation of finite element variational forms

In Chapter 6, we saw that an important step in the assembly of matrices and vectors for the 4523 discretization of finite element variational problems is the evaluation of the cell (element) tensor AT 4524 defined by 4525 AT,i = aT(

f

T,

r

i

r

,...,

f

T,2 i2,

f

T,1 i1 ).

Robert C. Kirby, Anders Logg
9. Discrete optimization of finite element matrix evaluation

The tensor contraction structure for the computation of the element tensor AT obtained in Chapter 8,enables not only the construction of a compiler for variational forms,but an optimizing compiler.For typical variational forms,the reference tensor A0 has significant structure that allows the element tensor AT to be computed on an arbitrary cell T at a lower computational cost.

Robert C. Kirby, Matthew Gregg Knepley, Anders Logg, L. Ridgway Scott, Andy R. Terrel

Implementation

Frontmatter
10. DOLFIN: a C++/Python finite element library

DOLFIN is a C++/Python library that functions as the main user interface of FEniCS. In this 4806 chapter, we review the functionality of DOLFIN. We also discuss the implementation of some key 4807 features of DOLFIN in detail.

Anders Logg, Garth N. Wells, Johan Hake
11. FFC: the FEniCS form compiler

One of the key features of FEniCS is automated code generation for the general and efficient 7018 solution of finite element variational problems. This automated code generation relies on a form 7019 compiler for offline or just-in-time compilation of code for individual forms. Two different form 7020 compilers are available as part of FEniCS.

Anders Logg, Kristian B. Ølgaard, Marie E. Rognes, Garth N. Wells
12. FErari: an optimizing compiler for variational forms

In Chapter 8, we presented a framework for efficient evaluation of multilinear forms based on 7311 expressing the multilinear form as a special tensor contraction. This allows generation of efficient 7312 low-level code for assembly of a range of multilinear forms.

Robert C. Kirby, Anders Logg
13. FIAT: numerical construction of finite element basis functions

The FIAT project [Kirby, 2004, 2006a] implements the mathematical framework described in 7423 Chapter 4 as a Python package, working mainly in terms of numerical linear algebra. Although an 7424 implementation in floating-point arithmetic presents some challenges relative to symbolic computation, 7425 it can allow greater efficiency in terms of work and memory usage, especially for high order elements.

Robert C. Kirby
14. Instant: just-in-time compilation of C/C++ in Python

Instant is a small Python module for just-in-time (JIT) compilation (or inlining) of C/C++ code.Instant accepts plain C/C++ code and is therefore conveniently combined with the code generating tools in DOLFIN, FFC and SFC.

Ilmar M. Wilbers, Kent-Andre Mardal, Martin S. Alnæs
15. SyFi and SFC: symbolic finite elements and form compilation

This chapter concerns the finite element library SyFi and its form compiler SFC. SyFi is a framework 8315 for defining finite elements symbolically, using the C++ library GiNaC [Bauer et al., 2002] and its 8316 Python interface Swiginac [Skavhaug and Certik, 2009].

Martin Sandve Alnæs, Kent-Andre Mardal
16. UFC: a finite element code generation interface

A central component of FEniCS is the UFC interface (Unified Form-assembly Code). UFC is an 8703 interface between problem-specific and general-purpose components of finite element programs. In 8704 particular, the UFC interface defines the structure and signature of the code that is generated by 8705 the form compilers FFC and SFC for DOLFIN. The UFC interface applies to a wide range of finite 8706 element problems (including mixed finite elements and discontinuous Galerkin methods) and may be 8707 used with libraries that differ widely in their design.

Martin Sandve Alnæs, Anders Logg, Kent-Andre Mardal
17. UFL: a finite element form language

The Unified Form Language – UFL [Alnæs and Logg, 2009] – is a domain specific language for the declaration of finite element discretizations of variational forms and functionals. More precisely, the language defines a flexible user interface for defining finite element spaces and expressions for weak forms in a notation close to mathematical notation.

Martin Sandve Alnæs
18. Unicorn: a unified continuum mechanics solver

This chapter provides a description of the technology of Unicorn focusing on simple, efficient and 10597 general algorithms and software for the Unified Continuum (UC) concept and the adaptive General 10598 Galerkin (G2) discretization as a unified approach to continuum mechanics.

Johan Hoffman, Johan Jansson, Cem Degirmenci, Niclas Jansson, Murtazo Nazarov
19. Lessons learned in mixed language programming

This chapter describes decisions made and lessons learned in the implementation of the Python interface of DOLFIN. The chapter is quite technical, since we aim at giving the reader a thorough understanding of the implementation of the DOLFIN Python interface.

Johan Hake, Kent-Andre Mardal

Applications

Frontmatter
20. Finite elements for incompressible fluids

The structure of the finite element method offers a user a range of choices. This is especially true for solving incompressible fluid problems, where theory points to a number of stable finite element formulations. Using automation tools, we implement and examine various stable formulations for the steady-state Stokes equations. It is demonstrated that the expressiveness of the FEniCS Project components allows solvers for the Stokes problem that use various element formulations to be created with ease.

Andy R. Terrel, L. Ridgway Scott, Matthew Gregg Knepley, Robert C. Kirby, Garth N. Wells
21. A comparison of finite element schemes for the incompressible Navier–Stokes equations

Numerical algorithms for the computation of fluid flow have been an active area of research for 12062 several decades and still remain an important field to study. As a result, there exists a large literature 12063 on discretization schemes for the incompressible Navier–Stokes equations, and it can be hard to 12064 judge which method works best for any particular problem. Furthermore, since the development of 12065 any particular discretization scheme is often a long process and tied to a specific implementation, 12066 comparisons of different methods are seldom made.

Kristian Valen-Sendstad, Anders Logg, Kent-Andre Mardal, Harish Narayanan, Mikael Mortensen
22. Simulation of transitional flows

The purpose of this work is to validate Navier–Stokes (NS) solvers implemented in FEniCS for 12416 unstable, transitional flows. Solvers for the NS equations have been discussed in Chapter 21 for 12417 laminar flows. In this chapter, focus is put more directly on energy and energy conservation, features 12418 of primary importance in turbulence applications. We emphasize the treatment of the nonlinear 12419 convection term, where various forms (standard, divergence and skew-symmetric) are implemented 12420 and tested for both accuracy and stability. The algorithm chosen to advance the momentum and 12421 pressure in time is a fractional step approach that is memory efficient, but incurs a splitting error due 12422 to the uncoupling of the velocity and pressure. The significance of this splitting error is validated 12423 through comparison with a more accurate fully coupled solver that, due to its higher memory cost, 12424 is less suitable for large-scale turbulence applications. The performance of the solvers is validated 12425 with the one-dimensional Burgers’ equation, the Orr–Sommerfeld perturbation in two dimensions 12426 and finally the three-dimensional unstable and transitional Taylor–Green vortex.

Mikael Mortensen, Kent-Andre Mardal, Hans Petter Langtangen
23. Computational hemodynamics

Computational fluid dynamics (CFD) is a tool with great potential in medicine. Using traditional engineering techniques, one may compute, e.g., the blood flow in arteries and the resulting stress on the vessel wall to understand, treat and prevent various cardiovascular diseases. This chapter is devoted to the computation of blood flow in large cerebral arteries and how the blood flow affects the development and rupture of aneurysms. We discuss the process, from generating geometries from medical imaging data to performing patient-specific simulations of hemodynamics in FEniCS. Specifically, we present three different applications: simulations related to a recently published study by Lindekleiv et al. [2010] concerning gender differences in cerebral arteries, a study of the carotid arteries of a canine with an induced aneurysm described in Jiang et al. [2010], and a study of the blood flow in a healthy Circle of Willis, where patient-specific velocity measurements are compared with a model for the peripheral resistance.

Kristian Valen-Sendstad, Kent-Andre Mardal, Anders Logg
24. Cerebrospinal fluid flow

This chapter concerns the flow of cerebrospinal fluid (CSF) in the subarachnoid space that surrounds the spinal cord. Particular attention is given to abnormal flow and pressure resulting from the Chiari I malformation and its often associated condition syringomyelia. The chapter builds on the software tools described in Chapter 21, and we will compare the Chorin, IPCS and G2 methods. In this chapter, we will also describe how to create meshes with Gmsh.

Susanne Støle-Hentschel, Svein Linge, Alf Emil Løvgren, Kent-Andre Mardal
25. Improved Boussinesq equations for surface water waves

The main motivation of this work is the implementation of a general finite element solver for some of the improved Boussinesq models. Here, we use an extension of the model proposed by Zhao et al. [2004] to investigate the behavior of surface water waves. The equations in this model do not contain spatial derivatives with an order higher than two. Some effects like energy dissipation and wave generation by natural phenomena or external physical mechanisms are also included. As a consequence, some modified dispersion relations are derived for this extended model. A matrix-based linear stability analysis of the proposed model is presented. It is shown that this model is robust with respect to instabilities related to steep bottom gradients.

Nuno D. Lopes, Pedro J. S. Pereira, Luís Trabucho
26. Applications in solid mechanics

Problems in solid mechanics constitute perhaps the largest field of application of finite element methods. The vast majority of solid mechanics problems involve the standard momentum balance equation, posed in a Lagrangian setting, with different models distinguished by the choice of nonlinear or linearized kinematics, and the constitutive model for determining the stress. For some common models, the constitutive relationships are rather complex. This chapter addresses a number of canonical solid mechanics models in the context of automated modeling, and focuses on some pertinent issues that arise due to the nature of the constitutive models. The solution of equations with second-order time derivatives, which characterizes dynamic problems, is also considered.

Kristian B. Ølgaard, Garth N. Wells
27. A computational framework for nonlinear elasticity

Nonlinear elasticity theory plays a fundamental role in modeling the mechanical response of many polymeric and biological materials. Such materials are capable of undergoing finite deformation, and their material response is often characterized by complex, nonlinear constitutive relationships. (See, for example, Holzapfel [2000] and Truesdell and Noll [1965] and the references within for several examples.) Because of these difficulties, predicting the response of arbitrary structures composed of such materials to arbitrary loads requires numerical computation, usually based on the finite element method. The steps involved in the construction of the required finite element algorithms are classical and straightforward in principle, but their application to non-trivial material models are typically tedious and error-prone. Our recent work on an automated computational framework for nonlinear elasticity, CBC.Twist, is an attempt to alleviate this problem.

Harish Narayanan
28. Turbulent flow and fluid–structure interaction

The FEniCS project aims towards the goals of generality, efficiency, and simplicity, concerning mathematical methodology, implementation and application, and the Unicorn project is an imple- mentation aimed at FSI and high Re turbulent flow guided by these principles. Unicorn is based on the DOLFIN/FFC/FIAT suite and the linear algebra package PETSc. We here present some key elements of Unicorn, and a set of computational results from applications. The details of the Unicorn implementation are described in Chapter 18.

Johan Hoffman, Johan Jansson, Niclas Jansson, Claes Johnson, Rodrigo Vilela De Abreu
29. An adaptive finite element solver for fluid–structure interaction problems

Fluid–structure interaction (FSI) occurs when a fluid interacts with a solid structure, exerting a traction force that causes deformation of the structure and, thus, alters the flow of the fluid itself. The FSI problem is a fully coupled multiphysics problem, whether the problem is solved in a partitioned manner or by a monolithic approach. In many cases we are only interested in one physical output quantity of the fully coupled system, e.g., the displacement of the structure. In order to compute ths particular physical output of interest with a high level of accuracy, a goal oriented adaptive finite element method can be used.

Kristoffer Selim
30. Modeling evolving discontinuities

We present a framework for solving partial differential equations with discontinuities in the solution across evolving surfaces. The partition-of-unity/extended finite element approach is adopted, 1 and it is demonstrated that such methods can be used in combination with a form compiler to generate equation-specific parts of a program. The automated generation of code makes it straightforward to incorporate discontinuities in formulations involving multiple fields, using both Lagrange and non-Lagrange basis functions. The approach is illustrated through some salient code extracts.

Mehdi Nikbakht, Garth N. Wells
31. Dynamic simulations of convection in the Earth’s mantle

In this chapter, we model dynamic convection processes in the Earth’s mantle; linking the geody- namical equations, numerical implementation and Python code tightly together. The convection of material is generated by heating from below with a compositionally distinct and denser layer at the bottom. The time-dependent nonlinear partial differential equations to be solved are the quasi-static Stokes equations with depth- and temperature-dependent viscosity, and advection-diffusion equations for the composition and temperature. We present a numerical algorithm for the simulation of these equations as well as an implementation of this algorithm using the DOLFIN Python interface. The results show that the compositional heterogeneities persist, but interact strongly with the convecting system, generating upwellings and movement as material from the surface displaces them. This chapter will be of interest to those seeking to model compositional discontinuities using field methods, as well as those interested in mantle convection simulations.

Lyudmyla Vynnytska, Stuart R. Clark, Marie E. Rognes
32. Automatic calibration of depositional models

A novel concept for calibrating depositional models is presented. In this approach, transport coefficients are determined from well output measurements. Finite element implementation of the multi-lithology models and their duals is automated by the DOLFIN Python interface.

Hans Joachim Schroll
33. A coupled stochastic and deterministic model of Ca2+ dynamics in the dyadic cleft

From the time we are children we are told that we should drink milk because it is an important source of calcium (Ca2+), and that Ca2+ is vital for a strong bone structure. What we do not hear as frequently is that Ca2+ is one of the most important cellular messengers in the human body [Alberts et al., 2002]. In particular, Ca2+ controls cell death, neural signaling, secretion of different chemical substances and the contraction of cells in the heart. The latter is the focus of this chapter.

Johan Hake
34. Electromagnetic waveguide analysis

At their core, Maxwell’s equations are a set of differential equations describing the interactions between electric and magnetic fields, charges and currents. These equations provide the tools with which to predict the behavior of electromagnetic phenomena, giving us the ability to use them in a wide variety of applications, including communication and power generation. Due to the complex nature of typical problems in these fields, numeric methods such as the finite element method are often employed.

Evan Lezar, David B. Davidson
35. Block preconditioning of systems of PDEs

In this chapter, we describe the implementation of block preconditioned Krylov solvers for systems of partial differential equations (PDEs) using CBC.Block and the Python interfaces of DOLFIN and Trilinos. We start by reviewing the abstract theory of constructing preconditioners by considering the differential operators as mappings in properly chosen Sobolev spaces, before giving a short overview of CBC.Block. We then present several examples, namely the Poisson problem, the Stokes problem, the time-dependent Stokes problem and finally a mixed formulation of the Hodge Laplacian.

Kent-Andre Mardal, Joachim Berdal Haga
36. Automated testing of saddle point stability conditions

Over the last five decades, there has been a substantial body of research on the theory of mixed finite element methods. Mixed finite element methods are finite element methods where two or more finite element spaces are used to approximate separate variables. These methods have often been applied to saddle point problems arising from constrained minimization problems. Examples include the Stokes equations, the equations of Darcy flow (or the mixed Laplacian) or the Hellinger–Reissner formulation for linear elasticity. For equations involving several variables, and where elimination of any of the variables is not a viable option, the usefulness of such methods is evident. For other equations, discretizations based on the introduction of additional variables may have improved properties. The goal of this chapter is to demonstrate that one may automate the examination of the stability of any given discretization.

Marie E. Rognes
Backmatter
Metadaten
Titel
Automated Solution of Differential Equations by the Finite Element Method
herausgegeben von
Anders Logg
Kent-Andre Mardal
Garth Wells
Copyright-Jahr
2012
Verlag
Springer Berlin Heidelberg
Electronic ISBN
978-3-642-23099-8
Print ISBN
978-3-642-23098-1
DOI
https://doi.org/10.1007/978-3-642-23099-8

Premium Partner