Math 104B Final Project ∗ Instructor: Xu Yang
General Instructions: Please write your homework papers neatly. You need to turn in both your codes and descriptions on the appropriate runs you made by following TA’s instructions. Write your own code, individually. Do not copy codes!
Consider the following partial differential equation (PDE): a(x,y)(uxx +uyy)=f(x,y),
Domain: Ω = −1 ≤ (x, y) ≤ 1; Boundary conditions: u = 0 on ∂Ω.
1. Discretize this PDE using the five point discrete Laplacian approach discussed on page 171 of the lecture notes (cf. equation (10.74)). Use the lexicographical order to label your grid points. What is the order of accuracy of this method would you expect? Explain why.
2. Code up the following iterative approaches for inverting the above derived linear system (NOTE: in none of these approaches you ever need to do explicitly from the martrix):
(a) SOR with an experimentally determined ωopt. (b) Conjugate gradient.
(c) Preconditioned conjugate gradient using diagonal preconditioning.
For all of these I want you to write your own code, and don’t use any functions already built into the softwares (e.g. Python or Matlab).
3. Verify your discretization is O(h2) by testing it on the following problem (use any method you wish to solve the linear system):
a(x,y)=1, f(x,y)=−5π2sin(π(x−1))sin(2π(y−1)).
Hint: find the true solution by the method of undetermined coefficient and letting u(x, y) =
A sin(π(x − 1)) sin(2π(y − 1)).
∗All course materials (class lectures and discussions, handouts, homework assignments, examinations, web ma- terials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons) from recording lectures or discussions and from distributing or selling lectures notes and all other course materials without the prior written permission of Prof. Hector D. Ceniceros.
1
4. Apply all of your iterative approaches to the following problem:
104 if x2+y2≤0.25
a(x,y) = , f(x,y) = −1.
1 otherwise
Use U = 0 as the initial guess to all your iterative methods. Use the values of h = 0.04, h = 0.02 and h = 0.01 to check the convergence order. For each case, iterate long enough to see that your answer has “reasonably” converged.
Create a table showing the methods, iteration numbers, and step sizes. Briefly discuss your results. Explain which methods performed well, which methods badly, etc. …
2