Index: NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/cfgs/SHARED/namelist_ref
===================================================================
--- NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/cfgs/SHARED/namelist_ref	(revision 15551)
+++ NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/cfgs/SHARED/namelist_ref	(revision 15554)
@@ -331,4 +331,5 @@
    rn_ltra_min   =  4.5       ! tracers  nudging magnitude inside the ABL [hour] (~3 rn_Dt)
    rn_ltra_max   =  1.5       ! tracers  nudging magnitude above  the ABL [hour] (~1 rn_Dt)
+   rn_vfac       =  1.        ! multiplicative factor for ocean/ice velocity
    nn_amxl       =  0         ! mixing length: = 0 Deardorff 80 length-scale
                               !                = 1 length-scale based on the distance to the PBL height
Index: NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/ablmod.F90
===================================================================
--- NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/ablmod.F90	(revision 15551)
+++ NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/ablmod.F90	(revision 15554)
@@ -83,5 +83,5 @@
       REAL(wp) , INTENT(inout), DIMENSION(:,:  ) ::   psen       ! Ch x Du
       REAL(wp) , INTENT(inout), DIMENSION(:,:  ) ::   pevp       ! Ce x Du
-      REAL(wp) , INTENT(inout), DIMENSION(:,:  ) ::   pwndm      ! ||uwnd||
+      REAL(wp) , INTENT(inout), DIMENSION(:,:  ) ::   pwndm      ! ||uwnd - uoce||
       REAL(wp) , INTENT(  out), DIMENSION(:,:  ) ::   plat       ! latent heat flux
       REAL(wp) , INTENT(  out), DIMENSION(:,:  ) ::   ptaui      ! taux
@@ -346,24 +346,24 @@
          DO jk = 3, jpkam1
             DO ji = 1, jpi
-               z_elem_a( ji, jk ) = - rDt_abl * Avm_abl( ji, jj, jk-1 ) / e3w_abl( jk-1 )  ! lower-diagonal
-               z_elem_c( ji, jk ) = - rDt_abl * Avm_abl( ji, jj, jk   ) / e3w_abl( jk   )  ! upper-diagonal
-               z_elem_b( ji, jk ) = e3t_abl(jk) - z_elem_a( ji, jk ) - z_elem_c( ji, jk )  !       diagonal
-            END DO
-         END DO
-
-         DO ji = 2, jpi   ! boundary conditions   (Avm_abl and pcd_du must be available at ji=jpi)
+               z_elem_a( ji, jk ) = - rDt_abl * Avm_abl( ji, jj, jk-1 ) / e3w_abl( jk-1 )   ! lower-diagonal
+               z_elem_c( ji, jk ) = - rDt_abl * Avm_abl( ji, jj, jk   ) / e3w_abl( jk   )   ! upper-diagonal
+               z_elem_b( ji, jk ) = e3t_abl(jk) - z_elem_a( ji, jk ) - z_elem_c( ji, jk )   !       diagonal
+            END DO
+         END DO
+
+         DO ji = 2, jpi   ! boundary conditions (Avm_abl and pcd_du must be available at ji=jpi)
             !++ Surface boundary condition
             z_elem_a( ji, 2 ) = 0._wp
             z_elem_c( ji, 2 ) = - rDt_abl * Avm_abl( ji, jj, 2 ) / e3w_abl( 2 )
             !
-            zztmp1  = pcd_du(ji, jj)
-            zztmp2  = 0.5_wp * pcd_du(ji, jj) * ( pssu(ji-1, jj) + pssu(ji,jj) )
+            zztmp1 = pcd_du(ji, jj)
+            zztmp2 = 0.5_wp * pcd_du(ji, jj) * ( pssu(ji-1, jj) + pssu(ji, jj  ) ) * rn_vfac
 #if defined key_si3
             zztmp1 = zztmp1 * pfrac_oce(ji,jj) + (1._wp - pfrac_oce(ji,jj)) * pcd_du_ice(ji, jj)
-            zzice  = 0.5_wp * ( pssu_ice(ji-1, jj) + pssu_ice(ji, jj) )
+            zzice  = 0.5_wp * ( pssu_ice(ji-1, jj) + pssu_ice(ji, jj  ) ) * rn_vfac
             zztmp2 = zztmp2 * pfrac_oce(ji,jj) + (1._wp - pfrac_oce(ji,jj)) * pcd_du_ice(ji, jj) * zzice
 #endif
             z_elem_b( ji,     2       ) = e3t_abl( 2 ) - z_elem_c( ji, 2 ) + rDt_abl * zztmp1
-            u_abl( ji, jj,    2, nt_a ) =      u_abl( ji, jj,    2, nt_a ) + rDt_abl * zztmp2
+            u_abl( ji, jj,    2, nt_a ) =         u_abl( ji, jj, 2, nt_a ) + rDt_abl * zztmp2
 
             ! idealized test cases only
@@ -386,9 +386,8 @@
          !! Matrix inversion
          !! ----------------------------------------------------------
-         !DO ji = 2, jpi
-         DO ji = 1, jpi  !!GS: TBI
+         DO ji = 1, jpi  !DO ji = 2, jpi !!GS: TBI
             zcff                 =   1._wp / z_elem_b( ji, 2 )
-            zCF   (ji,   2     ) =  - zcff * z_elem_c( ji, 2 )
-            u_abl (ji,jj,2,nt_a) =    zcff * u_abl(ji,jj,2,nt_a)
+            zCF   (ji,   2     ) =  - zcff * z_elem_c( ji,     2       )
+            u_abl (ji,jj,2,nt_a) =    zcff * u_abl   ( ji, jj, 2, nt_a )
          END DO
 
@@ -420,7 +419,7 @@
          DO jk = 3, jpkam1
             DO ji = 1, jpi
-               z_elem_a( ji, jk ) = -rDt_abl * Avm_abl( ji, jj, jk-1 ) / e3w_abl( jk-1 )   ! lower-diagonal
-               z_elem_c( ji, jk ) = -rDt_abl * Avm_abl( ji, jj, jk   ) / e3w_abl( jk   )   ! upper-diagonal
-               z_elem_b( ji, jk ) = e3t_abl(jk) - z_elem_a( ji, jk ) - z_elem_c( ji, jk )                              !       diagonal
+               z_elem_a( ji, jk ) = - rDt_abl * Avm_abl( ji, jj, jk-1 ) / e3w_abl( jk-1 )   ! lower-diagonal
+               z_elem_c( ji, jk ) = - rDt_abl * Avm_abl( ji, jj, jk   ) / e3w_abl( jk   )   ! upper-diagonal
+               z_elem_b( ji, jk ) = e3t_abl(jk) - z_elem_a( ji, jk ) - z_elem_c( ji, jk )   !       diagonal
             END DO
          END DO
@@ -432,8 +431,8 @@
             !
             zztmp1 = pcd_du(ji, jj)
-            zztmp2 = 0.5_wp * pcd_du(ji, jj) * ( pssv(ji, jj) + pssv(ji, jj-1) )
+            zztmp2 = 0.5_wp * pcd_du(ji, jj) * ( pssv(ji, jj) + pssv(ji, jj-1) ) * rn_vfac
 #if defined key_si3
             zztmp1 = zztmp1 * pfrac_oce(ji,jj) + (1._wp - pfrac_oce(ji,jj)) * pcd_du_ice(ji, jj)
-            zzice  = 0.5_wp * ( pssv_ice(ji, jj) + pssv_ice(ji, jj-1) )
+            zzice  = 0.5_wp * ( pssv_ice(ji, jj) + pssv_ice(ji, jj-1) ) * rn_vfac
             zztmp2 = zztmp2 * pfrac_oce(ji,jj) + (1._wp - pfrac_oce(ji,jj)) * pcd_du_ice(ji, jj) * zzice
 #endif
@@ -461,7 +460,7 @@
          !! ----------------------------------------------------------
          DO ji = 1, jpi
-            zcff                 =  1._wp / z_elem_b( ji, 2 )
-            zCF   (ji,   2     ) =   - zcff * z_elem_c( ji,     2       )
-            v_abl (ji,jj,2,nt_a) =     zcff * v_abl   ( ji, jj, 2, nt_a )
+            zcff                 =   1._wp / z_elem_b( ji, 2 )
+            zCF   (ji,   2     ) =  - zcff * z_elem_c( ji,     2       )
+            v_abl (ji,jj,2,nt_a) =    zcff * v_abl   ( ji, jj, 2, nt_a )
          END DO
 
@@ -501,4 +500,5 @@
                   &  + jp_alp1_dyn * zsig    + jp_alp0_dyn
                zcff  = (1._wp-zmsk) + zmsk * zcff2 * rDt_abl   ! zcff = 1 for masked points
+                                                               ! rn_Dt = rDt_abl / nn_fsbc
                zcff  = zcff * rest_eq(ji,jj)
                u_abl( ji, jj, jk, nt_a ) = (1._wp - zcff ) *  u_abl( ji, jj, jk, nt_a )   &
@@ -523,4 +523,5 @@
                &  + jp_alp1_tra * zsig    + jp_alp0_tra
             zcff  = (1._wp-zmsk) + zmsk * zcff2 * rDt_abl   ! zcff = 1 for masked points
+                                                            ! rn_Dt = rDt_abl / nn_fsbc
             tq_abl( ji, jj, jk, nt_a, jp_ta ) = (1._wp - zcff ) * tq_abl( ji, jj, jk, nt_a, jp_ta )   &
                &                                       + zcff   * pt_dta( ji, jj, jk )
@@ -538,5 +539,5 @@
       !
       CALL lbc_lnk( 'ablmod',  u_abl(:,:,:,nt_a      ), 'T', -1._wp,  v_abl(:,:,:,nt_a)      , 'T', -1._wp                            )
-      CALL lbc_lnk( 'ablmod', tq_abl(:,:,:,nt_a,jp_ta), 'T', 1._wp , tq_abl(:,:,:,nt_a,jp_qa), 'T',  1._wp , kfillmode = jpfillnothing )   ! ++++ this should not be needed...
+      !CALL lbc_lnk( 'ablmod', tq_abl(:,:,:,nt_a,jp_ta), 'T',  1._wp, tq_abl(:,:,:,nt_a,jp_qa), 'T',  1._wp, kfillmode = jpfillnothing )   ! ++++ this should not be needed...
       !
 #if defined key_xios
@@ -557,6 +558,6 @@
       END IF
       IF( ln_hpgls_frc ) THEN
-         IF ( iom_use("uz1_geo") ) CALL iom_put ( "uz1_geo",  pgu_dta(:,:,2)/MAX(fft_abl(:,:),2.5e-5_wp) )
-         IF ( iom_use("vz1_geo") ) CALL iom_put ( "vz1_geo", -pgv_dta(:,:,2)/MAX(fft_abl(:,:),2.5e-5_wp) )
+         IF ( iom_use("uz1_geo") ) CALL iom_put ( "uz1_geo", -pgv_dta(:,:,2)/MAX( ABS( fft_abl(:,:)), 2.5e-5_wp)*fft_abl(:,:)/ABS(fft_abl(:,:)) )
+         IF ( iom_use("vz1_geo") ) CALL iom_put ( "vz1_geo",  pgu_dta(:,:,2)/MAX( ABS( fft_abl(:,:)), 2.5e-5_wp)*fft_abl(:,:)/ABS(fft_abl(:,:)) )
       END IF
       ! 3D (all ABL levels)
@@ -580,6 +581,6 @@
       END IF
       IF( ln_hpgls_frc ) THEN
-         IF ( iom_use("u_geo") ) CALL iom_put ( "u_geo",  pgu_dta(:,:,2:jpka)/MAX( RESHAPE( fft_abl(:,:), (/jpi,jpj,jpka-1/), fft_abl(:,:)), 2.5e-5_wp) )
-         IF ( iom_use("v_geo") ) CALL iom_put ( "v_geo", -pgv_dta(:,:,2:jpka)/MAX( RESHAPE( fft_abl(:,:), (/jpi,jpj,jpka-1/), fft_abl(:,:)), 2.5e-5_wp) )
+         IF ( iom_use("u_geo") ) CALL iom_put ( "u_geo", -pgv_dta(:,:,2:jpka)/MAX( ABS( RESHAPE( fft_abl(:,:), (/jpi,jpj,jpka-1/), fft_abl(:,:))), 2.5e-5_wp) * RESHAPE( fft_abl(:,:)/ABS(fft_abl(:,:)), (/jpi,jpj,jpka-1/), fft_abl(:,:)/ABS(fft_abl(:,:))) )
+         IF ( iom_use("v_geo") ) CALL iom_put ( "v_geo",  pgu_dta(:,:,2:jpka)/MAX( ABS( RESHAPE( fft_abl(:,:), (/jpi,jpj,jpka-1/), fft_abl(:,:))), 2.5e-5_wp) * RESHAPE( fft_abl(:,:)/ABS(fft_abl(:,:)), (/jpi,jpj,jpka-1/), fft_abl(:,:)/ABS(fft_abl(:,:))) )
       END IF
 #endif
@@ -598,11 +599,8 @@
          rhoa( ji, jj ) = zcff
       END_2D
-      !!GS: debug only; to be removed
-      CALL iom_put ( "pres_zu", zpre(:,:) ) 
-      CALL iom_put ( "tabs_zu", ztabs(:,:) ) 
 
       DO_2D( nn_hls-1, nn_hls, nn_hls-1, nn_hls )
-         zwnd_i(ji,jj) = u_abl(ji  ,jj,2,nt_a) - 0.5_wp * ( pssu(ji  ,jj) + pssu(ji-1,jj) )
-         zwnd_j(ji,jj) = v_abl(ji,jj  ,2,nt_a) - 0.5_wp * ( pssv(ji,jj  ) + pssv(ji,jj-1) )
+         zwnd_i(ji,jj) = u_abl(ji  ,jj,2,nt_a) - 0.5_wp * ( pssu(ji  ,jj) + pssu(ji-1,jj) ) * rn_vfac
+         zwnd_j(ji,jj) = v_abl(ji,jj  ,2,nt_a) - 0.5_wp * ( pssv(ji,jj  ) + pssv(ji,jj-1) ) * rn_vfac
       END_2D
       !
@@ -667,8 +665,8 @@
          ptaui_ice(ji,jj) = 0.5_wp * (  rhoa(ji+1,jj) * pCd_du_ice(ji+1,jj)             &
             &                      +    rhoa(ji  ,jj) * pCd_du_ice(ji  ,jj)  )          &
-            &         * ( zztmp1 - pssu_ice(ji,jj) )
+            &         * ( zztmp1 - pssu_ice(ji,jj) * rn_vfac )
          ptauj_ice(ji,jj) = 0.5_wp * (  rhoa(ji,jj+1) * pCd_du_ice(ji,jj+1)             &
             &                      +    rhoa(ji,jj  ) * pCd_du_ice(ji,jj  )  )          &
-            &         * ( zztmp2 - pssv_ice(ji,jj) )
+            &         * ( zztmp2 - pssv_ice(ji,jj) * rn_vfac )
       END_2D
       CALL lbc_lnk( 'ablmod', ptaui_ice, 'U', -1.0_wp, ptauj_ice,'V', -1.0_wp )
Index: NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/par_abl.F90
===================================================================
--- NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/par_abl.F90	(revision 15551)
+++ NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/par_abl.F90	(revision 15554)
@@ -61,4 +61,5 @@
    REAL(wp), PUBLIC            ::   rn_ltra_max                   !: namelist parameter
    REAL(wp), PUBLIC            ::   rn_Ric                        !: critical Richardson number 
+   REAL(wp), PUBLIC            ::   rn_vfac                       !: multiplicative factor for ocean/ice velocity
 
    !!---------------------------------------------------------------------
Index: NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/sbcabl.F90
===================================================================
--- NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/sbcabl.F90	(revision 15551)
+++ NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/ABL/sbcabl.F90	(revision 15554)
@@ -72,5 +72,5 @@
          &                 rn_ldyn_min , rn_ldyn_max, rn_ltra_min, rn_ltra_max,   &
          &                 nn_amxl, rn_Cm, rn_Ct, rn_Ce, rn_Ceps, rn_Rod, rn_Ric, &
-         &                 ln_smth_pblh
+         &                 rn_vfac, ln_smth_pblh
       !!---------------------------------------------------------------------
 
@@ -370,4 +370,5 @@
 #endif
             &                                                                  )
+
          !!-------------------------------------------------------------------------------------------
          !! 4 - Finalize flux computation using ABL variables at (n+1), nt_n corresponds to (n+1) since
