You are on page 1of 16

Introduction to Numerical Analysis II:

Finite Element Method


Xiaozhe Hu
The Pennsylvania State University

X. Hu (Penn State)

MATH/CMPSC 456

Apr. 9, 2012

1/9

1D: Boundary Value Problem


Model Problem:

X. Hu (Penn State)

(
u 00 (x) = f (x)
u(0) = u(1) = 0

x (0, 1)

MATH/CMPSC 456

Apr. 9, 2012

2/9

1D: Boundary Value Problem


Model Problem:

(
u 00 (x) = f (x)
u(0) = u(1) = 0

x (0, 1)

Introduce a Space:
V := {v C 1 ([0, 1]),

X. Hu (Penn State)

v (0) = v (1) = 0}

MATH/CMPSC 456

Apr. 9, 2012

2/9

1D: Boundary Value Problem


Model Problem:

(
u 00 (x) = f (x)
u(0) = u(1) = 0

x (0, 1)

Introduce a Space:
V := {v C 1 ([0, 1]),

v (0) = v (1) = 0}

Weak Formulation: Find u V , such that


Z 1
Z 1
u 0 (x)v 0 (x)dx =
f (x)v (x)dx,
0

X. Hu (Penn State)

v V

MATH/CMPSC 456

Apr. 9, 2012

2/9

Finite Element Space


Grid:
0 = x0 < x1 < < xN < xN+1 = 1,
h = xi+1 xi =

X. Hu (Penn State)

1
.
N +1

MATH/CMPSC 456

Apr. 9, 2012

3/9

Finite Element Space


Grid:
0 = x0 < x1 < < xN < xN+1 = 1,
h = xi+1 xi =

1
.
N +1

Finite Dimensional Space:


Vh = {vh C 0 ([0, 1]), vh |[xi1 ,xi ] P1 , vh (0) = vh (1) = 0}

X. Hu (Penn State)

MATH/CMPSC 456

Apr. 9, 2012

3/9

Finite Element Space


Grid:
0 = x0 < x1 < < xN < xN+1 = 1,
h = xi+1 xi =

1
.
N +1

Finite Dimensional Space:


Vh = {vh C 0 ([0, 1]), vh |[xi1 ,xi ] P1 , vh (0) = vh (1) = 0}
Basis of Vh

i (x) =

xxi1

xi xi1
xi+1 x
xi+1 xi

X. Hu (Penn State)

x (xi1 , xi )
x [xi , xi+1 )

i = 1, 2 , N

otherwise

MATH/CMPSC 456

Apr. 9, 2012

3/9

Finite Element Method


Finite Element Method: Find uh Vh , such that,
Z 1
Z 1
uh0 (x)vh0 (x)dx =
f (x)vh (x)dx,
0

X. Hu (Penn State)

vh Vh

(1)

MATH/CMPSC 456

Apr. 9, 2012

4/9

Finite Element Method


Finite Element Method: Find uh Vh , such that,
Z 1
Z 1
uh0 (x)vh0 (x)dx =
f (x)vh (x)dx,
0

vh Vh

(1)

Two Observations:
P
uh (x) = N
j=1 uj j (x)
To fulfill (1) for any function vh in Vh is equivalent to fulfill it only for
the basis functions i (x), i = 1, 2, , N

X. Hu (Penn State)

MATH/CMPSC 456

Apr. 9, 2012

4/9

Finite Element Method


Finite Element Method: Find uh Vh , such that,
Z 1
Z 1
uh0 (x)vh0 (x)dx =
f (x)vh (x)dx,
0

vh Vh

(1)

Two Observations:
P
uh (x) = N
j=1 uj j (x)
To fulfill (1) for any function vh in Vh is equivalent to fulfill it only for
the basis functions i (x), i = 1, 2, , N
Discretized Equation
N Z
X
(
j=1

0j (x)0i (x)dx)uj

X. Hu (Penn State)

Z
=

f (x)i (x)dx,

i = 1, 2, , N

MATH/CMPSC 456

Apr. 9, 2012

4/9

Finite Element Method (cont.)

Let aij =
system

R1
0

0j (x)0i (x)dx and fi =

R1
0

f (x)i (x)dx, we have the linear

Au = f
where u = (u1 , u2 , , uN )T , f = (f1 , f2 , , fN )T , and A = (aij ).
Moreover, A can be computed and
A=

X. Hu (Penn State)

1
tridiag (1, 2, 1).
h

MATH/CMPSC 456

Apr. 9, 2012

5/9

FEM for Heat Equation in 1D


Model Problem:
ut (x, t) uxx (x, t) = f (x, t),

x (0, 1),

, t > 0,

with boundary conditions


u(0, t) = u(1, t) = 0,
and initial condition
u(x, 0) = u0(x),

X. Hu (Penn State)

x (0, 1).

MATH/CMPSC 456

Apr. 9, 2012

6/9

Discretization in Space

Weak Form:
Z 1
Z
ut (t, x)v (x)dx +
0

X. Hu (Penn State)

Z
ux (t, x)vx (x)dx =

f (t, x)v (x)dx


0

MATH/CMPSC 456

Apr. 9, 2012

7/9

Discretization in Space

Weak Form:
Z 1
Z
ut (t, x)v (x)dx +
0

Z
ux (t, x)vx (x)dx =

f (t, x)v (x)dx


0

Discretization in Space t > 0, find uh (t) Vh such that


Z
0

uh (t)
vh (x)dx +
t

X. Hu (Penn State)

Z
0

uh (t) vh (x)
dx =
x
x

MATH/CMPSC 456

f (t, x)vh (x)dx

vh (x)

Apr. 9, 2012

7/9

Discretization in Space
Let uh (t) =

PN

Z
N
X
uj (t)

j=1

j=1 uj (t)j (x),

j (x)i (x)dx+

N
X

Z
uj (t)

j=1

or in matrix form
M

0j (x)0i (x)dx

f (t, x)i (x)d


0

u(t)
+ Au(t) = f(t).
t

where
Z
(M)ij =

Z
i (x)j (x)dx,

(A)ij =

X. Hu (Penn State)

0i (x)0j (x)dx

MATH/CMPSC 456

Apr. 9, 2012

8/9

Fully Discretization

-method
M

uk+1 uk
+ A(uk+1 + (1 )uk ) = f(tk+1 ) + (1 )f(tk ).
t

i.e.
(M + tA)uk+1 = (M (1 )tA)uk + t(f(tk+1 ) + (1 )f(tk )).

X. Hu (Penn State)

MATH/CMPSC 456

Apr. 9, 2012

9/9

You might also like