      !***********************************************************************!
      SUBROUTINE  nrmerr(  gnrm2,  gnrmoo,  u,  u_exact,  tps,  comm3d  )
      !***********************************************************************!
!
      USE MPI
!
      USE numerics
!
      IMPLICIT  NONE
!
      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-1:ex+1,  sy-1:ey+1,  sz-1:ez+1),  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
!
! communicateur
      INTEGER,  INTENT(IN)  ::  comm3d
!
!--Declaration des variales locales
!
!Composante temporelle
      REAL(rp)  ::  ut
!
!Tableau intermediaire
      REAL(rp),  DIMENSION(2)  ::  lnrm2
      REAL(rp),  DIMENSION(2)  ::  lnrmoo
!
!Compteurs
      INTEGER   ::  i,  j,  k
!
      !***********************************************************************!
!
      DO k = 1, 2
         lnrm2(k)  = zero
         lnrmoo(k) = zero
      END DO
!
      CALL fctut( tps, ut )
!
!Calcul des quantites L2
      DO  k  =  sz,  ez
         DO  j  =  sy,  ey
            DO  i  =  sx,  ex
               lnrm2(1) = lnrm2(1) + u(i,j,k)**2
               lnrm2(2) = lnrm2(2) + ( u(i,j,k) - ut * u_exact(i,j,k) ) **2
               lnrmoo(1) = MAX( lnrmoo(1), ABS( u(i,j,k) ) )
               lnrmoo(2) = MAX( lnrmoo(2), ABS( u(i,j,k) - ut * u_exact(i,j,k) ) )
            END  DO
         END  DO
      END  DO
!
      CALL  MPI_ALLREDUCE(  lnrm2,   gnrm2,   2,  ITYPE_REAL,  &
                            MPI_SUM,  comm3d,  ierr  )
!
      CALL  MPI_ALLREDUCE(  lnrmoo,  gnrmoo,  2,  ITYPE_REAL,  &
                            MPI_MAX,  comm3d,  ierr  )
!
      gnrm2(1:2) = SQRT( gnrm2(1:2) / ( REAL(ntx, rp) * REAL(nty, rp) * REAL(ntz, rp ) ) )
!
      RETURN
      END  SUBROUTINE  nrmerr
