08 Numerical Solution of Elliptic PDEs
08 Numerical Solution of Elliptic PDEs
PDEs
Mostafa Abobaker 2018
Figure: Efficient method is needed for solution of such systems of equations! Nine point
approximation in 2D has 9-diagonal matrix!
1. Jacoby Method
• Solution techniques are either direct or iterative.
• Direct methods give theoretically exact solutions, but for large
system truncation error becomes significant. Time to solve
such system also increases with 𝒃𝟐 . n! (Gauss method)
• Iterative methods are approximate in nature, slower, but
each new iteration improves it ancestor, at end it gives more
accurate results for large system of equations than direct
methods, since number of operations per iteration is
relatively small.
Jacoby Method
Jacoby Method
Jacoby Method
Jacoby Method
Jacoby Method
Jacoby Method
Jacoby Method
We use two
matrices u(k) and
u(k+1)
2. Gauss-Seidel Method
• Only one u matrix is used.
• As soon as some value is calculated it is available for use in calculations of
other values.
• This method is twice as fast as Jacoby method.
Gauss-Seidel Method
a=2; b=1;
T1=100 C
T2=100 C
T3=100 C
T4=0 C
Example
Example
Problem code
• a=2;b=1;Dx=0.05;Dy=Dx;epsmax=0.01;
• T1=100;T2=100;T3=100;T4=0;omega=1.8;
• Nx=round(a/Dx)+1;
• Ny=round(b/Dy)+1;
• bet=Dy/Dx;
• T(1:Ny,1:Nx)=0;
• % GRU
• for i = 1:Nx % note that T (y,x) === T(j,i)
• T(1,i)=T3;
• T(Ny,i)=T1;
• end
• for j=1:Ny
• T(j,1) = T4;
• T(j,Nx)=T2;
• end
Problem code pp2
• epsi=10*epsmax;
• iter=0;
• while epsi>=epsmax
• epsi = 0.0;
• for i=2:Nx-1
• for j=2:Ny-1
• DT = (bet^2*(T(j,i+1)+T(j,i-1))+T(j+1,i)+T(j-1,i))...
• /(2*(1+bet^2)) - T(j,i);
• epsi = epsi+DT^2;
• T(j,i)=T(j,i)+omega*DT;
• end
• end
• iter=iter+1;
• disp([iter, epsi])
• end
• surf(T), shading interp