      DOUBLE PRECISION FUNCTION RES(U,F,NX,NY,NZ,H)
C
C	COMPUTES THE MAXIMUM NORM OF THE DEFECT
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION U(NX,NY,NZ), F(NX,NY,NZ)
C
      RES = 0.
      FAC=1/(H*H)
      DO 30 K=2,NZ-1
        DO 20 J=2,NY-1
          DO 10 I=2,NX-1
            D = F(I,J,K)+FAC*(-6.0*U(I,J,K)+U(I-1,J,K)+U(I+1,J,K)
     *                                     +U(I,J-1,K)+U(I,J+1,K)
     *                                     +U(I,J,K-1)+U(I,J,K+1))
               RES = MAX(ABS(D),RES)
   10     CONTINUE
   20   CONTINUE
   30 CONTINUE
      END
