Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/EXPREF/AGRIF_FixedGrids.in
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/EXPREF/AGRIF_FixedGrids.in	(revision 12960)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/EXPREF/AGRIF_FixedGrids.in	(revision 13065)
@@ -1,3 +1,3 @@
 1
-34 63 34 63 3 3 3
+33 62 33 62 3 3 3
 0
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/MY_SRC/usrdef_hgr.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/MY_SRC/usrdef_hgr.F90	(revision 12960)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/MY_SRC/usrdef_hgr.F90	(revision 13065)
@@ -76,14 +76,23 @@
 
       !                          ==========
-      zlam0 = -REAL(Ni0glo-1)/2, wp) * 1.e-3 * rn_dx
-      zphi0 = -REAL(Nj0glo-1)/2, wp) * 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
Index: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 12960)
+++ NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 13065)
@@ -85,7 +85,9 @@
          kpi = NINT( 300.e3 / rn_dx ) - 1
          kpj = NINT( 300.e3 / rn_dy ) - 1
+         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
-         kpi = nbcellsx + 2 + 2*nbghostcells
-         kpj = nbcellsy + 2 + 2*nbghostcells
+         kpi  = nbcellsx + 2 * ( nbghostcells + 1 )   ! Global Domain size: add nbghostcells + 1 "land" point on each side
+         kpj  = nbcellsy + 2 * ( nbghostcells + 1 )
       ENDIF
       kpk = 2
@@ -110,6 +112,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
