Index: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90
===================================================================
--- branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 4400)
+++ branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 4401)
@@ -130,5 +130,5 @@
       END IF
       !
-      zwi(:,:,:) = 0.e0
+      zwi(:,:,1:jpkf) = 0.e0
       !
       !                                                          ! ===========
@@ -137,6 +137,8 @@
          ! 1. Bottom value : flux set to zero
          ! ----------------------------------
-         zwx(:,:,jpk) = 0.e0    ;    zwz(:,:,jpk) = 0.e0
-         zwy(:,:,jpk) = 0.e0    ;    zwi(:,:,jpk) = 0.e0
+         ! ARPDBG: FINISS was using jpk correct here given that it can be 
+         ! below the ocean floor??
+         zwx(:,:,jpkf) = 0.e0    ;    zwz(:,:,jpkf) = 0.e0
+         zwy(:,:,jpkf) = 0.e0    ;    zwi(:,:,jpkf) = 0.e0
 
          ! 2. upstream advection with initial mass fluxes & intermediate update
@@ -147,7 +149,7 @@
          DO jj = 1, jpjm1
             DO ji = 1, jpim1
-               DO jk = 1, jpkm1
-#else
-         DO jk = 1, jpkm1
+               DO jk = 1, jpkfm1
+#else
+         DO jk = 1, jpkfm1
             DO jj = 1, jpjm1
                DO ji = 1, fs_jpim1   ! vector opt.
@@ -175,7 +177,7 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               DO jk = 2, jpkm1
-#else
-         DO jk = 2, jpkm1
+               DO jk = 2, jpkfm1
+#else
+         DO jk = 2, jpkfm1
             DO jj = 1, jpj
                DO ji = 1, jpi
@@ -194,8 +196,8 @@
          DO jj = 2, jpjm1
             DO ji = 2, jpim1
-               DO jk = 1, jpkm1
+               DO jk = 1, jpkfm1
                   z2dtt = p2dt(jk)
 #else
-         DO jk = 1, jpkm1
+         DO jk = 1, jpkfm1
             z2dtt = p2dt(jk)
             DO jj = 2, jpjm1
@@ -223,5 +225,5 @@
          IF( l_trd )  THEN 
             ! store intermediate advective trends
-            ztrdx(:,:,:) = zwx(:,:,:)   ;    ztrdy(:,:,:) = zwy(:,:,:)  ;   ztrdz(:,:,:) = zwz(:,:,:)
+            ztrdx(:,:,1:jpkf) = zwx(:,:,1:jpkf)   ;    ztrdy(:,:,1:jpkf) = zwy(:,:,1:jpkf)  ;   ztrdz(:,:,1:jpkf) = zwz(:,:,1:jpkf)
          END IF
          !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
@@ -238,7 +240,7 @@
          DO jj = 1, jpjm1
             DO ji = 1, jpim1
-               DO jk = 1, jpkm1
-#else
-         DO jk = 1, jpkm1
+               DO jk = 1, jpkfm1
+#else
+         DO jk = 1, jpkfm1
             DO jj = 1, jpjm1
                DO ji = 1, fs_jpim1   ! vector opt.
@@ -257,9 +259,9 @@
             DO ji = 1, jpi
                zwz(ji,jj,1) = 0.e0   ! Surface value
-               DO jk = 2, jpkm1
+               DO jk = 2, jpkfm1
 #else
          zwz(:,:,1) = 0.e0           ! Surface value
          !
-         DO jk = 2, jpkm1            ! Interior value
+         DO jk = 2, jpkfm1            ! Interior value
             DO jj = 1, jpj
                DO ji = 1, jpi
@@ -289,7 +291,7 @@
          DO jj = 2, jpjm1
             DO ji = 2, jpim1
-               DO jk = 1, jpkm1
-#else
-         DO jk = 1, jpkm1
+               DO jk = 1, jpkfm1
+#else
+         DO jk = 1, jpkfm1
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.  
@@ -390,5 +392,5 @@
       zbig  = 1.e+40_wp
       zrtrn = 1.e-15_wp
-      zbetup(:,:,jpk) = 0._wp   ;   zbetdo(:,:,jpk) = 0._wp
+      zbetup(:,:,jpkf) = 0._wp   ;   zbetdo(:,:,jpkf) = 0._wp
 
 
@@ -404,9 +406,9 @@
       DO jj = 2, jpjm1
          DO ji = 2, jpim1
-            DO jk = 1, jpkm1
+            DO jk = 1, jpkfm1
                ikm1 = MAX(jk-1,1)
                z2dtt = p2dt(jk)
 #else
-      DO jk = 1, jpkm1
+      DO jk = 1, jpkfm1
          ikm1 = MAX(jk-1,1)
          z2dtt = p2dt(jk)
@@ -455,7 +457,7 @@
       DO jj = 2, jpjm1
          DO ji = 2, jpim1
-            DO jk = 1, jpkm1
-#else
-      DO jk = 1, jpkm1
+            DO jk = 1, jpkfm1
+#else
+      DO jk = 1, jpkfm1
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
Index: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso.F90
===================================================================
--- branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso.F90	(revision 4400)
+++ branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso.F90	(revision 4401)
@@ -168,9 +168,9 @@
          !!   I - masked horizontal derivative 
          !!----------------------------------------------------------------------
-         CALL timing_start('traldf_iso_I')
+         !CALL timing_start('traldf_iso_I')
          !!bug ajout.... why?   ( 1,jpj,:) and (jpi,1,:) should be sufficient....
 #if defined key_z_first
          DO jj=1,jpj,1
-            DO jk=1,jpk,1
+            DO jk=1,jpkf,1
                zdit(1  ,jj,jk) = 0.0_wp
                zdit(jpi,jj,jk) = 0.0_wp
@@ -180,6 +180,6 @@
          END DO
 #else
-         zdit (1,:,:) = 0.e0     ;     zdit (jpi,:,:) = 0.e0
-         zdjt (1,:,:) = 0.e0     ;     zdjt (jpi,:,:) = 0.e0
+         zdit (1,:,1:jpkf) = 0.e0     ;     zdit (jpi,:,1:jpkf) = 0.e0
+         zdjt (1,:,1:jpkf) = 0.e0     ;     zdjt (jpi,:,1:jpkf) = 0.e0
 #endif
          !!end
@@ -189,7 +189,7 @@
          DO jj = 1, jpjm1
             DO ji = 1, jpim1
-               DO jk = 1, jpkm1
-#else
-         DO jk = 1, jpkm1
+               DO jk = 1, jpkfm1 ! jpkm1
+#else
+         DO jk = 1, jpkfm1 ! jpkm1
             DO jj = 1, jpjm1
                DO ji = 1, fs_jpim1   ! vector opt.
@@ -209,10 +209,10 @@
          ENDIF
          !
-         CALL timing_stop('traldf_iso_I','section')
+         !CALL timing_stop('traldf_iso_I','section')
 
          !!----------------------------------------------------------------------
          !!   II - horizontal trend  (full)
          !!----------------------------------------------------------------------
-         CALL timing_start('traldf_iso_II')
+         !CALL timing_start('traldf_iso_II')
 #if defined key_z_first
             ! 1. Vertical tracer gradient at level jk and jk+1
@@ -257,5 +257,5 @@
          DO jj = 2 , jpjm1
             DO ji = 2, jpim1
-               DO jk = 1, jpkm1
+               DO jk = 1, jpkfm1 ! jpkm1
 
                   ! 1. Vertical tracer gradient at level jk and jk+1
@@ -325,5 +325,5 @@
 !CDIR PARALLEL DO PRIVATE( zdk1t ) 
          !                                                ! ===============
-         DO jk = 1, jpkm1                                 ! Horizontal slab
+         DO jk = 1, jpkfm1 ! jpkm1                        ! Horizontal slab
             !                                             ! ===============
             ! 1. Vertical tracer gradient at level jk and jk+1
@@ -392,7 +392,7 @@
             DO jj = 2, jpjm1
                DO ji = 2, jpim1
-                  DO jk = 1, jpkm1
-#else
-            DO jk = 1, jpkm1
+                  DO jk = 1, jpkfm1 ! jpkm1
+#else
+            DO jk = 1, jpkfm1 ! jpkm1
                DO jj = 2, jpjm1
                   DO ji = fs_2, fs_jpim1   ! vector opt.
@@ -409,7 +409,7 @@
             DO jj = 2, jpjm1
                DO ji = 2, jpim1
-                  DO jk = 1, jpkm1
-#else
-            DO jk = 1, jpkm1
+                  DO jk = 1, jpkfm1 ! jpkm1
+#else
+            DO jk = 1, jpkfm1 ! jpkm1
                DO jj = 2, jpjm1
                   DO ji = fs_2, fs_jpim1   ! vector opt.
@@ -424,10 +424,10 @@
          END IF
 #endif
-         CALL timing_stop('traldf_iso_II','section')
-
-         !!----------------------------------------------------------------------
+         !CALL timing_stop('traldf_iso_II','section')
+
+         !!--------------------------------------------------------------------
          !!   III - vertical trend of T & S (extra diagonal terms only)
-         !!----------------------------------------------------------------------
-         CALL timing_start('traldf_iso_III')
+         !!--------------------------------------------------------------------
+         !CALL timing_start('traldf_iso_III')
          
          ! Local constant initialization
@@ -435,5 +435,5 @@
 #if defined key_z_first
          DO jj=1,jpj,1
-            DO jk=1,jpk,1
+            DO jk=1,jpkf,1
                ztfw(1  ,jj,jk) = 0.0_wp
                ztfw(jpi,jj,jk) = 0.0_wp
@@ -441,5 +441,5 @@
          END DO
 #else
-         ztfw(1,:,:) = 0.e0     ;     ztfw(jpi,:,:) = 0.e0
+         ztfw(1,:,1:jpkf) = 0.e0     ;     ztfw(jpi,:,1:jpkf) = 0.e0
 #endif
          ! Vertical fluxes
@@ -451,9 +451,10 @@
             DO jj=1,jpj,1
                ztfw(ji,jj,1  ) = 0.0_wp
-               ztfw(ji,jj,jpk) = 0.0_wp
-            END DO
-         END DO
-#else
-         ztfw(:,:, 1 ) = 0.e0      ;      ztfw(:,:,jpk) = 0.e0
+               ztfw(ji,jj,jpkf) = 0.0_wp ! ARPDBG - should this be jpk anyway
+                                         ! since may be below ocean floor?
+            END DO
+         END DO
+#else
+         ztfw(:,:, 1 ) = 0.e0      ;      ztfw(:,:,jpkf) = 0.e0
 #endif
 
@@ -462,7 +463,7 @@
          DO jj = 2, jpjm1
             DO ji = 2, jpim1
-               DO jk = 2, jpkm1
-#else
-         DO jk = 2, jpkm1
+               DO jk = 2, jpkfm1
+#else
+         DO jk = 2, jpkfm1
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.
@@ -492,7 +493,7 @@
          DO jj = 2, jpjm1
             DO ji = 2, jpim1
-               DO jk = 1, jpkm1
-#else
-         DO jk = 1, jpkm1
+               DO jk = 1, jpkfm1
+#else
+         DO jk = 1, jpkfm1
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.
@@ -506,5 +507,5 @@
          !
 
-         CALL timing_stop('traldf_iso_III','section')
+         !CALL timing_stop('traldf_iso_III','section')
 
       END DO
