Index: /NEMO/trunk/src/OCE/DYN/dynspg_ts.F90
===================================================================
--- /NEMO/trunk/src/OCE/DYN/dynspg_ts.F90	(revision 14204)
+++ /NEMO/trunk/src/OCE/DYN/dynspg_ts.F90	(revision 14205)
@@ -162,7 +162,7 @@
       REAL(wp), DIMENSION(jpi,jpj) :: zCdU_u, zCdU_v   ! top/bottom stress at u- & v-points
       REAL(wp), DIMENSION(jpi,jpj) :: zhU, zhV         ! fluxes
-#if defined key_qco 
-      REAL(wp), DIMENSION(jpi, jpj, jpk) :: ze3u, ze3v
-#endif
+!!st#if defined key_qco 
+!!st      REAL(wp), DIMENSION(jpi, jpj, jpk) :: ze3u, ze3v
+!!st#endif
       !
       REAL(wp) ::   zwdramp                     ! local scalar - only used if ln_wd_dl = .True. 
@@ -232,11 +232,15 @@
       !                                   !  ---------------------------  !
 #if defined key_qco 
-      DO jk = 1 , jpk
-         ze3u(:,:,jk) = e3u(:,:,jk,Kmm)
-         ze3v(:,:,jk) = e3v(:,:,jk,Kmm)
-      END DO
-      !
-      zu_frc(:,:) = SUM( ze3u(:,:,:) * uu(:,:,:,Krhs) * umask(:,:,:) , DIM=3 ) * r1_hu(:,:,Kmm)
-      zv_frc(:,:) = SUM( ze3v(:,:,:) * vv(:,:,:,Krhs) * vmask(:,:,:) , DIM=3 ) * r1_hv(:,:,Kmm)
+!!st      DO jk = 1 , jpk
+!!st         ze3u(:,:,jk) = e3u(:,:,jk,Kmm)
+!!st         ze3v(:,:,jk) = e3v(:,:,jk,Kmm)
+!!st      END DO
+!!st      !
+!!st      zu_frc(:,:) = SUM( ze3u(:,:,:) * uu(:,:,:,Krhs) * umask(:,:,:) , DIM=3 ) * r1_hu(:,:,Kmm)
+!!st      zv_frc(:,:) = SUM( ze3v(:,:,:) * vv(:,:,:,Krhs) * vmask(:,:,:) , DIM=3 ) * r1_hv(:,:,Kmm)
+
+      zu_frc(:,:) = SUM( e3u_0(:,:,:) * uu(:,:,:,Krhs) * umask(:,:,:) , DIM=3 ) * r1_hu_0(:,:)
+      zv_frc(:,:) = SUM( e3v_0(:,:,:) * vv(:,:,:,Krhs) * vmask(:,:,:) , DIM=3 ) * r1_hv_0(:,:)
+      
 #else
       zu_frc(:,:) = SUM( e3u(:,:,:,Kmm) * uu(:,:,:,Krhs) * umask(:,:,:) , DIM=3 ) * r1_hu(:,:,Kmm)
Index: /NEMO/trunk/src/OCE/DYN/sshwzv.F90
===================================================================
--- /NEMO/trunk/src/OCE/DYN/sshwzv.F90	(revision 14204)
+++ /NEMO/trunk/src/OCE/DYN/sshwzv.F90	(revision 14205)
@@ -261,5 +261,5 @@
 
 
-   SUBROUTINE ssh_atf( kt, Kbb, Kmm, Kaa, pssh, pssh_f )
+   SUBROUTINE ssh_atf( kt, Kbb, Kmm, Kaa, pssh )
       !!----------------------------------------------------------------------
       !!                    ***  ROUTINE ssh_atf  ***
@@ -278,9 +278,7 @@
       INTEGER                         , INTENT(in   ) ::   kt             ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   Kbb, Kmm, Kaa  ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpt)          , TARGET, INTENT(inout) ::   pssh           ! SSH field
-      REAL(wp), DIMENSION(jpi,jpj    ), OPTIONAL, TARGET, INTENT(  out) ::   pssh_f         ! filtered SSH field
+      REAL(wp), DIMENSION(jpi,jpj,jpt), INTENT(inout) ::   pssh           ! SSH field
       !
       REAL(wp) ::   zcoef   ! local scalar
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zssh   ! pointer for filtered SSH 
       !!----------------------------------------------------------------------
       !
@@ -292,22 +290,21 @@
          IF(lwp) WRITE(numout,*) '~~~~~~~ '
       ENDIF
-      !              !==  Euler time-stepping: no filter, just swap  ==!
-      IF ( .NOT.( l_1st_euler ) ) THEN   ! Only do time filtering for leapfrog timesteps
-         IF( PRESENT( pssh_f ) ) THEN   ;   zssh => pssh_f
-         ELSE                           ;   zssh => pssh(:,:,Kmm)
-         ENDIF
-         !                                                  ! filtered "now" field
-         pssh(:,:,Kmm) = pssh(:,:,Kmm) + rn_atfp * ( pssh(:,:,Kbb) - 2 * pssh(:,:,Kmm) + pssh(:,:,Kaa) )
+      !
+      IF( .NOT.l_1st_euler ) THEN   ! Apply Asselin time filter on Kmm field (not on euler 1st)
          !
-         IF( .NOT.ln_linssh ) THEN                          ! "now" <-- with forcing removed
+         IF( ln_linssh ) THEN                ! filtered "now" field
+            pssh(:,:,Kmm) = pssh(:,:,Kmm) + rn_atfp * ( pssh(:,:,Kbb) - 2 * pssh(:,:,Kmm) + pssh(:,:,Kaa) )
+            !
+         ELSE                                ! filtered "now" field with forcing removed
             zcoef = rn_atfp * rn_Dt * r1_rho0
-            pssh(:,:,Kmm) = pssh(:,:,Kmm) - zcoef * (     emp_b(:,:) - emp   (:,:)   &
-               &                             - rnf_b(:,:)        + rnf   (:,:)       &
-               &                             + fwfisf_cav_b(:,:) - fwfisf_cav(:,:)   &
-               &                             + fwfisf_par_b(:,:) - fwfisf_par(:,:)   ) * ssmask(:,:)
+            pssh(:,:,Kmm) = pssh(:,:,Kmm) + rn_atfp * ( pssh(:,:,Kbb) - 2 * pssh(:,:,Kmm) + pssh(:,:,Kaa) )   &
+               &                          - zcoef   * (         emp_b(:,:) -        emp(:,:)   &
+               &                                              - rnf_b(:,:) +        rnf(:,:)   &
+               &                                       + fwfisf_cav_b(:,:) - fwfisf_cav(:,:)   &
+               &                                       + fwfisf_par_b(:,:) - fwfisf_par(:,:)   ) * ssmask(:,:)
 
             ! ice sheet coupling
             IF( ln_isf .AND. ln_isfcpl .AND. kt == nit000+1 )   &
-               &   pssh(:,:,Kbb) = pssh(:,:,Kbb) - rn_atfp * rn_Dt * ( risfcpl_ssh(:,:) - 0.0 ) * ssmask(:,:)
+               &   pssh(:,:,Kbb) = pssh(:,:,Kbb) - rn_atfp * rn_Dt * ( risfcpl_ssh(:,:) - 0._wp ) * ssmask(:,:)
 
          ENDIF
Index: /NEMO/trunk/src/OCE/stpmlf.F90
===================================================================
--- /NEMO/trunk/src/OCE/stpmlf.F90	(revision 14204)
+++ /NEMO/trunk/src/OCE/stpmlf.F90	(revision 14205)
@@ -50,10 +50,4 @@
    USE traatf_qco     ! time filtering                 (tra_atf_qco routine)
    USE dynatf_qco     ! time filtering                 (dyn_atf_qco routine)
-   
-   USE bdydyn         ! ocean open boundary conditions (define bdy_dyn)
-
-#if defined key_agrif
-   USE agrif_oce_interp
-#endif
 
    IMPLICIT NONE
@@ -68,4 +62,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "do_loop_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -99,6 +94,5 @@
       !!----------------------------------------------------------------------
       INTEGER ::   ji, jj, jk, jtile   ! dummy loop indice
-      REAL(wp),              DIMENSION(jpi,jpj,jpk) ::   zgdept
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)         ::   zssh_f
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zgdept
       !! ---------------------------------------------------------------------
 #if defined key_agrif
@@ -210,7 +204,5 @@
       !  Ocean dynamics : hdiv, ssh, e3, u, v, w
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      DO jk = 1, jpk
-         zgdept(:,:,jk) = gdept(:,:,jk,Nnn)
-      END DO
+      
                          CALL ssh_nxt    ( kstp, Nbb, Nnn, ssh,  Naa )   ! after ssh (includes call to div_hor)
       IF( .NOT.lk_linssh ) THEN
@@ -221,6 +213,10 @@
                          CALL wzv        ( kstp, Nbb, Nnn, Naa, ww  )    ! Nnn cross-level velocity
       IF( ln_zad_Aimp )  CALL wAimp      ( kstp,      Nnn           )    ! Adaptive-implicit vertical advection partitioning
+                         ALLOCATE( zgdept(jpi,jpj,jpk) )
+                         DO jk = 1, jpk
+                            zgdept(:,:,jk) = gdept(:,:,jk,Nnn)
+                         END DO
                          CALL eos        ( ts(:,:,:,:,Nnn), rhd, rhop, zgdept ) ! now in situ density for hpg computation
-
+                         DEALLOCATE( zgdept )
 
                          uu(:,:,:,Nrhs) = 0._wp            ! set dynamics trends to zero
@@ -240,9 +236,9 @@
                          CALL dyn_hpg( kstp,      Nnn      , uu, vv, Nrhs )  ! horizontal gradient of Hydrostatic pressure
                          CALL dyn_spg( kstp, Nbb, Nnn, Nrhs, uu, vv, ssh, uu_b, vv_b, Naa )  ! surface pressure gradient
-
-                                                      ! With split-explicit free surface, since now transports have been updated and ssh(:,:,Nrhs) as well
-      IF( ln_dynspg_ts ) THEN                         ! vertical scale factors and vertical velocity need to be updated
+                         
+      IF( ln_dynspg_ts ) THEN      ! With split-explicit free surface, since now transports have been updated and ssh(:,:,Nrhs)
+                                   ! as well as vertical scale factors and vertical velocity need to be updated
                             CALL div_hor    ( kstp, Nbb, Nnn )                ! Horizontal divergence  (2nd call in time-split case)
-         IF(.NOT.lk_linssh) CALL dom_qco_r3c ( ssh(:,:,Naa), r3t(:,:,Naa), r3u(:,:,Naa), r3v(:,:,Naa), r3f(:,:) )   ! update ssh/h_0 ratio at t,u,v,f pts 
+         IF(.NOT.lk_linssh) CALL dom_qco_r3c( ssh(:,:,Naa), r3t(:,:,Naa), r3u(:,:,Naa), r3v(:,:,Naa), r3f(:,:) )   ! update ssh/h_0 ratio at t,u,v,f pts 
       ENDIF
                             CALL dyn_zdf    ( kstp, Nbb, Nnn, Nrhs, uu, vv, Naa  )  ! vertical diffusion
@@ -307,5 +303,5 @@
 
 #if defined key_agrif
-      IF(.NOT. Agrif_Root()) THEN
+      IF(.NOT. Agrif_Root() ) THEN
          IF( ln_tile    )   CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 )
                             CALL Agrif_Sponge_tra        ! tracers sponge
@@ -319,7 +315,8 @@
                             CALL tra_adv    ( kstp, Nbb, Nnn, ts, Nrhs )  ! hor. + vert. advection	==> RHS
          IF( ln_zdfmfc  )   CALL tra_mfc    ( kstp, Nbb,      ts, Nrhs )  ! Mass Flux Convection
-         IF( ln_zdfosm  )   CALL tra_osm    ( kstp,      Nnn, ts, Nrhs )  ! OSMOSIS non-local tracer fluxes ==> RHS
-         IF( lrst_oce .AND. ln_zdfosm )   &
-            &               CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts
+         IF( ln_zdfosm  ) THEN
+                            CALL tra_osm    ( kstp,      Nnn, ts, Nrhs )  ! OSMOSIS non-local tracer fluxes ==> RHS
+            IF( lrst_oce )  CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts
+         ENDIF
                             CALL tra_ldf    ( kstp, Nbb, Nnn, ts, Nrhs )  ! lateral mixing
 
@@ -391,5 +388,4 @@
       IF( Agrif_NbStepint() == 0 .AND. nstop == 0 )   &
          &               CALL Agrif_update_all( )                  ! Update all components
-      ENDIF
 
 #endif
@@ -494,4 +490,9 @@
       !! ** Action :   puu(Kaa),pvv(Kaa)   after horizontal velocity and tracers
       !!----------------------------------------------------------------------
+#if defined key_agrif
+      USE agrif_oce_interp
+#endif
+      USE bdydyn         ! ocean open boundary conditions (define bdy_dyn)
+      !!
       INTEGER                                  , INTENT(in   ) ::   kt         ! ocean time-step index
       INTEGER                                  , INTENT(in   ) ::   Kbb, Kaa   ! before and after time level indices
