Vous êtes sur la page 1sur 4

Finite Element Method

Haihang You
Department of Electrical Engineering and Computer Science,
The University of Tennessee, Knoxville, TN 37996, U.S.A.
(Dated: October 29, 2008)
Finite Element Method is a powerful and widely used method for numerical solutions of partial
differential equations. Continuous Galerkin finite element method is a well established PDE solver.
This article tries to introduce the method and the software to solve the Poissons equation fast and
with high order accuracy, it is complicated as it includes mesh generation, mesh refinement, 1st , 2nd
and even higher order approximation, stiffness matrix assembly , and fast linear solver. This program
will solve Poissons equation with Dirichlet boundary condition. It utilize the triangulation software:
Triangle[a], which is a Two-Dimensional quality mesh generator and delaunay triangulator. Mesh
refinement, 1st , 2nd order approximation, and Conjugate Gradient solver are also implemented in
the program.
PACS numbers:

I.

INTRODUCTION

In 1943, Richard Vourant introduced Finite Element


Methods[1] for approximating solutions for partial differential equations. Since then it has been studied and developed to be the powerful and widely used methods for
numerical solutions of partial differential equations. In
this chapter we will revisit Continuous Galerkin Methods
and reveal a new approach of assembling linear system,
which shows great deal of potentials of performance improvement than traditional way of matrix formation by
superimposing Dirichlet matrix block for linear solver.
Continuous Galerkin Methods, also referred as Standard Galerkin Methods is a popular Finite Element Methods for solving Partial Differential Equations(PDEs). It discretizes the given continuous problem,
generates a system of equations with finite dimensions,
and obtains approximate solutions by solving the linear
system.

0 on }, we can obtain the variational formulation by


multiplying Eq(1) with v V and integrating over :
Z
Z
2
f vdx v V
(3)
( u)vdx =

With integration by parts, we have


Z
Z
Z
(2 u)vdx =
u vdx

Let u be the solution of Eq(1), then u is also the solution


of following variational problem: Find u V such that
a(u, v) = (f, v)

(f, v) =

(1)
(2)

where Rd , d = 2, 3, gD denotes Dirichlet boundary condition, and boundary with n being the unit
outward normal vector. Let V = {v H 1 () : v =

Electronic address: you@eecs.utk.edu


[1] http://www.cs.cmu.edu/ quake/triangle.html

(6)

u vdx

(7)

f vdx

(8)

Let us consider the following second order elliptic problem of Poissons equation:
u = f in
u = gD on

v V

where

Poissons Equation

(4)

MATHEMATICAL DESCRIPTION
A.

u
vdx
n

Since v = 0 on the boundary, the second term on the


right hand side vanishes, and we have
Z
Z
2
( u)vdx =
u vdx
(5)

a(u, v) =
II.

B.

Standard Galerkin Formulation

Let h = {Ki : i = 1, 2, ..., mh } be a set of star-like nonoverlapping partitions of with length of 0 < h 1, such
that = Kh K = K1 K2 ... Kmh . Each element
of h satisfies the minimal angle condition[2]. Internal
edges are defined as E I = {e = Ki Kj , d1 (e) >
0, 1 < i mh }, and boundary edges are defined as E B =
{e = Ki , d1 (e) > 0, 1 < i mh }, and E = E I
B
E B , where Dirichlet boundary edges are ED
, Neumann
B
B
B
B
B
boundary edges are EN
, E B = ED
EN
and ED
EN
=.
Define the energy space Eh as:
Y
Eh =
H 2 (K)
Kh

and define the finite element space Vhr as:


Y
Vhr =
Pr (K)

Now we can express the finite element approximation as


a system of linear equations:

where Pr (K) is the space of polynomials of total degree


r 1.
Now we can formulate the Standard Galerkin Method
for Eq(1) from the variational formulation Eq(6) as: Find
uh Vhr such that

A is called the StiffnessMatrix which is symmetric positive definite with each element defined in Eq(14), b is a
vector which is defined in Eq(15), and the solution of the
linear system, = (1 , 2 , ..., N )T are the result of the
finite element approximation over internal DOFs in .

A = b

Kh

a(uh , vh ) = (f, vh ) vh Vhr

(16)

(9)

The basis functions can be defined as following: For each


of degree of freedom(DOF), j (xi ) Vhr ,

1
if i = j
j (xi ) = ij =
(10)
0
if i 6= j

C.

Stiffness Matrix

We have shown that the finite element methods will


end up solving a linear system of equations. In practice, the stiffness matrix A are computed by summing
contributions from all triangles, see [3] for more details.
(0, 1)
2
(x1 , y1 )
1

1
1

0.8

0.5

0.8

0.6

1
1

0.6
0
1

0.4

0.8
0.6

0.4
0.8

0.2

0.4

0.2

0.6
0.4

0.2
0

0.2

(a) A triangulated 2D
mesh.

0
(0, 0)

(b) Support of linear


j

1
(1, 0)

(a) K

0
(x0 , y0 )

2
(x2 , y2 )
(b) K

FIG. 1: Linear basis functions on a triangulated 2D mesh.

Figure 1 shows that the support of j are the triangles


which share the common node xi which is the center of
the mesh in Figure 1(a). Now we can represent vh Vhr
as:
X
vh (xj ) =
j j (xj ), j = vh (xj ), for xj . (11)

FIG. 2: Affine transformation between triangle K and refer


ence triangle K

1.

Affine Transformation

By choosing vh (xj ) = j (xj ), and let


uh (xi ) =

N
X

i i (xi )

(12)

i=1

where xi are internal DOFs, which are not on boundaries


of . We can write Eq(9) as:
N
X
i=1

i j dx =

f j dx

(13)

where
aji = aij =

i j dx

(14)

f j dx

(15)

fj =

In 2D case, an element is a triangle. Figure 2 shows


and an arbitrary triangle K. In
a reference triangle K
practice the values of polynomial Pn (x) and their firstorder derivatives are pre-computed on the reference triangle. To calculate the stiffness matrix (Diri block) for
an triangle, an Affine Transformation from an individual
triangle to a reference triangle is defined as following:

The Affine transformation F from reference triangle K


to triangle K is:

  
  
x0
x1 x0 x2 x0
x

x
+
(17)
=
y0
y
y1 y0 y2 y0
y
The Affine transformation F1 from reference triangle
is:
K to triangle K
 



1
x

y2 y0 (x2 x0 )
x x0
=
y
y y0
2|K| (y1 y0 ) x1 x0
(18)

or

3.

1
2|K|

c11 c12
c21 c22



x x0
y y0

(19)

where |K| = area of the triangle.


Then base function derivative can be represented by
reference triangles base functions derivatives:
=

1
2|K|

c11 c21
c12 c22

i j dxdy
K
Z
1
l )T (C
m )d
aji = aij =
(C
xd
y
2|K| K
aji = aij =

f (x, y)j (x, y)dxdy


bj =
ZK
f(
x, y)m (
x, y)d
xd
y
bj = 2|K|

(20)

(21)
(22)

First Order Basis Functions

1. Vertices on the reference triangle:


z0 = (0, 0) z1 = (1, 0) z2 = (0, 1)
Vertices on a triangle:
z0 = (x0 , y0 ) z1 = (x1 , y1 )

z2 = (x2 , y2 )

2. Basis functions are:


0 (
x, y) = 1 x y
1 (
x, y) = x

1. Vertices on the reference triangle:


z1 = (0, 0)
z4 = (0.5, 0)

z2 = (1, 0) z3 = (0, 1)
z5 = (0.5, 0.5) z6 = (0, 0.5)

Vertices on a triangle:
z0 = (x0 , y0 )
z3 = (x3 , y3 )

z1 = (x1 , y1 )
z4 = (x4 , y4 )

z2 = (x2 , y2 )
z5 = (x5 , y5 )

2. Basis functions are:


1 (
x, y) = 2
x2 + 4
xy + 2
y 2 3
x 3
y+1
2
2 (
x, y) = 2
x x
3 (
x, y) = 2
y 2 y
4 (
x, y) = 4
x2 4
xy + 4
x

(23)
(24)

where 1 i, j N , are global indices of DOFs on the


triangle, and 0 l, m 2 are local indices.

2.

Second Order Basis Functions

5 (
x, y) = 4
xy
6 (
x, y) = 4
xy 4
y 2 + 4
y
3. 1st order derivative basis functions are:


4
x + 4
y3

0 (
x, y) =
4
x + 4
y3


4
x1

1 (
x, y) =
0


0
2 (

x, y) =
4
y1


8
x 4
y+4
3 (
x, y) =

4
x


4
y
4 (

x, y) =
4
x


4
y
5 (

x, y) =
4
x 8
y+4
As we have shown above, on each triangle, we have 3
DOFs for 1st order polynomials, 6 for 2nd order, and for
3rd order and 4th order polynomials, we have 10 and 16
DOFs respectively.

2 (
x, y) = y
III.

3. 1st order derivative basis functions are:




1
0 (

x, y) =
1
 
1
1 (

x, y) =
0
 
0
2 (

x, y) =
1

SOFTWARE DEVELOPMENT

In Section II, we have seen the descriptions of calculations on each triangle, which will contribute to stiffness
matrix and right hand side vector. Before we can do any
computation, we need triangulate the domain. I used
software Triangle to generate initial triangulation, then
read in triangulation information. The program can refine the mesh by bi sectioning each edge. Fig 3(a) is the
initial mesh. Fig 3(b) shows the refined mesh.

x 10
4
3.5
3
2.5
2
1.5
1
0.5

(a) Initial mesh


generated by
Triangle.

(b) Refined mesh.

1
0.5

0.5
0

0.2

0.4

0.6

0.8

0
1

FIG. 4: Result of application 1.

Application 2:
IV.

APPLICATION

In this section we utilize the software to solve Poissons


equation with two different boundary conditions.
2 u(x, y) = f (x, y)

f (x, y) = 1, when x, y (0.49, 0.51)


gx=0 = 1, gx=1 = 0, gy=0 = 0, gy=1 = 0

(28)
(29)

(25)

where is (0, 1) (0, 1).


(0, 1)

(1, 1)

1.2
1
0.8
0.6
0.4

0.2
0
0.2
0
0.8

0.6

0.5

0.4
0.2
1

(0, 0)

(1, 0)
FIG. 5: Result of application 2.

FIG. 3: A positive charge at the center of a box.

Application 1:
f (x, y) = 1, when x, y (0.49, 0.51)
gD = 0 on

(26)
(27)

[1] R. Courant. Variational methods for the solutions of equilibrium and vibrations. Bull. Amer. Math. Soc., pages
123, 1943.
[2] Peter Knabner and Lutz Angermann. Numerical Methods
for Elliptic and Parabolic Partial Differential Equations:

Uniformly distributed positive charge with density of


= 0 is put at the center of the box within a radius
of 0.01. Numerical solutions are shown in Figure IV and
IV.

An Applications-oriented Introduction. Springer, 2003.


[3] Endre S
uli. Finite element methods for partial differential
equations. 2007.

Vous aimerez peut-être aussi