subroutine error(svar,f,N,a,b,c,d,emax,el2,erel) implicit none integer N double precision a,b,c,d,emax,el2,erel double precision, dimension(:,:) :: svar double precision, dimension(:,:) :: f double precision sum1,e1,sum2,e2 integer i,j sum1 = 0 sum2 = 0 emax = 0 C We do not use the boundary do i = 1,2*N+2 do j = 1,2*N+2 if(i .lt. 2*N+2 .and. j .lt. 2*N+2) then e1 = ((svar(i,j)-f(i,j)+svar(i+1,j)-f(i+1,j)+svar(i+1,j+1 $ )-f(i+1,j+1)+svar(i,j+1)-f(i,j+1))/4)**2*(b-a)*(d-c) $ /((2*N+2)**2) e2 = ((svar(i,j)+svar(i+1,j)+svar(i+1,j+1)+svar(i,j+1))/4 $ )**2*(b-a)*(d-c)/((2*N+2)**2) sum1 = sum1 + e1 sum2 = sum2 + e2 end if if(abs(svar(i,j)-f(i,j)) .gt. emax) then emax = abs(svar(i,j)-f(i,j)) end if end do end do el2 = sqrt(sum1) erel = sqrt(sum1/sum2) return end