Index: /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 4450)
+++ /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 4451)
@@ -48,4 +48,5 @@
    USE agrif_opa_interp
 #endif
+   USE timing
 
    IMPLICIT NONE
@@ -108,4 +109,6 @@
       !!----------------------------------------------------------------------
 
+      CALL timing_start('tra_nxt')
+
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -155,5 +158,5 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
-                  DO jk = 1, jpkm1
+                  DO jk = 1, mbkmax(ji,jj)-1 ! jpkm1
                      tsn(ji,jj,jk,jn) = tsa(ji,jj,jk,jn)    
                   END DO
@@ -185,5 +188,5 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               DO jk = 1, jpkm1
+               DO jk = 1, mbkmax(ji,jj)-1 ! jpkm1
                   zfact = 1.e0 / r2dtra(jk)             
                   ztrdt(ji,jj,jk) = ( tsb(ji,jj,jk,jp_tem) - ztrdt(ji,jj,jk) ) * zfact
@@ -207,4 +210,6 @@
       IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsn(:,:,:,jp_tem), clinfo1=' nxt  - Tn: ', mask1=tmask,   &
          &                       tab3d_2=tsn(:,:,:,jp_sal), clinfo2=       ' Sn: ', mask2=tmask )
+      !
+      CALL timing_stop('tra_nxt','section')
       !
    END SUBROUTINE tra_nxt
@@ -371,5 +376,5 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               DO jk = 1, jpkm1
+               DO jk = 1, mbkmax(ji,jj)-1 ! jpkm1
                   !! DCSE_NEMO: could try promoting these scalars to vectors
                   zfact1 = atfp * rdttra(jk)
Index: /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traswp.F90
===================================================================
--- /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traswp.F90	(revision 4450)
+++ /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traswp.F90	(revision 4451)
@@ -6,4 +6,5 @@
    USE par_oce         ! ocean parameters
    USE oce             ! ocean dynamics and active tracers
+   USE dom_oce, ONLY: mbkmax
 
    IMPLICIT NONE
@@ -31,7 +32,21 @@
       !!----------------------------------------------------------------------
       !
+#if defined key_z_first
+      INTEGER :: ji,jj,jk
+
+      DO jj = 1, jpj, 1
+         DO ji = 1, jpi, 1
+            DO jk = 1, mbkmax(ji,jj), 1
+               tsn(ji,jj,jk,jp_tem) = tn(ji,jj,jk)      ;      tsn(ji,jj,jk,jp_sal) = sn(ji,jj,jk)
+               tsb(ji,jj,jk,jp_tem) = tb(ji,jj,jk)      ;      tsb(ji,jj,jk,jp_sal) = sb(ji,jj,jk)
+               tsa(ji,jj,jk,jp_tem) = ta(ji,jj,jk)      ;      tsa(ji,jj,jk,jp_sal) = sa(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+#else
       tsn(:,:,:,jp_tem) = tn(:,:,:)      ;      tsn(:,:,:,jp_sal) = sn(:,:,:)
       tsb(:,:,:,jp_tem) = tb(:,:,:)      ;      tsb(:,:,:,jp_sal) = sb(:,:,:)
       tsa(:,:,:,jp_tem) = ta(:,:,:)      ;      tsa(:,:,:,jp_sal) = sa(:,:,:)
+#endif
       !
    END SUBROUTINE tra_swap
@@ -45,7 +60,21 @@
       !!----------------------------------------------------------------------
       !
+#if defined key_z_first
+      INTEGER :: ji,jj,jk
+
+      DO jj = 1, jpj, 1
+         DO ji = 1, jpi, 1
+            DO jk = 1, mbkmax(ji,jj), 1
+               tn(ji,jj,jk) = tsn(ji,jj,jk,jp_tem)      ;      sn(ji,jj,jk) = tsn(ji,jj,jk,jp_sal)
+               tb(ji,jj,jk) = tsb(ji,jj,jk,jp_tem)      ;      sb(ji,jj,jk) = tsb(ji,jj,jk,jp_sal)
+               ta(ji,jj,jk) = tsa(ji,jj,jk,jp_tem)      ;      sa(ji,jj,jk) = tsa(ji,jj,jk,jp_sal)
+            END DO
+         END DO
+      END DO
+#else
       tn(:,:,:) = tsn(:,:,:,jp_tem)      ;      sn(:,:,:) = tsn(:,:,:,jp_sal)
       tb(:,:,:) = tsb(:,:,:,jp_tem)      ;      sb(:,:,:) = tsb(:,:,:,jp_sal)
       ta(:,:,:) = tsa(:,:,:,jp_tem)      ;      sa(:,:,:) = tsa(:,:,:,jp_sal)
+#endif
       !
    END SUBROUTINE tra_unswap
