Index: NEMO/branches/2020/dev_12905_xios_restart/src/OFF/dtadyn.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OFF/dtadyn.F90	(revision 13000)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OFF/dtadyn.F90	(revision 13727)
@@ -23,5 +23,9 @@
    USE c1d             ! 1D configuration: lk_c1d
    USE dom_oce         ! ocean domain: variables
+#if ! defined key_qco 
    USE domvvl          ! variable volume
+#else
+   USE domqco
+#endif
    USE zdf_oce         ! ocean vertical physics: variables
    USE sbc_oce         ! surface module: variables
@@ -52,5 +56,7 @@
    PUBLIC   dta_dyn_sed        ! called by nemo_gcm
    PUBLIC   dta_dyn_atf        ! called by nemo_gcm
+#if ! defined key_qco
    PUBLIC   dta_dyn_sf_interp  ! called by nemo_gcm
+#endif
 
    CHARACTER(len=100) ::   cn_dir          !: Root directory for location of ssr files
@@ -65,5 +71,5 @@
    INTEGER  , SAVE      ::   jf_uwd         ! index of u-transport
    INTEGER  , SAVE      ::   jf_vwd         ! index of v-transport
-   INTEGER  , SAVE      ::   jf_wwd         ! index of v-transport
+   INTEGER  , SAVE      ::   jf_wwd         ! index of w-transport
    INTEGER  , SAVE      ::   jf_avt         ! index of Kz
    INTEGER  , SAVE      ::   jf_mld         ! index of mixed layer deptht
@@ -122,5 +128,5 @@
       !
       IF( kt == nit000 ) THEN    ;    nprevrec = 0
-      ELSE                       ;    nprevrec = sf_dyn(jf_tem)%nrec_a(2)
+      ELSE                       ;    nprevrec = sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%naa)
       ENDIF
       CALL fld_read( kt, 1, sf_dyn )      !=  read data at kt time step   ==!
@@ -149,5 +155,10 @@
          emp_b  (:,:)   = sf_dyn(jf_empb)%fnow(:,:,1) * tmask(:,:,1)    ! E-P
          zemp   (:,:)   = ( 0.5_wp * ( emp(:,:) + emp_b(:,:) ) + rnf(:,:) + fwbcorr ) * tmask(:,:,1)
-         CALL dta_dyn_ssh( kt, zhdivtr, ssh(:,:,Kbb), zemp, ssh(:,:,Kaa), e3t(:,:,:,Kaa) )  !=  ssh, vertical scale factor & vertical transport
+#if defined key_qco
+         CALL dta_dyn_ssh( kt, zhdivtr, ssh(:,:,Kbb), zemp, ssh(:,:,Kaa) )
+         CALL dom_qco_r3c( ssh(:,:,Kaa), r3t(:,:,Kaa), r3u(:,:,Kaa), r3v(:,:,Kaa) )
+#else
+         CALL dta_dyn_ssh( kt, zhdivtr, ssh(:,:,Kbb), zemp, ssh(:,:,Kaa), e3t(:,:,:,Kaa) )  !=  ssh, vertical scale factor
+#endif
          DEALLOCATE( zemp , zhdivtr )
          !                                           Write in the tracer restart file
@@ -283,4 +294,11 @@
       !                                         ! fill sf with slf_i and control print
       CALL fld_fill( sf_dyn, slf_d, cn_dir, 'dta_dyn_init', 'Data in file', 'namdta_dyn' )
+      sf_dyn(jf_uwd)%cltype = 'U'   ;   sf_dyn(jf_uwd)%zsgn = -1._wp  
+      sf_dyn(jf_vwd)%cltype = 'V'   ;   sf_dyn(jf_vwd)%zsgn = -1._wp  
+      !
+      IF( ln_trabbl ) THEN
+         sf_dyn(jf_ubl)%cltype = 'U'   ;   sf_dyn(jf_ubl)%zsgn =  1._wp  
+         sf_dyn(jf_vbl)%cltype = 'V'   ;   sf_dyn(jf_vbl)%zsgn =  1._wp  
+      END IF
       !
       ! Open file for each variable to get his number of dimension
@@ -319,16 +337,20 @@
            iom_varid( numrtr, 'sshn', ldstop = .FALSE. ) > 0 ) THEN
            IF(lwp) WRITE(numout,*) ' ssh(:,:,Kmm) forcing fields read in the restart file for initialisation'
-           CALL iom_get( numrtr, jpdom_autoglo, 'sshn', ssh(:,:,Kmm)   )
-           CALL iom_get( numrtr, jpdom_autoglo, 'sshb', ssh(:,:,Kbb)   )
+           CALL iom_get( numrtr, jpdom_auto, 'sshn', ssh(:,:,Kmm)   )
+           CALL iom_get( numrtr, jpdom_auto, 'sshb', ssh(:,:,Kbb)   )
         ELSE
            IF(lwp) WRITE(numout,*) ' ssh(:,:,Kmm) forcing fields read in the restart file for initialisation'
            CALL iom_open( 'restart', inum )
-           CALL iom_get( inum, jpdom_autoglo, 'sshn', ssh(:,:,Kmm)   )
-           CALL iom_get( inum, jpdom_autoglo, 'sshb', ssh(:,:,Kbb)   )
+           CALL iom_get( inum, jpdom_auto, 'sshn', ssh(:,:,Kmm)   )
+           CALL iom_get( inum, jpdom_auto, 'sshb', ssh(:,:,Kbb)   )
            CALL iom_close( inum )                                        ! close file
         ENDIF
         !
+#if defined key_qco
+        CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb) )
+        CALL dom_qco_r3c( ssh(:,:,Kmm), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm) )
+#else
         DO jk = 1, jpkm1
-           e3t(:,:,jk,Kmm) = e3t_0(:,:,jk) * ( 1._wp + ssh(:,:,Kmm) * tmask(:,:,1) / ( ht_0(:,:) + 1.0 - tmask(:,:,1) ) )
+           e3t(:,:,jk,Kmm) = e3t_0(:,:,jk) * ( 1._wp + ssh(:,:,Kmm) * r1_ht_0(:,:) * tmask(:,:,jk) )
         ENDDO
         e3t(:,:,jpk,Kaa) = e3t_0(:,:,jpk)
@@ -342,5 +364,5 @@
         ! ------------------------------------
         CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3w(:,:,:,Kmm), 'W' )
-  
+!!gm this should be computed from ssh(Kbb)  
         e3t(:,:,:,Kbb)  = e3t(:,:,:,Kmm)
         e3u(:,:,:,Kbb)  = e3u(:,:,:,Kmm)
@@ -352,5 +374,5 @@
         gdepw(:,:,1,Kmm) = 0.0_wp
 
-        DO_3D_11_11( 2, jpk )
+        DO_3D( 1, 1, 1, 1, 2, jpk )
           !    zcoef = (tmask(ji,jj,jk) - wmask(ji,jj,jk))   ! 0 everywhere
           !    tmask = wmask, ie everywhere expect at jk = mikt
@@ -367,4 +389,5 @@
         !
       ENDIF
+#endif
       !
       IF( ln_dynrnf .AND. ln_dynrnf_depth ) THEN       ! read depht over which runoffs are distributed
@@ -372,9 +395,9 @@
          IF(lwp) WRITE(numout,*) ' read in the file depht over which runoffs are distributed'
          CALL iom_open ( "runoffs", inum )                           ! open file
-         CALL iom_get  ( inum, jpdom_data, 'rodepth', h_rnf )   ! read the river mouth array
+         CALL iom_get  ( inum, jpdom_global, 'rodepth', h_rnf )   ! read the river mouth array
          CALL iom_close( inum )                                        ! close file
          !
          nk_rnf(:,:) = 0                               ! set the number of level over which river runoffs are applied
-         DO_2D_11_11
+         DO_2D( 1, 1, 1, 1 )
             IF( h_rnf(ji,jj) > 0._wp ) THEN
                jk = 2
@@ -389,5 +412,5 @@
             ENDIF
          END_2D
-         DO_2D_11_11
+         DO_2D( 1, 1, 1, 1 )                           ! set the associated depth
             h_rnf(ji,jj) = 0._wp
             DO jk = 1, nk_rnf(ji,jj)
@@ -413,4 +436,5 @@
    END SUBROUTINE dta_dyn_init
 
+   
    SUBROUTINE dta_dyn_sed( kt, Kmm )
       !!----------------------------------------------------------------------
@@ -434,5 +458,5 @@
       !
       IF( kt == nit000 ) THEN    ;    nprevrec = 0
-      ELSE                       ;    nprevrec = sf_dyn(jf_tem)%nrec_a(2)
+      ELSE                       ;    nprevrec = sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%naa)
       ENDIF
       CALL fld_read( kt, 1, sf_dyn )      !=  read data at kt time step   ==!
@@ -529,4 +553,5 @@
    END SUBROUTINE dta_dyn_sed_init
 
+   
    SUBROUTINE dta_dyn_atf( kt, Kbb, Kmm, Kaa )
      !!---------------------------------------------------------------------
@@ -552,4 +577,6 @@
    END SUBROUTINE dta_dyn_atf
    
+   
+#if ! defined key_qco    
    SUBROUTINE dta_dyn_sf_interp( kt, Kmm )
       !!---------------------------------------------------------------------
@@ -580,5 +607,5 @@
       gdepw(:,:,1,Kmm) = 0.0_wp
       !
-      DO_3D_11_11( 2, jpk )
+      DO_3D( 1, 1, 1, 1, 2, jpk )
          zcoef = (tmask(ji,jj,jk) - wmask(ji,jj,jk))
          gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm)
@@ -588,4 +615,6 @@
       !
    END SUBROUTINE dta_dyn_sf_interp
+#endif
+
 
    SUBROUTINE dta_dyn_ssh( kt, phdivtr, psshb,  pemp, pssha, pe3ta )
@@ -606,5 +635,5 @@
       !!          The boundary conditions are w=0 at the bottom (no flux)
       !!
-      !! ** action  :   ssh(:,:,Kaa) / e3t(:,:,:,Kaa) / ww
+      !! ** action  :   ssh(:,:,Kaa) / e3t(:,:,k,Kaa) / ww
       !!
       !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
@@ -630,9 +659,10 @@
       !                                                ! Sea surface  elevation time-stepping
       pssha(:,:) = ( psshb(:,:) - z2dt * ( r1_rho0 * pemp(:,:)  + zhdiv(:,:) ) ) * ssmask(:,:)
-      !                                                 ! 
-      !                                                 ! After acale factors at t-points ( z_star coordinate )
+      !
+      IF( PRESENT( pe3ta ) ) THEN                      ! After acale factors at t-points ( z_star coordinate )
       DO jk = 1, jpkm1
-        pe3ta(:,:,jk) = e3t_0(:,:,jk) * ( 1._wp + pssha(:,:) * tmask(:,:,1) / ( ht_0(:,:) + 1.0 - tmask(:,:,1) ) )
+            pe3ta(:,:,jk) = e3t_0(:,:,jk) * ( 1._wp + pssha(:,:) * r1_ht_0(:,:) * tmask(:,:,jk) )
       END DO
+      ENDIF
       !
    END SUBROUTINE dta_dyn_ssh
@@ -657,5 +687,5 @@
       !!----------------------------------------------------------------------
       !
-      DO_2D_11_11
+      DO_2D( 1, 1, 1, 1 )               ! update the depth over which runoffs are distributed
          h_rnf(ji,jj) = 0._wp
          DO jk = 1, nk_rnf(ji,jj)                           ! recalculates h_rnf to be the depth in metres
@@ -686,10 +716,11 @@
       !!---------------------------------------------------------------------
       !
-      IF( sf_dyn(jf_tem)%ln_tint ) THEN    ! Computes slopes (here avt is used as workspace)                       
+      IF( sf_dyn(jf_tem)%ln_tint ) THEN    ! Computes slopes (here avt is used as workspace)
+         !
          IF( kt == nit000 ) THEN
             IF(lwp) WRITE(numout,*) ' Compute new slopes at kt = ', kt
-            zts(:,:,:,jp_tem) = sf_dyn(jf_tem)%fdta(:,:,:,1) * tmask(:,:,:)   ! temperature
-            zts(:,:,:,jp_sal) = sf_dyn(jf_sal)%fdta(:,:,:,1) * tmask(:,:,:)   ! salinity 
-            avt(:,:,:)        = sf_dyn(jf_avt)%fdta(:,:,:,1) * tmask(:,:,:)   ! vertical diffusive coef.
+            zts(:,:,:,jp_tem) = sf_dyn(jf_tem)%fdta(:,:,:,sf_dyn(jf_tem)%nbb) * tmask(:,:,:)   ! temperature
+            zts(:,:,:,jp_sal) = sf_dyn(jf_sal)%fdta(:,:,:,sf_dyn(jf_sal)%nbb) * tmask(:,:,:)   ! salinity 
+            avt(:,:,:)        = sf_dyn(jf_avt)%fdta(:,:,:,sf_dyn(jf_avt)%nbb) * tmask(:,:,:)   ! vertical diffusive coef.
             CALL compute_slopes( kt, zts, zuslp, zvslp, zwslpi, zwslpj, Kbb, Kmm )
             uslpdta (:,:,:,1) = zuslp (:,:,:) 
@@ -698,7 +729,7 @@
             wslpjdta(:,:,:,1) = zwslpj(:,:,:) 
             !
-            zts(:,:,:,jp_tem) = sf_dyn(jf_tem)%fdta(:,:,:,2) * tmask(:,:,:)   ! temperature
-            zts(:,:,:,jp_sal) = sf_dyn(jf_sal)%fdta(:,:,:,2) * tmask(:,:,:)   ! salinity 
-            avt(:,:,:)        = sf_dyn(jf_avt)%fdta(:,:,:,2) * tmask(:,:,:)   ! vertical diffusive coef.
+            zts(:,:,:,jp_tem) = sf_dyn(jf_tem)%fdta(:,:,:,sf_dyn(jf_tem)%naa) * tmask(:,:,:)   ! temperature
+            zts(:,:,:,jp_sal) = sf_dyn(jf_sal)%fdta(:,:,:,sf_dyn(jf_sal)%naa) * tmask(:,:,:)   ! salinity 
+            avt(:,:,:)        = sf_dyn(jf_avt)%fdta(:,:,:,sf_dyn(jf_avt)%naa) * tmask(:,:,:)   ! vertical diffusive coef.
             CALL compute_slopes( kt, zts, zuslp, zvslp, zwslpi, zwslpj, Kbb, Kmm )
             uslpdta (:,:,:,2) = zuslp (:,:,:) 
@@ -709,6 +740,6 @@
            ! 
            iswap = 0
-           IF( sf_dyn(jf_tem)%nrec_a(2) - nprevrec /= 0 )  iswap = 1
-           IF( nsecdyn > sf_dyn(jf_tem)%nrec_b(2) .AND. iswap == 1 )  THEN    ! read/update the after data
+           IF( sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%naa) - nprevrec /= 0 )  iswap = 1
+           IF( nsecdyn > sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%nbb) .AND. iswap == 1 )  THEN    ! read/update the after data
               IF(lwp) WRITE(numout,*) ' Compute new slopes at kt = ', kt
               uslpdta (:,:,:,1) =  uslpdta (:,:,:,2)         ! swap the data
@@ -717,7 +748,7 @@
               wslpjdta(:,:,:,1) =  wslpjdta(:,:,:,2) 
               !
-              zts(:,:,:,jp_tem) = sf_dyn(jf_tem)%fdta(:,:,:,2) * tmask(:,:,:)   ! temperature
-              zts(:,:,:,jp_sal) = sf_dyn(jf_sal)%fdta(:,:,:,2) * tmask(:,:,:)   ! salinity 
-              avt(:,:,:)        = sf_dyn(jf_avt)%fdta(:,:,:,2) * tmask(:,:,:)   ! vertical diffusive coef.
+              zts(:,:,:,jp_tem) = sf_dyn(jf_tem)%fdta(:,:,:,sf_dyn(jf_tem)%naa) * tmask(:,:,:)   ! temperature
+              zts(:,:,:,jp_sal) = sf_dyn(jf_sal)%fdta(:,:,:,sf_dyn(jf_sal)%naa) * tmask(:,:,:)   ! salinity 
+              avt(:,:,:)        = sf_dyn(jf_avt)%fdta(:,:,:,sf_dyn(jf_avt)%naa) * tmask(:,:,:)   ! vertical diffusive coef.
               CALL compute_slopes( kt, zts, zuslp, zvslp, zwslpi, zwslpj, Kbb, Kmm )
               !
@@ -731,6 +762,6 @@
       !
       IF( sf_dyn(jf_tem)%ln_tint )  THEN
-         ztinta =  REAL( nsecdyn - sf_dyn(jf_tem)%nrec_b(2), wp )  &
-            &    / REAL( sf_dyn(jf_tem)%nrec_a(2) - sf_dyn(jf_tem)%nrec_b(2), wp )
+         ztinta =  REAL( nsecdyn - sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%nbb), wp )  &
+            &    / REAL( sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%naa) - sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%nbb), wp )
          ztintb =  1. - ztinta
          IF( l_ldfslp .AND. .NOT.lk_c1d ) THEN    ! Computes slopes (here avt is used as workspace)
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OFF/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OFF/nemogcm.F90	(revision 13000)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OFF/nemogcm.F90	(revision 13727)
@@ -28,6 +28,8 @@
    USE usrdef_nam     ! user defined configuration
    USE eosbn2         ! equation of state            (eos bn2 routine)
-   USE bdy_oce,  ONLY : ln_bdy
-   USE bdyini         ! open boundary cond. setting       (bdy_init routine)
+#if defined key_qco
+   USE domqco         ! tools for scale factor         (dom_qco_r3c  routine)
+#endif
+   USE bdyini         ! open boundary cond. setting        (bdy_init routine)
    !              ! ocean physics
    USE ldftra         ! lateral diffusivity setting    (ldf_tra_init routine)
@@ -38,4 +40,5 @@
    USE sbcmod         ! surface boundary condition     (sbc_init     routine)
    USE phycst         ! physical constant                   (par_cst routine)
+   USE zdfphy         ! vertical physics manager       (zdf_phy_init routine)
    USE dtadyn         ! Lecture and Interpolation of the dynamical fields
    USE trcini         ! Initilization of the passive tracers
@@ -47,5 +50,4 @@
    USE trcnam         ! passive tracer : namelist
    USE trcrst         ! passive tracer restart
-   USE diaptr         ! Need to initialise this as some variables are used in if statements later
    USE sbc_oce , ONLY : ln_rnf
    USE sbcrnf         ! surface boundary condition : runoffs
@@ -61,6 +63,7 @@
    USE timing         ! Timing
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
-   USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges
+   USE lbcnfd  , ONLY : isendto, nsndto   ! Setup of north fold exchanges
    USE step, ONLY : Nbb, Nnn, Naa, Nrhs   ! time level indices
+   USE halo_mng
 
    IMPLICIT NONE
@@ -70,4 +73,8 @@
 
    CHARACTER (len=64) ::   cform_aaa="( /, 'AAAAAAAA', / ) "   ! flag for output listing
+#if defined key_mpp_mpi
+   ! need MPI_Wtime
+   INCLUDE 'mpif.h'
+#endif
 
    !!----------------------------------------------------------------------
@@ -92,5 +99,6 @@
       !!              Madec, 2008, internal report, IPSL.
       !!----------------------------------------------------------------------
-      INTEGER :: istp, indic       ! time step index
+      INTEGER :: istp       ! time step index
+      REAL(wp)::   zstptiming   ! elapsed time for 1 time step
       !!----------------------------------------------------------------------
 
@@ -111,4 +119,10 @@
       ! 
       DO WHILE ( istp <= nitend .AND. nstop == 0 )    !==  OFF time-stepping  ==!
+
+         IF( ln_timing ) THEN
+            zstptiming = MPI_Wtime()
+            IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming
+            IF ( istp ==         nitend ) elapsed_time = zstptiming - elapsed_time
+         ENDIF
          !
       IF((istp == nitrst) .AND. lwxios) THEN
@@ -125,7 +139,17 @@
                                 CALL dta_dyn    ( istp, Nbb, Nnn, Naa )       ! Interpolation of the dynamical fields
 #endif
+#if ! defined key_sed_off
+         IF( .NOT.ln_linssh ) THEN
+                                CALL dta_dyn_atf( istp, Nbb, Nnn, Naa )       ! time filter of sea  surface height and vertical scale factors
+# if defined key_qco
+                                CALL dom_qco_r3c( ssh(:,:,Kmm), r3t_f, r3u_f, r3v_f )
+# endif
+         ENDIF
                                 CALL trc_stp    ( istp, Nbb, Nnn, Nrhs, Naa ) ! time-stepping
-#if ! defined key_sed_off
-         IF( .NOT.ln_linssh )   CALL dta_dyn_atf( istp, Nbb, Nnn, Naa )       ! time filter of sea  surface height and vertical scale factors
+# if defined key_qco
+                                !r3t(:,:,Kmm) = r3t_f(:,:)                     ! update ssh to h0 ratio
+                                !r3u(:,:,Kmm) = r3u_f(:,:)
+                                !r3v(:,:,Kmm) = r3v_f(:,:)
+# endif
 #endif
          ! Swap time levels
@@ -135,9 +159,14 @@
          Naa = Nrhs
          !
+#if ! defined key_qco
 #if ! defined key_sed_off
          IF( .NOT.ln_linssh )   CALL dta_dyn_sf_interp( istp, Nnn )  ! calculate now grid parameters
 #endif
-                                CALL stp_ctl    ( istp, indic )  ! Time loop: control and print
+#endif         
+         CALL stp_ctl    ( istp )             ! Time loop: control and print
          istp = istp + 1
+
+         IF( lwp .AND. ln_timing )   WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming
+
       END DO
       !
@@ -153,5 +182,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
       !
@@ -183,11 +213,11 @@
       INTEGER ::   ios, ilocal_comm   ! local integers
       !!
-      NAMELIST/namctl/ sn_cfctl, nn_print, nn_ictls, nn_ictle,              &
-         &             nn_isplt , nn_jsplt, nn_jctls, nn_jctle,             &
-         &             ln_timing, ln_diacfl
+      NAMELIST/namctl/ sn_cfctl, ln_timing, ln_diacfl,                                &
+         &             nn_isplt,  nn_jsplt,  nn_ictls, nn_ictle, nn_jctls, nn_jctle
       NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr
       !!----------------------------------------------------------------------
       !
       cxios_context = 'nemo'
+      nn_hls = 1
       !
       !                             !-------------------------------------------------!
@@ -235,20 +265,6 @@
       !
       ! finalize the definition of namctl variables
-      IF( sn_cfctl%l_allon ) THEN
-         ! Turn on all options.
-         CALL nemo_set_cfctl( sn_cfctl, .TRUE., .TRUE. )
-         ! Ensure all processors are active
-         sn_cfctl%procmin = 0 ; sn_cfctl%procmax = 1000000 ; sn_cfctl%procincr = 1
-      ELSEIF( sn_cfctl%l_config ) THEN
-         ! Activate finer control of report outputs
-         ! optionally switch off output from selected areas (note this only
-         ! applies to output which does not involve global communications)
-         IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. &
-           & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    &
-           &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. )
-      ELSE
-         ! turn off all options.
-         CALL nemo_set_cfctl( sn_cfctl, .FALSE., .TRUE. )
-      ENDIF
+      IF( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax .OR. MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 )   &
+         &   CALL nemo_set_cfctl( sn_cfctl, .FALSE. )
       !
       lwp = (narea == 1) .OR. sn_cfctl%l_oceout    ! control of all listing output print
@@ -296,7 +312,7 @@
       !
       IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
       ELSE                                ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
       ENDIF
       !
@@ -310,4 +326,5 @@
       CALL mpp_init
 
+      CALL halo_mng_init()
       ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays
       CALL nemo_alloc()
@@ -336,9 +353,11 @@
 
                            CALL     sbc_init( Nbb, Nnn, Naa )    ! Forcings : surface module
-                           CALL     bdy_init    ! Open boundaries initialisation    
+                           CALL     bdy_init    ! Open boundaries initialisation
+                           
+                           CALL zdf_phy_init( Nnn )    ! Vertical physics
 
       !                                      ! Tracer physics
                            CALL ldf_tra_init    ! Lateral ocean tracer physics
-                           CALL ldf_eiv_init    ! Eddy induced velocity param
+                           CALL ldf_eiv_init    ! Eddy induced velocity param. must be done after ldf_tra_init
                            CALL tra_ldf_init    ! lateral mixing
       IF( l_ldfslp     )   CALL ldf_slp_init    ! slope of lateral mixing
@@ -354,7 +373,5 @@
                            CALL dta_dyn_init( Nbb, Nnn, Naa )        ! Initialization for the dynamics
 #endif
-
                            CALL     trc_init( Nbb, Nnn, Naa )        ! Passive tracers initialization
-                           CALL dia_ptr_init   ! Poleward TRansports initialization
                            
       IF(lwp) WRITE(numout,cform_aaa)           ! Flag AAAAAAA
@@ -379,7 +396,4 @@
          WRITE(numout,*) '~~~~~~~~'
          WRITE(numout,*) '   Namelist namctl'
-         WRITE(numout,*) '                              sn_cfctl%l_glochk  = ', sn_cfctl%l_glochk
-         WRITE(numout,*) '                              sn_cfctl%l_allon   = ', sn_cfctl%l_allon
-         WRITE(numout,*) '       finer control over o/p sn_cfctl%l_config  = ', sn_cfctl%l_config
          WRITE(numout,*) '                              sn_cfctl%l_runstat = ', sn_cfctl%l_runstat
          WRITE(numout,*) '                              sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat
@@ -393,23 +407,9 @@
          WRITE(numout,*) '                              sn_cfctl%procincr  = ', sn_cfctl%procincr 
          WRITE(numout,*) '                              sn_cfctl%ptimincr  = ', sn_cfctl%ptimincr 
-         WRITE(numout,*) '      level of print                  nn_print   = ', nn_print
-         WRITE(numout,*) '      Start i indice for SUM control  nn_ictls   = ', nn_ictls
-         WRITE(numout,*) '      End i indice for SUM control    nn_ictle   = ', nn_ictle
-         WRITE(numout,*) '      Start j indice for SUM control  nn_jctls   = ', nn_jctls
-         WRITE(numout,*) '      End j indice for SUM control    nn_jctle   = ', nn_jctle
-         WRITE(numout,*) '      number of proc. following i     nn_isplt   = ', nn_isplt
-         WRITE(numout,*) '      number of proc. following j     nn_jsplt   = ', nn_jsplt
          WRITE(numout,*) '      timing by routine               ln_timing  = ', ln_timing
          WRITE(numout,*) '      CFL diagnostics                 ln_diacfl  = ', ln_diacfl
       ENDIF
-      !
-      nprint    = nn_print          ! convert DOCTOR namelist names into OLD names
-      nictls    = nn_ictls
-      nictle    = nn_ictle
-      njctls    = nn_jctls
-      njctle    = nn_jctle
-      isplt     = nn_isplt
-      jsplt     = nn_jsplt
-
+
+      IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file
       IF(lwp) THEN                  ! control print
          WRITE(numout,*)
@@ -422,44 +422,4 @@
          WRITE(numout,*) '      use file attribute if exists as i/p j-start ln_use_jattr     = ', ln_use_jattr
       ENDIF
-      IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file
-      !
-      !                             ! Parameter control
-      !
-      IF( sn_cfctl%l_prtctl .OR. sn_cfctl%l_prttrc ) THEN              ! sub-domain area indices for the control prints
-         IF( lk_mpp .AND. jpnij > 1 ) THEN
-            isplt = jpni   ;   jsplt = jpnj   ;   ijsplt = jpni*jpnj   ! the domain is forced to the real split domain
-         ELSE
-            IF( isplt == 1 .AND. jsplt == 1  ) THEN
-               CALL ctl_warn( ' - isplt & jsplt are equal to 1',   &
-                  &           ' - the print control will be done over the whole domain' )
-            ENDIF
-            ijsplt = isplt * jsplt            ! total number of processors ijsplt
-         ENDIF
-         IF(lwp) WRITE(numout,*)'          - The total number of processors over which the'
-         IF(lwp) WRITE(numout,*)'            print control will be done is ijsplt : ', ijsplt
-         !
-         !                              ! indices used for the SUM control
-         IF( nictls+nictle+njctls+njctle == 0 )   THEN    ! print control done over the default area
-            lsp_area = .FALSE.
-         ELSE                                             ! print control done over a specific  area
-            lsp_area = .TRUE.
-            IF( nictls < 1 .OR. nictls > jpiglo )   THEN
-               CALL ctl_warn( '          - nictls must be 1<=nictls>=jpiglo, it is forced to 1' )
-               nictls = 1
-            ENDIF
-            IF( nictle < 1 .OR. nictle > jpiglo )   THEN
-               CALL ctl_warn( '          - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' )
-               nictle = jpiglo
-            ENDIF
-            IF( njctls < 1 .OR. njctls > jpjglo )   THEN
-               CALL ctl_warn( '          - njctls must be 1<=njctls>=jpjglo, it is forced to 1' )
-               njctls = 1
-            ENDIF
-            IF( njctle < 1 .OR. njctle > jpjglo )   THEN
-               CALL ctl_warn( '          - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' )
-               njctle = jpjglo
-            ENDIF
-         ENDIF
-      ENDIF
       !
       IF( 1._wp /= SIGN(1._wp,-0._wp)  )   CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.',  &
@@ -517,25 +477,18 @@
    END SUBROUTINE nemo_alloc
 
-   SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all )
+   SUBROUTINE nemo_set_cfctl(sn_cfctl, setto )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE nemo_set_cfctl  ***
       !!
       !! ** Purpose :   Set elements of the output control structure to setto.
-      !!                for_all should be .false. unless all areas are to be
-      !!                treated identically.
-      !!
+     !!
       !! ** Method  :   Note this routine can be used to switch on/off some
-      !!                types of output for selected areas but any output types
-      !!                that involve global communications (e.g. mpp_max, glob_sum)
-      !!                should be protected from selective switching by the
-      !!                for_all argument
-      !!----------------------------------------------------------------------
-      LOGICAL :: setto, for_all
-      TYPE(sn_ctl) :: sn_cfctl
-      !!----------------------------------------------------------------------
-      IF( for_all ) THEN
-         sn_cfctl%l_runstat = setto
-         sn_cfctl%l_trcstat = setto
-      ENDIF
+      !!                types of output for selected areas.
+      !!----------------------------------------------------------------------
+      TYPE(sn_ctl), INTENT(inout) :: sn_cfctl
+      LOGICAL     , INTENT(in   ) :: setto
+      !!----------------------------------------------------------------------
+      sn_cfctl%l_runstat = setto
+      sn_cfctl%l_trcstat = setto
       sn_cfctl%l_oceout  = setto
       sn_cfctl%l_layout  = setto
@@ -567,5 +520,5 @@
 
 
-   SUBROUTINE stp_ctl( kt, kindic )
+   SUBROUTINE stp_ctl( kt )
       !!----------------------------------------------------------------------
       !!                    ***  ROUTINE stp_ctl  ***
@@ -578,5 +531,4 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in   ) ::   kt      ! ocean time-step index
-      INTEGER, INTENT(inout) ::   kindic  ! indicator of solver convergence
       !!----------------------------------------------------------------------
       !
