Universität Konstanz WS 10/11 Fachbereich Mathematik und Statistik
S. Volkwein, O. Lass, R. Mancini
Übungen zu Theorie und Numerik partieller Differentialgleichungen
http://www.math.uni-konstanz.de/numerik/personen/volkwein/teaching/
Submission: 17.01.2011, 11:00 o’clock Codes by E-Mail and Reports in Box 18
Program 2 (8 Points)
Let Ω = (0,1)×(0,1) and h = M1 with M ∈ N. Solve numerically the nonlinear elliptic problem
−∆u(x, y) +f(x, y, u(x, y)) = 0, (x, y)∈Ω
u(x, y) = g(x, y), (x, y)∈∂Ω (1)
with the Newton method. For the discretization of the Laplace operator use the classical finite difference scheme (i.e. five-point-stencil). Use the lexicographical ordering of the grid points in Ω. Use the following functions f and g:
f(x, y, u(x, y)) =eu(x,y) and g(x, y) =
½ x+y, if |x+y| ≤1, 2−x−y, if |x+y|>1.
a) Implement the Newton method for solving problem (1). As a stopping criteria for the Newton method use the norm of the residual to be less than10−6. For the initial guess choose u0 = (0.5, . . . ,0.5)> ∈R(M−1)2. For M we choose 100. For solving the linear system use the \-operator in Matlab.
b) Implement the Conjugate-Gradient (CG) method, Algorithm 1, and use it to replace the \-operator to solve the linear system arising from the Newton method in step a). For the values x0 and ² in Algorithm 1 use (0, . . . ,0)> ∈ R(M−1)
2 and 10−6, respectively.
Visualize the numerical solutionu(x, y)and do not forget to lable the plots. In the written report derive the Newton step for problem (1). Verify that the Jacobian obtained in the Newton method is positive definite.
Algorithm 1 (CG-Algorithm)
1: Given: A∈Rn×n symmetric positive definite,b ∈Rn, x0 ∈Rn and ² >0
2: Set: k = 0, r0 =b−Ax0 and p0 =r0
3:
4: while krkk> ² and k < ndo
5: αk= (pk)Trk (pk)TApk
6: xk+1 =xk+αkpk
7: rk+1 =rk−αkApk
8: βk= (Apk)Trk+1 (Apk)Tpk
9: pk+1 =rk+1−βkpk
10: k=k+ 1
11: end while