18.086 Pset #4 18.086 - Spring 2016, Problem Set 3 Due before class starts on April 29. Late homework will not be given any credit. Indicate on your report whether you have collaborated with others and whom you have collaborated with. 1. (20 points) a Problem 3 in Problem Set 7.2 of the textbook (eigenvalues of Gauss-Seidel). April 9, 2016 b Problem 10 in Problem Set 7.2 of the textbook (spectral radius of red-black GaussSeidel). 2. (509points) Consider the domain ⌦, as given in the figure. The boundary Out: Apr. Dirichlet boundaries D (thin lines) and Neumann boundaries N (fat lines). Due: May 2 we would like to approximate the Poisson problem di↵erences, 8 < 4 u = 1 in consists of Using finite ⌦ Problem 1 (50 points) As in theu =last f problem on D , set, we consider the domain Ω : @u @f = @n on conditions N (see figure below), with Dirichlet @nboundary at boundaries ΓD (thin 1 3 3 2 lines) and conditions parts lines). yields N (bold whereNeumann f (x, y) = x y boundary xy 2 x . Write a code that, at for any givenΓresolution parameter, Figure In contrast to the last problem set,0.1: weDomain. now solve for the steady state solution of the diffusion equation, i.e. the theabove Poisson a linear system that discretizes Poisson problem problem. Then choose a small resolution, a medium resolution and a high resolution, and (try to) solve the linear systems by 1. Matlab backslash 2. 3. −∆u = 1 in Ω u = f on ΓD Jacobi iteration ∂u ∂f a simple multigrid method (V-cycle) = on ΓN ∂n ∂n (1) (2) (3) 1 where f (x, y) = x3 y − xy 3 − 21 x2 as before. Using finite differences, adapt your code from the last pset in such a way that you can choose a resolution parameter for the discretization (for instance the number of grid points per unit length). Then choose a small resolution, a medium resolution and a high resolution, and (try to) solve the linear systems by • Matlab backslash (or any other built-in method in your favorite numerical software) • Jacobi iterations 1 • a simple multigrid v-cycle (see mit18086 multigrid.m for a 1D implementation) • Conjugate gradient method (see mit18086 cg.m for a 2D Poisson CG solver) Compare the approaches with respect to accuracy and run times. Up to which resolution can you go with the best method? Remarks/Hints: • Use sparse matrices and reuse your codes from the last problem set. • Codes from the CSE web page can be used. • Be aware of the difference between discretization error and errors in solving the linear system approximately. • For a small test problem Au = b, the accuracy of a linear solver is best measured by the norm of the error |utrue − uapprox |, where utrue can be obtained by Matlab’s backslash operator or similar approaches in Mathematica etc. However, for high resolutions, this error may not be accessible. In those cases, the residual |uapprox − b| can be used. • The high resolution may cause some solution methods to fail. The medium resolution shall be chosen in such a way that all considered solution methAbdulaziz Albaiz ods succeed to allow for comparison. ional Science and Engineering II Page 4 of 4 • The steady-state solution u should look like the figure below: m is using several methods, and in each method, different grid sizes are used. The following mmarizes all the combinations with their error (defined as ‖𝐴𝐴𝑥𝑥 − 𝑏𝑏‖∞) and run times (tolerance 7 Matlab’s Backslash Time: 0 nts) 5 Time: 0 nts) 1 Jacobi method Time: 0 Gauss-Seidel method 2 Conjugate Multigrid Gradient (V-Cycle)* Time: 0 Time: 0 Time: 0 Time: 0 Iterations: 233 Iterations: 185 Iterations: 79 Iterations: 0 Time: 0.04 sec Time: 0.03 sec Time: 0.03 sec Time: 0.03 sec Iterations: 1434 Iterations: 737 Iterations: 161 Iterations: 112 Time: 2.12 sec Time: 0.9 sec Time: 0.14 sec Time: 0.67 sec (base case)