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 12759)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mppini.F90	(revision 12760)
@@ -8,6 +8,6 @@
    !!            8.0  !  1998-05  (M. Imbard, J. Escobar, L. Colombet )  SHMEM and MPI versions
    !!  NEMO      1.0  !  2004-01  (G. Madec, J.M Molines)  F90 : free form , north fold jpni > 1
-   !!            3.4  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE) add mpp_init_nfdcom
-   !!            3.   ! 2013-06  (I. Epicoco, S. Mocavero, CMCC) mpp_init_nfdcom: setup avoiding MPI communication 
+   !!            3.4  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE)  add init_nfdcom
+   !!            3.   ! 2013-06  (I. Epicoco, S. Mocavero, CMCC)  init_nfdcom: setup avoiding MPI communication 
    !!            4.0  !  2016-06  (G. Madec)  use domain configuration file instead of bathymetry file
    !!            4.0  !  2017-06  (J.M. Molines, T. Lovato) merge of mppini and mppini_2
@@ -15,10 +15,8 @@
 
    !!----------------------------------------------------------------------
-   !!  mpp_init          : Lay out the global domain over processors with/without land processor elimination
-   !!  mpp_init_mask     : Read global bathymetric information to facilitate land suppression
-   !!  mpp_init_ioipsl   : IOIPSL initialization in mpp 
-   !!  mpp_init_partition: Calculate MPP domain decomposition
-   !!  factorise         : Calculate the factors of the no. of MPI processes
-   !!  mpp_init_nfdcom   : Setup for north fold exchanges with explicit point-to-point messaging
+   !!  mpp_init       : Lay out the global domain over processors with/without land processor elimination
+   !!      init_ioipsl: IOIPSL initialization in mpp 
+   !!      init_nfdcom: Setup for north fold exchanges with explicit point-to-point messaging
+   !!      init_doloop: set the starting/ending indices of DO-loop used in do_loop_substitute 
    !!----------------------------------------------------------------------
    USE dom_oce        ! ocean space and time domain
@@ -34,8 +32,8 @@
    PRIVATE
 
-   PUBLIC mpp_init       ! called by opa.F90
-
-   INTEGER :: numbot = -1  ! 'bottom_level' local logical unit
-   INTEGER :: numbdy = -1  ! 'bdy_msk'      local logical unit
+   PUBLIC   mpp_init   ! called by opa.F90
+
+   INTEGER ::   numbot = -1   ! 'bottom_level' local logical unit
+   INTEGER ::   numbdy = -1   ! 'bdy_msk'      local logical unit
    
    !!----------------------------------------------------------------------
@@ -66,7 +64,10 @@
       jpj    = jpjglo
       jpk    = jpkglo
-      jpim1  = jpi-1                                            ! inner domain indices
-      jpjm1  = jpj-1                                            !   "           "
-      jpkm1  = MAX( 1, jpk-1 )                                  !   "           "
+      jpim1  = jpi-1                         ! inner domain indices
+      jpjm1  = jpj-1                         !   "           "
+      jpkm1  = MAX( 1, jpk-1 )               !   "           "
+      !
+      CALL init_doloop                       ! set start/end indices or do-loop depending on the halo width value (nn_hls) 
+      !
       jpij   = jpi*jpj
       jpni   = 1
@@ -591,5 +592,5 @@
       jpi = nlci
       jpj = nlcj
-      jpk = jpkglo                                             ! third dim
+      jpk = jpkglo                              ! third dim
 #if defined key_agrif
       ! simple trick to use same vertical grid as parent but different number of levels: 
@@ -598,8 +599,11 @@
 !!$      IF(.NOT.Agrif_Root())   jpkglo = Agrif_Parent( jpkglo )
 #endif
-      jpim1 = jpi-1                                            ! inner domain indices
-      jpjm1 = jpj-1                                            !   "           "
-      jpkm1 = MAX( 1, jpk-1 )                                  !   "           "
-      jpij  = jpi*jpj                                          !  jpi x j
+      !
+      CALL init_doloop                          ! set start/end indices of do-loop, depending on the halo width value (nn_hls) 
+      !
+      jpim1 = jpi-1                             ! inner domain indices
+      jpjm1 = jpj-1                             !   "           "
+      jpkm1 = MAX( 1, jpk-1 )                   !   "           "
+      jpij  = jpi*jpj                           !  jpi x j
       DO jproc = 1, jpnij
          ii = iin(jproc)
@@ -691,8 +695,8 @@
       ENDIF
       !
-      CALL mpp_init_ioipsl       ! Prepare NetCDF output file (if necessary)
+      CALL init_ioipsl       ! Prepare NetCDF output file (if necessary)
       !      
       IF (( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ).AND.( ln_nnogather )) THEN
-         CALL mpp_init_nfdcom     ! northfold neighbour lists
+         CALL init_nfdcom     ! northfold neighbour lists
          IF (llwrtlay) THEN
             WRITE(inum,*)
@@ -1165,7 +1169,7 @@
 
 
-   SUBROUTINE mpp_init_ioipsl
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE mpp_init_ioipsl  ***
+   SUBROUTINE init_ioipsl
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE init_ioipsl  ***
       !!
       !! ** Purpose :   
@@ -1200,5 +1204,5 @@
       IF(lwp) THEN
           WRITE(numout,*)
-          WRITE(numout,*) 'mpp_init_ioipsl :   iloc  = ', iloc (1), iloc (2)
+          WRITE(numout,*) 'mpp init_ioipsl :   iloc  = ', iloc (1), iloc (2)
           WRITE(numout,*) '~~~~~~~~~~~~~~~     iabsf = ', iabsf(1), iabsf(2)
           WRITE(numout,*) '                    ihals = ', ihals(1), ihals(2)
@@ -1208,10 +1212,10 @@
       CALL flio_dom_set ( jpnij, nproc, idid, iglo, iloc, iabsf, iabsl, ihals, ihale, 'BOX', nidom)
       !
-   END SUBROUTINE mpp_init_ioipsl  
-
-
-   SUBROUTINE mpp_init_nfdcom
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE  mpp_init_nfdcom  ***
+   END SUBROUTINE init_ioipsl  
+
+
+   SUBROUTINE init_nfdcom
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE  init_nfdcom  ***
       !! ** Purpose :   Setup for north fold exchanges with explicit 
       !!                point-to-point messaging
@@ -1263,9 +1267,38 @@
       l_north_nogather = .TRUE.
       !
-   END SUBROUTINE mpp_init_nfdcom
-
+   END SUBROUTINE init_nfdcom
 
 #endif
 
+   SUBROUTINE init_doloop
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE init_doloop  ***
+      !!
+      !! ** Purpose :   set the starting/ending indices of DO-loop
+      !!              These indices are used in do_loop_substitute.h90
+      !!----------------------------------------------------------------------
+      !
+      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
+         !                                   
+         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
+         !
+      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
+         !                                                              
+         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
+         !
+      ELSE                                !* unexpected halo size
+         CALL ctl_stop( 'STOP', 'ini_mpp:  wrong value of halo size : nn_hls= 1 or 2 only !')
+      ENDIF
+      !
+   END SUBROUTINE init_doloop
+   
    !!======================================================================
 END MODULE mppini
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 12759)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/do_loop_substitute.h90	(revision 12760)
@@ -50,54 +50,247 @@
 ! 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 (___kIs_, __kJs_) and end indices of (__kIe_, __kJe_)
-! The following macros are defined just below: ___kIs_, __kJs_, ___kIsm1_, __kJsm1_, ___kIe_, __kJe_, ___kIep1_, __kJep1_. 
+! 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. 
 ! These names are chosen to, hopefully, avoid any future, unintended matches elsewhere in the code.
 !
+!!gm changes ;
+!
+! -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)
+!!# 
+! -1- fortran code  put in  mppinit.F90 :   
+!!#            just after the futur read of nn_hls in namXXX (to be defined)
+!!#            NB: currently nn_hls is defined as a parameter in par_oce.F90
+!!#   SUBROUTINE init_do_loop
+!!#      !!----------------------------------------------------------------------
+!!#      !!                  ***  ROUTINE init_do_loop_indices  ***
+!!#      !!
+!!#      !! ** Purpose :   set the starting/ending indices of DO-loop
+!!#      !!              These indices are used in do_loop_substitute.h90
+!!#      !!----------------------------------------------------------------------!!# !                             !==  set the starting/ending indices of DO-loop  ==!   (used in do_loop_substitute.h90)
+!!#      !
+!!#      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
+!!#         !
+!!#      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
+!!#         !
+!!#      ELSE                                !* unexpected halo size
+!!#         CALL ctl_stop( 'STOP', 'ini_mpp:  wrong value of halo size : nn_hls= 1 or 2 only !')
+!!#      ENDIF
+!!#
+!!#      !
+!!#   END SUBROUTINE init_do_loop
+!
+!  ! -2- in do_loop_substitute becomes :
+! 
 #endif
-#define __kIs_     2
-#define __kJs_     2
-#define __kIsm1_   1
-#define __kJsm1_   1
-
-#define __kIe_     jpi-1
-#define __kJe_     jpj-1
-#define __kIep1_   jpi
-#define __kJep1_   jpj
-
-#define DO_2D_00_00   DO jj = __kJs_, __kJe_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_00_01   DO jj = __kJs_, __kJe_   ;   DO ji = __kIs_, __kIep1_
-#define DO_2D_00_10   DO jj = __kJs_, __kJe_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_00_11   DO jj = __kJs_, __kJe_   ;   DO ji = __kIsm1_, __kIep1_
- 
-#define DO_2D_01_00   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_01_01   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIs_, __kIep1_
-#define DO_2D_01_10   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_01_11   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIsm1_, __kIep1_
- 
-#define DO_2D_10_00   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_10_10   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_10_11   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIsm1_, __kIep1_
- 
-#define DO_2D_11_00   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_11_01   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIs_, __kIep1_
-#define DO_2D_11_10   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_11_11   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIsm1_, __kIep1_
-
-#define DO_3D_00_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_00
-#define DO_3D_00_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_10
- 
-#define DO_3D_01_01(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_01
- 
-#define DO_3D_10_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_00
-#define DO_3D_10_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_10
-#define DO_3D_10_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_11
- 
-#define DO_3D_11_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_11
-
-#define DO_3DS_00_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_00
-#define DO_3DS_01_01(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_01
-#define DO_3DS_10_10(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_10
-#define DO_3DS_11_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_11
-
+
+! 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
+
+! 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
+
+! 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_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
+
+! 3D loops with 1
+
+#define DO_3D_00_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_00   
+#define DO_3D_00_01(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_01   
+#define DO_3D_00_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_10   
+#define DO_3D_00_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_11   
+
+#define DO_3D_01_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_00   
+#define DO_3D_01_01(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_01   
+#define DO_3D_01_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_10   
+#define DO_3D_01_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_11   
+
+#define DO_3D_10_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_00   
+#define DO_3D_10_01(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_01   
+#define DO_3D_10_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_10   
+#define DO_3D_10_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_11   
+
+#define DO_3D_11_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_00   
+#define DO_3D_11_01(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_01   
+#define DO_3D_11_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_10   
+#define DO_3D_11_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_11   
+
+! 3D loops with 1, following a 2/3D loop with 2
+
+#define DO_3D_00_01nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_01nxt2   
+#define DO_3D_00_10nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_10nxt2   
+#define DO_3D_00_11nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_11nxt2   
+
+#define DO_3D_01_00nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_00nxt2   
+#define DO_3D_01_01nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_01nxt2   
+#define DO_3D_01_10nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_10nxt2   
+#define DO_3D_01_11nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_11nxt2   
+
+#define DO_3D_10_00nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_00nxt2   
+#define DO_3D_10_01nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_01nxt2   
+#define DO_3D_10_10nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_10nxt2   
+#define DO_3D_10_11nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_11nxt2   
+
+#define DO_3D_11_00nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_00nxt2   
+#define DO_3D_11_01nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_01nxt2   
+#define DO_3D_11_10nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_10nxt2   
+#define DO_3D_11_11nxt2(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_11nxt2   
+
+! 3D loops with 2
+
+#define DO_3D_11_12(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_12   
+#define DO_3D_11_21(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_21   
+#define DO_3D_11_22(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_22   
+
+#define DO_3D_12_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_12_11   
+#define DO_3D_12_12(ks,ke)   DO jk = ks, ke   ;   DO_2D_12_12   
+#define DO_3D_12_21(ks,ke)   DO jk = ks, ke   ;   DO_2D_12_21   
+#define DO_3D_12_22(ks,ke)   DO jk = ks, ke   ;   DO_2D_12_22   
+
+#define DO_3D_21_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_21_11   
+#define DO_3D_21_12(ks,ke)   DO jk = ks, ke   ;   DO_2D_21_12   
+#define DO_3D_21_21(ks,ke)   DO jk = ks, ke   ;   DO_2D_21_21   
+#define DO_3D_21_22(ks,ke)   DO jk = ks, ke   ;   DO_2D_21_22   
+
+#define DO_3D_22_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_22_11   
+#define DO_3D_22_12(ks,ke)   DO jk = ks, ke   ;   DO_2D_22_12   
+#define DO_3D_22_21(ks,ke)   DO jk = ks, ke   ;   DO_2D_22_21   
+#define DO_3D_22_22(ks,ke)   DO jk = ks, ke   ;   DO_2D_22_22   
+                                
+! 3D loops with increment with 1
+
+#define DO_3DS_00_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_00   
+#define DO_3DS_00_01(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_01   
+#define DO_3DS_00_10(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_10   
+#define DO_3DS_00_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_11   
+
+#define DO_3DS_01_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_00   
+#define DO_3DS_01_01(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_01   
+#define DO_3DS_01_10(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_10   
+#define DO_3DS_01_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_11   
+
+#define DO_3DS_10_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_00   
+#define DO_3DS_10_01(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_01   
+#define DO_3DS_10_10(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_10   
+#define DO_3DS_10_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_11   
+
+#define DO_3DS_11_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_00   
+#define DO_3DS_11_01(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_01   
+#define DO_3DS_11_10(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_10   
+#define DO_3DS_11_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_11   
+                                
+! 3D loops with increment with 1, following a 2/3D loop with 2
+
+#define DO_3DS_00_01nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_01nxt2   
+#define DO_3DS_00_10nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_10nxt2   
+#define DO_3DS_00_11nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_11nxt2   
+
+#define DO_3DS_01_00nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_00nxt2   
+#define DO_3DS_01_01nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_01nxt2   
+#define DO_3DS_01_10nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_10nxt2   
+#define DO_3DS_01_11nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_11nxt2   
+
+#define DO_3DS_10_00nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_00nxt2   
+#define DO_3DS_10_01nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_01nxt2   
+#define DO_3DS_10_10nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_10nxt2   
+#define DO_3DS_10_11nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_11nxt2   
+
+#define DO_3DS_11_00nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_00nxt2   
+#define DO_3DS_11_01nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_01nxt2   
+#define DO_3DS_11_10nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_10nxt2   
+#define DO_3DS_11_11nxt2(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_11nxt2   
+
+! 3D loops with increment with 2
+
+#define DO_3DS_11_12(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_12   
+#define DO_3DS_11_21(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_21   
+#define DO_3DS_11_22(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_22   
+
+#define DO_3DS_12_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_12_11   
+#define DO_3DS_12_12(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_12_12   
+#define DO_3DS_12_21(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_12_21   
+#define DO_3DS_12_22(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_12_22   
+
+#define DO_3DS_21_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_21_11   
+#define DO_3DS_21_12(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_21_12   
+#define DO_3DS_21_21(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_21_21   
+#define DO_3DS_21_22(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_21_22   
+
+#define DO_3DS_22_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_22_11   
+#define DO_3DS_22_12(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_22_12   
+#define DO_3DS_22_21(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_22_21   
+#define DO_3DS_22_22(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_22_22   
+                                
 #define END_2D   END DO   ;   END DO
 #define END_3D   END DO   ;   END DO   ;   END DO
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 12759)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/par_oce.F90	(revision 12760)
@@ -78,5 +78,11 @@
    INTEGER, PUBLIC, PARAMETER ::   jpr2di = 0   !: number of columns for extra outer halo 
    INTEGER, PUBLIC, PARAMETER ::   jpr2dj = 0   !: number of rows    for extra outer halo 
-   INTEGER, PUBLIC            ::   nn_hls       !: halo width (applies to both rows and columns)
+
+   ! 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)
 
    !!----------------------------------------------------------------------
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 12759)
+++ /NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/TOP/oce_trc.F90	(revision 12760)
@@ -18,4 +18,21 @@
    USE par_oce , ONLY :   jp_tem   =>   jp_tem     !: indice for temperature
    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 in_out_manager                           !* IO manager *
