Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/1_namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/1_namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/1_namelist_cfg	(revision 13058)
@@ -81,6 +81,7 @@
    ln_blk      = .true.    !  Bulk formulation                          (T => fill namsbc_blk )
                      ! Sea-ice :
-   nn_ice      = 2         !  =2 or 3 automatically for SI3 or CICE    ("key_si3" or "key_cice")
-                           !          except in AGRIF zoom where it has to be specified
+   nn_ice      = 2         !  =0 no ice boundary condition
+      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
+      !                    !  =2 or 3 for SI3 and CICE, respectively
                      ! Misc. options of sbc : 
    ln_traqsr   = .true.    !  Light penetration in the ocean            (T => fill namtra_qsr)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/2_namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/2_namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/2_namelist_cfg	(revision 13058)
@@ -78,5 +78,7 @@
    ln_blk      = .true.    !  Bulk formulation                          (T => fill namsbc_blk )
                      ! Sea-ice :
-   nn_ice      = 2         !  =0   Use SI3 model
+   nn_ice      = 2         !  =0 no ice boundary condition
+      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
+      !                    !  =2 or 3 for SI3 and CICE, respectively
                      ! Misc. options of sbc : 
    ln_traqsr   = .true.    !  Light penetration in the ocean            (T => fill namtra_qsr)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/3_namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/3_namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/3_namelist_cfg	(revision 13058)
@@ -78,5 +78,7 @@
    ln_blk      = .true.    !  Bulk formulation                          (T => fill namsbc_blk )
                      ! Sea-ice :
-   nn_ice      = 2         !  =0   Use SI3 model
+   nn_ice      = 2         !  =0 no ice boundary condition
+      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
+      !                    !  =2 or 3 for SI3 and CICE, respectively
                      ! Misc. options of sbc : 
    ln_traqsr   = .true.    !  Light penetration in the ocean            (T => fill namtra_qsr)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/AGRIF_DEMO/EXPREF/namelist_cfg	(revision 13058)
@@ -81,6 +81,7 @@
    ln_blk      = .true.    !  Bulk formulation                          (T => fill namsbc_blk )
                      ! Sea-ice :
-   nn_ice      = 2         !  =2 or 3 automatically for SI3 or CICE    ("key_si3" or "key_cice")
-                           !          except in AGRIF zoom where it has to be specified
+   nn_ice      = 2         !  =0 no ice boundary condition
+      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
+      !                    !  =2 or 3 for SI3 and CICE, respectively
                      ! Misc. options of sbc : 
    ln_traqsr   = .true.    !  Light penetration in the ocean            (T => fill namtra_qsr)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_ICE_ABL/EXPREF/namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_ICE_ABL/EXPREF/namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_ICE_ABL/EXPREF/namelist_cfg	(revision 13058)
@@ -84,6 +84,7 @@
    ln_abl      = .true.    !  ABL  formulation                          (T => fill namsbc_abl )
                      ! Sea-ice :
-   nn_ice      = 2         !  =2 or 3 automatically for SI3 or CICE    ("key_si3" or "key_cice")
-                           !          except in AGRIF zoom where it has to be specified
+   nn_ice      = 2         !  =0 no ice boundary condition
+      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
+      !                    !  =2 or 3 for SI3 and CICE, respectively
                      ! Misc. options of sbc : 
    ln_traqsr   = .true.    !  Light penetration in the ocean            (T => fill namtra_qsr)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg	(revision 13058)
@@ -80,6 +80,7 @@
    ln_blk      = .true.    !  Bulk formulation                          (T => fill namsbc_blk )
                      ! Sea-ice :
-   nn_ice      = 2         !  =2 or 3 automatically for SI3 or CICE    ("key_si3" or "key_cice")
-                           !          except in AGRIF zoom where it has to be specified
+   nn_ice      = 2         !  =0 no ice boundary condition
+      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
+      !                    !  =2 or 3 for SI3 and CICE, respectively
                      ! Misc. options of sbc : 
    ln_traqsr   = .true.    !  Light penetration in the ocean            (T => fill namtra_qsr)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_SAS_ICE/EXPREF/namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_SAS_ICE/EXPREF/namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/ORCA2_SAS_ICE/EXPREF/namelist_cfg	(revision 13058)
@@ -59,5 +59,7 @@
    nn_fsbc     = 1         !  frequency of SBC module call
    ln_blk      = .true.    !  Bulk formulation                          (T => fill namsbc_blk )
-   nn_ice      = 2         !  =2  sea-ice model                         ("key_SI3" or "key_cice")
+   nn_ice      = 2         !  =0 no ice boundary condition
+      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
+      !                    !  =2 or 3 for SI3 and CICE, respectively
 /
 !-----------------------------------------------------------------------
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/SHARED/namelist_ref
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/SHARED/namelist_ref	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/SHARED/namelist_ref	(revision 13058)
@@ -1135,4 +1135,10 @@
    !                       !                 = 3 as =2 with distinct dissipative an mixing length scale
    ln_mxl0     = .true.    !  surface mixing length scale = F(wind stress) (T) or not (F)
+      nn_mxlice    = 0        ! type of scaling under sea-ice
+                              !    = 0 no scaling under sea-ice
+                              !    = 1 scaling with constant sea-ice thickness
+                              !    = 2  scaling with mean sea-ice thickness ( only with SI3 sea-ice model )
+                              !    = 3  scaling with maximum sea-ice thickness
+      rn_mxlice   = 10.       ! max constant ice thickness value when scaling under sea-ice ( nn_mxlice=1)
    rn_mxl0     =   0.04    !  surface  buoyancy lenght scale minimum value
    ln_drg      = .false.   !  top/bottom friction added as boundary condition of TKE
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/WED025/EXPREF/namelist_cfg
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/WED025/EXPREF/namelist_cfg	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/WED025/EXPREF/namelist_cfg	(revision 13058)
@@ -116,8 +116,7 @@
    ln_blk      = .true.    !  Bulk formulation                          (T => fill namsbc_blk )
                      ! Sea-ice :
-   nn_ice      = 2         !  =0 no ice boundary condition    
+   nn_ice      = 2         !  =0 no ice boundary condition
       !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif )
-      !                    !  =2 or 3 automatically for SI3 or CICE    ("key_si3" or "key_cice")
-      !                    !          except in AGRIF zoom where it has to be specified
+      !                    !  =2 or 3 for SI3 and CICE, respectively
    ln_ice_embd = .false.   !  =T embedded sea-ice (pressure + mass and salt exchanges)
       !                    !  =F levitating ice (no pressure, mass and salt exchanges)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ICB/icbrst.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ICB/icbrst.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ICB/icbrst.F90	(revision 13058)
@@ -215,6 +215,6 @@
          cl_filename = TRIM(cexper)//"_"//TRIM(ADJUSTL(cl_kt))//"_"//TRIM(cn_icbrst_out)
          IF( lk_mpp ) THEN
-            idg = MAX( INT(LOG10(REAL(jpnij-1,wp))) + 1, 4 )          ! how many digits to we need to write? min=4, max=9
-            WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg   ! '(a,a,ix.x,a)'
+            idg = MAX( INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1, 4 )          ! how many digits to we need to write? min=4, max=9
+            WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg          ! '(a,a,ix.x,a)'
             WRITE(cl_filename,clfmt) TRIM(cl_filename), '_', narea-1, '.nc'
          ELSE
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ICB/icbtrj.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ICB/icbtrj.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ICB/icbtrj.F90	(revision 13058)
@@ -84,6 +84,6 @@
       cl_filename = 'trajectory_icebergs_'//TRIM(ADJUSTL(cldate_ini))//'-'//TRIM(ADJUSTL(cldate_end))
       IF ( lk_mpp ) THEN
-         idg = MAX( INT(LOG10(REAL(jpnij-1,wp))) + 1, 4 )          ! how many digits to we need to write? min=4, max=9
-         WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg   ! '(a,a,ix.x,a)'
+         idg = MAX( INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1, 4 )          ! how many digits to we need to write? min=4, max=9
+         WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg          ! '(a,a,ix.x,a)'
          WRITE(cl_filename,clfmt) TRIM(cl_filename), '_', narea-1, '.nc'
       ELSE
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/IOM/iom_nf90.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/IOM/iom_nf90.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/IOM/iom_nf90.F90	(revision 13058)
@@ -111,6 +111,6 @@
          IF( ldwrt ) THEN              !* the file should be open in write mode so we create it...
             IF( jpnij > 1 ) THEN
-               idg = MAX( INT(LOG10(REAL(jpnij-1,wp))) + 1, 4 )          ! how many digits to we need to write? min=4, max=9
-               WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg   ! '(a,a,ix.x,a)'
+               idg = MAX( INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1, 4 )          ! how many digits to we need to write? min=4, max=9
+               WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg          ! '(a,a,ix.x,a)'
                WRITE(cltmp,clfmt) cdname(1:iln-1), '_', narea-1, '.nc'
                cdname = TRIM(cltmp)
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/LBC/lib_mpp.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/LBC/lib_mpp.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/LBC/lib_mpp.F90	(revision 13058)
@@ -1114,20 +1114,17 @@
       !
       CHARACTER(LEN=8) ::   clfmt            ! writing format
-      INTEGER ::   inum
-      INTEGER ::   idg  ! number of digits
+      INTEGER          ::   inum
       !!----------------------------------------------------------------------
       !
       nstop = nstop + 1
       !
-      IF( numout == 6 ) THEN                          ! force to open ocean.output file if not already opened
-         CALL ctl_opn( numout, 'ocean.output', 'APPEND', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
-      ELSE
-         IF( narea > 1 .AND. cd1 == 'STOP' ) THEN     ! add an error message in ocean.output
-            CALL ctl_opn( inum,'ocean.output', 'APPEND', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
-            WRITE(inum,*)
-            idg = MAX( INT(LOG10(REAL(jpnij-1,wp))) + 1, 4 )        ! how many digits to we need to write? min=4, max=9
-            WRITE(clfmt, "('(a,i', i1, '.', i1, ')')") idg, idg     ! '(a,ix.x)'
-            WRITE(inum,clfmt) ' ===>>> : see E R R O R in ocean.output_', narea - 1
-         ENDIF
+      IF( cd1 == 'STOP' .AND. narea /= 1 ) THEN    ! Immediate stop: add an arror message in 'ocean.output' file
+         CALL ctl_opn( inum, 'ocean.output', 'APPEND', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
+         WRITE(inum,*)
+         WRITE(inum,*) ' ==>>>   Look for "E R R O R" messages in all existing *ocean.output* files'
+         CLOSE(inum)
+      ENDIF
+      IF( numout == 6 ) THEN                       ! force to open ocean.output file if not already opened
+         CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea )
       ENDIF
       !
@@ -1232,6 +1229,7 @@
       IF( PRESENT( karea ) ) THEN
          IF( karea > 1 ) THEN
-            idg = MAX( INT(LOG10(REAL(jpnij-1,wp))) + 1, 4 )        ! how many digits to we need to write? min=4, max=9
-            WRITE(clfmt, "('(a,a,i', i1, '.', i1, ')')") idg, idg   ! '(a,a,ix.x)'
+            ! Warning: jpnij is maybe not already defined when calling ctl_opn -> use mppsize instead of jpnij
+            idg = MAX( INT(LOG10(REAL(MAX(1,mppsize-1),wp))) + 1, 4 )      ! how many digits to we need to write? min=4, max=9
+            WRITE(clfmt, "('(a,a,i', i1, '.', i1, ')')") idg, idg          ! '(a,a,ix.x)'
             WRITE(clfile, clfmt) TRIM(clfile), '_', karea-1
          ENDIF
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/SBC/sbcmod.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/SBC/sbcmod.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/SBC/sbcmod.F90	(revision 13058)
@@ -120,15 +120,5 @@
       ncom_fsbc = nn_fsbc    ! make nn_fsbc available for lib_mpp
 #endif
-      !                             !* overwrite namelist parameter using CPP key information
-#if defined key_agrif
- !     IF( Agrif_Root() ) THEN                ! AGRIF zoom (cf r1242: possibility to run without ice in fine grid)
- !        IF( lk_si3  )   nn_ice      = 2
- !        IF( lk_cice )   nn_ice      = 3
- !     ENDIF
-!!GS: TBD
-!#else
-!      IF( lk_si3  )   nn_ice      = 2
-!      IF( lk_cice )   nn_ice      = 3
-#endif
+      !
       !
       IF(lwp) THEN                  !* Control print
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ZDF/zdftke.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ZDF/zdftke.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/ZDF/zdftke.F90	(revision 13058)
@@ -45,4 +45,10 @@
    USE zdfdrg         ! vertical physics: top/bottom drag coef.
    USE zdfmxl         ! vertical physics: mixed layer
+#if defined key_si3
+   USE ice, ONLY: hm_i, h_i
+#endif
+#if defined key_cice
+   USE sbc_ice, ONLY: h_i
+#endif
    !
    USE in_out_manager ! I/O manager
@@ -64,4 +70,6 @@
    INTEGER  ::   nn_mxl    ! type of mixing length (=0/1/2/3)
    REAL(wp) ::   rn_mxl0   ! surface  min value of mixing length (kappa*z_o=0.4*0.1 m)  [m]
+   INTEGER  ::      nn_mxlice ! type of scaling under sea-ice
+   REAL(wp) ::      rn_mxlice ! max constant ice thickness value when scaling under sea-ice ( nn_mxlice=1)
    INTEGER  ::   nn_pdl    ! Prandtl number or not (ratio avt/avm) (=0/1)
    REAL(wp) ::   rn_ediff  ! coefficient for avt: avt=rn_ediff*mxl*sqrt(e)
@@ -422,5 +430,5 @@
       REAL(wp) ::   zrn2, zraug, zcoef, zav   ! local scalars
       REAL(wp) ::   zdku,   zdkv, zsqen       !   -      -
-      REAL(wp) ::   zemxl, zemlm, zemlp       !   -      -
+      REAL(wp) ::   zemxl, zemlm, zemlp, zmaxice       !   -      -
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmxlm, zmxld   ! 3D workspace
       !!--------------------------------------------------------------------
@@ -436,12 +444,51 @@
       zmxld(:,:,:)  = rmxl_min
       !
-      IF( ln_mxl0 ) THEN            ! surface mixing length = F(stress) : l=vkarmn*2.e5*taum/(rho0*g)
+     IF( ln_mxl0 ) THEN            ! surface mixing length = F(stress) : l=vkarmn*2.e5*taum/(rho0*g)
+         !
          zraug = vkarmn * 2.e5_wp / ( rho0 * grav )
+#if ! defined key_si3 && ! defined key_cice
          DO_2D_00_00
-            zmxlm(ji,jj,1) = MAX( rn_mxl0, zraug * taum(ji,jj) * tmask(ji,jj,1) )
+            zmxlm(ji,jj,1) =  zraug * taum(ji,jj) * tmask(ji,jj,1)
          END_2D
-      ELSE 
+#else
+         SELECT CASE( nn_mxlice )             ! Type of scaling under sea-ice
+         !
+         CASE( 0 )                      ! No scaling under sea-ice
+            DO_2D_00_00
+               zmxlm(ji,jj,1) = zraug * taum(ji,jj) * tmask(ji,jj,1)
+            END_2D
+            !
+         CASE( 1 )                           ! scaling with constant sea-ice thickness
+            DO_2D_00_00
+               zmxlm(ji,jj,1) =  ( ( 1. - fr_i(ji,jj) ) * zraug * taum(ji,jj) + fr_i(ji,jj) * rn_mxlice ) * tmask(ji,jj,1)
+            END_2D
+            !
+         CASE( 2 )                                 ! scaling with mean sea-ice thickness
+            DO_2D_00_00
+#if defined key_si3
+               zmxlm(ji,jj,1) = ( ( 1. - fr_i(ji,jj) ) * zraug * taum(ji,jj) + fr_i(ji,jj) * hm_i(ji,jj) * 2. ) * tmask(ji,jj,1)
+#elif defined key_cice
+               zmaxice = MAXVAL( h_i(ji,jj,:) )
+               zmxlm(ji,jj,1) = ( ( 1. - fr_i(ji,jj) ) * zraug * taum(ji,jj) + fr_i(ji,jj) * zmaxice ) * tmask(ji,jj,1)
+#endif
+            END_2D
+            !
+         CASE( 3 )                                 ! scaling with max sea-ice thickness
+            DO_2D_00_00
+               zmaxice = MAXVAL( h_i(ji,jj,:) )
+               zmxlm(ji,jj,1) = ( ( 1. - fr_i(ji,jj) ) * zraug * taum(ji,jj) + fr_i(ji,jj) * zmaxice ) * tmask(ji,jj,1)
+            END_2D
+            !
+         END SELECT
+#endif
+         !
+         DO_2D_00_00
+            zmxlm(ji,jj,1) = MAX( rn_mxl0, zmxlm(ji,jj,1) )
+         END_2D
+         !
+      ELSE
          zmxlm(:,:,1) = rn_mxl0
       ENDIF
+
       !
       DO_3D_00_00( 2, jpkm1 )
@@ -547,8 +594,9 @@
       INTEGER             ::   ios
       !!
-      NAMELIST/namzdf_tke/ rn_ediff, rn_ediss , rn_ebb , rn_emin  ,          &
-         &                 rn_emin0, rn_bshear, nn_mxl , ln_mxl0  ,          &
-         &                 rn_mxl0 , nn_pdl   , ln_drg , ln_lc    , rn_lc,   &
-         &                 nn_etau , nn_htau  , rn_efr , rn_eice  
+      NAMELIST/namzdf_tke/ rn_ediff, rn_ediss , rn_ebb   , rn_emin  ,  &
+         &                 rn_emin0, rn_bshear, nn_mxl   , ln_mxl0  ,  &
+         &                 rn_mxl0 , nn_mxlice, rn_mxlice,             &
+         &                 nn_pdl  , ln_drg   , ln_lc    , rn_lc,      &
+         &                 nn_etau , nn_htau  , rn_efr   , rn_eice  
       !!----------------------------------------------------------------------
       !
@@ -576,4 +624,9 @@
          WRITE(numout,*) '      mixing length type                          nn_mxl    = ', nn_mxl
          WRITE(numout,*) '         surface mixing length = F(stress) or not    ln_mxl0   = ', ln_mxl0
+         IF( ln_mxl0 ) THEN
+            WRITE(numout,*) '      type of scaling under sea-ice               nn_mxlice = ', nn_mxlice
+            IF( nn_mxlice == 1 ) &
+            WRITE(numout,*) '      ice thickness when scaling under sea-ice    rn_mxlice = ', rn_mxlice
+         ENDIF         
          WRITE(numout,*) '         surface  mixing length minimum value        rn_mxl0   = ', rn_mxl0
          WRITE(numout,*) '      top/bottom friction forcing flag            ln_drg    = ', ln_drg
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/nemogcm.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/nemogcm.F90	(revision 13058)
@@ -228,9 +228,10 @@
          IF( ngrdstop > 0 ) THEN
             WRITE(ctmp9,'(i2)') ngrdstop
-            WRITE(ctmp2,*) '      ==>>>   Error detected in Agrif grid '//TRIM(ctmp9)
-            WRITE(ctmp3,*) '      ==>>>   look for error messages in '//TRIM(ctmp9)//'_ocean_output* files'
-            CALL ctl_stop( ctmp1, ctmp2, ctmp3 )
+            WRITE(ctmp2,*) '           E R R O R detected in Agrif grid '//TRIM(ctmp9)
+            WRITE(ctmp3,*) '           Look for "E R R O R" messages in all existing '//TRIM(ctmp9)//'_ocean_output* files'
+            CALL ctl_stop( ' ', ctmp1, ' ', ctmp2, ' ', ctmp3 )
          ELSE
-            CALL ctl_stop( ctmp1 )
+            WRITE(ctmp2,*) '           Look for "E R R O R" messages in all existing ocean_output* files'
+            CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 )
          ENDIF
       ENDIF
@@ -245,5 +246,5 @@
 #else
       IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS
-      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop      ! end mpp communications
+      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop        ! end mpp communications
       ENDIF
 #endif
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/stpctl.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/stpctl.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/stpctl.F90	(revision 13058)
@@ -260,5 +260,5 @@
       !!! WRITE(clsum, '(i'//clfmt//')') ksum                   ! this is creating a compilation error with AGRIF
       cl4 = '(i'//clfmt//')'   ;   WRITE(clsum, cl4) ksum
-      WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpnij-1,wp))) + 1     ! how many digits to we need to write ? (we decide max = 9)
+      WRITE(clfmt, '(i1)') INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1    ! how many digits to we need to write ? (we decide max = 9)
       cl4 = '(i'//clfmt//')'   ;   WRITE(clmin, cl4) kmin-1
                                    WRITE(clmax, cl4) kmax-1
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OFF/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OFF/nemogcm.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OFF/nemogcm.F90	(revision 13058)
@@ -147,5 +147,6 @@
       IF( nstop /= 0 .AND. lwp ) THEN                 ! error print
          WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found'
-         CALL ctl_stop( ctmp1 )
+         WRITE(ctmp2,*) '           Look for "E R R O R" messages in all existing ocean_output* files'
+         CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 )
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/SAS/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/SAS/nemogcm.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/SAS/nemogcm.F90	(revision 13058)
@@ -162,9 +162,10 @@
          IF( ngrdstop > 0 ) THEN
             WRITE(ctmp9,'(i2)') ngrdstop
-            WRITE(ctmp2,*) '      ==>>>   Error detected in Agrif grid '//TRIM(ctmp9)
-            WRITE(ctmp3,*) '      ==>>>   look for error messages in '//TRIM(ctmp9)//'_ocean_output* files'
-            CALL ctl_stop( ctmp1, ctmp2, ctmp3 )
+            WRITE(ctmp2,*) '           E R R O R detected in Agrif grid '//TRIM(ctmp9)
+            WRITE(ctmp3,*) '           Look for "E R R O R" messages in all existing '//TRIM(ctmp9)//'_ocean_output* files'
+            CALL ctl_stop( ' ', ctmp1, ' ', ctmp2, ' ', ctmp3 )
          ELSE
-            CALL ctl_stop( ctmp1 )
+            WRITE(ctmp2,*) '           Look for "E R R O R" messages in all existing ocean_output* files'
+            CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 )
          ENDIF
       ENDIF
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/SAS/stpctl.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/SAS/stpctl.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/SAS/stpctl.F90	(revision 13058)
@@ -220,5 +220,5 @@
       !!! WRITE(clsum, '(i'//clfmt//')') ksum                   ! this is creating a compilation error with AGRIF
       cl4 = '(i'//clfmt//')'   ;   WRITE(clsum, cl4) ksum
-      WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpnij-1,wp))) + 1     ! how many digits to we need to write ? (we decide max = 9)
+      WRITE(clfmt, '(i1)') INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1    ! how many digits to we need to write ? (we decide max = 9)
       cl4 = '(i'//clfmt//')'   ;   WRITE(clmin, cl4) kmin-1
                                    WRITE(clmax, cl4) kmax-1
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/TOP/PISCES/P4Z/p4zsms.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 13058)
@@ -206,5 +206,5 @@
       IF( l_trdtrc ) THEN
          DO jn = jp_pcs0, jp_pcs1
-           ztrdt(:,:,:,jn) = ( tr(:,:,:,jn,Kbb) - ztrdt(:,:,:,jn) ) * rfact2r 
+           ztrdt(:,:,:,jn) = ( tr(:,:,:,jn,Kbb) - ztrdt(:,:,:,jn) ) * rfactr 
            CALL trd_trc( tr(:,:,:,jn,Krhs), jn, jptra_sms, kt, Kmm )   ! save trends
          END DO
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/CANAL/MY_SRC/stpctl.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/CANAL/MY_SRC/stpctl.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/CANAL/MY_SRC/stpctl.F90	(revision 13058)
@@ -260,5 +260,5 @@
       !!! WRITE(clsum, '(i'//clfmt//')') ksum                   ! this is creating a compilation error with AGRIF
       cl4 = '(i'//clfmt//')'   ;   WRITE(clsum, cl4) ksum
-      WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpnij-1,wp))) + 1     ! how many digits to we need to write ? (we decide max = 9)
+      WRITE(clfmt, '(i1)') INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1    ! how many digits to we need to write ? (we decide max = 9)
       cl4 = '(i'//clfmt//')'   ;   WRITE(clmin, cl4) kmin-1
                                    WRITE(clmax, cl4) kmax-1
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/STATION_ASF/MY_SRC/nemogcm.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/STATION_ASF/MY_SRC/nemogcm.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/STATION_ASF/MY_SRC/nemogcm.F90	(revision 13058)
@@ -100,5 +100,6 @@
       IF( nstop /= 0 .AND. lwp ) THEN        ! error print
          WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found'
-         CALL ctl_stop( ctmp1 )
+         WRITE(ctmp2,*) '           Look for "E R R O R" messages in all existing ocean_output* files'
+         CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 )
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/STATION_ASF/MY_SRC/stpctl.F90
===================================================================
--- /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/STATION_ASF/MY_SRC/stpctl.F90	(revision 13057)
+++ /NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/tests/STATION_ASF/MY_SRC/stpctl.F90	(revision 13058)
@@ -219,5 +219,5 @@
       !!! WRITE(clsum, '(i'//clfmt//')') ksum                   ! this is creating a compilation error with AGRIF
       cl4 = '(i'//clfmt//')'   ;   WRITE(clsum, cl4) ksum
-      WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpnij-1,wp))) + 1     ! how many digits to we need to write ? (we decide max = 9)
+      WRITE(clfmt, '(i1)') INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1    ! how many digits to we need to write ? (we decide max = 9)
       cl4 = '(i'//clfmt//')'   ;   WRITE(clmin, cl4) kmin-1
                                    WRITE(clmax, cl4) kmax-1
