18.336 Numerical Methods of Applied Mathematics -- II

advertisement
MIT OpenCourseWare
http://ocw.mit.edu
18.336 Numerical Methods of Applied Mathematics -- II
Spring 2009
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
MIT Dept. of Mathematics
Benjamin Seibold
18.336 spring 2009
Problem Set 3
Out Thu 03/12/09
Due Thu 04/02/09
Problem 6
Consider the 1d Poisson equation
�
−uxx = f
u=0
in ]0, 1[
on {0, 1}
(1)
with f (x) = sin(φ(x))(φx (x))2 − cos(φ(x))φxx (x), where φ(x) = 9πx2 . Consider a 3­
point finite difference approximation on regular grids (grid spacing h) to approximate
(1) by linear systems Ah · uh = fh . Implement a V-cycle multigrid scheme (ν pres­
moothing and ν postsmoothing steps), which solves systems smaller than 100×100 ex­
actly. Solve the linear system corresponding to h = 2−15 by multigrid. For ν ∈ 1, 2, 3,
show the error in the various levels in the V-cycle. How does the final (multigrid)
error compare to the approximation error of the finite difference scheme?
Problem 7
On the domain Ω =]0, 1[2 \[ 14 , 21 ]2 , with the boundaries ΓD = ({0, 1} × [0, 1]) ∪ ([0, 1] ×
{0, 1}), and ΓN = ({ 14 , 12 } × [ 14 , 12 ]) ∪ ([ 14 , 21 ] × { 41 , 21 }), consider the Poisson problem
⎧
2
⎪
⎨−� u = 1
u=f
⎪
⎩
∂u
∂f
= ∂n
∂n
in Ω
on ΓD
on ΓN
(2)
with f (x, y) = x3 y − xy 3 − 12 x2 .
1. Write a finite difference code that approximates (2) for various grid resolutions
h = Δx = Δy.
2. Implement a good multigrid solver that solves the arising linear systems. You
can restrict to mesh sizes that are powers to 2, for which the domain boundaries
fall onto grid edges.
3. Compare the run times (tic, toc) of your multigrid solver with the run times
using the Matlab backslash operator and with conjugate gradients for a com­
parable accuracy.
Download