120£®Jacobi µþ´ú: HPF³ÌÐò |
REAL u(0:nx,0:ny), unew(0:nx, 0:ny), f(0:nx, 0:ny)
!HPF$ DISTRIBUTE u(BLOCK, *)
!HPF$ ALIGN WITH u(:,:) :: unew(:,:), f(:,:)
dx = 1.0/nc; dy = 1.0/ny; err = tol * le6
FORALL ( i=0:nx, j=0:ny)
¡¡¡¡¡¡f(i,j) = 02*(dx*i)**2+2*dx*i-2*(dy*j)**2+2*dy*j
END FORALL
u = 0.0; unew = 0.0
DO WHILE (err > tol)
¡¡¡¡¡¡FORALL (i=1:nx-1, j=1:ny-1 ) &
¡¡¡¡¡¡¡¡unew(i,j) = (u(i-1,j)+u(i+1,j)+u(i,j-1)+ &
¡¡¡¡¡¡¡¡u(i,j+1)+f(i,j))/4
¡¡¡¡¡¡err = MAXVAL( ABS(unew-u) )
¡¡¡¡¡¡u = unew
END DO
Copyright: NPACT |