Successive over-relaxation
June 2nd, 2008 by Daniel Høyer Iversen
Successive over-relaxation (SOR), written in Matlab to solve the Advection-diffusion equation. The matrix A (in A x= b) is a block pentadiagonal matrix.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | function Z = solver(A,b) %Successive over-relaxation, forbedret Gauss-Seidel w=1.95; p=params(0,0); Z=p.noder(:,1)*0; e=A(1,1); for j=1:540 Z(1)= (1-w)*Z(1)+w/e*( b(1)- Z(2)*A(1,2)-Z(1+p.N)*A(1,1+p.N)); for i=2:p.N Z(i)= (1-w)*Z(i)+w/e*( b(i)- Z(i-1)*A(i,i-1)-Z(i+1)*A(i,i+1)-Z(i+p.N)*A(i,i+p.N)); end for i=p.N+1:p.NM-p.N Z(i)= (1-w)*Z(i)+w/e*( b(i)- Z(i-p.N)*A(i,i-p.N)-Z(i-1)*A(i,i-1)-Z(i+1)*A(i,i+1)-Z(i+p.N)*A(i,i+p.N)); end for i=p.NM-p.N+1:p.NM-1 Z(i)= (1-w)*Z(i)+w/e*( b(i)- Z(i-p.N)*A(i,i-p.N)- Z(i-1)*A(i,i-1)-Z(i+1)*A(i,i+1)); end Z(p.NM)= (1-w)*Z(p.NM)+w/e*( b(p.NM)- Z(i-p.N)*A(i,i-p.N)-Z(p.NM-1)*A(p.NM,p.NM-1)); end |
http://en.wikipedia.org/wiki/Successive_over-relaxation :
Successive over-relaxation (SOR) is a numerical method used to speed up convergence of the Gauss–Seidel method for solving a linear system of equations. A similar method can be used for any slowly converging iterative process. It was devised simultaneously by David M. Young and by H. Frankel in 1950 for the purpose of automatically solving linear systems on digital computers. Over-relaxation methods have been used before the work of Young and Frankel. For instance, the method of Lewis Fry Richardson, and the methods developed by R. V. Southwell. However, these methods were designed for computation by human calculators, and they required some expertise to ensure convergence to the solution which made them inapplicable for programming on digital computers. These aspects are discussed in the thesis of David M. Young.
tolong kirimkan program SOR dengan menggunakan matlab. thanks.