Index: NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/DOM/dom_oce.F90
===================================================================
--- NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/DOM/dom_oce.F90	(revision 12958)
+++ NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/DOM/dom_oce.F90	(revision 12979)
@@ -77,4 +77,10 @@
    LOGICAL, PUBLIC ::   ln_tile
    INTEGER         ::   nn_ltile_i, nn_ltile_j
+
+   ! Domain tiling (all tiles)
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntsi_a       !: start of internal part of tile domain
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntsj_a       !
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntei_a       !: end of internal part of tile domain
+   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntej_a       !
 
    !                                 !  domain MPP decomposition parameters
Index: NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/DOM/domain.F90
===================================================================
--- NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/DOM/domain.F90	(revision 12958)
+++ NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/DOM/domain.F90	(revision 12979)
@@ -50,4 +50,5 @@
    PUBLIC   dom_init     ! called by nemogcm.F90
    PUBLIC   domain_cfg   ! called by nemogcm.F90
+   PUBLIC   dom_tile     ! called by step.F90
 
    !!-------------------------------------------------------------------------
@@ -120,7 +121,7 @@
       !           !==  Reference coordinate system  ==!
       !
-      CALL dom_glo                     ! global domain versus local domain
-      CALL dom_nam                     ! read namelist ( namrun, namdom )
-      CALL dom_tile                    ! Tile domains
+      CALL dom_glo                            ! global domain versus local domain
+      CALL dom_nam                            ! read namelist ( namrun, namdom )
+      CALL dom_tile( ntsi, ntsj, ntei, ntej ) ! Tile domain
 
       !
@@ -272,5 +273,5 @@
 
 
-   SUBROUTINE dom_tile
+   SUBROUTINE dom_tile( ktsi, ktsj, ktei, ktej, ktile )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_tile  ***
@@ -278,59 +279,70 @@
       !! ** Purpose :   Set tile domain variables
       !!
-      !! ** Action  : - ntsi, ntsj     : start of internal part of domain
-      !!              - ntei, ntej     : end of internal part of domain
+      !! ** Action  : - ktsi, ktsj     : start of internal part of domain
+      !!              - ktei, ktej     : end of internal part of domain
+      !!              - ntile          : current tile number
       !!              - nijtile        : total number of tiles
       !!----------------------------------------------------------------------
-      INTEGER ::   jt               ! dummy loop argument
-      INTEGER ::   iitile, ijtile   ! Local integers
-      !!----------------------------------------------------------------------
-      ntile = 0                     ! Initialise to full domain indices
-
-      IF( ln_tile ) THEN            ! Set tile decomposition
-         iitile = (jpi - 2 * nn_hls) / nn_ltile_i
-         ijtile = (jpj - 2 * nn_hls) / nn_ltile_j
-         IF( MOD( jpi - 2 * nn_hls, nn_ltile_i ) /= 0 ) iitile = iitile + 1
-         IF( MOD( jpj - 2 * nn_hls, nn_ltile_j ) /= 0 ) ijtile = ijtile + 1
-
-         nijtile = iitile * ijtile
-         ALLOCATE( ntsi(0:nijtile), ntsj(0:nijtile), ntei(0:nijtile), ntej(0:nijtile) )
+      INTEGER, INTENT(out) :: ktsi, ktsj, ktei, ktej      ! Tile domain indices
+      INTEGER, INTENT(in), OPTIONAL :: ktile              ! Tile number
+      INTEGER ::   jt                                     ! dummy loop argument
+      INTEGER ::   iitile, ijtile                         ! Local integers
+      !!----------------------------------------------------------------------
+      IF( PRESENT(ktile) .AND. ln_tile ) THEN
+         ntile = ktile                 ! Set domain indices for tile
+         ktsi = ntsi_a(ktile)
+         ktsj = ntsj_a(ktile)
+         ktei = ntei_a(ktile)
+         ktej = ntej_a(ktile)
       ELSE
+         ntile = 0                     ! Initialise to full domain
          nijtile = 1
-         ALLOCATE( ntsi(0:0), ntsj(0:0), ntei(0:0), ntej(0:0) )
-      ENDIF
-
-      ntsi(0) = 1 + nn_hls          ! Full domain
-      ntsj(0) = 1 + nn_hls
-      ntei(0) = jpi - nn_hls
-      ntej(0) = jpj - nn_hls
-
-      IF( ln_tile ) THEN            ! Tile domains
-         DO jt = 1, nijtile
-            ntsi(jt) = ntsi(0) + nn_ltile_i * MOD(jt - 1, iitile)
-            ntsj(jt) = ntsj(0) + nn_ltile_j * ((jt - 1) / iitile)
-            ntei(jt) = MIN(ntsi(jt) + nn_ltile_i - 1, ntei(0))
-            ntej(jt) = MIN(ntsj(jt) + nn_ltile_j - 1, ntej(0))
-         ENDDO
-      ENDIF
-
-      IF(lwp) THEN                  ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'dom_tile : Domain tiling decomposition'
-         WRITE(numout,*) '~~~~~~~~'
-         IF( ln_tile ) THEN
-            WRITE(numout,*) iitile, 'tiles in i'
-            WRITE(numout,*) '    Starting indices'
-            WRITE(numout,*) '        ', (ntsi(jt), jt=1, iitile)
-            WRITE(numout,*) '    Ending indices'
-            WRITE(numout,*) '        ', (ntei(jt), jt=1, iitile)
-            WRITE(numout,*) ijtile, 'tiles in j'
-            WRITE(numout,*) '    Starting indices'
-            WRITE(numout,*) '        ', (ntsj(jt), jt=1, nijtile, iitile)
-            WRITE(numout,*) '    Ending indices'
-            WRITE(numout,*) '        ', (ntej(jt), jt=1, nijtile, iitile)
-         ELSE
-            WRITE(numout,*) 'No domain tiling'
-            WRITE(numout,*) '    i indices =', ntsi(0), ':', ntei(0)
-            WRITE(numout,*) '    j indices =', ntsj(0), ':', ntej(0)
+         ktsi = 1 + nn_hls
+         ktsj = 1 + nn_hls
+         ktei = jpi - nn_hls
+         ktej = jpj - nn_hls
+
+         IF( ln_tile ) THEN            ! Calculate tile domain indices
+            iitile = (jpi - 2 * nn_hls) / nn_ltile_i       ! Number of tiles
+            ijtile = (jpj - 2 * nn_hls) / nn_ltile_j
+            IF( MOD( jpi - 2 * nn_hls, nn_ltile_i ) /= 0 ) iitile = iitile + 1
+            IF( MOD( jpj - 2 * nn_hls, nn_ltile_j ) /= 0 ) ijtile = ijtile + 1
+
+            nijtile = iitile * ijtile
+            ALLOCATE( ntsi_a(0:nijtile), ntsj_a(0:nijtile), ntei_a(0:nijtile), ntej_a(0:nijtile) )
+
+            ntsi_a(0) = ktsi                               ! Full domain
+            ntsj_a(0) = ktsj
+            ntei_a(0) = ktei
+            ntej_a(0) = ktej
+
+            DO jt = 1, nijtile                             ! Tile domains
+               ntsi_a(jt) = ktsi + nn_ltile_i * MOD(jt - 1, iitile)
+               ntsj_a(jt) = ktsj + nn_ltile_j * ((jt - 1) / iitile)
+               ntei_a(jt) = MIN(ntsi_a(jt) + nn_ltile_i - 1, ktei)
+               ntej_a(jt) = MIN(ntsj_a(jt) + nn_ltile_j - 1, ktej)
+            ENDDO
+         ENDIF
+
+         IF(lwp) THEN                  ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'dom_tile : Domain tiling decomposition'
+            WRITE(numout,*) '~~~~~~~~'
+            IF( ln_tile ) THEN
+               WRITE(numout,*) iitile, 'tiles in i'
+               WRITE(numout,*) '    Starting indices'
+               WRITE(numout,*) '        ', (ntsi_a(jt), jt=1, iitile)
+               WRITE(numout,*) '    Ending indices'
+               WRITE(numout,*) '        ', (ntei_a(jt), jt=1, iitile)
+               WRITE(numout,*) ijtile, 'tiles in j'
+               WRITE(numout,*) '    Starting indices'
+               WRITE(numout,*) '        ', (ntsj_a(jt), jt=1, nijtile, iitile)
+               WRITE(numout,*) '    Ending indices'
+               WRITE(numout,*) '        ', (ntej_a(jt), jt=1, nijtile, iitile)
+            ELSE
+               WRITE(numout,*) 'No domain tiling'
+               WRITE(numout,*) '    i indices =', ktsi, ':', ktei
+               WRITE(numout,*) '    j indices =', ktsj, ':', ktej
+            ENDIF
          ENDIF
       ENDIF
Index: NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/do_loop_substitute.h90
===================================================================
--- NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/do_loop_substitute.h90	(revision 12958)
+++ NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/do_loop_substitute.h90	(revision 12979)
@@ -55,11 +55,11 @@
 !
 #endif
-#define __kIs_     ntsi(ntile)
-#define __kJs_     ntsj(ntile)
+#define __kIs_     ntsi
+#define __kJs_     ntsj
 #define __kIsm1_   __kIs_ - nn_hls
 #define __kJsm1_   __kJs_ - nn_hls
 
-#define __kIe_     ntei(ntile)
-#define __kJe_     ntej(ntile)
+#define __kIe_     ntei
+#define __kJe_     ntej
 #define __kIep1_   __kIe_ + nn_hls
 #define __kJep1_   __kJe_ + nn_hls
Index: NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/par_oce.F90
===================================================================
--- NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/par_oce.F90	(revision 12958)
+++ NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/par_oce.F90	(revision 12979)
@@ -63,10 +63,10 @@
 
    ! Domain tiling
-   INTEGER, PUBLIC                                  ::   nijtile    !: number of tiles in total
-   INTEGER, PUBLIC                                  ::   ntile      !: current tile number
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntsi       !: start of internal part of tile domain
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntsj       !
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntei       !: end of internal part of tile domain
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ntej       !
+   INTEGER, PUBLIC ::   nijtile    !: number of tiles in total
+   INTEGER, PUBLIC ::   ntile      !: current tile number
+   INTEGER, PUBLIC ::   ntsi       !: start of internal part of tile domain
+   INTEGER, PUBLIC ::   ntsj       !
+   INTEGER, PUBLIC ::   ntei       !: end of internal part of tile domain
+   INTEGER, PUBLIC ::   ntej       !
 
    !!---------------------------------------------------------------------
Index: NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/step.F90
===================================================================
--- NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/step.F90	(revision 12958)
+++ NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/step.F90	(revision 12979)
@@ -264,8 +264,8 @@
       ! Loop over tile domains
       DO jtile = 1, nijtile
-         IF( ln_tile ) ntile = jtile
+         IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile )
                          CALL tra_ldf    ( kstp, Nbb, Nnn, ts, Nrhs )  ! lateral mixing
       END DO
-      IF( ln_tile ) ntile = 0                                          ! Revert to tile over full domain
+      IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) ! Revert to tile over full domain
                          CALL tra_zdf    ( kstp, Nbb, Nnn, Nrhs, ts, Naa  )  ! vertical mixing and after tracer fields
       IF( ln_zdfnpc  )   CALL tra_npc    ( kstp,      Nnn, Nrhs, ts, Naa  )  ! update after fields by non-penetrative convection
Index: NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/step_oce.F90
===================================================================
--- NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/step_oce.F90	(revision 12958)
+++ NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/OCE/step_oce.F90	(revision 12979)
@@ -9,4 +9,5 @@
    USE oce             ! ocean dynamics and tracers variables
    USE dom_oce         ! ocean space and time domain variables
+   USE domain, ONLY : dom_tile
    USE zdf_oce         ! ocean vertical physics variables
    USE zdfdrg  ,  ONLY : ln_drgimp   ! implicit top/bottom friction
