Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
= weak form in V :
a(u, v ) = L(v )
min F (v ), = Vh (nite dimensional space and basis functions) = a(uh , vh ) = L(vh ) = uh and error analysis.
9.1
Let us recall the divergence theorem: Theorem 9.1. Let F H 1 () H 1 (), then we have F ds = F n ds,
div Fdxdy =
(9.1)
where n is the unit normal direction pointing outward of the boundary of , and is the gradient operator, , x y
T
(9.2)
From this theorem, we can prove the second Greens theorem below by letting F =
201
i i i
202
v u = v
: div F = x v u x + y v u y
u v 2u 2u u v +v 2 + +v 2 x x x y y y
= u v + v u, where u = u u = uxx + uyy . From the second Greens theorem, we conclude that div Fdxdy =
(u v + v u) dxdy
which gives the following formula of integration by parts in two space dimensions. Theorem 9.2. If u(x, y ) H 2 () and v (x, y ) H 2 (), where is a bounded domain, then u ds v udxdy = v u vdxdy, (9.3) n where u u u = un = nx + ny n x y is called the normal derivative of u. We list some important elliptic type patrial dierential equations below uxx + uyy = 0, uxx uyy = f (x, y ), uxx uyy + u = f, uxxxx + 2uxxyy + uyyyy = 0, Laplace Equation, Poisson Equation, Helmholtz Equation, Bi-harmonic Equation. (9.4)
When > 0, the PDE is called a generalized Helmholtz equation that is easier to solve compared with the case when < 0. Note that we can simplify the expressions above using the gradient symbol , for example uxx + uyy = u = u = u. A general linear quadratic elliptic patrial dierential equation has the form a(x, y )uxx + 2b(x, y )uxy + c(x, y )uyy + d(x, y )ux + e(x, y )uy + g (x, y )u = f (x, y ) with the discriminant b2 ac < 0. A second order self-adjoint elliptic equation has the following form (p(x, y )u) + q (x, y )u = f (x, y ). (9.5)
i i i
203
9.1.1
Boundary conditions
In two space dimensions, the boundary of the domain is one or several curves. We will consider three linear boundary conditions. A Dirichlet boundary condition is given on the entire boundary, that is, u(x, y )| = u0 (x, y ) is known.
u A Neumann boundary condition is given on the entire boundary, that is, = g (x, y ) n is known. For such a boundary condition, the solution to a Poisson equation may not exit or may not be unique depending on whether the compatibility condition is satised. For example, for the Laplacian equation, we have
f dxdy =
udxdy =
udxdy =
un ds =
g (x, y )ds = 0.
The solution would exists only the comparability condition is satised. Otherwise, the solution does not exist. When this compatibility condition is satised, the solution is not unique since it can dier by an arbitrary constant. Mixed boundary conditions on the entire boundary, that is (x, y )u(x, y ) + (x, y ) u = (x, y ) n
is given, where (x, y ), (x, y ), and (x, y ) are known functions. Dirichlet, Neumann, and Mixed boundary conditions on some parts of the boundary.
9.1.2
Multiplying a testing function v (x, y ) H 1 () to the self-adjoint equation (9.5), we have { (p(x, y )u) + q (x, y )u} vdxdy = f vdxdy.
Using the formula of integration by parts, we change the left hand side to (pu v + quv ) dxdy
b a
pvun ds.
b a
We can compare the above expression with weak is (pu v + quv ) dxdy = f vdxdy +
vu dx =
u v dx vu |b a . Therefore the
v (x, y ) V (),
where N is the part of boundary where a Neumann boundary condition is dened. The solution space resides in V = v (x, y ), v (x, y ) = 0, (x, y ) D , v (x, y ) H 1 () , (9.6)
i i i
204
9.1.3
(9.7)
f vdxdy
(9.8)
for a Dirichlet boundary condition on the entire boundary. As before, we assume that 0 < p(x, y ) pmax , 0 q (x) qmax , p C (), q C ().
v 2 dxdy C
|v |2 dxdy,
(9.9)
where C is a constant. Now we are ready to check the conditions of the Lax-Milgram Lemma. 1. It is obvious that a(u, v ) = a(v, u). 2. It is easy to see that |a(u, v )| max {pmax , qmax }
= max {pmax , qmax } |(|u|, |v |)1 | max {pmax , qmax } u 3. From the Poincar e inequality we have |a(v, v )| = =
1
1.
|v |2 + qv 2 dxdy
Therefore a(u, v ) is V-elliptic. 4. Finally we show that L(v ) is continuous |L(v )| = |(f, v )0 | f
0
1.
1 () H0
i i i
205
9.2
The general procedure of the nite element method is the same for any dimensions. The Galerkin nite element method involves the following main steps. Generate a triangulation over the domain. Usually the triangulation is composed of either triangles or quadrilaterals (rectangles). There are a number of mesh generation software packages around, for examples, the Matlab PDE toolbox from Mathworks, Triangle from Carnegie Melon University, ...., and many others. Some of them are available through the Internet. Construct basis functions over the triangulation. We will only consider the conforming nite element method. Assemble the stiness matrix and the load vector element by element using either the Galerkin method (the weak form) or Ritzs method (the minimization) form. Solve the system of equations. Do the error analysis.
9.2.1
Given a general domain, we can approximate the domain by a polygon, and then generate a triangulation over the polygon. Once we have a triangulation, we can rene it if necessary. A simple approach is the mid-point rule. A triangulation usually has the following mesh parameters: p : Kj : Ni : hj : j : h: : We assume that 1 j > 0. hj polygonal region = K1 K2 K3 Knelem , are non-overlapping triangles, are nodal points, the longest side of Kj , the diameter of the circle inscribed in Kj (encircle), the largest of all hj , the smallest of all j , h = max{hj }, = min{j }. j = 1, 2, nelem, i = 1, 2, nnode,
The constant is a measurement of the triangulation quality. The large is, the better quality of the triangulation. Given a triangulation, a node is also the vertex of all adjacent triangles. We do not discuss hanging nodes here.
9.2.2
For second order linear elliptic partial dierential equations, we know that the solution space is in the H 1 (). Unlike the one dimensional case, an element v (x, y ) in the H 1 ()
i i i
206
may not be continuous based on the Sobolev embedding theorem. However, in practice, most of solutions in practice are indeed continuous especially for second order PDEs with certain regularities. We will still look for solution in the continuous function space C 0 (). We rst we consider how to construct piecewise linear functions over a mesh with the Dirichlet boundary condition u(x, y )| = 0. Given a triangulation, we dene Vh = v (x, y ), v (x, y ) is piecewise linear over each Kj , C 0 () . (9.10)
v (x, y )| = 0, v (x, y ) H 1 ()
We need to determine the dimension of this space and construct a set of basis functions. On each triangle, a linear function has the form vh (x, y ) = + x + y, where , , and are constants. So there are three free parameters. We denote Pk = {p(x, y ), We have the following theorem. Theorem 9.4. 1. A linear function p1 (x, y ) = + x + y dened on a triangle is uniquely determined by its values at its three vertices. 2. If p1 (x, y ) P1 , p2 (x, y ) P1 , and p1 (A) = p2 (A), p1 (B ) = p2 (B ), where A and B are two points x-y plane, then p1 (x, y ) p2 (x, y ) for any (x, y ) IAB , where IAB is the line segment between A and B . Proof: Assume the vertices of the triangle is (xi , yi ), i = 1, 2, 3. The linear function takes value vi at the vertices p(xi , yi ) = vi . We have three equations + x1 + y1 = v1 + x2 + y2 = v2 + x3 + y3 = v3 . p(x, y ) is a polynomial of degree of k} . (9.12) (9.11)
since
j > 0. hj
(9.13)
i i i
207
p1 a1 p2
a2
Figure 9.1. A diagram of a triangle with three vertices a1 , a2 , and a3 ; an adjacent triangle with a common side; the local coordinate system in which a 2 is the origin and a2 a3 is the axis.
Thus, the linear system of equations has a unique solution. Now we prove the second part of the theory. Suppose that the equation of the line segment is l1 x + l2 y + l3 = 0, We can solve for x or for y , x= or y= l2 y + l 3 l1 l1 x + l 3 l2 if if l1 = 0, l2 = 0.
2 2 l1 + l2 = 0.
= 1 + 1 x Similarly we have 1 + p2 (x, y ) = 1 x. Since p1 (A) = p2 (A) and p1 (B ) = p2 (B ), we have 1 + 1 x1 = p(A), 1 + 1 x2 = p(B ), 1 + 1 x 1 = p (A ) 1 + 1 x 2 = p (B )
i i i
208
Since both linear system of equations have the same coecients matrix 1 x1 , 1 x2 which is non-singular since and x1 = x2 because point A and B are. We have to have 1 = 1 and 1 = 1 , which means that the two linear functions have the same expression along the line segment, i.e., they are identical along the line segment. Corollary 9.5. A piecewise linear function in C 0 () over a triangulation (a set of nonoverlapping triangles) is uniquely determined by its values dened at vertices. Theorem 9.6. The dimension of the nite dimensional space composed of piecewise linear functions in C 0 () H 1 () over a triangulation for (9.5) is the number of interior nodal points plus the number of nodal points on the boundary where the natural boundary conditions are imposed (Neumann and mixed boundary conditions). Example 9.1. Given a triangulation shown in Figure 9.2, a piecewise continuous function vh (x, y ) is determined by its values on the vertices of all triangles, more precisely
vh (x, y ) (0, 0, v (N1 )), (0, 0, v (N2 )), (0, v (N3 ), v (N2 )), (0, v (N1 ), v (N3 )),
is determined from (x, y ) K1 , (x, y ) K3 , (x, y ) K5 , (x, y ) K7 , (0, v (N2 ), v (N1 )), (0, 0, v (N2 )), (0, 0, v (N3 )), (x, y ) K2 , (x, y ) K4 , (x, y ) K6 , (x, y ) K8 .
Note that although some three values of the vertices are the same, like the values for K3 and K4 , but the geometries are dierent, so the functions will likely to have dierent expressions on dierent triangles.
0 4 5 6 3 7 0 1 1 0 2 2 8 3 0
i i i
209
9.2.3
A global function in the piecewise continuous linear space is dened as 1 i (Nj ) = 0 if i = j (9.14) otherwise,
where Nj are nodal points. The shape looks like a tent without a door. Its support is the union of the triangles surrounding the node Ni , see Figure 9.3. Figure 9.3 (b) is the plot of a triangulation and the contour plot of the global basis function centered at a node. We can see that the basis function is piecewise linear and it is supported only in the surrounding triangles. Figure 9.3 (a) is the mesh plot of the global basis function.
(a)
(b)
2
0.5
2 2
Figure 9.3. A global basis function j . (a) the mesh plot; (b) the triangulation and the contour plot of the global basis function.
It is almost impossible to give a closed form of a global basis function except for some very special geometries, see the example in the next section. However, it is much easier to write down the shape function. Example 9.2. We use a Poisson equation and a uniform mesh as an example to demonstrate the piecewise linear basis functions and the nite element method. Suppose we want to solve the Poisson equation (uxx + uyy ) = f (x, y ), u(x, y )| = 0. (x, y ) [a, b] [c, d],
We know how to use the standard central nite dierence scheme with the ve point stencil to solve the Poisson equation. We will show that with some manipulations, the
i i i
210
5 6 1 4 3 2
linear system of equation using the nite element method with a uniform triangulation, see Fig 9.4, is the same as that obtained from the nite dierence method. Given a uniform triangulation as shown in Figure 9.4, we use row-wise ordering for the nodal points
(x i , yj ),
xi = ih,
yj = jh,
h=
1 , n
i = 1, 2, , m 1, j = 1, 2, , n 1.
j (n1)+i
i i i
211
A=
0 0 0 0 0 0
o 0 0 0 0
0 0 o 0 0 0
o 0 0 0 0
0 o o 0
0 0 0 0 o
0 0 0 o 0 0
0 0 0 0 o
where stands for the non-zero entries, and o happens to be stiness matrix is block tri-diagonal B I 0 4 1 B I 4 I 1 A= B= , I B I I B
0 1 1 4 1
where I is the identity matrix. The component of the load vector Fi can be approximated as follows f (x, y )i dxdy fij
D D
i dxdy = h2 fij .
Therefore after we divide h2 to the linear system of equations, we get the exact system of equations as the nite dierence scheme Ui1,j + Ui+1,j + Ui,j 1 + Ui,j +1 4Uij = fij h2
9.2.4
We know that the nite element solution uh is the best solution in terms of the energy norm in the nite dimensional space Vh , that is u uh a u vh a assuming that u is the solution to the weak form. But this does not give a quantitative estimate for the nite element solution. We may wish to have a more precise error estimate in terms of the solution information and the mesh size h. This is done through the interpolation function for which an error estimate is often available from the approximation theory. Note that
i i i
212
the solution information appears as part of error constants in error estimates even though the solution is unknown. We will use the mesh parameters dened on page 205 in the discussion. Denition 9.7. Given a triangulation of Th , let K Th be a triangle with vertices ai , i = 1, 2, 3. The interpolation function of a function v (x, y ) on the triangle is dened as
3
vI (x, y ) =
i=1
v (ai )i (x, y ),
(9.15)
j j , where i is the where i (x, y ) is the piecewise linear function that satises i (aj ) = i Kronecker symbol. A global interpolation function is dened as nnode
vI (x, y ) =
i=1
v (ai )i (x, y ),
(9.16)
where ai are all the nodal points and i (x, y ) is the global basis function centered at ai . Theorem 9.8. Assuming that v (x, y ) C 2 (K ), then we have the error estimate for the interpolation function on a triangle K , v vI
2h max D v
||=2
(9.17)
||=1
(9.18)
a3 h
a2
a1
i i i
213
vI (x, y ) =
i=1 3
=
i=1
i (x, y ) v (x, y ) +
=
i=1
i (x, y )v (x, y ) +
i=1
i (x, y )
+ R(x, y ), where (, ) is a point in the triangle K . It is easy to get |R(x, y )| 2h2 max D v
||=2 3 i=1
since (x, y ) 0 and 3 i=1 i (x, y ) = 1. If we take v (x, y ) = 1 which is a linear function, v then we have x = v = 0 and max||=2 D v = 0. The interpolation is simply the y function itself since it uniquely determined by the values at the vertices of T . Thus we have
3 3
vI (x, y ) = v (x, y ) =
i=1
v (ai )i (x, y ) =
i=1
i (x, y ) = 1.
(9.19)
v = d1 , If we take v (x, y ) = d1 x + d2 y which is also a linear function, then we have x v = d , and max D v = 0. The interpolation is simply the function itself since 2 | | =2 y it uniquely determined by the values at the vertices of K . Thus from the previous Taylor expansion and the identity 3 i=1 i (x, y ) = 1, we have 3
(9.20)
which conclude that 3 i=1 i (x, y ) (d1 (xi x) + d2 (yi y )) = 0 for any d1 and d2 . This says that the linear part in the expansion is the interpolation function. Therefore for a general function v (x, y ) C 2 (K ), we have vI (x, y ) = v (x, y ) + R(x, y ), v vI
2h2 max D v
||=2
This completes the proof of the rst part of the theorem. To prove the second part of the theorem about the error estimate for the gradient, we choose a point (x0 , y0 ) inside the triangle K and apply the Taylor expansion at (x0 , y0 ) to get v (x, y ) = v (x0 , y0 ) + v v (x0 , y0 )(x x0 ) + (x0 , y0 )(y y0 ) + R2 (x, y ), x y |R2 (x, y )| 2h2 max D v
||=2 .
= p1 (x, y ) + R2 (x, y ),
i i i
214
We rewrite the interpolation function vI (x, y ) as vI (x, y ) = v (x0 , y0 ) + v v (x0 , y0 )(x x0 ) + (x0 , y0 )(y y0 ) + R1 (x, y ), x y
from the denition above. On the other hand, vI (x, y ) is the interpolation function, so we also have vI (ai ) = v (ai ) = p1 (ai ) + R2 (ai ), i = 1, 2, 3.
Since p1 (ai ) + R1 (ai ) = p1 (ai ) + R2 (ai ), we conclude R1 (ai ) = R2 (ai ), that is, R1 (x, y ) is the interpolation function of R2 (x, y ) in the triangle K . Therefore we have
3
R1 (x, y ) =
i=1
R2 (ai )i (x, y ).
v (x0 , y0 )(x x
With this equality and by dierentiating vI (x, y ) = v (x0 , y0 ) + v (x0 , y0 )(y y0 ) + R1 (x, y ) with respect to x, we get y
3
x0 ) +
v v vI R1 i (x, y ) = (x 0 , y 0 ) + (x, y ) = (x 0 , y 0 ) + (x, y ). R2 (ai ) x x x x x i=1 Applying the Taylor expansion for
v (x, y ) x
at (x0 , y0 ), we get
v 2v 2v v (x, y ) = (x 0 , y 0 ) + ( x, y )(y y0 ), ( x , y )( x x ) + 0 x x x2 xy where ( x, y ) is a point in the triangle K . From the last two equalities, we get 2v 2v v vI ( x, y )(x x0 ) + ( x, y )(y y0 ) = 2 x x x xy max D v
||=2 3
R2 (ai )
i=1
i x
2h + 2h2
3 i=1
i x
use a shift and rotation coordinates transform such that a2 a3 is the axis and a2 is the origin, see Figure 9.5, = (x x2 ) cos + (y y2 ) sin , = (x x2 ) sin + (y y2 ) cos . Then 1 (x, y ) = 1 (, ) = C = /1 where 1 is the coordinate in the (, ) coordinate system. Thus we get 1 1 1 1 1 1 = cos sin . cos x 1 |1 |
i x
i i i
215
i = 2, 3. We nally get
v vI max D v ||=2 x x
2h +
6h2
from the fact that h. We ca use the same way to get the same error estimate for 2 From the theorem, we can get the following corollary.
vI y
Corollary 9.9. Given a triangulation of Th , we have also the following error estimates for the interpolation function, v vI
L2 (Th )
C1 h2 v
H 2 (Th ) ,
v vI
H 1 (Th )
C2 h v
H 2 (Th ) ,
(9.21)
9.2.5
Recall the two dimensional Sturm-Liouville problem in a bounded domain , (p(x, y )u(x, y )) + q (x, y )u(x, y ) = f (x, y ), u(x, y ) = u0 (x, y ), where u0 (x, y ) is a given function, that is, a Dirichlet boundary condition is prescribed. We assume that p, q C (), p(x, y ) p0 > 0, q (x, y ) 0, f L2 (), and the boundary is smooth (in C 1 ), then we know that the weak form has a unique solution and the energy norm v a is equivalent to the H 1 norm v 1 . Furthermore, we know that the solution u(x, y ) C 2 (). Given a triangulation Th whose outer boundary formed a polygonal approximation to the boundary . Let Vh be the piecewise linear function space over the triangulation Th , and uh be the nite element solution. We have the following error estimates. Theorem 9.10. u uh u uh
a
(x, y ) ,
C1 h u
H 2 (Th ) , 2 H 2 (Th )
u uh
H 1 (Th )
C2 h u
2
H 2 (Th ) , H 2 (Th ) ,
(9.22) (9.23)
L2 (Th )
C3 h u
u uh
C4 h u
where Ci are constants. Sketch of the proof. Since the nite element solution is the best solution in the energy norm, we have u uh
a
u uI
1 u uI C
H 1 (Th )
1 C 2 h u C
H 2 (Th )
because the energy norm is equivalent to the H 1 norm. Also because of the equivalence, we get the estimate for the H 1 norm as well. The third estimate can be obtained using
i i i
216
1 2 1 2
u uh u uh
2 L2 (Th ) 2 L2 (Th )
+ u uh
+ C u uh
2 L2 (Th ) 2 H 1 (Th ) 2 H 2 (Th ) .
1 max {1, C } 2
u uh
+ u uh
The error estimate for the L norm is not trivial in two dimensions. We refer the readers to other advanced text book on nite element methods.
9.3
Any triangle whose area is non-zero can be transformed to the right-isosceles master triangle, or standard triangle , see the right diagram in Figure 9.6. There are three non-zero basis functions over this standard triangle (master triangle), 1 (, ) = 1 , 2 (, ) = , 3 (, ) = . (9.24) (9.25) (9.26)
(x1 , y1 )
(, ) (0, 0) (1, 0)
Figure 9.6. The linear transform from an arbitrary triangle to the standard triangle (master element) and the inverse map.
The linear transform from a triangle (x1 , y1 ), (x2 , y2 ), and (x3 , y3 ), arranged in the
i i i
217
is
3
x=
j =1
xj j (, ),
y=
j =1
yj j (, )
(9.27)
or 1 [(y3 y1 )(x x1 ) (x3 x1 )(y y1 )] 2Ae 1 [(y2 y1 )(x x1 ) + (x2 x1 )(y y1 )] , = 2Ae = (9.28) (9.29)
where Ae is the area of the triangle which can be calculated using the formula in (9.13).
9.3.1
Quadrature formulas
(x, y ) dd, (, )
In the assembling process, we need to evaluate the double integrals q (x, y )i (x, y )j (x, y ) dxdy = f (x, y )j (x, y ) dxdy = q (, ) i (, )j (, ) f (, ) j (, )
p(x, y )i j dxdy =
b c a
a a
c b d
Figure 9.7. A diagram of the quadrature formulas in 2D with one, three, and four quadrature points, respectively.
A quadrature formula has the following form
L
g (, )dd =
S k=1
wk g (k , k ),
(9.30)
where is the standard right triangle, L is the number of points involved in the quadrature. Below we list some commonly used quadrature formulas in two dimensions using one, three, and four points. The geometry of the points are illustrated in Figure 9.7 while the coordinates of the points and the weights are given in Table 9.1. Notice that only the three points quadrature formula is closed since the three points are on the boundary of the triangle. The rest of quadrature formulas are open formulas.
i i i
218
Table 9.1. Quadrature points and weights corresponding to the geometry in Figure 9.7. L 1 3 Points a a b c 4 a b c d (k , k ) 1 , 3 0, 1 , 2 1 , 2 1 , 3 2 , 15 2 , 15 11 , 15 1 3 1 2 0 1 2 1 3 11 15 2 15 2 15 wk 1 2 1 6 1 6 1 6 27 96 25 96 25 96 25 96
9.4
The procedure is essentially the same as the one dimensional case except the details are slightly dierent.
9.4.1
Description of a triangulation.
A triangulation is determined by its elements and nodal points. We use the following notations. Nodal points: Ni , (x1 , y1 ), (x2 , y2 ), , (xnnode , ynnode ). That is, we assume that there are nnode of nodal points. Elements: Ki , K1 , K2 , , Knelem . That is, we assume that there are nelem of elements. A two dimensional array nodes used to describe the relation between the nodal points and the elements: nodes(3, nelem). The rst index is the index of nodal
i i i
219
point in an element, usually in counterclockwise direction, the second index is the index of the element. Example 9.3. We show the relation between the index of nodal points, elements, and its relations below in reference to Figure 9.8. nodes(1, 1) = 5, nodes(2, 1) = 1, nodes(3, 1) = 6, nodes(1, 10) = 7, nodes(2, 10) = 11, nodes(3, 10) = 6,
13 13 14 9 7 8 5 1 2 1 2 3 4 3 5 6 4 9 10 11 12 8 15 16 17 18 12
(x5 , y5 ) = (0, h), (x1 , y1 ) = (0, 0), (x6 , y6 ) = (h, h) (x7 , y7 ) = (2h, h), (x11 , y11 ) = (2h, 2h), (x6 , y6 ) = (h, h).
16
9.4.2
Outline of the FEM algorithm using the piecewise linear basis functions
The main assembling process is the following loop. for nel = 1:nelem i1 = nodes(1,nel); i2 = nodes(2,nel); i3 = nodes(3,nel); ..............
Computing the local stiness matrix and the load vector. ef=zeros(3,1); ek = zeros(3,3); for l=1:nq
i i i
220
p(, )
e
i j i j + x x y y
dx dy.
We need to calculate
and
i y
i i i = + , x x x i i i = + . y y y However we know that 1 [(y3 y1 )(x x1 ) (x3 x1 )(y y1 )] 2Ae 1 = [(y2 y1 )(x x1 ) + (x2 x1 )(y y1 )] . 2Ae = Thus 1 1 (y 3 y 1 ), (x 3 x 1 ) = = x 2Ae y 2Ae 1 1 (y 2 y 1 ), (x 2 x 1 ). = = x 2Ae y 2Ae Add to the global stiness matrix and the load vector. for i= 1:3 ig = nodes(i,nel); gf(ig) = gf(ig) + ef(i); for j=1:3 jg = nodes(j,nel); gk(ig,jg) = gk(ig,jg) + ek(i,j); end end
i i i
221
Iterative method plus preconditioning, e.g., Jacobi, Gauss-Seidel, SOR, conjugate gradient methods etc. Error analysis. Construct interpolation functions. Error estimates for interpolation functions. FEM solution is the best approximation in the nite element space in the energy norm.
9.5
With constant coecients, we can nd a closed form for the local stiness matrix in terms of the coordinates of the nodal points. Thus, the FEM algorithm can be simplied. In this section, we introduce the simplied FEM algorithm. A good reference is: An introduction to the nite element method with applications to non-linear problems by R.E. White, John Wiley & Sons. We consider the Poisson equation u = f (x, y ), (x, y ) ,
u(x, y ) = g (x, y ), (x, y ) 1 , u = 0, (x, y ) 2 . n where can be an arbitrary domain. We can use Matlab PDE Tool-box to generate a triangulation for the domain . The weak form is
u v dx dy =
f v dx dy.
With the piecewise linear basis function dened on a triangulation on , we can derive analytic expressions for the basis functions and the entries of the local stiness matrix. Theorem 9.11. Given a triangle determined by (x1 , y1 ), (x2 , y2 ), (x3 , y3 ). Let a i = x j ym x m yj , bi = y j y m , ci = xm xj , (9.31) (9.32) (9.33)
where i, j , m is a positive permutation of 1, 2, and 3. For examples, i = 1, j = 2, m = 3, i = 2, j = 3, m = 1, i = 3, j = 1, m = 2. Then the non-zero three basis functions have the following expressions i (x, y ) = ai + bi x + ci y , 2 i = 1, 2, 3. (9.34)
i i i
222
(9.35)
We prove the theorem for 1 (x, y ). From the expression of 1 (x, y ), we have 1 (x, y ) = = Therefore we can get 1 (x2 , y2 ) = 1 (x3 , y3 ) = 1 (x1 , y1 ) = (x 2 y 3 x 3 y 2 ) + (y 2 y 3 )x 2 + (x 3 x 2 )y 2 = 0, 2 (x 2 y 3 x 3 y 2 ) + (y 2 y 3 )x 3 + (x 3 x 2 )y 3 = 0, 2 2 (x 2 y 3 x 3 y 2 ) + (y 2 y 3 )x 1 + (x 3 x 2 )y 1 = = 1. 2 2 a1 + b1 x + c1 y , 2 (x 2 y 3 x 3 y 2 ) + (y 2 y 3 )x + (x 3 x 2 )y . 2
We can prove the same feature for 2 and 3 . We have the following theorem which is essential to the simplied nite element method. Theorem 9.12. With the same notations as in Theorem 9.11, we have the following equalities: (1 )m (2 )n (3 )l dxdy = i j dxdy = m! n! l! 2, (m + n + l + 2) ! (9.36) (9.37) (9.38) (9.39) (9.40)
e e F1 =
bi bj + ci cj , 4 + f2 + f3 6 12 12 + f2 + f3 12 6 12 + f2 + f3 . 12 12 6
e F2 =
e F3 =
where fi = f (xi , yi ). The proof is straightforward since we have analytic form of i . There is a negligible error in approximating f (x, y ) and the load vector f (x, y ) f1 1 + f2 2 + f3 3 , (9.41)
i i i
223
= f1
1 f (x, y ) dxdy
e 2 1 dxdy + f2 e
(9.42) 1 2 dxdy + f3
e
1 3 dxdy.
Note that the integrals in the expression above can be obtained from the formulas (9.36)
9.5.1
Assume that we have a triangulation, for example, a triangulation generated from Matlab by saving the mesh. Then we have the following, p(1, 1), p(1, 2), , p(1, nnode) p(2, 1), p(2, 2), , p(2, nnode) are x coordinates of the nodal points, are y coordinates of the nodal points.
And the array t, (in fact, it is nodes in terms of our earlier notations), t(1, 1), t(1, 2), , t(1, nele) t(2, 1), t(2, 2), , t(2, nele) t(3, 1), t(3, 2), , t(3, nele) are the index of the rst node of an element, are the index of the second node of the element, are the index of the third node of the element,
and the array e to describe the nodal points on the boundary e(1, 1), e(1, 2), , e(1, nbc) e(2, 1), e(2, 2), , e(2, nbc) are the index of the beginning node of a boundary edge, are the index of the end node of the boundary edge.
A Matlab code for the simplied nite element method is listed below.
% Set-up: assume we have a triangulation p,e,t from Matlab PDE tool box % already. [ijunk,nelem] = size(t); [ijunk,nnode] = size(p); for i=1:nelem nodes(1,i)=t(1,i); nodes(2,i)=t(2,i); nodes(3,i)=t(3,i); end gk=zeros(nnode,nnode); gf = zeros(nnode,1); for nel = 1:nelem, for j=1:3, % Begin to assemle by element. % The coordinates of the nodes in the
i i i
224
for j=1:3, % The coordinates of the nodes in the jj = nodes(j,nel); % element. xx(j) = p(1,jj); yy(j) = p(2,jj); end for i=1:3, j = i+1 - fix((i+1)/3)*3; if j == 0 j = 3; end m = i+2 - fix((i+2)/3)*3; if m == 0 m = 3; end a(i) = xx(j)*yy(m) - xx(m)*yy(j); b(i) = yy(j) - yy(m); c(i) = xx(m) - xx(j); end delta = ( c(3)*b(2) - c(2)*b(3) )/2.0; % Area.
for ir = 1:3, ii = nodes(ir,nel); for ic=1:3, ak = (b(ir)*b(ic) + c(ir)*c(ic))/(4*delta); jj = nodes(ic,nel); gk(ii,jj) = gk(ii,jj) + ak; end j = ir+1 - fix((ir+1)/3)*3; if j == 0 j = 3; end m = ir+2 - fix((ir+2)/3)*3; if m == 0 m = 3; end
i i i
225
%-----------------------------------------------------% Now deal with the Dirichlet boundary condition [ijunk,npres] = size(e); for i=1:npres, xb = p(1,e(1,i)); yb=p(2,e(1,i)); g1(i) = uexact(xb,yb); end for i=1:npres, nod = e(1,i); for k=1:nnode, gf(k) = gf(k) - gk(k,nod)*g1(i); gk(nod,k) = 0; gk(k,nod) = 0; end gk(nod,nod) = 1; gf(nod) = g1(i); end u=gk\gf; pdemesh(p,e,t,u) % End. Example 9.4. We test the simplied nite element method for Poisson equation using the following example. Domain: Unit square with a hole, see Figure 9.9. Exact solution: u(x, y ) = x2 + y 2 , therefore, f (x, y ) = 4. Boundary condition, Dirichlet on the whole boundary. Use Matlab PDE Tool-box to generate initial mesh and then export it. % Solve the linear system. % Plot the solution.
Figure 9.9 is the domain and the mesh generated by the Matlab PDE Tool-box. The left plot in Figure 9.10 is the mesh plot of the FEM solution while the right plot is the error plot. The error is of O(h2).
i i i
226
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1 1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
6 4 2 0 2 4
1 0.5
0.5 0 0 0.5
Figure 9.10. (a) Solution plot u(x, y ) = x2 + y 2 , f (x, y ) = 4. (b): Error plot.
9.6
Given a triangulation (triangles, rectangles, quadrilaterals, etc), we want to construct dierent nite element spaces with nite dimensions. There are several reasons why we want to do this: To have better accuracy of the FE solution if we use piecewise higher order polynomial basis functions. We need high order derivatives for high order PDES, for example, the solution to a biharmonic equations is in H 2 space.
i i i
227
We will focus on conforming piecewise polynomial nite element spaces. A set of polynomials of degree k is denoted as
i+j k
Pk =
v (x ),
v (x ) =
i,j =0
aij xi xj
Example 9.5. We list some polynomial spaces below. P1 = { v (x), P2 = v (x ), v (x) = a00 + a10 x + a01 y } v (x) = a00 + a10 x + a01 y + a20 x2 + a11 xy + a02 y 2
Degree of freedom of Pk . For any xed xi , the possible y j terms of a pk (x) Pk are y , y 1 , , y ki , that is, j is from 0 to k i. Thus there are k i + 1 parameters for a given xi . Therefore, the total degree of freedom is
k k k 0
(k i + 1) =
i=0 i=0
(k + 1)
i=0
= (k + 1)2
(k + 1)(k + 2) k(k + 1) = . 2 2
We list the degrees of the freedom for dierent k below, 3 when k = 1, the linear function space P1 . 6 when k = 2, the quadratic function space P2 . 10 when k = 3, the cubic function space P3 . 15 when k = 4, the fourth order polynomials space P4 . 21 when k = 5, the fth order polynomials space P5 . Regularity requirements: Generally we can not conclude that v (x, y ) C 0 if v (x, y ) H 1 . However if Vh are a nite dimensional space of piecewise polynomials, then such conclusion is indeed true. Similarly, if v (x, y ) H 2 , and v (x, y ) Pk , then v (x, y ) C 1 . The regularity requirements are important when we construct a nite element space. As we know, there are two ways to improve the accuracy. One way is to decrease the mesh size h. The other way is to use high order polynomial spaces Pk . In general , we have the following error estimates for the FE solution uh if we use Pk nite element space on a given triangulation Th for second order linear elliptic PDEs u uh
H 1 (Th )
C1 hk u
H k+1 (Th ) ,
u uh
L2 (Th )
C2 hk+1 u
i i i
228
a31
a12
a23
a
1
a2
9.6.1
The degree of the freedom of a quadratic function on a triangle is six. We add three auxiliary middle points along the three sides to get six points on the triangle to dene a quadratic function. Theorem 9.13. Give a triangle K = (a1 , a2 , a3 ), see Figure 9.11. A function v (x, y ) P2 (K ) is uniquely determined by its values at v (a i ), i = 1, 2, 3; and v (a12 ), v (a23 ), v (a31 ), the three middle points.
Intuitively, there are six parameters and six conditions. So we should be able to determine the quadratic function uniquely. The highlights of the proof is the following. We just need to prove the homogeneous case: v (ai ) = 0, v (aij ) = 0 since the right hand side would not aect the existence and uniqueness. We can factorize a quadratic function as a product of two linear functions as v (x) = 1 (x) (x) = 1 (x)2 (x)0 , where i (x, y ) are the local basis function i (ai ) = 1, and i (aj ) = 0, if i = j . It is easier to use new coordinates that is aligned with one of three sides. Proof: We introduce the new coordinate system, see Figure 9.5: = (x x2 ) cos + (y y2 ) sin = (x x2 ) sin + (y y2 ) cos . Under the new coordinates, a2 is the origin and a2 a3 is the - axis and v (x, y ) can be written as 10 + a 01 + a 20 2 + a 11 + a 02 2 . v (x, y ) = v (x(, ), y (, )) = v (, ) = a 00 + a Also under the new coordinates, we have 1 (, ) = + + =
i i i
229
(a3 ) = v (a23 ) = 0, we get a 00 = 0, a 01 = 0, and a 02 = 0. Therefore we can Since v (a2 ) = v write v (, ) = a 10 + a 11 + a 20 2 = ( a10 + a 11 + a 20 ) = a 10 a 20 a 11 + + = 1 (, ) (, )
Similarly along the edge a1 a3 , we know that v (a13 ) = (a13 ) (a13 ) = 1 (a13 ) = 0 2 v (a1 ) = (a1 ) (a1 ) = (a1 ) = 0,
that is, (a13 ) = 0, By similar arguments, we conclude that (x, y ) = 2 (x, y ) 0 and nally v (x, y ) = 1 (x, y )2 (x, y )0 . Using the zero value of v at a12 , we have v (a12 ) = 1 (a12 ) 2 (a12 ) 0 = which concludes that 0 = 0 and thus v (x, y ) 0. 1 1 0 = 0, 2 2 (a1 ) = 0.
Therefore the piecewise quadratic functions dened on two triangles with a common side is identically same on the entire side if they have the same values at the two end points and at the middle point along the side.
i i i
230
v (x, y )
=
i=1
+
i,j =1,i<j
Proof: It is easy to verify for the vertices if we plug in aj into the right hand side of the expression above, v (aj )j (aj ) 2j (aj ) 1 = v (a j )
since i (aj ) = 0 if i = j . We take one min-point to verify the theorem. If we plug in a12 into the left expression above, we have v (a1 )1 (a12 ) 2i (a12 ) 1 + v (a2 )2 (a12 ) 22 (a12 ) 1 + v (a3 )3 (a12 ) 23 (a12 ) 1 + 4v (a12 )1 (a12 )2 (a12 ) + 4v (a13 )1 (a12 )3 (a12 ) + 4v (a23 )2 (a12 )3 (a12 ) = v (a12 ), 1 = 0, 22 (a12 ) 1 = 2 1 1 = 0, 3 (a12 ) = 0, and since 2i (a12 ) 1 = 2 1 2 2 12 12 1 1 41 (a )2 (a ) = 4 2 2 = 1. Note that the local stiness matrix using quadratic functions is a six by six matrix.
9.6.2
There are several ways in constructing cubic basis functions in H 1 C 0 over a triangulation. One key consideration is how to keep the continuity of basis functions along the edges of neighboring triangles. Notice that the degree of freedom of a cubic function in 2D is 10. One way is to add two auxiliary points along each side, and one auxiliary point inside the triangle. Along with the three vertices, we have ten points on a triangle to match the degree of the freedom, see Figure 9.12. The existence and uniqueness of such a cubic function is stated in the following theorem. Theorem 9.15. A cubic function v P3 (K ) is uniquely determined by the values of v (a i ), v (aiij ), i, j = 1, 2, 3, i = j, v (a123 ), (9.45)
i i i
9.6. Some nite element spaces in H 1 () and H 2 () a3 a331 a113 a1 a112 a221 a2 10, P3 (K ), C 0 10, P3 (K ), C 0 a332 a223
231
Figure 9.12. A diagram of the freedom used to determine two dierent cubic basis function H 1 C 0 . We use the following notations, : function values; : values of the rst derivatives.
where a123 = 1 3 a1 + a2 + a3 , aiij = 1 3 2ai + aj , i, j = 1, 2, 3, i = j. (9.46)
Sketch of the proof: Similar to the quadratic case, we just need to prove that the cubic function is identical zero if v (ai ) = v (aiij ) = v (a123 ) = 0. Using the local coordinates such that one of sides of the triangle T is on the axis, we can get v (x) = C1 (x)2 (x)3 (x),
11 = 0, where C is a constant. We also have v (a123 ) = C1 (a123 )2 (a123 )3 (a123 ) = C 1 3 33 so we get C = 0 and thus conclude that v (x) 0. In terms of the continuity along the common side of two adjacent triangles, we notice that the polynomial of two variables will become a polynomial of one variable along the side since we can substitute x with respect to y or other way around from the line equations l0 + l10 x + l01 y = 0. A cubic function of one variable is uniquely determined by the values of four distinct points. There is another type of cubic basis functions using the rst order derivatives at the vertices, see the right diagram in Figure 9.12. This is stated in the following theorem.
v i (a ), xj
v (a i ) x
i = 1, 2, 3, j = 1, 2
v (a i ) y
i = j,
v (a123 ),
(9.47)
and
At each vertex of the triangle, we have three degrees of freedom which are the function value and two rst order partial derivatives. So total, we have nine degrees of freedom. An additional degree of freedom is the value at the centroid of the triangle. In terms of the continuity, along a common side of two adjacent triangles, a cubic polynomial of one variable is uniquely determined by its function values at two distinct points plus
i i i
232
the rst order derivatives from the Hermite interpolation theory. The rst order derivative v is the tangential derivative along the common side which is dened as v = x t1 + v t , t y 2 2 2 where t = (t1 , t2 ), t1 + t2 = 1, is the unit direction of the common side.
9.6.3
Basis functions in H 2 C 1
Such basis functions are needed for fourth order PDEs such as a biharmonic equation (uxx + uyy ) = uxxxx + 2uxxyy + uyyyy = 0 (9.48)
in two dimensions. Since second order partial derivatives are involved, we need to use polynomials whose degrees are more than three. On a triangle, if we specify the function values and up to second order partial derivatives, the degree of freedom would be at least eighteen. The closest polynomial would be a polynomial of degree of ve. A fth polynomial v (x) P5 has a degree of freedom 21, see the left diagram in Figure 9.13.
Figure 9.13. A diagram of the freedom used to determine two dierent fth polynomial basis functions in H 1 C 1 . In addition to the previous notations, we : values of the second derivatives. /: values of the rst derivatives. also denote, : values of the mixed derivatives.
Theorem 9.17. A cubic function v P3 (K ) is uniquely determined by the values of D v (a i ), i = 1, 2, 3, || 2, v ij (a ), i, j = 1, 2, 3, i < j, n (9.49)
v v where n (ai ) = x (ai )n1 + v (ai )n2 stands for the normal derivative of v (x), and n = y 2 (n1 , n2 ), n2 + n = 1 is the outward unit normal direction to the boundary of the triangle. 1 2
Sketch of the proof: We just need to show that v (x) = 0 if D v (ai ) = 0, i = v 1, 2, 3, || 2 and n (aij ) = 0, i, j = 1, 2, 3, i < j . A fth polynomial v (s) of one variable s is uniquely determined by the values of v , v (s), and v (s) at two distinct points. Thus v along a2 a3 , v (x) has to be zero for the given homogeneous conditions. Notice that n (x ) 2 3 is a fourth polynomial of one variable along a a . Since all the rst and second order partial derivatives are zero at a2 and a3 , we have v i (a ) = 0, n n v n (ai ) = 0, i = 2, 3
i i i
233
= 0 along
(9.50)
(9.51)
where C is a constant. We have to have C = 0 otherwise v (x) would be a polynomial of degree sixth, which contradicts the fact of v (x) P5 . The continuity condition along a common side of two adjacent triangles in C 1 has two parts. Both the function and the normal derivative have to be continuous. Along a common side of two adjacent triangles, a fth polynomial of v (x, y ) is actually of a fth polynomial of one variable v (s) which can be uniquely determined by the values v (s), v (s), and v (s) at two distinct points. Thus the two fth polynomials on two adjacent triangles are identical along the common side if they have the same values of v (s), v (s), and v (s) at two shared vertices. Similarly, for the normal derivative along a common side v of two adjacent triangles, it is a fourth polynomial of one variable n (s). The polynomials v d v can be uniquely determined by the values n (s) and ds n (s) at two distinct plus the v value of a n (s) at the middle point. Thus the continuity of the normal derivative is also guaranteed. v An alternative approach is to replace the values of n (aij ) at the three middle points of three sides by imposing other three conditions. For example, assume that along a 2 a3 , the normal derivative of the fth of the polynomial has the form v = a00 + a10 + a20 2 + a30 3 + a40 4 . n We can impose a40 = 0. In other words, along the side of a2 a3 , the normal derivative of v becomes a cubic polynomial of one variable. The continuity can be guaranteed by the n Hermite interpolation theory. Using this approach, the degree of the freedom reduced to 18 from original 21, see the right diagram in Figure 9.13 for an illustration.
9.6.4
While triangle meshes are intensively used particularly for arbitrary domains, meshes using quadrilaterals are also popular for rectangular regions. Often we use bi-linear functions as basis functions. We rst consider a bilinear function space in H 1 C 0 . A bilinear function space over a quadrilateral K in two dimension, see Figure 9.14 for an illustration, is dened as Q 1 (K ) = v (x, y ), v (x, y ) = a00 + a10 x + a01 y + a11 xy . (9.52)
Note that v (x, y ) is linear with respect to x and y , respectively. That is why it is called a bilinear functions. The degree of the freedom of a bilinear function in Q1 (K ) is four. Theorem 9.18. A bilinear function v (x, y ) Q1 (K ) is uniquely determined by its values at four corners.
i i i