Index: NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/TRA/tranxt.F90
===================================================================
--- NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/TRA/tranxt.F90	(revision 10946)
+++ NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/TRA/tranxt.F90	(revision 10954)
@@ -64,5 +64,5 @@
 CONTAINS
 
-   SUBROUTINE tra_nxt( kt, Kmm, Krhs )
+   SUBROUTINE tra_nxt( kt, Kbb, Kmm, Krhs )
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE tranxt  ***
@@ -84,8 +84,8 @@
       !!             domains (lk_agrif=T)
       !!
-      !! ** Action  : - tsb & tsn ready for the next time step
+      !! ** Action  : - ts(Kbb) & ts(Kmm) ready for the next time step
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
-      INTEGER, INTENT(in) ::   Kmm, Krhs  ! time level indices
+      INTEGER, INTENT(in) ::   Kbb, Kmm, Krhs  ! time level indices
       !!
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -108,5 +108,5 @@
 #endif
       !                                              ! local domain boundaries  (T-point, unchanged sign)
-      CALL lbc_lnk_multi( 'tranxt', tsa(:,:,:,jp_tem), 'T', 1., tsa(:,:,:,jp_sal), 'T', 1. )
+      CALL lbc_lnk_multi( 'tranxt', ts(:,:,:,jp_tem,Krhs), 'T', 1., ts(:,:,:,jp_sal,Krhs), 'T', 1. )
       !
       IF( ln_bdy )   CALL bdy_tra( kt )  ! BDY open boundaries
@@ -128,8 +128,8 @@
          ! total trend for the non-time-filtered variables. 
          zfact = 1.0 / rdt
-         ! G Nurser 23 Mar 2017. Recalculate trend as Delta(e3t*T)/e3tn; e3tn cancel from tsn terms
+         ! G Nurser 23 Mar 2017. Recalculate trend as Delta(e3t*T)/e3tn; e3tn cancel from ts(Kmm) terms
          DO jk = 1, jpkm1
-            ztrdt(:,:,jk) = ( tsa(:,:,jk,jp_tem)*e3t_a(:,:,jk) / e3t_n(:,:,jk) - tsn(:,:,jk,jp_tem)) * zfact
-            ztrds(:,:,jk) = ( tsa(:,:,jk,jp_sal)*e3t_a(:,:,jk) / e3t_n(:,:,jk) - tsn(:,:,jk,jp_sal)) * zfact
+            ztrdt(:,:,jk) = ( ts(:,:,jk,jp_tem,Krhs)*e3t(:,:,jk,Krhs) / e3t(:,:,jk,Kmm) - ts(:,:,jk,jp_tem,Kmm)) * zfact
+            ztrds(:,:,jk) = ( ts(:,:,jk,jp_sal,Krhs)*e3t(:,:,jk,Krhs) / e3t(:,:,jk,Kmm) - ts(:,:,jk,jp_sal,Kmm)) * zfact
          END DO
          CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_tem, jptra_tot, ztrdt )
@@ -138,6 +138,6 @@
             ! Store now fields before applying the Asselin filter 
             ! in order to calculate Asselin filter trend later.
-            ztrdt(:,:,:) = tsn(:,:,:,jp_tem) 
-            ztrds(:,:,:) = tsn(:,:,:,jp_sal)
+            ztrdt(:,:,:) = ts(:,:,:,jp_tem,Kmm) 
+            ztrds(:,:,:) = ts(:,:,:,jp_sal,Kmm)
          ENDIF
       ENDIF
@@ -146,5 +146,5 @@
          DO jn = 1, jpts
             DO jk = 1, jpkm1
-               tsn(:,:,jk,jn) = tsa(:,:,jk,jn)    
+               ts(:,:,jk,jn,Kmm) = ts(:,:,jk,jn,Krhs)    
             END DO
          END DO
@@ -159,12 +159,14 @@
       ELSE                                            ! Leap-Frog + Asselin filter time stepping
          !
-         IF( ln_linssh ) THEN   ;   CALL tra_nxt_fix( kt, nit000,      'TRA', tsb, tsn, tsa, jpts )  ! linear free surface 
-         ELSE                   ;   CALL tra_nxt_vvl( kt, Kmm, Krhs, nit000, rdt, 'TRA', tsb, tsn, tsa,   &
-           &                                                                sbc_tsc, sbc_tsc_b, jpts )  ! non-linear free surface
-         ENDIF
-         !
-         CALL lbc_lnk_multi( 'tranxt', tsb(:,:,:,jp_tem), 'T', 1., tsb(:,:,:,jp_sal), 'T', 1., &
-                  &          tsn(:,:,:,jp_tem), 'T', 1., tsn(:,:,:,jp_sal), 'T', 1., &
-                  &          tsa(:,:,:,jp_tem), 'T', 1., tsa(:,:,:,jp_sal), 'T', 1.  )
+         IF( ln_linssh ) THEN   ;   CALL tra_nxt_fix( kt,      Kmm,       nit000,      'TRA',                           &
+           &                                                   ts(:,:,:,:,Kbb), ts(:,:,:,:,Kmm), ts(:,:,:,:,Krhs), jpts )  ! linear free surface 
+         ELSE                   ;   CALL tra_nxt_vvl( kt, Kbb, Kmm, Krhs, nit000, rdt, 'TRA',                           &
+           &                                                   ts(:,:,:,:,Kbb), ts(:,:,:,:,Kmm), ts(:,:,:,:,Krhs),      &
+           &                                                   sbc_tsc        , sbc_tsc_b                        , jpts )  ! non-linear free surface
+         ENDIF
+         !
+         CALL lbc_lnk_multi( 'tranxt', ts(:,:,:,jp_tem,Kbb) , 'T', 1., ts(:,:,:,jp_sal,Kbb) , 'T', 1., &
+                  &                    ts(:,:,:,jp_tem,Kmm) , 'T', 1., ts(:,:,:,jp_sal,Kmm) , 'T', 1., &
+                  &                    ts(:,:,:,jp_tem,Krhs), 'T', 1., ts(:,:,:,jp_sal,Krhs), 'T', 1.  )
          !
       ENDIF     
@@ -173,6 +175,6 @@
          zfact = 1._wp / r2dt             
          DO jk = 1, jpkm1
-            ztrdt(:,:,jk) = ( tsb(:,:,jk,jp_tem) - ztrdt(:,:,jk) ) * zfact
-            ztrds(:,:,jk) = ( tsb(:,:,jk,jp_sal) - ztrds(:,:,jk) ) * zfact
+            ztrdt(:,:,jk) = ( ts(:,:,jk,jp_tem,Kbb) - ztrdt(:,:,jk) ) * zfact
+            ztrds(:,:,jk) = ( ts(:,:,jk,jp_sal,Kbb) - ztrds(:,:,jk) ) * zfact
          END DO
          CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_tem, jptra_atf, ztrdt )
@@ -182,6 +184,6 @@
       !
       !                        ! control print
-      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 )
+      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ts(:,:,:,jp_tem,Kmm), clinfo1=' nxt  - Tn: ', mask1=tmask,   &
+         &                       tab3d_2=ts(:,:,:,jp_sal,Kmm), clinfo2=       ' Sn: ', mask2=tmask )
       !
       IF( ln_timing )   CALL timing_stop('tra_nxt')
@@ -190,5 +192,5 @@
 
 
-   SUBROUTINE tra_nxt_fix( kt, kit000, cdtype, ptb, ptn, pta, kjpt )
+   SUBROUTINE tra_nxt_fix( kt, Kmm, kit000, cdtype, ptb, ptn, pta, kjpt )
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE tra_nxt_fix  ***
@@ -200,7 +202,8 @@
       !!              - swap tracer fields to prepare the next time_step.
       !!
-      !! ** Action  : - tsb & tsn ready for the next time step
+      !! ** Action  : - ptb & ptn ready for the next time step
       !!----------------------------------------------------------------------
       INTEGER                              , INTENT(in   ) ::  kt        ! ocean time-step index
+      INTEGER                              , INTENT(in   ) ::  Kmm       ! time level index
       INTEGER                              , INTENT(in   ) ::  kit000    ! first time step index
       CHARACTER(len=3)                     , INTENT(in   ) ::  cdtype    ! =TRA or TRC (tracer indicator)
@@ -239,5 +242,5 @@
 
 
-   SUBROUTINE tra_nxt_vvl( kt, Kmm, Krhs, kit000, p2dt, cdtype, ptb, ptn, pta, psbc_tc, psbc_tc_b, kjpt )
+   SUBROUTINE tra_nxt_vvl( kt, Kbb, Kmm, Krhs, kit000, p2dt, cdtype, ptb, ptn, pta, psbc_tc, psbc_tc_b, kjpt )
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE tra_nxt_vvl  ***
@@ -248,12 +251,12 @@
       !! ** Method  : - Apply a thickness weighted Asselin time filter on now fields.
       !!              - swap tracer fields to prepare the next time_step.
-      !!             tb  = ( e3t_n*tn + atfp*[ e3t_b*tb - 2 e3t_n*tn + e3t_a*ta ] )
-      !!                  /( e3t_n    + atfp*[ e3t_b    - 2 e3t_n    + e3t_a    ] )
+      !!             tb  = ( e3t(Kmm)*tn + atfp*[ e3t(Kbb)*tb - 2 e3t(Kmm)*tn + e3t_a*ta ] )
+      !!                  /( e3t(Kmm)    + atfp*[ e3t(Kbb)    - 2 e3t(Kmm)    + e3t(Krhs)    ] )
       !!             tn  = ta 
       !!
-      !! ** Action  : - tsb & tsn ready for the next time step
+      !! ** Action  : - ptb & ptn ready for the next time step
       !!----------------------------------------------------------------------
       INTEGER                              , INTENT(in   ) ::  kt        ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::  Kmm, Krhs ! time level indices
+      INTEGER                              , INTENT(in   ) ::  Kbb, Kmm, Krhs ! time level indices
       INTEGER                              , INTENT(in   ) ::  kit000    ! first time step index
       REAL(wp)                             , INTENT(in   ) ::  p2dt      ! time-step
@@ -300,7 +303,7 @@
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1
-                  ze3t_b = e3t_b(ji,jj,jk)
-                  ze3t_n = e3t_n(ji,jj,jk)
-                  ze3t_a = e3t_a(ji,jj,jk)
+                  ze3t_b = e3t(ji,jj,jk,Kbb)
+                  ze3t_n = e3t(ji,jj,jk,Kmm)
+                  ze3t_a = e3t(ji,jj,jk,Krhs)
                   !                                         ! tracer content at Before, now and after
                   ztc_b  = ptb(ji,jj,jk,jn) * ze3t_b
@@ -323,5 +326,5 @@
                      IF( mikt(ji,jj) <=jk .and. jk <= nk_rnf(ji,jj)  ) THEN
                         ze3t_f = ze3t_f - zfact2 * ( - (rnf_b(ji,jj) - rnf(ji,jj)   )  ) &
-                    &                            * ( e3t_n(ji,jj,jk) / h_rnf(ji,jj) ) 
+                    &                            * ( e3t(ji,jj,jk,Kmm) / h_rnf(ji,jj) ) 
                      ENDIF
                   ELSE
@@ -339,5 +342,5 @@
                   IF( ll_rnf .AND. jk <= nk_rnf(ji,jj) )                                          &
                      &     ztc_f  = ztc_f  - zfact1 * ( rnf_tsc(ji,jj,jn) - rnf_tsc_b(ji,jj,jn) ) & 
-                     &                              * e3t_n(ji,jj,jk) / h_rnf(ji,jj)
+                     &                              * e3t(ji,jj,jk,Kmm) / h_rnf(ji,jj)
                      !
                   ! ice shelf
@@ -346,9 +349,9 @@
                      IF ( jk >= misfkt(ji,jj) .AND. jk < misfkb(ji,jj) )                          &
                         ztc_f  = ztc_f  - zfact1 * ( risf_tsc(ji,jj,jn) - risf_tsc_b(ji,jj,jn) )  &
-                               &                 * e3t_n(ji,jj,jk) * r1_hisf_tbl (ji,jj)
+                               &                 * e3t(ji,jj,jk,Kmm) * r1_hisf_tbl (ji,jj)
                      ! level partially include in Losch_2008 ice shelf boundary layer 
                      IF ( jk == misfkb(ji,jj) )                                                   &
                         ztc_f  = ztc_f  - zfact1 * ( risf_tsc(ji,jj,jn) - risf_tsc_b(ji,jj,jn) )  &
-                               &                 * e3t_n(ji,jj,jk) * r1_hisf_tbl (ji,jj) * ralpha(ji,jj)
+                               &                 * e3t(ji,jj,jk,Kmm) * r1_hisf_tbl (ji,jj) * ralpha(ji,jj)
                   END IF
                   !
