Nada/CSC 2D1255 Spring 2007 Lab 1, multigrid for the Poisson equation: Report due Feb 23, Computing the capacitance between an inner conductor an an enclosing square. ------------------------------------------------------------------------------------------------------------ The task is to solve the Laplace equation on the annular domain between an inner rectangle and an outer square. Download the mglab text-file from the home page; it contains a skeleton of the code you will develop. The code does not run at all as is. The solutions, driving functions, etc., are represented as arrays and we do not expand them into vectors. 1. Write a function u = jacobi2(u,rhs,mask) which returns the result of one explicit time-step and the central difference approximation to the laplace operator. Only the points where mask is non-zero should be updated. The array mask exists and every non-zero element is equal to the relaxation parameter. The equation is du/dt = laplace(u) + rhs u = 0 on outer square, u = 1 on inner rectangle where rhs is a driving function, = 0 for the problem to be solved. But you will need rhs non-zero in the multi-grid implementation so should include it now. Test the code by running the main program rcapmg with method = "Jacobi". 2. How does the convergence rate depend on the meshsize? The theory says e(n+1)/e(n) = 1- kh**2 3. The convergence rate may be fast in the first iterations but soon slows down. Try different initial values (hint: oscillatory or smooth are different) Please explain 4. The computation of the capacitance by the line integral can use any curve, as explained in the lecture from the discrete conservation properties. The given code gauss uses the outermost square. Make the code use a smaller rectangular curve, and check that it does produce the same answer. Or not? maybe the solution is not well enough converged. 5. Now try an elliptic inner conductor. Run a mesh refinement exercise and plot the convergence rate of the computed capacitance. What is the order of accuracy? Hit: DO NOT USE too fine grids because the Jacobi iteration is so slow! 6. Now we turn to the multigrid exercise. The skeleton code given is patterned after the V-cycle algorithm (see the Briggs copy.) You need to 1. construct the restriction and prolongation matrices. 2. figure out how to scale the residual when it is sent to the coarser grid. The scaling depends on how you chose the scaling of the matrices in the jacobi2-function! When the implementation is correct you should observe convergence rate independent of the meshsize, and no slowing down after the initial steps. 7. The cheating here is that MG as implemented here does NOT work properly for general geometries. Try the ellipse and see! Can you explain why, and also give a characterization of the geometries for which it does work properly , depending on the meshsize and the number of MG levels? Construct the mask for a non-trivial example (the 1/2 x 1/2 rectangle is trivial) and check that your prediction is good. 8. (if there is time) Implement the FMV algorithm and check the conclusions in Briggs that it DOES converge fatser.