))/dh^2;Р xi(i,n+1)=-2*(psi(i,n)-psi(i,n+1))/dh^2;Р end Р Р for j=2:nР xi(1,j)=-2*(psi(2,j)-psi(1,j)+dh)/dh^2;Р xi(n+1,j)=-2*(psi(n,j)-psi(n+1,j))/dh^2;Р endР Р for i=2:nР for j=2:nР u(i,j)=(psi(i,j+1)-psi(i,j-1))/(2*dh);Р v(i,j)=-((psi(i+1,j)-psi(i-1,j))/(2*dh));Р err1=(psi(i+1,j)+psi(i-1,j)+psi(i,j+1)+psi(i,j-1)+xi(i,j)*dh^2)/4-psi(i,j);Р psi(i,j)=psi(i,j)+rho*err1;Р err2=(xi(i+1,j)+xi(i-1,j)+xi(i,j+1)+xi(i,j-1))/4 ...Р -Re*dh*(u(i,j)*(xi(i+1,j)-xi(i-1,j))+v(i,j)*(xi(i,j+1)-xi(i,j-1)))/8-xi(i,j);Р xi(i,j)=xi(i,j)+rho*err2;Р temp=max(abs(err1),abs(err2));Р if err<tempР err=temp;Р endР endР endР Рif err<1e-6Р break;РendРendР Р РkРerrРrhoР%psiРcontour(psi,100);Р时,k=6445,err=9.9978e-07,rho=1.0;Р时,k =7533,err=9.9953e-07,rho=1.0;Р时,k =10707,err =9.9973e-07,rho=1.0;Р时,在不调节松弛因子时,其发散了,通过减小其松弛因子得到