Index: trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lbcnfd.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lbcnfd.F90	(revision 6918)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lbcnfd.F90	(revision 7646)
@@ -802,5 +802,5 @@
             ELSE
                startloop = 3
-               pt2dl(2,ijpj) = psgn * pt2dr(3,ijpjm1)
+               pt2dl(2,ijpj) = psgn * pt2dl(3,ijpjm1)
             ENDIF
             DO ji = startloop, nlci
@@ -814,5 +814,5 @@
             ELSE
                startloop = 3
-               pt2dl(2,ijpj) = psgn * pt2dr(3,ijpjm1)
+               pt2dl(2,ijpj) = psgn * pt2dl(3,ijpjm1)
             ENDIF
             DO ji = startloop, nlci
@@ -908,5 +908,5 @@
                DO ji = startloop , endloop
                   ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
-                  pt2dl(ji,ijpj)= 0.5 * (pt2dr(ji,ijpjm1) + psgn * pt2dr(ijt,ijpjm1))
+                  pt2dl(ji,ijpj)= 0.5 * (pt2dl(ji,ijpjm1) + psgn * pt2dr(ijt,ijpjm1))
                END DO
 
@@ -924,5 +924,5 @@
                DO ji = startloop , endloop
                   ijt = jpiglo - ji - nimpp - nfiimpp(isendto(1),jpnj) + 4
-                  pt2dl(ji,ijpj) = pt2dr(ji,ijpjm1)
+                  pt2dl(ji,ijpj) = pt2dl(ji,ijpjm1)
                END DO
 
Index: trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 6918)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 7646)
@@ -405,7 +405,12 @@
                                          ptab(nlci-jpreci+1:jpi   ,:,:) = zland    ! north
          ENDIF
-         !                                   ! North-South boundaries (always closed)
-         IF( .NOT. cd_type == 'F' )   ptab(:,     1       :jprecj,:) = zland       ! south except F-point
-                                      ptab(:,nlcj-jprecj+1:jpj   ,:) = zland       ! north
+                                          ! North-south cyclic
+         IF ( nbondj == 2 .AND. jperio == 7 )    THEN !* cyclic north south only with no mpp split in latitude
+            ptab(:,1 , :) = ptab(:, jpjm1,:)
+            ptab(:,jpj,:) = ptab(:,     2,:)
+         ELSE   !                                   ! North-South boundaries (closed)
+            IF( .NOT. cd_type == 'F' )   ptab(:,     1       :jprecj,:) = zland       ! south except F-point
+                                         ptab(:,nlcj-jprecj+1:jpj   ,:) = zland       ! north
+         ENDIF
          !
       ENDIF
@@ -608,9 +613,15 @@
                                                    pt2d_array(ii)%pt2d(nlci-jpreci+1 : jpi   ,:) = zland    ! north
             ENDIF
-            !                                   ! North-South boundaries (always closed)
+                                                ! Noth-South boundaries
+            IF ( nbondj == 2 .AND. jperio == 7 )    THEN !* cyclic north south
+               pt2d_array(ii)%pt2d(:, 1   ) =   pt2d_array(ii)%pt2d(:, jpjm1 )
+               pt2d_array(ii)%pt2d(:, jpj ) =   pt2d_array(ii)%pt2d(:, 2 )          
+            ELSE   !             
+               !                                   ! North-South boundaries (closed)
                IF( .NOT. type_array(ii) == 'F' )   pt2d_array(ii)%pt2d(:,             1:jprecj ) = zland    ! south except F-point
                                                    pt2d_array(ii)%pt2d(:, nlcj-jprecj+1:jpj    ) = zland    ! north
             !
-         ENDIF
+            ENDIF
+          ENDIF
       END DO
 
@@ -888,8 +899,13 @@
                                          pt2d(nlci-jpreci+1:jpi   ,:) = zland    ! north
          ENDIF
-         !                                   ! North-South boundaries (always closed)
+                                            ! North-South boudaries
+         IF ( nbondj == 2 .AND. jperio == 7 )    THEN !* cyclic north south
+            pt2d(:,  1 ) = pt2d(:,jpjm1)
+            pt2d(:, jpj) = pt2d(:,    2)
+         ELSE    
+         !                                   ! North-South boundaries (closed)
             IF( .NOT. cd_type == 'F' )   pt2d(:,     1       :jprecj) = zland    !south except F-point
                                          pt2d(:,nlcj-jprecj+1:jpj   ) = zland    ! north
-         !
+         ENDIF     
       ENDIF
 
@@ -1071,12 +1087,17 @@
                                        ptab2(nlci-jpreci+1:jpi   ,:,:) = 0.e0
       ENDIF
-
-
-      !                                      ! North-South boundaries
+                                            ! North-South boundaries
+      IF ( nbondj == 2 .AND. jperio == 7 )    THEN !* cyclic north south
+         ptab1(:,     1       ,:) = ptab1(: ,  jpjm1 , :)
+         ptab1(:,   jpj       ,:) = ptab1(: ,      2 , :)
+         ptab2(:,     1       ,:) = ptab2(: ,  jpjm1 , :)
+         ptab2(:,   jpj       ,:) = ptab2(: ,      2 , :)
+      ELSE     
+      !                                      ! North-South boundaries closed
       IF( .NOT. cd_type1 == 'F' )   ptab1(:,     1       :jprecj,:) = 0.e0    ! south except at F-point
       IF( .NOT. cd_type2 == 'F' )   ptab2(:,     1       :jprecj,:) = 0.e0
                                     ptab1(:,nlcj-jprecj+1:jpj   ,:) = 0.e0    ! north
                                     ptab2(:,nlcj-jprecj+1:jpj   ,:) = 0.e0
-
+      ENDIF     
 
       ! 2. East and west directions exchange
@@ -1267,8 +1288,15 @@
       ! Order matters Here !!!!
       !
-      !                                      !* North-South boundaries (always colsed)
+                                           ! North-South cyclic
+      IF ( nbondj == 2 .AND. jperio == 7 )    THEN !* cyclic north south
+         pt2d(:, 1-jprj:  1     ) = pt2d ( :, jpjm1-jprj:jpjm1)
+         pt2d(:, jpj   :jpj+jprj) = pt2d ( :, 2         :2+jprj)
+      ELSE
+        
+      !                                      !* North-South boundaries (closed)
       IF( .NOT. cd_type == 'F' )   pt2d(:,  1-jprj   :  jprecj  ) = 0.e0    ! south except at F-point
                                    pt2d(:,nlcj-jprecj+1:jpj+jprj) = 0.e0    ! north
-
+      ENDIF
+                                
       !                                      ! East-West boundaries
       !                                           !* Cyclic east-west
@@ -4304,4 +4332,5 @@
             WRITE(kout,*)
          ENDIF
+         CALL FLUSH(kout) 
          STOP 'ctl_opn bad opening'
       ENDIF
@@ -4320,9 +4349,9 @@
       INTEGER         , INTENT(inout) ::   kios    ! IO status after reading the namelist
       CHARACTER(len=*), INTENT(in   ) ::   cdnam   ! group name of namelist for which error occurs
-      CHARACTER(len=4)                ::   clios   ! string to convert iostat in character for print
+      CHARACTER(len=5)                ::   clios   ! string to convert iostat in character for print
       LOGICAL         , INTENT(in   ) ::   ldwp    ! boolean term for print
       !!----------------------------------------------------------------------
       !
-      WRITE (clios, '(I4.0)')   kios
+      WRITE (clios, '(I5.0)')   kios
       IF( kios < 0 ) THEN         
          CALL ctl_warn( 'end of record or file while reading namelist '   &
Index: trunk/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90	(revision 6918)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90	(revision 7646)
@@ -65,5 +65,5 @@
          WRITE(numout,*)
          WRITE(numout,*) 'mpp_init(2) : NO massively parallel processing'
-         WRITE(numout,*) '~~~~~~~~~~~: '
+         WRITE(numout,*) '~~~~~~~~~~~ '
          WRITE(numout,*) '         nperio = ', nperio
          WRITE(numout,*) '         npolj  = ', npolj
@@ -76,4 +76,6 @@
           &              'the domain is lay out for distributed memory computing! ' )
 
+      IF( jperio == 7 ) CALL ctl_stop( ' jperio = 7 needs distributed memory computing ',   &
+          &              ' with 1 process. Add key_mpp_mpi in the list of active cpp keys ' )
    END SUBROUTINE mpp_init
 
@@ -265,10 +267,7 @@
       
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' mpp_init: defines mpp subdomains'
-      IF(lwp) WRITE(numout,*) ' ~~~~~~  ----------------------'
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'iresti=',iresti,' irestj=',irestj
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'jpni=',jpni,' jpnj=',jpnj
+      IF(lwp) WRITE(numout,*) '   defines mpp subdomains'
+      IF(lwp) WRITE(numout,*) '      jpni=', jpni, ' iresti=', iresti
+      IF(lwp) WRITE(numout,*) '      jpnj=', jpnj, ' irestj=', irestj
       zidom = nreci
       DO ji = 1, jpni
@@ -276,5 +275,5 @@
       END DO
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*)' sum ilcit(i,1)=', zidom, ' jpiglo=', jpiglo
+      IF(lwp) WRITE(numout,*)'      sum ilcit(i,1)=', zidom, ' jpiglo=', jpiglo
 
       zjdom = nrecj
@@ -282,6 +281,5 @@
          zjdom = zjdom + ilcjt(1,jj) - nrecj
       END DO
-      IF(lwp) WRITE(numout,*)' sum ilcit(1,j)=', zjdom, ' jpjglo=', jpjglo
-      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*)'      sum ilcit(1,j)=', zjdom, ' jpjglo=', jpjglo
 
       IF(lwp) THEN
@@ -360,24 +358,23 @@
       njmpp  = njmppt(narea)  
 
-     ! Save processor layout in layout.dat file 
-       IF (lwp) THEN
-        CALL ctl_opn( inum, 'layout.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea )
-        WRITE(inum,'(a)') '   jpnij     jpi     jpj     jpk  jpiglo  jpjglo'
-        WRITE(inum,'(6i8)') jpnij,jpi,jpj,jpk,jpiglo,jpjglo
-        WRITE(inum,'(a)') 'NAREA nlci nlcj nldi nldj nlei nlej nimpp njmpp'
-
-        DO  jn = 1, jpnij
-         WRITE(inum,'(9i5)') jn, nlcit(jn), nlcjt(jn), &
-                                      nldit(jn), nldjt(jn), &
-                                      nleit(jn), nlejt(jn), &
-                                      nimppt(jn), njmppt(jn)
-        END DO
-        CLOSE(inum)   
+      ! Save processor layout in layout.dat file 
+      IF(lwp) THEN
+         CALL ctl_opn( inum, 'layout.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea )
+         WRITE(inum,'(a)') '   jpnij     jpi     jpj     jpk  jpiglo  jpjglo'
+         WRITE(inum,'(6i8)') jpnij,jpi,jpj,jpk,jpiglo,jpjglo
+         WRITE(inum,'(a)') 'NAREA nlci nlcj nldi nldj nlei nlej nimpp njmpp'
+         !
+         DO jn = 1, jpnij
+            WRITE(inum,'(9i5)') jn, nlcit(jn), nlcjt(jn), &
+               &                    nldit(jn), nldjt(jn), &
+               &                    nleit(jn), nlejt(jn), &
+               &                    nimppt(jn), njmppt(jn)
+         END DO
+         CLOSE(inum)   
       END IF
 
-
       ! w a r n i n g  narea (zone) /= nproc (processors)!
 
-      IF( jperio == 1 .OR. jperio == 4 .OR. jperio == 6 ) THEN
+      IF( jperio == 1 .OR. jperio == 4 .OR. jperio == 6 .OR. jperio == 7 ) THEN
          IF( jpni == 1 )THEN
             nbondi = 2
@@ -428,22 +425,21 @@
 
       IF(lwp) THEN
-         WRITE(numout,*) ' nproc  = ', nproc
-         WRITE(numout,*) ' nowe   = ', nowe  , ' noea   =  ', noea
-         WRITE(numout,*) ' nono   = ', nono  , ' noso   =  ', noso
-         WRITE(numout,*) ' nbondi = ', nbondi
-         WRITE(numout,*) ' nbondj = ', nbondj
-         WRITE(numout,*) ' npolj  = ', npolj
-         WRITE(numout,*) ' nperio = ', nperio
-         WRITE(numout,*) ' nlci   = ', nlci
-         WRITE(numout,*) ' nlcj   = ', nlcj
-         WRITE(numout,*) ' nimpp  = ', nimpp
-         WRITE(numout,*) ' njmpp  = ', njmpp
-         WRITE(numout,*) ' nreci  = ', nreci  , ' npse   = ', npse
-         WRITE(numout,*) ' nrecj  = ', nrecj  , ' npsw   = ', npsw
-         WRITE(numout,*) ' jpreci = ', jpreci , ' npne   = ', npne
-         WRITE(numout,*) ' jprecj = ', jprecj , ' npnw   = ', npnw
+         WRITE(numout,*) '      nproc  = ', nproc
+         WRITE(numout,*) '      nowe   = ', nowe  , '      noea   =  ', noea
+         WRITE(numout,*) '      nono   = ', nono  , '      noso   =  ', noso
+         WRITE(numout,*) '      nbondi = ', nbondi, '      nbondj = ', nbondj
+         WRITE(numout,*) '      npolj  = ', npolj
+         WRITE(numout,*) '      nperio = ', nperio
+         WRITE(numout,*) '      nlci   = ', nlci  , '      nlcj   = ', nlcj
+         WRITE(numout,*) '      nimpp  = ', nimpp , '      njmpp  = ', njmpp
+         WRITE(numout,*) '      nreci  = ', nreci , '      npse   = ', npse
+         WRITE(numout,*) '      nrecj  = ', nrecj , '      npsw   = ', npsw
+         WRITE(numout,*) '      jpreci = ', jpreci, '      npne   = ', npne
+         WRITE(numout,*) '      jprecj = ', jprecj, '      npnw   = ', npnw
          WRITE(numout,*)
       ENDIF
 
+      IF( jperio == 7 .AND. ( jpni /= 1 .OR. jpnj /= 1 ) ) &
+         &                  CALL ctl_stop( ' mpp_init: error jperio = 7 works only with jpni = jpnj = 1' )
       IF( nperio == 1 .AND. jpni /= 1 ) CALL ctl_stop( ' mpp_init: error on cyclicity' )
 
Index: trunk/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90	(revision 6918)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90	(revision 7646)
@@ -6,5 +6,5 @@
       !!     FOR USING THIS VERSION, A PREPROCESSING TRAITMENT IS RECOMMENDED
       !!     FOR DEFINING BETTER CUTTING OUT.
-      !!       This routine is used with a the bathymetry file.
+      !!       This routine requires the presence of the domain configuration file.
       !!       In this version, the land processors are avoided and the adress
       !!     processor (nproc, narea,noea, ...) are calculated again.
@@ -32,13 +32,14 @@
       !!                    nono      : number for local neighboring processor
       !!
-      !! History :
-      !!        !  94-11  (M. Guyon)  Original code
-      !!        !  95-04  (J. Escobar, M. Imbard)
-      !!        !  98-02  (M. Guyon)  FETI method
-      !!        !  98-05  (M. Imbard, J. Escobar, L. Colombet )  SHMEM and MPI versions
-      !!   9.0  !  04-01  (G. Madec, J.M Molines)  F90 : free form , north fold jpni > 1
+      !! History :       !  1994-11  (M. Guyon)  Original code
+      !!  OPA            !  1995-04  (J. Escobar, M. Imbard)
+      !!                 !  1998-02  (M. Guyon)  FETI method
+      !!                 !  1998-05  (M. Imbard, J. Escobar, L. Colombet )  SHMEM and MPI versions
+      !!  NEMO      1.0  !  2004-01  (G. Madec, J.M Molines)  F90 : free form , north fold jpni > 1
+      !!            4.0  !  2016-06  (G. Madec)  use domain configuration file instead of bathymetry file
       !!----------------------------------------------------------------------
       USE in_out_manager  ! I/O Manager
       USE iom
+      USE bdy_oce
       !! 
       INTEGER :: ji, jj, jn, jproc, jarea     ! dummy loop indices
@@ -65,76 +66,58 @@
          ione  , ionw  , iose  , iosw  ,   &  !    "           "
          ibne  , ibnw  , ibse  , ibsw         !    "           "
-      INTEGER,  DIMENSION(jpiglo,jpjglo) ::   &
-         imask                                ! temporary global workspace
-      REAL(wp), DIMENSION(jpiglo,jpjglo) ::   &
-         zdta, zdtaisf                     ! temporary data workspace
-      REAL(wp) ::   zidom , zjdom          ! temporary scalars
-
-      ! read namelist for ln_zco
-      NAMELIST/namzgr/ ln_zco, ln_zps, ln_sco, ln_isfcav, ln_linssh
-
+      INTEGER,  DIMENSION(jpiglo,jpjglo) ::   imask               ! global workspace
+      REAL(wp), DIMENSION(jpiglo,jpjglo) ::   zbot, ztop          ! global workspace
+      REAL(wp) ::   zidom , zjdom          ! local scalars
+      NAMELIST/nambdy/ ln_bdy, nb_bdy, ln_coords_file, cn_coords_file,         &
+         &             ln_mask_file, cn_mask_file, cn_dyn2d, nn_dyn2d_dta,     &
+         &             cn_dyn3d, nn_dyn3d_dta, cn_tra, nn_tra_dta,             &  
+         &             ln_tra_dmp, ln_dyn3d_dmp, rn_time_dmp, rn_time_dmp_out, &
+         &             cn_ice_lim, nn_ice_lim_dta,                           &
+         &             rn_ice_tem, rn_ice_sal, rn_ice_age,                 &
+         &             ln_vol, nn_volctl, nn_rimwidth, nb_jpk_bdy
       !!----------------------------------------------------------------------
-      !!  OPA 9.0 , LOCEAN-IPSL (2005) 
+      !! NEMO/OPA 4.0 , NEMO Consortium (2016)
       !! $Id$
-      !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+      !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
       !!----------------------------------------------------------------------
 
-      REWIND( numnam_ref )              ! Namelist namzgr in reference namelist : Vertical coordinate
-      READ  ( numnam_ref, namzgr, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzgr in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namzgr in configuration namelist : Vertical coordinate
-      READ  ( numnam_cfg, namzgr, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzgr in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, namzgr )
-
       IF(lwp)WRITE(numout,*)
-      IF(lwp)WRITE(numout,*) 'mpp_init : Message Passing MPI'
-      IF(lwp)WRITE(numout,*) '~~~~~~~~'
+      IF(lwp)WRITE(numout,*) 'mpp_init_2 : Message Passing MPI'
+      IF(lwp)WRITE(numout,*) '~~~~~~~~~~'
       IF(lwp)WRITE(numout,*) ' '
 
-      IF( jpni*jpnj < jpnij ) CALL ctl_stop( ' jpnij > jpni x jpnj impossible' )
+      IF( jpni*jpnj < jpnij )   CALL ctl_stop( ' jpnij > jpni x jpnj impossible' )
 
       ! 0. initialisation
       ! -----------------
-
-      ! open the file
-      ! Remember that at this level in the code, mpp is not yet initialized, so
-      ! the file must be open with jpdom_unknown, and kstart and kcount forced 
-      jstartrow = 1
-      IF ( ln_zco ) THEN 
-         CALL iom_open ( 'bathy_level.nc', inum )   ! Level bathymetry
-          ! Optionally use a file attribute (open_ocean_jstart) to set a start row for reading from the global file
-          ! This allows the unextended grid bathymetry to be stored in the same file as the under ice-shelf extended bathymetry
-         CALL iom_getatt(inum, 'open_ocean_jstart', jstartrow ) ! -999 is returned if the attribute is not found
-         jstartrow = MAX(1,jstartrow)
-         CALL iom_get ( inum, jpdom_unknown, 'Bathy_level', zdta, kstart=(/jpizoom,jpjzoom+jstartrow-1/), kcount=(/jpiglo,jpjglo/) )
-      ELSE
-         CALL iom_open ( 'bathy_meter.nc', inum )   ! Meter bathy in case of partial steps
-         IF ( ln_isfcav ) THEN
-             CALL iom_get ( inum, jpdom_unknown, 'Bathymetry_isf' , zdta, kstart=(/jpizoom,jpjzoom/), kcount=(/jpiglo,jpjglo/) )
-         ELSE
-             ! Optionally use a file attribute (open_ocean_jstart) to set a start row for reading from the global file
-             ! This allows the unextended grid bathymetry to be stored in the same file as the under ice-shelf extended bathymetry
-             CALL iom_getatt(inum, 'open_ocean_jstart', jstartrow ) ! -999 is returned if the attribute is not found
-             jstartrow = MAX(1,jstartrow)
-             CALL iom_get ( inum, jpdom_unknown, 'Bathymetry' , zdta, kstart=(/jpizoom,jpjzoom+jstartrow-1/)   &
-                &                                                   , kcount=(/jpiglo,jpjglo/) )
-         ENDIF
-      ENDIF
-      CALL iom_close (inum)
-      
-      ! used to compute the land processor in case of not masked bathy file.
-      zdtaisf(:,:) = 0.0_wp
-      IF ( ln_isfcav ) THEN
-         CALL iom_open ( 'bathy_meter.nc', inum )   ! Meter bathy in case of partial steps
-         CALL iom_get ( inum, jpdom_unknown, 'isf_draft' , zdtaisf, kstart=(/jpizoom,jpjzoom/), kcount=(/jpiglo,jpjglo/) )
-      END IF
-      CALL iom_close (inum)
-
-      ! land/sea mask over the global/zoom domain
-
-      imask(:,:)=1
-      WHERE ( zdta(:,:) - zdtaisf(:,:) <= rn_isfhmin ) imask = 0
+      CALL iom_open( cn_domcfg, inum )
+      !
+      !                                   ! ocean top and bottom level
+      CALL iom_get( inum, jpdom_data, 'bottom_level' , zbot    )  ! nb of ocean T-points
+      CALL iom_get( inum, jpdom_data, 'top_level'    , ztop    )  ! nb of ocean T-points (ISF)
+      !
+      CALL iom_close( inum )
+      !
+      ! 2D ocean mask (=1 if at least one level of the water column is ocean, =0 otherwise)
+      WHERE( zbot(:,:) - ztop(:,:) + 1 > 0 )   ;   imask(:,:) = 1
+      ELSEWHERE                                ;   imask(:,:) = 0
+      END WHERE
+
+      ! Adjust imask with bdy_msk if exists
+
+      REWIND( numnam_ref )              ! Namelist nambdy in reference namelist : BDY
+      READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903)
+903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in reference namelist (mppini_2)', lwp )
+
+      REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist : BDY
+      READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 904 )
+904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in configuration namelist (mppini_2)', lwp )
+
+      IF( ln_bdy .AND. ln_mask_file ) THEN
+         CALL iom_open( cn_mask_file, inum )
+         CALL iom_get ( inum, jpdom_data, 'bdy_msk', bdytmask(:,:) )
+         CALL iom_close( inum )
+         WHERE ( bdytmask(:,:) <= 0. ) imask = 0
+      ENDIF
 
       !  1. Dimension arrays for subdomains
@@ -322,5 +305,5 @@
          DO jj = 1, ilj
             DO  ji = 1, ili
-               IF( imask(ji+iimppt(ii,ij)-1, jj+ijmppt(ii,ij)-1) == 1) isurf = isurf+1
+               IF( imask(ji+iimppt(ii,ij)-1, jj+ijmppt(ii,ij)-1) == 1)   isurf = isurf+1
             END DO
          END DO
