      !***********************************************************************!
      SUBROUTINE  nrmerr(  gnrm2,  gnrmoo,  u,  u_exact,  tps  )
      !***********************************************************************!
!
      USE numerics
!
      IMPLICIT  NONE
!
      INCLUDE 'comthd.h'
!
      INTERFACE
!
      include    'i_fctut.h'
!
      END INTERFACE
!Solution  u  a  l'instant tps
      REAL(rp),  DIMENSION(sx-1:ex+1,  sy-1:ey+1,  sz-1:ez+1),  INTENT(IN)  ::  u
!
!Solution exacte
      REAL(rp),  DIMENSION(sx  :ex  ,  sy  :ey  ,  sz  :ez  ),  INTENT(IN)  ::  u_exact
!
!Norme L2,   solution et erreur
      REAL(rp),  DIMENSION(2),  INTENT(OUT)  ::  gnrm2
!
!Norme Loo,  solution
      REAL(rp),  DIMENSION(2),  INTENT(OUT)  ::  gnrmoo
!
!Instant courant
      REAL(rp),  INTENT(IN)   ::  tps
!
!--Declaration des variales locales
!
!Composante temporelle
      REAL(rp)  ::  ut
      REAL(rp)  ::  rnrm2,   rerr2
      REAL(rp)  ::  rnrmoo, rerroo
!
!Compteurs
      INTEGER   ::  i,  j,  k
!
      !***********************************************************************!
!
      CALL fctut( tps, ut )
!
      rnrm2 = zero
      rerr2 = zero
      rnrmoo = zero
      rerroo = zero
!
!Calcul des quantites L2 et Loo
      DO  k  =  sz,  ez
         DO  j  =  sy,  ey
            DO  i  =  sx,  ex
               rnrm2  = rnrm2 + u(i,j,k)**2
               rerr2  = rerr2 + ( u(i,j,k) - ut * u_exact(i,j,k) ) **2
               rnrmoo = MAX( rnrmoo, ABS( u(i,j,k) ) )
               rerroo = MAX( rerroo, ABS( u(i,j,k) - ut * u_exact(i,j,k) ) )
            END  DO
         END  DO
      END  DO
!
!$OMP CRITICAL
      gnrm2(1)  = gnrm2(1) + rnrm2
      gnrm2(2)  = gnrm2(2) + rerr2
      gnrmoo(1) = MAX( gnrmoo(1), rnrmoo )
      gnrmoo(2) = MAX( gnrmoo(2), rerroo )
!$OMP END CRITICAL
!
!$OMP BARRIER
!
!$OMP MASTER
     gnrm2(1:2) = SQRT( gnrm2(1:2) / ( REAL(ntx, rp) * REAL(nty, rp) * REAL(ntz, rp ) ) )
!$OMP END MASTER
!
      RETURN
      END  SUBROUTINE  nrmerr
