Next Article in Journal
Graph Compression by BFS
Next Article in Special Issue
Stefan Problem through Extended Finite Elements: Review and Further Investigations
Previous Article in Journal
Advances in Artificial Neural Networks – Methodological Development and Application
Previous Article in Special Issue
Failure Assessment of Layered Composites Subject to Impact Loadings: a Finite Element, Sigma-Point Kalman Filter Approach
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Automated Modelling of Evolving Discontinuities

1
Faculty of Civil Engineering and Geosciences, Delft University of Technology, Stevinweg 1, 2628 CN Delft, The Netherlands
2
Department of Engineering, University of Cambridge, Trumpington Street, Cambridge CB2 1PZ, UK
*
Author to whom correspondence should be addressed.
Algorithms 2009, 2(3), 1008-1030; https://doi.org/10.3390/a2031008
Submission received: 7 May 2009 / Accepted: 7 August 2009 / Published: 18 August 2009
(This article belongs to the Special Issue Numerical Simulation of Discontinuities in Mechanics)

Abstract

:
The automated approximation of solutions to differential equations which involve discontinuities across evolving surfaces is addressed. Finite element technology has developed to the point where it is now possible to model evolving discontinuities independently of the underlying mesh, which is particularly useful in simulating failure of solids. However, the approach remains tedious to program, particularly in the case of coupled problems where a variety of finite element bases are employed and where a mixture of continuous and discontinuous fields may be used. We tackle this point by exploring the scope for employing automated code generation techniques for modelling discontinuities. Function spaces and variational forms are defined in a language that resembles mathematical notation, and computer code for modelling discontinuities is automatically generated. Principles underlying the approach are elucidated and a number of two- and three-dimensional examples for different equations are presented.

1. Introduction

The computational modelling of evolving discontinuities has witnessed considerable advances in recent times. Using the partition of unity property of finite element shape functions [1], it is possible to simulate discontinuities in a finite element solution across surfaces which are not aligned with the underlying mesh. Such methods are known as the extended finite element method [2, 3] and the generalised finite element method [4]. The approach has obvious application to the modelling of failure in solids, but it can also be applied for a variety of other applications.
While the technology for modelling evolving discontinuities is now maturing, the implementation of such techniques can be tedious and requires a significant investment of time. For these reasons, application of extended finite element techniques is still largely the domain of those in a position to develop software rather than of the broader group, that is, users of computational technology. A limited number of libraries which support the extended finite element method are available (see for example [5]), however these libraries follow the traditional paradigm in which a user is required to program by hand the innermost parts of a solver. We present here our efforts towards the automated solution of partial differential equations which involve evolving discontinuities in the solution. The approach relies on automated code generation from high-level input. Progress has been made in automating large parts of the finite element modelling process for conventional formulations [6, 7], as well as discontinuous Galerkin methods [8] and H ( div ) and H ( curl ) conforming elements [9]. We will extend and generalise some of these ideas to the modelling of discontinuities. Namely, we will use a form compiler to generate low-level computer code from a high-level input language. This permits a high degree of mathematical expressiveness, and by generating low-level code, there is the potential to generate more efficient code than that can be reasonably produced by hand [6, 10]. Furthermore, the approach detaches the model (differential equation) of interest from underlying implementation aspects, such as the discontinuity surface representation.
The rest of this work is structured as follows. In Section 2. we introduce briefly aspects of automated computational modelling for continuous problems and present a simple example. This is followed by a concise overview of modelling discontinuities using the extended finite element method. We then present our approach to automating the solution of problems which involve discontinuities, and this is followed by a collection of examples.
The approach described in this work is manifest in computer code which is available under the GNU Public License (GPL) and the GNU Lesser Public License (LGPL). We build on a number of tools which are part of the FEniCS Project [11], and which are freely available at www.fenics.org. The specific extensions and examples presented in this work are archived at [12].

2. Automated Mathematical Modelling

In the context of a finite element solver, it is possible to divide the code into problem-specific and generic components. The approach which we follow is to generate automatically code for those parts which are specific to a given finite element variational form and to make use of, and develop, where necessary, reusable library components for tasks which are independent of the precise finite element variational form. The code which is specific to a particular finite element variational problem is the finite element basis, the degree of freedom mapping and the element matrices and vectors.
For complicated problems, particularly those that involve a number of coupled equations and combinations of different and possibly unusual finite element spaces, developing the code to compute element matrices and vectors is error prone, tedious and time consuming. Furthermore, developing high performance code by hand for complicated problems is not trivial. A number of efforts are currently under way to address the gulf between performance and generality in scientific software design (several of which are listed in [7]). An approach to reconciling mathematical expressiveness and generality with performance is automated code generation using a compiler for variational forms [6,7,8]. A domain specific language can be created which mirrors the standard mathematical notation for variational methods, thereby providing a high degree of expressiveness, and a compiler can be used to generate low-level code from the high-level input. The compiler approach permits different strategies for representing element matrices and vectors [6, 10] and various optimisation approaches can be employed. In particular, optimisations can be employed that are not tractable in hand-written code [6, 8]. In this work, we will present generalisations of the FEniCS Form Compiler (FFC) [6, 8, 13] for extended finite element methods. Firstly though we illustrate the compiler approach for a conventional continuous problem.
For the weighted Poisson equation on the domain Ω R d , 1 d 3 with homogeneous Dirichlet boundary conditions, the variational form of the problem reads: given sufficiently regular functions w : Ω R , and f : Ω R , find u H 0 1 ( Ω ) such that
a ( v , u ) = L ( v ) v H 0 1 ( Ω ) ,
where
a ( v , u ) = Ω w v · u d Ω ,
L ( v ) = Ω v f d Ω .
The term a ( v , u ) is known as the “bilinear form” and L ( v ) is known as the “linear form”. A finite element formulation of this problem follows from replacing the function space H 0 1 ( Ω ) by a suitable finite element space V H 0 1 ( Ω ) . If we choose a continuous piecewise linear Lagrange finite element basis in three dimensions ( d = 3 ) on tetrahedra,
V = { v H 0 1 ( Ω ) , v | Ω e P 1 ( Ω e ) e } ,
where Ω e is a cell of the triangulation of Ω and P 1 is space of standard linear Lagrange shape functions on a tetrahedron. The input to the form compiler FFC for this variational problem reads:
element = FiniteElement("Lagrange", "tetrahedron", 1)
v = TestFunction(element)
u = TrialFunction(element)
w = Function(element)
f = Function(element)
a = w*dot(grad(v), grad(u))*dx
L = v*f*dx
	 
In this example, element defines the finite element space, v and u are the test and trial functions, respectively, and w and f are supplied functions. It is assumed in the above input that w and f come from the finite element space V or will be interpolated in V. The bilinear form is denoted by a, and the linear form is denoted by L. A number of operators, such as the inner product between two vector-valued functions and the gradient are employed. Integration over a cell is indicated by *dx. In FFC, integration over external facets is denoted by *ds and integration over internal facets is denoted by *dS. The form compiler FFC is developed in Python, which makes it easily extensible.
The form code can be entered into a text file, and FFC can be called from the command line to generate C++ code from this input. The generated code conforms to the Unified Form-assembly Code (UFC) specification [14, 15] and serves as input to any assembly library which supports the UFC interface, such as DOLFIN [7, 16]. Alternatively, the above input to the form compiler code can be included in the Python interface of DOLFIN which will then use just-in-time complication to generate and compile C++ code on demand. A detailed explanation and a range of examples can be found in Logg et al. [7].

3. Extended Finite Element Method: Review

The partition-of-unity property of finite element shape functions can be exploited to extend a finite element basis with arbitrary functions, as formulated in the works of Melenk et al. [1] and Babuska et al. [17]. The partition-of-unity property was utilised by Belytschko et al. [18] to extend locally a finite element basis with functions coming from the near-tip solution to linear elastic fracture mechanics problems, and in Moës et al. [2] a discontinuous function was introduced to model the jump in the displacement field across a crack surface away from the crack tip in a linear elastic body. Crucially, discontinuous functions which are independent of the underlying finite element mesh structure can be incorporated into the finite element basis, thereby permitting the resolution of discontinuities across paths which are not aligned with the structure of the mesh. While the extended finite element method can be applied to a variety of problems (see for example [3]), we restrict our attention to automated code generation for problems that involve discontinuous solutions across surfaces and for which the flux (traction) is prescribed on the discontinuity surface [19].

3.1. Incorporating Discontinuities into Finite Element Spaces

Consider a domain Ω which is crossed by a discontinuity surface Γ d , as illustrated in Figure 1 (for simplicity we show a body which is completely crossed by a discontinuity surface, but it also possible to consider bodies which are not bisected by a discontinuity surface, and we will do so for the examples presented in Section 5.). The domains on different sides of the discontinuity surface are denoted by Ω - and Ω + such that Ω - Ω + Γ d = Ω . The unit normal vector n on Γ d is defined such that it points towards Ω + , as illustrated in Figure 1.
We wish to represent functions which are continuous on Ω \ Γ d and exhibit jumps across the surface Γ d . Such a function u can be expressed in terms of continuous functions and a jump function by
u = u ¯ + H d u ^ ,
where u ¯ and u ^ are defined on Ω and are continuous, and H d is the Heaviside function centred on the discontinuity surface Γ d and is defined such that H d ( x ) = 1 if x Ω + and H d ( x ) = 0 if x Ω - . The jump in u across the surface Γ d , denoted by u = u + - u - , and is equal to u ^ for x Γ d . The jump may or may not be required to go to zero on Γ d . In the context of a crack, Γ d is the crack tip.
Figure 1. Domain Ω R 2 crossed by a discontinuity surface Γ d .
Figure 1. Domain Ω R 2 crossed by a discontinuity surface Γ d .
Algorithms 02 01008 g001
The Heaviside function can be built into a finite element basis by exploiting the partition-of-unity property of the finite element shape functions. A regular finite element function u h is expressed in terms of the finite element shape functions { ϕ i } and the nodal degrees of freedom { u ¯ i } ,
u h = i ϕ i u ¯ i .
A finite element function which exhibits a jump across the surface Γ d can be represented by adding the Heaviside function to the finite element basis,
u h = i ϕ i u ¯ i + i H d ϕ i u ^ i
where u ^ i are “enriched” degrees of freedom and are associated with the field u ^ in Equation (5). The expression in (7) will in general lead to a linear dependency if used in a finite element formulation, since away from a discontinuity surface the Heaviside function is a constant over a finite element cell, and the regular finite element basis contains constant functions. This linear dependency can be obviated as follows: enriched degrees of freedom u ^ i at node i are active only if the support of the shape function ϕ i is intersected by a discontinuity surface. Formally,
u h = i ϕ i u i + i { ψ i } ϕ i u ^ i
where { ψ i } = H d if the support of ϕ i is intersected by a discontinuity surface, otherwise { ψ i } = . The extra degrees of freedom are therefore localised to the small region around the discontinuity surface and eliminated elsewhere.

3.2. Example: Poisson Equation

We consider a Poisson problem and deliberately phrase the problem in a mathematically concrete and abstract fashion as we wish our domain specific language, which we will use to define the input to the form compiler, to inherit this syntax. The Poisson problem on Ω, with the boundary Γ = Ω partitioned such that Γ g Γ h ¯ = Γ and Γ g Γ h = , involves finding u such that:
- Δ u = f in Ω ,
u = 0 on Γ g ,
u · n = h on Γ h ,
u + · n = q on Γ d ,
u · n = 0 on Γ d ,
where f : Ω R a sufficiently regular source term, g : Γ g R and h : Γ h R are the prescribed boundary conditions, q is the flux across the discontinuity surface. The flux may be prescribed or it may be determined via a constitutive model. The jump operator is defined as a = a + - a - . Equation (13) therefore implies continuity of the flux across the surface Γ d .
Assuming that the flux on the discontinuity surface is given by q = q ( u ) , the variational formulation of this problem reads: find u V such that
Ω \ Γ d v · u d Ω + Γ d v q ( u ) d Γ = Ω v f d Ω , + Γ h v h d Γ v V ,
where
V = { v L 2 ( Ω ) H 1 ( Ω \ Γ d ) : v = 0 on Γ g } .
We wish to construct a finite-dimensional counterpart of this problem using finite element basis functions without requiring that the triangulation of Ω conform in any way to the discontinuity surface. We can do this by decomposing the finite element solution u h along the same lines as Equation (5):
u h = u ¯ h + H d u ^ h .
Decomposing the weight function v similarly, the variational problem can be expressed equivalently as: find u ¯ h V ¯ and u ^ h V ^ such that
Ω v ¯ · u ¯ d Ω + Ω + v ¯ · u ^ Ω + Ω + v ^ · ( u ¯ + u ^ ) d Ω + Γ d v ^ q ( u ^ ) d Γ = Ω v ¯ f d Ω + Ω + v ^ f d Ω + Γ h v ¯ h d Γ + Γ h + v ^ h d Γ v ¯ V ¯ , v ^ V ^ ,
where Γ h + = Γ h Ω + . The task now is to generate a suitable finite element space. Following from the expression for u h in Equation (8), we define the finite element spaces
V ¯ { = u ¯ H 1 ( Ω ) , u ¯ | Ω e P k 1 ( Ω e ) e : u = 0 on Γ g } ,
V ^ = { u ^ H 0 1 ( Ω d ) , u ^ | Ω e P k 2 ( Ω e ) e Ω d : u ^ = 0 on Γ g Ω + } ,
where Ω d Ω is a “small” region around the discontinuity surface Γ d . More precisely, Ω d as the union of the supports of all basis functions whose support is intersected by the discontinuity surface. The extended finite element formulation for the Poisson equation is now complete. In the definition of the finite element spaces, we have deliberately permitted the use of different order functions for u ¯ h and u ^ h since it will be straightforward using the form compiler to generate code for k 1 k 2 . For the examples presented in Section 5., it is assumed that k 1 = k 2 and that the solution goes to zero on the boundary, therefore we will use the compacter notation
V = { v h L 2 ( Ω ) H 0 1 ( Ω \ Γ d ) , v h | Ω e P k ( Ω e \ Γ d ) e }
for a finite element function v h V , which is discontinuous across surfaces when defining the examples.
The extended finite element problem can be expressed as a system of linear equations
K u = f ,
which in an expanded format for the case q = k u , where k is a positive constant, reads
Ω B ¯ T B ¯ d Ω Ω d + B ¯ T B ^ d Ω Ω d + B ^ T B ¯ d Ω Ω d + B ^ T B ^ d Ω + Γ d N ^ k N ^ d Γ u ¯ u ^ = Ω N ¯ T f d Ω Ω d + N ^ T f d Ω ,
where B ¯ and B ^ contain derivatives of the shape functions { ϕ ¯ i } and { ϕ ^ i } , respectively, N ¯ and N ^ contain shape functions, and u ¯ and u ^ contain the degrees of freedom. Usually, the same finite element basis will be used for the regular and enriched components ( k 1 = k 2 in Equations (18) and (19)), in which case B ¯ = B ^ and N ¯ = N ^ . Details of the matrix formulation and some practical aspects can be found in [19].

4. Automated Modelling of Discontinuities

The development of our automated approach for extended finite element methods can be broken down into three keys parts. Firstly, the domain-specific language for variational forms which we have outlined in Section 2. requires extension. It is necessary that finite element spaces with discontinuities across surfaces can be represented and that terms can be evaluated and integrated on discontinuity surfaces. Secondly, the form compiler must be able to translate the high-level input into low-level computer code that can perform the tasks required at the innermost assembly loop of a finite element program, namely computing the element matrices and vectors. For this, we have extended the form compiler FFC [6, 13]. The third component is the solver. We have constructed a solver on top of the C++/Python library DOLFIN [7, 16]. It is at the solver level that discontinuity surfaces are represented, coefficients of finite element functions that appear in forms (such as w in the case of the weighted Poisson equation) are supplied to the assembler and that the global system of linear equations is assembled and solved. We describe each of the three key software library components in this section. The implementation of the form compiler and the solver components which support the extended finite element method are available in the supporting material [12].
As already alluded, automated code generation offers a number of interesting possibilities. For example, it is possible to employ representations of finite element matrices and vectors which cannot be reasonably coded by hand. As an example, standard element matrices and vectors can be expressed using a “tensor contraction” approach [6] which involves extensive “pre-computation” (prior to runtime), instead of the conventional quadrature-loop representation. Different representations can lead to dramatic differences in performance. The relative performance of different representations depends heavily on the nature of the differential Equation [6, 10]. At first inspection, for the extended finite element method we are limited in terms of possible representations. This is due to the discontinuity surface being defined globally in terms of the real coordinates, unlike shape functions which are usually defined on reference cells. This eliminates the possibility of using certain approaches, such as the tensor contraction approach, which rely on all functions being defined on a reference element. Deeper inspections may yield interesting possibilities, but for now we limit ourselves to the automated generation of code which uses the conventional quadrature representation. Even for quadrature representations, special optimisations through automation can be applied, for example the automated rearrangement of loops which can have dramatic performance consequences beyond those which can be realised by modern generic compiler optimisations [10]. Automation is particularly amenable to specialised performance optimisations, which is not only because of the possibility of employing special strategies but also the simple regeneration of the code for a particular problem by following improvement to the form compiler.

4.1. Domain-Specific Language Extensions

In the domain-specific language used by the form compiler FFC, we need to include discontinuous finite element function spaces, various operators at discontinuity surfaces and integration over discontinuity surfaces. Inspired by the decomposition of the displacement field in (5), we define “continuous” and “discontinuous” function spaces which will correspond to u ¯ h and u ^ h , respectively, and a mixed space is then defined as the sum of the two,
elem_cont     = FiniteElement(type, shape, order)
elem_discont  = DiscontinuousFiniteElement(type, shape, order)
element       = elem_cont + element_discont
	
where type is the finite element type e.g. “Lagrange”, “discontinuous Lagrange” (discontinuous across cell facets), or “Raviart-Thomas”, among others, shape defines the shape of the finite element cell (“interval”, “triangle” or “tetrahedron”) and order is the order of the finite element basis (which is arbitrary). A finite element space which is suitable for modelling problems with discontinuous solutions has been created from the sum of the continuous and discontinuous element spaces. Not all FFC supported finite element spaces are currently compatible with the extended finite element implementation. We will focus on arbitrary order continuous Lagrange elements.
Once the finite element spaces have been defined, test, trial and other functions can be defined on the appropriate spaces. For the Poisson equation presented in Section 3.2., we define the test and trial functions, v and u, respectively, and the source function f,
	v = TestFunctionPUM(element)
	u = TrialFunctionPUM(element)
	f = Function(elem_cont)
	
The test and trial functions have been defined on the space of functions containing a discontinuity and the source function f is defined on a continuous finite element space.
FFC provides a number of operators for computing terms such as inner products, gradients, the divergence and the transpose [6, 7, 13]. It is possible to use compact tensor or index notation. In the context of the extended finite element method, we define some operators which act at discontinuity surfaces. A common operation at a discontinuity surface is the computation of the jump in the field across the surface. For this, we provide the operator djump(u) which is equivalent to u + - u - , and the operator ljump(u, n) which returns the jump in the vector u + - u - , but with the components of the jump relative to the local n - s coordinate system in which the n-direction is normal to the discontinuity surface and the s-direction is tangential to the discontinuity surface. Another ingredient is integration over discontinuity surfaces which is denoted by *dc. The range of operators at discontinuity surfaces is currently limited. More elaborate operators, akin to those already available on cell facets [8], are under development.
We have now introduced the necessary language elements to represent a finite element variational formulation of the Poisson problem with a discontinuous solution across a surface and a flux acting at the discontinuity surface which is a function of the solution jump, as presented in Equation (14). For a quadratic Lagrange basis, and the constitutive model for the discontinuity surface flux q = k u where k 0 is a constant, the form compiler input for this problem reads:
# Finite element spaces
elem_cont    = FiniteElement("Lagrange", "triangle", 2)
elem_discont = DiscontinuousFiniteElement("Lagrange", "triangle", 2)
element      = elem_cont + elem_discont
 
# Test and trial functions
v = TestFunctionPUM(element)
u = TrialFunctionPUM(element)
 
# Source term
f = Function(elem_cont)
 
# Interface flux parameter
k = Constant("triangle")
 
# Bilinear and linear forms
a = dot(grad(v), grad(u))*dx + k*djump(v)*djump(u)*dc
L = v*f*dx
	
The bilinear form is denoted by a and the linear form is denoted by L. The extended FFC can be called from the command line to generate C++ code from this high-level input. The input to the form compiler mirrors the mathematical formulation of the problem, thereby detaching the mathematical problem from the implementation details. This can dramatically reduce the time required to develop and test new models.

4.2. Specialised Generated Code

From the high-level input, low-level code which is specific to the considered equation is automatically generated by the form compiler. FFC generates C++ code which conforms to the Unified Form-assembly Code (UFC) specification [14, 15] (the generated code conforms to the upcoming version 1.2 of UFC). The UFC specification is a C++ interface for the assembly of variational forms and provides a specification against which automated code generators can work. An assembler that supports the UFC specification can therefore assemble the global matrices and vectors from the generated code without modification.
In the context of the extended finite element method, the computation of element matrices and vectors, and the degree of freedom maps are affected by the discontinuity surfaces. To exploit the UFC specification, we follow a standard C++ polymorphic design and generate subclasses of the classes defined in the UFC specification. The automatically generated classes are initialised with a GenericPUM object (the design of this object is described later in the section) which provides the data which is dependent on the presence of discontinuity surfaces and is necessary to build element matrices and vectors for the extended finite element method. The member functions of the generated code which are called during assembly are part of the UFC specification, which is why the global system of equations can be assembled by any assembly code which supports the specification. We outline some key elements of the automatically generated code and describe their purpose. A number of other utility classes and functions in addition to those which we will describe are also generated, such as functions for evaluating basis functions and their derivatives at arbitrary points.
The key classes generated by the form compiler address the degree of freedom maps, cell integrals (which include integration over a discontinuity surface within a cell) and forms, which represent mathematical variational forms. At the highest level of abstraction, given an object pum, forms are created. For example, for the Poisson equation, classes which represent the bilinear and linear forms are generated,
  UFC_PoissonBilinearForm a(pum);
  UFC_PoissonLinearForm L(pum);
	
Forms are self-aware of various properties, such as their rank, and are able to create the relevant degree of freedom maps, integral objects and finite elements. Forms are the main interface through which an application developer interacts with the automatically generated code. A generated form is a subclass of the UFC class ufc::form. Typically, a form is passed together with a matrix/vector and a mesh to an assembler to build the global matrix/vector. A form object is also able to create degree of freedom maps (which are subclasses of the UFC class ufc::dof_map). For the Poisson example, the form compiler will generate code for a class from which an object is created by
  Poisson_dof_map_0 dof_map(pum);
	
This object is able to tabulate the degree of freedom map for a given cell. The degree of freedom map is aware of the discontinuity and the extra “enriched” degrees of freedom via the object pum. Degree of freedom map classes can perform various tasks, as defined in the UFC specification. The numeral in the class name is a convention in the generated code which indicates the particular degree of freedom map. Problems with multiple fields will involve multiple maps. However, the user is not exposed to this as the degree of freedom maps are accessed via the higher-level form object. This naming convention is followed for other generated classes.
Objects which are able to compute an element matrix or vector are generated by the compiler and are subclasses of ufc::cell_integral from the UFC specification. A cell integral object for a Poisson problem can be created by
  Poisson_cell_integral_0 cell_integral(pum);
	
For each form that appears in a problem (usually there is one bilinear form and one linear form), there will typically be a cell integral class. The key member function of the cell integral class is a “tabulate” function which computes the element matrix/vector. The tabulate function is supplied with a finite element cell and any coefficient functions in the variational problem, and the element matrix or element vector is computed. It is in the implementation of cell integrals and degree of freedom maps that aspects of the extended finite element method in the generated code are most evident. The form compiler determines the appropriate order of quadrature for an integral based on the operators and functions appearing in the form. There are also facilities for specifying the quadrature order manually.
In addition to code for computing degree of freedom maps and tabulating element matrices and vectors, tools which are useful for post-processing are also generated. Most prominent among these are tools for interpolating an extended finite element solution in a continuous space for visualisation purposes.
An important feature of the design of the generated code is that it is independent of the method by which discontinuity surfaces are represented. This emphasises the separation of the mathematical definition of the problem and implementation aspects.
At this stage, limited attention has been paid to specialised optimisations which are possible with automated code generation. There may be considerable scope for this, as reported in [6, 10]. Automated optimisations are particularly pertinent to problems which involve multiple fields, possibly from different finite element spaces and which may or may not be discontinuous, as developing optimised code for such problems is difficult and time consuming.

4.3. Solver Environment

The key tasks of the solver environment are to make use of the generated code, provide representations of discontinuity surfaces, and manage the local extension of the finite element function space and the resulting changes to the number of degrees of freedom. The solver is also responsible for a range of standard tasks, such as linear algebra data structures, linear solvers, application of Dirichlet boundary conditions, mesh management and input/output. The necessary solver components are developed as extensions to the library DOLFIN [7, 16], which is designed to interact with automated code generators. The solver environment facilitates the use of generated code, therefore we provide an overview only.

Surface representation

Surfaces across which finite element functions are discontinuous are represented by the Surface class. The interface to Surface is designed such that other parts of the library and the generated code are unaffected by the method with which a surface is represented internally. We presently work with simple representations of surfaces, with the initial discontinuity surface represented by a mathematical function. This is not the most general approach as surfaces cannot “double back”, but it does permit a wide range of quite elaborate initial discontinuity paths to be considered. In two dimensions, a discontinuity surface (a line) is represented by a user-defined function and the start and end points. In three dimensions, the surface is represented using two level set functions, ϕ and ψ, where for a point on the surface ϕ = 0 and ψ < 0 . In both two and three dimensions, the functions used to describe the surface make use of the Function abstraction in DOLFIN. The interface to the class Surface is designed such that it is dimension-independent.
Once a Surface has been created, it can perform a range of geometric tasks, such as determining on which side of the surface a given point lies, finding the intersection point of a straight line and the surface, determining whether a cell is intersected by the surface and computing the ratio between the volumes of an intersected cell on either side of the surface. The design can be extended as extra functionally is required. Multiple surfaces can be stored in standard STL containers, which is useful when dealing with multiple discontinuities. When a crack grows, the surface object which represents the crack surface simply needs to be updated.
The Surface interface is not exposed in the generated code, which enforces the desirable separation between the generated code and the surface representation. Rather, only the GenericPUM interface, which is described below, is exposed in the generated code. Details of the surface representation can be changed without disruption to other parts of the code. A user can define their own surface representation without needing to modify the form compiler.

Interface to the generated code and local extension of the finite element basis management

The local extension of the finite element basis is controlled by an object derived from the abstract base class GenericPUM. Its task is to manage aspects related to the partition of unity approach. The base class GenericPUM provides an interface for interacting with the generate code. Key tasks of a GenericPUM-based object include the evaluation of the Heaviside function at arbitrary points, computing quadrature schemes for intersected elements based on an input reference scheme which is provided by the generated code and managing which nodes have enriched functions attached. Each discontinuous field in a problem has an associated GenricPUM object. For example, for a three-dimensional elasticity problem, there will be a GenricPUM object associated with each of the three fields If GenricPUM objects are the same for each field, then they can be shared. Partition of unity related data which is required by the generated code is accessed exclusively through the GenricPUM public interface.
For modelling discontinuities, we define an object PUM, which is a subclass of GenericPUM and is initialised with the discontinuity surfaces, a mesh and the standard degree of freedom map (a map for the standard degrees of freedom),
   std::vector<const Surface*> surfaces;
   PUM pum(surfaces, mesh, standard_dof_map);
	
When a discontinuity surface evolves, the PUM object simply needs to be updated to reflect the change.
An important feature of GenericPUM-based objects is that the public interface is designed such that it only involves arguments and return variables that are standard C++ types or part of the UFC specification. This is important as it allows a PUM object to act as the “glue” between the generated code and different finite element libraries. A user of any library which supports UFC can use the generated code by just providing their own sub-class of GenericPUM.
To ensure that the jump in a solution goes to zero at the boundary of a discontinuity surface which does not intersect the boundary of the domain, the enriched degrees of freedom are carefully selected close to the boundary of a discontinuity surface, as described in [19].

Function spaces and variational forms

We are now in a position to define function spaces and variational forms which are represented by the DOLFIN classes FunctionSpace and Form, respectively. A FunctionSpace represents the mathematical function space within which a solution is sought, such as those defined in Equation (20) which describe the type of finite element functions. A FunctionSpace is also aware of the domain Ω and the degree of freedom map (which in part defines the regularity of the function space). A Form is defined by the variational problem and the relevant function space(s). A Form can be assembled into a global matrix (in the case of a bilinear form) or a global vector (in the case of a linear form). These concepts and abstractions are explained in detail in [7] for conventional finite element methods. For the Poisson problem presented in Section 3.2., a function space, and bilinear and linear forms are created by
 Poisson::FunctionSpace V(mesh, pum_objects);
 Poisson::BilinearForm a(V, V);
 Poisson::LinearForm L(V);
	
with the form objects being initialised with function spaces. The code for the above function space and form classes is generated by the form compiler. The form classes are essentially wrappers for the UFC_PoissonBilinearForm and UFC_PoissonLinearForm objects and are created to simply the interaction with the DOLFIN environment. For a problem with multiple fields, such as three-dimensional incompressible elasticity, a PUM object is associated with each field (one for each displacement component plus one for the pressure field), therefore to create a function space we would have
std::vector<const GenericPUM*> pum_objects;
pum_objects.push_back(&pum_u);
pum_objects.push_back(&pum_u);
pum_objects.push_back(&pum_u);
pum_objects.push_back(&pum_p);
 
Incompressible3D::FunctionSpace V(mesh, pum_objects);
	
Since the displacement components are all discontinuous across the same surface and they share the same finite element type, they can share the same PUM object. Usually the finite element field used for the pressure field differs from that used for the displacement components, therefore it requires its own PUM object. An incompressible elasticity formulation is elaborated in Section 5..
With the exception of Dirichlet boundary conditions, the finite element variational problem is completely defined by the Form objects and the mesh. They can be passed to the assembler to compute the global matrix and vector.
Matrix A;
Vector b;
Assembler::assemble(A, a);
Assembler::assemble(b, L);
	
Once the global matrix and vector have been assembled, Dirichlet boundary conditions can be applied to the linear system if necessary, and the system of linear equations can be solved as usual.

5. Examples

A number of examples are presented in this section to demonstrate various aspects of the automated modelling approach for simulating discontinuities. To avoid lengthy and intricate definitions of case-specific function spaces, the variational form of each example is presented for the case of homogeneous Dirichlet boundary conditions, despite the computed problems using more elaborate boundary conditions. For each example we define the forms a and L, and the function space V. The form compiler input is listed in this section for each example and the complete code for each example is available in the supporting material [12]. All parameters which we use are non-dimensional.
The presented examples are linear, although the code generation approach can be used equally for nonlinear problems (see [7]).

5.1. Weighted Poisson Equation

We consider first the weighted Poisson with discontinuities in the solution u across the surfaces Γ d and fluxes acting on the discontinuity surfaces. The bilinear and linear forms associated with this problem read:
a u h , v h = Ω \ Γ d w h v h · u h d Ω + Γ d v h k u h d Γ ,
L ( v h ) = Ω v h f d Ω ,
where f is the source term and w h is the interpolant of the supplied weighting function w in a finite element space. The flux across the discontinuity surface is q d = k u , where k > 0 . The relevant finite element function space is given in Equation (20). The form compiler input for an extended finite element formulation of this problem is shown in Figure 2 for the case of quadratic basis functions on triangular cells.
Figure 2. Form compiler input for the weighted Poisson equation with discontinuous u.
Figure 2. Form compiler input for the weighted Poisson equation with discontinuous u.
Algorithms 02 01008 g002
We present computed results using the form compiler input in Figure 2 for the case Ω = ( 0 , 1 ) × ( 0 , 1 ) , f = 1 , w = 1 + e x 2 and k = 10 . Dirichlet boundary conditions are applied along the bottom and top edges ( u h = 0 for y = 0 and u h = 1 for y = 1 ) of the domain. Along the sides of the domain ( x = 0 and x = 1 ) a zero flux condition is applied. Three disjoint discontinuity surfaces are included in the domain. Precise details of the crack paths can be found in the supporting material [12]. Having compiled the input file with the form compiler, the generated C++ code serves as input for the solver, which is where the discontinuity surface is defined. For this problem, an extract of the C++ program is shown in Figure 3. The code for the objects Poisson::BilinearForm, Poisson::LinearForm and Poisson::PostProcess has been generated by the form compiler. The other elements of the code which appear in Figure 3 are reusable components which are independent of the considered equation. The computed results for this problem are presented in Figure 4 which shows the discontinuity surfaces, which are not aligned with the mesh, and contours of the solution field in which the jumps in the solution across the discontinuity surfaces can be observed.
Figure 3. C++ code extract for the two-dimensional weighted Poisson problem with discontinuities in the solution.
Figure 3. C++ code extract for the two-dimensional weighted Poisson problem with discontinuities in the solution.
Algorithms 02 01008 g003
Figure 4. Weighted Poisson problem in two dimensions: (a) mesh and discontinuity surfaces and (b) solution contours.
Figure 4. Weighted Poisson problem in two dimensions: (a) mesh and discontinuity surfaces and (b) solution contours.
Algorithms 02 01008 g004
Figure 5. Form compiler input for a three-dimensional linear elasticity problem with discontinuous u.
Figure 5. Form compiler input for a three-dimensional linear elasticity problem with discontinuous u.
Algorithms 02 01008 g005

5.2. Three-dimensional elasticity

For a linear elasticity problem with homogeneous Dirichlet boundary conditions and traction-free discontinuity surfaces, the bilinear and linear forms read:
a ( v h , u h ) = Ω \ Γ d v h : C : s u h d Ω ,
L ( v h ) = Ω v h · f d Ω ,
where C is the elasticity tensor, s ( · ) = ( 1 / 2 ) ( ( · ) + ( ( · ) ) T ) is the symmetric gradient and f is the body force vector. For this problem, the relevant finite element space reads
V = { v ( L 2 ( Ω ) ) d ( H 0 1 ( Ω \ Γ d ) ) d , v | Ω e ( P k Ω e \ Γ d ) d } .
The form compiler input for this problem in three dimensions using linear tetrahedral elements is shown in Figure 5. The input is dimension independent; “tetrahedron” can simply be changed to “triangle” to change from three dimensions to two dimensions.
A computation has been performed for a unit cube Ω = ( 0 , 1 ) × ( 0 , 1 ) × ( 0 , 1 ) , with two discontinuity surfaces. The displacement is prescribed on the top and bottom faces of the cube ( u h = 0 for z = 0 and u h = ( 0 , 0 , 1 ) for z = 1 ) and all other faces are traction-free, no body force is applied ( f = 0 ), Young’s modulus E = 2 × 10 4 and Poisson’s ratio ν = 0 . 2 . As with the previous example, descriptions of the discontinuity surfaces can be found in the supporting material [12]. The surfaces and the computed displacement contours are illustrated in Figure 6. As expected, the presence of the discontinuity surfaces is reflected in the contours of the magnitude of the displacement field across the discontinuity surfaces.
Figure 6. Three-dimensional elasticity problem. The mesh on the surface of the cube is shown in (a) and the displacement magnitude contours are shown in (b). The discontinuity surfaces are visible in both figures.
Figure 6. Three-dimensional elasticity problem. The mesh on the surface of the cube is shown in (a) and the displacement magnitude contours are shown in (b). The discontinuity surfaces are visible in both figures.
Algorithms 02 01008 g006

5.3. Incompressible elasticity with cohesive discontinuity surfaces

Incompressible elasticity (or Stokes flow) is usually posed as a mixed problem with the displacement and pressure fields as unknowns. In the context of finite element analysis, stability requirements pose restrictions on the allowable combination of finite element spaces for the displacement and pressure fields. For example, it is well known that using equal order Lagrange basis functions for the displacement and pressure fields leads to an unstable formulation. The Taylor-Hood family of elements are examples of stable elements for incompressible elasticity, and involve a continuous piecewise quadratic basis for the displacement field and continuous piecewise linear basis for the pressure field on simplices. A common criticism of Taylor-Hood elements is that they are difficult to implement due to the different order basis functions. If this objection is accepted, it is compounded when considering discontinuous solutions. One has to deal with not only different basis functions, but also the enriched degrees of freedom for the discontinuous fields. Furthermore, one may wish to use, and perhaps switch between, combinations of continuous and discontinuous fields. At the very least, these issues require careful software design. The complexity argument is completely obviated by automated code generation as one can use arbitrary combinations of basis functions trivially, as well as switch between combinations of continuous and discontinuous functions with minimal effort, as we will illustrate. Incompressible elasticity serves as a demonstration of the ease with which multi-physics problems can be dealt with using automated code generation.
We consider two incompressible elasticity formulations, both involving a displacement field which is discontinuous across surfaces. The first formulation involves a pressure field which is permitted to be discontinuous across surfaces, and the second formulation involves a pressure field which is continuous across surfaces. In both cases, the problem is expressed abstractly as: find u h V and p h Q such that
a ( v h ; q h , u h ; p h ) = L ( v h ; q h ) v h V , q h Q .
For a problem with homogeneous Dirichlet boundary conditions on the displacement, the bilinear and linear forms read:
a ( v h ; q h , u h ; p h ) = Ω \ Γ d v h · 2 μ s u h - ( · v h ) p h + q h · u h d Ω + Γ d v h · t d Γ ,
L ( v h ; q h ) = Ω v h · f d Ω ,
where μ is the shear modulus, t is the traction acting on the discontinuity surface and f is a source term.
For the case in which both the pressure and displacement fields are discontinuous across a discontinuity surface, the relevant functions spaces for the Taylor-Hood element read
V = { v ( L 2 ( Ω ) ) d ( H 0 1 ( Ω \ Γ d ) ) d , v | Ω e P 2 ( Ω ) \ Γ d ) d e } ,
Q = { p L 2 ( Ω ) H 1 ( Ω \ Γ d ) , p | Ω e P 1 ( Ω \ Γ d ) e } .
For the case in which the displacement field is discontinuous and the pressure field is continuous, the pressure space Q requires re-definition:
Q = { p H 1 ( Ω ) , p | Ω e P 1 ( Ω ) e } .
The difference between the two formulations is subtle. Inspection of the Euler-Lagrange equations associated with the variational forms shows that in both cases
( 2 μ s u + - p + I ) n + = t ,
( 2 μ s u - - p - I ) n - = t ,
which implies that weak continuity of the traction across discontinuity surfaces is enforced. For the continuous pressure case, this can be rephrased as enforcing
2 μ s u n + = 0
in a weak sense, which is the viscous part of the traction (continuity of pressure contribution is enforced point-wise by construction). For the discontinuous pressure case we have
2 μ s u - p I n + = 0 ,
which implies weak continuity of the total traction across the discontinuity surface. There is also a subtle difference between the two formulations in terms of how the incompressibility constraint is enforced, but since the Taylor-Hood element does not enforce · u = 0 element-wise, this is unlikely to be of consequence.
We now show how one can switch trivially between discontinuous and continuous pressure formulations with a Taylor-Hood element using the form compiler. For a problem in which the traction acting on the discontinuity surface is made a function of the displacement jump across the surface according to
t = t n t s = K n n 0 0 K s s u h n u h s ,
Figure 7. Form compiler input for incompressible elasticity with discontinuous u and p.
Figure 7. Form compiler input for incompressible elasticity with discontinuous u and p.
Algorithms 02 01008 g007
where the subscripts “n” and “s” denote normal and tangential components relative to the discontinuity surface, the form compiler input for the problem with discontinuous pressure is shown in Figure 7.
A quadratic Lagrange vector function space and a linear Lagrange function space, both of which include discontinuities, are defined and these are used for the displacement and pressure fields, respectively. The two spaces are combined to create a Taylor-Hood element and the definition of the variational forms follows directly from Equations (29) and (30). To switch to a formulation with continuous pressure, only the function spaces in the input to the form compiler, shown in Figure 7, need to be changed. The form compiler declarations of the function spaces for a Taylor-Hood formulation with a discontinuous displacement field and a continuous pressure field are shown in Figure 8.
Using both formulations, a two-dimensional domain with sides of unit length and an internal cut-out section has been modelled. Two discontinuity surfaces are present. The displacement is prescribed on the bottom edge ( u h = 0 for y = 0 ) and the top edge ( u h = ( 0 , 1 ) for y = 1 ). All other faces are traction-free. The shear modulus μ = 1 and for the interface traction K n n = 2 and K s s = 0 . The computed pressure fields are shown in Figure 9. It appears from inspection of the results that differences between the two simulations are small, as expected based on the examination of the Euler-Lagrange equations for the two problems.
Figure 8. Function space definitions for the form compiler input for incompressible elasticity with discontinuous u and continuous p. The definition of the functions and forms is identical to that in Figure 7.
Figure 8. Function space definitions for the form compiler input for incompressible elasticity with discontinuous u and continuous p. The definition of the functions and forms is identical to that in Figure 7.
Algorithms 02 01008 g008
Figure 9. Pressure fields for (a) the continuous pressure case and (b) the discontinuous pressure case.
Figure 9. Pressure fields for (a) the continuous pressure case and (b) the discontinuous pressure case.
Algorithms 02 01008 g009

6. Conclusions

We have demonstrated an automated code generation approach for the extended finite element method. A domain-specific language has been extended so that the equation of interest, in a variational format, can be expressed in a high-level language, and low-level C++ code is automatically generated through the form compiler. The approach facilitates the rapid development of new models that involve discontinuities and provides scope for special optimisations not tractable by hand. Furthermore, expressing the equation of interest in an abstract form provides separation between the considered model (the differential equation and the function spaces) and aspects of the implementation. In practice, the approach reduces the implementation burden for developers. A number of concrete examples have been presented in which problems that involve multiple fields with different finite element bases are addressed. The input language is extensible, so a wider range of discontinuity-specific operators can be developed to deal with a wider range of problems.

Acknowledgements

MN acknowledges the support of the Netherlands Technology Foundation STW, the Netherlands Organisation for Scientific Research and the Ministry of Public Works and Water Management.

References

  1. Melenk, J. M.; Babuska, I. The partition of unity finite element method: Basic theory and applications. Comput. Method. Appl. Mech. Eng. 1996, 139, 289–314. [Google Scholar] [CrossRef]
  2. Moës, N.; Dolbow, J.; Belytschko, T. A finite element method for crack growth without remeshing. Int. J. Numer. Method. Eng. 1999, 46, 231–150. [Google Scholar] [CrossRef]
  3. Belytschko, T.; N. Moës, S. U.; Parimik, C. Arbitrary discontinuities in finite elements. Int. J. Numer. Method. Eng. 2001, 50, 993–1013. [Google Scholar] [CrossRef]
  4. Strouboulis, T.; Copps, K.; Babuška, I. The generalized finite element method. Comput. Method. Appl. Mech. Eng. 2001, 190, 4081–4193. [Google Scholar] [CrossRef]
  5. Bordas, S.; Nguyen, P. V.; Dunant, C.; Guidoum, A.; Nguyen-Dang, H. An extended finite element library. Int. J. Numer. Method. Eng. 2007, 71, 703–732. [Google Scholar] [CrossRef]
  6. Kirby, R. C.; Logg, A. A compiler for variational forms. ACM Trans. Math. Software 2006, 32, 417–444. [Google Scholar] [CrossRef]
  7. Logg, A.; Wells, G. N. DOLFIN: Automated finite element modelling, 2009. Available online: http://www.dspace.cam.ac.uk/handle/1810/214787.
  8. Ølgaard, K. B.; Logg, A.; Wells, G. N. Automated code generation for discontinuous Galerkin methods. SIAM J. Sci. Comput. 2008, 31, 849–864. [Google Scholar] [CrossRef]
  9. Rognes, M. E.; Kirby, R. C.; Logg, A. Efficient assembly of H(div) and H(curl) conforming finite elements. 2009; Submitted. [Google Scholar]
  10. Ølgaard, K. B.; Wells, G. N. Optimisations for quadrature representations of finite element tensors through automated code generation. ACM Trans. Math. Software 2010, 37. Available online: http://www.dspace.cam.ac.uk/handle/1810/218613. [Google Scholar] [CrossRef]
  11. FEniCS. FEniCS Project 2009. Available online: http://www.fenics.org/.
  12. Nikbakht, M.; Wells, G. N. Supporting material 2009. Available online: http://www.dspace.cam.ac.uk/handle/1810/218650.
  13. Logg, A.; others. FEniCS Form Compiler 2009. Available online: http://www.fenics.org/ffc.
  14. Alnæs, M. S.; Logg, A.; Mardal, K.-A.; Skavhaug, O.; Langtangen, H. P. UFC Specification User Manual. 2009. Available online: http://www.fenics.org/ufc/.
  15. Alnæs, M. S.; Logg, A.; Mardal, K.-A.; Skavhaug, O.; Langtangen, H. P. Unified framework for finite element assembly. Int. J. Computat. Sci. Eng. 2009. Available online: http://simula.no/research/scientific/publications/Simula.SC.96/simula_pdf_file.
  16. Logg, A.; Wells, G. N.; others. DOLFIN 2009. Available online: http://www.fenics.org/dolfin.
  17. Babuška, I.; Melenk, J. M. The Partition of Unity Method. Int. J. Numer. Method. Eng. 1997, 40, 727–758. [Google Scholar] [CrossRef]
  18. Belytschko, T.; Black, T. Elastic crack growth in finite elements with minimal remeshing. Int. J. Numer. Method. Eng. 1999, 45, 601–620. [Google Scholar] [CrossRef]
  19. Wells, G. N.; Sluys, L. J. A new method for modelling cohesive cracks using finite elements. Int. J. Numer. Method. Eng. 2001, 50, 2667–2682. [Google Scholar] [CrossRef]

Share and Cite

MDPI and ACS Style

Nikbakht, M.; Wells, G.N. Automated Modelling of Evolving Discontinuities. Algorithms 2009, 2, 1008-1030. https://doi.org/10.3390/a2031008

AMA Style

Nikbakht M, Wells GN. Automated Modelling of Evolving Discontinuities. Algorithms. 2009; 2(3):1008-1030. https://doi.org/10.3390/a2031008

Chicago/Turabian Style

Nikbakht, Mehdi, and Garth N. Wells. 2009. "Automated Modelling of Evolving Discontinuities" Algorithms 2, no. 3: 1008-1030. https://doi.org/10.3390/a2031008

APA Style

Nikbakht, M., & Wells, G. N. (2009). Automated Modelling of Evolving Discontinuities. Algorithms, 2(3), 1008-1030. https://doi.org/10.3390/a2031008

Article Metrics

Back to TopTop