# the multigrid method

Post on 01-Jan-2016

26 views

Embed Size (px)

DESCRIPTION

The Multigrid Method. Nicolas Alt ∙ n.alt@mytum.de University of Technology, Munich JASS 2006. Overview. Model Problems Relaxation Methods Error convergence Multiple grids Performance Theoretical Considerations. Model Problem 1D. Differential Equation in 1D –u’’(x) + au(x) = f(x) - PowerPoint PPT PresentationTRANSCRIPT

The Multigrid MethodNicolas Alt n.alt@mytum.deUniversity of Technology, MunichJASS 2006

The Multigrid Method* / 31JASS 2006

OverviewModel ProblemsRelaxation MethodsError convergenceMultiple gridsPerformanceTheoretical Considerations

The Multigrid Method* / 31JASS 2006

Model Problem 1DDifferential Equation in 1Du(x) + au(x) = f(x)for 0 < x < 1 , a > 0 Boundary: u(0) = u(1) = 0Partition continuous problem into n subintervals by sampling it at the grid points xj = jh, with h = 1/nGrid h:

u0u1u2u3u4u5[] Vector u / vu

The Multigrid Method* / 31JASS 2006

Model Problem 1DSecond order finite difference approximation

v0 = vn = 0; with v being the approximate solution to uWritten in Matrix-Vector form

Written compactly: Av = f

The Multigrid Method* / 31JASS 2006

Model Problem 2D(Elliptic) Partial Differential Equationuxx uyy + au = f(x,y)for 0 < x,y < 1 , a > 0Boundary: Frame = 0Sampled with a two-dimensional grid (n-1,m-1 interior grid points)yxu3,2

The Multigrid Method* / 31JASS 2006

Model Problem 2DSampling results in difference approximation

Written in Matrix-Vector form

The Multigrid Method* / 31JASS 2006

Model Problem 2DExample: System for a=0, n=4, h=1

Again, written compactly: Av = f

IBI

The Multigrid Method* / 31JASS 2006

OverviewModel ProblemsRelaxation MethodsError convergenceMultiple gridsPerformanceTheoretical Considerations

The Multigrid Method* / 31JASS 2006

Relaxation Methods To solve the PDE, u = A-1f is too complicatedBased on an estimated solution v(0) find better solution v(1) in next stepReduces norm of the error e = u vUse residual r = f Av as a measure Relationship error / residual: Ae = r For exact solution v = u r = 0For the following, split matrix A = D L U D: diagonal of A; L/U: lower/upper triangular part of A

The Multigrid Method* / 31JASS 2006

Relaxation MethodsGeneral approximation: Try to find a B close to A-1, as u v = A-1r Jacobi scheme / Simultaneous displacementjth component of v is calculated using the two neighbours from previous step

Solves the PDE locally (compare original problem: uj-1 + 2uj uj+1 = h2fj)

The Multigrid Method* / 31JASS 2006

Relaxation MethodsWeighted or damped Jacobi methodWeighting factor 0 < < 1

Gauss-SeidelLike Jacobi, but components updated immediatelyReduces storage requirements

The Multigrid Method* / 31JASS 2006

OverviewModel ProblemsRelaxation MethodsError convergenceMultiple gridsPerformanceTheoretical Considerations

The Multigrid Method* / 31JASS 2006

Error convergence Simplified problem: Au = 0 v should converge to 0, and e = vIn what way does weighted Jacobi decrease the error? Analyse eigenvectors of iteration matrixEigenvectors wk of matrices A and R

Vector wk is also the kth Fourier modeEigen values k of matrix R (generally: Rwk = kwk)

For 0 < 1 |k| < 1, iteration converges

The Multigrid Method* / 31JASS 2006

Error convergenceEigen valuesSmooth, low-frequency Fourier modes of e: 1 k n|k| is close to 1 no satisfactory damping Oscillatory, high-frequency modes: n k n-1For the right , |k| is close to 0 good dampingOptimal damping for =

The Multigrid Method* / 31JASS 2006

Error convergenceDamping diagram for the weighted Jacobi method

Oscillatory modes of the error are removed quite wellSmooth modes are hardly damped.

The Multigrid Method* / 31JASS 2006

Error convergenceExample code in MATLABGrid n = 64Initial error modes 2 and 16Solves u(x) = 0n = 64;% components of AD = 2 * diag(ones(n-1,1),0); U = diag(ones(n-2,1),1); L = diag(ones(n-2,1),-1);% iteration matricesw=2/3; RJ = inv(D) * (L+U); RW = (1-w).*eye(n-1) + w.*RJ;% init f=0, v with modes 2 and 16f = zeros(n-1,1);v = transpose(sin((1:n-1) * 2 * pi / n) + sin((1:n-1) * 16 * pi / n));plot(v); hold on% do 10 iterationsfor i = 1:10 v = RW*v + 0; endplot(v);

The Multigrid Method* / 31JASS 2006

The Multigrid Method* / 31JASS 2006

Multiple GridsFundamental idea of multigridMake smooth modes look oscillatory! Smooth mode on h looks oscillatory on grid nhA hierarchy of discretizations is used to solve the problem of small damping for smooth modes h4h

The Multigrid Method* / 31JASS 2006

Multiple GridsIntergrid Transfer coarse fine: Interpolation2h h, UpsamplingLinear interpolation is effective

The Multigrid Method* / 31JASS 2006

Multiple GridsIntergrid Transfer fine coarse: Restriction h 2h, DownsamplingSimplest method: InjectionBetter: Full weighting

Restriction operator:

Transfer Operations h 2h sufficient

The Multigrid Method* / 31JASS 2006

Multiple GridsAliasing: Oscillatory modes on h will be represented as smooth modes on 2hA basic two-grid correction schemeOn grid h, relax 1 times on Ahvh = 0 with initial guess v(0)hRestrict fine-grid residual rh to the coarse gridOn grid 2h, relax 2 times on A2he2h = r2h with initial guess e(0)h = 0Interpolate the coarse-grid errorCorrect the fine-grid approximation: vh vh + ehOn grid h, relax 1 times on Ahvh = 0 with initial guess vh

The Multigrid Method* / 31JASS 2006

Multiple GridsMultigrid strategiesNested iteration: Use coarse grids to generate improved initial guessesCoarse grid correction: Approximate the error by relaxing on the residual equation on a course grid V-cycleW-cycleFMG scheme

The Multigrid Method* / 31JASS 2006

Multiple GridsThe V-Cycle Scheme (Coarse Grid Correction)V-Cycle(vh, fh)Relax 1 times on Ahvh = 0 with initial guess vhIf (current grid = coarsest grid) goto last pointElse: f2h = Restrict(fh Ahvh)v2h = 0Call v2h = V-Cycle(v2h, f2h)Correct vh += Interpolate(v2h)Relax 2 times on Ahvh = 0 with initial guess vhRecursive algorithm

The Multigrid Method* / 31JASS 2006

The Multigrid Method* / 31JASS 2006

PerformanceStorage requirementsVectors v and f for n = 16 with boundary values

For d = 1, memory requirement is less then twice that of the fine-grid problem alone

The Multigrid Method* / 31JASS 2006

PerformanceComputational costs 1 work unit (WU): one relaxation sweep on hO(WU) = O(N), with N: Total number of grid pointsIntergrid transfer is neglectedOne relaxation sweep per level (i = 1)

1D problem: Single V-Cycle costs ~4WU, Complete FMG cycle ~8WU

The Multigrid Method* / 31JASS 2006

PerformanceDiagnostic ToolsHelp to debug your implementationMethodical Plan for testing modulesStarting Simply with small, simple problems Exposing Trouble difficulties might be hiddenFixed Point Property relaxation may not change exact solutionHomogenous Problem: norm of error and residual should decrease to zero

The Multigrid Method* / 31JASS 2006

The Multigrid Method* / 31JASS 2006

TheoryThe Impact of Intergrid Transfer and the iterative method may be expressed and proven in a formal wayTwo-grid correction TG consists of matrices for Interpolation, Restriction and RelaxationSpectral picture of multigridRelaxation damps oscillator modesInterpolation & Restriction damp smooth modesAlgebraic picture of multigridDecompose Space of the error: h = R N L similar to R, H similar to N

The Multigrid Method* / 31JASS 2006

TheoryOperations of multigrid, visualizedPlane represents hError eh is successively projected on one of the axesRelaxations on the fine grid (1)Two-grid correction (2)Again, relaxation on the fine grid (3)

The Multigrid Method* / 31JASS 2006

End of Presentation

Thanks for your attentionAny questions?

Recommended