One-Dimensional Finite Element Methods
One-Dimensional Finite Element Methods
2.1 Introduction
The piecewise-linear Galerkin nite element method of Chapter 1 can be extended in several directions. The most important of these is multi-dimensional problems however, we'll postpone this until the next chapter. Here, we'll address and answer some other questions that may be inferred from our brief encounter with the method. 1. Is the Galerkin method the best way to construct a variational principal for a partial di erential system? 2. How do we construct variational principals for more complex problems? Speci cally, how do we treat boundary conditions other than Dirichlet? 3. The nite element method appeared to converge as O(h) in strain energy and O(h2) in L2 for the example of Section 1.3. Is this true more generally? 4. Can the nite element solution be improved by using higher-degree piecewisepolynomial approximations? What are the costs and bene ts of doing this? We'll tackle the Galerkin formulations in the next two sections, examine higher-degree piecewise polynomials in Sections 2.4 and 2.5, and conclude with a discussion of approximation errors in Section 2.6.
Although the construction of variational principles from di erential equations is an important aspect of the nite element method it will not be our main objective. We'll explore some properties of variational principles with a goal of developing a more thorough understanding of Galerkin's method and of answering the questions raised in Section 2.1. In particular, we'll focus on boundary conditions, approximating spaces, and extremal properties of Galerkin's method. Once again, we'll use the model two-point Dirichlet problem
0<x<1
(2.2.1a) (2.2.1b)
u(0) = u(1) = 0
with p(x) > 0, q(x) 0, and f (x) being smooth functions on 0 x 1. As described in Chapter 1, the Galerkin form of (2.2.1) is obtained by multiplying (2.2.1a) by a test function v 2 H01, integrating the result on 0 1], and integrating the second-order term by parts to obtain
A(v u) = (v f )
where (v f ) = and
8v 2 H01
vfdx
(2.2.2a) (2.2.2b)
Z1
0
A(v u) = (v pu ) + (v qu) =
0 0
Z
0
(v pu + vqu)dx
0 0
(2.2.2c)
1 0
(v )2 + v2]dx:
0
For (2.2.1), a function v is in H01 if it also satis es the trivial boundary conditions v(0) = v(1) = 0. As we shall discover in Section 2.3, the de nition of H01 will depend on the type of boundary conditions being applied to the di erential equation. There is a connection between self-adjoint di erential problems such as (2.2.1) and the minimum problem: nd w 2 H01 that minimizes
I w] = A(w w) ; 2(w f ) =
Z1
0
(2.2.3)
Maximum and minimum variational principles occur throughout mathematics and physics and a discipline called the Calculus of Variations arose in order to study them. The initial goal of this eld was to extend the elementary theory of the calculus of the maxima and minima of functions to problems of nding the extrema of functionals such as I w]. (A functional is an operator that maps functions onto real numbers.) The construction of the Galerkin form (2.2.2) of a problem from the di erential form (2.2.1) is straight forward however, the construction of the extremal problem (2.2.3) is not. We do not pursue this matter here. Instead, we refer readers to a text on the calculus of variations such as Courant and Hilbert 4]. Accepting (2.2.3), we establish that the solution u of Galerkin's method (2.2.2) is optimal in the sense of minimizing (2.2.3). Theorem 2.2.1. The function u 2 H01 that minimizes (2.2.3) is the one that satis es (2.2.2a) and conversely. Proof. Suppose rst that u(x) is the solution of (2.2.2a). We choose a real parameter and any function v(x) 2 H01 and de ne the comparison function w(x) = u(x) + v(x): (2.2.4) For each function v(x) we have a one parameter family of comparison functions w(x) 2 H01 with the solution u(x) of (2.2.2a) obtained when = 0. By a suitable choice of and v(x) we can use (2.2.4) to represent any function in H01. A comparison function w(x) and its variation v(x) are shown in Figure 2.2.1.
u, w w(x) v(x)
u(x)
Figure 2.2.1: A comparison function w(x) and its variation v(x) from u(x). Substituting (2.2.4) into (2.2.3) I w] = I u + v] = A(u + v u + v) ; 2(u + v f ):
I w] = A(u u) ; 2(u f ) + 2 A(v u) ; (v f )] + 2A(v v): By hypothesis, u satis es (2.2.2a), so the O( ) term vanishes. Using (2.2.3), we have I w] = I u] + 2A(v v): With p > 0 and q 0, we have A(v v) 0 thus, u minimizes (2.2.3). In order to prove the converse, assume that u(x) minimizes (2.2.3) and use (2.2.4) to
obtain
I u] I u + v]: For a particular choice of v(x), let us regard I u + v] as a function ( ), i.e., I u + v] := ( ) = A(u + v u + v) ; 2(u + v f ):
A necessary condition for a minimum to occur at = 0 is (0) = 0 thus, di erentiating
0 0
and setting = 0
(0) = 2 A(v u) ; (v f )] = 0: Thus, u is a solution of (2.2.2a). The following corollary veri es that the minimizing function u is also unique. Corollary 2.2.1. The solution u of (2.2.2a) (or (2.2.3)) is unique. 1 Proof. Suppose there are two functions u1 u2 2 H0 satisfying (2.2.2a), i.e.,
A(v u1) = (v f )
Subtracting
A(v u2) = (v f )
8v 2 H01:
isolated points or subintervals of (0 1). For simplicity, let us consider the former case. The analysis of the latter case is similar. When q(x) 0, x 2 0 1], A(u1 ; u2 u1 ; u2) can vanish when u1 ; u2 = 0. Thus, u1 ; u2 is a constant. However, both u1 and u2 satisfy the trivial boundary conditions (2.2.1b) thus, the constant is zero and u1 = u2.
0 0
A(v u1 ; u2) = 0 8v 2 H01: Since this relation is valid for all v 2 H01, choose v = u1 ; u2 to obtain A(u1 ; u2 u1 ; u2) = 0: If q(x) > 0, x 2 (0 1), then A(u1 ; u2 u1 ; u2) is positive unless u1 = u2. Thus, it su ces to consider cases when either (i) q(x) 0, x 2 0 1], or (ii) q(x) vanishes at
Corollary 2.2.2. If u w are smooth enough to permit integrating A(u v) by parts then
Proof. Integrate the di erentiated term in (2.2.3) by parts to obtain
the minimizer of (2.2.3), the solution of the Galerkin problem (2.2.2a), and the solution of the two-point boundary value problem (2.2.1) are all equivalent.
I w] =
Z1
0
The last term vanishes since w 2 H01 thus, using (2.2.1a) and (2.2.2b) we have
I w] = (w L w]) ; 2(w f ):
Now, follow the steps used in Theorem 2.2.1 to show
(2.2.5)
A(v u) ; (v f ) = (v L u] ; f ) = 0
and, hence, establish the result.
8v 2 H01
The minimization problems (2.2.3) and (2.2.5) are equivalent when w has su cient smoothness. However, minimizers of (2.2.3) may lack the smoothness to satisfy (2.2.5). When this occurs, the solutions with less smoothness are often the ones of physical interest.
Problems
Z1
0
1. Consider the \stationary value" problem: nd functions w(x) that give stationary values (maxima, minima, or saddle points) of
I w] = w(0) =
F (x w w )dx
0
(2.2.6a) (2.2.6b)
w(1) = :
1 Let w 2 HE , where the subscript E denotes that w satis es (2.2.6b), and consider 1 comparison functions of the form (2.2.4) where u 2 HE is the function that makes I w] stationary and v 2 H01 is arbitrary. (Functions in H01 satisfy trivial versions of (2.2.6b), i.e., v(0) = v(1) = 0.) Using (2.2.1) as an example, we would have
= = 0:
Smooth stationary values of (2.2.6) would be minima in this case and correspond to solutions of the di erential equation (2.2.1a) and boundary conditions (2.2.1b).
One-Dimensional Finite Element Methods Di erential equations arising from minimum principles like (2.2.3) or from stationary value principles like (2.2.6) are called Euler-Lagrange equations. Beginning with (2.2.6), follow the steps used in proving Theorem 2.2.1 to determine the Galerkin equations satis ed by u. Also determine the Euler-Lagrange equations for smooth stationary values of (2.2.6).
u(0) =
u(1) = :
(2.3.1a)
In this case, functions u satisfying (2.2.2a) or w satisfying (2.2.3) must be members of 1 H 1 and satisfy (2.3.1a). We'll indicate this by writing u w 2 HE , with the subscript E denoting that u and w satisfy the essential Dirichlet boundary conditions (2.3.1a). Since u and w satisfy (2.3.1a), we may use (2.2.4) or the interpretation of v as a variation shown in Figure 2.2.1, to conclude that v should still vanish at x = 0 and 1 and, hence, belong to H01. When u is not prescribed at x = 0 and/or 1, the function v need not vanish there. Let us illustrate this when (2.2.1a) is subject to conditions
u(0) =
p(1)u (1) = :
0
(2.3.1b)
Thus, an essential or Dirichlet condition is speci ed at x = 0 and a Neumann condition is speci ed at x = 1. Let us construct a Galerkin form of the problem by again multiplying (2.2.1a) by a test function v, integrating on 0 1], and integrating the second derivative terms by parts to obtain
1 0
(2.3.2)
With an essential boundary condition at x = 0, we specify u(0) = and v(0) = 0 1 however, u(1) and v(1) remain unspeci ed. We still classify u 2 HE and v 2 H01 since they satisfy, respectively, the essential and trivial essential boundary conditions speci ed with the problem. With v(0) = 0 and p(1)u (1) = , we use (2.3.2) to establish the Galerkin problem 1 for (2.2.1a, 2.3.1b) as: determine u 2 HE satisfying
0
A(v u) = (v f ) + v(1)
8v 2 H01:
(2.3.3)
Let us reiterate that the subscript E on H 1 restricts functions to satisfy Dirichlet (essential) boundary conditions, but not any Neumann conditions. The subscript 0 restricts functions to satisfy trivial versions of any Dirichlet conditions but, once again, Neumann conditions are not imposed. As with problem (2.2.1), there is a minimization problem corresponding to (2.2.3): 1 determine w 2 HE that minimizes
(2.3.4)
Furthermore, in analogy with Theorem 2.2.1, we have an equivalence between the Galerkin (2.3.3) and minimization (2.3.4) problems.
1 Theorem 2.3.1. The function u 2 HE that minimizes (2.3.4) is the one that satis es
Proof. The proof is so similar to that of Theorem 2.2.1 that we'll only prove that the function u that minimizes (2.3.4) also satis es (2.3.3). (The remainder of the proof is stated as Problem 1 as the end of this section.) Again, create the comparison function
(2.3.5)
u(x) x 0 1
Figure 2.3.1: Comparison function w(x) and variation v(x) when Dirichlet data is prescribed at x = 0 and Neumann data is prescribed at x = 1.
8
0
Di erentiating with respect to yields the necessary condition for a minimum as (0) = 2 A(v u) ; (v f ) ; v(1) ] = 0 thus, u satis es (2.3.3). As expected, Theorem 2.3.1 can be extended when the minimizing function u is smooth. 1 Corollary 2.3.1. Smooth functions u 2 HE satisfying (2.3.3) or minimizing (2.3.4) also satisfy (2.2.1a, 2.3.1b). Proof. Using (2.2.2c), integrate the di erentiated term in (2.3.3) by parts to obtain
1 0
8v 2 H01:
(2.3.6)
Since (2.3.6) must be satis ed for all possible test functions, it must vanish for those functions satisfying v(1) = 0. Thus, we conclude that (2.2.1a) is satis ed. Similarly, by considering test functions v that are nonzero in just a small neighborhood of x = 1, we conclude that the boundary condition (2.3.1b) must be satis ed. Since (2.3.6) must be satis ed for all test functions v, the solution u must satisfy (2.2.1a) in the interior of the domain and (2.3.1b) at x = 1. Neumann boundary conditions, or other boundary conditions prescribing derivatives (cf. Problem 2 at the end of this section), are called natural boundary conditions because they follow directly from the variational principle and are not explicitly imposed. Essential boundary conditions constrain the space of functions that may be used as trial or comparison functions. Natural boundary conditions impose no constraints on the function spaces but, rather, alter the variational principle.
Problems
1. Prove the remainder of Theorem 2.3.1, i.e., show that functions that satisfy (2.3.3) also minimize (2.3.4). 2. Show that the Galerkin form (2.2.1a) with the Robin boundary conditions p(0)u (0) + 0u(0) = 0 p(1)u (1) + 1u(1) = 1 is: determine u 2 H 1 satisfying A(v u) = (v f ) + v(1)( 1 ; 1u(1)) ; v(0)( 0 ; 0u(0)) 8v 2 H 1: Also show that the function w 2 H 1 that minimizes I w] = A(w w) ; 2(w f ) ; 2 1w(1) + 1w(1)2 + 2 0w(0) ; 0w(0)2 is u, the solution of the Galerkin problem.
0 0
2.4. Piecewise Lagrange Polynomials 3. Construct the Galerkin form of (2.2.1) when
8 x xj ; > xj xj; if xj 1 x < xj < (x) = > xxjj xxj if xj x < xj+1 j :0 otherwise
;
+1 ; +1 ;
1 1
(2.4.1a)
on the mesh
(2.4.1b)
is a member of both classes. It has two desirable properties: (i) j (x) is unity at node j and vanishes at all other nodes and (ii) j is only nonzero on those elements containing node j . The rst property simpli es the determination of solutions at nodes while the second simpli es the solution of the algebraic system that results from the nite element discretization. The Lagrangian basis maintains these properties with increasing polynomial degree. Hierarchical approximations, on the other hand, maintain only the second property. They are constructed by adding high-degree corrections to lower-degree members of the series. We will examine Lagrange bases in this section, beginning with the quadratic polynomial basis. These are constructed by adding an extra node xj 1=2 at the midpoint of each element xj 1 xj ], j = 1 2 : : : N (Figure 2.4.1). As with the piecewise-linear basis (2.4.1a), one basis function is associated with each node. Those associated with vertices are
; ;
10
U(x)
x x0 x1/2 x1 x
3/2
x2
xN-1 x
N-1/2
xN
Figure 2.4.1: Finite element mesh for piecewise-quadratic Lagrange polynomial approximations.
and those associated with element midpoints are ( 1 ; 4( x xhjj;1=2 )2 if xj 1 x < xj j = 1 2 : : : N: (2.4.2b) j 1=2 (x) = 0 otherwise Here hj = xj ; xj 1 j = 1 2 : : : N: (2.4.2c) These functions are shown in Figure 2.4.2. Their construction (to be described) invovles satsifying 1 if j = k j k = 0 1=2 1 : : : N ; 1 N ; 1=2 N: (2.4.3) j (xk ) = 0 otherwise Basis functions associated with a vertex are nonzero on at most two elements and those associated with an element midpoint are nonzero on only one element. Thus, as noted, the Lagrange basis function j is nonzero only on elements containing node j . The functions (2.4.2a,b) are quadratic polynomials on each element. Their construction and trivial extension to other nite elements guarantees that they are continuous over the entire mesh and, like (2.4.1), are members of H 1. The nite element trial function U (x) is a linear combination of (2.4.2a,b) over the vertices and element midpoints of the mesh that may be written as
; ; ; ;
8 > 1 + 3( x hjxj ) + 2( x hjxj )2 if xj 1 x < xj < 1 ; 3( x j xj ) + 2( x j xj )2 if xj x < xj+1 j (x) = h h > :0 otherwise
; ; ; ; ;
+1
+1
j = 0 1 ::: N
(2.4.2a)
U (x) =
N X j=0
cj j (x) +
N X j=1
cj
1=2 j ;
1=2 (x) =
2N X j=0
cj=2
j=2
(x):
(2.4.4)
11
1 0.9
0.8
0.8
0.7
0.6
0.6
0.5
0.4
0.4
0.2
0.3
0.2
0
0.1
0.2 1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
0 1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
Figure 2.4.2: Piecewise-quadratic Lagrange basis functions for a vertex at x = 0 (left) and an element midpoint at x = ;0:5 (right). When comparing with (2.4.2), set xj 1 = ;1, xj 1=2 = ;0:5, xj = 0, xj+1=2 = 0:5, and xj+1 = 1.
; ;
Using (2.4.3), we see that U (xk ) = ck , k = 0 1=2 1 : : : N ; 1=2 N . Cubic, quartic, etc. Lagrangian polynomials are generated by adding nodes to element interiors. However, prior to constructing them, let's introduce some terminology and simplify the node numbering to better suit our task. Finite element bases are constructed implicitly in an element-by-element manner in terms of shape functions. A shape function is the restriction of a basis function to an element. Thus, for the piecewise-quadratic Lagrange polynomial, there are three nontrivial shape functions on the element j := xj 1 xj ]: the right portion of j 1(x)
; ;
Nj
j ;1=2
1j
(2.4.5a) (2.4.5b)
(x)
Nj
1=2 j
(x) = 1 ; 4(
x ; xj hj
1=2 2
Nj j (x) = 1 + 3( x ; xj ) + 2( x ; xj )2 h h
j j
x2
(2.4.5c)
(Figure 2.4.3). In these equations, Nk j is the shape function associated with node k, k = j ; 1 j ; 1=2 j , of element j (the subinterval j ). We may use (2.4.4) and (2.4.5) to write the restriction of U (x) to j as U (x) = cj 1Nj 1 j + cj 1=2 Nj 1=2 j + cj Nj j x 2 j:
; ; ; ;
12
1.2
0.8
0.6
0.4
0.2
0.2
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Figure 2.4.3: The three quadratic Lagrangian shape functions on the element xj When comparing with (2.4.5), set xj 1 = 0, xj 1=2 = 0:5, and xj = 1.
; ;
xj ].
More generally, we will associate the shape function Nk e(x) with mesh entity k of element e. At present, the only mesh entities that we know of are vertices and (nodes on) elements however, edges and faces will be introduced in two and three dimensions. The key construction concept is that the shape function Nk e(x) is 1. nonzero only on element e and 2. nonzero only if mesh entity k belongs to element e. A one-dimensional Lagrange polynomial shape function of degree p is constructed on an element e using two vertex nodes and p ; 1 nodes interior to the element. The generation of shape functions is straight forward, but it is customary and convenient to do this on a \canonical element." Thus, we map an arbitrary element e = xj 1 xj ] onto ;1 1 by the linear transformation x( ) = 1 ; xj 1 + 1 + xj 2 ;1 1]: (2.4.6) 2 2 Nodes on the canonical element are numbered according to some simple scheme, i.e., 0 to p with 0 = ;1, p = 1, and 0 < 1 < 2 < : : : < p 1 < 1 (Figure 2.4.4). These are mapped to the actual physical nodes xj 1 xj 1+1=p : : : xj on e using (2.4.6). Thus, i = 0 1 : : : p: xj 1+i=p = 1 ; i xj 1 + 1 + i xj 2 2
; ; ; ; ; ; ;
13
1 = 0 1 k N = 1
Figure 2.4.4: An element e used to construct a p th-degree Lagrangian shape function and the shape function Nk e(x) associated with node k. The Lagrangian shape function Nk e( ) of degree p has a unit value at node k of element e and vanishes at all other nodes thus, Nk e( l ) = kl = 1 if k = l l = 0 1 : : : p: (2.4.7a) 0 otherwise It is extended trivially when 2 ;1 1]. The conditions expressed by (2.4.7a) imply that = )( ; k+1) : : : ( ; p) : k 1 )( k ; k+1 ) : : : ( k ; p ) l=0 l=k (2.4.7b) We easily check that Nk e (i) is a polynomial of degree p in and (ii) it satis es conditions (2.4.7a). It is shown in Figure 2.4.4. Written in terms of shape function, the restriction of U to the canonical element is
Nk e( ) =
p Y
6
; l = ( ; 0)( ; 1) : : : ( ; ( k ; 0)( k ; 1) : : : ( k ; k; l
k ;1
;
U( ) =
p X k=0
ck Nk e( ):
(2.4.8)
Example 2.4.1. Let us construct the quadratic Lagrange shape functions on the canonical element by setting p = 2 in (2.4.7b) to obtain N1 e( ) = (( ; 0)( ; 2)) N0 e( ) = (( ; 1)( ; 2 )) 0 ; 1 )( 0 ; 2 1 ; 0 )( 1 ; 2 ; )( N2 e( ) = (( ; 0)( ; 1)) : 2 0 2; 1
14 Setting
0
= 0, and 2 = 1 yields ; N0 e( ) = ( 2 1) N1 e( ) = (1 ; 2) N2 e( ) = ( + 1) : (2.4.9) 2 These may easily be shown to be identical to (2.4.2) by using the transformation (2.4.6) (see Problem 1 at the end of this section). Example 2.4.2. Setting p = 1 in (2.4.7b), we obtain the linear shape functions on the canonical element as N0 e = 1 ; N1 e = 1 + : (2.4.10) 2 2 The two nodes needed for these shape functions are at the vertices 0 = ;1 and 1 = 1. Using the transformation (2.4.6), these yield the two pieces of the hat function (2.4.1a). We also note that these shape functions were used in the linear coordinate transformation (2.4.6). This will arise again in Chapter 5.
Problems
1. Show the the quadratic Lagrange shape functions (2.4.9) on the canonical ;1 1] element transform to those on the physical element (2.4.2) upon use of (2.4.6) 2. Construct the shape functions for a cubic Lagrange polynomial from the general formula (2.4.7) by using two vertex nodes and two interior nodes equally spaced on the canonical ;1 1] element. Sketch the shape functions. Write the basis functions for a vertex and an interior node.
U 2 (x) = U 1 (x) + cj
1=2
x2
e e
(2.5.1a) (2.5.1b)
15 if x 2 e otherwise if x 2 e otherwise
Superscripts have been added to U and Nj e to identify their polynomial degree. Thus,
1 j ;1 e
(x) =
(2.5.1c) (2.5.1d)
N (x) = 0
1 je
;
x;xj ;1 hj
are the usual hat function (2.4.1) associated with a piecewise-linear approximation U 1 (x). The quadratic correction Nj2 1=2 e(x) is required to (i) be a quadratic polynomial, (ii) vanish when x 2 e, and (iii) be continuous. These conditions imply that Nj2 1=2 e is = proportional to the quadratic Lagrange shape function (2.4.5b) and we will take it to be identical thus,
;
1 ; 4( x 0
xj ;1=2 2 hj
if x 2 e : otherwise
(2.5.1e)
The normalization Nj2 1=2 e(xj 1=2 ) = 1 is not necessary, but seems convenient. Like the quadratic Lagrange approximation, the quadratic hierarchical polynomial has three nontrivial shape functions per element however, two of them are linear and only one is quadratic (Figure 2.5.1). The basis, however, still spans quadratic polynomials. Examining (2.5.1), we see that cj 1 = U (xj 1 ) and cj = U (xj ) however, U (xj 1=2 ) = cj 12+ cj + cj 1=2: Di erentiating (2.5.1a) twice with respect to x gives an interpretation to cj 1=2 as
; ; ; ; ; ;
cj
1=2
This interpretation may be useful but is not necessary. A basis may be constructed from the shape functions in the manner described for Lagrange polynomials. With a mesh having the structure used for the piecewise-quadratic Lagrange polynomials (Figure 2.4.1), the piecewise-quadratic hierarchical functions have the form
= ; h U (xj 8
2
00
1=2
):
U (x) =
N X j=0
c (x) +
1 j j
N X j=1
cj
2 1=2 j ;1=2
(x)
(2.5.2)
where 1(x) is the hat function basis (2.4.1a) and 2(x) = Nj2e(x). j j Higher-degree hierarchical polynomials are obtained by adding more correction terms to the lower-degree polynomials. It is convenient to construct and display these polynomials on the canonical ;1 1] element used in Section 2.4. The linear transformation
16
1 0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
(2.4.6) is again used to map an arbitrary element xj 1 xj ] onto ;1 1. The vertex nodes at = ;1 and 1 are associated with the linear shape functions and, for simplicity, we will index them as ;1 and 1. The remaining p ; 1 shape functions are on the element interior. They need not be associated with any nodes but, for convenience, we will associate all of them with a single node indexed by 0 at the center ( = 0) of the element. The restriction of the nite element solution U ( ) to the canonical element has the form
U ( ) = c 1 N 1 ( ) + c1 N ( ) +
;
1 1
p X i=2
ciN0i ( )
2 ;1 1]:
(2.5.3)
(We have dropped the elemental index e on Nji e since we are only concerned with approximations on the canonical element.) The vertex shape functions N 1 1 and N11 are the hat function segments (2.4.10) on the canonical element N11 ( ) = 1 + 2 ;1 1]: (2.5.4) N 1 1( ) = 1 ; 2 2 Once again, the higher-degree shape functions N0i ( ), i = 2 3 : : : p, are required to have the proper degree and vanish at the element's ends = ;1 1 to maintain continuity. Any normalization is arbitrary and may be chosen to satisfy a speci ed condition, e.g., N02 (0) = 1. We use a normalization of Szabo and Babuska 7] which relies on Legendre polynomials. The Legendre polynomial Pi ( ), i 0, is a polynomial of degree i in satisfying 1]:
; ;
17
;1 < < 1
i 0
i 0
(2.5.5a)
2. the normalization
Pi(1) = 1
3. the orthogonality relation
(2.5.5b)
Z1
;
(2.5.5c)
(2.5.5e)
i 1:
(2.5.5f)
P2( ) = 3 2; 1
2
P0 ( ) = 1
(2.5.6)
N ( )=
i 0
2i ; 1 Z P ( )d i 1 2 1
; ;
(2.5.7a)
(2.5.7b)
18
Use of the normalization and symmetry properties (2.5.5b,d) further reveal that
i 2 i j 2:
(2.5.7c)
Z 1 dN i ( ) dN j ( ) 0 0 d d d = 1
;
ij
(2.5.7d)
(2.5.8)
0.4
0.2
0.2
0.4
0.6
0.8 1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
Figure 2.5.2: One-dimensional hierarchical shape functions of degrees 2 (solid), 3( ), 4 ( ), 5 (+), and 6 (*) on the canonical element ;1 1. The representation (2.5.3) with use of (2.5.5b,d) reveals that the parameters c 1 and c1 correspond to the values of U (;1) and U (1), respectively however, the remaining parameters ci, i 2, do not correspond to solution values. In particular, using (2.5.3),
;
19
i=2 4
Hierarchical bases can be constructed so that ci is proportional to diU (0)=d i, i 2 (cf. 3], Section 2.8) however, the shape functions (2.5.8) based on Legendre polynomials reduce sensitivity of the basis to round-o error accumulation. This is very important when using high-order nite element approximations. Example 2.5.1. Let us solve the two-point boundary value problem
;pu + qu = f (x)
00
0<x<1
u(0) = u(1) = 0
(2.5.9)
using the nite element method with piecewise-quadratic hierarchical approximations. As in Chapter 1, we simplify matters by assuming that p > 0 and q 0 are constants. By now we are aware that the Galerkin form of this problem is given by (2.2.2). As in Chapter 1, introduce (cf. (1.3.9))
A (v u) =
S j
Z xj
xj ;1
pv u dx:
0 0
(2.5.10)
Using (2.5.3), we write the restriction of the piecewise-quadratic trial and text functions to xj 1 xj ] as
;
U ( ) = cj
V ( ) = dj
(2.5.11)
A (V U ) = dj
S j
2 3 cj 1 dj dj 1=2]Kj 4 cj 5 cj 1=2
; ; ;
(2.5.12a)
20
Substituting for the basis de nitions (2.5.4, 2.5.8) 2 3 r Z 1 ;1=2 2p 6 1=2 7 ;1=2 1=2 3 ]d : Kj = h 4 q 5 2 j 3 1
;
Integrating
p 2 3 Z 1 2 1=4 ;1=4 ; p 3=8 3 1 ;1 0 p Kj = 2p 4 ;p=4 p=4 1 1 3=8 5 d = h 4 ;1 1 0 5 : (2.5.12b) hj 1 ; 3=8 j 0 0 2 3=8 3 2=2
;
The orthogonality relation (2.5.7d) has simpli ed the sti ness matrix by uncoupling the linear and quadratic modes. In a similar manner,
A (V U ) =
M j
Z xj
xj ;1
qhj Z 1 V Ud : qV Udx = 2
;
(2.5.13a)
Using (2.5.11)
(2.5.13c) The higher and lower order terms of the element mass matrix have not decoupled. Comparing (2.5.12b) and (2.5.13c) with the forms developed in Section 1.3 for piecewise-linear approximations, we see that the piecewise linear sti ness and mass matrices are contained as the upper 2 2 portions of these matrices. This will be the case for linear problems thus, each higher-degree polynomial will add a \border" to the lower-degree sti ness and mass matrices. Finally, consider (V f )j = Using (2.5.11) (V f )j = dj
;
2 3 cj 1 AM (V U ) = dj 1 dj dj 1=2]Mj 4 cj 5 (2.5.13b) j cj 1=2 where, upon use of (2.5.4, 2.5.8), the element mass matrix Mj satis es p 2 2 Z 1 2 N11 3 1 ;p3=2 3 5: Mj = qhj 4 N11 5 N 1 1 N11 N02 ]d = qhj 4 p 2 2 1 N2 6 ; 13=2 ;p3=2 ; 6=3=2 5 0
; ; ; ; ; ; ;
xj xj ;1
hj Z 1 V fd : V fdx = 2
;
(2.5.14a) (2.5.14b)
dj dj
1=2 j
]l
21
Z 1 2 N11 3 lj = hj 4 N11 5 f (x( ))d : (2.5.14c) 2 1 N2 0 As in Section 1.3, we approximate f (x) by piecewise-linear interpolation, which we write
; ;
f (x) N 1 1 ( )fj 1 + N11 ( )fj with fj := f (xj ). The manner of approximating f (x) should clearly be related to the degree p and we will need a more careful analysis. Postponing this until Chapters 6 and
; ;
as
7, we have
fj 1 fj
;
Using (2.2.2a) with (2.5.12a), (2.5.13a), and (2.5.14a), we see that assembly requires evluating the sum
N X j=1
(2.5.14d)
AS (V U ) + AM (V U ) ; (V f )j ] = 0: j j
Following the strategy used for the piecewise-linear solution of Section 1.3, the local sti ness and mass matrices and load vectors are added into their proper locations in their global counterparts. Imposing the condition that the system be satis ed for all choices of dj , j = 1=2 1 3=2 : : : N ; 1, yields the linear algebraic system (K + M)c = l: (2.5.15) The structure of the sti ness and mass matrices K and M and load vector l depend on the ordering of the unknowns c and virtual coordinates d. One possibility is to order them by increasing index, i.e.,
c = c1=2 c1 c3=2 c2 : : : cN 1 cN
;
1=2
]T :
(2.5.16)
As with the piecewise-linear basis, we have assumed that the homogeneous boundary conditions have explicitly eliminated c0 = cN = 0. Assembly for this ordering is similar to the one used in Section 1.3 (cf. Problem 2 at the end of this section). This is a natural ordering and the one most used for this approximation however, for variety, let us order the unknowns by listing the vertices rst followed by those at element midpoints, i.e.,
cL c = cQ
2 6 cL = 6 6 4
cN
3 c1 c2 7 7 ... 7 5
;
3 7 7: 7 5
(2.5.17)
22
0 K = KL KQ 0
M M = MTL MLQ MQ LQ
L l = llQ
(2.5.18)
2 2 6 2 p6 ... KQ = h 6 6 6 4 2
3 7 7 7 7 7 5
(2.5.19)
2 3 4 1 61 4 1 7 6 qh 6 . . . . . . 7 ML = 6 6 7 . . . 7 6 7 4 1 4 15
2 3 f0 + f1 6 f +f 7 (2.5.21) lQ = ; ph 6 1 .. 2 7 : 6 7 ... 5 24 4 . fN 1 + fN fN 2 + 4fN 1 + fN With N ; 1 vertex unknowns cL and N elemental unknowns cQ, the matrices KL and ML are (N ; 1) (N ; 1), KQ and MQ are N N , and MLQ is (N ; 1) N . Similarly, lL and lQ have dimension N ; 1 and N , respectively. The indicated ordering implies that the 3 3 element sti ness and mass matrices (2.5.12b) and (2.5.13c) for element j are added to rows and columns j ; 1, j , and N ; 1 + j of their global counterparts. The rst row and column of the element sti ness and mass matrices are deleted when j = 1 2 6 lL = h 6 66 4
f0 + 4f1 + f2 f1 + 4f2 + f3
;
3 7 7 7 5
to satisfy the left boundary condition. Likewise, the second row and column of these matrices are deleted when j = N to satisfy the right boundary condition. The structure of the system matrix K + M is M K + M = KL +T ML KQ +LQ Q : (2.5.22) MLQ M
23
The matrix KL + ML is the same one used for the piecewise-linear solution of this problem in Section 1.3. Thus, an assembly and factorization of this matrix done during a prior piecewise-linear nite element analysis could be reused. A solution procedure using this factorization is presented as Problem 3 at the end of this section. Furthermore, if q 0 then MLQ = 0 (cf. (2.5.20b)) and the linear and quadratic portions of the system uncouple. In Example 1.3.1, we solved (2.5.9) with p = 1, q = 1, and f (x) = x using piecewiselinear nite elements. Let us solve this problem again using piecewise-quadratic hierarchical approximations and compare the results. Recall that the exact solution of this problem is u(x) = x ; sinh x : sinh 1 Results for the error in the L2 norm are shown in Table 2.5.1 for solutions obtained with piecewise-linear and quadratic approximations. The results indicate that solutions with piecewise-quadratic approximations are converging as O(h3) as opposed to O(h2) for piecewise-linear approximations. Subsequently, we shall show that smooth solutions generally converge as O(hp+1) in the L2 norm and as O(hp) in the strain energy (or H 1) norm.
N
4 8 16 32
DOF 3 7 15 31
DOF jjejj0 jjejj0=h3 0.265(-2) 0.425(-1) 7 0.126(-3) 0.807(-2) 0.656(-3) 0.426(-1) 15 0.158(-4) 0.809(-2) 0.167(-3) 0.427(-1) 31 0.198(-5) 0.809(-2) 0.417(-4) 0.427(-1)
2
jjejj0
Linear
jjejj0=h
Quadratic
Table 2.5.1: Errors in L2 and degrees of freedom (DOF) for piecewise-linear and piecewsequadratic solutions of Example 2.5.1. The number of elements N is not the only measure of computational complexity. With higher-order methods, the number of unknowns (degrees of freedom) provides a better index. Since the piecewise-quadratic solution has approximately twice the number of unknowns of the linear solution, we should compare the linear solution with spacing h and the quadratic solution with spacing 2h. Even with this analysis, the superiority of the higher-order method in Table 2.5.1 is clear.
Problems
1. Consider the approximation in strain energy of a given function u( ), ;1 < < 1, by a polynomial U ( ) in the hierarchical form (2.5.3). The problem consists of
24
One-Dimensional Finite Element Methods determining U ( ) as the solution of the Galerkin problem
A(V U ) = A(V u)
8V 2 S p
where S p is a space of p th-degree polynomials on ;1 1]. For simplicity, let us take the strain energy as Z1 A(v u) = v u d :
;
With c 1 = u(;1) and c1 = u(1), nd expressions for determining the remaining coe cients ci, i = 2 3 : : : p, so that the approximation satis es the speci ed Galerkin projection.
;
2. Show how to generate the global sti ness and mass matrices and load vector for Example 2.5.1 when the equations and unknowns are written in order of increasing index (2.5.16). 3. Suppose KL + ML have been assembled and factored by Gaussian elimination as part of a nite element analysis with piecewise-linear approximations. Devise an algorithm to solve (2.5.15) for cL and cQ that utilizes the given factorization.
A(v u) = (v f ) A(V U ) = (V f )
8v 2 H01: 8V 2 S0N :
(2.6.1) (2.6.2)
N Let the approximating space S0 H01 consist of piecewise-polynomials of degree p on N -element meshes. We begin with two fundamental results regarding Galerkin's method and nite element approximations.
25
Theorem 2.6.1. Let u 2 H01 and U 2 S0N H01 satisfy (2.6.1) and (2.6.2), respectively,
A(V u ; U ) = 0
8V 2 S0N :
(2.6.3)
N 1 Proof. Since V 2 S0 it also belongs to H0 . Thus, it may be used to replace v in (2.6.1). Doing this and subtracting (2.6.2) yields the result.
We shall subsequently show that the strain energy furnishes an inner product. With this interpretation, we may regard (2.6.3) as an orthogonality condition in a \strain p energy space" where A(v u) is an inner product and A(u u) is a norm. Thus, the nite element solution error
(2.6.4)
N is orthogonal in strain energy to all functions V in the subspace S0 . We use this orthogonality to show that solutions obtained by Galerkin's method are optimal in the sence of minimizing the error in strain energy.
Theorem 2.6.2. Under the conditions of Theorem 2.6.1, A(u ; U u ; U ) = min A(u ; V u ; V ): V SN
2
(2.6.5)
Proof. Consider
A(u ; U u ; U ) = A(u u) ; 2A(u U ) + A(U U ) + 2A(u ; U U ) A(u ; U u ; U ) = A(u u) ; A(U U ): N Again, using (2.6.3) for any V 2 S0 A(u ; U u ; U ) = A(u u) ; A(U U ) + A(V V ) ; A(V V ) ; 2A(u ; U V )
or or
Since the last term on the right is non-negative, we can drop it to obtain
8V 2 S0N :
26
With optimality of Galerkin's method, we may obtain estimates of nite element discretization errors by bounding the right side of (2.6.5) for particular choices of V . Convenient bounds are obtained by selecting V to be an interpolant of the exact solution u. Bounds furnished in this manner generally provide the exact order of convergence in the mesh spacing h. Furthermore, results similar to (2.6.5) may be obtained in other norms. They are rarely as precise as those in strain energy and typically indicate that the nite element solution di ers by no more than a constant from the optimal solution in the considered norm. Thus, we will study the errors associated with interpolation problems. This can be done either on a physical or a canonical element, but we will proceed using a canonical element since we constructed shape functions in this manner. For our present purposes, we regard u( ) as a known function that is interpolated by a p th-degree polynomial U ( ) on the canonical element ;1 1]. Any form of the interpolating polynomial may be used. We use the Lagrange form (2.4.8), where
U( ) =
p X k=0
ck Nk ( )
(2.6.6)
with Nk ( ) given by (2.4.7b). (We have omitted the elemental index e on Nk for clarity since we are concerned with one element.) An analysis of interpolation errors whith hierarchical shape functions may also be done (cf. Problem 1 at the end of this section). Although the Lagrangian and hierarchical shape functions di er, the resulting interpolation polynomials U ( ) and their errors are the same since the interpolation problem has a unique solution 2, 6]. Selecting p+1 distinct points xii 2 ;1 1], i = 0 1 : : : p, the interpolation conditions are
U ( i ) = u( i) := ui = ci
j = 0 1 ::: p
(2.6.7)
where the rightmost condition follows from (2.4.7a). There are many estimates of pointwise interpolation errors. Here is a typical result. Theorem 2.6.3. Let u( ) 2 C p+1 ;1 1] then, for each 2 ;1 1], there exists a point ( ) 2 (;1 1) such that the error in interpolating u( ) by a p th-degree polynomial U ( ) is p u(p+1) ( ) Y( ; ): e( ) = (p + 1)! (2.6.8) i i=0 Proof. Although the proof is not di cult, we'll just sketch the essential details. A complete analysis is given in numerical analysis texts such as Burden and Faires 2], Chapter 3, and Isaacson and Keller 6], Chapter 5.
27
e( 0) = e( 1 ) = : : : = e( p) = 0 e( ) = g( ) ( ; i):
i=0 p Y
The error in interpolating a polynomial of degree p or less is zero thus, g( ) must be proportional to u(p+1). We may use a Taylor's series argument to infer the existence of ( ) 2 (;1 1) and p Y (p+1) e( ) = Cu ( ) ( ; i): Selecting u to be a polynomial of degree p + 1 and di erentiating this expression p + 1 times yields C as 1=(p + 1)! and (2.6.8). The pointwise error (2.6.8) can be used to obtain a variety of global error estimates. Let us estimate the error when interpolating a smooth function u( ) by a linear polynomial U ( ) at the vertices 0 = ;1 and 1 = 1 of an element. Using (2.6.8) with p = 1 reveals ( 2 (;1 1): (2.6.9) e( ) = u 2 ) ( + 1)( ; 1) Thus, je( )j 1 max 1 ju ( )j max 1 j 2 ; 1j: 1 2 1 Now, max 1 j 2 ; 1j = 1: 1
00 00 ; ; ;
i=0
Thus,
Derivatives in this expression are taken with respect to . In most cases, we would like results expressed in physical terms. The linear transformation (2.4.6) provides the necessary conversion from the canonical element to element j : xj 1 xj ]. Thus,
;
kf ( )k j := xj;max xj jf (x)j x
1
(2.6.10)
28
xj ], we have
1
ke( )k
h2 j
(Arguments have been replaced by a to emphasize that the actual norm doesn't depend on x.) If u(x) were interpolated by a piecewise-linear function U (x) on N elements xj 1 xj ], j = 1 2 : : : N , then (2.6.11) could be used on each element to obtain an estimate of the maximum error as
;
8 ku ( )k j :
00
(2.6.11)
ke( )k
where
1
h2 ku ( )k
8
00
kf ( )k := 1max kf ( )k j N
and
;
As a next step, let us use (2.6.9) and (2.4.6) to compute an error estimate in the L2 norm thus, Z xj hj Z 1 u ( ( )) ( 2 ; 1)]2d : 2 e (x)dx = 2 2 1 xj ;1 Since j 2 ; 1j 1, we have
;
Z xj
xj ;1
hj Z 1 u ( ( ))]2d : e (x)dx 8
2
00 ;
kf ( )k0 j :=
Then,
Z xj
xj ;1
!1=2 f (x)dx :
2
00
(2.6.13)
ke( )k
2 0j
It is tempting to replace the integral on the right side of our error estimate by ku k2 j . 0 This is almost correct however, = ( ). We would have to verify that varies smoothly with . Here, we will assume this to be the case and expand u using Taylor's theorem to obtain
00 00
hj Z 1 u ( ( ))]2d 8
;
u ( ) = u ( ) + u ( )( ; ) = u ( ) + O(j ; j)
00 00 000 00
2( )
29
ju ( )j C ju ( )j:
00 00
The constant C absorbs our careless treatment of the higher-order term in the Taylor's expansion. Thus, using (2.4.6), we have
ke( )k
2 0j
hj Z 1 u ( )]2d = C 2 h4 Z j C 8 64
2
00 ;
xj
xj ;1
u (x)]2 dx
00
where derivatives in the rightmost expression are with respect to x. Using (2.6.13)
If we sum (2.6.14) over the N nite elements of the mesh and take a square root we obtain
(2.6.14)
(2.6.15a)
where
kf ( )k =
2 0
N X j=1
kf ( )k2 j : 0
(2.6.15b)
(The constant C in (2.6.15a) replaces the constant C=8 of (2.6.14), but we won't be precise about identifying di erent constants.) With a goal of estimating the error in H 1, let us examine the error u ( ) ; U ( ). Di erentiating (2.6.9) with respect to
0 0
e ( ) = u ( ) + u 2( ) d ( 2 ; 1): d
000 0 00
ke k =
0
2 0j
xj
xj ;1
de(x) ]2 dx = 2 Z 1 u ( ) + u ( ) d ( 2 ; 1)]2d : dx hj 1 2 d
000 00 ;
(2.6.16)
30
To obtain an error estimate in the H 1 norm, we combine (2.6.15a) and (2.6.16) to get
(2.6.17a)
where
kf ( )k :=
2 1
N X j=1
kf ( )k2 j + kf ( )k2 j ]: 0 0
0
(2.6.17b)
The methodology developed above may be applied to estimate interpolation errors of higher-degree polynomial approximations. A typical result follows.
x0 < x1 < : : : < xN b such that U (x) is a polynomial of degree p or less on every subinterval (xj 1 xj ) and U 2 H 1 (a b). Let U (x) interpolate u(x) 2 H p+1 a b] such that no error results when u(x) is any polynomial of degree p or less. Then, there exists a constant Cp > 0, depending on p, such that
;
ku ; U k0 Cphp+1ku(p+1)k0
and
(2.6.18a) (2.6.18b)
ku ; U k1 Chpku(p+1)k0: p
where h satis es (2.6.12c). Proof. The analysis follows the one used for linear polynomials.
Problems
1. Choose a hierarchical polynomial (2.5.3) on a canonical element ;1 1] and show how to determine the coe cients cj , j = ;1 1 2 : : : p, to solve the interpolation problem (2.6.7).
Bibliography
1] M. Abromowitz and I.A. Stegun. Handbook of Mathematical Functions, volume 55 of Applied Mathematics Series. National Bureau of Standards, Gathersburg, 1964. 2] R.L. Burden and J.D. Faires. Numerical Analysis. PWS-Kent, Boston, fth edition, 1993. 3] G.F. Carey and J.T. Oden. Finite Elements: A Second Course, volume II. Prentice Hall, Englewood Cli s, 1983. 4] R. Courant and D. Hilbert. Methods of Mathematical Physics, volume 1. WileyInterscience, New York, 1953. 5] C. de Boor. A Practical Guide to Splines. Springer-Verlag, New York, 1978. 6] E. Isaacson and H.B. Keller. Analysis of Numerical Methods. John Wiley and Sons, New York, 1966. 7] B. Szabo and I. Babuska. Finite Element Analysis. John Wiley and Sons, New York, 1991.
31