Presentation is loading. Please wait.

Presentation is loading. Please wait.

Geometric MultiGrid Mehod

Similar presentations


Presentation on theme: "Geometric MultiGrid Mehod"— Presentation transcript:

1 Geometric MultiGrid Mehod
MULTIGRID METHOD MultiGrid Methods (MGM) Algebraic MultiGrid Method (AMG) Geometric MultiGrid Mehod (GMG)

2 MULTIGRID METHOD Remark: Given an approximate:
We want to improve this approximate: Residual Equation: It means that if we replace the right hand side vector b in the main linear system, the solution of this new system is the exact error (residual) (error) But the cost of solving this system is the same as solving the original system. (update)

3 MULTIGRID METHOD (GMG)
Two-Grid Cycle Algorithm 1) few GS iterations on the system to obtain an approximate solution Pre-smoothing step 2) Compute the residual 3) Restrict the residual Restriction step 4) Solve residual equation on coarse mesh ProloCorrection step 5) Interpolate Prolongation step 6) Update 7) few GS iterations on the system With initial approximate Post-smoothing step

4 MULTIGRID METHOD (GMG)
W - Cycle postsmoothing restriction presmoothing prolongation V - Cycle Direct solver

5 MULTIGRID METHOD (GMG)
Jacobi code function [sol]=jacobi(A,b,x0,steps) n=length(b); x=x0; xnew = sparse(n,1); for k=1:steps for i=1:n sum1=0; for j=1:i-1 sum1=sum1+A(i,j)*x(j); end sum2=0; for j=i+1:n sum2=sum2+A(i,j)*x(j); xnew(i)=(b(i)-sum1-sum2)/A(i,i); x=xnew; sol=xnew;

6 MULTIGRID METHOD (GMG)
one-dimensional problems Example: Coarse mesh Fine mesh We have the inclusion

7 MULTIGRID METHOD (GMG)

8 MULTIGRID METHOD (GMG)

9 MULTIGRID METHOD (GMG)
This means that the j-th column of P, corresponding to coarse grid node j, has the form

10 Two Grid TWO GRID METHOD nf=2*55-1; % number of fine nodes
h=1/(nf+1); % fine mesh size xh=0:h:1; % fine mesh oneh=ones(nf,1); Ah=spdiags([-oneh 2*oneh -oneh],-1:1,nf,nf)/h; % fine stiffness matrix bh=ones(nf,1)*h; % fine load vector nc=(nf-1)/2; % coarse nodes H=1/(nc+1); % coarse mesh size xH=0:H:1; % coarse mesh oneH=ones(nc,1); AH=spdiags([-oneH 2*oneH -oneH],-1:1,nc,nc)/H; % coarse stiffness matrix uh=zeros(nf,1); % initial guess P=sparse(nf,nc); % prolongation matrix for i=1:nc P(2*i-1,i)=0.5; P(2*i,i)=1; P(2*i+1,i)=0.5; end R=P'; % Restriction matrix for k=1:5 [uh]=jacobi(Ah,bh,uh,2); rH=R*(bh-Ah*uh); % Restricted residual eH=AH\rH; % correction step uh =uh+P*eH; % update plot(xh,[0 ; uh ; 0]), xlabel('x'), ylabel('u'); grid on Two Grid

11 TWO GRID METHOD nf=2*55-1; % number of fine nodes
h=1/(nf+1); % fine mesh size xh=0:h:1; % fine mesh oneh=ones(nf,1); Ah=spdiags([-oneh 2*oneh -oneh],-1:1,nf,nf)/h; % fine stiffness matrix bh=ones(nf,1)*h; % fine load vector nc=(nf-1)/2; % coarse nodes H=1/(nc+1); % coarse mesh size xH=0:H:1; % coarse mesh oneH=ones(nc,1); AH=spdiags([-oneH 2*oneH -oneH],-1:1,nc,nc)/H; % coarse stiffness matrix uh=zeros(nf,1); % initial guess P=sparse(nf,nc); % prolongation matrix for i=1:nc P(2*i-1,i)=0.5; P(2*i,i)=1; P(2*i+1,i)=0.5; end R=P'; % Restriction matrix for k=1:5 [uh]=jacobi(Ah,bh,uh,2); rH=R*(bh-Ah*uh); % Restricted residual eH=AH\rH; % correction step uh =uh+P*eH; % update plot(xh,[0 ; uh ; 0]), xlabel('x'), ylabel('u'); grid on

12 MULTIGRID METHOD (GMG)
multigrid V-cycle is given by the following recursive algorithm: [Elman, Howard C., David Silvester, and Andy Wathen. Finite elements and fast iterative solvers: with applications in incompressible fluid dynamics. Oxford University Press, 2014.] page102 u = V_cycle(A,b,u,level) few GS iterations on the system Pre-smooth If coarsest level : solve else Restriction Recursive coarse grid correction Prolong & update endif few GS iterations on the system V - Cycle Post-smooth

13 MULTIGRID METHOD (GMG)
u = V_cycle(A,b,u,level) few GS iterations on the system Pre-smooth If coarsest level : solve else Restriction V – Cycle 3 level Recursive coarse grid correction Prolong & update endif few GS iterations on the system Post-smooth

14 MULTIGRID METHOD (GMG)
clear; clc kk=6; n1=4*kk+3; % --- linear system for level 1 h1=1/(n1+1); x1=0:h1:1; oneh1=ones(n1,1); A1=spdiags([-oneh1 2*oneh1 -oneh1],-1:1,n1,n1)/h1; b1=ones(n1,1)*h1; % --- linear system for level 2 n2=(n1-1)/2; h2=1/(n2+1); x2=0:h2:1; oneh2=ones(n2,1); A2=spdiags([-oneh2 2*oneh2 -oneh2],-1:1,n2,n2)/h2; b2=ones(n2,1)*h2; % --- linear system for level 3 n3=(n2-1)/2; h3=1/(n3+1); x3=0:h3:1; oneh3=ones(n3,1); A3=spdiags([-oneh3 2*oneh3 -oneh3],-1:1,n3,n3)/h3; b3=ones(n3,1)*h3; A(1).size = n1; A(1).h = h1; A(1).mat = A1; A(1).rhs = b1; A(2).size = n2; A(2).h = h2; A(2).mat = A2; A(2).rhs = b2; A(3).size = n3; A(3).h = h3; A(3).mat = A3; A(3).rhs = b3; b = b1; u = sparse(length(b),1); level =3; [u] = V_Cycle(A(1:level),b,u,level); V – Cycle 3 level

15 MULTIGRID METHOD (GMG)
function [u] = V_Cycle(A,b,u,level) if level < 1; return ; end disp(['I am entering level ',num2str(level)]) if size(A,2) == 1 AA = A(1).mat; u = AA\b; disp(' ---coarset level done ---'); else [u]=jacobi(A(1).mat,b,u,3); % (3 pre-smoothing) nf = A(1).size; nc = A(2).size; P=sparse(nf,nc); for i=1:nc P(2*i-1,i)=0.5; P(2*i,i)=1; P(2*i+1,i)=0.5; end R=P'; rbar = R*(b-AA*u); % (restrict residual) ebar = sparse(length(rbar),1); Abar = A(2:level); % recursive coarse grid correction ---- [ebar] = V_Cycle(Abar,rbar,ebar,size(Abar,2)); u = u + P*ebar; % prolong and update [u]=jacobi(A(1).mat,b,u,3); disp(['I am exiting level ',num2str(level)]) u = V_cycle(A,b,u,level) Pre-smooth few GS iterations on the system If coarsest level : solve else Restriction Recursive coarse grid correction Prolong & update endif few GS iterations on the system Post-smooth

16 Geometric MultiGrid Mehod
MULTIGRID METHOD MultiGrid Methods (MGM) Algebraic MultiGrid Method (AMG) Geometric MultiGrid Mehod (GMG)

17 MULTIGRID METHOD (AMG)
Algebraic MultiGrid Method (AMG) Can we apply multigrid techniques when there is no grid? For AMG, these components are required. sequence of grids, P and R smoothing coarse-grid versions of the fine-grid operator a solver for the coarsest grid.

18 MULTIGRID METHOD (AMG)
Algebraic MultiGrid Method (AMG) Adjacency Graph Selecting the Coarse Grid we want to partition the grid points into C-pints and F-points. Denote by Si the set of points that strongly influence i; denote by ST the set of points that strongly depend on the point i.

19 MULTIGRID METHOD


Download ppt "Geometric MultiGrid Mehod"

Similar presentations


Ads by Google