Math/AMath 595: Special Topics in Numerical Analysis, Winter 2001

Assignment 1.

Due Mon., Jan. 22.

Objectives: To program a 1-D finite element method and see how it compares with a finite difference approach.

(1)
Derive the equations for the continuous piecewise linear finite element approximation to the solution of the boundary value problem
L u º - d
dx
æ
ç
è
p(x) du
dx
ö
÷
ø
+ q(x) u = f(x) ,    0 £ x £ p,
u(0) = u( p) = 0 ,
starting from the weak form of the equation: Find u Î H01 such that
áLu,v ñ = áf , v ñ   "v Î H01 ,
where
H01 = { v : v(0) = v( p) = 0 and ó
õ
p

0 
( v¢)2 + v2 < ¥} ,   áv, w ñ = ó
õ
p

0 
v(x)w(x) dx .

(2)
Write a code in MATLAB or another language to solve the problem in (1) with q(x) = 1 and
p(x) = ì
í
î
1 ,
0 £ x £ p/ 3
100 ,
p/ 3 < x £ p
.
You can check your code by fixing a solution u and determining what f is. For example, try setting
f(x) = ì
ï
ï
í
ï
ï
î
5
4
sin x
2
,
x £ p/ 3
13
50
sin x
2
+ 99
200
,
x > p/ 3
.
Then the solution is
u(x) = ì
ï
ï
í
ï
ï
î
sin x
2
,
x £ p/ 3
1
100
sin x
2
+ 99
200
,
x > p/ 3
.
As you refine the mesh, your approximate solution should approach the true solution. Based on your numerical experiments, what would you say is the order of accuracy of this finite element method?

(3)
Formulate and implement a finite difference method for the problem in (2) and compare the equations and the accuracy with that of the finite element code.


File translated from TEX by TTH, version 1.59.