Index: trunk/NEMO/OPA_SRC/DOM/domhgr.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DOM/domhgr.F90	(revision 80)
+++ trunk/NEMO/OPA_SRC/DOM/domhgr.F90	(revision 81)
@@ -7,5 +7,6 @@
    !!----------------------------------------------------------------------
    !!   dom_hgr        : initialize the horizontal mesh 
-   !!   dom_hgr_coo    : read "coordinate" file (except for EEL config.)
+   !!   hgr_read       : read "coordinate" NetCDF file 
+   !!   hgr_read_fdir  : read "coordinate" direct access file 
    !!----------------------------------------------------------------------
    !! * Modules used
@@ -43,20 +44,16 @@
       !!      the two horizontal directions (fse1 and fse2), the model grid-
       !!      point position and scale factors are given by:
-      !!            t-point: glamt(i,j) = fslam(i,j)
-      !!                     gphit(i,j) = fsphi(i,j)
-      !!                     e1t  (i,j) = fse1 (i,j)
-      !!                     e2t  (i,j) = fse2 (i,j)
-      !!            u-point: glamu(i,j) = fslam(i+0.5,j)
-      !!                     gphiu(i,j) = fsphi(i+0.5,j)
-      !!                     e1u  (i,j) = fse1 (i+0.5,j)
-      !!                     e2u  (i,j) = fse2 (i+0.5,j)
-      !!            v-point: glamv(i,j) = fslam(i,j+0.5)
-      !!                     gphiv(i,j) = fsphi(i,j+0.5)
-      !!                     e1v  (i,j) = fse1 (i,j+0.5)
-      !!                     e2v  (i,j) = fse2 (i,j+0.5)
-      !!            f-point: glamf(i,j) = fslam(i+0.5,j+0.5)
-      !!                     gphif(i,j) = fsphi(i+0.5,j+0.5)
-      !!                     e1f  (i,j) = fse1 (i+0.5,j+0.5)
-      !!                     e2f  (i,j) = fse2 (i+0.5,j+0.5)
+      !!         t-point:
+      !!      glamt(i,j) = fslam(i    ,j    )   e1t(i,j) = fse1(i    ,j    )
+      !!      gphit(i,j) = fsphi(i    ,j    )   e2t(i,j) = fse2(i    ,j    )
+      !!         u-point:
+      !!      glamu(i,j) = fslam(i+1/2,j    )   e1u(i,j) = fse1(i+1/2,j    )
+      !!      gphiu(i,j) = fsphi(i+1/2,j    )   e2u(i,j) = fse2(i+1/2,j    )
+      !!         v-point:
+      !!      glamv(i,j) = fslam(i    ,j+1/2)   e1v(i,j) = fse1(i    ,j+1/2)
+      !!      gphiv(i,j) = fsphi(i    ,j+1/2)   e2v(i,j) = fse2(i    ,j+1/2)
+      !!            f-point:
+      !!      glamf(i,j) = fslam(i+1/2,j+1/2)   e1f(i,j) = fse1(i+1/2,j+1/2)
+      !!      gphif(i,j) = fsphi(i+1/2,j+1/2)   e2f(i,j) = fse2(i+1/2,j+1/2)
       !!      Where fse1 and fse2 are defined by:
       !!         fse1(i,j) = ra * rad * SQRT( (cos(phi) di(fslam))**2
@@ -100,10 +97,11 @@
       !!----------------------------------------------------------------------
       !! * local declarations
-      INTEGER  ::   ji, jj          ! dummy loop indices
-      INTEGER  ::   ijeq             ! index of equator T point (computed for case 4)
+      INTEGER  ::   ji, jj              ! dummy loop indices
+      INTEGER  ::   ii0, ii1, ij0, ij1  ! temporary integers
+      INTEGER  ::   ijeq                ! index of equator T point (used in case 4)
       REAL(wp) ::   &
-         zti, zui, zvi, zfi,     &  ! temporary scalars
-         ztj, zuj, zvj, zfj,     &  !
-         zphi0, zbeta, znorme,   &  !
+         zti, zui, zvi, zfi,         &  ! temporary scalars
+         ztj, zuj, zvj, zfj,         &  !
+         zphi0, zbeta, znorme,       &  !
          zarg, zf0
       !!----------------------------------------------------------------------
@@ -127,7 +125,38 @@
 
          IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) '          curvilinear coordinate on the sphere read in coordinate.nc file'
-
-         CALL dom_hgr_coo
+         IF(lwp) WRITE(numout,*) '          curvilinear coordinate on the sphere read in "coordinate" file'
+#if defined key_fdir
+         CALL hgr_read_fdir      ! 'key_fdir'       :   direct access file
+#else
+         CALL hgr_read           ! Defaultl option  :   NetCDF file
+#endif
+
+         !                                                ! =====================
+         IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN    ! ORCA R2 configuration
+            !                                             ! =====================
+            IF( n_cla == 0 ) THEN
+               ii0 = 160   ;   ii1 = 161        ! Bab el Mandeb (e2u = 18 km)
+               ij0 =  88   ;   ij1 =  88   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  18.e3
+               IF(lwp) WRITE(numout,*)
+               IF(lwp) WRITE(numout,*) '             orca_r2: Bab el Mandeb: e2u reduced to 18 km'
+            ENDIF
+
+            ii0 = 145   ;   ii1 = 146        ! Sound Strait (e2u = 15 km)
+            ij0 = 116   ;   ij1 = 116   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  15.e3
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) '             orca_r2: Reduced e2u at the Sound Strait'
+            !
+         ENDIF
+
+         !                                                ! ======================
+         IF( cp_cfg == "orca" .AND. jp_cfg == 05 ) THEN   ! ORCA R05 configuration
+            !                                             ! ======================
+            ii0 = 563   ;   ii1 = 564        ! Gibraltar Strait (e2u = 20 km)
+            ij0 = 327   ;   ij1 = 327   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  20.e3
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) '             orca_r05: Reduced e2u at the Gibraltar Strait'
+            !
+         ENDIF
+
 
          ! N.B. :  General case, lat and long function of both i and j indices:
@@ -267,6 +296,4 @@
          END DO
 
-
-
       CASE DEFAULT
          IF(lwp) WRITE(numout,cform_err)
@@ -352,8 +379,5 @@
          IF( znorme > 1.e-13 ) THEN
             IF(lwp) WRITE(numout,cform_err)
-            IF(lwp) WRITE(numout,*) ' '
-            IF(lwp) WRITE(numout,*) ' ===>>>> : symmetrical condition'
-            IF(lwp) WRITE(numout,*) 'stop rerun with good equator line'
-            IF(lwp) WRITE(numout,*) '           ----'
+            IF(lwp) WRITE(numout,*) ' ===>>>> : symmetrical condition: rerun with good equator line'
             nstop = nstop + 1
          ENDIF
@@ -362,18 +386,8 @@
    END SUBROUTINE dom_hgr
 
-#if defined key_fdir
-   !!---------------------------------------------------------------------
-   !!   'key-fdir                                       direct access file 
-   !!---------------------------------------------------------------------
-#  include "domhgr_coo_fdir.h90"
-
-#else
-   !!---------------------------------------------------------------------
-   !!   Defaultl option  :                                     NetCDF file 
-   !!---------------------------------------------------------------------
-
-   SUBROUTINE dom_hgr_coo
+
+   SUBROUTINE hgr_read
       !!---------------------------------------------------------------------
-      !!              ***  ROUTINE dom_hgr_coo  ***
+      !!              ***  ROUTINE hgr_read  ***
       !!
       !! ** Purpose :   Read a coordinate file in NetCDF format 
@@ -398,8 +412,7 @@
 
       !! * Local declarations
-      LOGICAL ::   llog
-      CHARACTER(len=21) ::   clname
+      LOGICAL ::   llog = .FALSE.
+      CHARACTER(len=21) ::   clname = 'coordinates'
       INTEGER  ::   ji, jj              ! dummy loop indices
-      INTEGER  ::   ii0, ii1, ij0, ij1  ! temporary integers
       INTEGER  ::   inum                ! temporary logical unit
       INTEGER  ::   ilev, itime         ! temporary integers
@@ -407,5 +420,5 @@
       REAL(wp) ::   zdept(1)            ! temporary workspace
       REAL(wp), DIMENSION(jpidta,jpjdta) ::   &
-         zlamt, zphit, zdta             ! temporary workspace
+         zlamt, zphit, zdta             ! temporary workspace (NetCDF read)
       !!----------------------------------------------------------------------
 
@@ -416,20 +429,18 @@
       IF(lwp) THEN
          WRITE(numout,*)
-         WRITE(numout,*) 'dom_hgr_coo : read the horizontal coordinates'
-         WRITE(numout,*) '~~~~~~~~~~~'
-         WRITE(numout,*) '         jpiglo jpjglo jpk : ', jpiglo, jpjglo, jpk
+         WRITE(numout,*) 'hgr_read : read the horizontal coordinates'
+         WRITE(numout,*) '~~~~~~~~~~~      jpiglo = ', jpiglo, ' jpjglo = ', jpjglo, ' jpk = ', jpk
       ENDIF
 
       ! read the file
       itime = 0
-      clname = 'coordinates'
-      llog = .FALSE.
       ilev = 1   
       zlamt(:,:) = 0.e0
       zphit(:,:) = 0.e0
-      CALL restini( clname,jpidta,jpjdta,zlamt,zphit,ilev,zdept,clname   &
-         &          ,itime,zdate0,zdt,inum)
-
-      CALL restget(inum,'glamt',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restini( clname, jpidta, jpjdta, zlamt , zphit,   &
+         &                  ilev  , zdept , clname,          &
+         &                  itime , zdate0, zdt   , inum )
+
+      CALL restget( inum, 'glamt', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -437,5 +448,5 @@
          END DO
       END DO
-      CALL restget(inum,'glamu',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'glamu', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -443,5 +454,5 @@
          END DO
       END DO
-      CALL restget(inum,'glamv',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'glamv', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -449,5 +460,5 @@
          END DO
       END DO
-      CALL restget(inum,'glamf',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'glamf', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -455,5 +466,5 @@
          END DO
       END DO
-      CALL restget(inum,'gphit',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'gphit', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -461,5 +472,5 @@
          END DO
       END DO
-      CALL restget(inum,'gphiu',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'gphiu', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -467,5 +478,5 @@
          END DO
       END DO
-      CALL restget(inum,'gphiv',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'gphiv', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -473,5 +484,5 @@
          END DO
       END DO
-      CALL restget(inum,'gphif',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'gphif', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -479,5 +490,5 @@
          END DO
       END DO
-      CALL restget(inum,'e1t',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e1t', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -485,5 +496,5 @@
          END DO
       END DO
-      CALL restget(inum,'e1u',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e1u', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -491,5 +502,5 @@
          END DO
       END DO
-      CALL restget(inum,'e1v',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e1v', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -497,5 +508,5 @@
          END DO
       END DO
-      CALL restget(inum,'e1f',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e1f', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -503,5 +514,5 @@
          END DO
       END DO
-      CALL restget(inum,'e2t',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e2t', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -509,5 +520,5 @@
          END DO
       END DO
-      CALL restget(inum,'e2u',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e2u', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -515,5 +526,5 @@
          END DO
       END DO
-      CALL restget(inum,'e2v',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e2v', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -521,5 +532,5 @@
          END DO
       END DO
-      CALL restget(inum,'e2f',jpidta,jpjdta,1,0,llog,zdta)
+      CALL restget( inum, 'e2f', jpidta, jpjdta, 1, 0, llog, zdta )
       DO jj = 1, nlcj
          DO ji = 1, nlci
@@ -528,5 +539,5 @@
       END DO
 
-      CALL restclo(inum)
+      CALL restclo( inum )
 
       ! set extra rows add in mpp to none zero values
@@ -556,34 +567,288 @@
       END DO
 
-      !                                                ! =====================
-      IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN    ! ORCA R2 configuration
-         !                                             ! =====================
-         IF( n_cla == 0 ) THEN
-            ii0 = 160   ;   ii1 = 161        ! Bab el Mandeb (e2u = 18 km)
-            ij0 =  88   ;   ij1 =  88   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij0) ) =  18.e3 
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) '          Bab el Mandeb: e2u reduced to 18 km'
-         ENDIF 
-
-         ii0 = 145   ;   ii1 = 146        ! Sound Strait (e2u = 15 km)
-         ij0 = 116   ;   ij1 = 116   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij0) ) =  15.e3 
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) '        : Reduced e2u at the Sound Strait'
-         !
-      ENDIF
-
-      !                                                ! ======================
-      IF( cp_cfg == "orca" .AND. jp_cfg == 05 ) THEN   ! ORCA R05 configuration
-         !                                             ! ======================
-         ii0 = 563   ;   ii1 = 564        ! Gibraltar Strait (e2u = 20 km)
-         ij0 = 327   ;   ij1 = 327   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij0) ) =  20.e3    
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) '        : Reduced e2u at the Gibraltar Strait'
-         !
-      ENDIF
-
-   END SUBROUTINE dom_hgr_coo
-
-#endif
+   END SUBROUTINE hgr_read
+
+
+   SUBROUTINE hgr_read_fdir
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE hgr_read_fdir  ***
+      !!
+      !!----------------------------------------------------------------------
+      !! * Local declarations
+      CHARACTER (len=5) ::   clfield
+      CHARACTER(len=21) ::   clname = 'coordinates'
+      INTEGER ::   ji, jj         ! dummy loop indices
+      INTEGER ::   inumcoo = 11   ! logical unit for coordinate file
+      INTEGER ::   ijpi, ijpj     ! temporary integers
+      REAL(wp), DIMENSION(jpi,jpj) ::   zdta   ! temporary workspace
+      !!----------------------------------------------------------------------
+
+
+      ! 1. Read of the grid coordinates and scale factors
+      ! -------------------------------------------------
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'hgrcoo : read the horizontal coordinates'
+         WRITE(numout,*) '~~~~~~'
+         WRITE(numout,*) '         jpiglo jpjglo jpk : ', jpiglo, jpjglo, jpk
+      ENDIF
+
+      ! open the file
+          CALL ctlopn( inumcoo, clname, 'OLD', 'UNFORMATTED', 'SEQUENTIAL',   &
+                       1      , numout       , lwp  , 1                            )
+
+      ! read the file
+      READ(inumcoo) ijpi,ijpj
+      IF( (ijpi /= jpidta) .OR. (ijpj /= jpjdta) ) THEN
+         IF(lwp) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) '         inconsitency in reading coordinate file, unit=',inumcoo
+            WRITE(numout,*) '            jpidta = ',jpidta  ,' jpi  read = ',ijpi
+            WRITE(numout,*) '            jpjdta = ',jpjdta  ,' jpj  read = ',ijpj
+            WRITE(numout,*)
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+
+      READ(inumcoo) clfield, zdta
+      IF( clfield /= 'GLAMT' ) THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMT'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            glamt(ji,jj) = zdta(mig(ji),mjg(jj))
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'GLAMU') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMU'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            glamu(ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'GLAMV') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMV'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            glamv(ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'GLAMF') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMF'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            glamf(ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'GPHIT') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIT'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            gphit(ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'GPHIU') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIU'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            gphiu(ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'GPHIV') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIV'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            gphiv(ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'GPHIF') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIF'
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            gphif(ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E1T  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1T  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e1t  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E1U  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1U  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e1u  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E1V  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1V  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e1v  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E1F  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1F  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e1f  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E2T  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2T  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e2t  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E2U  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2U  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e2u  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E2V  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2V  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e2v  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+      READ(inumcoo) clfield, zdta
+      IF(clfield /= 'E2F  ') THEN
+         IF(lwp) THEN
+            WRITE(numout,cform_err)
+            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2F  '
+         ENDIF
+         nstop = nstop + 1
+      ENDIF
+      DO jj = 1, nlcj
+         DO ji = 1, nlci
+            e2f  (ji,jj) = zdta(mig(ji),mjg(jj))                    
+         END DO
+      END DO
+
+      CLOSE( inumcoo )
+
+      ! set extra rows add in mpp to none zero values
+      DO jj = nlcj+1, jpj
+         DO ji = 1, nlci
+            glamt(ji,jj) = glamt(ji,1)   ;   gphit(ji,jj) = gphit(ji,1)
+            glamu(ji,jj) = glamu(ji,1)   ;   gphiu(ji,jj) = gphiu(ji,1)
+            glamv(ji,jj) = glamv(ji,1)   ;   gphiv(ji,jj) = gphiv(ji,1)
+            glamf(ji,jj) = glamf(ji,1)   ;   gphif(ji,jj) = gphif(ji,1)
+            e1t  (ji,jj) = e1t  (ji,1)   ;   e2t  (ji,jj) = e2t  (ji,1)
+            e1u  (ji,jj) = e1u  (ji,1)   ;   e2u  (ji,jj) = e2u  (ji,1)
+            e1v  (ji,jj) = e1v  (ji,1)   ;   e2v  (ji,jj) = e2v  (ji,1)
+            e1f  (ji,jj) = e1f  (ji,1)   ;   e2f  (ji,jj) = e2f  (ji,1)
+         END DO
+      END DO
+
+      ! set extra columns add in mpp to none zero values
+      DO ji = nlci+1, jpi
+         glamt(ji,:) = glamt(1,:)   ;   gphit(ji,:) = gphit(1,:)
+         glamu(ji,:) = glamu(1,:)   ;   gphiu(ji,:) = gphiu(1,:)
+         glamv(ji,:) = glamv(1,:)   ;   gphiv(ji,:) = gphiv(1,:)
+         glamf(ji,:) = glamf(1,:)   ;   gphif(ji,:) = gphif(1,:)
+         e1t  (ji,:) = e1t  (1,:)   ;   e2t  (ji,:) = e2t  (1,:)
+         e1u  (ji,:) = e1u  (1,:)   ;   e2u  (ji,:) = e2u  (1,:)
+         e1v  (ji,:) = e1v  (1,:)   ;   e2v  (ji,:) = e2v  (1,:)
+         e1f  (ji,:) = e1f  (1,:)   ;   e2f  (ji,:) = e2f  (1,:)
+      END DO
+
+   END SUBROUTINE hgr_read_fdir
+
    !!======================================================================
 END MODULE domhgr
Index: trunk/NEMO/OPA_SRC/DOM/domhgr_coo_fdir.h90
===================================================================
--- trunk/NEMO/OPA_SRC/DOM/domhgr_coo_fdir.h90	(revision 80)
+++ 	(revision )
@@ -1,301 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                    ***  domhgr_coo_fdir.h90  ***
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LODYC-IPSL  (2003)
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE dom_hgr_coo
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE dom_hgr_coo  ***
-      !!
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      CHARACTER (len=5) ::   clfield
-      INTEGER ::   ji, jj         ! dummy loop indices
-      INTEGER ::   inumcoo = 11   ! logical unit for coordinate file
-      INTEGER ::   ijpi, ijpj     ! temporary integers
-      REAL(wp), DIMENSION(jpi,jpj) ::   zdta   ! temporary workspace
-      !!----------------------------------------------------------------------
-
-
-      ! 1. Read of the grid coordinates and scale factors
-      ! -------------------------------------------------
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'hgrcoo : read the horizontal coordinates'
-         WRITE(numout,*) '~~~~~~'
-         WRITE(numout,*) '         jpiglo jpjglo jpk : ', jpiglo, jpjglo, jpk
-      ENDIF
-
-      ! open the file
-          clname = 'coordinates'
-          CALL ctlopn( inumcoo, 'coordinates', 'OLD', 'UNFORMATTED', 'SEQUENTIAL',   &
-                       1      , numout       , lwp  , 1                            )
-
-      ! read the file
-      READ(inumcoo) ijpi,ijpj
-      IF( (ijpi /= jpidta) .OR. (ijpj /= jpjdta) ) THEN
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) '         inconsitency in reading coordinate file, unit=',inumcoo
-            WRITE(numout,*) '            jpidta = ',jpidta  ,' jpi  read = ',ijpi
-            WRITE(numout,*) '            jpjdta = ',jpjdta  ,' jpj  read = ',ijpj
-            WRITE(numout,*)
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-
-      READ(inumcoo) clfield, zdta
-      IF( clfield /= 'GLAMT' ) THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMT'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            glamt(ji,jj) = zdta(mig(ji),mjg(jj))
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'GLAMU') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMU'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            glamu(ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'GLAMV') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMV'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            glamv(ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'GLAMF') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GLAMF'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            glamf(ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'GPHIT') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIT'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            gphit(ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'GPHIU') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIU'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            gphiu(ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'GPHIV') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIV'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            gphiv(ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'GPHIF') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' GPHIF'
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            gphif(ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E1T  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1T  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e1t  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E1U  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1U  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e1u  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E1V  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1V  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e1v  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E1F  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E1F  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e1f  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E2T  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2T  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e2t  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E2U  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2U  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e2u  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E2V  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2V  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e2v  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-      READ(inumcoo) clfield,zdta
-      IF(clfield /= 'E2F  ') THEN
-         IF(lwp) THEN
-            WRITE(numout,cform_err)
-            WRITE(numout,*) 'hgrcoo: bad read',clfield,' E2F  '
-         ENDIF
-         nstop = nstop + 1
-      ENDIF
-      DO jj = 1, nlcj
-         DO ji = 1, nlci
-            e2f  (ji,jj) = zdta(mig(ji),mjg(jj))                    
-         END DO
-      END DO
-
-      CLOSE( inumcoo )
-
-      DO jj = nlcj+1, jpj
-         DO ji = 1, nlci
-            glamt(ji,jj) = glamt(ji,1)
-            glamu(ji,jj) = glamu(ji,1)
-            glamv(ji,jj) = glamv(ji,1)
-            glamf(ji,jj) = glamf(ji,1)
-            gphit(ji,jj) = gphit(ji,1)
-            gphiu(ji,jj) = gphiu(ji,1)
-            gphiv(ji,jj) = gphiv(ji,1)
-            gphif(ji,jj) = gphif(ji,1)
-            e1t  (ji,jj) = e1t  (ji,1)
-            e1u  (ji,jj) = e1u  (ji,1)
-            e1v  (ji,jj) = e1v  (ji,1)
-            e1f  (ji,jj) = e1f  (ji,1)
-            e2t  (ji,jj) = e2t  (ji,1)
-            e2u  (ji,jj) = e2u  (ji,1)
-            e2v  (ji,jj) = e2v  (ji,1)
-            e2f  (ji,jj) = e2f  (ji,1)
-         END DO
-      END DO
-      DO jj = 1, jpj
-         DO ji = nlci+1, jpi
-            glamt(ji,jj) = glamt(1,jj)
-            glamu(ji,jj) = glamu(1,jj)
-            glamv(ji,jj) = glamv(1,jj)
-            glamf(ji,jj) = glamf(1,jj)
-            gphit(ji,jj) = gphit(1,jj)
-            gphiu(ji,jj) = gphiu(1,jj)
-            gphiv(ji,jj) = gphiv(1,jj)
-            gphif(ji,jj) = gphif(1,jj)
-            e1t  (ji,jj) = e1t  (1,jj)
-            e1u  (ji,jj) = e1u  (1,jj)
-            e1v  (ji,jj) = e1v  (1,jj)
-            e1f  (ji,jj) = e1f  (1,jj)
-            e2t  (ji,jj) = e2t  (1,jj)
-            e2u  (ji,jj) = e2u  (1,jj)
-            e2v  (ji,jj) = e2v  (1,jj)
-            e2f  (ji,jj) = e2f  (1,jj)
-         END DO
-      END DO
-
-   END SUBROUTINE dom_hgr_coo
