Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_ice_interp.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_ice_interp.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_ice_interp.F90	(revision 12807)
@@ -260,32 +260,32 @@
 !            imin = i1  ;  imax = i2  ;  jmin = j1  ;  jmax = j2
 !            IF( (nbondj == -1) .OR. (nbondj == 2) )   jmin = 3
-!            IF( (nbondj == +1) .OR. (nbondj == 2) )   jmax = nlcj-2
+!            IF( (nbondj == +1) .OR. (nbondj == 2) )   jmax = jpj-2
 !            IF( (nbondi == -1) .OR. (nbondi == 2) )   imin = 3
-!            IF( (nbondi == +1) .OR. (nbondi == 2) )   imax = nlci-2
+!            IF( (nbondi == +1) .OR. (nbondi == 2) )   imax = jpi-2
 !
 !            ! smoothed fields
 !            IF( eastern_side ) THEN
-!               ztab(nlci,j1:j2,:) = z1 * ptab(nlci,j1:j2,:) + z2 * ptab(nlci-1,j1:j2,:)
+!               ztab(jpi,j1:j2,:) = z1 * ptab(jpi,j1:j2,:) + z2 * ptab(jpi-1,j1:j2,:)
 !               DO jj = jmin, jmax
 !                  rswitch = 0.
-!                  IF( u_ice(nlci-2,jj) > 0._wp ) rswitch = 1.
-!                  ztab(nlci-1,jj,:) = ( 1. - umask(nlci-2,jj,1) ) * ztab(nlci,jj,:)  &
-!                     &                +      umask(nlci-2,jj,1)   *  &
-!                     &                ( ( 1. - rswitch ) * ( z4 * ztab(nlci,jj,:)   + z3 * ztab(nlci-2,jj,:) )  &
-!                     &                  +      rswitch   * ( z6 * ztab(nlci-2,jj,:) + z5 * ztab(nlci,jj,:) + z7 * ztab(nlci-3,jj,:) ) )
-!                  ztab(nlci-1,jj,:) = ztab(nlci-1,jj,:) * tmask(nlci-1,jj,1)
+!                  IF( u_ice(jpi-2,jj) > 0._wp ) rswitch = 1.
+!                  ztab(jpi-1,jj,:) = ( 1. - umask(jpi-2,jj,1) ) * ztab(jpi,jj,:)  &
+!                     &               +      umask(jpi-2,jj,1)   *  &
+!                     &               ( (1. - rswitch) * ( z4 * ztab(jpi  ,jj,:) + z3 * ztab(jpi-2,jj,:) )  &
+!                     &                 +     rswitch  * ( z6 * ztab(jpi-2,jj,:) + z5 * ztab(jpi  ,jj,:) + z7 * ztab(jpi-3,jj,:) ) )
+!                  ztab(jpi-1,jj,:) = ztab(jpi-1,jj,:) * tmask(jpi-1,jj,1)
 !               END DO
 !            ENDIF
 !            ! 
 !            IF( northern_side ) THEN
-!               ztab(i1:i2,nlcj,:) = z1 * ptab(i1:i2,nlcj,:) + z2 * ptab(i1:i2,nlcj-1,:)
+!               ztab(i1:i2,jpj,:) = z1 * ptab(i1:i2,jpj,:) + z2 * ptab(i1:i2,jpj-1,:)
 !               DO ji = imin, imax
 !                  rswitch = 0.
-!                  IF( v_ice(ji,nlcj-2) > 0._wp ) rswitch = 1.
-!                  ztab(ji,nlcj-1,:) = ( 1. - vmask(ji,nlcj-2,1) ) * ztab(ji,nlcj,:)  &
-!                     &                +      vmask(ji,nlcj-2,1)   *  &
-!                     &                ( ( 1. - rswitch ) * ( z4 * ztab(ji,nlcj,:)   + z3 * ztab(ji,nlcj-2,:) ) &
-!                     &                  +      rswitch   * ( z6 * ztab(ji,nlcj-2,:) + z5 * ztab(ji,nlcj,:) + z7 * ztab(ji,nlcj-3,:) ) )
-!                  ztab(ji,nlcj-1,:) = ztab(ji,nlcj-1,:) * tmask(ji,nlcj-1,1)
+!                  IF( v_ice(ji,jpj-2) > 0._wp ) rswitch = 1.
+!                  ztab(ji,jpj-1,:) = ( 1. - vmask(ji,jpj-2,1) ) * ztab(ji,jpj,:)  &
+!                     &               +      vmask(ji,jpj-2,1)   *  &
+!                     &               ( (1. - rswitch) * ( z4 * ztab(ji,jpj  ,:) + z3 * ztab(ji,jpj-2,:) ) &
+!                     &                 +     rswitch  * ( z6 * ztab(ji,jpj-2,:) + z5 * ztab(ji,jpj  ,:) + z7 * ztab(ji,jpj-3,:) ) )
+!                  ztab(ji,jpj-1,:) = ztab(ji,jpj-1,:) * tmask(ji,jpj-1,1)
 !               END DO
 !            END IF
@@ -318,8 +318,8 @@
 !            !
 !            ! Treatment of corners
-!            IF( (eastern_side) .AND. ((nbondj == -1).OR.(nbondj == 2)) )  ztab(nlci-1,2,:)      = ptab(nlci-1,2,:)      ! East south
-!            IF( (eastern_side) .AND. ((nbondj ==  1).OR.(nbondj == 2)) )  ztab(nlci-1,nlcj-1,:) = ptab(nlci-1,nlcj-1,:) ! East north
-!            IF( (western_side) .AND. ((nbondj == -1).OR.(nbondj == 2)) )  ztab(2,2,:)           = ptab(2,2,:)           ! West south
-!            IF( (western_side) .AND. ((nbondj ==  1).OR.(nbondj == 2)) )  ztab(2,nlcj-1,:)      = ptab(2,nlcj-1,:)      ! West north
+!            IF( (eastern_side) .AND. ((nbondj == -1).OR.(nbondj == 2)) )  ztab(jpi-1,2    ,:) = ptab(jpi-1,    2,:)   ! East south
+!            IF( (eastern_side) .AND. ((nbondj ==  1).OR.(nbondj == 2)) )  ztab(jpi-1,jpj-1,:) = ptab(jpi-1,jpj-1,:)   ! East north
+!            IF( (western_side) .AND. ((nbondj == -1).OR.(nbondj == 2)) )  ztab(    2,    2,:) = ptab(    2,    2,:)   ! West south
+!            IF( (western_side) .AND. ((nbondj ==  1).OR.(nbondj == 2)) )  ztab(    2,jpj-1,:) = ptab(    2,jpj-1,:)   ! West north
 !            
 !            ! retrieve ice tracers
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_oce_sponge.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_oce_sponge.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_oce_sponge.F90	(revision 12807)
@@ -646,5 +646,5 @@
 
          jmax = j2-1
-         IF ((nbondj == 1).OR.(nbondj == 2)) jmax = MIN(jmax,nlcj-nbghostcells-2)   ! North
+         IF ((nbondj == 1).OR.(nbondj == 2)) jmax = MIN(jmax,jpj-nbghostcells-2)   ! North
 
          DO jj = j1+1, jmax
@@ -802,5 +802,5 @@
 
          imax = i2 - 1
-         IF ((nbondi == 1).OR.(nbondi == 2))   imax = MIN(imax,nlci-nbghostcells-2)   ! East
+         IF ((nbondi == 1).OR.(nbondi == 2))   imax = MIN(imax,jpi-nbghostcells-2)   ! East
 
          DO jj = j1+1, j2
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_user.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_user.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/NST/agrif_user.F90	(revision 12807)
@@ -65,6 +65,6 @@
       ind2 = 1 + nbghostcells
       ind3 = 2 + nbghostcells
-      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e1u_id)
-      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e2v_id)
+      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e1u_id)
+      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e2v_id)
 
       ! 2. Type of interpolation
@@ -318,50 +318,50 @@
       ind3 = 2 + nbghostcells
 # if defined key_vertical
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts+1/),tsn_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts+1/),tsn_sponge_id)
-
-      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_interp_id)
-      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_interp_id)
-      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_update_id)
-      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_update_id)
-      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_sponge_id)
-      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_sponge_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts+1/),tsn_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts+1/),tsn_sponge_id)
+
+      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,2/),un_interp_id)
+      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,2/),vn_interp_id)
+      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,2/),un_update_id)
+      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,2/),vn_update_id)
+      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,2/),un_sponge_id)
+      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,2/),vn_sponge_id)
 # else
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_sponge_id)
-
-      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_interp_id)
-      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_interp_id)
-      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_update_id)
-      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_update_id)
-      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_sponge_id)
-      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_sponge_id)
-# endif
-
-      CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),e3t_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsn_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsn_sponge_id)
+
+      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,1/),un_interp_id)
+      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,1/),vn_interp_id)
+      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,1/),un_update_id)
+      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,1/),vn_update_id)
+      CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,1/),un_sponge_id)
+      CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,1/),vn_sponge_id)
+# endif
+
+      CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),e3t_id)
 
 # if defined key_vertical
-      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),mbkt_id)
-      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ht0_id)
-# endif
-
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,3/),scales_t_id)
-
-      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),unb_id)
-      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vnb_id)
-      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_interp_id)
-      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_interp_id)
-      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_update_id)
-      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_update_id)
-
-      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),sshn_id)
+      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),mbkt_id)
+      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),ht0_id)
+# endif
+
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,3/),scales_t_id)
+
+      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),unb_id)
+      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),vnb_id)
+      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),ub2b_interp_id)
+      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),vb2b_interp_id)
+      CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),ub2b_update_id)
+      CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),vb2b_update_id)
+
+      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),sshn_id)
 
       IF( ln_zdftke.OR.ln_zdfgls ) THEN
-!         CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/), en_id)
-!         CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),avt_id)
+!         CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/), en_id)
+!         CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),avt_id)
 # if defined key_vertical
-         CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),avm_id)
+         CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,2/),avm_id)
 # else
-         CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),avm_id)
+         CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,1/),avm_id)
 # endif
       ENDIF
@@ -535,7 +535,7 @@
       ind2 = 1 + nbghostcells
       ind3 = 2 + nbghostcells
-      CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpl*(8+nlay_s+nlay_i)/),tra_ice_id)
-      CALL agrif_declare_variable((/1,2/)  ,(/ind2,ind3/)  ,(/'x','y'/)    ,(/1,1/)  ,(/nlci,nlcj/)                      ,u_ice_id  )
-      CALL agrif_declare_variable((/2,1/)  ,(/ind3,ind2/)  ,(/'x','y'/)    ,(/1,1/)  ,(/nlci,nlcj/)                      ,v_ice_id  )
+      CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpl*(8+nlay_s+nlay_i)/),tra_ice_id)
+      CALL agrif_declare_variable((/1,2/)  ,(/ind2,ind3/)  ,(/'x','y'/)    ,(/1,1/)  ,(/jpi,jpj/)                      ,u_ice_id  )
+      CALL agrif_declare_variable((/2,1/)  ,(/ind3,ind2/)  ,(/'x','y'/)    ,(/1,1/)  ,(/jpi,jpj/)                      ,v_ice_id  )
 
       ! 2. Set interpolations (normal & tangent to the grid cell for velocities)
@@ -661,9 +661,9 @@
       ind3 = 2 + nbghostcells
 # if defined key_vertical
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_sponge_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra+1/),trn_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra+1/),trn_sponge_id)
 # else
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_id)
-      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_sponge_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trn_id)
+      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trn_sponge_id)
 # endif
 
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crs.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crs.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crs.F90	(revision 12807)
@@ -36,10 +36,8 @@
       INTEGER  ::  jpiglo_full, jpjglo_full     !: jpiglo / jpjglo
       INTEGER  ::  npiglo, npjglo               !: jpjglo
-      INTEGER  ::  nlci_full, nlcj_full         !: i-, j-dimension of local or sub domain on parent grid
-      INTEGER  ::  nldi_full, nldj_full         !: starting indices of internal sub-domain on parent grid
-      INTEGER  ::  nlei_full, nlej_full         !: ending indices of internal sub-domain on parent grid
-      INTEGER  ::  nlci_crs, nlcj_crs           !: i-, j-dimension of local or sub domain on coarse grid
-      INTEGER  ::  nldi_crs, nldj_crs           !: starting indices of internal sub-domain on coarse grid
-      INTEGER  ::  nlei_crs, nlej_crs           !: ending indices of internal sub-domain on coarse grid
+      INTEGER  ::  Nis0_full, Njs0_full         !: starting indices of internal sub-domain on parent grid
+      INTEGER  ::  Nie0_full, Nje0_full         !: ending indices of internal sub-domain on parent grid
+      INTEGER  ::  Nis0_crs , Njs0_crs          !: starting indices of internal sub-domain on coarse grid
+      INTEGER  ::  Nie0_crs , Nje0_crs          !: ending indices of internal sub-domain on coarse grid
 
       INTEGER  ::  narea_full, narea_crs        !: node
@@ -48,6 +46,4 @@
       INTEGER  ::  nimpp_full, njmpp_full       !: global position of point (1,1) of subdomain on parent grid
       INTEGER  ::  nimpp_crs, njmpp_crs         !: set to 1,1 for now .  Valid only for monoproc
-      INTEGER  ::  nreci_full, nrecj_full
-      INTEGER  ::  nreci_crs, nrecj_crs
       !cc
       INTEGER ::   noea_full, nowe_full        !: index of the local neighboring processors in
@@ -76,20 +72,18 @@
       INTEGER, DIMENSION(:), ALLOCATABLE :: mi0_crs, mi1_crs, mj0_crs, mj1_crs
       INTEGER  :: mxbinctr, mybinctr            ! central point in grid box
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nlcit_crs, nlcit_full  !: dimensions of every subdomain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nldit_crs, nldit_full     !: first, last indoor index for each i-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nleit_crs, nleit_full    !: first, last indoor index for each j-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nimppt_crs, nimppt_full    !: first, last indoor index for each j-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nlcjt_crs, nlcjt_full  !: dimensions of every subdomain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nldjt_crs, nldjt_full     !: first, last indoor index for each i-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nlejt_crs, nlejt_full    !: first, last indoor index for each j-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   njmppt_crs, njmppt_full    !: first, last indoor index for each j-domain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::    jpiall_crs,  jpiall_full   !: dimensions of every subdomain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::   nis0all_crs, nis0all_full   !: first, last indoor index for each i-domain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::   nie0all_crs, nie0all_full   !: first, last indoor index for each j-domain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::    nimppt_crs,  nimppt_full   !: first, last indoor index for each j-domain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::    jpjall_crs,  jpjall_full   !: dimensions of every subdomain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::   njs0all_crs, njs0all_full   !: first, last indoor index for each i-domain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::   nje0all_crs, nje0all_full   !: first, last indoor index for each j-domain
+      INTEGER, DIMENSION(:), ALLOCATABLE ::    njmppt_crs,  njmppt_full   !: first, last indoor index for each j-domain
 
  
       ! Masks
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmask_crs, umask_crs, vmask_crs, fmask_crs
-      REAL(wp), DIMENSION(:,:)  , ALLOCATABLE :: tmask_i_crs, rnfmsk_crs, tpol_crs, fpol_crs
-      
-  !    REAL(wp), DIMENSION(:,:),   ALLOCATABLE :: tmask_i_crs, tpol, fpol      
-
+      REAL(wp), DIMENSION(:,:)  , ALLOCATABLE :: rnfmsk_crs
+      
       ! Scale factors
       REAL(wp), DIMENSION(:,:),   ALLOCATABLE :: e1t_crs, e2t_crs, e1e2t_crs ! horizontal scale factors grid type T
@@ -182,6 +176,5 @@
          &      umask_crs(jpi_crs,jpj_crs,jpk) , vmask_crs(jpi_crs,jpj_crs,jpk) , STAT=ierr(2))
 
-      ALLOCATE( tmask_i_crs(jpi_crs,jpj_crs)   , rnfmsk_crs(jpi_crs,jpj_crs), &
-      &         tpol_crs(jpiglo_crs,jpjglo_crs), fpol_crs(jpiglo_crs,jpjglo_crs), STAT=ierr(3) )
+      ALLOCATE( rnfmsk_crs(jpi_crs,jpj_crs), STAT=ierr(3) )
 
       ALLOCATE( gphit_crs(jpi_crs,jpj_crs) , glamt_crs(jpi_crs,jpj_crs) , & 
@@ -238,8 +231,8 @@
          &      hmlp_crs(jpi_crs,jpj_crs) , hmlpt_crs(jpi_crs,jpj_crs) , STAT=ierr(14) )
          
-      ALLOCATE( nimppt_crs (jpnij) , nlcit_crs (jpnij) , nldit_crs (jpnij) , nleit_crs (jpnij),   &
-         &      nimppt_full(jpnij) , nlcit_full(jpnij) , nldit_full(jpnij) , nleit_full(jpnij),   &
-                njmppt_crs (jpnij) , nlcjt_crs (jpnij) , nldjt_crs (jpnij) , nlejt_crs (jpnij),   &
-         &      njmppt_full(jpnij) , nlcjt_full(jpnij) , nldjt_full(jpnij) , nlejt_full(jpnij)  , STAT=ierr(15) )
+      ALLOCATE( nimppt_crs (jpnij) , jpiall_crs (jpnij) , nis0all_crs (jpnij) , nie0all_crs (jpnij),   &
+         &      nimppt_full(jpnij) , jpiall_full(jpnij) , nis0all_full(jpnij) , nie0all_full(jpnij),   &
+                njmppt_crs (jpnij) , jpjall_crs (jpnij) , njs0all_crs (jpnij) , nje0all_crs (jpnij),   &
+         &      njmppt_full(jpnij) , jpjall_full(jpnij) , njs0all_full(jpnij) , nje0all_full(jpnij)  , STAT=ierr(15) )
    
       crs_dom_alloc = MAXVAL(ierr)
@@ -258,5 +251,5 @@
       ierr(:) = 0
       
-      ALLOCATE( mjs_crs(nlej_crs) , mje_crs(nlej_crs), mis_crs(nlei_crs) , mie_crs(nlei_crs), STAT=ierr(1) )
+      ALLOCATE( mjs_crs(Nje0_crs) , mje_crs(Nje0_crs), mis_crs(Nie0_crs) , mie_crs(Nie0_crs), STAT=ierr(1) )
       crs_dom_alloc2 = MAXVAL(ierr)
 
@@ -282,21 +275,21 @@
       jpjglo = jpjglo_full
 
-      nlci   = nlci_full
-      nlcj   = nlcj_full
-      nldi   = nldi_full
-      nldj   = nldj_full
-      nlei   = nlei_full
-      nlej   = nlej_full
-      nimpp  = nimpp_full
-      njmpp  = njmpp_full
-      
-      nlcit(:)  = nlcit_full(:)
-      nldit(:)  = nldit_full(:)
-      nleit(:)  = nleit_full(:)
-      nimppt(:) = nimppt_full(:)
-      nlcjt(:)  = nlcjt_full(:)
-      nldjt(:)  = nldjt_full(:)
-      nlejt(:)  = nlejt_full(:)
-      njmppt(:) = njmppt_full(:)
+      jpi   = jpi_full
+      jpj   = jpj_full
+      Nis0  = Nis0_full
+      Njs0  = Njs0_full
+      Nie0  = Nie0_full
+      Nje0  = Nje0_full
+      nimpp = nimpp_full
+      njmpp = njmpp_full
+      
+      jpiall (:) = jpiall_full (:)
+      nis0all(:) = nis0all_full(:)
+      nie0all(:) = nie0all_full(:)
+      nimppt (:) = nimppt_full (:)
+      jpjall (:) = jpjall_full (:)
+      njs0all(:) = njs0all_full(:)
+      nje0all(:) = nje0all_full(:)
+      njmppt (:) = njmppt_full (:)
 
    END SUBROUTINE dom_grid_glo
@@ -322,21 +315,21 @@
 
 
-      nlci   = nlci_crs
-      nlcj   = nlcj_crs
-      nldi   = nldi_crs
-      nlei   = nlei_crs
-      nlej   = nlej_crs
-      nldj   = nldj_crs
-      nimpp  = nimpp_crs
-      njmpp  = njmpp_crs
-      
-      nlcit(:)  = nlcit_crs(:)
-      nldit(:)  = nldit_crs(:)
-      nleit(:)  = nleit_crs(:)
-      nimppt(:) = nimppt_crs(:)
-      nlcjt(:)  = nlcjt_crs(:)
-      nldjt(:)  = nldjt_crs(:)
-      nlejt(:)  = nlejt_crs(:)
-      njmppt(:) = njmppt_crs(:)
+      jpi   = jpi_crs
+      jpj   = jpj_crs
+      Nis0  = Nis0_crs
+      Nie0  = Nie0_crs
+      Nje0  = Nje0_crs
+      Njs0  = Njs0_crs
+      nimpp = nimpp_crs
+      njmpp = njmpp_crs
+      
+      jpiall (:) = jpiall_crs (:)
+      nis0all(:) = nis0all_crs(:)
+      nie0all(:) = nie0all_crs(:)
+      nimppt (:) = nimppt_crs (:)
+      jpjall (:) = jpjall_crs (:)
+      njs0all(:) = njs0all_crs(:)
+      nje0all(:) = nje0all_crs(:)
+      njmppt (:) = njmppt_crs (:)
       !
    END SUBROUTINE dom_grid_crs
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crsdom.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crsdom.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crsdom.F90	(revision 12807)
@@ -73,5 +73,5 @@
   
             
-      IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+      IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
          IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
             je_2 = mje_crs(2)   ;  ij = je_2
@@ -81,5 +81,5 @@
       ENDIF
       DO jk = 1, jpkm1
-         DO ji = 2, nlei_crs  
+         DO ji = 2, Nie0_crs  
             ijis = mis_crs(ji)  ;  ijie = mie_crs(ji)    
             !          
@@ -101,7 +101,7 @@
       !
       DO jk = 1, jpkm1
-         DO ji = 2, nlei_crs  
+         DO ji = 2, Nie0_crs  
             ijis = mis_crs(ji)     ;   ijie = mie_crs(ji)       
-            DO jj = 3, nlej_crs
+            DO jj = 3, Nje0_crs
                ijjs = mjs_crs(jj)  ;   ijje = mje_crs(jj)
                           
@@ -168,7 +168,7 @@
       SELECT CASE ( cd_type )
          CASE ( 'T' )
-            DO jj =  nldj_crs, nlej_crs
+            DO jj =  Njs0_crs, Nje0_crs
                ijjs = mjs_crs(jj) + mybinctr
-               DO ji = 2, nlei_crs
+               DO ji = 2, Nie0_crs
                   ijis = mis_crs(ji) + mxbinctr 
                   p_gphi_crs(ji,jj) = p_gphi(ijis,ijjs)
@@ -177,7 +177,7 @@
             ENDDO
          CASE ( 'U' )
-            DO jj =  nldj_crs, nlej_crs
+            DO jj =  Njs0_crs, Nje0_crs
                ijjs = mjs_crs(jj) + mybinctr                  
-               DO ji = 2, nlei_crs
+               DO ji = 2, Nie0_crs
                   ijis = mis_crs(ji)
                   p_gphi_crs(ji,jj) = p_gphi(ijis,ijjs)
@@ -186,7 +186,7 @@
             ENDDO
          CASE ( 'V' )
-            DO jj =  nldj_crs, nlej_crs
+            DO jj =  Njs0_crs, Nje0_crs
                ijjs = mjs_crs(jj)
-               DO ji = 2, nlei_crs
+               DO ji = 2, Nie0_crs
                   ijis = mis_crs(ji) + mxbinctr 
                   p_gphi_crs(ji,jj) = p_gphi(ijis,ijjs)
@@ -195,7 +195,7 @@
             ENDDO
          CASE ( 'F' )
-            DO jj =  nldj_crs, nlej_crs
+            DO jj =  Njs0_crs, Nje0_crs
                ijjs = mjs_crs(jj)
-               DO ji = 2, nlei_crs
+               DO ji = 2, Nie0_crs
                   ijis = mis_crs(ji)
                   p_gphi_crs(ji,jj) = p_gphi(ijis,ijjs)
@@ -212,5 +212,5 @@
       SELECT CASE ( cd_type )
          CASE ( 'T', 'V' )
-            DO ji = 2, nlei_crs
+            DO ji = 2, Nie0_crs
                ijis = mis_crs(ji) + mxbinctr 
                p_gphi_crs(ji,1) = p_gphi(ijis,1)
@@ -218,5 +218,5 @@
             ENDDO
          CASE ( 'U', 'F' )
-            DO ji = 2, nlei_crs
+            DO ji = 2, Nie0_crs
                ijis = mis_crs(ji) 
                p_gphi_crs(ji,1) = p_gphi(ijis,1)
@@ -261,7 +261,7 @@
 
       DO jk = 1, jpk    
-         DO ji = 2, nlei_crs
+         DO ji = 2, Nie0_crs
             ijie = mie_crs(ji)
-            DO jj = nldj_crs, nlej_crs
+            DO jj = Njs0_crs, Nje0_crs
                ijje = mje_crs(jj)   ;   ijrs =  mje_crs(jj) - mjs_crs(jj)
                ! Only for a factro 3 coarsening
@@ -374,5 +374,5 @@
       ENDIF
 
-      IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+      IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
          IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
             je_2 = mje_crs(2)
@@ -512,5 +512,5 @@
                   ENDIF
          
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -617,5 +617,5 @@
                CASE( 'T', 'W' )
          
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -674,5 +674,5 @@
                CASE( 'V' )
 
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         ijje = mje_crs(2)
@@ -711,5 +711,5 @@
                CASE( 'U' )
 
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -782,5 +782,5 @@
                CASE( 'T', 'W' )
          
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -842,5 +842,5 @@
                CASE( 'V' )
 
-                 IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                 IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         ijje = mje_crs(2)
@@ -883,5 +883,5 @@
                CASE( 'U' )
 
-                 IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                 IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -953,5 +953,5 @@
                CASE( 'T', 'W' )
          
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -1013,5 +1013,5 @@
                CASE( 'V' )
 
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         ijje = mje_crs(2)
@@ -1053,5 +1053,5 @@
                CASE( 'U' )
 
-                 IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                 IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -1158,5 +1158,5 @@
             zsurfmsk(:,:) =  p_e12(:,:) * p_e3(:,:,1) * p_mask(:,:,1)
 
-            IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+            IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                   je_2 = mje_crs(2)
@@ -1234,5 +1234,5 @@
                CASE( 'T', 'W' )
 
-                   IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                   IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                       IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                          je_2 = mje_crs(2)
@@ -1285,5 +1285,5 @@
                CASE( 'V' )
 
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         ijje = mje_crs(2)
@@ -1318,5 +1318,5 @@
                CASE( 'U' )
 
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -1369,5 +1369,5 @@
                CASE( 'T', 'W' )
   
-                   IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                   IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                       IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                          je_2 = mje_crs(2)
@@ -1420,5 +1420,5 @@
                CASE( 'V' )
 
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         ijje = mje_crs(2)
@@ -1453,5 +1453,5 @@
                CASE( 'U' )
 
-                 IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                 IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -1497,5 +1497,5 @@
               CASE( 'T', 'W' )
   
-                   IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                   IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                       IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                          je_2 = mje_crs(2)
@@ -1548,5 +1548,5 @@
                CASE( 'V' )
 
-                  IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                  IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         ijje = mje_crs(2)
@@ -1581,5 +1581,5 @@
                CASE( 'U' )
 
-                 IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+                 IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
                      IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
                         je_2 = mje_crs(2)
@@ -1665,5 +1665,5 @@
        ENDDO
 
-       IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+       IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
           IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
              je_2 = mje_crs(2)
@@ -1808,5 +1808,5 @@
       END SELECT
 
-      IF( nldj_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
+      IF( Njs0_crs == 1 .AND. ( ( mje_crs(2) - mjs_crs(2) ) < 2 ) ) THEN     !!cc bande du sud style ORCA2
          IF( mje_crs(2) - mjs_crs(2) == 1 ) THEN
             je_2 = mje_crs(2)
@@ -1899,57 +1899,53 @@
       ! 2.a Define processor domain
       IF( .NOT. lk_mpp ) THEN
-         nimpp_crs  = 1
-         njmpp_crs  = 1
-         nlci_crs   = jpi_crs
-         nlcj_crs   = jpj_crs
-         nldi_crs   = 1
-         nldj_crs   = 1
-         nlei_crs   = jpi_crs
-         nlej_crs   = jpj_crs
+         nimpp_crs = 1
+         njmpp_crs = 1
+         Nis0_crs  = 1
+         Njs0_crs  = 1
+         Nie0_crs  = jpi_crs
+         Nje0_crs  = jpj_crs
       ELSE
          ! Initialisation of most local variables -
-         nimpp_crs  = 1
-         njmpp_crs  = 1
-         nlci_crs   = jpi_crs
-         nlcj_crs   = jpj_crs
-         nldi_crs   = 1
-         nldj_crs   = 1
-         nlei_crs   = jpi_crs
-         nlej_crs   = jpj_crs
+         nimpp_crs = 1
+         njmpp_crs = 1
+         Nis0_crs  = 1
+         Njs0_crs  = 1
+         Nie0_crs  = jpi_crs
+         Nje0_crs  = jpj_crs
          
         ! Calculs suivant une découpage en j
         DO jn = 1, jpnij, jpni
            IF( jn < ( jpnij - jpni + 1 ) ) THEN
-              nlejt_crs(jn) = AINT( REAL( ( jpjglo - (njmppt(jn     ) - 1) ) / nn_facty, wp ) ) &
+              nje0all_crs(jn) = AINT( REAL( ( jpjglo - (njmppt(jn     ) - 1) ) / nn_facty, wp ) ) &
                        &    - AINT( REAL( ( jpjglo - (njmppt(jn+jpni) - 1) ) / nn_facty, wp ) )
            ELSE                                             
-              nlejt_crs(jn) = AINT( REAL(  nlejt(jn) / nn_facty, wp ) ) + 1            
+              nje0all_crs(jn) = AINT( REAL(  nje0all(jn) / nn_facty, wp ) ) + 1            
            ENDIF
-           IF( noso < 0 ) nlejt_crs(jn) = nlejt_crs(jn) + 1             
+           IF( noso < 0 ) nje0all_crs(jn) = nje0all_crs(jn) + 1             
            SELECT CASE( ibonjt(jn) )
               CASE ( -1 )
-                IF( MOD( jpjglo - njmppt(jn), nn_facty) > 0 )  nlejt_crs(jn) = nlejt_crs(jn) + 1
-                nlcjt_crs(jn) = nlejt_crs(jn) + nn_hls
-                nldjt_crs(jn) = nldjt(jn)
+                IF( MOD( jpjglo - njmppt(jn), nn_facty) > 0 )  nje0all_crs(jn) = nje0all_crs(jn) + 1
+                jpjall_crs (jn) = nje0all_crs(jn) + nn_hls
+                njs0all_crs(jn) = njs0all(jn)
               
               CASE ( 0 )
               
-                nldjt_crs(jn) = nldjt(jn)
-                IF( nldjt(jn) == 1 )  nlejt_crs(jn) = nlejt_crs(jn) + 1
-                nlejt_crs(jn) = nlejt_crs(jn) + nn_hls
-                nlcjt_crs(jn) = nlejt_crs(jn) + nn_hls
+                njs0all_crs(jn) = njs0all(jn)
+                IF( njs0all(jn) == 1 )  nje0all_crs(jn) = nje0all_crs(jn) + 1
+                nje0all_crs(jn) = nje0all_crs(jn) + nn_hls
+                jpjall_crs (jn) = nje0all_crs(jn) + nn_hls
                 
               CASE ( 1, 2 )
               
-                nlejt_crs(jn) = nlejt_crs(jn) + nn_hls
-                nlcjt_crs(jn) = nlejt_crs(jn)
-                nldjt_crs(jn) = nldjt(jn)
+                nje0all_crs(jn) = nje0all_crs(jn) + nn_hls
+                jpjall_crs (jn) = nje0all_crs(jn)
+                njs0all_crs(jn) = njs0all(jn)
                 
               CASE DEFAULT
                  CALL ctl_stop( 'STOP', 'error from crs_dom_def, you should not be there (1) ...' )
            END SELECT
-           IF( nlcjt_crs(jn) > jpj_crs )     jpj_crs = jpj_crs + 1
-
-           IF(nldjt_crs(jn) == 1 ) THEN
+           IF( jpjall_crs(jn) > jpj_crs )     jpj_crs = jpj_crs + 1
+
+           IF(njs0all_crs(jn) == 1 ) THEN
               njmppt_crs(jn) = 1
            ELSE
@@ -1958,40 +1954,40 @@
            
            DO jj = jn + 1, jn + jpni - 1
-              nlejt_crs(jj) = nlejt_crs(jn) 
-              nlcjt_crs(jj) = nlcjt_crs(jn)
-              nldjt_crs(jj) = nldjt_crs(jn)
-              njmppt_crs(jj)= njmppt_crs(jn)
+              nje0all_crs(jj) = nje0all_crs(jn) 
+              jpjall_crs (jj) = jpjall_crs(jn)
+              njs0all_crs(jj) = njs0all_crs(jn)
+              njmppt_crs (jj) = njmppt_crs(jn)
            ENDDO
         ENDDO 
-        nlej_crs  = nlejt_crs(nproc + 1) 
-        nlcj_crs  = nlcjt_crs(nproc + 1)
-        nldj_crs  = nldjt_crs(nproc + 1)
-        njmpp_crs = njmppt_crs(nproc + 1)
+        Nje0_crs  = nje0all_crs(nproc + 1) 
+        jpj_crs   = jpjall_crs (nproc + 1)
+        Njs0_crs  = njs0all_crs(nproc + 1)
+        njmpp_crs = njmppt_crs (nproc + 1)
 
         ! Calcul suivant un decoupage en i
         DO jn = 1, jpni
            IF( jn == 1 ) THEN          
-              nleit_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + nlcit(jn  ) )  / nn_factx, wp) )
+              nie0all_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + jpiall(jn  ) )  / nn_factx, wp) )
            ELSE
-              nleit_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + nlcit(jn  ) )  / nn_factx, wp) ) &
-                 &          - AINT( REAL( ( nimppt(jn-1) - 1 + nlcit(jn-1) )  / nn_factx, wp) )
+              nie0all_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + jpiall(jn  ) )  / nn_factx, wp) ) &
+                 &            - AINT( REAL( ( nimppt(jn-1) - 1 + jpiall(jn-1) )  / nn_factx, wp) )
            ENDIF
 
            SELECT CASE( ibonit(jn) )
               CASE ( -1 )
-                 nleit_crs(jn) = nleit_crs(jn) + nn_hls           
-                 nlcit_crs(jn) = nleit_crs(jn) + nn_hls
-                 nldit_crs(jn) = nldit(jn) 
+                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls           
+                 jpiall_crs (jn) = nie0all_crs(jn) + nn_hls
+                 nis0all_crs(jn) = nis0all(jn) 
               
               CASE ( 0 )
-                 nleit_crs(jn) = nleit_crs(jn) + nn_hls
-                 nlcit_crs(jn) = nleit_crs(jn) + nn_hls
-                 nldit_crs(jn) = nldit(jn) 
+                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls
+                 jpiall_crs (jn) = nie0all_crs(jn) + nn_hls
+                 nis0all_crs(jn) = nis0all(jn) 
                 
               CASE ( 1, 2 )
-                 IF( MOD( jpiglo - nimppt(jn), nn_factx) > 0 )  nleit_crs(jn) = nleit_crs(jn) + 1
-                 nleit_crs(jn) = nleit_crs(jn) + nn_hls
-                 nlcit_crs(jn) = nleit_crs(jn)
-                 nldit_crs(jn) = nldit(jn) 
+                 IF( MOD( jpiglo - nimppt(jn), nn_factx) > 0 )  nie0all_crs(jn) = nie0all_crs(jn) + 1
+                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls
+                 jpiall_crs (jn) = nie0all_crs(jn)
+                 nis0all_crs(jn) = nis0all(jn) 
 
               CASE DEFAULT
@@ -2001,15 +1997,15 @@
            nimppt_crs(jn) = ANINT( REAL( (nimppt(jn) + 1 ) / nn_factx, wp ) ) + 1
            DO jj = jn + jpni , jpnij, jpni
-              nleit_crs(jj) = nleit_crs(jn) 
-              nlcit_crs(jj) = nlcit_crs(jn)
-              nldit_crs(jj) = nldit_crs(jn)
-              nimppt_crs(jj)= nimppt_crs(jn)
+              nie0all_crs(jj) = nie0all_crs(jn) 
+              jpiall_crs (jj) = jpiall_crs (jn)
+              nis0all_crs(jj) = nis0all_crs(jn)
+              nimppt_crs (jj) = nimppt_crs (jn)
            ENDDO
          ENDDO 
         
-         nlei_crs  = nleit_crs(nproc + 1) 
-         nlci_crs  = nlcit_crs(nproc + 1)
-         nldi_crs  = nldit_crs(nproc + 1)
-         nimpp_crs = nimppt_crs(nproc + 1)
+         Nie0_crs  = nie0all_crs(nproc + 1) 
+         jpi_crs   = jpiall_crs (nproc + 1)
+         Nis0_crs  = nis0all_crs(nproc + 1)
+         nimpp_crs = nimppt_crs (nproc + 1)
 
          DO ji = 1, jpi_crs
@@ -2043,21 +2039,21 @@
       jpjglo_full = jpjglo
 
-      nlcj_full   = nlcj
-      nlci_full   = nlci
-      nldi_full   = nldi
-      nldj_full   = nldj
-      nlei_full   = nlei
-      nlej_full   = nlej
-      nimpp_full  = nimpp     
-      njmpp_full  = njmpp
+      jpj_full   = jpj
+      jpi_full   = jpi
+      Nis0_full  = Nis0
+      Njs0_full  = Njs0
+      Nie0_full  = Nie0
+      Nje0_full  = Nje0
+      nimpp_full = nimpp     
+      njmpp_full = njmpp
       
-      nlcit_full(:)  = nlcit(:)
-      nldit_full(:)  = nldit(:)
-      nleit_full(:)  = nleit(:)
-      nimppt_full(:) = nimppt(:)
-      nlcjt_full(:)  = nlcjt(:)
-      nldjt_full(:)  = nldjt(:)
-      nlejt_full(:)  = nlejt(:)
-      njmppt_full(:) = njmppt(:)
+      jpiall_full (:) = jpiall (:)
+      nis0all_full(:) = nis0all(:)
+      nie0all_full(:) = nie0all(:)
+      nimppt_full (:) = nimppt (:)
+      jpjall_full (:) = jpjall (:)
+      njs0all_full(:) = njs0all(:)
+      nje0all_full(:) = nje0all(:)
+      njmppt_full (:) = njmppt (:)
       
       CALL dom_grid_crs  !swich de grille
@@ -2073,12 +2069,12 @@
          WRITE(numout,*)
          WRITE(numout,*) ' nproc  = '     , nproc
-         WRITE(numout,*) ' nlci   = '     , nlci
-         WRITE(numout,*) ' nlcj   = '     , nlcj
-         WRITE(numout,*) ' nldi   = '     , nldi
-         WRITE(numout,*) ' nldj   = '     , nldj
-         WRITE(numout,*) ' nlei   = '     , nlei
-         WRITE(numout,*) ' nlej   = '     , nlej
-         WRITE(numout,*) ' nlei_full='    , nlei_full
-         WRITE(numout,*) ' nldi_full='    , nldi_full
+         WRITE(numout,*) ' jpi    = '     , jpi
+         WRITE(numout,*) ' jpj    = '     , jpj
+         WRITE(numout,*) ' Nis0   = '     , Nis0
+         WRITE(numout,*) ' Njs0   = '     , Njs0
+         WRITE(numout,*) ' Nie0   = '     , Nie0
+         WRITE(numout,*) ' Nje0   = '     , Nje0
+         WRITE(numout,*) ' Nie0_full='    , Nie0_full
+         WRITE(numout,*) ' Nis0_full='    , Nis0_full
          WRITE(numout,*) ' nimpp  = '     , nimpp
          WRITE(numout,*) ' njmpp  = '     , njmpp
@@ -2203,9 +2199,9 @@
         mje_crs(:) = mje2_crs(:) 
       ELSE
-        DO jj = 1, nlej_crs
+        DO jj = 1, Nje0_crs
            mjs_crs(jj) = mjs2_crs(mjg_crs(jj)) - njmpp + 1
            mje_crs(jj) = mje2_crs(mjg_crs(jj)) - njmpp + 1
         ENDDO
-        DO ji = 1, nlei_crs
+        DO ji = 1, Nie0_crs
            mis_crs(ji) = mis2_crs(mig_crs(ji)) - nimpp + 1
            mie_crs(ji) = mie2_crs(mig_crs(ji)) - nimpp + 1
@@ -2213,6 +2209,6 @@
       ENDIF
       !
-      nistr = mis_crs(2)  ;   niend = mis_crs(nlci_crs - 1)
-      njstr = mjs_crs(3)  ;   njend = mjs_crs(nlcj_crs - 1)
+      nistr = mis_crs(2)  ;   niend = mis_crs(jpi_crs - 1)
+      njstr = mjs_crs(3)  ;   njend = mjs_crs(jpj_crs - 1)
       !
    END SUBROUTINE crs_dom_def
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crsdomwri.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crsdomwri.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/CRS/crsdomwri.F90	(revision 12807)
@@ -50,5 +50,4 @@
       INTEGER           ::   ji, jj, jk   ! dummy loop indices
       INTEGER           ::   inum         ! local units for 'mesh_mask.nc' file
-      INTEGER           ::   iif, iil, ijf, ijl
       CHARACTER(len=21) ::   clnam        ! filename (mesh and mask informations)
       !                                   !  workspace
@@ -76,36 +75,7 @@
       CALL iom_rstput( 0, 0, inum, 'fmask', fmask_crs, ktype = jp_i1 )
       
-      
-      tmask_i_crs(:,:) = tmask_crs(:,:,1)
-      iif = nn_hls
-      iil = nlci_crs - nn_hls + 1
-      ijf = nn_hls
-      ijl = nlcj_crs - nn_hls + 1
-     
-      tmask_i_crs( 1:iif ,    :  ) = 0._wp
-      tmask_i_crs(iil:jpi_crs,    :  ) = 0._wp
-      tmask_i_crs(   :   , 1:ijf ) = 0._wp
-      tmask_i_crs(   :   ,ijl:jpj_crs) = 0._wp
-      
-      
-      tpol_crs(1:jpiglo_crs,:) = 1._wp
-      fpol_crs(1:jpiglo_crs,:) = 1._wp
-      IF( jperio == 3 .OR. jperio == 4 ) THEN
-         tpol_crs(jpiglo_crs/2+1:jpiglo_crs,:) = 0._wp
-         fpol_crs(       1      :jpiglo_crs,:) = 0._wp
-         IF( mjg_crs(nlej_crs) == jpiglo_crs ) THEN
-            DO ji = iif+1, iil-1
-               tmask_i_crs(ji,nlej_crs-1) = tmask_i_crs(ji,nlej_crs-1) &
-               & * tpol_crs(mig_crs(ji),1)
-            ENDDO
-         ENDIF
-      ENDIF
-      IF( jperio == 5 .OR. jperio == 6 ) THEN
-         tpol_crs(      1       :jpiglo_crs,:)=0._wp
-         fpol_crs(jpiglo_crs/2+1:jpiglo_crs,:)=0._wp
-      ENDIF
-      
-      CALL iom_rstput( 0, 0, inum, 'tmaskutil', tmask_i_crs, ktype = jp_i1 )
-                                   !    ! unique point mask
+      CALL dom_uniq_crs( zprw, 'T' )
+      zprt = tmask_crs(:,:,1) * zprw
+      CALL iom_rstput( 0, 0, inum, 'tmaskutil', zprt, ktype = jp_i1 )
       CALL dom_uniq_crs( zprw, 'U' )
       zprt = umask_crs(:,:,1) * zprw
@@ -211,6 +181,6 @@
       REAL(wp) ::  zshift   ! shift value link to the process number
       INTEGER  ::  ji       ! dummy loop indices
-      LOGICAL, DIMENSION(SIZE(puniq,1),SIZE(puniq,2),1) ::  lldbl  ! store whether each point is unique or not
-      REAL(wp), DIMENSION(jpi_crs,jpj_crs) :: ztstref
+      LOGICAL , DIMENSION(jpi_crs,jpj_crs,1) ::   lluniq  ! store whether each point is unique or not
+      REAL(wp), DIMENSION(jpi_crs,jpj_crs  ) ::   ztstref
       !!----------------------------------------------------------------------
       !
@@ -218,14 +188,12 @@
       ! in mpp: make sure that these values are different even between process
       ! -> apply a shift value according to the process number
-      zshift = jpi_crs * jpj_crs * ( narea - 1 )
+      zshift = (jpi_crs+1.) * (jpj_crs+1.) * ( narea - 1 )   ! we should use jpimax_crs but not existing
       ztstref(:,:) = RESHAPE( (/ (zshift + REAL(ji,wp), ji = 1, jpi_crs*jpj_crs) /), (/ jpi_crs, jpj_crs /) )
       !
-      puniq(:,:) = ztstref(:,:)                   ! default definition
-      CALL crs_lbc_lnk( puniq,cdgrd, 1. )            ! apply boundary conditions
-      lldbl(:,:,1) = puniq(:,:) == ztstref(:,:)   ! check which values have been changed 
-      !
-      puniq(:,:) = 1.                             ! default definition
-      ! fill only the inner part of the cpu with llbl converted into real 
-      puniq(nldi_crs:nlei_crs,nldj_crs:nlej_crs) = REAL( COUNT( lldbl(nldi_crs:nlei_crs,nldj_crs:nlej_crs,:), dim = 3 ) , wp )
+      puniq(:,:) = ztstref(:,:)                    ! default definition
+      CALL crs_lbc_lnk( puniq,cdgrd, 1. )          ! apply boundary conditions
+      lluniq(:,:,1) = puniq(:,:) == ztstref(:,:)   ! check which values have been changed 
+      !
+      puniq(:,:) = REAL( COUNT( lluniq(:,:,:), dim = 3 ), wp )
       !
    END SUBROUTINE dom_uniq_crs
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DIA/diadct.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DIA/diadct.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DIA/diadct.F90	(revision 12807)
@@ -409,7 +409,7 @@
               ijloc=ijglo-njmpp+1   !  "
 
-              !verify if the point is on the local domain:(1,nlei)*(1,nlej)
-              IF( iiloc >= 1 .AND. iiloc <= nlei .AND. &
-                  ijloc >= 1 .AND. ijloc <= nlej       )THEN
+              !verify if the point is on the local domain:(1,Nie0)*(1,Nje0)
+              IF( iiloc >= 1 .AND. iiloc <= Nie0 .AND. &
+                  ijloc >= 1 .AND. ijloc <= Nje0       )THEN
                  iptloc = iptloc + 1                                                 ! count local points
                  secs(jsec)%listPoint(iptloc) = POINT_SECTION(mi0(iiglo),mj0(ijglo)) ! store local coordinates
@@ -516,6 +516,6 @@
  
      !which coordinate shall we verify ?
-     IF      ( cdind=='I' )THEN   ; itest=nlei ; iind=1
-     ELSE IF ( cdind=='J' )THEN   ; itest=nlej ; iind=2
+     IF      ( cdind=='I' )THEN   ; itest=Nie0 ; iind=1
+     ELSE IF ( cdind=='J' )THEN   ; itest=Nje0 ; iind=2
      ELSE    ; CALL ctl_stop("removepoints :Wrong value for cdind") 
      ENDIF
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dom_oce.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dom_oce.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dom_oce.F90	(revision 12807)
@@ -75,5 +75,4 @@
    !                                 !  domain MPP decomposition parameters
    INTEGER             , PUBLIC ::   nimpp, njmpp     !: i- & j-indexes for mpp-subdomain left bottom
-   INTEGER             , PUBLIC ::   nreci, nrecj     !: overlap region in i and j
    INTEGER             , PUBLIC ::   nproc            !: number for local processor
    INTEGER             , PUBLIC ::   narea            !: number for local area
@@ -85,6 +84,4 @@
 
    INTEGER, PUBLIC ::   npolj             !: north fold mark (0, 3 or 4)
-   INTEGER, PUBLIC ::   nlci, nldi, nlei  !: i-dimensions of the local subdomain and its first and last indoor indices
-   INTEGER, PUBLIC ::   nlcj, nldj, nlej  !: i-dimensions of the local subdomain and its first and last indoor indices
    INTEGER, PUBLIC ::   noea, nowe        !: index of the local neighboring processors in
    INTEGER, PUBLIC ::   noso, nono        !: east, west, south and north directions
@@ -97,10 +94,10 @@
    INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   mj0, mj1   !: global ==> local  domain j-index (mj0=1 and mj1=0 if the global index
    !                                                                !                                             is not in the local domain)
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nimppt, njmppt   !: i-, j-indexes for each processor
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ibonit, ibonjt   !: i-, j- processor neighbour existence
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nlcit , nlcjt    !: dimensions of every subdomain
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nldit , nldjt    !: first, last indoor index for each i-domain
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nleit , nlejt    !: first, last indoor index for each j-domain
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nfiimpp, nfipproc, nfilcit
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::    nimppt,  njmppt   !: i-, j-indexes for each processor
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::    ibonit,  ibonjt   !: i-, j- processor neighbour existence
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::    jpiall,  jpjall   !: dimensions of all subdomain
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nis0all, njs0all   !: first, last indoor index for all i-subdomain
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nie0all, nje0all   !: first, last indoor index for all j-subdomain
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nfiimpp, nfipproc, nfijpit
 
    !!----------------------------------------------------------------------
@@ -185,6 +182,4 @@
    REAL(wp), PUBLIC, POINTER, SAVE, DIMENSION(:,:,:) :: tmask, umask, vmask, wmask  !: land/ocean mask at T-, U-, V-pts
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:), TARGET :: wumask, wvmask        !: land/ocean mask at WT-, WU- and WV-pts
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   tpol, fpol          !: north fold mask (jperio= 3 or 4)
 
    !!----------------------------------------------------------------------
@@ -250,6 +245,5 @@
       ALLOCATE( mig(jpi), mjg(jpj), STAT=ierr(1) )
          !
-      ALLOCATE( mi0(jpiglo)   , mi1 (jpiglo),  mj0(jpjglo)   , mj1 (jpjglo) ,     &
-         &      tpol(jpiglo)  , fpol(jpiglo)                                , STAT=ierr(2) )
+      ALLOCATE( mi0(jpiglo), mi1(jpiglo), mj0(jpjglo), mj1(jpjglo), STAT=ierr(2) )
          !
       ALLOCATE( glamt(jpi,jpj) ,    glamu(jpi,jpj) ,  glamv(jpi,jpj) ,  glamf(jpi,jpj) ,     &
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domhgr.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domhgr.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domhgr.F90	(revision 12807)
@@ -31,4 +31,5 @@
    USE iom            ! I/O library
    USE lib_mpp        ! MPP library
+   USE lbclnk         ! lateal boundary condition / mpp exchanges
    USE timing         ! Timing
 
@@ -199,13 +200,13 @@
       CALL iom_get( inum, jpdom_global, 'gphif', pphif, cd_type = 'F', psgn = 1._wp )
       !
-      CALL iom_get( inum, jpdom_global, 'e1t'  , pe1t , cd_type = 'T', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e1u'  , pe1u , cd_type = 'U', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e1v'  , pe1v , cd_type = 'V', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e1f'  , pe1f , cd_type = 'F', psgn = 1._wp )
-      !
-      CALL iom_get( inum, jpdom_global, 'e2t'  , pe2t , cd_type = 'T', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e2u'  , pe2u , cd_type = 'U', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e2v'  , pe2v , cd_type = 'V', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e2f'  , pe2f , cd_type = 'F', psgn = 1._wp )
+      CALL iom_get( inum, jpdom_global, 'e1t'  , pe1t , cd_type = 'T', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e1u'  , pe1u , cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e1v'  , pe1v , cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e1f'  , pe1f , cd_type = 'F', psgn = 1._wp, kfill = jpfillcopy )
+      !
+      CALL iom_get( inum, jpdom_global, 'e2t'  , pe2t , cd_type = 'T', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e2u'  , pe2u , cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e2v'  , pe2v , cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e2f'  , pe2f , cd_type = 'F', psgn = 1._wp, kfill = jpfillcopy )
       !
       IF(  iom_varid( inum, 'ff_f', ldstop = .FALSE. ) > 0  .AND.  &
@@ -221,6 +222,6 @@
       IF( iom_varid( inum, 'e1e2u', ldstop = .FALSE. ) > 0 ) THEN
          IF(lwp) WRITE(numout,*) '           e1e2u & e1e2v read in ', TRIM( cn_domcfg ), ' file'
-         CALL iom_get( inum, jpdom_global, 'e1e2u', pe1e2u, cd_type = 'U', psgn = 1._wp )
-         CALL iom_get( inum, jpdom_global, 'e1e2v', pe1e2v, cd_type = 'V', psgn = 1._wp )
+         CALL iom_get( inum, jpdom_global, 'e1e2u', pe1e2u, cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy )
+         CALL iom_get( inum, jpdom_global, 'e1e2v', pe1e2v, cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy )
          ke1e2u_v = 1
       ELSE
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dommsk.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dommsk.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/dommsk.F90	(revision 12807)
@@ -25,4 +25,5 @@
    USE oce            ! ocean dynamics and tracers
    USE dom_oce        ! ocean space and time domain
+   USE domutl         ! 
    USE usrdef_fmask   ! user defined fmask
    USE bdy_oce        ! open boundary
@@ -88,6 +89,4 @@
       !
       INTEGER  ::   ji, jj, jk     ! dummy loop indices
-      INTEGER  ::   iif, iil       ! local integers
-      INTEGER  ::   ijf, ijl       !   -       -
       INTEGER  ::   iktop, ikbot   !   -       -
       INTEGER  ::   ios, inum
@@ -131,15 +130,21 @@
       !
       tmask(:,:,:) = 0._wp
-      DO_2D_11_11
+      DO_2D_00_00
          iktop = k_top(ji,jj)
          ikbot = k_bot(ji,jj)
          IF( iktop /= 0 ) THEN       ! water in the column
-            tmask(ji,jj,iktop:ikbot  ) = 1._wp
+            tmask(ji,jj,iktop:ikbot) = 1._wp
          ENDIF
       END_2D
       !
-      ! the following call is mandatory
+      ! the following is mandatory
       ! it masks boundaries (bathy=0) where needed depending on the configuration (closed, periodic...)  
-      CALL lbc_lnk( 'dommsk', tmask  , 'T', 1._wp )      ! Lateral boundary conditions
+      IF( .NOT. (nbondj == 1 .OR. nbondj == 0 .OR. l_Jperio) ) THEN
+         tmask(mi0(  1 ):mi1(jpiglo),mj0(Njs0):mj1(Njs0  ),:) = 0._wp   ! line   number Njs0 at 0
+      ENDIF
+      IF( .NOT. (nbondi == 1 .OR. nbondi == 0 .OR. l_Iperio) ) THEN
+         tmask(mi0(Nis0):mi1(  Nis0),mj0(  1 ):mj1(jpjglo),:) = 0._wp   ! column number Nis0 at 0
+      ENDIF
+      CALL lbc_lnk( 'dommsk', tmask, 'T', 1._wp )      ! Lateral boundary conditions
 
      ! Mask corrections for bdy (read in mppini2)
@@ -186,5 +191,4 @@
       END DO
 
-
       ! Ocean/land column mask at t-, u-, and v-points   (i.e. at least 1 wet cell in the vertical)
       ! ----------------------------------------------
@@ -193,39 +197,11 @@
       ssvmask(:,:) = MAXVAL( vmask(:,:,:), DIM=3 )
 
-
       ! Interior domain mask  (used for global sum)
       ! --------------------
       !
-      iif = nn_hls   ;   iil = nlci - nn_hls + 1
-      ijf = nn_hls   ;   ijl = nlcj - nn_hls + 1
-      !
-      !                          ! halo mask : 0 on the halo and 1 elsewhere
-      tmask_h(:,:) = 1._wp                  
-      tmask_h( 1 :iif,   :   ) = 0._wp      ! first columns
-      tmask_h(iil:jpi,   :   ) = 0._wp      ! last  columns (including mpp extra columns)
-      tmask_h(   :   , 1 :ijf) = 0._wp      ! first rows
-      tmask_h(   :   ,ijl:jpj) = 0._wp      ! last  rows (including mpp extra rows)
-      !
-      !                          ! north fold mask
-      tpol(1:jpiglo) = 1._wp 
-      fpol(1:jpiglo) = 1._wp
-      IF( jperio == 3 .OR. jperio == 4 ) THEN      ! T-point pivot
-         tpol(jpiglo/2+1:jpiglo) = 0._wp
-         fpol(     1    :jpiglo) = 0._wp
-         IF( mjg(nlej) == jpjglo ) THEN                  ! only half of the nlcj-1 row for tmask_h
-            DO ji = iif+1, iil-1
-               tmask_h(ji,nlej-1) = tmask_h(ji,nlej-1) * tpol(mig(ji))
-            END DO
-         ENDIF
-      ENDIF
-      !
-      IF( jperio == 5 .OR. jperio == 6 ) THEN      ! F-point pivot
-         tpol(     1    :jpiglo) = 0._wp
-         fpol(jpiglo/2+1:jpiglo) = 0._wp
-      ENDIF
+      CALL dom_uniq( tmask_h, 'T' )
       !
       !                          ! interior mask : 2D ocean mask x halo mask 
       tmask_i(:,:) = ssmask(:,:) * tmask_h(:,:)
-
 
       ! Lateral boundary conditions on velocity (modify fmask)
@@ -261,8 +237,8 @@
 #if defined key_agrif 
             IF( .NOT. AGRIF_Root() ) THEN 
-               IF ((nbondi ==  1).OR.(nbondi == 2)) fmask(nlci-1 , :     ,jk) = 0.e0      ! east 
-               IF ((nbondi == -1).OR.(nbondi == 2)) fmask(1      , :     ,jk) = 0.e0      ! west 
-               IF ((nbondj ==  1).OR.(nbondj == 2)) fmask(:      ,nlcj-1 ,jk) = 0.e0      ! north 
-               IF ((nbondj == -1).OR.(nbondj == 2)) fmask(:      ,1      ,jk) = 0.e0      ! south 
+               IF ((nbondi ==  1).OR.(nbondi == 2)) fmask(jpi-1, :   ,jk) = 0.e0      ! east 
+               IF ((nbondi == -1).OR.(nbondi == 2)) fmask(1    , :   ,jk) = 0.e0      ! west 
+               IF ((nbondj ==  1).OR.(nbondj == 2)) fmask(:    ,jpj-1,jk) = 0.e0      ! north 
+               IF ((nbondj == -1).OR.(nbondj == 2)) fmask(:    ,1    ,jk) = 0.e0      ! south 
             ENDIF 
 #endif 
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domngb.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domngb.F90	(revision 12799)
+++ 	(revision )
@@ -1,80 +1,0 @@
-MODULE domngb
-   !!======================================================================
-   !!                       ***  MODULE  domngb  ***
-   !! Grid search:  find the closest grid point from a given on/lat position
-   !!======================================================================
-   !! History : 3.2  !  2009-11  (S. Masson)  Original code
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   dom_ngb       : find the closest grid point from a given lon/lat position
-   !!----------------------------------------------------------------------
-   USE dom_oce        ! ocean space and time domain
-   !
-   USE in_out_manager ! I/O manager
-   USE lib_mpp        ! for mppsum
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   dom_ngb   ! routine called in iom.F90 module
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
-   !! $Id$ 
-   !! Software governed by the CeCILL license (see ./LICENSE)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE dom_ngb( plon, plat, kii, kjj, cdgrid, kkk )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE dom_ngb  ***
-      !!
-      !! ** Purpose :   find the closest grid point from a given lon/lat position
-      !!
-      !! ** Method  :   look for minimum distance in cylindrical projection 
-      !!                -> not good if located at too high latitude...
-      !!----------------------------------------------------------------------
-      REAL(wp)        , INTENT(in   ) ::   plon, plat   ! longitude,latitude of the point
-      INTEGER         , INTENT(  out) ::   kii, kjj     ! i-,j-index of the closes grid point
-      INTEGER         , INTENT(in   ), OPTIONAL :: kkk  ! k-index of the mask level used
-      CHARACTER(len=1), INTENT(in   ) ::   cdgrid       ! grid name 'T', 'U', 'V', 'W'
-      !
-      INTEGER :: ik         ! working level
-      INTEGER , DIMENSION(2) ::   iloc
-      REAL(wp)               ::   zlon, zmini
-      REAL(wp), DIMENSION(jpi,jpj) ::   zglam, zgphi, zmask, zdist
-      !!--------------------------------------------------------------------
-      !
-      zmask(:,:) = 0._wp
-      ik = 1
-      IF ( PRESENT(kkk) ) ik=kkk
-      SELECT CASE( cdgrid )
-      CASE( 'U' )  ; zglam(:,:) = glamu(:,:) ; zgphi(:,:) = gphiu(:,:) ; zmask(nldi:nlei,nldj:nlej) = umask(nldi:nlei,nldj:nlej,ik)
-      CASE( 'V' )  ; zglam(:,:) = glamv(:,:) ; zgphi(:,:) = gphiv(:,:) ; zmask(nldi:nlei,nldj:nlej) = vmask(nldi:nlei,nldj:nlej,ik)
-      CASE( 'F' )  ; zglam(:,:) = glamf(:,:) ; zgphi(:,:) = gphif(:,:) ; zmask(nldi:nlei,nldj:nlej) = fmask(nldi:nlei,nldj:nlej,ik)
-      CASE DEFAULT ; zglam(:,:) = glamt(:,:) ; zgphi(:,:) = gphit(:,:) ; zmask(nldi:nlei,nldj:nlej) = tmask(nldi:nlei,nldj:nlej,ik)
-      END SELECT
-
-      zlon       = MOD( plon       + 720., 360. )                                     ! plon between    0 and 360
-      zglam(:,:) = MOD( zglam(:,:) + 720., 360. )                                     ! glam between    0 and 360
-      IF( zlon > 270. )   zlon = zlon - 360.                                          ! zlon between  -90 and 270
-      IF( zlon <  90. )   WHERE( zglam(:,:) > 180. ) zglam(:,:) = zglam(:,:) - 360.   ! glam between -180 and 180
-      zglam(:,:) = zglam(:,:) - zlon
-
-      zgphi(:,:) = zgphi(:,:) - plat
-      zdist(:,:) = zglam(:,:) * zglam(:,:) + zgphi(:,:) * zgphi(:,:)
-      
-      IF( lk_mpp ) THEN  
-         CALL mpp_minloc( 'domngb', zdist(:,:), zmask, zmini, iloc)
-         kii = iloc(1) ; kjj = iloc(2)
-      ELSE
-         iloc(:) = MINLOC( zdist(:,:), mask = zmask(:,:) == 1.e0 )
-         kii = iloc(1) + nimpp - 1
-         kjj = iloc(2) + njmpp - 1
-      ENDIF
-      !
-   END SUBROUTINE dom_ngb
-
-   !!======================================================================
-END MODULE domngb
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domutl.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domutl.F90	(revision 12807)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domutl.F90	(revision 12807)
@@ -0,0 +1,119 @@
+MODULE domutl
+   !!======================================================================
+   !!                       ***  MODULE  domutl  ***
+   !! Grid utilities:
+   !!======================================================================
+   !! History : 4.2  !  2020-04  (S. Masson)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   dom_ngb       : find the closest grid point from a given lon/lat position
+   !!   dom_uniq      : identify unique point of a grid (TUVF)
+   !!----------------------------------------------------------------------
+   !
+   USE dom_oce        ! ocean space and time domain
+   !
+   USE in_out_manager ! I/O manager
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE lib_mpp        ! for mppsum
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC dom_ngb    ! routine called in iom.F90 module
+   PUBLIC dom_uniq   ! Called by dommsk and domwri
+
+   !!----------------------------------------------------------------------
+   !! NEMO/OCE 4.2 , NEMO Consortium (2020)
+   !! $Id$ 
+   !! Software governed by the CeCILL license (see ./LICENSE)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE dom_ngb( plon, plat, kii, kjj, cdgrid, kkk )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE dom_ngb  ***
+      !!
+      !! ** Purpose :   find the closest grid point from a given lon/lat position
+      !!
+      !! ** Method  :   look for minimum distance in cylindrical projection 
+      !!                -> not good if located at too high latitude...
+      !!----------------------------------------------------------------------
+      REAL(wp)        , INTENT(in   ) ::   plon, plat   ! longitude,latitude of the point
+      INTEGER         , INTENT(  out) ::   kii, kjj     ! i-,j-index of the closes grid point
+      INTEGER         , INTENT(in   ), OPTIONAL :: kkk  ! k-index of the mask level used
+      CHARACTER(len=1), INTENT(in   ) ::   cdgrid       ! grid name 'T', 'U', 'V', 'W'
+      !
+      INTEGER :: ik         ! working level
+      INTEGER , DIMENSION(2) ::   iloc
+      REAL(wp)               ::   zlon, zmini
+      REAL(wp), DIMENSION(jpi,jpj) ::   zglam, zgphi, zmask, zdist
+      !!--------------------------------------------------------------------
+      !
+      ik = 1
+      IF ( PRESENT(kkk) ) ik=kkk
+      !
+      CALL dom_uniq(zmask,cdgrid)
+      !
+      SELECT CASE( cdgrid )
+      CASE( 'U' )    ;   zglam(:,:) = glamu(:,:)   ;   zgphi(:,:) = gphiu(:,:)   ;   zmask(:,:) = zmask(:,:) * umask(:,:,ik)
+      CASE( 'V' )    ;   zglam(:,:) = glamv(:,:)   ;   zgphi(:,:) = gphiv(:,:)   ;   zmask(:,:) = zmask(:,:) * vmask(:,:,ik)
+      CASE( 'F' )    ;   zglam(:,:) = glamf(:,:)   ;   zgphi(:,:) = gphif(:,:)   ;   zmask(:,:) = zmask(:,:) * fmask(:,:,ik)
+      CASE DEFAULT   ;   zglam(:,:) = glamt(:,:)   ;   zgphi(:,:) = gphit(:,:)   ;   zmask(:,:) = zmask(:,:) * tmask(:,:,ik)
+      END SELECT
+      !
+      zlon       = MOD( plon       + 720., 360. )                                     ! plon between    0 and 360
+      zglam(:,:) = MOD( zglam(:,:) + 720., 360. )                                     ! glam between    0 and 360
+      IF( zlon > 270. )   zlon = zlon - 360.                                          ! zlon between  -90 and 270
+      IF( zlon <  90. )   WHERE( zglam(:,:) > 180. ) zglam(:,:) = zglam(:,:) - 360.   ! glam between -180 and 180
+      zglam(:,:) = zglam(:,:) - zlon
+
+      zgphi(:,:) = zgphi(:,:) - plat
+      zdist(:,:) = zglam(:,:) * zglam(:,:) + zgphi(:,:) * zgphi(:,:)
+      
+      IF( lk_mpp ) THEN  
+         CALL mpp_minloc( 'domngb', zdist(:,:), zmask, zmini, iloc)
+         kii = iloc(1) ; kjj = iloc(2)
+      ELSE
+         iloc(:) = MINLOC( zdist(:,:), mask = zmask(:,:) == 1.e0 )
+         kii = iloc(1) + nimpp - 1
+         kjj = iloc(2) + njmpp - 1
+      ENDIF
+      !
+   END SUBROUTINE dom_ngb
+
+
+   SUBROUTINE dom_uniq( puniq, cdgrd )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE dom_uniq  ***
+      !!                   
+      !! ** Purpose :   identify unique point of a grid (TUVF)
+      !!
+      !! ** Method  :   1) aplly lbc_lnk on an array with different values for each element
+      !!                2) check which elements have been changed
+      !!----------------------------------------------------------------------
+      CHARACTER(len=1)        , INTENT(in   ) ::   cdgrd   ! 
+      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   puniq   ! 
+      !
+      REAL(wp)                       ::  zshift   ! shift value link to the process number
+      INTEGER                        ::  ji       ! dummy loop indices
+      LOGICAL , DIMENSION(jpi,jpj,1) ::   lluniq  ! store whether each point is unique or not
+      REAL(wp), DIMENSION(jpi,jpj  ) ::   ztstref
+      !!----------------------------------------------------------------------
+      !
+      ! build an array with different values for each element 
+      ! in mpp: make sure that these values are different even between process
+      ! -> apply a shift value according to the process number
+      zshift = jpimax * jpjmax * ( narea - 1 )
+      ztstref(:,:) = RESHAPE( (/ (zshift + REAL(ji,wp), ji = 1, jpi*jpj) /), (/ jpi, jpj /) )
+      !
+      puniq(:,:) = ztstref(:,:)                    ! default definition
+      CALL lbc_lnk( 'domwri', puniq, cdgrd, 1. )   ! apply boundary conditions
+      lluniq(:,:,1) = puniq(:,:) == ztstref(:,:)   ! check which values have not been changed 
+      !
+      puniq(:,:) = REAL( COUNT( lluniq(:,:,:), dim = 3 ), wp )
+      !
+   END SUBROUTINE dom_uniq
+   
+   !!======================================================================
+END MODULE domutl
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domwri.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domwri.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domwri.F90	(revision 12807)
@@ -13,9 +13,9 @@
    !!----------------------------------------------------------------------
    !!   dom_wri        : create and write mesh and mask file(s)
-   !!   dom_uniq       : identify unique point of a grid (TUVF)
    !!   dom_stiff      : diagnose maximum grid stiffness/hydrostatic consistency (s-coordinate)
    !!----------------------------------------------------------------------
    !
    USE dom_oce         ! ocean space and time domain
+   USE domutl          ! 
    USE phycst ,   ONLY :   rsmall
    USE wet_dry,   ONLY :   ll_wd  ! Wetting and drying
@@ -182,39 +182,4 @@
       !                                     ! ============================
    END SUBROUTINE dom_wri
-
-
-   SUBROUTINE dom_uniq( puniq, cdgrd )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dom_uniq  ***
-      !!                   
-      !! ** Purpose :   identify unique point of a grid (TUVF)
-      !!
-      !! ** Method  :   1) aplly lbc_lnk on an array with different values for each element
-      !!                2) check which elements have been changed
-      !!----------------------------------------------------------------------
-      CHARACTER(len=1)        , INTENT(in   ) ::   cdgrd   ! 
-      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   puniq   ! 
-      !
-      REAL(wp) ::  zshift   ! shift value link to the process number
-      INTEGER  ::  ji       ! dummy loop indices
-      LOGICAL, DIMENSION(SIZE(puniq,1),SIZE(puniq,2),1) ::  lldbl  ! store whether each point is unique or not
-      REAL(wp), DIMENSION(jpi,jpj) ::   ztstref
-      !!----------------------------------------------------------------------
-      !
-      ! build an array with different values for each element 
-      ! in mpp: make sure that these values are different even between process
-      ! -> apply a shift value according to the process number
-      zshift = jpi * jpj * ( narea - 1 )
-      ztstref(:,:) = RESHAPE( (/ (zshift + REAL(ji,wp), ji = 1, jpi*jpj) /), (/ jpi, jpj /) )
-      !
-      puniq(:,:) = ztstref(:,:)                   ! default definition
-      CALL lbc_lnk( 'domwri', puniq, cdgrd, 1. )            ! apply boundary conditions
-      lldbl(:,:,1) = puniq(:,:) == ztstref(:,:)   ! check which values have been changed 
-      !
-      puniq(:,:) = 1.                             ! default definition
-      ! fill only the inner part of the cpu with llbl converted into real 
-      puniq(nldi:nlei,nldj:nlej) = REAL( COUNT( lldbl(nldi:nlei,nldj:nlej,:), dim = 3 ) , wp )
-      !
-   END SUBROUTINE dom_uniq
 
 
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domzgr.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domzgr.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DOM/domzgr.F90	(revision 12807)
@@ -236,11 +236,11 @@
       CALL iom_get( inum, jpdom_unknown, 'e3w_1d'  , pe3w_1d  )
       !
-      CALL iom_get( inum, jpdom_global, 'e3t_0'  , pe3t , cd_type = 'T', psgn = 1._wp )    ! 3D coordinate
-      CALL iom_get( inum, jpdom_global, 'e3u_0'  , pe3u , cd_type = 'U', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e3v_0'  , pe3v , cd_type = 'V', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e3f_0'  , pe3f , cd_type = 'F', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e3w_0'  , pe3w , cd_type = 'W', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e3uw_0' , pe3uw, cd_type = 'U', psgn = 1._wp )
-      CALL iom_get( inum, jpdom_global, 'e3vw_0' , pe3vw, cd_type = 'V', psgn = 1._wp )
+      CALL iom_get( inum, jpdom_global, 'e3t_0'  , pe3t , cd_type = 'T', psgn = 1._wp, kfill = jpfillcopy )    ! 3D coordinate
+      CALL iom_get( inum, jpdom_global, 'e3u_0'  , pe3u , cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e3v_0'  , pe3v , cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e3f_0'  , pe3f , cd_type = 'F', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e3w_0'  , pe3w , cd_type = 'W', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e3uw_0' , pe3uw, cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy )
+      CALL iom_get( inum, jpdom_global, 'e3vw_0' , pe3vw, cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy )
       !
       !                          !* depths
@@ -254,6 +254,6 @@
          CALL iom_get( inum, jpdom_unknown, 'gdept_1d', pdept_1d )   
          CALL iom_get( inum, jpdom_unknown, 'gdepw_1d', pdepw_1d )
-         CALL iom_get( inum, jpdom_global , 'gdept_0' , pdept  )
-         CALL iom_get( inum, jpdom_global , 'gdepw_0' , pdepw  )
+         CALL iom_get( inum, jpdom_global , 'gdept_0' , pdept, kfill = jpfillcopy )
+         CALL iom_get( inum, jpdom_global , 'gdepw_0' , pdepw, kfill = jpfillcopy )
          !
       ELSE                                !- depths computed from e3. scale factors
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/divhor.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/divhor.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/divhor.F90	(revision 12807)
@@ -86,8 +86,8 @@
 #if defined key_agrif
       IF( .NOT. Agrif_Root() ) THEN
-         IF( nbondi == -1 .OR. nbondi == 2 )   hdiv(   2   ,  :   ,:) = 0._wp      ! west
-         IF( nbondi ==  1 .OR. nbondi == 2 )   hdiv( nlci-1,  :   ,:) = 0._wp      ! east
-         IF( nbondj == -1 .OR. nbondj == 2 )   hdiv(   :   ,  2   ,:) = 0._wp      ! south
-         IF( nbondj ==  1 .OR. nbondj == 2 )   hdiv(   :   ,nlcj-1,:) = 0._wp      ! north
+         IF( nbondi == -1 .OR. nbondi == 2 )   hdiv(  2  ,  :  ,:) = 0._wp      ! west
+         IF( nbondi ==  1 .OR. nbondi == 2 )   hdiv(jpi-1,  :  ,:) = 0._wp      ! east
+         IF( nbondj == -1 .OR. nbondj == 2 )   hdiv(  :  ,  2  ,:) = 0._wp      ! south
+         IF( nbondj ==  1 .OR. nbondj == 2 )   hdiv(  :  ,jpj-1,:) = 0._wp      ! north
       ENDIF
 #endif
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/dynldf_lap_blp.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/dynldf_lap_blp.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/dynldf_lap_blp.F90	(revision 12807)
@@ -74,12 +74,9 @@
          DO_2D_01_01
             !                                      ! ahm * e3 * curl  (computed from 1 to jpim1/jpjm1)
-!!gm open question here : e3f  at before or now ?    probably now...
-!!gm note that ahmf has already been multiplied by fmask
-            zcur(ji-1,jj-1) = ahmf(ji-1,jj-1,jk) * e3f(ji-1,jj-1,jk) * r1_e1e2f(ji-1,jj-1)       &
+            zcur(ji-1,jj-1) = ahmf(ji-1,jj-1,jk) * e3f(ji-1,jj-1,jk) * r1_e1e2f(ji-1,jj-1)       &   ! ahmf already * by fmask
                &     * (  e2v(ji  ,jj-1) * pv(ji  ,jj-1,jk) - e2v(ji-1,jj-1) * pv(ji-1,jj-1,jk)  &
                &        - e1u(ji-1,jj  ) * pu(ji-1,jj  ,jk) + e1u(ji-1,jj-1) * pu(ji-1,jj-1,jk)  )
             !                                      ! ahm * div        (computed from 2 to jpi/jpj)
-!!gm note that ahmt has already been multiplied by tmask
-            zdiv(ji,jj)     = ahmt(ji,jj,jk) * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kbb)                                         &
+            zdiv(ji,jj)     = ahmt(ji,jj,jk) * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kbb)               &   ! ahmt already * by tmask
                &     * (  e2u(ji,jj)*e3u(ji,jj,jk,Kbb) * pu(ji,jj,jk) - e2u(ji-1,jj)*e3u(ji-1,jj,jk,Kbb) * pu(ji-1,jj,jk)  &
                &        + e1v(ji,jj)*e3v(ji,jj,jk,Kbb) * pv(ji,jj,jk) - e1v(ji,jj-1)*e3v(ji,jj-1,jk,Kbb) * pv(ji,jj-1,jk)  )
@@ -87,11 +84,11 @@
          !
          DO_2D_00_00
-            pu_rhs(ji,jj,jk) = pu_rhs(ji,jj,jk) + zsign * (                                                 &
+            pu_rhs(ji,jj,jk) = pu_rhs(ji,jj,jk) + zsign * umask(ji,jj,jk) * (    &    ! * by umask is mandatory for dyn_ldf_blp use
                &              - ( zcur(ji  ,jj) - zcur(ji,jj-1) ) * r1_e2u(ji,jj) / e3u(ji,jj,jk,Kmm)   &
-               &              + ( zdiv(ji+1,jj) - zdiv(ji,jj  ) ) * r1_e1u(ji,jj)                     )
+               &              + ( zdiv(ji+1,jj) - zdiv(ji,jj  ) ) * r1_e1u(ji,jj)                      )
                !
-            pv_rhs(ji,jj,jk) = pv_rhs(ji,jj,jk) + zsign * (                                                 &
+            pv_rhs(ji,jj,jk) = pv_rhs(ji,jj,jk) + zsign * vmask(ji,jj,jk) * (    &    ! * by vmask is mandatory for dyn_ldf_blp use
                &                ( zcur(ji,jj  ) - zcur(ji-1,jj) ) * r1_e1v(ji,jj) / e3v(ji,jj,jk,Kmm)   &
-               &              + ( zdiv(ji,jj+1) - zdiv(ji  ,jj) ) * r1_e2v(ji,jj)                     )
+               &              + ( zdiv(ji,jj+1) - zdiv(ji  ,jj) ) * r1_e2v(ji,jj)                      )
          END_2D
          !                                             ! ===============
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/sshwzv.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/sshwzv.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/DYN/sshwzv.F90	(revision 12807)
@@ -202,8 +202,8 @@
 #if defined key_agrif 
       IF( .NOT. AGRIF_Root() ) THEN 
-         IF ((nbondi ==  1).OR.(nbondi == 2)) pww(nlci-1 , :     ,:) = 0.e0      ! east 
-         IF ((nbondi == -1).OR.(nbondi == 2)) pww(2      , :     ,:) = 0.e0      ! west 
-         IF ((nbondj ==  1).OR.(nbondj == 2)) pww(:      ,nlcj-1 ,:) = 0.e0      ! north 
-         IF ((nbondj == -1).OR.(nbondj == 2)) pww(:      ,2      ,:) = 0.e0      ! south 
+         IF ((nbondi ==  1).OR.(nbondi == 2)) pww(jpi-1, :   ,:) = 0.e0      ! east 
+         IF ((nbondi == -1).OR.(nbondi == 2)) pww( 2   , :   ,:) = 0.e0      ! west 
+         IF ((nbondj ==  1).OR.(nbondj == 2)) pww( :   ,jpj-1,:) = 0.e0      ! north 
+         IF ((nbondj == -1).OR.(nbondj == 2)) pww( :   , 2   ,:) = 0.e0      ! south 
       ENDIF 
 #endif 
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/floblk.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/floblk.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/floblk.F90	(revision 12807)
@@ -100,6 +100,6 @@
 222   DO jfl = 1, jpnfl
 # if   defined key_mpp_mpi
-         IF( iil(jfl) >= mig(nldi) .AND. iil(jfl) <= mig(nlei) .AND.   &
-             ijl(jfl) >= mjg(nldj) .AND. ijl(jfl) <= mjg(nlej)   ) THEN
+         IF( iil(jfl) >= mig(Nis0) .AND. iil(jfl) <= mig(Nie0) .AND.   &
+             ijl(jfl) >= mjg(Njs0) .AND. ijl(jfl) <= mjg(Nje0)   ) THEN
             iiloc(jfl) = iil(jfl) - mig(1) + 1
             ijloc(jfl) = ijl(jfl) - mjg(1) + 1
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/flodom.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/flodom.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/flodom.F90	(revision 12807)
@@ -155,6 +155,6 @@
          ikmfl(jfl) = 0
 # if   defined key_mpp_mpi
-         DO ji = MAX(nldi,2), nlei
-            DO jj = MAX(nldj,2), nlej   ! NO vector opt.
+         DO ji = MAX(Nis0,2), Nie0
+            DO jj = MAX(Njs0,2), Nje0   ! NO vector opt.
 # else         
          DO ji = 2, jpi
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/florst.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/florst.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/florst.F90	(revision 12807)
@@ -98,8 +98,8 @@
          IF( lk_mpp ) THEN
             DO jfl = 1, jpnfl
-               IF( (INT(tpifl(jfl)) >= mig(nldi)) .AND.   &
-                  &(INT(tpifl(jfl)) <= mig(nlei)) .AND.   &
-                  &(INT(tpjfl(jfl)) >= mjg(nldj)) .AND.   &
-                  &(INT(tpjfl(jfl)) <= mjg(nlej)) ) THEN
+               IF( (INT(tpifl(jfl)) >= mig(Nis0)) .AND.   &
+                  &(INT(tpifl(jfl)) <= mig(Nie0)) .AND.   &
+                  &(INT(tpjfl(jfl)) >= mjg(Njs0)) .AND.   &
+                  &(INT(tpjfl(jfl)) <= mjg(Nje0)) ) THEN
                   iperproc(narea) = iperproc(narea)+1
                ENDIF
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/flowri.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/flowri.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/FLO/flowri.F90	(revision 12807)
@@ -105,6 +105,6 @@
             ibfloc = mj1( ibfl )
  
-            IF( nldi <= iafloc .AND. iafloc <= nlei .AND. &
-              & nldj <= ibfloc .AND. ibfloc <= nlej       ) THEN 
+            IF( Nis0 <= iafloc .AND. iafloc <= Nie0 .AND. &
+              & Njs0 <= ibfloc .AND. ibfloc <= Nje0       ) THEN 
 
                !the float is inside of current proc's area
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ICB/icbini.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ICB/icbini.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ICB/icbini.F90	(revision 12807)
@@ -133,5 +133,5 @@
       ! first entry with narea for this processor is left hand interior index
       ! last  entry                               is right hand interior index
-      jj = nlcj/2
+      jj = jpj/2
       nicbdi = -1
       nicbei = -1
@@ -149,5 +149,5 @@
       !
       ! repeat for j direction
-      ji = nlci/2
+      ji = jpi/2
       nicbdj = -1
       nicbej = -1
@@ -166,9 +166,9 @@
       ! special for east-west boundary exchange we save the destination index
       i1 = MAX( nicbdi-1, 1)
-      i3 = INT( src_calving(i1,nlcj/2) )
+      i3 = INT( src_calving(i1,jpj/2) )
       jj = INT( i3/nicbpack )
       ricb_left = REAL( i3 - nicbpack*jj, wp )
       i1 = MIN( nicbei+1, jpi )
-      i3 = INT( src_calving(i1,nlcj/2) )
+      i3 = INT( src_calving(i1,jpj/2) )
       jj = INT( i3/nicbpack )
       ricb_right = REAL( i3 - nicbpack*jj, wp )
@@ -203,11 +203,11 @@
          WRITE(numicb,*) 'processor ', narea
          WRITE(numicb,*) 'jpi, jpj   ', jpi, jpj
-         WRITE(numicb,*) 'nldi, nlei ', nldi, nlei
-         WRITE(numicb,*) 'nldj, nlej ', nldj, nlej
+         WRITE(numicb,*) 'Nis0, Nie0 ', Nis0, Nie0
+         WRITE(numicb,*) 'Njs0, Nje0 ', Njs0, Nje0
          WRITE(numicb,*) 'berg i interior ', nicbdi, nicbei
          WRITE(numicb,*) 'berg j interior ', nicbdj, nicbej
          WRITE(numicb,*) 'berg left       ', ricb_left
          WRITE(numicb,*) 'berg right      ', ricb_right
-         jj = nlcj/2
+         jj = jpj/2
          WRITE(numicb,*) "central j line:"
          WRITE(numicb,*) "i processor"
@@ -215,5 +215,5 @@
          WRITE(numicb,*) "i point"
          WRITE(numicb,*) (INT(src_calving(ji,jj)), ji=1,jpi)
-         ji = nlci/2
+         ji = jpi/2
          WRITE(numicb,*) "central i line:"
          WRITE(numicb,*) "j processor"
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ICB/icbrst.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ICB/icbrst.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ICB/icbrst.F90	(revision 12807)
@@ -91,6 +91,6 @@
             ij = INT( localpt%yj + 0.5 )
             ! Only proceed if this iceberg is on the local processor (excluding halos).
-            IF ( ii >= mig(nldi) .AND. ii <= mig(nlei) .AND.   &
-           &     ij >= mjg(nldj) .AND. ij <= mjg(nlej) ) THEN           
+            IF ( ii >= mig(Nis0) .AND. ii <= mig(Nie0) .AND.   &
+           &     ij >= mjg(Njs0) .AND. ij <= mjg(Nje0) ) THEN           
 
                CALL iom_get( ncid, jpdom_unknown, 'number', zdata(:) , ktime=jn, kstart=(/1/), kcount=(/nkounts/) )
@@ -226,8 +226,8 @@
    
          ! Dimensions
-         nret = NF90_DEF_DIM(ncid, 'x', nlei-nldi+1, ix_dim)
+         nret = NF90_DEF_DIM(ncid, 'x', Ni_0, ix_dim)
          IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_def_dim x failed')
    
-         nret = NF90_DEF_DIM(ncid, 'y', nlej-nldj+1, iy_dim)
+         nret = NF90_DEF_DIM(ncid, 'y', Nj_0, iy_dim)
          IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_def_dim y failed')
    
@@ -243,11 +243,11 @@
             nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_number_total'   , jpnij              )
             nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_number'         , narea-1            )
-            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_dimensions_ids' , (/ 1              , 2               /) )
-            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_size_global'    , (/ jpiglo         , jpjglo          /) )
-            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_size_local'     , (/ nlei - nldi + 1, nlej - nldj + 1 /) )
-            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_position_first' , (/ mig(nldi)      , mjg(nldj)       /) )
-            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_position_last'  , (/ mig(nlei)      , mjg(nlej)       /) )
-            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_halo_size_start', (/ 0              , 0               /) )
-            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_halo_size_end'  , (/ 0              , 0               /) )
+            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_dimensions_ids' , (/ 1        , 2         /) )
+            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_size_global'    , (/ jpiglo   , jpjglo    /) )
+            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_size_local'     , (/ Ni_0     , Nj_0      /) )
+            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_position_first' , (/ mig(Nis0), mjg(Njs0) /) )
+            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_position_last'  , (/ mig(Nie0), mjg(Nje0) /) )
+            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_halo_size_start', (/ 0        , 0         /) )
+            nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_halo_size_end'  , (/ 0        , 0         /) )
             nret = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'DOMAIN_type'           , 'BOX'              )
          ENDIF
@@ -341,11 +341,11 @@
          nstrt3(1) = 1
          nstrt3(2) = 1
-         nlngth3(1) = nlei - nldi + 1
-         nlngth3(2) = nlej - nldj + 1
+         nlngth3(1) = Ni_0
+         nlngth3(2) = Nj_0
          nlngth3(3) = 1
    
          DO jn=1,nclasses
             nstrt3(3) = jn
-            nret = NF90_PUT_VAR( ncid, nsiceid, berg_grid%stored_ice(nldi:nlei,nldj:nlej,jn), nstrt3, nlngth3 )
+            nret = NF90_PUT_VAR( ncid, nsiceid, berg_grid%stored_ice(Nis0:Nie0,Njs0:Nje0,jn), nstrt3, nlngth3 )
             IF (nret .ne. NF90_NOERR) THEN
                IF( lwp ) WRITE(numout,*) TRIM(NF90_STRERROR( nret ))
@@ -358,11 +358,11 @@
          IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var kount failed')
    
-         nret = NF90_PUT_VAR( ncid, nsheatid, berg_grid%stored_heat(nldi:nlei,nldj:nlej) )
+         nret = NF90_PUT_VAR( ncid, nsheatid, berg_grid%stored_heat(Nis0:Nie0,Njs0:Nje0) )
          IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var stored_heat failed')
          IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: stored_heat written'
    
-         nret = NF90_PUT_VAR( ncid, ncalvid , src_calving(nldi:nlei,nldj:nlej) )
+         nret = NF90_PUT_VAR( ncid, ncalvid , src_calving(Nis0:Nie0,Njs0:Nje0) )
          IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var calving failed')
-         nret = NF90_PUT_VAR( ncid, ncalvhid, src_calving_hflx(nldi:nlei,nldj:nlej) )
+         nret = NF90_PUT_VAR( ncid, ncalvhid, src_calving_hflx(Nis0:Nie0,Njs0:Nje0) )
          IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var calving_hflx failed')
          IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: calving written'
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom.F90	(revision 12807)
@@ -21,4 +21,5 @@
    !!----------------------------------------------------------------------
    USE dom_oce         ! ocean space and time domain
+   USE domutl          ! 
    USE c1d             ! 1D vertical configuration
    USE flo_oce         ! floats module declarations
@@ -34,5 +35,4 @@
    USE ice      , ONLY :   jpl
 #endif
-   USE domngb          ! ocean space and time domain
    USE phycst          ! physical constants
    USE dianam          ! build name of file
@@ -117,6 +117,6 @@
       REAL(wp), DIMENSION(2,jpkam1)         :: za_bnds   ! ABL vertical boundaries
       LOGICAL ::   ll_tmppatch = .TRUE.    !: seb: patch before we remove periodicity
-      INTEGER ::   nldi_save, nlei_save    !:      and close boundaries in output files
-      INTEGER ::   nldj_save, nlej_save    !:
+      INTEGER ::   Nis0_save, Nie0_save    !:      and close boundaries in output files
+      INTEGER ::   Njs0_save, Nje0_save    !:
       LOGICAL ::   ll_closedef = .TRUE.
       !!----------------------------------------------------------------------
@@ -127,10 +127,10 @@
       ENDIF
       IF ( ll_tmppatch ) THEN
-         nldi_save = nldi   ;   nlei_save = nlei
-         nldj_save = nldj   ;   nlej_save = nlej
-         IF( nimpp           ==      1 ) nldi = 1
-         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
-         IF( njmpp           ==      1 ) nldj = 1
-         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+         Nis0_save = Nis0   ;   Nie0_save = Nie0
+         Njs0_save = Njs0   ;   Nje0_save = Nje0
+         IF( nimpp           ==      1 ) Nis0 = 1
+         IF( nimpp + jpi - 1 == jpiglo ) Nie0 = jpi
+         IF( njmpp           ==      1 ) Njs0 = 1
+         IF( njmpp + jpj - 1 == jpjglo ) Nje0 = jpj
       ENDIF
       IF ( PRESENT(ld_closedef) ) ll_closedef = ld_closedef
@@ -169,8 +169,8 @@
          !
          IF( ln_cfmeta ) THEN   ! Add additional grid metadata
-            CALL iom_set_domain_attr("grid_T", area = e1e2t(nldi:nlei, nldj:nlej))
-            CALL iom_set_domain_attr("grid_U", area = e1e2u(nldi:nlei, nldj:nlej))
-            CALL iom_set_domain_attr("grid_V", area = e1e2v(nldi:nlei, nldj:nlej))
-            CALL iom_set_domain_attr("grid_W", area = e1e2t(nldi:nlei, nldj:nlej))
+            CALL iom_set_domain_attr("grid_T", area = e1e2t(Nis0:Nie0, Njs0:Nje0))
+            CALL iom_set_domain_attr("grid_U", area = e1e2u(Nis0:Nie0, Njs0:Nje0))
+            CALL iom_set_domain_attr("grid_V", area = e1e2v(Nis0:Nie0, Njs0:Nje0))
+            CALL iom_set_domain_attr("grid_W", area = e1e2t(Nis0:Nie0, Njs0:Nje0))
             CALL set_grid_bounds( "T", glamf, gphif, glamt, gphit )
             CALL set_grid_bounds( "U", glamv, gphiv, glamu, gphiu )
@@ -192,8 +192,8 @@
          !
          IF( ln_cfmeta .AND. .NOT. llrst_context) THEN   ! Add additional grid metadata
-            CALL iom_set_domain_attr("grid_T", area = e1e2t_crs(nldi:nlei, nldj:nlej))
-            CALL iom_set_domain_attr("grid_U", area = e1u_crs(nldi:nlei, nldj:nlej) * e2u_crs(nldi:nlei, nldj:nlej))
-            CALL iom_set_domain_attr("grid_V", area = e1v_crs(nldi:nlei, nldj:nlej) * e2v_crs(nldi:nlei, nldj:nlej))
-            CALL iom_set_domain_attr("grid_W", area = e1e2t_crs(nldi:nlei, nldj:nlej))
+            CALL iom_set_domain_attr("grid_T", area = e1e2t_crs(Nis0:Nie0, Njs0:Nje0))
+            CALL iom_set_domain_attr("grid_U", area =   e1u_crs(Nis0:Nie0, Njs0:Nje0) * e2u_crs(Nis0:Nie0, Njs0:Nje0))
+            CALL iom_set_domain_attr("grid_V", area =   e1v_crs(Nis0:Nie0, Njs0:Nje0) * e2v_crs(Nis0:Nie0, Njs0:Nje0))
+            CALL iom_set_domain_attr("grid_W", area = e1e2t_crs(Nis0:Nie0, Njs0:Nje0))
             CALL set_grid_bounds( "T", glamf_crs, gphif_crs, glamt_crs, gphit_crs )
             CALL set_grid_bounds( "U", glamv_crs, gphiv_crs, glamu_crs, gphiu_crs )
@@ -283,6 +283,6 @@
       !
       IF ( ll_tmppatch ) THEN
-         nldi = nldi_save   ;   nlei = nlei_save
-         nldj = nldj_save   ;   nlej = nlej_save
+         Nis0 = Nis0_save   ;   Nie0 = Nie0_save
+         Njs0 = Njs0_save   ;   Nje0 = Nje0_save
       ENDIF
 #endif
@@ -762,9 +762,9 @@
       ENDIF
       IF( llwrt ) THEN
-         idompar(:,1) = (/ nlei - nldi + 1, nlej - nldj + 1 /)
-         idompar(:,2) = (/ mig(nldi)      , mjg(nldj)       /)
-         idompar(:,3) = (/ mig(nlei)      , mjg(nlej)       /)
-         idompar(:,4) = (/ 0              , 0               /)
-         idompar(:,5) = (/ 0              , 0               /)
+         idompar(:,1) = (/ Ni_0     , Nj_0      /)
+         idompar(:,2) = (/ mig(Nis0), mjg(Njs0) /)
+         idompar(:,3) = (/ mig(Nie0), mjg(Nje0) /)
+         idompar(:,4) = (/ 0        , 0         /)
+         idompar(:,5) = (/ 0        , 0         /)
       ENDIF
       ! Open the NetCDF file
@@ -976,5 +976,5 @@
    END SUBROUTINE iom_g1d
 
-   SUBROUTINE iom_g2d( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kstart, kcount, ldxios)
+   SUBROUTINE iom_g2d( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount, ldxios)
       INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file
       INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read
@@ -984,4 +984,5 @@
       CHARACTER(len=1), INTENT(in   )              , OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
       REAL(wp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.): (not) change sign across the north fold
+      INTEGER         , INTENT(in   )              , OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kstart    ! start axis position of the reading 
       INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kcount    ! number of points in each axis
@@ -989,11 +990,11 @@
       !
       IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom         , cdvar            , pv_r2d=pvar,   &
-            &                                                       ktime=ktime  , cd_type = cd_type, psgn = psgn,   &
-            &                                                       kstart=kstart, kcount=kcount    , ldxios=ldxios  )
+         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom, cdvar      , pv_r2d = pvar  , ktime = ktime,   &
+            &                                                       cd_type = cd_type, psgn   = psgn  , kfill = kfill,   &
+            &                                                       kstart  = kstart , kcount = kcount, ldxios=ldxios  )
       ENDIF
    END SUBROUTINE iom_g2d
 
-   SUBROUTINE iom_g3d( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kstart, kcount, ldxios )
+   SUBROUTINE iom_g3d( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount, ldxios )
       INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file
       INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read
@@ -1003,4 +1004,5 @@
       CHARACTER(len=1), INTENT(in   )              , OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
       REAL(wp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
+      INTEGER         , INTENT(in   )              , OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kstart    ! start axis position of the reading 
       INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kcount    ! number of points in each axis
@@ -1008,13 +1010,13 @@
       !
       IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom         , cdvar            , pv_r3d=pvar,   &
-            &                                                       ktime=ktime  , cd_type = cd_type, psgn = psgn,   &
-            &                                                       kstart=kstart, kcount=kcount    , ldxios=ldxios  )
+         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom, cdvar      , pv_r3d = pvar  , ktime = ktime,   &
+            &                                                       cd_type = cd_type, psgn   = psgn  , kfill = kfill,   &
+            &                                                       kstart  = kstart , kcount = kcount, ldxios=ldxios  )
       ENDIF
    END SUBROUTINE iom_g3d
    !!----------------------------------------------------------------------
 
-   SUBROUTINE iom_get_123d( kiomid, kdom   , cdvar , pv_r1d, pv_r2d, pv_r3d,   &
-         &                  ktime , cd_type, psgn  , kstart, kcount, ldxios )
+   SUBROUTINE iom_get_123d( kiomid , kdom, cdvar, pv_r1d, pv_r2d, pv_r3d, ktime ,   &
+         &                  cd_type, psgn, kfill, kstart, kcount, ldxios )
       !!-----------------------------------------------------------------------
       !!                  ***  ROUTINE  iom_get_123d  ***
@@ -1033,4 +1035,5 @@
       CHARACTER(len=1)           , INTENT(in   ), OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
       REAL(wp)                   , INTENT(in   ), OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
+      INTEGER                    , INTENT(in   ), OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kstart    ! start position of the reading in each axis 
       INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kcount    ! number of points to be read in each axis
@@ -1158,7 +1161,7 @@
                ENDIF
             ELSE   !   not a 1D array as pv_r1d requires jpdom_unknown
-               ! we do not read the overlap and the extra-halos -> from nldi to nlei and from nldj to nlej 
-               IF( idom == jpdom_global )   istart(1:2) = (/ mig(nldi), mjg(nldj) /)
-               icnt(1:2) = (/ nlei - nldi + 1, nlej - nldj + 1 /)
+               ! we do not read the overlap and the extra-halos -> from Nis0 to Nie0 and from Njs0 to Nje0 
+               IF( idom == jpdom_global )   istart(1:2) = (/ mig(Nis0)-nn_hls, mjg(Njs0)-nn_hls /)
+               icnt(1:2) = (/ Ni_0, Nj_0 /)
                IF( PRESENT(pv_r3d) ) THEN
                   IF( idom == jpdom_auto_xy ) THEN
@@ -1191,8 +1194,8 @@
             ELSE
                IF( irankpv == 2 ) THEN
-                  ishape(1:2) = SHAPE(pv_r2d(nldi:nlei,nldj:nlej  ))   ;   ctmp1 = 'd(nldi:nlei,nldj:nlej)'
+                  ishape(1:2) = SHAPE(pv_r2d(Nis0:Nie0,Njs0:Nje0  ))   ;   ctmp1 = 'd(Nis0:Nie0,Njs0:Nje0)'
                ENDIF
                IF( irankpv == 3 ) THEN 
-                  ishape(1:3) = SHAPE(pv_r3d(nldi:nlei,nldj:nlej,:))   ;   ctmp1 = 'd(nldi:nlei,nldj:nlej,:)'
+                  ishape(1:3) = SHAPE(pv_r3d(Nis0:Nie0,Njs0:Nje0,:))   ;   ctmp1 = 'd(Nis0:Nie0,Njs0:Nje0,:)'
                ENDIF
             ENDIF         
@@ -1209,5 +1212,5 @@
             !
             ! find the right index of the array to be read
-            IF( idom /= jpdom_unknown ) THEN   ;   ix1 = nldi   ;   ix2 = nlei      ;   iy1 = nldj   ;   iy2 = nlej
+            IF( idom /= jpdom_unknown ) THEN   ;   ix1 = Nis0   ;   ix2 = Nie0      ;   iy1 = Njs0   ;   iy2 = Nje0
             ELSE                               ;   ix1 = 1      ;   ix2 = icnt(1)   ;   iy1 = 1      ;   iy2 = icnt(2)
             ENDIF
@@ -1224,7 +1227,7 @@
                !--- overlap areas and extra hallows (mpp)
                IF(     PRESENT(pv_r2d) .AND. idom /= jpdom_unknown ) THEN
-                  CALL lbc_lnk( 'iom', pv_r2d, cl_type, zsgn, kfillmode = jpfillnothing )
+                  CALL lbc_lnk( 'iom', pv_r2d, cl_type, zsgn, kfillmode = kfill )
                ELSEIF( PRESENT(pv_r3d) .AND. idom /= jpdom_unknown ) THEN
-                  CALL lbc_lnk( 'iom', pv_r3d, cl_type, zsgn, kfillmode = jpfillnothing )
+                  CALL lbc_lnk( 'iom', pv_r3d, cl_type, zsgn, kfillmode = kfill )
                ENDIF
                !
@@ -1863,18 +1866,14 @@
       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plat
       !
-      INTEGER  :: ni, nj
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmask
       LOGICAL, INTENT(IN) :: ldxios, ldrxios
       !!----------------------------------------------------------------------
       !
-      ni = nlei-nldi+1
-      nj = nlej-nldj+1
-      !
-      CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj)
-      CALL iom_set_domain_attr("grid_"//cdgrd, data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj)
+      CALL iom_set_domain_attr("grid_"//cdgrd,ni_glo=jpiglo,nj_glo=jpjglo,ibegin=nimpp+Nis0-2,jbegin=njmpp+Njs0-2,ni=Ni_0,nj=Nj_0)
+      CALL iom_set_domain_attr("grid_"//cdgrd, data_dim=2, data_ibegin = 1-Nis0, data_ni = jpi, data_jbegin = 1-Njs0, data_nj = jpj)
 !don't define lon and lat for restart reading context. 
       IF ( .NOT.ldrxios ) &
-         CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = RESHAPE(plon(nldi:nlei, nldj:nlej),(/ ni*nj /)),   &
-         &                                     latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /)))  
+         CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = RESHAPE(plon(Nis0:Nie0, Njs0:Nje0),(/ Ni_0*Nj_0 /)),   &
+         &                                        latvalue = RESHAPE(plat(Nis0:Nie0, Njs0:Nje0),(/ Ni_0*Nj_0 /)))  
       !
       IF ( ln_mskland .AND. (.NOT.ldxios) ) THEN
@@ -1887,6 +1886,6 @@
          END SELECT
          !
-         CALL iom_set_domain_attr( "grid_"//cdgrd       , mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,1),(/ni*nj    /)) /= 0. )
-         CALL iom_set_grid_attr  ( "grid_"//cdgrd//"_3D", mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,:),(/ni,nj,jpk/)) /= 0. )
+         CALL iom_set_domain_attr( "grid_"//cdgrd       , mask = RESHAPE(zmask(Nis0:Nie0,Njs0:Nje0,1),(/Ni_0*Nj_0    /)) /= 0. )
+         CALL iom_set_grid_attr  ( "grid_"//cdgrd//"_3D", mask = RESHAPE(zmask(Nis0:Nie0,Njs0:Nje0,:),(/Ni_0*Nj_0,jpk/)) /= 0. )
       ENDIF
       !
@@ -1905,5 +1904,5 @@
       REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) :: plon_pnt, plat_pnt  ! Lat/lon coord. of the point of cell (i,j)
       !
-      INTEGER :: ji, jj, jn, ni, nj
+      INTEGER :: ji, jj, jn
       INTEGER :: icnr, jcnr                             ! Offset such that the vertex coordinate (i+icnr,j+jcnr)
       !                                                 ! represents the bottom-left corner of cell (i,j)
@@ -1921,7 +1920,4 @@
       CASE ('V')        ;   icnr = -1   ;   jcnr =  0
       END SELECT
-      !
-      ni = nlei-nldi+1   ! Dimensions of subdomain interior
-      nj = nlej-nldj+1
       !
       z_fld(:,:) = 1._wp
@@ -1958,5 +1954,5 @@
          IF( (nbondi == 1 .OR. nbondi == 2) .AND. .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6) ) THEN
             DO jn = 1, 4        ! (East or jpni = 1), closed E-W
-               z_bnds(jn,nlci,:,1) = plat_pnt(nlci,:)  ;  z_bnds(jn,nlci,:,2) = plon_pnt(nlci,:)
+               z_bnds(jn,jpi,:,1) = plat_pnt(jpi,:)  ;  z_bnds(jn,jpi,:,2) = plon_pnt(jpi,:)
             END DO
          ENDIF
@@ -1968,5 +1964,5 @@
          IF( (nbondj == 1 .OR. nbondj == 2) .AND. jperio  < 3 ) THEN
             DO jn = 1, 4        ! (North or jpnj = 1), no north fold
-               z_bnds(jn,:,nlcj,1) = plat_pnt(:,nlcj)  ;  z_bnds(jn,:,nlcj,2) = plon_pnt(:,nlcj)
+               z_bnds(jn,:,jpj,1) = plat_pnt(:,jpj)  ;  z_bnds(jn,:,jpj,2) = plon_pnt(:,jpj)
             END DO
          ENDIF
@@ -1991,6 +1987,6 @@
       ENDIF
       !
-      CALL iom_set_domain_attr("grid_"//cdgrd, bounds_lat = RESHAPE(z_bnds(:,nldi:nlei,nldj:nlej,1),(/ 4,ni*nj /)),           &
-          &                                    bounds_lon = RESHAPE(z_bnds(:,nldi:nlei,nldj:nlej,2),(/ 4,ni*nj /)), nvertex=4 )
+      CALL iom_set_domain_attr("grid_"//cdgrd, bounds_lat = RESHAPE(z_bnds(:,Nis0:Nie0,Njs0:Nje0,1),(/ 4,Ni_0*Nj_0 /)),           &
+          &                                    bounds_lon = RESHAPE(z_bnds(:,Nis0:Nie0,Njs0:Nje0,2),(/ 4,Ni_0*Nj_0 /)), nvertex=4 )
       !
       DEALLOCATE( z_bnds, z_fld, z_rot ) 
@@ -2008,18 +2004,16 @@
       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plat
       !
-      INTEGER  :: ni, nj, ix, iy
+      INTEGER  :: ix, iy
       REAL(wp), DIMENSION(:), ALLOCATABLE  ::   zlon
       !!----------------------------------------------------------------------
       !
-      ni=nlei-nldi+1       ! define zonal mean domain (jpj*jpk)
-      nj=nlej-nldj+1
       ALLOCATE( zlon(ni*nj) )       ;       zlon(:) = 0._wp
       !
 !      CALL dom_ngb( -168.53, 65.03, ix, iy, 'T' ) !  i-line that passes through Bering Strait: Reference latitude (used in plots)
       CALL dom_ngb( 180., 90., ix, iy, 'T' ) !  i-line that passes near the North Pole : Reference latitude (used in plots)
-      CALL iom_set_domain_attr("gznl", ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj)
-      CALL iom_set_domain_attr("gznl", data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj)
+      CALL iom_set_domain_attr("gznl", ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+Nis0-2, jbegin=njmpp+Njs0-2, ni=Ni_0, nj=Nj_0)
+      CALL iom_set_domain_attr("gznl", data_dim=2, data_ibegin = 1-Nis0, data_ni = jpi, data_jbegin = 1-Njs0, data_nj = jpj)
       CALL iom_set_domain_attr("gznl", lonvalue = zlon,   &
-         &                             latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /)))  
+         &                             latvalue = RESHAPE(plat(Nis0:Nie0, Njs0:Nje0),(/ Ni_0*Nj_0 /)))  
       CALL iom_set_zoom_domain_attr("ptr", ibegin=ix-1, jbegin=0, ni=1, nj=jpjglo)
       !
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom_def.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom_def.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom_def.F90	(revision 12807)
@@ -14,5 +14,5 @@
 
    INTEGER, PARAMETER, PUBLIC ::   jpdom_global        = 1   !: ( 1  :jpiglo, 1  :jpjglo)
-   INTEGER, PARAMETER, PUBLIC ::   jpdom_local         = 2   !: (nldi:nlei  ,nldj:nlej  )
+   INTEGER, PARAMETER, PUBLIC ::   jpdom_local         = 2   !: (Nis0: Nie0 ,Njs0: Nje0 )
    INTEGER, PARAMETER, PUBLIC ::   jpdom_unknown       = 3   !: No dimension checking
    INTEGER, PARAMETER, PUBLIC ::   jpdom_auto          = 4   !: 
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom_nf90.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom_nf90.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/iom_nf90.F90	(revision 12807)
@@ -134,5 +134,5 @@
                  CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'nav_lev',            jpk, idmy ), clinfo)
                  CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'time_counter', NF90_UNLIMITED, idmy ), clinfo)
-                 CALL iom_nf90_check(NF90_DEF_DIM( if90id,  'numcat',          kdlev, idmy ), clinfo)
+                 IF( kdlev > 0 )   CALL iom_nf90_check(NF90_DEF_DIM( if90id,  'numcat',          kdlev, idmy ), clinfo)
               ENDIF
             ELSE
@@ -665,9 +665,9 @@
          IF( PRESENT(pv_r2d) .OR. PRESENT(pv_r3d) ) THEN
             idimsz(1:2) = iom_file(kiomid)%dimsz(1:2,idvar)
-            IF(     idimsz(1) == (nlei - nldi + 1) .AND. idimsz(2) == (nlej - nldj + 1) ) THEN
-               ix1 = nldi   ;   ix2 = nlei   ;   iy1 = nldj   ;   iy2 = nlej
-            ELSEIF( idimsz(1) == nlci              .AND. idimsz(2) == nlcj              ) THEN
-               ix1 = 1      ;   ix2 = nlci   ;   iy1 = 1      ;   iy2 = nlcj
-            ELSEIF( idimsz(1) == jpi               .AND. idimsz(2) == jpj               ) THEN
+            IF(     idimsz(1) == Ni_0 .AND. idimsz(2) == Nj_0 ) THEN
+               ix1 = Nis0   ;   ix2 = Nie0   ;   iy1 = Njs0   ;   iy2 = Nje0
+            ELSEIF( idimsz(1) == jpi  .AND. idimsz(2) == jpj  ) THEN
+               ix1 = 1      ;   ix2 = jpi    ;   iy1 = 1      ;   iy2 = jpj
+            ELSEIF( idimsz(1) == jpi  .AND. idimsz(2) == jpj  ) THEN
                ix1 = 1      ;   ix2 = jpi    ;   iy1 = 1      ;   iy2 = jpj
             ELSE 
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/prtctl.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/prtctl.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/IOM/prtctl.F90	(revision 12807)
@@ -18,9 +18,9 @@
 
    INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   numid
-   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   nlditl , nldjtl    ! first, last indoor index for each i-domain
-   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   nleitl , nlejtl    ! first, last indoor index for each j-domain
-   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   nimpptl, njmpptl   ! i-, j-indexes for each processor
-   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   nlcitl , nlcjtl    ! dimensions of every subdomain
-   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   ibonitl, ibonjtl   !
+   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   nis0allp, njs0allp   ! first, last indoor index for each i-domain
+   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::   nie0allp, nje0allp   ! first, last indoor index for each j-domain
+   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::    nimpptl,  njmpptl   ! i-, j-indexes for each processor
+   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::    jpiallp,  jpjallp   ! dimensions of every subdomain
+   INTEGER , DIMENSION(:), ALLOCATABLE, SAVE ::    ibonitl,  ibonjtl   !
 
    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::   t_ctll , s_ctll    ! previous tracer trend values
@@ -134,23 +134,23 @@
          IF( .NOT. lsp_area ) THEN
             IF (lk_mpp .AND. jpnij > 1)   THEN
-               nictls = MAX(  1, nlditl(jn) )
-               nictle = MIN(jpi, nleitl(jn) )
-               njctls = MAX(  1, nldjtl(jn) )
-               njctle = MIN(jpj, nlejtl(jn) )
+               nictls = MAX(  1, nis0allp(jn) )
+               nictle = MIN(jpi, nie0allp(jn) )
+               njctls = MAX(  1, njs0allp(jn) )
+               njctle = MIN(jpj, nje0allp(jn) )
                ! Do not take into account the bound of the domain
                IF( ibonitl(jn) == -1 .OR. ibonitl(jn) == 2 ) nictls = MAX(2, nictls)
                IF( ibonjtl(jn) == -1 .OR. ibonjtl(jn) == 2 ) njctls = MAX(2, njctls)
-               IF( ibonitl(jn) ==  1 .OR. ibonitl(jn) == 2 ) nictle = MIN(nictle, nleitl(jn) - 1)
-               IF( ibonjtl(jn) ==  1 .OR. ibonjtl(jn) == 2 ) njctle = MIN(njctle, nlejtl(jn) - 1)
+               IF( ibonitl(jn) ==  1 .OR. ibonitl(jn) == 2 ) nictle = MIN(nictle, nie0allp(jn) - 1)
+               IF( ibonjtl(jn) ==  1 .OR. ibonjtl(jn) == 2 ) njctle = MIN(njctle, nje0allp(jn) - 1)
             ELSE
-               nictls = MAX(  1, nimpptl(jn) - 1 + nlditl(jn) )
-               nictle = MIN(jpi, nimpptl(jn) - 1 + nleitl(jn) )
-               njctls = MAX(  1, njmpptl(jn) - 1 + nldjtl(jn) )
-               njctle = MIN(jpj, njmpptl(jn) - 1 + nlejtl(jn) )
+               nictls = MAX(  1, nimpptl(jn) - 1 + nis0allp(jn) )
+               nictle = MIN(jpi, nimpptl(jn) - 1 + nie0allp(jn) )
+               njctls = MAX(  1, njmpptl(jn) - 1 + njs0allp(jn) )
+               njctle = MIN(jpj, njmpptl(jn) - 1 + nje0allp(jn) )
                ! Do not take into account the bound of the domain
                IF( ibonitl(jn) == -1 .OR. ibonitl(jn) == 2 ) nictls = MAX(2, nictls)
                IF( ibonjtl(jn) == -1 .OR. ibonjtl(jn) == 2 ) njctls = MAX(2, njctls)
-               IF( ibonitl(jn) ==  1 .OR. ibonitl(jn) == 2 ) nictle = MIN(nictle, nimpptl(jn) + nleitl(jn) - 2)
-               IF( ibonjtl(jn) ==  1 .OR. ibonjtl(jn) == 2 ) njctle = MIN(njctle, njmpptl(jn) + nlejtl(jn) - 2)
+               IF( ibonitl(jn) ==  1 .OR. ibonitl(jn) == 2 ) nictle = MIN(nictle, nimpptl(jn) + nie0allp(jn) - 2)
+               IF( ibonjtl(jn) ==  1 .OR. ibonjtl(jn) == 2 ) njctle = MIN(njctle, njmpptl(jn) + nje0allp(jn) - 2)
             ENDIF
          ENDIF
@@ -277,8 +277,8 @@
 
       ! Allocate arrays
-      ALLOCATE( nlditl(ijsplt) , nleitl(ijsplt) , nimpptl(ijsplt) , ibonitl(ijsplt) ,   &
-         &      nldjtl(ijsplt) , nlejtl(ijsplt) , njmpptl(ijsplt) , ibonjtl(ijsplt) ,   &
-         &      nlcitl(ijsplt) , t_ctll(ijsplt) , u_ctll (ijsplt) ,                     &
-         &      nlcjtl(ijsplt) , s_ctll(ijsplt) , v_ctll (ijsplt)                       )
+      ALLOCATE( nis0allp(ijsplt) , nie0allp(ijsplt) , nimpptl(ijsplt) , ibonitl(ijsplt) ,   &
+         &      njs0allp(ijsplt) , nje0allp(ijsplt) , njmpptl(ijsplt) , ibonjtl(ijsplt) ,   &
+         &       jpiallp(ijsplt) ,   t_ctll(ijsplt) ,  u_ctll(ijsplt) ,                     &
+         &       jpjallp(ijsplt) ,   s_ctll(ijsplt) ,  v_ctll(ijsplt)                       )
 
       ! Initialization 
@@ -295,14 +295,14 @@
          cl_run = 'MULTI processor run'
          ! use indices for each area computed by mpp_init subroutine
-         nlditl(1:jpnij) = nldit(:) 
-         nleitl(1:jpnij) = nleit(:) 
-         nldjtl(1:jpnij) = nldjt(:) 
-         nlejtl(1:jpnij) = nlejt(:) 
+         nis0allp(1:jpnij) = nis0all(:) 
+         nie0allp(1:jpnij) = nie0all(:) 
+         njs0allp(1:jpnij) = njs0all(:) 
+         nje0allp(1:jpnij) = nje0all(:) 
          !
          nimpptl(1:jpnij) = nimppt(:)
          njmpptl(1:jpnij) = njmppt(:)
          !
-         nlcitl(1:jpnij) = nlcit(:)
-         nlcjtl(1:jpnij) = nlcjt(:)
+         jpiallp(1:jpnij) = jpiall(:)
+         jpjallp(1:jpnij) = jpjall(:)
          !
          ibonitl(1:jpnij) = ibonit(:)
@@ -335,8 +335,8 @@
          ! Print the SUM control indices
          IF( .NOT. lsp_area )   THEN
-            nictls = nimpptl(jn) + nlditl(jn) - 1
-            nictle = nimpptl(jn) + nleitl(jn) - 1
-            njctls = njmpptl(jn) + nldjtl(jn) - 1
-            njctle = njmpptl(jn) + nlejtl(jn) - 1
+            nictls = nimpptl(jn) + nis0allp(jn) - 1
+            nictle = nimpptl(jn) + nie0allp(jn) - 1
+            njctls = njmpptl(jn) + njs0allp(jn) - 1
+            njctle = njmpptl(jn) + nje0allp(jn) - 1
          ENDIF
          WRITE(j_id,*) 
@@ -344,5 +344,5 @@
          WRITE(j_id,*) '~~~~~~~'
          WRITE(j_id,*)
-         WRITE(j_id,9000)'                                nlej   = ', nlejtl(jn), '              '
+         WRITE(j_id,9000)'                                Nje0   = ', nje0allp(jn), '              '
          WRITE(j_id,9000)'                  ------------- njctle = ', njctle, ' -------------'
          WRITE(j_id,9001)'                  |                                       |'
@@ -350,10 +350,10 @@
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9002)'           nictls = ', nictls,  '                           nictle = ', nictle
-         WRITE(j_id,9002)'           nldi   = ', nlditl(jn),  '                           nlei   = ', nleitl(jn)
+         WRITE(j_id,9002)'           Nis0   = ', nis0allp(jn),  '                           Nie0   = ', nie0allp(jn)
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9004)'  njmpp  = ',njmpptl(jn),'   ------------- njctls = ', njctls, ' -------------'
-         WRITE(j_id,9003)'           nimpp  = ', nimpptl(jn), '        nldj   = ', nldjtl(jn), '              '
+         WRITE(j_id,9003)'           nimpp  = ', nimpptl(jn), '        Njs0   = ', njs0allp(jn), '              '
          WRITE(j_id,*)
          WRITE(j_id,*)
@@ -392,6 +392,6 @@
       !!                    njmpp     : latitudinal  index
       !!                    narea     : number for local area
-      !!                    nlcil      : first dimension
-      !!                    nlcjl      : second dimension
+      !!                    ipil      : first dimension
+      !!                    ipjl      : second dimension
       !!                    nbondil    : mark for "east-west local boundary"
       !!                    nbondjl    : mark for "north-south local boundary"
@@ -408,9 +408,9 @@
          ii, ij,                         &  ! temporary integers
          irestil, irestjl,               &  !    "          "
-         ijpi  , ijpj, nlcil,            &  ! temporary logical unit
-         nlcjl , nbondil, nbondjl,       &
-         nrecil, nrecjl, nldil, nleil, nldjl, nlejl
-
-      INTEGER, DIMENSION(jpi,jpj) ::   iimpptl, ijmpptl, ilcitl, ilcjtl   ! workspace
+         ijpi  , ijpj, ipil,             &  ! temporary logical unit
+         ipjl , nbondil, nbondjl,        &
+         nrecil, nrecjl, Nis0l, Nie0l, Njs0l, Nje0l
+
+      INTEGER, DIMENSION(jpi,jpj) ::   iimpptl, ijmpptl, ijpitl, ijpjtl   ! workspace
       REAL(wp) ::   zidom, zjdom            ! temporary scalars
       INTEGER ::   inum                     ! local logical unit
@@ -421,5 +421,5 @@
       !  1. Dimension arrays for subdomains
       ! -----------------------------------
-      !  Computation of local domain sizes ilcitl() ilcjtl()
+      !  Computation of local domain sizes ijpitl() ijpjtl()
       !  These dimensions depend on global sizes isplt,jsplt and jpiglo,jpjglo
       !  The subdomains are squares leeser than or equal to the global
@@ -448,7 +448,7 @@
       DO jj = 1, jsplt 
          DO ji=1, isplt-1 
-            ilcitl(ji,jj) = ijpi 
+            ijpitl(ji,jj) = ijpi 
          END DO 
-         ilcitl(isplt,jj) = jpiglo - (isplt - 1) * (ijpi - nrecil)
+         ijpitl(isplt,jj) = jpiglo - (isplt - 1) * (ijpi - nrecil)
       END DO 
 
@@ -457,8 +457,8 @@
       DO jj = 1, jsplt
          DO ji = 1, irestil
-            ilcitl(ji,jj) = ijpi
+            ijpitl(ji,jj) = ijpi
          END DO
          DO ji = irestil+1, isplt
-            ilcitl(ji,jj) = ijpi -1
+            ijpitl(ji,jj) = ijpi -1
          END DO
       END DO
@@ -472,7 +472,7 @@
       DO ji = 1, isplt 
          DO jj=1, jsplt-1 
-            ilcjtl(ji,jj) = ijpj 
+            ijpjtl(ji,jj) = ijpj 
          END DO 
-         ilcjtl(ji,jsplt) = jpjglo - (jsplt - 1) * (ijpj - nrecjl)
+         ijpjtl(ji,jsplt) = jpjglo - (jsplt - 1) * (ijpj - nrecjl)
       END DO 
 
@@ -481,8 +481,8 @@
       DO ji = 1, isplt
          DO jj = 1, irestjl
-            ilcjtl(ji,jj) = ijpj
+            ijpjtl(ji,jj) = ijpj
          END DO
          DO jj = irestjl+1, jsplt
-            ilcjtl(ji,jj) = ijpj -1
+            ijpjtl(ji,jj) = ijpj -1
          END DO
       END DO
@@ -491,14 +491,14 @@
       zidom = nrecil
       DO ji = 1, isplt
-         zidom = zidom + ilcitl(ji,1) - nrecil
+         zidom = zidom + ijpitl(ji,1) - nrecil
       END DO
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*)' sum ilcitl(i,1) = ', zidom, ' jpiglo = ', jpiglo
+      IF(lwp) WRITE(numout,*)' sum ijpitl(i,1) = ', zidom, ' jpiglo = ', jpiglo
       
       zjdom = nrecjl
       DO jj = 1, jsplt
-         zjdom = zjdom + ilcjtl(1,jj) - nrecjl
-      END DO
-      IF(lwp) WRITE(numout,*)' sum ilcitl(1,j) = ', zjdom, ' jpjglo = ', jpjglo
+         zjdom = zjdom + ijpjtl(1,jj) - nrecjl
+      END DO
+      IF(lwp) WRITE(numout,*)' sum ijpitl(1,j) = ', zjdom, ' jpjglo = ', jpjglo
       IF(lwp) WRITE(numout,*)
       
@@ -513,5 +513,5 @@
          DO jj = 1, jsplt
             DO ji = 2, isplt
-               iimpptl(ji,jj) = iimpptl(ji-1,jj) + ilcitl(ji-1,jj) - nrecil
+               iimpptl(ji,jj) = iimpptl(ji-1,jj) + ijpitl(ji-1,jj) - nrecil
             END DO
          END DO
@@ -521,5 +521,5 @@
          DO jj = 2, jsplt
             DO ji = 1, isplt
-               ijmpptl(ji,jj) = ijmpptl(ji,jj-1)+ilcjtl(ji,jj-1)-nrecjl
+               ijmpptl(ji,jj) = ijmpptl(ji,jj-1)+ijpjtl(ji,jj-1)-nrecjl
             END DO
          END DO
@@ -534,8 +534,8 @@
          nimpptl(jn) = iimpptl(ii,ij)
          njmpptl(jn) = ijmpptl(ii,ij)
-         nlcitl (jn) = ilcitl (ii,ij)     
-         nlcil       = nlcitl (jn)     
-         nlcjtl (jn) = ilcjtl (ii,ij)     
-         nlcjl       = nlcjtl (jn)
+         jpiallp(jn) = ijpitl (ii,ij)     
+         ipil        = jpiallp(jn)     
+         jpjallp(jn) = ijpjtl (ii,ij)     
+         ipjl        = jpjallp(jn)
          nbondjl = -1                                    ! general case
          IF( jn   >  isplt          )   nbondjl = 0      ! first row of processor
@@ -550,16 +550,16 @@
          ibonitl(jn) = nbondil
          
-         nldil =  1   + nn_hls
-         nleil = nlcil - nn_hls
-         IF( nbondil == -1 .OR. nbondil == 2 )   nldil = 1
-         IF( nbondil ==  1 .OR. nbondil == 2 )   nleil = nlcil
-         nldjl =  1   + nn_hls
-         nlejl = nlcjl - nn_hls
-         IF( nbondjl == -1 .OR. nbondjl == 2 )   nldjl = 1
-         IF( nbondjl ==  1 .OR. nbondjl == 2 )   nlejl = nlcjl
-         nlditl(jn) = nldil
-         nleitl(jn) = nleil
-         nldjtl(jn) = nldjl
-         nlejtl(jn) = nlejl
+         Nis0l =  1   + nn_hls
+         Nie0l = ipil - nn_hls
+         IF( nbondil == -1 .OR. nbondil == 2 )   Nis0l = 1
+         IF( nbondil ==  1 .OR. nbondil == 2 )   Nie0l = ipil
+         Njs0l =  1   + nn_hls
+         Nje0l = ipjl - nn_hls
+         IF( nbondjl == -1 .OR. nbondjl == 2 )   Njs0l = 1
+         IF( nbondjl ==  1 .OR. nbondjl == 2 )   Nje0l = ipjl
+         nis0allp(jn) = Nis0l
+         nie0allp(jn) = Nie0l
+         njs0allp(jn) = Njs0l
+         nje0allp(jn) = Nje0l
       END DO
       !
@@ -567,12 +567,12 @@
       IF(lwp) THEN
          CALL ctl_opn( inum, 'layout_prtctl.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea )
-         WRITE(inum,'(a)') 'nproc nlcil nlcjl nldil nldjl nleil nlejl nimpptl njmpptl ibonitl ibonjtl'
+         WRITE(inum,'(a)') 'nproc ipil ipjl Nis0l Njs0l Nie0l Nje0l nimpptl njmpptl ibonitl ibonjtl'
          !
          DO jn = 1, ijsplt
-            WRITE(inum,'(i5,6i6,4i8)') jn-1,nlcitl(jn),  nlcjtl(jn), &
-               &                            nlditl(jn),  nldjtl(jn), &
-               &                            nleitl(jn),  nlejtl(jn), &
-               &                           nimpptl(jn), njmpptl(jn), &
-               &                           ibonitl(jn), ibonjtl(jn)
+            WRITE(inum,'(i5,6i6,4i8)') jn-1, jpiallp(jn),  jpjallp(jn), &
+               &                            nis0allp(jn), njs0allp(jn), &
+               &                            nie0allp(jn), nje0allp(jn), &
+               &                             nimpptl(jn),  njmpptl(jn), &
+               &                             ibonitl(jn),  ibonjtl(jn)
          END DO
          CLOSE(inum)   
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ISF/isfcpl.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ISF/isfcpl.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ISF/isfcpl.F90	(revision 12807)
@@ -16,5 +16,5 @@
    USE lib_mpp , ONLY: mpp_sum, mpp_max ! mpp routine
    USE domvvl  , ONLY: dom_vvl_zgr      ! vertical scale factor interpolation
-   USE domngb  , ONLY: dom_ngb          ! find the closest grid point from a given lon/lat position
+   USE domutl  , ONLY: dom_ngb          ! find the closest grid point from a given lon/lat position
    !
    USE oce            ! ocean dynamics and tracers
@@ -519,6 +519,6 @@
 
       DO jk = 1,jpk-1
-         DO jj = nldj,nlej
-            DO ji = nldi,nlei
+         DO jj = Njs0,Nje0
+            DO ji = Nis0,Nie0
 
                ! volume diff
@@ -552,6 +552,6 @@
       nisfl(:)=0
       DO jk = 1,jpk-1
-         DO jj = nldj,nlej
-            DO ji = nldi,nlei
+         DO jj = Njs0,Nje0
+            DO ji = Nis0,Nie0
                jip1=MIN(ji+1,jpi) ; jim1=MAX(ji-1,1) ; jjp1=MIN(jj+1,jpj) ; jjm1=MAX(jj-1,1) ;
                IF ( tmask(ji,jj,jk) == 0._wp .AND. ztmask_b(ji,jj,jk) == 1._wp ) nisfl(narea) = nisfl(narea) + MAX(SUM(tmask(jim1:jip1,jjm1:jjp1,jk)),1._wp)
@@ -572,6 +572,6 @@
       jisf = 0
       DO jk = 1,jpk-1
-         DO jj = nldj,nlej
-            DO ji = nldi,nlei
+         DO jj = Njs0,Nje0
+            DO ji = Nis0,Nie0
                IF ( tmask(ji,jj,jk) == 0._wp .AND. ztmask_b(ji,jj,jk) == 1._wp ) THEN
 
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ISF/isfutils.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ISF/isfutils.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/ISF/isfutils.F90	(revision 12807)
@@ -15,5 +15,5 @@
    USE lib_fortran   , ONLY: glob_sum, glob_min, glob_max                    ! compute global value
    USE par_oce       , ONLY: jpi,jpj,jpk, jpnij                              ! domain size
-   USE dom_oce       , ONLY: nldi, nlei, nldj, nlej, narea, tmask_h, tmask_i ! local domain
+   USE dom_oce       , ONLY: Nis0, Nie0, Njs0, Nje0, narea, tmask_h, tmask_i ! local domain
    USE in_out_manager, ONLY: i8, wp, lwp, numout                             ! miscelenious
    USE lib_mpp
@@ -84,6 +84,6 @@
       !
       ! local MOD sum
-      DO jj=nldj,nlej
-         DO ji=nldi,nlei
+      DO jj=Njs0,Nje0
+         DO ji=Nis0,Nie0
             idums = ABS(MOD(TRANSFER(pvar(ji,jj), ip),imodd))
             itmps(narea) = MOD(itmps(narea) + idums, imods)
@@ -138,6 +138,6 @@
       ! local MOD sum
       DO jk=1,jpk
-         DO jj=nldj,nlej
-            DO ji=nldi,nlei
+         DO jj=Njs0,Nje0
+            DO ji=Nis0,Nie0
                idums = ABS(MOD(TRANSFER(pvar(ji,jj,jk), ip),imodd))
                itmps(narea) = MOD(itmps(narea) + idums, imods)
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/halo_mng.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/halo_mng.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/halo_mng.F90	(revision 12807)
@@ -26,7 +26,6 @@
    INTEGER :: jpi_1, jpj_1
    INTEGER :: jpimax_1, jpjmax_1
-   INTEGER :: nlci_1, nlcj_1
-   INTEGER :: nldi_1, nldj_1
-   INTEGER :: nlei_1, nlej_1
+   INTEGER :: Nis0_1, Njs0_1
+   INTEGER :: Nie0_1, Nje0_1
 CONTAINS
 
@@ -36,12 +35,9 @@
         jpj_1 = jpj
 
-        nlci_1 = nlci
-        nlcj_1 = nlcj
+        Nis0_1 = Nis0
+        Njs0_1 = Njs0
 
-        nldi_1 = nldi
-        nldj_1 = nldj
-
-        nlei_1 = nlei
-        nlej_1 = nlej
+        Nie0_1 = Nie0
+        Nje0_1 = Nje0
 
    	jpimax_1 = jpimax
@@ -59,15 +55,15 @@
         jpj = jpj_1 + 2*khls -2
 
-        nlci = nlci_1 + 2*khls -2
-        nlcj = nlcj_1 + 2*khls -2
+        jpi = jpi_1 + 2*khls -2
+        jpj = jpj_1 + 2*khls -2
         
         jpimax = jpimax_1 + 2*khls -2
         jpjmax = jpjmax_1 + 2*khls -2
 
-        nldi = nldi_1 + khls - 1
-        nldj = nldj_1 + khls - 1
+        Nis0 = Nis0_1 + khls - 1
+        Njs0 = Njs0_1 + khls - 1
 
-        nlei = nlei_1 + khls - 1
-        nlej = nlej_1 + khls - 1
+        Nie0 = Nie0_1 + khls - 1
+        Nje0 = Nje0_1 + khls - 1
 
    END SUBROUTINE halo_mng_set
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_ext_generic.h90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_ext_generic.h90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_ext_generic.h90	(revision 12807)
@@ -28,5 +28,5 @@
       !
       SELECT CASE ( jpni )
-      CASE ( 1 )     ;   ipj = nlcj       ! 1 proc only  along the i-direction
+      CASE ( 1 )     ;   ipj = jpj        ! 1 proc only  along the i-direction
       CASE DEFAULT   ;   ipj = 4          ! several proc along the i-direction
       END SELECT
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_generic.h90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_generic.h90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_generic.h90	(revision 12807)
@@ -65,5 +65,5 @@
       !
       SELECT CASE ( jpni )
-      CASE ( 1 )     ;   ipj = nlcj       ! 1 proc only  along the i-direction
+      CASE ( 1 )     ;   ipj = jpj        ! 1 proc only  along the i-direction
       CASE DEFAULT   ;   ipj = 4          ! several proc along the i-direction
       END SELECT
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_nogather_generic.h90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_nogather_generic.h90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbc_nfd_nogather_generic.h90	(revision 12807)
@@ -97,6 +97,6 @@
                DO jl = 1, ipl; DO jk = 1, ipk
                	  DO jj = 1, nn_hls
-               	     ijj = nlcj -jj +1
-                     DO ji = startloop, nlci
+               	     ijj = jpj -jj +1
+                     DO ji = startloop, jpi
                     	ijt = jpiglo - (ji + nimpp-nn_hls+1 ) - nfiimpp(isendto(1),jpnj) + 4
                      	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
@@ -107,7 +107,7 @@
                   DO jl = 1, ipl; DO jk = 1, ipk
                      DO jj = 1, nn_hls
-               	  	ijj = nlcj -jj +1
+               	  	ijj = jpj -jj +1
                	  	DO ii = 0, nn_hls-1
-                  	   ARRAY_IN(ii+1,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii+1,nlcj-2*nn_hls+jj-1,jk,jl,jf)
+                  	   ARRAY_IN(ii+1,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii+1,jpj-2*nn_hls+jj-1,jk,jl,jf)
                   	END DO
                      END DO
@@ -118,19 +118,19 @@
                   IF( nimpp >= jpiglo/2+1 ) THEN
                      startloop = 1
-                  ELSEIF( nimpp+nlci-2*nn_hls+1 >= jpiglo/2+1 .AND. nimpp < jpiglo/2+1 ) THEN
+                  ELSEIF( nimpp+jpi-2*nn_hls+1 >= jpiglo/2+1 .AND. nimpp < jpiglo/2+1 ) THEN
                      startloop = jpiglo/2+1 - nimpp + nn_hls
                   ELSE
-                     startloop = nlci + 1
-                  ENDIF
-                  IF( startloop <= nlci ) THEN
+                     startloop = jpi + 1
+                  ENDIF
+                  IF( startloop <= jpi ) THEN
                      DO jl = 1, ipl; DO jk = 1, ipk
-                        DO ji = startloop, nlci
+                        DO ji = startloop, jpi
                            ijt  = jpiglo - (ji + nimpp -nn_hls+1)- nfiimpp(isendto(1),jpnj) + 4
                            jia  = ji + nimpp -nn_hls
                            ijta = jpiglo - jia + 2
                            IF( ijta >= startloop+nimpp-1 .AND. ijta < jia ) THEN
-                              ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijta-nimpp+nn_hls,nlcj-nn_hls,jk,jl,jf)
+                              ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijta-nimpp+nn_hls,jpj-nn_hls,jk,jl,jf)
                            ELSE
-                              ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,nn_hls+1,jk,jl,jf)
+                              ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,nn_hls+1,jk,jl,jf)
                            ENDIF
                         END DO
@@ -139,12 +139,12 @@
                ENDIF
             CASE ( 'U' )                                     ! U-point
-               IF( nimpp + nlci - 2*nn_hls+1 /= jpiglo ) THEN
-                  endloop = nlci
+               IF( nimpp + jpi - 2*nn_hls+1 /= jpiglo ) THEN
+                  endloop = jpi
                ELSE
-                  endloop = nlci - nn_hls
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
-        	     ijj = nlcj -jj +1
+                  endloop = jpi - nn_hls
+               ENDIF
+               DO jl = 1, ipl; DO jk = 1, ipk
+		  DO jj = 1, nn_hls
+        	     ijj = jpj -jj +1
                      DO ji = 1, endloop
                         iju = jpiglo - (ji + nimpp -nn_hls+1)- nfiimpp(isendto(1),jpnj) + 3
@@ -155,15 +155,15 @@
                IF (nimpp .eq. 1) THEN
 		  DO jj = 1, nn_hls
-		     ijj = nlcj -jj +1
+		     ijj = jpj -jj +1
 		     DO ii = 0, nn_hls-1
-		 	ARRAY_IN(ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,nlcj-2*nn_hls+jj-1,:,:,jf)
+		 	ARRAY_IN(ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,jpj-2*nn_hls+jj-1,:,:,jf)
 		     END DO
                   END DO
                ENDIF
-               IF((nimpp + nlci - 2*nn_hls+1) .eq. jpiglo) THEN
+               IF((nimpp + jpi - 2*nn_hls+1) .eq. jpiglo) THEN
                   DO jj = 1, nn_hls
-               	     ijj = nlcj -jj +1
+               	     ijj = jpj -jj +1
 			DO ii = 1, nn_hls
-		   	   ARRAY_IN(nlci-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii,nlcj-2*nn_hls+jj-1,:,:,jf)
+		   	   ARRAY_IN(jpi-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii,jpj-2*nn_hls+jj-1,:,:,jf)
 			END DO
 		  END DO
@@ -171,12 +171,12 @@
                !
                IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp + nlci - 2*nn_hls+1 /= jpiglo ) THEN
-                     endloop = nlci
-                  ELSE
-                     endloop = nlci - nn_hls
+                  IF( nimpp + jpi - 2*nn_hls+1 /= jpiglo ) THEN
+                     endloop = jpi
+                  ELSE
+                     endloop = jpi - nn_hls
                   ENDIF
                   IF( nimpp >= jpiglo/2 ) THEN
                      startloop = 1
-                  ELSEIF( ( nimpp + nlci - 2*nn_hls+1 >= jpiglo/2 ) .AND. ( nimpp < jpiglo/2 ) ) THEN
+                  ELSEIF( ( nimpp + jpi - 2*nn_hls+1 >= jpiglo/2 ) .AND. ( nimpp < jpiglo/2 ) ) THEN
                      startloop = jpiglo/2 - (nimpp -nn_hls+1) +1
                   ELSE
@@ -190,7 +190,7 @@
                         ijua = jpiglo - jia + 1
                         IF( ijua >= startloop+nimpp-1 .AND. ijua < jia ) THEN
-                           ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijua-nimpp+nn_hls,nlcj-nn_hls,jk,jl,jf)
+                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijua-nimpp+nn_hls,jpj-nn_hls,jk,jl,jf)
                         ELSE
-                           ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,nn_hls+1,jk,jl,jf)
+                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,nn_hls+1,jk,jl,jf)
                         ENDIF
                      END DO
@@ -208,6 +208,6 @@
                   DO jl = 1, ipl; DO jk = 1, ipk
                	     DO jj = 2, nn_hls+1
-               	  	ijj = nlcj -jj +1
-                     	DO ji = startloop, nlci
+               	  	ijj = jpj -jj +1
+                     	DO ji = startloop, jpi
                            ijt=jpiglo - (ji +nimpp -nn_hls+1)- nfiimpp(isendto(1),jpnj) + 4
                            ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
@@ -217,27 +217,27 @@
                ENDIF
                DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = startloop, nlci
+                  DO ji = startloop, jpi
                      ijt=jpiglo - (ji + nimpp -nn_hls+1)- nfiimpp(isendto(1),jpnj) + 4
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,1,jk,jl,jf)
+                     ARRAY_IN(ji,jpj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,1,jk,jl,jf)
                   END DO
                END DO; END DO
                IF (nimpp .eq. 1) THEN
 		  DO jj = 1, nn_hls
-               	     ijj = nlcj-jj+1
+               	     ijj = jpj-jj+1
                	     DO ii = 0, nn_hls-1
-                        ARRAY_IN(ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii+1,nlcj-2*nn_hls+jj-1,:,:,jf)
+                        ARRAY_IN(ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii+1,jpj-2*nn_hls+jj-1,:,:,jf)
 		     END DO
 		  END DO
                ENDIF
             CASE ( 'F' )                                     ! F-point
-               IF( nimpp + nlci - 2*nn_hls+1 /= jpiglo ) THEN
-                  endloop = nlci
+               IF( nimpp + jpi - 2*nn_hls+1 /= jpiglo ) THEN
+                  endloop = jpi
                ELSE
-                  endloop = nlci - nn_hls
+                  endloop = jpi - nn_hls
                ENDIF
                IF ( .NOT. l_fast_exchanges ) THEN
                   DO jl = 1, ipl; DO jk = 1, ipk
                	     DO jj = 2, nn_hls+1
-               	  	ijj = nlcj -jj +1
+               	  	ijj = jpj -jj +1
                      	DO ji = 1, endloop
                            iju = jpiglo - (ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 3
@@ -250,29 +250,29 @@
                   DO ji = 1, endloop
                      iju = jpiglo - (ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 3
-                     ARRAY_IN(ji,nlcj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,1,jk,jl,jf)
+                     ARRAY_IN(ji,jpj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,1,jk,jl,jf)
                   END DO
                END DO; END DO
 		IF (nimpp .eq. 1) THEN               
 		   DO ii = 1, nn_hls
-	              ARRAY_IN(ii+1,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,nlcj-2*nn_hls-1,:,:,jf)
+	              ARRAY_IN(ii+1,jpj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,jpj-2*nn_hls-1,:,:,jf)
 		   END DO
 		   IF ( .NOT. l_fast_exchanges ) THEN
 		      DO jj = 1, nn_hls
-               	 	 ijj = nlcj -jj
+               	 	 ijj = jpj -jj
                		 DO ii = 1, nn_hls
-                    	    ARRAY_IN(2-ii,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,nlcj-2*nn_hls+jj-1,:,:,jf)
+                    	    ARRAY_IN(2-ii,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,jpj-2*nn_hls+jj-1,:,:,jf)
                  	 END DO
                       END DO
                	   ENDIF
 		ENDIF
-		IF((nimpp + nlci - 2*nn_hls+1 ) .eq. jpiglo) THEN
+		IF((nimpp + jpi - 2*nn_hls+1 ) .eq. jpiglo) THEN
                    DO ii = 1, nn_hls
-	              ARRAY_IN(nlci-ii+1,nlcj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii,nlcj-2*nn_hls-1,:,:,jf)
+	              ARRAY_IN(jpi-ii+1,jpj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii,jpj-2*nn_hls-1,:,:,jf)
 		   END DO
 		   IF ( .NOT. l_fast_exchanges ) THEN
 		      DO jj = 1, nn_hls
-               	         ijj = nlcj -jj
+               	         ijj = jpj -jj
 	               	 DO ii = 1, nn_hls
-                    	    ARRAY_IN(nlci-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii,nlcj-2*nn_hls+jj-1,:,:,jf)
+                    	    ARRAY_IN(jpi-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii,jpj-2*nn_hls+jj-1,:,:,jf)
                      	 END DO
                       END DO
@@ -288,6 +288,6 @@
                DO jl = 1, ipl; DO jk = 1, ipk
 		  DO jj = 1, nn_hls
- 		     ijj = nlcj-jj+1
-		     DO ji = 1, nlci
+ 		     ijj = jpj-jj+1
+		     DO ji = 1, jpi
                      	ijt = jpiglo - ( ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 3
                      	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
@@ -297,12 +297,12 @@
                !
             CASE ( 'U' )                                     ! U-point
-               IF( nimpp + nlci - 2*nn_hls+1 /= jpiglo ) THEN
-                  endloop = nlci
+               IF( nimpp + jpi - 2*nn_hls+1 /= jpiglo ) THEN
+                  endloop = jpi
                ELSE
-                  endloop = nlci - nn_hls
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
- 		     ijj = nlcj-jj+1
+                  endloop = jpi - nn_hls
+               ENDIF
+               DO jl = 1, ipl; DO jk = 1, ipk
+		  DO jj = 1, nn_hls
+ 		     ijj = jpj-jj+1
                      DO ji = 1, endloop
                         iju = jpiglo- (ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 2
@@ -311,11 +311,11 @@
                   END DO
                END DO; END DO
-               IF(nimpp + nlci - 2*nn_hls+1 .eq. jpiglo) THEN
+               IF(nimpp + jpi - 2*nn_hls+1 .eq. jpiglo) THEN
                   DO jl = 1, ipl; DO jk = 1, ipk
                      DO jj = 1, nn_hls
-               	        ijj = nlcj-jj+1
+               	        ijj = jpj-jj+1
                         DO ii = 1, nn_hls
-			   iij = nlci-ii+1
-                           ARRAY_IN(iij,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii-1,nlcj-2*nn_hls+jj,jk,jl,jf)
+			   iij = jpi-ii+1
+                           ARRAY_IN(iij,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii-1,jpj-2*nn_hls+jj,jk,jl,jf)
                         END DO
                      END DO
@@ -326,6 +326,6 @@
                DO jl = 1, ipl; DO jk = 1, ipk
 		  DO jj = 1, nn_hls
-		     ijj = nlcj -jj +1
-                     DO ji = 1, nlci
+		     ijj = jpj -jj +1
+                     DO ji = 1, jpi
                         ijt = jpiglo - (ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 3
                         ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
@@ -337,14 +337,14 @@
                   IF( nimpp >= jpiglo/2+1 ) THEN
                      startloop = 1
-                  ELSEIF( nimpp+nlci-2*nn_hls+1 >= jpiglo/2+1 .AND. nimpp < jpiglo/2+1 ) THEN
+                  ELSEIF( nimpp+jpi-2*nn_hls+1 >= jpiglo/2+1 .AND. nimpp < jpiglo/2+1 ) THEN
                      startloop = jpiglo/2+1 - nimpp + nn_hls
                   ELSE
-                     startloop = nlci + 1
-                  ENDIF
-                  IF( startloop <= nlci ) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                        DO ji = startloop, nlci
+                     startloop = jpi + 1
+                  ENDIF
+                  IF( startloop <= jpi ) THEN
+                  DO jl = 1, ipl; DO jk = 1, ipk
+                        DO ji = startloop, jpi
                    	   ijt = jpiglo - (ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 3
-                           ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,nn_hls+1,jk,jl,jf)
+                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,nn_hls+1,jk,jl,jf)
                         END DO
                   END DO; END DO
@@ -353,12 +353,12 @@
                !
             CASE ( 'F' )                               ! F-point
-               IF( nimpp + nlci - 2*nn_hls+1 /= jpiglo ) THEN
-                  endloop = nlci
+               IF( nimpp + jpi - 2*nn_hls+1 /= jpiglo ) THEN
+                  endloop = jpi
                ELSE
-                  endloop = nlci - nn_hls
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
-		    ijj = nlcj -jj +1
+                  endloop = jpi - nn_hls
+               ENDIF
+               DO jl = 1, ipl; DO jk = 1, ipk
+		  DO jj = 1, nn_hls
+		    ijj = jpj -jj +1
                     DO ji = 1, endloop
                        iju = jpiglo - (ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 2
@@ -367,11 +367,11 @@
                   END DO
                END DO; END DO
-               IF((nimpp + nlci - 2*nn_hls+1) .eq. jpiglo) THEN
+               IF((nimpp + jpi - 2*nn_hls+1) .eq. jpiglo) THEN
                   DO jl = 1, ipl; DO jk = 1, ipk
                      DO jj = 1, nn_hls
-                        ijj = nlcj -jj +1
+                        ijj = jpj -jj +1
                         DO ii = 1, nn_hls
-			   iij = nlci -ii+1
-                     	   ARRAY_IN(iij,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(nlci-2*nn_hls+ii-1,nlcj-2*nn_hls+jj-1,jk,jl,jf)
+			   iij = jpi -ii+1
+                     	   ARRAY_IN(iij,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii-1,jpj-2*nn_hls+jj-1,jk,jl,jf)
                         END DO
                      END DO
@@ -380,12 +380,12 @@
                !
                IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp + nlci - 2*nn_hls+1 /= jpiglo ) THEN
-                     endloop = nlci
-                  ELSE
-                     endloop = nlci - nn_hls
+                  IF( nimpp + jpi - 2*nn_hls+1 /= jpiglo ) THEN
+                     endloop = jpi
+                  ELSE
+                     endloop = jpi - nn_hls
                   ENDIF
                   IF( nimpp >= jpiglo/2+1 ) THEN
                      startloop = 1 
-                  ELSEIF( nimpp+nlci-2*nn_hls+1 >= jpiglo/2+1 .AND. nimpp < jpiglo/2+1 ) THEN
+                  ELSEIF( nimpp+jpi-2*nn_hls+1 >= jpiglo/2+1 .AND. nimpp < jpiglo/2+1 ) THEN
                      startloop = jpiglo/2+1 - nimpp + nn_hls
                   ELSE
@@ -396,5 +396,5 @@
                         DO ji = startloop, endloop
                            iju = jpiglo - (ji + nimpp -nn_hls+1) - nfiimpp(isendto(1),jpnj) + 2
-                           ARRAY_IN(ji,nlcj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,nn_hls+1,jk,jl,jf)
+                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,nn_hls+1,jk,jl,jf)
                         END DO
                      END DO; END DO
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbclnk.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbclnk.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/lbclnk.F90	(revision 12807)
@@ -248,5 +248,5 @@
       !
       INTEGER ::   ji, jj, jr
-      INTEGER ::   ierr, itaille, ildi, ilei, iilb
+      INTEGER ::   ierr, itaille, iis0, iie0, iilb
       INTEGER ::   ipj, ij, iproc
       !
@@ -282,9 +282,9 @@
       DO jr = 1, ndim_rank_north            ! recover the global north array
          iproc = nrank_north(jr) + 1
-         ildi = nldit (iproc)
-         ilei = nleit (iproc)
+         iis0 = nis0all(iproc)
+         iie0 = nie0all(iproc)
          iilb = nimppt(iproc)
          DO jj = 1-kextj, ipj+kextj
-            DO ji = ildi, ilei
+            DO ji = iis0, iie0
                ztab_e(ji+iilb-1,jj) = znorthgloio_e(ji,jj,jr)
             END DO
@@ -396,5 +396,5 @@
       SELECT CASE ( nbondi )      ! Read Dirichlet lateral conditions
       CASE ( -1, 0, 1 )                ! all exept 2 (i.e. close case)
-         iihom = jpi-nreci-kexti
+         iihom = jpi - (2 * nn_hls) - kexti
          DO jl = 1, ipreci
             r2dew(:,jl,1) = pt2d(nn_hls+jl,:)
@@ -453,5 +453,5 @@
       !
       IF( nbondj /= 2 ) THEN      ! Read Dirichlet lateral conditions
-         ijhom = jpj-nrecj-kextj
+         ijhom = jpj - ( 2 * nn_hls ) -kextj
          DO jl = 1, iprecj
             r2dsn(:,jl,1) = pt2d(:,ijhom +jl)
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_lnk_generic.h90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_lnk_generic.h90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_lnk_generic.h90	(revision 12807)
@@ -189,26 +189,18 @@
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
             ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_we(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillperio )                 ! use east-weast periodicity
          ishift2 = jpi - 2 * nn_hls
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
             ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf                               ! number of arrays to be treated
-            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-                  ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-               END DO   ;   END DO   ;   END DO   ;   END DO
-            ENDIF
-         END DO
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
+            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf                               ! number of arrays to be treated
-            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-                  ARRAY_IN(ji,jj,jk,jl,jf) = zland
-               END DO;   END DO   ;   END DO   ;   END DO
-            ENDIF
-         END DO
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
+            ARRAY_IN(ji,jj,jk,jl,jf) = zland
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       END SELECT
       !
@@ -234,5 +226,5 @@
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
             ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       END SELECT
       !
@@ -303,26 +295,18 @@
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
             ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_so(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillperio )                 ! use north-south periodicity
          ishift2 = jpj - 2 * nn_hls
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
             ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf                               ! number of arrays to be treated
-            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-                  ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
-               END DO   ;   END DO   ;   END DO   ;   END DO
-            ENDIF
-         END DO
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
+            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf                               ! number of arrays to be treated
-            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
-               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi 
-                  ARRAY_IN(ji,jj,jk,jl,jf) = zland
-               END DO;   END DO   ;   END DO   ;   END DO
-            ENDIF
-         END DO
+         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi 
+            ARRAY_IN(ji,jj,jk,jl,jf) = zland
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       END SELECT
       !
@@ -340,13 +324,13 @@
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
             ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcopy  )                 ! filling with inner domain values
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
             ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       CASE ( jpfillcst   )                 ! filling with constant value
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
             ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
-         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
       END SELECT
       !
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90	(revision 12807)
@@ -56,5 +56,5 @@
       INTEGER  ::   ipi, ipk, ipl, ipf         ! dimension of the input array
       INTEGER  ::   imigr, iihom, ijhom             ! local integers
-      INTEGER  ::   ierr, ibuffsize, ilci, ildi, ilei, iilb
+      INTEGER  ::   ierr, ibuffsize, ijpi, iis0, iie0, iilb
       INTEGER  ::   ij, iproc
       INTEGER, DIMENSION (jpmaxngh)       ::   ml_req_nf   ! for mpi_isend when avoiding mpi_allgather
@@ -111,9 +111,9 @@
                CASE ( 'T' , 'W' ,'U' )                            ! T-, U-, W-point
                   DO ji = 1, nn_hls+1
-                     jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1
+                     jj_s(jf,ji) = jpj - 2*nn_hls +ji -1
                   ENDDO
                CASE ( 'V' , 'F' )                                 ! V-, F-point
                   DO ji = 1, nn_hls+1
-                     jj_s(jf,ji) = nlcj - 2*nn_hls +ji - 2
+                     jj_s(jf,ji) = jpj - 2*nn_hls +ji - 2
                   ENDDO
                END SELECT
@@ -124,10 +124,10 @@
                CASE ( 'T' , 'W' ,'U' )                            ! T-, U-, W-point
                   DO ji = 1, nn_hls
-                     jj_s(jf,ji) = nlcj - 2*nn_hls + ji
+                     jj_s(jf,ji) = jpj - 2*nn_hls + ji
                   ENDDO
                   ipj_s(jf) = nn_hls                  ! need only one line anyway
                CASE ( 'V' , 'F' )                                 ! V-, F-point
                   DO ji = 1, nn_hls+1
-                     jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1
+                     jj_s(jf,ji) = jpj - 2*nn_hls +ji -1
                   ENDDO
                END SELECT
@@ -175,10 +175,10 @@
             iproc = nfipproc(isendto(jr),jpnj)
             IF(iproc /= -1) THEN
-               iilb = nimppt(iproc+1)
-               ilci = nlcit (iproc+1)
-               ildi = nldit (iproc+1) + nn_hls-1
-               ilei = nleit (iproc+1) + nn_hls-1
-               IF( iilb            ==      1 )   ildi = nn_hls   ! e-w boundary already done -> force to take 1st column
-               IF( iilb + ilci - 1 == jpiglo )   ilei = nlei+1   ! e-w boundary already done -> force to take last column
+               iilb =  nimppt(iproc+1)
+               ijpi =  jpiall(iproc+1)
+               iis0 = nis0all(iproc+1) + nn_hls-1
+               iie0 = nie0all(iproc+1) + nn_hls-1
+               IF( iilb            ==      1 )   iis0 = nn_hls   ! e-w boundary already done -> force to take 1st column
+               IF( iilb + ijpi - 1 == jpiglo )   iie0 = Nie0+1   ! e-w boundary already done -> force to take last column
                iilb = nfiimpp(isendto(jr),jpnj) - nfiimpp(isendto(1),jpnj)
             ENDIF
@@ -190,5 +190,5 @@
                   DO jl = 1, ipl
                      DO jk = 1, ipk
-                        DO ji = ildi, ilei
+                        DO ji = iis0, iie0
                            ztabr(iilb-nn_hls+1+ji,jj,jk,jl,jf) = zfoldwk(ji,js,jk,jl,1)
                         END DO
@@ -200,5 +200,5 @@
                   DO jl = 1, ipl
                      DO jk = 1, ipk
-                        DO ji = ildi, ilei
+                        DO ji = iis0, iie0
                            ztabr(iilb-nn_hls+1+ji,jj,jk,jl,jf) = ARRAY_IN(ji,jj_s(jf,jj),jk,jl,jf)
                         END DO
@@ -233,6 +233,6 @@
             DO jl = 1, ipl
                DO jk = 1, ipk
-                  DO jj = nlcj - ijpj +1, nlcj
-                     ij = jj - nlcj + ijpj
+                  DO jj = jpj - ijpj +1, jpj
+                     ij = jj - jpj + ijpj
                      znorthloc(1:jpi,ij,jk,jl,jf) = ARRAY_IN(1:jpi,jj,jk,jl,jf)
                   END DO
@@ -262,15 +262,15 @@
          DO jr = 1, ndim_rank_north         ! recover the global north array
             iproc = nrank_north(jr) + 1
-            iilb  = nimppt(iproc)
-            ilci  = nlcit (iproc)
-            ildi  = nldit (iproc)
-            ilei  = nleit (iproc)
-            IF( iilb            ==      1 )   ildi = 1      ! e-w boundary already done -> force to take 1st column
-            IF( iilb + ilci - 1 == jpiglo )   ilei = ilci   ! e-w boundary already done -> force to take last column
+            iilb  =  nimppt(iproc)
+            ijpi  =  jpiall(iproc)
+            iis0  = nis0all(iproc)
+            iie0  = nie0all(iproc)
+            IF( iilb            ==      1 )   iis0 = 1      ! e-w boundary already done -> force to take 1st column
+            IF( iilb + ijpi - 1 == jpiglo )   iie0 = ijpi   ! e-w boundary already done -> force to take last column
             DO jf = 1, ipf
                DO jl = 1, ipl
                   DO jk = 1, ipk
                      DO jj = 1, ijpj
-                        DO ji = ildi, ilei
+                        DO ji = iis0, iie0
                            ztab(ji+iilb-1,jj,jk,jl,jf) = znorthgloio(ji,jj,jk,jl,jf,jr)
                         END DO
@@ -287,7 +287,7 @@
             DO jl = 1, ipl
                DO jk = 1, ipk
-                  DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to ARRAY_IN
-                     ij = jj - nlcj + ijpj
-                     DO ji= 1, nlci
+                  DO jj = jpj-ijpj+1, jpj             ! Scatter back to ARRAY_IN
+                     ij = jj - jpj + ijpj
+                     DO ji= 1, jpi
                         ARRAY_IN(ji,jj,jk,jl,jf) = ztab(ji+nimpp-1,ij,jk,jl,jf)
                      END DO
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mppini.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mppini.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mppini.F90	(revision 12807)
@@ -59,4 +59,6 @@
       !!----------------------------------------------------------------------
       !
+      jpiglo = Ni0glo
+      jpjglo = Nj0glo
       jpimax = jpiglo
       jpjmax = jpjglo
@@ -76,10 +78,4 @@
       nimpp  = 1           ! 
       njmpp  = 1
-      nlci   = jpi
-      nlcj   = jpj
-      nldi   = 1
-      nldj   = 1
-      nlei   = jpi
-      nlej   = jpj
       nbondi = 2
       nbondj = 2
@@ -131,6 +127,4 @@
       !!                    njmpp     : latitudinal  index
       !!                    narea     : number for local area
-      !!                    nlci      : first dimension
-      !!                    nlcj      : second dimension
       !!                    nbondi    : mark for "east-west local boundary"
       !!                    nbondj    : mark for "north-south local boundary"
@@ -158,8 +152,8 @@
       INTEGER, ALLOCATABLE, DIMENSION(:)     ::   iin, ii_nono, ii_noea          ! 1D workspace
       INTEGER, ALLOCATABLE, DIMENSION(:)     ::   ijn, ii_noso, ii_nowe          !  -     -
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   iimppt, ilci, ibondi, ipproc   ! 2D workspace
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ijmppt, ilcj, ibondj, ipolj    !  -     -
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ilei, ildi, iono, ioea         !  -     -
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ilej, ildj, ioso, iowe         !  -     -
+      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   iimppt, ijpi, ibondi, ipproc   ! 2D workspace
+      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ijmppt, ijpj, ibondj, ipolj    !  -     -
+      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   iie0, iis0, iono, ioea         !  -     -
+      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ije0, ijs0, ioso, iowe         !  -     -
       LOGICAL, ALLOCATABLE, DIMENSION(:,:) ::   llisoce                        !  -     -
       NAMELIST/nambdy/ ln_bdy, nb_bdy, ln_coords_file, cn_coords_file,           &
@@ -194,5 +188,11 @@
       !
       IF(lwm)   WRITE( numond, nammpp )
-
+      !
+!!!------------------------------------
+!!!  nn_hls shloud be read in nammpp
+!!!------------------------------------
+      jpiglo = Ni0glo + 2 * nn_hls
+      jpjglo = Nj0glo + 2 * nn_hls
+      !
       ! do we need to take into account bdy_msk?
       READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903)
@@ -204,10 +204,10 @@
       IF( ln_bdy .AND. ln_mask_file ) CALL iom_open( cn_mask_file, numbdy )
       !
-      IF( ln_listonly )   CALL mpp_init_bestpartition( MAX(mppsize,jpni*jpnj), ldlist = .TRUE. )   ! must be done by all core
+      IF( ln_listonly )   CALL bestpartition( MAX(mppsize,jpni*jpnj), ldlist = .TRUE. )   ! must be done by all core
       !
       !  1. Dimension arrays for subdomains
       ! -----------------------------------
       !
-      ! If dimensions of processor grid weren't specified in the namelist file
+      ! If dimensions of processors grid weren't specified in the namelist file
       ! then we calculate them here now that we have our communicator size
       IF(lwp) THEN
@@ -217,14 +217,14 @@
       ENDIF
       IF( jpni < 1 .OR. jpnj < 1 ) THEN
-         CALL mpp_init_bestpartition( mppsize, jpni, jpnj )           ! best mpi decomposition for mppsize mpi processes
+         CALL bestpartition( mppsize, jpni, jpnj )           ! best mpi decomposition for mppsize mpi processes
          llauto = .TRUE.
          llbest = .TRUE.
       ELSE
          llauto = .FALSE.
-         CALL mpp_init_bestpartition( mppsize, inbi, inbj, icnt2 )    ! best mpi decomposition for mppsize mpi processes
+         CALL bestpartition( mppsize, inbi, inbj, icnt2 )    ! best mpi decomposition for mppsize mpi processes
          ! largest subdomain size for mpi decoposition jpni*jpnj given in the namelist
-         CALL mpp_basic_decomposition( jpni, jpnj, jpimax, jpjmax )
-         ! largest subdomain size for mpi decoposition inbi*inbj given by mpp_init_bestpartition
-         CALL mpp_basic_decomposition( inbi, inbj,  iimax,  ijmax )
+         CALL basic_decomposition( jpiglo, jpjglo, nn_hls, jpni, jpnj, jpimax, jpjmax )
+         ! largest subdomain size for mpi decoposition inbi*inbj given by bestpartition
+         CALL basic_decomposition( jpiglo, jpjglo, nn_hls, inbi, inbj,  iimax,  ijmax )
          icnt1 = jpni*jpnj - mppsize   ! number of land subdomains that should be removed to use mppsize mpi processes
          IF(lwp) THEN
@@ -257,5 +257,5 @@
       ! look for land mpi subdomains...
       ALLOCATE( llisoce(jpni,jpnj) )
-      CALL mpp_init_isoce( jpni, jpnj, llisoce )
+      CALL is_ocean( jpni, jpnj, llisoce )
       inijmin = COUNT( llisoce )   ! number of oce subdomains
 
@@ -266,5 +266,5 @@
          WRITE(ctmp4,*) '   ==>>> There is the list of best domain decompositions you should use: '
          CALL ctl_stop( ctmp1, ctmp2, ctmp3, ' ', ctmp4, ' ' )
-         CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core
+         CALL bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core
       ENDIF
 
@@ -290,5 +290,5 @@
             WRITE(numout,*)
          ENDIF
-         CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core
+         CALL bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core
       ENDIF
 
@@ -318,14 +318,14 @@
       IF( numbdy /= -1 )   CALL iom_close( numbdy )
     
-      ALLOCATE(  nfiimpp(jpni,jpnj), nfipproc(jpni,jpnj), nfilcit(jpni,jpnj) ,    &
-         &       nimppt(jpnij) , ibonit(jpnij) , nlcit(jpnij) , nlcjt(jpnij) ,    &
-         &       njmppt(jpnij) , ibonjt(jpnij) , nldit(jpnij) , nldjt(jpnij) ,    &
-         &                                       nleit(jpnij) , nlejt(jpnij) ,    &
+      ALLOCATE(  nfiimpp(jpni,jpnj), nfipproc(jpni,jpnj), nfijpit(jpni,jpnj) ,    &
+         &       nimppt(jpnij) , ibonit(jpnij) ,  jpiall(jpnij) ,  jpjall(jpnij) ,    &
+         &       njmppt(jpnij) , ibonjt(jpnij) , nis0all(jpnij) , njs0all(jpnij) ,    &
+         &                                       nie0all(jpnij) , nje0all(jpnij) ,    &
          &       iin(jpnij), ii_nono(jpnij), ii_noea(jpnij),   &
          &       ijn(jpnij), ii_noso(jpnij), ii_nowe(jpnij),   &
-         &       iimppt(jpni,jpnj), ilci(jpni,jpnj), ibondi(jpni,jpnj), ipproc(jpni,jpnj),   &
-         &       ijmppt(jpni,jpnj), ilcj(jpni,jpnj), ibondj(jpni,jpnj), ipolj(jpni,jpnj),   &
-         &       ilei(jpni,jpnj), ildi(jpni,jpnj), iono(jpni,jpnj), ioea(jpni,jpnj),   &
-         &       ilej(jpni,jpnj), ildj(jpni,jpnj), ioso(jpni,jpnj), iowe(jpni,jpnj),   &
+         &       iimppt(jpni,jpnj), ijpi(jpni,jpnj), ibondi(jpni,jpnj), ipproc(jpni,jpnj),   &
+         &       ijmppt(jpni,jpnj), ijpj(jpni,jpnj), ibondj(jpni,jpnj),  ipolj(jpni,jpnj),   &
+         &         iie0(jpni,jpnj), iis0(jpni,jpnj),   iono(jpni,jpnj),   ioea(jpni,jpnj),   &
+         &         ije0(jpni,jpnj), ijs0(jpni,jpnj),   ioso(jpni,jpnj),   iowe(jpni,jpnj),   &
          &       STAT=ierr )
       CALL mpp_sum( 'mppini', ierr )
@@ -345,9 +345,7 @@
       ! -----------------------------------
       !
-      nreci = 2 * nn_hls
-      nrecj = 2 * nn_hls
-      CALL mpp_basic_decomposition( jpni, jpnj, jpimax, jpjmax, iimppt, ijmppt, ilci, ilcj )
+      CALL basic_decomposition( jpiglo, jpjglo, nn_hls, jpni, jpnj, jpimax, jpjmax, iimppt, ijmppt, ijpi, ijpj )
       nfiimpp(:,:) = iimppt(:,:)
-      nfilcit(:,:) = ilci(:,:)
+      nfijpit(:,:) = ijpi(:,:)
       !
       IF(lwp) THEN
@@ -359,6 +357,6 @@
          WRITE(numout,*) '      jpnj = ', jpnj
          WRITE(numout,*)
-         WRITE(numout,*) '      sum ilci(i,1) = ', sum(ilci(:,1)), ' jpiglo = ', jpiglo
-         WRITE(numout,*) '      sum ilcj(1,j) = ', sum(ilcj(1,:)), ' jpjglo = ', jpjglo
+         WRITE(numout,*) '      sum ijpi(i,1) = ', sum(ijpi(:,1)), ' jpiglo = ', jpiglo
+         WRITE(numout,*) '      sum ijpj(1,j) = ', sum(ijpj(1,:)), ' jpjglo = ', jpjglo
       ENDIF
      
@@ -375,6 +373,6 @@
          ii = 1 + MOD(iarea0,jpni)
          ij = 1 +     iarea0/jpni
-         ili = ilci(ii,ij)
-         ilj = ilcj(ii,ij)
+         ili = ijpi(ii,ij)
+         ilj = ijpj(ii,ij)
          ibondi(ii,ij) = 0                         ! default: has e-w neighbours
          IF( ii   ==    1 )   ibondi(ii,ij) = -1   ! first column, has only e neighbour
@@ -391,8 +389,8 @@
          ioea(ii,ij) = iarea0 + 1
          iono(ii,ij) = iarea0 + jpni
-         ildi(ii,ij) =  1  + nn_hls
-         ilei(ii,ij) = ili - nn_hls
-         ildj(ii,ij) =  1  + nn_hls
-         ilej(ii,ij) = ilj - nn_hls
+         iis0(ii,ij) =  1  + nn_hls
+         iie0(ii,ij) = ili - nn_hls
+         ijs0(ii,ij) =  1  + nn_hls
+         ije0(ii,ij) = ilj - nn_hls
 
          ! East-West periodicity: change ibondi, ioea, iowe
@@ -500,15 +498,4 @@
          ENDIF
       END DO
-
-      ! Update il[de][ij] according to modified ibond[ij]
-      ! ----------------------
-      DO jproc = 1, jpnij
-         ii = iin(jproc)
-         ij = ijn(jproc)
-         IF( ibondi(ii,ij) == -1 .OR. ibondi(ii,ij) == 2 ) ildi(ii,ij) =  1
-         IF( ibondi(ii,ij) ==  1 .OR. ibondi(ii,ij) == 2 ) ilei(ii,ij) = ilci(ii,ij)
-         IF( ibondj(ii,ij) == -1 .OR. ibondj(ii,ij) == 2 ) ildj(ii,ij) =  1
-         IF( ibondj(ii,ij) ==  1 .OR. ibondj(ii,ij) == 2 ) ilej(ii,ij) = ilcj(ii,ij)
-      END DO
       
       ! 5. Subdomain print
@@ -523,5 +510,5 @@
             DO jj = jpnj, 1, -1
                WRITE(numout,9403) ('   ',ji=il1,il2-1)
-               WRITE(numout,9402) jj, (ilci(ji,jj),ilcj(ji,jj),ji=il1,il2)
+               WRITE(numout,9402) jj, (ijpi(ji,jj),ijpj(ji,jj),ji=il1,il2)
                WRITE(numout,9404) (ipproc(ji,jj),ji=il1,il2)
                WRITE(numout,9403) ('   ',ji=il1,il2-1)
@@ -580,16 +567,14 @@
       noea = ii_noea(narea)
       nono = ii_nono(narea)
-      nlci = ilci(ii,ij)  
-      nldi = ildi(ii,ij)
-      nlei = ilei(ii,ij)
-      nlcj = ilcj(ii,ij)  
-      nldj = ildj(ii,ij)
-      nlej = ilej(ii,ij)
+      jpi    = ijpi(ii,ij)  
+!!$      Nis0  = iis0(ii,ij)
+!!$      Nie0  = iie0(ii,ij)
+      jpj    = ijpj(ii,ij)  
+!!$      Njs0  = ijs0(ii,ij)
+!!$      Nje0  = ije0(ii,ij)
       nbondi = ibondi(ii,ij)
       nbondj = ibondj(ii,ij)
       nimpp = iimppt(ii,ij)  
       njmpp = ijmppt(ii,ij)
-      jpi = nlci
-      jpj = nlcj
       jpk = jpkglo                              ! third dim
 #if defined key_agrif
@@ -609,10 +594,10 @@
          ii = iin(jproc)
          ij = ijn(jproc)
-         nlcit(jproc) = ilci(ii,ij)
-         nldit(jproc) = ildi(ii,ij)
-         nleit(jproc) = ilei(ii,ij)
-         nlcjt(jproc) = ilcj(ii,ij)
-         nldjt(jproc) = ildj(ii,ij)
-         nlejt(jproc) = ilej(ii,ij)
+         jpiall (jproc) = ijpi(ii,ij)
+         nis0all(jproc) = iis0(ii,ij)
+         nie0all(jproc) = iie0(ii,ij)
+         jpjall (jproc) = ijpj(ii,ij)
+         njs0all(jproc) = ijs0(ii,ij)
+         nje0all(jproc) = ije0(ii,ij)
          ibonit(jproc) = ibondi(ii,ij)
          ibonjt(jproc) = ibondj(ii,ij)
@@ -628,10 +613,10 @@
          WRITE(inum,'(6i8,a,3i8,a)') jpnij,jpimax,jpjmax,jpk,jpiglo,jpjglo,&
    &           ' ( local: ',narea,jpi,jpj,' )'
-         WRITE(inum,'(a)') 'nproc nlci nlcj nldi nldj nlei nlej nimp njmp nono noso nowe noea nbondi nbondj '
+         WRITE(inum,'(a)') 'nproc jpi jpj Nis0 Njs0 Nie0 Nje0 nimp njmp nono noso nowe noea nbondi nbondj '
 
          DO jproc = 1, jpnij
-            WRITE(inum,'(13i5,2i7)')   jproc-1, nlcit  (jproc), nlcjt  (jproc),   &
-               &                                nldit  (jproc), nldjt  (jproc),   &
-               &                                nleit  (jproc), nlejt  (jproc),   &
+            WRITE(inum,'(13i5,2i7)')   jproc-1,  jpiall(jproc),  jpjall(jproc),   &
+               &                                nis0all(jproc), njs0all(jproc),   &
+               &                                nie0all(jproc), nje0all(jproc),   &
                &                                nimppt (jproc), njmppt (jproc),   & 
                &                                ii_nono(jproc), ii_noso(jproc),   &
@@ -667,10 +652,6 @@
          WRITE(numout,*) '    l_Iperio = ', l_Iperio
          WRITE(numout,*) '    l_Jperio = ', l_Jperio
-         WRITE(numout,*) '      nlci   = ', nlci
-         WRITE(numout,*) '      nlcj   = ', nlcj
          WRITE(numout,*) '      nimpp  = ', nimpp
          WRITE(numout,*) '      njmpp  = ', njmpp
-         WRITE(numout,*) '      nreci  = ', nreci  
-         WRITE(numout,*) '      nrecj  = ', nrecj  
          WRITE(numout,*) '      nn_hls = ', nn_hls 
       ENDIF
@@ -712,5 +693,5 @@
       DEALLOCATE(iin, ijn, ii_nono, ii_noea, ii_noso, ii_nowe,    &
          &       iimppt, ijmppt, ibondi, ibondj, ipproc, ipolj,   &
-         &       ilci, ilcj, ilei, ilej, ildi, ildj,              &
+         &       ijpi, ijpj, iie0, ije0, iis0, ijs0,              &
          &       iono, ioea, ioso, iowe, llisoce)
       !
@@ -718,7 +699,7 @@
 
 
-    SUBROUTINE mpp_basic_decomposition( knbi, knbj, kimax, kjmax, kimppt, kjmppt, klci, klcj)
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE mpp_basic_decomposition  ***
+    SUBROUTINE basic_decomposition( kiglo, kjglo, khls, knbi, knbj, kimax, kjmax, kimppt, kjmppt, klci, klcj)
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE basic_decomposition  ***
       !!                    
       !! ** Purpose :   Lay out the global domain over processors.
@@ -732,4 +713,6 @@
       !!                    klcj       : second dimension
       !!----------------------------------------------------------------------
+      INTEGER,                                 INTENT(in   ) ::   kiglo, kjglo
+      INTEGER,                                 INTENT(in   ) ::   khls
       INTEGER,                                 INTENT(in   ) ::   knbi, knbj
       INTEGER,                                 INTENT(  out) ::   kimax, kjmax
@@ -738,14 +721,15 @@
       !
       INTEGER ::   ji, jj
+      INTEGER ::   i2hls 
       INTEGER ::   iresti, irestj, irm, ijpjmin
-      INTEGER ::   ireci, irecj
-      !!----------------------------------------------------------------------
+      !!----------------------------------------------------------------------
+      i2hls = 2*khls
       !
 #if defined key_nemocice_decomp
-      kimax = ( nx_global+2-2*nn_hls + (knbi-1) ) / knbi + 2*nn_hls    ! first  dim.
-      kjmax = ( ny_global+2-2*nn_hls + (knbj-1) ) / knbj + 2*nn_hls    ! second dim. 
+      kimax = ( nx_global+2-i2hls + (knbi-1) ) / knbi + i2hls    ! first  dim.
+      kjmax = ( ny_global+2-i2hls + (knbj-1) ) / knbj + i2hls    ! second dim. 
 #else
-      kimax = ( jpiglo - 2*nn_hls + (knbi-1) ) / knbi + 2*nn_hls    ! first  dim.
-      kjmax = ( jpjglo - 2*nn_hls + (knbj-1) ) / knbj + 2*nn_hls    ! second dim.
+      kimax = ( kiglo - i2hls + (knbi-1) ) / knbi + i2hls    ! first  dim.
+      kjmax = ( kjglo - i2hls + (knbj-1) ) / knbj + i2hls    ! second dim.
 #endif
       IF( .NOT. PRESENT(kimppt) ) RETURN
@@ -754,25 +738,23 @@
       ! -----------------------------------
       !  Computation of local domain sizes klci() klcj()
-      !  These dimensions depend on global sizes knbi,knbj and jpiglo,jpjglo
+      !  These dimensions depend on global sizes knbi,knbj and kiglo,kjglo
       !  The subdomains are squares lesser than or equal to the global
       !  dimensions divided by the number of processors minus the overlap array.
       !
-      ireci = 2 * nn_hls
-      irecj = 2 * nn_hls
-      iresti = 1 + MOD( jpiglo - ireci -1 , knbi )
-      irestj = 1 + MOD( jpjglo - irecj -1 , knbj )
+      iresti = 1 + MOD( kiglo - i2hls - 1 , knbi )
+      irestj = 1 + MOD( kjglo - i2hls - 1 , knbj )
       !
       !  Need to use kimax and kjmax here since jpi and jpj not yet defined
 #if defined key_nemocice_decomp
       ! Change padding to be consistent with CICE
-      klci(1:knbi-1      ,:) = kimax
-      klci(knbi          ,:) = jpiglo - (knbi - 1) * (kimax - nreci)
-      klcj(:,      1:knbj-1) = kjmax
-      klcj(:,          knbj) = jpjglo - (knbj - 1) * (kjmax - nrecj)
+      klci(1:knbi-1,:       ) = kimax
+      klci(  knbi  ,:       ) = kiglo - (knbi - 1) * (kimax - i2hls)
+      klcj(:       ,1:knbj-1) = kjmax
+      klcj(:       ,  knbj  ) = kjglo - (knbj - 1) * (kjmax - i2hls)
 #else
       klci(1:iresti      ,:) = kimax
       klci(iresti+1:knbi ,:) = kimax-1
-      IF( MINVAL(klci) < 3 ) THEN
-         WRITE(ctmp1,*) '   mpp_basic_decomposition: minimum value of jpi must be >= 3'
+      IF( MINVAL(klci) < 2*i2hls ) THEN
+         WRITE(ctmp1,*) '   basic_decomposition: minimum value of jpi must be >= ', 2*i2hls
          WRITE(ctmp2,*) '   We have ', MINVAL(klci)
         CALL ctl_stop( 'STOP', ctmp1, ctmp2 )
@@ -780,19 +762,17 @@
       IF( jperio == 3 .OR. jperio == 4 .OR. jperio == 5 .OR. jperio == 6 ) THEN
          ! minimize the size of the last row to compensate for the north pole folding coast
-         IF( jperio == 3 .OR. jperio == 4 )   ijpjmin = 5   ! V and F folding involves line jpj-3 that must not be south boundary
-         IF( jperio == 5 .OR. jperio == 6 )   ijpjmin = 4   ! V and F folding involves line jpj-2 that must not be south boundary
-         irm = knbj - irestj                                    ! total number of lines to be removed
-         klcj(:,            knbj) = MAX( ijpjmin, kjmax-irm )   ! we must have jpj >= ijpjmin in the last row
-         irm = irm - ( kjmax - klcj(1,knbj) )                   ! remaining number of lines to remove 
-         irestj = knbj - 1 - irm                        
-         klcj(:,        1:irestj) = kjmax
+         IF( jperio == 3 .OR. jperio == 4 )   ijpjmin = 2+3*khls   ! V and F folding must be outside of southern halos
+         IF( jperio == 5 .OR. jperio == 6 )   ijpjmin = 1+3*khls   ! V and F folding must be outside of southern halos
+         irm = knbj - irestj                                       ! total number of lines to be removed
+         klcj(:,knbj) = MAX( ijpjmin, kjmax-irm )                  ! we must have jpj >= ijpjmin in the last row
+         irm = irm - ( kjmax - klcj(1,knbj) )                      ! remaining number of lines to remove 
+         irestj = knbj - 1 - irm
          klcj(:, irestj+1:knbj-1) = kjmax-1
       ELSE
-         ijpjmin = 3
-         klcj(:,      1:irestj) = kjmax
-         klcj(:, irestj+1:knbj) = kjmax-1
-      ENDIF
-      IF( MINVAL(klcj) < ijpjmin ) THEN
-         WRITE(ctmp1,*) '   mpp_basic_decomposition: minimum value of jpj must be >= ', ijpjmin
+         klcj(:, irestj+1:knbj  ) = kjmax-1
+      ENDIF
+      klcj(:,1:irestj) = kjmax
+      IF( MINVAL(klcj) < 2*i2hls ) THEN
+         WRITE(ctmp1,*) '   basic_decomposition: minimum value of jpj must be >= ', 2*i2hls
          WRITE(ctmp2,*) '   We have ', MINVAL(klcj)
          CALL ctl_stop( 'STOP', ctmp1, ctmp2 )
@@ -808,5 +788,5 @@
          DO jj = 1, knbj
             DO ji = 2, knbi
-               kimppt(ji,jj) = kimppt(ji-1,jj) + klci(ji-1,jj) - ireci
+               kimppt(ji,jj) = kimppt(ji-1,jj) + klci(ji-1,jj) - 2 * nn_hls
             END DO
          END DO
@@ -816,15 +796,15 @@
          DO jj = 2, knbj
             DO ji = 1, knbi
-               kjmppt(ji,jj) = kjmppt(ji,jj-1) + klcj(ji,jj-1) - irecj
+               kjmppt(ji,jj) = kjmppt(ji,jj-1) + klcj(ji,jj-1) - 2 * nn_hls
             END DO
          END DO
       ENDIF
       
-   END SUBROUTINE mpp_basic_decomposition
-
-
-   SUBROUTINE mpp_init_bestpartition( knbij, knbi, knbj, knbcnt, ldlist )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE mpp_init_bestpartition  ***
+   END SUBROUTINE basic_decomposition
+
+
+   SUBROUTINE bestpartition( knbij, knbi, knbj, knbcnt, ldlist )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE bestpartition  ***
       !!
       !! ** Purpose :
@@ -877,5 +857,5 @@
          iszitst = ( nx_global+2-2*nn_hls + (ji-1) ) / ji + 2*nn_hls    ! first  dim.
 #else
-         iszitst = ( jpiglo - 2*nn_hls + (ji-1) ) / ji + 2*nn_hls
+         iszitst = ( Ni0glo + (ji-1) ) / ji + 2*nn_hls
 #endif
          IF( iszitst < isziref ) THEN
@@ -888,5 +868,5 @@
          iszjtst = ( ny_global+2-2*nn_hls + (ji-1) ) / ji + 2*nn_hls    ! first  dim.
 #else
-         iszjtst = ( jpjglo - 2*nn_hls + (ji-1) ) / ji + 2*nn_hls
+         iszjtst = ( Nj0glo + (ji-1) ) / ji + 2*nn_hls
 #endif
          IF( iszjtst < iszjref ) THEN
@@ -976,10 +956,10 @@
          ji = isz0   ! initialization with the largest value
          ALLOCATE( llisoce(inbi0(ji), inbj0(ji)) )
-         CALL mpp_init_isoce( inbi0(ji), inbj0(ji), llisoce ) ! Warning: must be call by all cores (call mpp_sum)
+         CALL is_ocean( inbi0(ji), inbj0(ji), llisoce ) ! Warning: must be call by all cores (call mpp_sum)
          inbijold = COUNT(llisoce)
          DEALLOCATE( llisoce )
          DO ji =isz0-1,1,-1
             ALLOCATE( llisoce(inbi0(ji), inbj0(ji)) )
-            CALL mpp_init_isoce( inbi0(ji), inbj0(ji), llisoce ) ! Warning: must be call by all cores (call mpp_sum)
+            CALL is_ocean( inbi0(ji), inbj0(ji), llisoce ) ! Warning: must be call by all cores (call mpp_sum)
             inbij = COUNT(llisoce)
             DEALLOCATE( llisoce )
@@ -1007,5 +987,5 @@
          ii = ii -1 
          ALLOCATE( llisoce(inbi0(ii), inbj0(ii)) )
-         CALL mpp_init_isoce( inbi0(ii), inbj0(ii), llisoce )            ! must be done by all core
+         CALL is_ocean( inbi0(ii), inbj0(ii), llisoce )            ! must be done by all core
          inbij = COUNT(llisoce)
          DEALLOCATE( llisoce )
@@ -1016,5 +996,5 @@
       DEALLOCATE( inbi0, inbj0 )
       !
-   END SUBROUTINE mpp_init_bestpartition
+   END SUBROUTINE bestpartition
    
    
@@ -1025,5 +1005,5 @@
       !! ** Purpose : the the proportion of land points in the surface land-sea mask
       !!
-      !! ** Method  : read iproc strips (of length jpiglo) of the land-sea mask
+      !! ** Method  : read iproc strips (of length Ni0glo) of the land-sea mask
       !!----------------------------------------------------------------------
       REAL(wp), INTENT(  out) :: propland    ! proportion of land points in the global domain (between 0 and 1)
@@ -1042,5 +1022,5 @@
 
       ! number of processes reading the bathymetry file 
-      iproc = MINVAL( (/mppsize, jpjglo/2, 100/) )  ! read a least 2 lines, no more that 100 processes reading at the same time
+      iproc = MINVAL( (/mppsize, Nj0glo/2, 100/) )  ! read a least 2 lines, no more that 100 processes reading at the same time
       
       ! we want to read iproc strips of the land-sea mask. -> pick up iproc processes every idiv processes starting at 1
@@ -1052,10 +1032,10 @@
       IF( MOD( narea-1, idiv ) == 0 .AND. iarea < iproc ) THEN   ! beware idiv can be = to 1
          !
-         ijsz = jpjglo / iproc                                               ! width of the stripe to read
-         IF( iarea < MOD(jpjglo,iproc) ) ijsz = ijsz + 1
-         ijstr = iarea*(jpjglo/iproc) + MIN(iarea, MOD(jpjglo,iproc)) + 1    ! starting j position of the reading
-         !
-         ALLOCATE( lloce(jpiglo, ijsz) )                                     ! allocate the strip
-         CALL mpp_init_readbot_strip( ijstr, ijsz, lloce )
+         ijsz = Nj0glo / iproc                                               ! width of the stripe to read
+         IF( iarea < MOD(Nj0glo,iproc) ) ijsz = ijsz + 1
+         ijstr = iarea*(Nj0glo/iproc) + MIN(iarea, MOD(Nj0glo,iproc)) + 1    ! starting j position of the reading
+         !
+         ALLOCATE( lloce(Ni0glo, ijsz) )                                     ! allocate the strip
+         CALL readbot_strip( ijstr, ijsz, lloce )
          inboce = COUNT(lloce)                                               ! number of ocean point in the stripe
          DEALLOCATE(lloce)
@@ -1066,10 +1046,10 @@
       CALL mpp_sum( 'mppini', inboce )   ! total number of ocean points over the global domain
       !
-      propland = REAL( jpiglo*jpjglo - inboce, wp ) / REAL( jpiglo*jpjglo, wp ) 
+      propland = REAL( Ni0glo*Nj0glo - inboce, wp ) / REAL( Ni0glo*Nj0glo, wp ) 
       !
    END SUBROUTINE mpp_init_landprop
    
    
-   SUBROUTINE mpp_init_isoce( knbi, knbj, ldisoce )
+   SUBROUTINE is_ocean( knbi, knbj, ldisoce )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE mpp_init_nboce  ***
@@ -1078,5 +1058,5 @@
       !!              subdomains contain at least 1 ocean point
       !!
-      !! ** Method  : read knbj strips (of length jpiglo) of the land-sea mask
+      !! ** Method  : read knbj strips (of length Ni0glo) of the land-sea mask
       !!----------------------------------------------------------------------
       INTEGER,                       INTENT(in   ) ::   knbi, knbj     ! domain decomposition
@@ -1088,6 +1068,6 @@
       INTEGER :: ji, jn
       LOGICAL, ALLOCATABLE, DIMENSION(:,:) ::   lloce                  ! lloce(i,j) = .true. if the point (i,j) is ocean 
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   iimppt, ilci
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ijmppt, ilcj
+      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   iimppt, ijpi
+      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ijmppt, ijpj
       !!----------------------------------------------------------------------
       ! do nothing if there is no land-sea mask
@@ -1109,15 +1089,15 @@
          IF( MOD( narea-1, idiv ) == 0 .AND. iarea < knbj ) THEN   ! beware idiv can be = to 1
             !
-            ALLOCATE( iimppt(knbi,knbj), ijmppt(knbi,knbj), ilci(knbi,knbj), ilcj(knbi,knbj) )
-            CALL mpp_basic_decomposition( knbi, knbj, iimax, ijmax, iimppt, ijmppt, ilci, ilcj )
+            ALLOCATE( iimppt(knbi,knbj), ijmppt(knbi,knbj), ijpi(knbi,knbj), ijpj(knbi,knbj) )
+            CALL basic_decomposition( Ni0glo, Nj0glo, 0, knbi, knbj, iimax, ijmax, iimppt, ijmppt, ijpi, ijpj )
             !
-            ALLOCATE( lloce(jpiglo, ilcj(1,iarea+1)) )                                         ! allocate the strip
-            CALL mpp_init_readbot_strip( ijmppt(1,iarea+1), ilcj(1,iarea+1), lloce )           ! read the strip
+            ALLOCATE( lloce(Ni0glo, ijpj(1,iarea+1)) )                       ! allocate the strip
+            CALL readbot_strip( ijmppt(1,iarea+1), ijpj(1,iarea+1), lloce )           ! read the strip
             DO  ji = 1, knbi
-               inboce(ji,iarea+1) = COUNT( lloce(iimppt(ji,1):iimppt(ji,1)+ilci(ji,1)-1,:) )   ! number of ocean point in subdomain
+               inboce(ji,iarea+1) = COUNT( lloce(iimppt(ji,1):iimppt(ji,1)+ijpi(ji,1)-1,:) )   ! number of ocean point in subdomain
             END DO
             !
             DEALLOCATE(lloce)
-            DEALLOCATE(iimppt, ijmppt, ilci, ilcj)
+            DEALLOCATE(iimppt, ijmppt, ijpi, ijpj)
             !
          ENDIF
@@ -1129,10 +1109,10 @@
       ldisoce(:,:) = inboce(:,:) /= 0
       !
-   END SUBROUTINE mpp_init_isoce
+   END SUBROUTINE is_ocean
    
    
-   SUBROUTINE mpp_init_readbot_strip( kjstr, kjcnt, ldoce )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE mpp_init_readbot_strip  ***
+   SUBROUTINE readbot_strip( kjstr, kjcnt, ldoce )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE readbot_strip  ***
       !!
       !! ** Purpose : Read relevant bathymetric information in order to
@@ -1140,31 +1120,31 @@
       !!              of land domains, in an mpp computation.
       !!
-      !! ** Method  : read stipe of size (jpiglo,...)
+      !! ** Method  : read stipe of size (Ni0glo,...)
       !!----------------------------------------------------------------------
       INTEGER                         , INTENT(in   ) :: kjstr       ! starting j position of the reading
       INTEGER                         , INTENT(in   ) :: kjcnt       ! number of lines to read
-      LOGICAL, DIMENSION(jpiglo,kjcnt), INTENT(  out) :: ldoce       ! ldoce(i,j) = .true. if the point (i,j) is ocean 
+      LOGICAL, DIMENSION(Ni0glo,kjcnt), INTENT(  out) :: ldoce       ! ldoce(i,j) = .true. if the point (i,j) is ocean 
       !
       INTEGER                           ::   inumsave                ! local logical unit
-      REAL(wp), DIMENSION(jpiglo,kjcnt) ::   zbot, zbdy 
+      REAL(wp), DIMENSION(Ni0glo,kjcnt) ::   zbot, zbdy 
       !!----------------------------------------------------------------------
       !
       inumsave = numout   ;   numout = numnul   !   redirect all print to /dev/null
       !
-      IF( numbot /= -1 ) THEN
-         CALL iom_get( numbot, jpdom_unknown, 'bottom_level', zbot, kstart = (/1,kjstr/), kcount = (/jpiglo, kjcnt/) )
+      IF( numbot /= -1 ) THEN   
+         CALL iom_get( numbot, jpdom_unknown, 'bottom_level', zbot, kstart = (/1,kjstr/), kcount = (/Ni0glo, kjcnt/) )
       ELSE
-         zbot(:,:) = 1.                         ! put a non-null value
-      ENDIF
-
-       IF( numbdy /= -1 ) THEN                  ! Adjust with bdy_msk if it exists    
-         CALL iom_get ( numbdy, jpdom_unknown, 'bdy_msk', zbdy, kstart = (/1,kjstr/), kcount = (/jpiglo, kjcnt/) )
+         zbot(:,:) = 1._wp                      ! put a non-null value
+      ENDIF
+      !
+      IF( numbdy /= -1 ) THEN                   ! Adjust with bdy_msk if it exists    
+         CALL iom_get ( numbdy, jpdom_unknown,     'bdy_msk', zbdy, kstart = (/1,kjstr/), kcount = (/Ni0glo, kjcnt/) )
          zbot(:,:) = zbot(:,:) * zbdy(:,:)
       ENDIF
       !
-      ldoce(:,:) = zbot(:,:) > 0.
+      ldoce(:,:) = zbot(:,:) > 0._wp
       numout = inumsave
       !
-   END SUBROUTINE mpp_init_readbot_strip
+   END SUBROUTINE readbot_strip
 
 
@@ -1190,13 +1170,13 @@
       iglo(1) = jpiglo
       iglo(2) = jpjglo
-      iloc(1) = nlci
-      iloc(2) = nlcj
+      iloc(1) = jpi
+      iloc(2) = jpj
       iabsf(1) = nimppt(narea)
       iabsf(2) = njmppt(narea)
       iabsl(:) = iabsf(:) + iloc(:) - 1
-      ihals(1) = nldi - 1
-      ihals(2) = nldj - 1
-      ihale(1) = nlci - nlei
-      ihale(2) = nlcj - nlej
+      ihals(1) = Nis0 - 1
+      ihals(2) = Njs0 - 1
+      ihale(1) = jpi - Nie0
+      ihale(2) = jpj - Nje0
       idid(1) = 1
       idid(2) = 2
@@ -1239,5 +1219,5 @@
          !
          !sxM is the first point (in the global domain) needed to compute the north-fold for the current process
-         sxM = jpiglo - nimppt(narea) - nlcit(narea) + 1
+         sxM = jpiglo - nimppt(narea) - jpiall(narea) + 1
          !dxM is the last point (in the global domain) needed to compute the north-fold for the current process
          dxM = jpiglo - nimppt(narea) + 2
@@ -1249,5 +1229,5 @@
             !
             sxT = nfiimpp(jn, jpnj)                            ! sxT = 1st  point (in the global domain) of the jn process
-            dxT = nfiimpp(jn, jpnj) + nfilcit(jn, jpnj) - 1    ! dxT = last point (in the global domain) of the jn process
+            dxT = nfiimpp(jn, jpnj) + nfijpit(jn, jpnj) - 1    ! dxT = last point (in the global domain) of the jn process
             !
             IF    ( sxT < sxM  .AND.  sxM < dxT ) THEN
@@ -1281,21 +1261,28 @@
       IF(     nn_hls == 1 ) THEN          !* halo size of 1
          !
-         nIs_0 =   2     ;   nIs_1 =   1     ;   nIs_1nxt2 = nIs_0   ;   nIs_2 = nIs_1
-         nJs_0 =   2     ;   nJs_1 =   1     ;   nJs_1nxt2 = nJs_0   ;   nJs_2 = nJs_1
+         Nis0 =   2     ;   Nis1 =   1     ;   Nis1nxt2 = Nis0   ;   Nis2 = Nis1
+         Njs0 =   2     ;   Njs1 =   1     ;   Njs1nxt2 = Njs0   ;   Njs2 = Njs1
          !                                   
-         nIe_0 = jpi-1   ;   nIe_1 = jpi     ;   nIe_1nxt2 = nIe_0   ;   nIe_2 = nIe_1
-         nJe_0 = jpj-1   ;   nJe_1 = jpj     ;   nJe_1nxt2 = nJe_0   ;   nJe_2 = nJe_1
+         Nie0 = jpi-1   ;   Nie1 = jpi     ;   Nie1nxt2 = Nie0   ;   Nie2 = Nie1
+         Nje0 = jpj-1   ;   Nje1 = jpj     ;   Nje1nxt2 = Nje0   ;   Nje2 = Nje1
          !
       ELSEIF( nn_hls == 2 ) THEN          !* halo size of 2
          !
-         nIs_0 =   3     ;   nIs_1 =   2     ;   nIs_1nxt2 = nIs_1   ;   nIs_2 =   1
-         nJs_0 =   3     ;   nJs_1 =   2     ;   nJs_1nxt2 = nJs_1   ;   nJs_2 =   1
+         Nis0 =   3     ;   Nis1 =   2     ;   Nis1nxt2 = Nis1   ;   Nis2 =   1
+         Njs0 =   3     ;   Njs1 =   2     ;   Njs1nxt2 = Njs1   ;   Njs2 =   1
          !                                                              
-         nIe_0 = jpi-2   ;   nIe_1 = jpi-1   ;   nIe_1nxt2 = nIe_1   ;   nIe_2 = jpi
-         nJe_0 = jpj-2   ;   nJe_1 = jpj-1   ;   nJe_1nxt2 = nJe_1   ;   nJe_2 = jpj
+         Nie0 = jpi-2   ;   Nie1 = jpi-1   ;   Nie1nxt2 = Nie1   ;   Nie2 = jpi
+         Nje0 = jpj-2   ;   Nje1 = jpj-1   ;   Nje1nxt2 = Nje1   ;   Nje2 = jpj
          !
       ELSE                                !* unexpected halo size
          CALL ctl_stop( 'STOP', 'ini_mpp:  wrong value of halo size : nn_hls= 1 or 2 only !')
       ENDIF
+      !
+      Ni_0 = Nie0 - Nis0 + 1
+      Nj_0 = Nje0 - Njs0 + 1
+      Ni_1 = Nie1 - Nis1 + 1
+      Nj_1 = Nje1 - Njs1 + 1
+      Ni_2 = Nie2 - Nis2 + 1
+      Nj_2 = Nje2 - Njs2 + 1
       !
    END SUBROUTINE init_doloop
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/find_obs_proc.h90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/find_obs_proc.h90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/find_obs_proc.h90	(revision 12807)
@@ -41,5 +41,5 @@
       ! first and last indoor i- and j-indexes      kldi, klei,   kldj, klej
       ! exclude any obs in the bottom-left overlap region
-      ! also any obs outside to whole region (defined by nlci and nlcj)
+      ! also any obs outside to whole region (defined by jpi and jpj)
       ! I am assuming that kobsp does not need to be the correct processor 
       ! number
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/mpp_map.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/mpp_map.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/mpp_map.F90	(revision 12807)
@@ -12,5 +12,5 @@
    USE par_kind, ONLY :   wp            ! Precision variables
    USE par_oce , ONLY :   jpi, jpj      ! Ocean parameters
-   USE dom_oce , ONLY :   mig, mjg, nldi, nlei, nldj, nlej, nlci, nlcj, narea   ! Ocean space and time domain variables
+   USE dom_oce , ONLY :   mig, mjg, Nis0, Nie0, Njs0, Nje0, jpi, jpj, narea   ! Ocean space and time domain variables
 #if defined key_mpp_mpi
    USE lib_mpp, ONLY :   mpi_comm_oce   ! MPP library
@@ -65,5 +65,5 @@
 
 !      ! Setup local grid points
-      imppmap(mig(1):mig(nlci),mjg(1):mjg(nlcj)) = narea
+      imppmap(mig(1):mig(jpi),mjg(1):mjg(jpj)) = narea
       
       ! Get global data
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/obs_grid.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/obs_grid.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/OBS/obs_grid.F90	(revision 12807)
@@ -129,5 +129,5 @@
             IF ( cdgrid == 'T' ) THEN
                CALL obs_grd_bruteforce( jpi, jpj, jpiglo, jpjglo, &
-                  &                             1, nlci, 1, nlcj,         &
+                  &                             1, jpi, 1, jpj,           &
                   &                             nproc, jpnij,             &
                   &                             glamt, gphit, tmask,      &
@@ -136,5 +136,5 @@
             ELSEIF ( cdgrid == 'U' ) THEN
                CALL obs_grd_bruteforce( jpi, jpj, jpiglo, jpjglo, &
-                  &                             1, nlci, 1, nlcj,         &
+                  &                             1, jpi, 1, jpj,           &
                   &                             nproc, jpnij,             &
                   &                             glamu, gphiu, umask,      &
@@ -143,5 +143,5 @@
             ELSEIF ( cdgrid == 'V' ) THEN
                CALL obs_grd_bruteforce( jpi, jpj, jpiglo, jpjglo, &
-                  &                             1, nlci, 1, nlcj,         &
+                  &                             1, jpi, 1, jpj,           &
                   &                             nproc, jpnij,             &
                   &                             glamv, gphiv, vmask,      &
@@ -150,5 +150,5 @@
             ELSEIF ( cdgrid == 'F' ) THEN
                CALL obs_grd_bruteforce( jpi, jpj, jpiglo, jpjglo, &
-                  &                             1, nlci, 1, nlcj,         &
+                  &                             1, jpi, 1, jpj,           &
                   &                             nproc, jpnij,             &
                   &                             glamf, gphif, fmask,      &
@@ -279,6 +279,6 @@
          zmskg(:,:) = -1.e+10
          ! Add various grids here.
-         DO jj = 1, nlcj
-            DO ji = 1, nlci
+         DO jj = 1, jpj
+            DO ji = 1, jpi
                zlamg(mig(ji),mjg(jj)) = glamt(ji,jj)
                zphig(mig(ji),mjg(jj)) = gphit(ji,jj)
@@ -816,5 +816,5 @@
             
             CALL obs_grd_bruteforce( jpi, jpj, jpiglo, jpjglo,  &
-               &                     1, nlci, 1, nlcj,          &
+               &                     1, jpi, 1, jpj,            &
                &                     nproc, jpnij,              &
                &                     glamt, gphit, tmask,       &
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/cpl_oasis3.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/cpl_oasis3.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/cpl_oasis3.F90	(revision 12807)
@@ -70,6 +70,6 @@
    INTEGER, PUBLIC, PARAMETER ::   nmaxcpl=5    ! Maximum number of coupling fields
    LOGICAL, PARAMETER         ::   ltmp_wapatch = .TRUE.   ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define  
-   INTEGER                    ::   nldi_save, nlei_save
-   INTEGER                    ::   nldj_save, nlej_save
+   INTEGER                    ::   Nis0_save, Nie0_save
+   INTEGER                    ::   Njs0_save, Nje0_save
    
    TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information
@@ -150,10 +150,10 @@
       ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define
       IF( ltmp_wapatch ) THEN
-         nldi_save = nldi   ;   nlei_save = nlei
-         nldj_save = nldj   ;   nlej_save = nlej
-         IF( nimpp           ==      1 ) nldi = 1
-         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
-         IF( njmpp           ==      1 ) nldj = 1
-         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+         Nis0_save = Nis0   ;   Nie0_save = Nie0
+         Njs0_save = Njs0   ;   Nje0_save = Nje0
+         IF( nimpp           ==      1 ) Nis0 = 1
+         IF( nimpp + jpi - 1 == jpiglo ) Nie0 = jpi
+         IF( njmpp           ==      1 ) Njs0 = 1
+         IF( njmpp + jpj - 1 == jpjglo ) Nje0 = jpj
       ENDIF 
       IF(lwp) WRITE(numout,*)
@@ -182,11 +182,11 @@
       !
       ishape(1) = 1
-      ishape(2) = nlei-nldi+1
+      ishape(2) = Ni_0
       ishape(3) = 1
-      ishape(4) = nlej-nldj+1
+      ishape(4) = Nj_0
       !
       ! ... Allocate memory for data exchange
       !
-      ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror)
+      ALLOCATE(exfld(Ni_0, Nj_0), stat = nerror)
       IF( nerror > 0 ) THEN
          CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld')   ;   RETURN
@@ -198,7 +198,7 @@
       
       paral(1) = 2                                              ! box partitioning
-      paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1)   ! NEMO lower left corner global offset    
-      paral(3) = nlei-nldi+1                                    ! local extent in i 
-      paral(4) = nlej-nldj+1                                    ! local extent in j
+      paral(2) = jpiglo * (Njs0-1+njmpp-1) + (Nis0-1+nimpp-1)   ! NEMO lower left corner global offset    
+      paral(3) = Ni_0                                           ! local extent in i 
+      paral(4) = Nj_0                                           ! local extent in j
       paral(5) = jpiglo                                         ! global extent in x
       
@@ -206,6 +206,6 @@
          WRITE(numout,*) ' multiexchg: paral (1:5)', paral
          WRITE(numout,*) ' multiexchg: jpi, jpj =', jpi, jpj
-         WRITE(numout,*) ' multiexchg: nldi, nlei, nimpp =', nldi, nlei, nimpp
-         WRITE(numout,*) ' multiexchg: nldj, nlej, njmpp =', nldj, nlej, njmpp
+         WRITE(numout,*) ' multiexchg: Nis0, Nie0, nimpp =', Nis0, Nie0, nimpp
+         WRITE(numout,*) ' multiexchg: Njs0, Nje0, njmpp =', Njs0, Nje0, njmpp
       ENDIF
    
@@ -317,6 +317,6 @@
       !
       IF( ltmp_wapatch ) THEN
-         nldi = nldi_save   ;   nlei = nlei_save
-         nldj = nldj_save   ;   nlej = nlej_save
+         Nis0 = Nis0_save   ;   Nie0 = Nie0_save
+         Njs0 = Njs0_save   ;   Nje0 = Nje0_save
       ENDIF
    END SUBROUTINE cpl_define
@@ -339,10 +339,10 @@
       ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define
       IF( ltmp_wapatch ) THEN
-         nldi_save = nldi   ;   nlei_save = nlei
-         nldj_save = nldj   ;   nlej_save = nlej
-         IF( nimpp           ==      1 ) nldi = 1
-         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
-         IF( njmpp           ==      1 ) nldj = 1
-         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+         Nis0_save = Nis0   ;   Nie0_save = Nie0
+         Njs0_save = Njs0   ;   Nje0_save = Nje0
+         IF( nimpp           ==      1 ) Nis0 = 1
+         IF( nimpp + jpi - 1 == jpiglo ) Nie0 = jpi
+         IF( njmpp           ==      1 ) Njs0 = 1
+         IF( njmpp + jpj - 1 == jpjglo ) Nje0 = jpj
       ENDIF
       !
@@ -353,5 +353,5 @@
         
             IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN
-               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo )
+               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(Nis0:Nie0, Njs0:Nje0,jc), kinfo )
                
                IF ( sn_cfctl%l_oasout ) THEN        
@@ -363,7 +363,7 @@
                      WRITE(numout,*) 'oasis_put:  kstep ', kstep
                      WRITE(numout,*) 'oasis_put:   info ', kinfo
-                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(nldi:nlei,nldj:nlej,jc))
+                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(Nis0:Nie0,Njs0:Nje0,jc))
                      WRITE(numout,*) '****************'
                   ENDIF
@@ -375,6 +375,6 @@
       ENDDO
       IF( ltmp_wapatch ) THEN
-         nldi = nldi_save   ;   nlei = nlei_save
-         nldj = nldj_save   ;   nlej = nlej_save
+         Nis0 = Nis0_save   ;   Nie0 = Nie0_save
+         Njs0 = Njs0_save   ;   Nje0 = Nje0_save
       ENDIF
       !
@@ -400,6 +400,6 @@
       ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define
       IF( ltmp_wapatch ) THEN
-         nldi_save = nldi   ;   nlei_save = nlei
-         nldj_save = nldj   ;   nlej_save = nlej
+         Nis0_save = Nis0   ;   Nie0_save = Nie0
+         Njs0_save = Njs0   ;   Nje0_save = Nje0
       ENDIF
       !
@@ -410,8 +410,8 @@
       DO jc = 1, srcv(kid)%nct
          IF( ltmp_wapatch ) THEN
-            IF( nimpp           ==      1 ) nldi = 1
-            IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
-            IF( njmpp           ==      1 ) nldj = 1
-            IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+            IF( nimpp           ==      1 ) Nis0 = 1
+            IF( nimpp + jpi - 1 == jpiglo ) Nie0 = jpi
+            IF( njmpp           ==      1 ) Njs0 = 1
+            IF( njmpp + jpj - 1 == jpjglo ) Nje0 = jpj
          ENDIF
          llfisrt = .TRUE.
@@ -432,8 +432,9 @@
                   kinfo = OASIS_Rcv
                   IF( llfisrt ) THEN 
-                     pdata(nldi:nlei,nldj:nlej,jc) =                                 exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
+                     pdata(Nis0:Nie0,Njs0:Nje0,jc) =   exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm)
                      llfisrt = .FALSE.
                   ELSE
-                     pdata(nldi:nlei,nldj:nlej,jc) = pdata(nldi:nlei,nldj:nlej,jc) + exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
+                     pdata(Nis0:Nie0,Njs0:Nje0,jc) = pdata(Nis0:Nie0,Njs0:Nje0,jc)   &
+                        &                                + exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm)
                   ENDIF
                   
@@ -444,7 +445,7 @@
                      WRITE(numout,*) 'oasis_get:   kstep', kstep
                      WRITE(numout,*) 'oasis_get:   info ', kinfo
-                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(nldi:nlei,nldj:nlej,jc))
+                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(Nis0:Nie0,Njs0:Nje0,jc))
                      WRITE(numout,*) '****************'
                   ENDIF
@@ -457,6 +458,6 @@
 
          IF( ltmp_wapatch ) THEN
-            nldi = nldi_save   ;   nlei = nlei_save
-            nldj = nldj_save   ;   nlej = nlej_save
+            Nis0 = Nis0_save   ;   Nie0 = Nie0_save
+            Njs0 = Njs0_save   ;   Nje0 = Nje0_save
          ENDIF
          !--- Fill the overlap areas and extra hallows (mpp)
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbccpl.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbccpl.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbccpl.F90	(revision 12807)
@@ -1036,6 +1036,6 @@
          xcplmask(:,:,:) = 0.
          CALL iom_open( 'cplmask', inum )
-         CALL iom_get( inum, jpdom_unknown, 'cplmask', xcplmask(1:nlci,1:nlcj,1:nn_cplmodel),   &
-            &          kstart = (/ mig(1),mjg(1),1 /), kcount = (/ nlci,nlcj,nn_cplmodel /) )
+         CALL iom_get( inum, jpdom_unknown, 'cplmask', xcplmask(1:jpi,1:jpj,1:nn_cplmodel),   &
+            &          kstart = (/ mig(1),mjg(1),1 /), kcount = (/ jpi,jpj,nn_cplmodel /) )
          CALL iom_close( inum )
       ELSE
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcice_cice.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcice_cice.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcice_cice.F90	(revision 12807)
@@ -872,6 +872,6 @@
 !        pcg(:,:)=0.0
          DO jn=1,jpnij
-            DO jj=nldjt(jn),nlejt(jn)
-               DO ji=nldit(jn),nleit(jn)
+            DO jj=njs0all(jn),nje0all(jn)
+               DO ji=nis0all(jn),nie0all(jn)
                   png2(ji+nimppt(jn)-1,jj+njmppt(jn)-1)=png(ji,jj,jn)
                ENDDO
@@ -993,6 +993,6 @@
          png(:,:,:)=0.0
          DO jn=1,jpnij
-            DO jj=nldjt(jn),nlejt(jn)
-               DO ji=nldit(jn),nleit(jn)
+            DO jj=njs0all(jn),nje0all(jn)
+               DO ji=nis0all(jn),nie0all(jn)
                   png(ji,jj,jn)=pcg(ji+nimppt(jn)-1-ji_off,jj+njmppt(jn)-1-jj_off)
                ENDDO
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcwave.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcwave.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/SBC/sbcwave.F90	(revision 12807)
@@ -212,8 +212,8 @@
 #if defined key_agrif
       IF( .NOT. Agrif_Root() ) THEN
-         IF( nbondi == -1 .OR. nbondi == 2 )   ze3divh( 2:nbghostcells+1,:        ,:) = 0._wp      ! west
-         IF( nbondi ==  1 .OR. nbondi == 2 )   ze3divh( nlci-nbghostcells:nlci-1,:,:) = 0._wp      ! east
-         IF( nbondj == -1 .OR. nbondj == 2 )   ze3divh( :,2:nbghostcells+1        ,:) = 0._wp      ! south
-         IF( nbondj ==  1 .OR. nbondj == 2 )   ze3divh( :,nlcj-nbghostcells:nlcj-1,:) = 0._wp      ! north
+         IF( nbondi == -1 .OR. nbondi == 2 )   ze3divh( 2:nbghostcells+1,:      ,:) = 0._wp      ! west
+         IF( nbondi ==  1 .OR. nbondi == 2 )   ze3divh( jpi-nbghostcells:jpi-1,:,:) = 0._wp      ! east
+         IF( nbondj == -1 .OR. nbondj == 2 )   ze3divh( :,2:nbghostcells+1      ,:) = 0._wp      ! south
+         IF( nbondj ==  1 .OR. nbondj == 2 )   ze3divh( :,jpj-nbghostcells:jpj-1,:) = 0._wp      ! north
       ENDIF
 #endif
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/do_loop_substitute.h90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/do_loop_substitute.h90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/do_loop_substitute.h90	(revision 12807)
@@ -50,6 +50,6 @@
 ! includes the possibility of strides for which an extra set of DO_3DS macros are defined.
 !
-! In the following definitions the inner PE domain is defined by start indices of (_nIs_0, nJs_0) and end indices of (nIe_0, nJs_0)
-! The following macros are defined just below: _nIs_0, nJs_0, _nIs_1, nJs_1, _nIe_0, nJs_0, _nIe_1, nJe_1. 
+! In the following definitions the inner PE domain is defined by start indices of (_Nis0, Njs0) and end indices of (Nie0, Njs0)
+! The following macros are defined just below: _Nis0, Njs0, _Nis1, Njs1, _Nie0, Njs0, _Nie1, Nje1. 
 ! These names are chosen to, hopefully, avoid any future, unintended matches elsewhere in the code.
 !
@@ -58,8 +58,8 @@
 ! -0- fortran code : defined in par_oce.F90 the folowwing valiables :
 !!# 
-!!#    INTEGER, PUBLIC ::   nIs_0, nIs_1, nIs_2   !: start I-index (_0: no halo, _1 & _2: 1 & 2-halos)
-!!#    INTEGER, PUBLIC ::   nIe_0, nIe_1, nIe_2   !: end   I-index (_0: no halo, _1 & _2: 1 & 2-halos)
-!!#    INTEGER, PUBLIC ::   nJs_0, nJs_1, nJs_2   !: start J-index (_0: no halo, _1 & _2: 1 & 2-halos)
-!!#    INTEGER, PUBLIC ::   nJe_0, nJe_1, nJe_2   !: end   J-index (_0: no halo, _1 & _2: 1 & 2-halos)
+!!#    INTEGER, PUBLIC ::   Nis0, Nis1, Nis2   !: start I-index (_0: no halo, _1 & _2: 1 & 2-halos)
+!!#    INTEGER, PUBLIC ::   Nie0, Nie1, Nie2   !: end   I-index (_0: no halo, _1 & _2: 1 & 2-halos)
+!!#    INTEGER, PUBLIC ::   Njs0, Njs1, Njs2   !: start J-index (_0: no halo, _1 & _2: 1 & 2-halos)
+!!#    INTEGER, PUBLIC ::   Nje0, Nje1, Nje2   !: end   J-index (_0: no halo, _1 & _2: 1 & 2-halos)
 !!# 
 ! -1- fortran code  put in  mppinit.F90 :   
@@ -76,17 +76,17 @@
 !!#      IF(     nn_hls == 1 ) THEN          !* halo size of 1
 !!#         !
-!!#         nIs_0 =   2     ;   nIs_1 =   1     ;   nIs_2 = nIs_1
-!!#         nJs_0 = nIs_0   ;   nJs_1 = nIs_1   ;   nJs_2 = nIs_1
-!!#         !
-!!#         nIe_0 = jpi-1   ;   nJe_1 = jpi     ;   nIe_2 = nIe_1
-!!#         nJe_0 = jpj-1   ;   nJe_1 = jpj-1   ;   nJe_2 = nIe_1
+!!#         Nis0 =   2     ;   Nis1 =   1     ;   Nis2 = Nis1
+!!#         Njs0 = Nis0    ;   Njs1 = Nis1    ;   Njs2 = Nis1
+!!#         !
+!!#         Nie0 = jpi-1   ;   Nje1 = jpi     ;   Nie2 = Nie1
+!!#         Nje0 = jpj-1   ;   Nje1 = jpj-1   ;   Nje2 = Nie1
 !!#         !
 !!#      ELSEIF( nn_hls == 2 ) THEN          !* halo size of 2
 !!#         !
-!!#         nIs_0 =   3     ;   nIs_1 =   2     ;   nIs_2 =   1
-!!#         nJs_0 = nIs_0   ;   nJs_1 = nIs_1   ;   nJs_2 = nIs_2
-!!#         !
-!!#         nIe_0 = jpi-2   ;   nJe_1 = jpi-1   ;   nIe_2 = jpi
-!!#         nJe_0 = jpj-2   ;   nJe_1 = jpj-1   ;   nJe_2 = jpj
+!!#         Nis0 =   3     ;   Nis1 =   2     ;   Nis2 =   1
+!!#         Njs0 = Nis0    ;   Njs1 = Nis1    ;   Njs2 = Nis2
+!!#         !
+!!#         Nie0 = jpi-2   ;   Nje1 = jpi-1   ;   Nie2 = jpi
+!!#         Nje0 = jpj-2   ;   Nje1 = jpj-1   ;   Nje2 = jpj
 !!#         !
 !!#      ELSE                                !* unexpected halo size
@@ -103,65 +103,65 @@
 ! 2D loops with 1
 
-#define DO_2D_00_00   DO jj = nJs_0, nJe_0   ;   DO ji = nIs_0, nIe_0
-#define DO_2D_00_01   DO jj = nJs_0, nJe_0   ;   DO ji = nIs_0, nIe_1
-#define DO_2D_00_10   DO jj = nJs_0, nJe_0   ;   DO ji = nIs_1, nIe_0
-#define DO_2D_00_11   DO jj = nJs_0, nJe_0   ;   DO ji = nIs_1, nIe_1
- 
-#define DO_2D_01_00   DO jj = nJs_0, nJe_1   ;   DO ji = nIs_0, nIe_0
-#define DO_2D_01_01   DO jj = nJs_0, nJe_1   ;   DO ji = nIs_0, nIe_1
-#define DO_2D_01_10   DO jj = nJs_0, nJe_1   ;   DO ji = nIs_1, nIe_0
-#define DO_2D_01_11   DO jj = nJs_0, nJe_1   ;   DO ji = nIs_1, nIe_1
- 
-#define DO_2D_10_00   DO jj = nJs_1, nJe_0   ;   DO ji = nIs_0, nIe_0
-#define DO_2D_10_01   DO jj = nJs_1, nJe_0   ;   DO ji = nIs_0, nIe_1   ! not used ?
-#define DO_2D_10_10   DO jj = nJs_1, nJe_0   ;   DO ji = nIs_1, nIe_0
-#define DO_2D_10_11   DO jj = nJs_1, nJe_0   ;   DO ji = nIs_1, nIe_1
- 
-#define DO_2D_11_00   DO jj = nJs_1, nJe_1   ;   DO ji = nIs_0, nIe_0
-#define DO_2D_11_01   DO jj = nJs_1, nJe_1   ;   DO ji = nIs_0, nIe_1
-#define DO_2D_11_10   DO jj = nJs_1, nJe_1   ;   DO ji = nIs_1, nIe_0
-#define DO_2D_11_11   DO jj = nJs_1, nJe_1   ;   DO ji = nIs_1, nIe_1
+#define DO_2D_00_00   DO jj = Njs0, Nje0   ;   DO ji = Nis0, Nie0
+#define DO_2D_00_01   DO jj = Njs0, Nje0   ;   DO ji = Nis0, Nie1
+#define DO_2D_00_10   DO jj = Njs0, Nje0   ;   DO ji = Nis1, Nie0
+#define DO_2D_00_11   DO jj = Njs0, Nje0   ;   DO ji = Nis1, Nie1
+ 
+#define DO_2D_01_00   DO jj = Njs0, Nje1   ;   DO ji = Nis0, Nie0
+#define DO_2D_01_01   DO jj = Njs0, Nje1   ;   DO ji = Nis0, Nie1
+#define DO_2D_01_10   DO jj = Njs0, Nje1   ;   DO ji = Nis1, Nie0
+#define DO_2D_01_11   DO jj = Njs0, Nje1   ;   DO ji = Nis1, Nie1
+ 
+#define DO_2D_10_00   DO jj = Njs1, Nje0   ;   DO ji = Nis0, Nie0
+#define DO_2D_10_01   DO jj = Njs1, Nje0   ;   DO ji = Nis0, Nie1   ! not used ?
+#define DO_2D_10_10   DO jj = Njs1, Nje0   ;   DO ji = Nis1, Nie0
+#define DO_2D_10_11   DO jj = Njs1, Nje0   ;   DO ji = Nis1, Nie1
+ 
+#define DO_2D_11_00   DO jj = Njs1, Nje1   ;   DO ji = Nis0, Nie0
+#define DO_2D_11_01   DO jj = Njs1, Nje1   ;   DO ji = Nis0, Nie1
+#define DO_2D_11_10   DO jj = Njs1, Nje1   ;   DO ji = Nis1, Nie0
+#define DO_2D_11_11   DO jj = Njs1, Nje1   ;   DO ji = Nis1, Nie1
 
 ! 2D loops with 1 following a 2/3D loop with 2
 
-#define DO_2D_00_01nxt2   DO jj = nJs_0    , nJe_0       ;   DO ji = nIs_0    , nIe_1nxt2
-#define DO_2D_00_10nxt2   DO jj = nJs_0    , nJe_0       ;   DO ji = nIs_1nxt2, nIe_0
-#define DO_2D_00_11nxt2   DO jj = nJs_0    , nJe_0       ;   DO ji = nIs_1nxt2, nIe_1nxt2
-
-#define DO_2D_01_00nxt2   DO jj = nJs_0    , nJe_1nxt2   ;   DO ji = nIs_0    , nIe_0
-#define DO_2D_01_01nxt2   DO jj = nJs_0    , nJe_1nxt2   ;   DO ji = nIs_0    , nIe_1nxt2
-#define DO_2D_01_10nxt2   DO jj = nJs_0    , nJe_1nxt2   ;   DO ji = nIs_1nxt2, nIe_0
-#define DO_2D_01_11nxt2   DO jj = nJs_0    , nJe_1nxt2   ;   DO ji = nIs_1nxt2, nIe_1nxt2
-
-#define DO_2D_10_00nxt2   DO jj = nJs_1nxt2, nJe_0       ;   DO ji = nIs_0    , nIe_0
-#define DO_2D_10_01nxt2   DO jj = nJs_1nxt2, nJe_0       ;   DO ji = nIs_0    , nIe_1nxt2   ! not used ?
-#define DO_2D_10_10nxt2   DO jj = nJs_1nxt2, nJe_0       ;   DO ji = nIs_1nxt2, nIe_0
-#define DO_2D_10_11nxt2   DO jj = nJs_1nxt2, nJe_0       ;   DO ji = nIs_1nxt2, nIe_1nxt2
-
-#define DO_2D_11_00nxt2   DO jj = nJs_1nxt2, nJe_1nxt2   ;   DO ji = nIs_0    , nIe_0
-#define DO_2D_11_01nxt2   DO jj = nJs_1nxt2, nJe_1nxt2   ;   DO ji = nIs_0    , nIe_1nxt2
-#define DO_2D_11_10nxt2   DO jj = nJs_1nxt2, nJe_1nxt2   ;   DO ji = nIs_1nxt2, nIe_0
-#define DO_2D_11_11nxt2   DO jj = nJs_1nxt2, nJe_1nxt2   ;   DO ji = nIs_1nxt2, nIe_1nxt2
+#define DO_2D_00_01nxt2   DO jj = Njs0    , Nje0       ;   DO ji = Nis0    , Nie1nxt2
+#define DO_2D_00_10nxt2   DO jj = Njs0    , Nje0       ;   DO ji = Nis1nxt2, Nie0
+#define DO_2D_00_11nxt2   DO jj = Njs0    , Nje0       ;   DO ji = Nis1nxt2, Nie1nxt2
+
+#define DO_2D_01_00nxt2   DO jj = Njs0    , Nje1nxt2   ;   DO ji = Nis0    , Nie0
+#define DO_2D_01_01nxt2   DO jj = Njs0    , Nje1nxt2   ;   DO ji = Nis0    , Nie1nxt2
+#define DO_2D_01_10nxt2   DO jj = Njs0    , Nje1nxt2   ;   DO ji = Nis1nxt2, Nie0
+#define DO_2D_01_11nxt2   DO jj = Njs0    , Nje1nxt2   ;   DO ji = Nis1nxt2, Nie1nxt2
+
+#define DO_2D_10_00nxt2   DO jj = Njs1nxt2, Nje0       ;   DO ji = Nis0    , Nie0
+#define DO_2D_10_01nxt2   DO jj = Njs1nxt2, Nje0       ;   DO ji = Nis0    , Nie1nxt2   ! not used ?
+#define DO_2D_10_10nxt2   DO jj = Njs1nxt2, Nje0       ;   DO ji = Nis1nxt2, Nie0
+#define DO_2D_10_11nxt2   DO jj = Njs1nxt2, Nje0       ;   DO ji = Nis1nxt2, Nie1nxt2
+
+#define DO_2D_11_00nxt2   DO jj = Njs1nxt2, Nje1nxt2   ;   DO ji = Nis0    , Nie0
+#define DO_2D_11_01nxt2   DO jj = Njs1nxt2, Nje1nxt2   ;   DO ji = Nis0    , Nie1nxt2
+#define DO_2D_11_10nxt2   DO jj = Njs1nxt2, Nje1nxt2   ;   DO ji = Nis1nxt2, Nie0
+#define DO_2D_11_11nxt2   DO jj = Njs1nxt2, Nje1nxt2   ;   DO ji = Nis1nxt2, Nie1nxt2
 
 ! 2D loops with 2
 
-#define DO_2D_11_12   DO jj = nJs_1nxt2, nJe_1nxt2   ;   DO ji = nIs_1nxt2, nIe_2
-#define DO_2D_11_21   DO jj = nJs_1nxt2, nJe_1nxt2   ;   DO ji = nIs_2    , nIe_1nxt2
-#define DO_2D_11_22   DO jj = nJs_1nxt2, nJe_1nxt2   ;   DO ji = nIs_2    , nIe_2
-
-#define DO_2D_12_11   DO jj = nJs_1nxt2, nJe_2       ;   DO ji = nIs_1nxt2, nIe_1nxt2
-#define DO_2D_12_12   DO jj = nJs_1nxt2, nJe_2       ;   DO ji = nIs_1nxt2, nIe_2
-#define DO_2D_12_21   DO jj = nJs_1nxt2, nJe_2       ;   DO ji = nIs_2    , nIe_1nxt2
-#define DO_2D_12_22   DO jj = nJs_1nxt2, nJe_2       ;   DO ji = nIs_2    , nIe_2
- 
-#define DO_2D_21_11   DO jj = nJs_2    , nJe_1nxt2   ;   DO ji = nIs_1nxt2, nIe_1nxt2
-#define DO_2D_21_12   DO jj = nJs_2    , nJe_1nxt2   ;   DO ji = nIs_1nxt2, nIe_2        ! not used ?
-#define DO_2D_21_21   DO jj = nJs_2    , nJe_1nxt2   ;   DO ji = nIs_2    , nIe_1nxt2
-#define DO_2D_21_22   DO jj = nJs_2    , nJe_1nxt2   ;   DO ji = nIs_2    , nIe_2
+#define DO_2D_11_12   DO jj = Njs1nxt2, Nje1nxt2   ;   DO ji = Nis1nxt2, Nie2
+#define DO_2D_11_21   DO jj = Njs1nxt2, Nje1nxt2   ;   DO ji = Nis2    , Nie1nxt2
+#define DO_2D_11_22   DO jj = Njs1nxt2, Nje1nxt2   ;   DO ji = Nis2    , Nie2
+
+#define DO_2D_12_11   DO jj = Njs1nxt2, Nje2       ;   DO ji = Nis1nxt2, Nie1nxt2
+#define DO_2D_12_12   DO jj = Njs1nxt2, Nje2       ;   DO ji = Nis1nxt2, Nie2
+#define DO_2D_12_21   DO jj = Njs1nxt2, Nje2       ;   DO ji = Nis2    , Nie1nxt2
+#define DO_2D_12_22   DO jj = Njs1nxt2, Nje2       ;   DO ji = Nis2    , Nie2
+ 
+#define DO_2D_21_11   DO jj = Njs2    , Nje1nxt2   ;   DO ji = Nis1nxt2, Nie1nxt2
+#define DO_2D_21_12   DO jj = Njs2    , Nje1nxt2   ;   DO ji = Nis1nxt2, Nie2        ! not used ?
+#define DO_2D_21_21   DO jj = Njs2    , Nje1nxt2   ;   DO ji = Nis2    , Nie1nxt2
+#define DO_2D_21_22   DO jj = Njs2    , Nje1nxt2   ;   DO ji = Nis2    , Nie2
                                      
-#define DO_2D_22_11   DO jj = nJs_2    , nJe_2       ;   DO ji = nIs_1nxt2, nIe_1nxt2
-#define DO_2D_22_12   DO jj = nJs_2    , nJe_2       ;   DO ji = nIs_1nxt2, nIe_2
-#define DO_2D_22_21   DO jj = nJs_2    , nJe_2       ;   DO ji = nIs_2    , nIe_1nxt2
-#define DO_2D_22_22   DO jj = nJs_2    , nJe_2       ;   DO ji = nIs_2    , nIe_2
+#define DO_2D_22_11   DO jj = Njs2    , Nje2       ;   DO ji = Nis1nxt2, Nie1nxt2
+#define DO_2D_22_12   DO jj = Njs2    , Nje2       ;   DO ji = Nis1nxt2, Nie2
+#define DO_2D_22_21   DO jj = Njs2    , Nje2       ;   DO ji = Nis2    , Nie1nxt2
+#define DO_2D_22_22   DO jj = Njs2    , Nje2       ;   DO ji = Nis2    , Nie2
 
 ! 3D loops with 1
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/nemogcm.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/nemogcm.F90	(revision 12807)
@@ -392,7 +392,7 @@
       !
       IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
       ELSE                              ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
       ENDIF
       !
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/par_oce.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/par_oce.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/par_oce.F90	(revision 12807)
@@ -81,8 +81,10 @@
    ! halo with and starting/inding DO-loop indices
    INTEGER, PUBLIC ::   nn_hls   !: halo width (applies to both rows and columns)
-   INTEGER, PUBLIC ::   nIs_0, nIs_1, nIs_1nxt2, nIs_2   !: start I-index (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   nIe_0, nIe_1, nIe_1nxt2, nIe_2   !: end   I-index (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   nJs_0, nJs_1, nJs_1nxt2, nJs_2   !: start J-index (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   nJe_0, nJe_1, nJe_1nxt2, nJe_2   !: end   J-index (_0: without halo, _1 or _2: with 1 or 2 halos)
+   INTEGER, PUBLIC ::   Nis0, Nis1, Nis1nxt2, Nis2   !: start I-index (_0: without halo, _1 or _2: with 1 or 2 halos)
+   INTEGER, PUBLIC ::   Nie0, Nie1, Nie1nxt2, Nie2   !: end   I-index (_0: without halo, _1 or _2: with 1 or 2 halos)
+   INTEGER, PUBLIC ::   Njs0, Njs1, Njs1nxt2, Njs2   !: start J-index (_0: without halo, _1 or _2: with 1 or 2 halos)
+   INTEGER, PUBLIC ::   Nje0, Nje1, Nje1nxt2, Nje2   !: end   J-index (_0: without halo, _1 or _2: with 1 or 2 halos)
+   INTEGER, PUBLIC ::   Ni_0, Nj_0, Ni_1, Nj_1, Ni_2, Nj_2   !: domain size (_0: without halo, _1 or _2: with 1 or 2 halos)
+   INTEGER, PUBLIC ::   Ni0glo, Nj0glo
 
    !!----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAO/sao_read.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAO/sao_read.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAO/sao_read.F90	(revision 12807)
@@ -10,5 +10,5 @@
    USE netcdf
    USE oce,     ONLY: tsn, sshn
-   USE dom_oce, ONLY: nlci, nlcj, nimpp, njmpp, tmask
+   USE dom_oce, ONLY: nimpp, njmpp, tmask
    USE par_oce, ONLY: jpi, jpj, jpk
    !
@@ -94,7 +94,7 @@
          IF (ifcst .LE. ntimes) THEN
             ! Allocate temporary temperature array
-            ALLOCATE(temp_tn(nlci,nlcj,jpk))
-            ALLOCATE(temp_sn(nlci,nlcj,jpk))
-            ALLOCATE(temp_sshn(nlci,nlcj))
+            ALLOCATE(temp_tn(jpi,jpj,jpk))
+            ALLOCATE(temp_sn(jpi,jpj,jpk))
+            ALLOCATE(temp_sshn(jpi,jpj))
 
             ! Set temp_tn, temp_sn to 0.
@@ -104,8 +104,8 @@
 
             ! Create start and count arrays
-            start_n = (/ nimpp, njmpp, 1,   ifcst /)
-            count_n = (/ nlci,  nlcj,  jpk, 1     /)
-            start_s = (/ nimpp, njmpp, ifcst /)
-            count_s = (/ nlci,  nlcj,  1     /)
+            start_n = (/ nimpp, njmpp,      1, ifcst /)
+            count_n = (/   jpi,   jpj, jpk, 1        /)
+            start_s = (/ nimpp, njmpp        , ifcst /)
+            count_s = (/   jpi,   jpj,      1        /)
 
             ! Read information into temporary arrays
@@ -138,22 +138,8 @@
 
             ! Mask out missing data index
-            tsn(1:nlci,1:nlcj,1:jpk,1) = temp_tn(:,:,:) * tmask(1:nlci,1:nlcj,1:jpk)
-            tsn(1:nlci,1:nlcj,1:jpk,2) = temp_sn(:,:,:) * tmask(1:nlci,1:nlcj,1:jpk)
-            sshn(1:nlci,1:nlcj)        = temp_sshn(:,:) * tmask(1:nlci,1:nlcj,1)
-
-            ! Remove halo from tmask, tsn, sshn to prevent double obs counting
-            IF (jpi > nlci) THEN
-                tmask(nlci+1:,:,:) = 0
-                tsn(nlci+1:,:,:,1) = 0
-                tsn(nlci+1:,:,:,2) = 0
-                sshn(nlci+1:,:) = 0
-            END IF
-            IF (jpj > nlcj) THEN
-                tmask(:,nlcj+1:,:) = 0
-                tsn(:,nlcj+1:,:,1) = 0
-                tsn(:,nlcj+1:,:,2) = 0
-                sshn(:,nlcj+1:) = 0
-            END IF
-
+            tsn(1:jpi,1:jpj,1:jpk,1) = temp_tn(:,:,:) * tmask(1:jpi,1:jpj,1:jpk)
+            tsn(1:jpi,1:jpj,1:jpk,2) = temp_sn(:,:,:) * tmask(1:jpi,1:jpj,1:jpk)
+            sshn(1:jpi,1:jpj)        = temp_sshn(:,:) * tmask(1:jpi,1:jpj,1)
+            
             ! Deallocate arrays
             DEALLOCATE(temp_tn, temp_sn, temp_sshn)
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/oce_trc.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/oce_trc.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/oce_trc.F90	(revision 12807)
@@ -19,20 +19,26 @@
    USE par_oce , ONLY :   jp_sal   =>   jp_sal     !: indice for salinity
    USE par_oce , ONLY :   nn_hls   =>   nn_hls     !: 
-   USE par_oce , ONLY :   nIs_0    =>   nIs_0      !: 
-   USE par_oce , ONLY :   nJs_0    =>   nJs_0      !: 
-   USE par_oce , ONLY :   nIe_0    =>   nIe_0      !: 
-   USE par_oce , ONLY :   nJe_0    =>   nJe_0      !: 
-   USE par_oce , ONLY :   nIs_1    =>   nIs_1      !: 
-   USE par_oce , ONLY :   nJs_1    =>   nJs_1      !: 
-   USE par_oce , ONLY :   nIe_1    =>   nIe_1      !: 
-   USE par_oce , ONLY :   nJe_1    =>   nJe_1      !: 
-   USE par_oce , ONLY :   nIs_1nxt2    =>   nIs_1nxt2      !: 
-   USE par_oce , ONLY :   nJs_1nxt2    =>   nJs_1nxt2      !: 
-   USE par_oce , ONLY :   nIe_1nxt2    =>   nIe_1nxt2      !: 
-   USE par_oce , ONLY :   nJe_1nxt2    =>   nJe_1nxt2      !: 
-   USE par_oce , ONLY :   nIs_2    =>   nIs_2      !: 
-   USE par_oce , ONLY :   nJs_2    =>   nJs_2      !: 
-   USE par_oce , ONLY :   nIe_2    =>   nIe_2      !: 
-   USE par_oce , ONLY :   nJe_2    =>   nJe_2      !: 
+   USE par_oce , ONLY :   Nis0    =>   Nis0      !: 
+   USE par_oce , ONLY :   Njs0    =>   Njs0      !: 
+   USE par_oce , ONLY :   Nie0    =>   Nie0      !: 
+   USE par_oce , ONLY :   Nje0    =>   Nje0      !: 
+   USE par_oce , ONLY :   Nis1    =>   Nis1      !: 
+   USE par_oce , ONLY :   Njs1    =>   Njs1      !: 
+   USE par_oce , ONLY :   Nie1    =>   Nie1      !: 
+   USE par_oce , ONLY :   Nje1    =>   Nje1      !: 
+   USE par_oce , ONLY :   Nis1nxt2    =>   Nis1nxt2      !: 
+   USE par_oce , ONLY :   Njs1nxt2    =>   Njs1nxt2      !: 
+   USE par_oce , ONLY :   Nie1nxt2    =>   Nie1nxt2      !: 
+   USE par_oce , ONLY :   Nje1nxt2    =>   Nje1nxt2      !: 
+   USE par_oce , ONLY :   Nis2    =>   Nis2      !: 
+   USE par_oce , ONLY :   Njs2    =>   Njs2      !: 
+   USE par_oce , ONLY :   Nie2    =>   Nie2      !: 
+   USE par_oce , ONLY :   Nje2    =>   Nje2      !: 
+   USE par_oce , ONLY :   Ni_0    =>   Ni_0      !: 
+   USE par_oce , ONLY :   Nj_0    =>   Nj_0      !: 
+   USE par_oce , ONLY :   Ni_1    =>   Ni_1      !: 
+   USE par_oce , ONLY :   Nj_1    =>   Nj_1      !: 
+   USE par_oce , ONLY :   Ni_2    =>   Ni_2      !: 
+   USE par_oce , ONLY :   Nj_2    =>   Nj_2      !: 
 
    USE in_out_manager                           !* IO manager *
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/prtctl_trc.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/prtctl_trc.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/prtctl_trc.F90	(revision 12807)
@@ -18,10 +18,10 @@
    PRIVATE
 
-   INTEGER , DIMENSION(:), ALLOCATABLE ::   numid_trc          !: logical unit 
-   INTEGER , DIMENSION(:), ALLOCATABLE ::   nlditl , nldjtl    !: first, last indoor index for each i-domain
-   INTEGER , DIMENSION(:), ALLOCATABLE ::   nleitl , nlejtl    !: first, last indoor index for each j-domain
-   INTEGER , DIMENSION(:), ALLOCATABLE ::   nimpptl, njmpptl   !: i-, j-indexes for each processor
-   INTEGER , DIMENSION(:), ALLOCATABLE ::   nlcitl , nlcjtl    !: dimensions of every subdomain
-   INTEGER , DIMENSION(:), ALLOCATABLE ::   ibonitl, ibonjtl
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   numid_trc            !: logical unit 
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nis0allp, njs0allp   !: first, last indoor index for each i-domain
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nie0allp, nje0allp   !: first, last indoor index for each j-domain
+   INTEGER , DIMENSION(:), ALLOCATABLE ::    nimpptl,  njmpptl   !: i-, j-indexes for each processor
+   INTEGER , DIMENSION(:), ALLOCATABLE ::    jpiallp,  jpjallp   !: dimensions of every subdomain
+   INTEGER , DIMENSION(:), ALLOCATABLE ::    ibonitl,  ibonjtl
 
    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   tra_ctl         !: previous trend values
@@ -105,23 +105,23 @@
          IF( .NOT. lsp_area ) THEN
             IF (lk_mpp )   THEN
-               nictls = MAX( 1, nlditl(js) - overlap )
-               nictle = nleitl(js) + overlap * MIN( 1, nlcitl(js) - nleitl(js)) 
-               njctls = MAX( 1, nldjtl(js) - overlap )
-               njctle = nlejtl(js) + overlap * MIN( 1, nlcjtl(js) - nlejtl(js))
+               nictls = MAX( 1, nis0allp(js) - overlap )
+               nictle = nie0allp(js) + overlap * MIN( 1, jpiallp(js) - nie0allp(js)) 
+               njctls = MAX( 1, njs0allp(js) - overlap )
+               njctle = nje0allp(js) + overlap * MIN( 1, jpjallp(js) - nje0allp(js))
                ! Do not take into account the bound of the domain
                IF( ibonitl(js) == -1 .OR. ibonitl(js) == 2 )   nictls = MAX( 2, nictls )
-               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 )   nictle = MIN( nictle, nleitl(js) - 1 )
+               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 )   nictle = MIN( nictle, nie0allp(js) - 1 )
                IF( ibonjtl(js) == -1 .OR. ibonjtl(js) == 2 )   njctls = MAX( 2, njctls )
-               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 )   njctle = MIN( njctle, nlejtl(js) - 1 )
+               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 )   njctle = MIN( njctle, nje0allp(js) - 1 )
             ELSE
-               nictls = MAX( 1, nimpptl(js) + nlditl(js) - 1 - overlap )
-               nictle = nimpptl(js) + nleitl(js) - 1 + overlap * MIN( 1, nlcitl(js) - nleitl(js) ) 
-               njctls = MAX( 1, njmpptl(js) + nldjtl(js) - 1 - overlap )
-               njctle = njmpptl(js) + nlejtl(js) - 1 + overlap * MIN( 1, nlcjtl(js) - nlejtl(js) ) 
+               nictls = MAX( 1, nimpptl(js) + nis0allp(js) - 1 - overlap )
+               nictle = nimpptl(js) + nie0allp(js) - 1 + overlap * MIN( 1, jpiallp(js) - nie0allp(js) ) 
+               njctls = MAX( 1, njmpptl(js) + njs0allp(js) - 1 - overlap )
+               njctle = njmpptl(js) + nje0allp(js) - 1 + overlap * MIN( 1, jpjallp(js) - nje0allp(js) ) 
                ! Do not take into account the bound of the domain
                IF( ibonitl(js) == -1 .OR. ibonitl(js) == 2 )   nictls = MAX( 2, nictls )
                IF( ibonjtl(js) == -1 .OR. ibonjtl(js) == 2 )   njctls = MAX( 2, njctls )
-               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 )   nictle = MIN( nictle, nimpptl(js) + nleitl(js) - 2 )
-               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 )   njctle = MIN( njctle, njmpptl(js) + nlejtl(js) - 2 )
+               IF( ibonitl(js) ==  1 .OR. ibonitl(js) == 2 )   nictle = MIN( nictle, nimpptl(js) + nie0allp(js) - 2 )
+               IF( ibonjtl(js) ==  1 .OR. ibonjtl(js) == 2 )   njctle = MIN( njctle, njmpptl(js) + nje0allp(js) - 2 )
             ENDIF
          ENDIF
@@ -193,12 +193,12 @@
 
       !                             ! Allocate arrays
-      ALLOCATE( nlditl (ijsplt) )
-      ALLOCATE( nldjtl (ijsplt) )
-      ALLOCATE( nleitl (ijsplt) )
-      ALLOCATE( nlejtl (ijsplt) )
+      ALLOCATE( nis0allp(ijsplt) )
+      ALLOCATE( njs0allp(ijsplt) )
+      ALLOCATE( nie0allp(ijsplt) )
+      ALLOCATE( nje0allp(ijsplt) )
       ALLOCATE( nimpptl(ijsplt) )
       ALLOCATE( njmpptl(ijsplt) )
-      ALLOCATE( nlcitl (ijsplt) )
-      ALLOCATE( nlcjtl (ijsplt) )
+      ALLOCATE( jpiallp(ijsplt) )
+      ALLOCATE( jpjallp(ijsplt) )
       ALLOCATE( tra_ctl(jptra,ijsplt) )
       ALLOCATE( ibonitl(ijsplt) )
@@ -213,14 +213,14 @@
          cl_run = 'MULTI processor run'
          ! use indices for each area computed by mpp_init subroutine
-         nlditl(1:jpnij) = nldit(:) 
-         nleitl(1:jpnij) = nleit(:) 
-         nldjtl(1:jpnij) = nldjt(:) 
-         nlejtl(1:jpnij) = nlejt(:) 
+         nis0allp(1:jpnij) = nis0all(:) 
+         nie0allp(1:jpnij) = nie0all(:) 
+         njs0allp(1:jpnij) = njs0all(:) 
+         nje0allp(1:jpnij) = nje0all(:) 
          !
          nimpptl(1:jpnij) = nimppt(:)
          njmpptl(1:jpnij) = njmppt(:)
          !
-         nlcitl(1:jpnij) = nlcit(:)
-         nlcjtl(1:jpnij) = nlcjt(:)
+         jpiallp(1:jpnij) = jpiall(:)
+         jpjallp(1:jpnij) = jpjall(:)
          !
          ibonitl(1:jpnij) = ibonit(:)
@@ -254,13 +254,13 @@
          IF( .NOT. lsp_area )   THEN
             IF ( lk_mpp )   THEN
-               nictls = nlditl(js) 
-               nictle = nleitl(js)
-               njctls = nldjtl(js)
-               njctle = nlejtl(js)
+               nictls = nis0allp(js) 
+               nictle = nie0allp(js)
+               njctls = njs0allp(js)
+               njctle = nje0allp(js)
             ELSE
-               nictls = nimpptl(js) + nlditl(js) - 1
-               nictle = nimpptl(js) + nleitl(js) - 1
-               njctls = njmpptl(js) + nldjtl(js) - 1
-               njctle = njmpptl(js) + nlejtl(js) - 1
+               nictls = nimpptl(js) + nis0allp(js) - 1
+               nictle = nimpptl(js) + nie0allp(js) - 1
+               njctls = njmpptl(js) + njs0allp(js) - 1
+               njctle = njmpptl(js) + nje0allp(js) - 1
             ENDIF
          ENDIF
@@ -269,5 +269,5 @@
          WRITE(j_id,*) '~~~~~~~'
          WRITE(j_id,*)
-         WRITE(j_id,9000)'                                nlej   = ', nlejtl(js), '              '
+         WRITE(j_id,9000)'                                Nje0   = ', nje0allp(js), '              '
          WRITE(j_id,9000)'                  ------------- njctle = ', njctle, ' -------------'
          WRITE(j_id,9001)'                  |                                       |'
@@ -275,10 +275,10 @@
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9002)'           nictls = ', nictls,  '                           nictle = ', nictle
-         WRITE(j_id,9002)'           nldi   = ', nlditl(js),  '                           nlei   = ', nleitl(js)
+         WRITE(j_id,9002)'           Nis0   = ', nis0allp(js),  '                           Nie0   = ', nie0allp(js)
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9001)'                  |                                       |'
          WRITE(j_id,9004)'  njmpp  = ',njmpptl(js),'   ------------- njctls = ', njctls, ' -------------'
-         WRITE(j_id,9003)'           nimpp  = ', nimpptl(js), '        nldj   = ', nldjtl(js), '              '
+         WRITE(j_id,9003)'           nimpp  = ', nimpptl(js), '        Njs0   = ', njs0allp(js), '              '
          WRITE(j_id,*)
          WRITE(j_id,*)
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca025_like
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca025_like	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca025_like	(revision 12807)
@@ -15,6 +15,6 @@
 &namusr_def    !   User defined :   BENCH configuration: Flat bottom, beta-plane
 !-----------------------------------------------------------------------
-   nn_isize   =   1442     ! number of point in i-direction of global(local) domain if >0 (<0)  
-   nn_jsize   =   1207  !!  1050    ! number of point in j-direction of global(local) domain if >0 (<0)  
+   nn_isize   =   1440     ! number of point in i-direction of global(local) domain if >0 (<0)  
+   nn_jsize   =   1206  !!  1049    ! number of point in j-direction of global(local) domain if >0 (<0)  
    nn_ksize   =   75       ! total number of point in k-direction
    nn_perio   =   4        ! periodicity
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca12_like
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca12_like	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca12_like	(revision 12807)
@@ -15,6 +15,6 @@
 &namusr_def    !   User defined :   BENCH configuration: Flat bottom, beta-plane
 !-----------------------------------------------------------------------
-   nn_isize   =   4322     ! number of point in i-direction of global(local) domain if >0 (<0)  
-   nn_jsize   =   3147     ! number of point in j-direction of global(local) domain if >0 (<0)  
+   nn_isize   =   4320     ! number of point in i-direction of global(local) domain if >0 (<0)  
+   nn_jsize   =   3146     ! number of point in j-direction of global(local) domain if >0 (<0)  
    nn_ksize   =   75       ! total number of point in k-direction
    nn_perio   =   4        ! periodicity
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca1_like
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca1_like	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/EXPREF/namelist_cfg_orca1_like	(revision 12807)
@@ -15,6 +15,6 @@
 &namusr_def    !   User defined :   BENCH configuration: Flat bottom, beta-plane
 !-----------------------------------------------------------------------
-   nn_isize   =   362      ! number of point in i-direction of global(local) domain if >0 (<0)  
-   nn_jsize   =   332      ! number of point in j-direction of global(local) domain if >0 (<0)  
+   nn_isize   =   360      ! number of point in i-direction of global(local) domain if >0 (<0)  
+   nn_jsize   =   331      ! number of point in j-direction of global(local) domain if >0 (<0)  
    nn_ksize   =   75       ! total number of point in k-direction
    nn_perio   =   6        ! periodicity
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_hgr.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_hgr.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_hgr.F90	(revision 12807)
@@ -24,4 +24,6 @@
    PUBLIC   usr_def_hgr   ! called by domhgr.F90
 
+   !! * Substitutions
+#  include "do_loop_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OPA 4.0, NEMO Consortium (2016)
@@ -72,23 +74,21 @@
       !                          
       ! Position coordinates (in grid points)
-      !                          ==========         
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            
-            zti = REAL( ji - 1 + nimpp - 1, wp )          ;  ztj = REAL( jj - 1 + njmpp - 1, wp )
-            zui = REAL( ji - 1 + nimpp - 1, wp ) + 0.5_wp ;  zvj = REAL( jj - 1 + njmpp - 1, wp ) + 0.5_wp
+      !                          ==========
+      DO_2D_11_11
+         
+         zti = REAL( mig(ji)-1, wp )          ;  ztj = REAL( mjg(jj)-2, wp )
+         zui = REAL( mig(ji)-1, wp ) + 0.5_wp ;  zvj = REAL( mjg(jj)-2, wp ) + 0.5_wp
+         
+         plamt(ji,jj) = zti
+         plamu(ji,jj) = zui
+         plamv(ji,jj) = zti
+         plamf(ji,jj) = zui
+         
+         pphit(ji,jj) = ztj
+         pphiv(ji,jj) = zvj
+         pphiu(ji,jj) = ztj
+         pphif(ji,jj) = zvj
 
-            plamt(ji,jj) = zti
-            plamu(ji,jj) = zui
-            plamv(ji,jj) = zti
-            plamf(ji,jj) = zui
-   
-            pphit(ji,jj) = ztj
-            pphiv(ji,jj) = zvj
-            pphiu(ji,jj) = ztj
-            pphif(ji,jj) = zvj
-            
-         END DO
-      END DO
+      END_2D
       !     
       ! Horizontal scale factors (in meters)
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_istate.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_istate.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_istate.F90	(revision 12807)
@@ -28,4 +28,6 @@
    PUBLIC   usr_def_istate   ! called by istate.F90
 
+   !! * Substitutions
+#  include "do_loop_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OPA 4.0 , NEMO Consortium (2016)
@@ -62,9 +64,7 @@
       !
       ! define unique value on each point. z2d ranging from 0.05 to -0.05
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            z2d(ji,jj) = 0.1 * ( 0.5 - REAL( mig(ji) + mjg(jj) * jpiglo, wp ) / REAL( jpiglo * jpjglo, wp ) )
-         ENDDO
-      ENDDO
+      DO_2D_11_11
+         z2d(ji,jj) = 0.1 * ( 0.5 - REAL( mig(ji) + (mjg(jj)-2) * jpiglo, wp ) / REAL( jpiglo * ( jpjglo - 1 ), wp ) )
+      END_2D
       !
       ! sea level:
@@ -78,6 +78,6 @@
          pts(:,:,jk,jp_sal) = 30._wp + 1._wp * zfact + z2d(:,:)           ! 30 to 31 +/- 0.05 psu
          ! velocities:
-         pu(:,:,jk) = z2d(:,:) * 0.1_wp                                   ! +/- 0.005  m/s
-         pv(:,:,jk) = z2d(:,:) * 0.01_wp                                  ! +/- 0.0005 m/s
+         pu(:,:,jk) = z2d(:,:) *  0.1_wp * umask(:,:,jk)                  ! +/- 0.005  m/s
+         pv(:,:,jk) = z2d(:,:) * 0.01_wp * vmask(:,:,jk)                  ! +/- 0.0005 m/s
       ENDDO
       !
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 12807)
@@ -77,6 +77,6 @@
 902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist' )
 
-         kpi = ( -nn_isize - 2*nn_hls ) * jpni + 2*nn_hls
-         kpj = ( -nn_jsize - 2*nn_hls ) * jpnj + 2*nn_hls
+         kpi = -nn_isize * jpni
+         kpj = -nn_jsize * jpnj
       ELSE
          kpi = nn_isize
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_sbc.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_sbc.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/BENCH/MY_SRC/usrdef_sbc.F90	(revision 12807)
@@ -34,4 +34,6 @@
    PUBLIC   usrdef_sbc_ice_flx  ! routine called by sbcice_lim.F90 for ice thermo
 
+   !! * Substitutions
+#  include "do_loop_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OPA 4.0 , NEMO Consortium (2016)
@@ -102,9 +104,7 @@
       !
       ! define unique value on each point. z2d ranging from 0.05 to -0.05
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            z2d(ji,jj) = 0.1 * ( 0.5 - REAL( nimpp + ji - 1 + ( njmpp + jj - 2 ) * jpiglo, wp ) / REAL( jpiglo * jpjglo, wp ) )
-         ENDDO
-      ENDDO
+      DO_2D_11_11
+         z2d(ji,jj) = 0.1 * ( 0.5 - REAL( mig(ji) + (mjg(jj)-2) * jpiglo, wp ) / REAL( jpiglo * ( jpjglo - 1 ), wp ) )
+      END_2D
       utau_ice(:,:) = 0.1_wp +  z2d(:,:)
       vtau_ice(:,:) = 0.1_wp +  z2d(:,:)
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/CANAL/MY_SRC/usrdef_istate.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/CANAL/MY_SRC/usrdef_istate.F90	(revision 12799)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/CANAL/MY_SRC/usrdef_istate.F90	(revision 12807)
@@ -164,6 +164,6 @@
          pssh(:,1) = - ff_t(:,1) / grav * pu(:,1,1) * e2t(:,1)
          DO jl=1, jpnj
-            DO jj=nldj, nlej
-               DO ji=nldi, nlei
+            DO jj=Njs0, Nje0
+               DO ji=Nis0, Nie0
                   pssh(ji,jj) = pssh(ji,jj-1) - ff_t(ji,jj) / grav * pu(ji,jj,1) * e2t(ji,jj)
                END DO
