Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/EXPREF/namelist_cfg
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/EXPREF/namelist_cfg	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/EXPREF/namelist_cfg	(revision 13694)
@@ -461,5 +461,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)
@@ -478,5 +477,4 @@
 /
 !-----------------------------------------------------------------------
-&namptr        !   Poleward Transport Diagnostic                        (default: OFF)
 !-----------------------------------------------------------------------
 /
Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/dtatsd.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/dtatsd.F90	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/dtatsd.F90	(revision 13694)
@@ -191,5 +191,5 @@
          ENDIF
          !
-         DO_2D( 1, 1, 1, 1 )
+         DO_2D( 1, 1, 1, 1 )                  ! vertical interpolation of T & S
             DO jk = 1, jpk                        ! determines the intepolated T-S profiles at each (i,j) points
                zl = gdept_0(ji,jj,jk)
Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/eosbn2.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/eosbn2.F90	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/eosbn2.F90	(revision 13694)
@@ -182,4 +182,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -965,5 +966,5 @@
       IF( ln_timing )   CALL timing_start('bn2')
       !
-      DO_3D( 1, 1, 1, 1, 2, jpkm1 )
+      DO_3D( 1, 1, 1, 1, 2, jpkm1 )      ! interior points only (2=< jk =< jpkm1 ); surface and bottom value set to zero one for all in istate.F90
          zrw =   ( gdepw(ji,jj,jk  ,Kmm) - gdept(ji,jj,jk,Kmm) )   &
             &  / ( gdept(ji,jj,jk-1,Kmm) - gdept(ji,jj,jk,Kmm) ) 
@@ -1723,4 +1724,7 @@
          !
       CASE( np_leos )                        !==  Linear ISOMIP EOS     ==!
+
+         r1_S0  = 0.875_wp/35.16504_wp   ! Used to convert CT in potential temperature when using bulk formulae (eos_pt_from_ct)
+         
          IF(lwp) THEN
             WRITE(numout,*)
@@ -1731,4 +1735,5 @@
             WRITE(numout,*) '             saline  cont. coef.   rn_b0      = ', rn_b0
          ENDIF
+         l_useCT = .TRUE.          ! Use conservative temperature
          !
       CASE DEFAULT                     !==  ERROR in neos  ==!
Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isf_oce.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isf_oce.F90	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isf_oce.F90	(revision 13694)
@@ -75,5 +75,5 @@
    !
    ! 2.1 -------- ice shelf cavity parameter --------------
-   LOGICAL , PUBLIC            :: l_isfoasis
+   LOGICAL , PUBLIC            :: l_isfoasis = .FALSE.
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)    ::   risfload                    !: ice shelf load
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)    ::   fwfisf_oasis
Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isfcavgam.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isfcavgam.F90	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isfcavgam.F90	(revision 13694)
@@ -30,4 +30,5 @@
    PUBLIC   isfcav_gammats
 
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isfstp.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isfstp.F90	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/isfstp.F90	(revision 13694)
@@ -13,5 +13,4 @@
    !!   isfstp       : compute iceshelf melt and heat flux
    !!----------------------------------------------------------------------
-   !
    USE isf_oce                                      ! isf variables
    USE isfload, ONLY: isf_load                      ! ice shelf load
@@ -21,5 +20,6 @@
    USE isfcpl , ONLY: isfcpl_rst_write, isfcpl_init ! isf variables
 
-   USE dom_oce, ONLY: ht, e3t, ln_isfcav, ln_linssh     ! ocean space and time domain
+   USE dom_oce        ! ocean space and time domain
+   USE oce      , ONLY: ssh                           ! sea surface height
    USE domvvl,  ONLY: ln_vvl_zstar                      ! zstar logical
    USE zdfdrg,  ONLY: r_Cdmin_top, r_ke0_top            ! vertical physics: top/bottom drag coef.
@@ -31,9 +31,10 @@
 
    IMPLICIT NONE
-
    PRIVATE
 
    PUBLIC   isf_stp, isf_init, isf_nam  ! routine called in sbcmod and divhor
 
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -41,4 +42,5 @@
    !! Software governed by the CeCILL license (see ./LICENSE)
    !!----------------------------------------------------------------------
+
 CONTAINS
  
@@ -60,4 +62,7 @@
       INTEGER, INTENT(in) ::   kt   ! ocean time step
       INTEGER, INTENT(in) ::   Kmm  ! ocean time level index
+      !!----------------------------------------------------------------------
+      INTEGER :: jk                               ! loop index
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: ze3t    ! e3t 
       !!---------------------------------------------------------------------
       !
@@ -78,5 +83,8 @@
          ! 1.2: compute misfkb, rhisf_tbl, rfrac (deepest level, thickness, fraction of deepest cell affected by tbl)
          rhisf_tbl_cav(:,:) = rn_htbl * mskisf_cav(:,:)
-         CALL isf_tbl_lvl(ht, e3t(:,:,:,Kmm), misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav)
+         DO jk = 1, jpk
+            ze3t(:,:,jk) = e3t(:,:,jk,Kmm)
+         END DO 
+         CALL isf_tbl_lvl(ht(:,:), ze3t, misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav)
          !
          ! 1.3: compute ice shelf melt
@@ -100,5 +108,8 @@
          ! by simplicity, we assume the top level where param applied do not change with time (done in init part)
          rhisf_tbl_par(:,:) = rhisf0_tbl_par(:,:)
-         CALL isf_tbl_lvl(ht, e3t(:,:,:,Kmm), misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par)
+         DO jk = 1, jpk
+            ze3t(:,:,jk) = e3t(:,:,jk,Kmm)
+         END DO
+         CALL isf_tbl_lvl(ht(:,:), ze3t, misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par)
          !
          ! 2.3: compute ice shelf melt
Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/istate.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/istate.F90	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/istate.F90	(revision 13694)
@@ -24,5 +24,4 @@
    USE dom_oce        ! ocean space and time domain 
    USE daymod         ! calendar
-   USE divhor         ! horizontal divergence            (div_hor routine)
    USE dtatsd         ! data temperature and salinity   (dta_tsd routine)
    USE dtauvd         ! data: U & V current             (dta_uvd routine)
@@ -35,4 +34,8 @@
    USE lib_mpp         ! MPP library
    USE restart         ! restart
+#if defined key_agrif
+   USE agrif_oce_interp
+   USE agrif_oce
+#endif   
 
    IMPLICIT NONE
@@ -43,4 +46,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -59,4 +63,5 @@
       !
       INTEGER ::   ji, jj, jk   ! dummy loop indices
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zgdept     ! 3D table  !!st patch to use gdept subtitute
 !!gm see comment further down
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   zuvd    ! U & V data workspace
@@ -70,5 +75,5 @@
 !!gm  Why not include in the first call of dta_tsd ?  
 !!gm  probably associated with the use of internal damping...
-                     CALL dta_tsd_init        ! Initialisation of T & S input data
+       CALL dta_tsd_init        ! Initialisation of T & S input data
 !!gm to be moved in usrdef of C1D case
 !      IF( lk_c1d )   CALL dta_uvd_init        ! Initialization of U & V input data
@@ -84,4 +89,17 @@
 #endif
 
+#if defined key_agrif
+      IF ( (.NOT.Agrif_root()).AND.ln_init_chfrpar ) THEN
+         numror = 0                           ! define numror = 0 -> no restart file to read
+         ln_1st_euler = .true.                ! Set time-step indicator at nit000 (euler forward)
+         CALL day_init 
+         CALL agrif_istate( Kbb, Kmm, Kaa )   ! Interp from parent
+         !
+         ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb) 
+         ssh (:,:,Kmm)     = ssh(:,:,Kbb)
+         uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb)
+         vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb)
+      ELSE
+#endif
       IF( ln_rstart ) THEN                    ! Restart from a file
          !                                    ! -------------------
@@ -100,4 +118,7 @@
             !
             ssh(:,:,Kbb)   = 0._wp               ! set the ocean at rest
+            uu  (:,:,:,Kbb) = 0._wp
+            vv  (:,:,:,Kbb) = 0._wp  
+            !
             IF( ll_wd ) THEN
                ssh(:,:,Kbb) =  -ssh_ref  ! Added in 30 here for bathy that adds 30 as Iterative test CEOD 
@@ -111,9 +132,10 @@
                END_2D
             ENDIF 
-            uu  (:,:,:,Kbb) = 0._wp
-            vv  (:,:,:,Kbb) = 0._wp  
-            !
+             !
          ELSE                                 ! user defined initial T and S
-            CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )         
+            DO jk = 1, jpk
+               zgdept(:,:,jk) = gdept(:,:,jk,Kbb)
+            END DO
+            CALL usr_def_istate( zgdept, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )         
          ENDIF
          ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones
@@ -121,11 +143,8 @@
          uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb)
          vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb)
-         hdiv(:,:,jpk) = 0._wp               ! bottom divergence set one for 0 to zero at jpk level
-         CALL div_hor( 0, Kbb, Kmm )         ! compute interior hdiv value  
-!!gm                                    hdiv(:,:,:) = 0._wp
 
 !!gm POTENTIAL BUG :
 !!gm  ISSUE :  if ssh(:,:,Kbb) /= 0  then, in non linear free surface, the e3._n, e3._b should be recomputed
-!!             as well as gdept and gdepw....   !!!!! 
+!!             as well as gdept_ and gdepw_....   !!!!! 
 !!      ===>>>>   probably a call to domvvl initialisation here....
 
@@ -151,4 +170,7 @@
          ! 
       ENDIF 
+#if defined key_agrif
+      ENDIF
+#endif
       ! 
       ! Initialize "now" and "before" barotropic velocities:
Index: NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/sbcfwb.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/sbcfwb.F90	(revision 13540)
+++ NEMO/branches/2020/r12377_ticket2386/tests/ISOMIP+/MY_SRC/sbcfwb.F90	(revision 13694)
@@ -17,5 +17,5 @@
    USE dom_oce        ! ocean space and time domain
    USE sbc_oce        ! surface ocean boundary condition
-   USE isf_oce        ! ice shelf melting contribution
+   USE isf_oce , ONLY : fwfisf_cav, fwfisf_par, ln_isfcpl, ln_isfcpl_cons, risfcpl_cons_ssh ! ice shelf melting contribution
    USE sbc_ice , ONLY : snwice_mass, snwice_mass_b, snwice_fmass
    USE phycst         ! physical constants
@@ -71,5 +71,5 @@
       REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   ztmsk_tospread, zerp_cor    !   -      -
       REAL(wp)   ,DIMENSION(1) ::   z_fwfprv  
-      COMPLEX(wp),DIMENSION(1) ::   y_fwfnow  
+      COMPLEX(dp),DIMENSION(1) ::   y_fwfnow  
       !!----------------------------------------------------------------------
       !
@@ -206,5 +206,5 @@
             !
 !!gm   ===>>>>  lbc_lnk should be useless as all the computation is done over the whole domain !
-            CALL lbc_lnk( 'sbcfwb', zerp_cor, 'T', 1. )
+            CALL lbc_lnk( 'sbcfwb', zerp_cor, 'T', 1.0_wp )
             !
             emp(:,:) = emp(:,:) + zerp_cor(:,:)
