Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/1_namelist_cfg
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/1_namelist_cfg	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/1_namelist_cfg	(revision 13899)
@@ -106,6 +106,6 @@
 !!                                                                    !!
 !!   namdrg        top/bottom drag coefficient                          (default: NO selection)
-!!   namdrg_top    top    friction                                      (ln_OFF=F & ln_isfcav=T)
-!!   namdrg_bot    bottom friction                                      (ln_OFF=F)
+!!   namdrg_top    top    friction                                      (ln_drg_OFF=F & ln_isfcav=T)
+!!   namdrg_bot    bottom friction                                      (ln_drg_OFF=F)
 !!   nambbc        bottom temperature boundary condition                (default: OFF)
 !!   nambbl        bottom boundary layer scheme                         (default: OFF)
@@ -115,5 +115,5 @@
 &namdrg        !   top/bottom drag coefficient                          (default: NO selection)
 !-----------------------------------------------------------------------
-   ln_OFF     = .true.     !  free-slip       : Cd = 0                  
+   ln_drg_OFF = .true.    !  free-slip       : Cd = 0                  (F => fill namdrg_bot
 /
 !!======================================================================
@@ -197,5 +197,4 @@
 !!                                                                    !!
 !!   namtrd       dynamics and/or tracer trends                         (default: OFF)
-!!   namptr       Poleward Transport Diagnostics                        (default: OFF)
 !!   namhsb       Heat and salt budgets                                 (default: OFF)
 !!   namdiu       Cool skin and warm layer models                       (default: OFF)
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/AGRIF_FixedGrids.in
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/AGRIF_FixedGrids.in	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/AGRIF_FixedGrids.in	(revision 13899)
@@ -1,3 +1,3 @@
 1
-34 63 34 63 3 3 3
+33 62 33 62 3 3 3
 0
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/context_nemo.xml
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/context_nemo.xml	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/context_nemo.xml	(revision 13899)
@@ -11,5 +11,5 @@
        <variable id="ref_month" type="int"> 01 </variable>
        <variable id="ref_day"   type="int"> 01 </variable>
-       <variable id="rau0"      type="float" > 1026.0 </variable>
+       <variable id="rho0"      type="float" > 1026.0 </variable>
        <variable id="cpocean"   type="float" > 3991.86795711963 </variable>
        <variable id="convSpsu"  type="float" > 0.99530670233846  </variable>
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/file_def_nemo-ice.xml
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/file_def_nemo-ice.xml	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/file_def_nemo-ice.xml	(revision 13899)
@@ -53,7 +53,6 @@
         <field field_ref="normstr"          name="normstr" />
         <field field_ref="sheastr"          name="sheastr" />
-        <field field_ref="isig1"            name="isig1"   />
-        <field field_ref="isig2"            name="isig2"   />
-        <field field_ref="isig3"            name="isig3"   />
+       <field field_ref="sig1_pnorm"       name="sig1_pnorm"/>
+       <field field_ref="sig2_pnorm"       name="sig2_pnorm"/>
 
         <!-- heat fluxes -->
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/namelist_cfg
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/namelist_cfg	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/namelist_cfg	(revision 13899)
@@ -106,6 +106,6 @@
 !!                                                                    !!
 !!   namdrg        top/bottom drag coefficient                          (default: NO selection)
-!!   namdrg_top    top    friction                                      (ln_OFF=F & ln_isfcav=T)
-!!   namdrg_bot    bottom friction                                      (ln_OFF=F)
+!!   namdrg_top    top    friction                                      (ln_drg_OFF=F & ln_isfcav=T)
+!!   namdrg_bot    bottom friction                                      (ln_drg_OFF=F)
 !!   nambbc        bottom temperature boundary condition                (default: OFF)
 !!   nambbl        bottom boundary layer scheme                         (default: OFF)
@@ -115,5 +115,5 @@
 &namdrg        !   top/bottom drag coefficient                          (default: NO selection)
 !-----------------------------------------------------------------------
-   ln_OFF     = .true.     !  free-slip       : Cd = 0                  
+   ln_drg_OFF = .true.    !  free-slip       : Cd = 0                  (F => fill namdrg_bot
 /
 !!======================================================================
@@ -197,5 +197,4 @@
 !!                                                                    !!
 !!   namtrd       dynamics and/or tracer trends                         (default: OFF)
-!!   namptr       Poleward Transport Diagnostics                        (default: OFF)
 !!   namhsb       Heat and salt budgets                                 (default: OFF)
 !!   namdiu       Cool skin and warm layer models                       (default: OFF)
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/namelist_ice_cfg
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/namelist_ice_cfg	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/EXPREF/namelist_ice_cfg	(revision 13899)
@@ -86,5 +86,5 @@
 !------------------------------------------------------------------------------
    ln_iceini        = .true.          !  activate ice initialization (T) or not (F)
-   ln_iceini_file   = .true.          !  netcdf file provided for initialization (T) or not (F)
+   nn_iceini_file   =  1              !  netcdf file provided for initialization 
 
    sn_hti = 'initice'                 , -12 ,'hti'   ,  .false.  , .true., 'yearly'  , '' , '', ''
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_hgr.F90
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_hgr.F90	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_hgr.F90	(revision 13899)
@@ -64,7 +64,7 @@
       REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
       !
-      INTEGER  ::   ji, jj   ! dummy loop indices
+      INTEGER  ::   ji, jj     ! dummy loop indices
       REAL(wp) ::   zphi0, zlam0, zbeta, zf0
-      REAL(wp) ::   zti, zui, ztj, zvj   ! local scalars
+      REAL(wp) ::   zti, ztj   ! local scalars
       !!-------------------------------------------------------------------------------
       !
@@ -76,29 +76,38 @@
 
       !                          ==========
-      zlam0 = -(jpiglo-1)/2 * 1.e-3 * rn_dx
-      zphi0 = -(jpjglo-1)/2 * 1.e-3 * rn_dy
-
 #if defined key_agrif 
-      IF( .NOT. Agrif_Root() ) THEN
+      IF( Agrif_Root() ) THEN
+#endif
+         ! Compatibility WITH old version: 
+         ! jperio = 7 =>  Ni0glo = jpigo_old_version - 2
+         !            =>  jpiglo-1 replaced by Ni0glo+1
+         zlam0 = -REAL( (Ni0glo+1)/2, wp) * 1.e-3 * rn_dx
+         zphi0 = -REAL( (Nj0glo+1)/2, wp) * 1.e-3 * rn_dy   ! +1 for compatibility with old version --> to be replaced by -1 as before
+#if defined key_agrif 
+      ELSE
+         ! ! let lower left longitude and latitude from parent
 !clem         zlam0  = Agrif_Parent(zlam0) + (Agrif_ix())*Agrif_Parent(rn_dx) * 1.e-5
 !clem         zphi0  = Agrif_Parent(zphi0) + (Agrif_iy())*Agrif_Parent(rn_dy) * 1.e-5
-         zlam0 = ( 0.5_wp - ( Agrif_parent(jpiglo) - 1 ) / 2 ) * 1.e-3 * Agrif_irhox() * rn_dx  &
+         ! Compatibility WITH old version: 
+         ! jperio = 0 =>  Ni0glo = jpigo_old_version
+         !            =>  Agrif_parent(jpiglo)-1 replaced by  Agrif_parent(Ni0glo)-1
+         zlam0 = ( 0.5_wp - REAL( ( Agrif_parent(Ni0glo)-1 ) / 2, wp) ) * 1.e-3 * Agrif_irhox() * rn_dx  &
             &  + ( Agrif_Ix() + nbghostcells - 1 ) * Agrif_irhox() * rn_dx * 1.e-3 - ( 0.5_wp + nbghostcells ) * rn_dx * 1.e-3
-         zphi0 = ( 0.5_wp - ( Agrif_parent(jpjglo) - 1 ) / 2 ) * 1.e-3 * Agrif_irhoy() * rn_dy  &
+         zphi0 = ( 0.5_wp - REAL( ( Agrif_parent(Nj0glo)-1 ) / 2, wp) ) * 1.e-3 * Agrif_irhoy() * rn_dy  &
             &  + ( Agrif_Iy() + nbghostcells - 1 ) * Agrif_irhoy() * rn_dy * 1.e-3 - ( 0.5_wp + nbghostcells ) * rn_dy * 1.e-3
       ENDIF
 #endif         
 
-      DO_2D_11_11
-         zti = FLOAT( ji - 1 + nimpp - 1 )          ;  ztj = FLOAT( jj - 1 + njmpp - 1 )
-         zui = FLOAT( ji - 1 + nimpp - 1 ) + 0.5_wp ;  zvj = FLOAT( jj - 1 + njmpp - 1 ) + 0.5_wp
+      DO_2D( 1, 1, 1, 1 )
+         zti = REAL( mig0_oldcmp(ji) - 1, wp )   ! start at i=0 in the global grid without halos
+         ztj = REAL( mjg0_oldcmp(jj) - 1, wp )   ! start at j=0 in the global grid without halos
          
-         plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 * zti
-         plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * zui
+         plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 *   zti
+         plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * ( zti + 0.5_wp )
          plamv(ji,jj) = plamt(ji,jj) 
          plamf(ji,jj) = plamu(ji,jj) 
          
-         pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 * ztj
-         pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * zvj
+         pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 *   ztj
+         pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * ( ztj + 0.5_wp )
          pphiu(ji,jj) = pphit(ji,jj) 
          pphif(ji,jj) = pphiv(ji,jj) 
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 13899)
@@ -14,5 +14,5 @@
    !!   usr_def_hgr   : initialize the horizontal mesh 
    !!----------------------------------------------------------------------
-   USE dom_oce  , ONLY: nimpp , njmpp            ! i- & j-indices of the local domain
+   USE dom_oce
    USE par_oce        ! ocean space and time domain
    USE phycst         ! physical constants
@@ -85,7 +85,11 @@
          kpi = NINT( 300.e3 / rn_dx ) - 1
          kpj = NINT( 300.e3 / rn_dy ) - 1
-      ELSE
-         kpi = nbcellsx + 2 + 2*nbghostcells
-         kpj = nbcellsy + 2 + 2*nbghostcells
+         kpi = kpi - 2   ! for compatibility with old version (because kerio=7) --> to be removed
+         kpj = kpj - 2   ! for compatibility with old version (because kerio=7) --> to be removed
+      ELSE                           ! Global Domain size: add nbghostcells + 1 "land" point on each side
+         kpi  = nbcellsx + 2 * ( nbghostcells + 1 )
+         kpj  = nbcellsy + 2 * ( nbghostcells + 1 )
+!!$         kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2
+!!$         kpj  = nbcellsy + nbghostcells_y_s + nbghostcells_y_n + 2
       ENDIF
       kpk = 2
@@ -110,6 +114,6 @@
          WRITE(numout,*) '         LX [km]: ', zlx
          WRITE(numout,*) '         LY [km]: ', zly
-         WRITE(numout,*) '         resulting global domain size :        jpiglo = ', kpi
-         WRITE(numout,*) '                                               jpjglo = ', kpj
+         WRITE(numout,*) '         resulting global domain size :        Ni0glo = ', kpi
+         WRITE(numout,*) '                                               Nj0glo = ', kpj
          WRITE(numout,*) '                                               jpkglo = ', kpk
          WRITE(numout,*) '         Coriolis:', ln_corio
Index: NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_sbc.F90
===================================================================
--- NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_sbc.F90	(revision 13277)
+++ NEMO/branches/2020/tickets_icb_1900/tests/ICE_AGRIF/MY_SRC/usrdef_sbc.F90	(revision 13899)
@@ -107,6 +107,8 @@
       REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phi    ! ice thickness
       !!
+      INTEGER  ::   jl
       REAL(wp) ::   zfr1, zfr2                 ! local variables
       REAL(wp), DIMENSION(jpi,jpj) ::   zsnw   ! snw distribution after wind blowing
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztri
       !!---------------------------------------------------------------------
       !
@@ -141,14 +143,16 @@
 
       ! --- shortwave radiation transmitted below the surface (W/m2, see Grenfell Maykut 77) --- !
-      zfr1 = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice )            ! transmission when hi>10cm
-      zfr2 = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice )            ! zfr2 such that zfr1 + zfr2 to equal 1
+      cloud_fra(:,:) = pp_cldf
+      ztri(:,:) = 0.18 * ( 1.0 - cloud_fra(:,:) ) + 0.35 * cloud_fra(:,:)  ! surface transmission when hi>10cm
       !
-      WHERE    ( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) <  0.1_wp )       ! linear decrease from hi=0 to 10cm  
-         qtr_ice_top(:,:,:) = qsr_ice(:,:,:) * ( zfr1 + zfr2 * ( 1._wp - phi(:,:,:) * 10._wp ) )
-      ELSEWHERE( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) >= 0.1_wp )       ! constant (zfr1) when hi>10cm
-         qtr_ice_top(:,:,:) = qsr_ice(:,:,:) * zfr1
-      ELSEWHERE                                                         ! zero when hs>0
-         qtr_ice_top(:,:,:) = 0._wp 
-      END WHERE
+      DO jl = 1, jpl
+         WHERE    ( phs(:,:,jl) <= 0._wp .AND. phi(:,:,jl) <  0.1_wp )     ! linear decrease from hi=0 to 10cm  
+            qtr_ice_top(:,:,jl) = qsr_ice(:,:,jl) * ( ztri(:,:) + ( 1._wp - ztri(:,:) ) * ( 1._wp - phi(:,:,jl) * 10._wp ) )
+         ELSEWHERE( phs(:,:,jl) <= 0._wp .AND. phi(:,:,jl) >= 0.1_wp )     ! constant (ztri) when hi>10cm
+            qtr_ice_top(:,:,jl) = qsr_ice(:,:,jl) * ztri(:,:)
+         ELSEWHERE                                                         ! zero when hs>0
+            qtr_ice_top(:,:,jl) = 0._wp
+         END WHERE
+      ENDDO
           
    END SUBROUTINE usrdef_sbc_ice_flx
