Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isf.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isf.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isf.F90	(revision 11852)
@@ -14,6 +14,6 @@
    !!----------------------------------------------------------------------
 
-   USE in_out_manager ! I/O manager
-   USE lib_mpp        ! MPP library
+   USE in_out_manager, ONLY: wp, jpi,jpj, jpk, jpts ! I/O manager
+   USE lib_mpp       , ONLY: ctl_stop, mpp_sum      ! MPP library
    USE fldread        ! read input fields
 
@@ -197,5 +197,5 @@
       !
       CALL mpp_sum ( 'isf', ierr )
-      IF( ierr /= 0 )   CALL ctl_warn('STOP','isfcpl: failed to allocate arrays.')
+      IF( ierr /= 0 )   CALL ctl_stop('STOP','isfcpl: failed to allocate arrays.')
       !
    END SUBROUTINE isf_alloc_cpl
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcav.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcav.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcav.F90	(revision 11852)
@@ -13,14 +13,17 @@
    !!   isf_cav       : update ice shelf melting under ice shelf
    !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers
    USE isf            ! ice shelf public variables
-   USE isfutils
-   USE isftbl         ! ice shelf top boundary layer properties
-   USE isfcavmlt      ! ice shelf melt formulation
-   USE isfcavgam      ! ice shelf melt exchange coeficient
-   USE isfdiags       ! ice shelf diags
-   USE dom_oce        ! ocean space and time domain
-   USE phycst         ! physical constants
-   USE eosbn2         ! l_useCT
+   !
+   USE isfrst   , ONLY: isfrst_write, isfrst_read ! ice shelf restart read/write subroutine
+   USE isfutils , ONLY: debug          ! ice shelf debug subroutine
+   USE isftbl   , ONLY: isf_tbl        ! ice shelf top boundary layer properties subroutine
+   USE isfcavmlt, ONLY: isfcav_mlt     ! ice shelf melt formulation subroutine
+   USE isfcavgam, ONLY: isfcav_gammats ! ice shelf melt exchange coeficient subroutine
+   USE isfdiags , ONLY: isf_diags_flx  ! ice shelf diags subroutine
+   !
+   USE oce      , ONLY: tsn                    ! ocean tracers
+   USE dom_oce  , ONLY: jpi,jpj                ! ocean space and time domain
+   USE phycst   , ONLY: grav,rau0,r1_rau0_rcp  ! physical constants
+   USE eosbn2   , ONLY: l_useCT                ! l_useCT
    !
    USE in_out_manager ! I/O manager
@@ -58,6 +61,6 @@
       !!---------------------------------------------------------------------
       !!-------------------------- OUT --------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj)     , INTENT(inout) :: pqfwf
-      REAL(wp), DIMENSION(jpi,jpj,jpts), INTENT(inout) :: ptsc
+      REAL(wp), DIMENSION(jpi,jpj)     , INTENT(inout) :: pqfwf  ! ice shelf melt (>0 out)
+      REAL(wp), DIMENSION(jpi,jpj,jpts), INTENT(inout) :: ptsc   ! T & S ice shelf cavity contents
       !!-------------------------- IN  --------------------------------------
       INTEGER, INTENT(in) ::   kt   ! ocean time step
@@ -66,8 +69,8 @@
       INTEGER :: nit
       REAL(wp) :: zerr
-      REAL(wp), DIMENSION(jpi,jpj) :: zqlat, zqoce, zqhc, zqh
-      REAL(wp), DIMENSION(jpi,jpj) :: zqoce_b
-      REAL(wp), DIMENSION(jpi,jpj) :: zgammat, zgammas
-      REAL(wp), DIMENSION(jpi,jpj) :: zttbl, zstbl
+      REAL(wp), DIMENSION(jpi,jpj) :: zqlat, zqoce, zqhc, zqh  ! heat fluxes
+      REAL(wp), DIMENSION(jpi,jpj) :: zqoce_b                  !
+      REAL(wp), DIMENSION(jpi,jpj) :: zgammat, zgammas         ! exchange coeficient
+      REAL(wp), DIMENSION(jpi,jpj) :: zttbl, zstbl             ! temp. and sal. in top boundary layer
       !!---------------------------------------------------------------------
       !
@@ -140,4 +143,7 @@
       ptsc(:,:,jp_tem) = - zqh(:,:) * r1_rau0_rcp
       !
+      ! write restart variables (qoceisf, qhcisf, fwfisf for now and before)
+      IF (lrst_oce) CALL isfrst_write(kt, 'cav', ptsc, pqfwf)
+      !
       IF ( ln_isfdebug ) THEN
          CALL debug('isf_cav: ptsc T',ptsc(:,:,1))
@@ -158,10 +164,25 @@
       !!---------------------------------------------------------------------
 
-      ! allocation isfcav gamtisf, gamsisf, 
+      ! 0: allocation
+      !
       CALL isf_alloc_cav()
       !
-      ! cav
+      ! 1: initialisation
+      !
+      ! top and bottom level of the 'top boundary layer'
       misfkt_cav(:,:)    = mikt(:,:) ; misfkb_cav(:,:)    = 1
+      !
+      ! thickness of 'tbl' and fraction of bottom cell affected by 'tbl'
       rhisf_tbl_cav(:,:) = 0.0_wp    ; rfrac_tbl_cav(:,:) = 0.0_wp
+      !
+      ! cavity mask
+      mskisf_cav(:,:)    = (1._wp - tmask(:,:,1)) * ssmask(:,:)
+      !
+      ! 2: read restart
+      !
+      ! read cav variable from restart
+      IF ( ln_rstart ) CALL isfrst_read('cav', risf_cav_tsc, fwfisf_cav, risf_cav_tsc_b, fwfisf_cav_b)
+      !
+      ! 3: specific allocation and initialisation (depending of scheme choice)
       !
       SELECT CASE ( TRIM(cn_isfcav_mlt) )
@@ -199,7 +220,4 @@
       END SELECT
       !
-      ! compute mask
-      mskisf_cav(:,:) = (1._wp - tmask(:,:,1)) * ssmask(:,:)
-      !
    END SUBROUTINE isf_cav_init
 
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcavgam.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcavgam.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcavgam.F90	(revision 11852)
@@ -10,13 +10,16 @@
    !!   isfcav_gammats       : compute exchange coeficient gamma 
    !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers
    USE isf
-   USE isfutils
-   USE isftbl
+   USE isfutils, ONLY: debug
+   USE isftbl  , ONLY: isf_tbl
+
+   USE oce     , ONLY: un, vn, rn2         ! ocean dynamics and tracers
+   USE phycst  , ONLY: grav, vkarmn        ! physical constant
+   USE eosbn2  , ONLY: eos_rab             ! equation of state
+   USE zdfdrg  , ONLY: rCd0_top, r_ke0_top ! vertical physics: top/bottom drag coef.
+   USE iom     , ONLY: iom_put             !
+   USE lib_mpp , ONLY: ctl_stop
+
    USE dom_oce        ! ocean space and time domain
-   USE phycst         ! physical constants
-   USE eosbn2         ! equation of state
-   USE zdfdrg         ! vertical physics: top/bottom drag coef.
-   USE iom
    USE in_out_manager ! I/O manager
    !
@@ -46,5 +49,5 @@
       !!---------------------------------------------------------------------
       !!-------------------------- OUT -------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pgt  , pgs      ! gamma t and gamma s 
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) :: pgt  , pgs      ! gamma t and gamma s 
       !!-------------------------- IN  -------------------------------------
       REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pqoce, pqfwf    ! isf heat and fwf
@@ -114,5 +117,5 @@
       !!---------------------------------------------------------------------
       !!-------------------------- OUT -------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pgt, pgs     ! gammat and gammas [m/s]
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) :: pgt, pgs     ! gammat and gammas [m/s]
       !!-------------------------- IN  -------------------------------------
       REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: putbl, pvtbl ! velocity in the losch top boundary layer
@@ -145,5 +148,5 @@
       !!---------------------------------------------------------------------
       !!-------------------------- OUT -------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pgt, pgs     ! gammat and gammas
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) :: pgt, pgs     ! gammat and gammas
       !!-------------------------- IN  -------------------------------------
       REAL(wp),                     INTENT(in   ) :: pke2           ! background velocity squared
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcavmlt.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcavmlt.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcavmlt.F90	(revision 11852)
@@ -11,15 +11,19 @@
    !!   isfcav_mlt    : update surface ocean boundary condition under ice shelf
    !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers
-   USE isf            ! ice shelf public variables
-   USE isfutils       ! ice shelf debug subroutine
-   USE dom_oce        ! ocean space and time domain
-   USE phycst         ! physical constants
-   USE eosbn2         ! equation of state
-   !
-   USE in_out_manager ! I/O manager
-   USE iom            ! I/O library
-   USE fldread        ! read input field at current time step
-   USE lib_fortran
+
+   USE isf                      ! ice shelf
+   USE isftbl , ONLY: isf_tbl   ! ice shelf depth average
+   USE isfutils,ONLY: debug     ! debug subroutine
+
+   USE dom_oce                            ! ocean space and time domain
+   USE oce    , ONLY: tsn                 ! ocean dynamics and tracers
+   USE phycst , ONLY: rcp, rau0, rau0_rcp ! physical constants
+   USE eosbn2 , ONLY: eos_fzp             ! equation of state
+
+   USE in_out_manager              ! I/O manager
+   USE iom        , ONLY: iom_put  ! I/O library
+   USE fldread    , ONLY: fld_read !
+   USE lib_fortran, ONLY: glob_sum !
+   USE lib_mpp    , ONLY: ctl_stop !
 
    IMPLICIT NONE
@@ -110,5 +114,5 @@
       !
       ! read input file
-      CALL fld_read ( kt, nn_fsbc, sf_isfcav_fwf )
+      CALL fld_read ( kt, 1, sf_isfcav_fwf )
       !
       ! define fwf and qoce
@@ -276,5 +280,5 @@
       !
       ! read input file
-      CALL fld_read ( kt, nn_fsbc, sf_isfcav_fwf )
+      CALL fld_read ( kt, 1, sf_isfcav_fwf )
       !
       ! ice shelf 2d map
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcpl.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcpl.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcpl.F90	(revision 11852)
@@ -12,10 +12,9 @@
    !!   isfrst : read/write iceshelf variables in/from restart
    !!----------------------------------------------------------------------
+   USE isf                             ! ice shelf variable
+   USE lib_mpp, ONLY: mpp_sum, mpp_max ! mpp routine
+   USE domvvl , ONLY: dom_vvl_zgr      ! vertical scale factor interpolation
+   !
    USE oce            ! ocean dynamics and tracers
-   USE isf            ! ice shelf variable
-   USE isfutils       ! debuging
-   USE lib_mpp        ! mpp routine
-   USE domvvl         ! vertical scale factor interpolation
-   !
    USE in_out_manager ! I/O manager
    USE iom            ! I/O library
@@ -47,4 +46,7 @@
 CONTAINS
    SUBROUTINE isfcpl_init()
+      !
+      ! start on an euler time step
+      neuler = 0
       ! 
       CALL isf_alloc_cpl()
@@ -57,4 +59,6 @@
       !
       ! correction of the horizontal divergence and associated temp. and salt content flux
+      ! Need to : - include in the cpl cons the risfcpl_vol/tsc contribution
+      !           - decide how to manage thickness level change in conservation
       CALL isfcpl_vol()
       !
@@ -66,6 +70,19 @@
       vn(:,:,:) = vn(:,:,:) * vmask(:,:,:)
       !
-      ! Need to : - include in the cpl cons the risfcpl_vol/tsc contribution
-      !           - decide how to manage thickness level change in conservation
+      ! all before fields set to now values
+      tsb  (:,:,:,:) = tsn  (:,:,:,:)
+      ub   (:,:,:)   = un   (:,:,:)
+      vb   (:,:,:)   = vn   (:,:,:)
+      sshb (:,:)     = sshn (:,:)
+      e3t_b(:,:,:)   = e3t_n(:,:,:)
+ 
+      ! prepare writing restart
+      IF( lwxios ) THEN
+         CALL iom_set_rstw_var_active('ssmask')
+         CALL iom_set_rstw_var_active('tmask')
+         CALL iom_set_rstw_var_active('e3t_n')
+         CALL iom_set_rstw_var_active('e3u_n')
+         CALL iom_set_rstw_var_active('e3v_n')
+      END IF
       !
    END SUBROUTINE isfcpl_init
@@ -92,5 +109,5 @@
    END SUBROUTINE isfcpl_rst_write
 
-   SUBROUTINE isfcpl_ssh
+   SUBROUTINE isfcpl_ssh()
       !!---------------------------------------------------------------------- 
       !!                   ***  ROUTINE iscpl_ssh  ***
@@ -153,9 +170,9 @@
       !
       ! recompute the vertical scale factor, depth and water thickness
-      CALL dom_vvl_zgr
+      CALL dom_vvl_zgr()
       !
    END SUBROUTINE isfcpl_ssh
 
-   SUBROUTINE isfcpl_tra
+   SUBROUTINE isfcpl_tra()
       !!---------------------------------------------------------------------- 
       !!                   ***  ROUTINE iscpl_tra  ***
@@ -316,5 +333,5 @@
    END SUBROUTINE isfcpl_tra
 
-   SUBROUTINE isfcpl_vol
+   SUBROUTINE isfcpl_vol()
       !!---------------------------------------------------------------------- 
       !!                   ***  ROUTINE iscpl_vol  ***
@@ -402,5 +419,5 @@
    END SUBROUTINE isfcpl_vol
 
-   SUBROUTINE isfcpl_cons
+   SUBROUTINE isfcpl_cons()
       !!---------------------------------------------------------------------- 
       !!                   ***  ROUTINE iscpl_cons  ***
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfhdiv.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfhdiv.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfhdiv.F90	(revision 11852)
@@ -1,10 +1,8 @@
 MODULE isfhdiv
 
-   USE dom_oce
-   USE iom
-   USE isf
-   USE isfutils
-   USE phycst
-   USE in_out_manager
+   USE isf                    ! ice shelf
+   USE dom_oce                ! time and space domain
+   USE phycst , ONLY: r1_rau0 ! physical constant
+   USE in_out_manager         !
 
    IMPLICIT NONE
@@ -39,5 +37,5 @@
          !
          ! ice sheet coupling contribution 
-         IF ( ln_isfcpl ) THEN
+         IF ( ln_isfcpl .AND. kt /= 0 ) THEN
             !
             ! correct divergence only for the first time step
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfload.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfload.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfload.F90	(revision 11852)
@@ -11,9 +11,11 @@
    !!----------------------------------------------------------------------
 
-   USE isf             ! ice shelf variables
-   USE dom_oce         ! vertical scale factor
+   USE isf, ONLY: cn_isfload   ! ice shelf variables
+
+   USE dom_oce, ONLY: e3w_n, gdept_n, risfdep, mikt ! vertical scale factor
+   USE eosbn2 , ONLY: eos                           ! eos routine
+
+   USE lib_mpp, ONLY: ctl_stop ! ctl_stop routine
    USE in_out_manager  ! 
-   USE eosbn2          ! eos routine
-   USE lib_mpp         ! ctl_stop routine
 
    IMPLICIT NONE
@@ -86,5 +88,5 @@
       !
       !                                !- Surface value + ice shelf gradient
-      risfload(:,:) = 0._wp                       ! compute pressure due to ice shelf load 
+      pisfload(:,:) = 0._wp                       ! compute pressure due to ice shelf load 
       DO jj = 1, jpj                         ! (used to compute hpgi/j for all the level from 1 to miku/v)
          DO ji = 1, jpi                      ! divided by 2 later
@@ -94,13 +96,13 @@
                !
                ! top layer of the ice shelf
-               risfload(ji,jj) = risfload(ji,jj) + (znad + zrhd(ji,jj,1) ) * e3w_n(ji,jj,1)
+               pisfload(ji,jj) = pisfload(ji,jj) + (znad + zrhd(ji,jj,1) ) * e3w_n(ji,jj,1)
                !
                ! core layers of the ice shelf
                DO jk = 2, ikt-1
-                  risfload(ji,jj) = risfload(ji,jj) + (2._wp * znad + zrhd(ji,jj,jk-1) + zrhd(ji,jj,jk)) * e3w_n(ji,jj,jk)
+                  pisfload(ji,jj) = pisfload(ji,jj) + (2._wp * znad + zrhd(ji,jj,jk-1) + zrhd(ji,jj,jk)) * e3w_n(ji,jj,jk)
                END DO
                !
                ! deepest part of the ice shelf (between deepest T point and ice/ocean interface
-               risfload(ji,jj) = risfload(ji,jj) + (2._wp * znad + zrhdtop_isf(ji,jj) + zrhd(ji,jj,ikt-1)) &
+               pisfload(ji,jj) = pisfload(ji,jj) + (2._wp * znad + zrhdtop_isf(ji,jj) + zrhd(ji,jj,ikt-1)) &
                   &                                              * ( risfdep(ji,jj) - gdept_n(ji,jj,ikt-1) )
                !
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfnxt.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfnxt.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfnxt.F90	(revision 11852)
@@ -8,10 +8,12 @@
   
    !!-------------------------------------------------------------------------
-   !!   isfnxt       : aplly correction need for the ice shelf
+   !!   isfnxt       : aplly correction needed for the ice shelf to ensure conservation
    !!-------------------------------------------------------------------------
 
    USE isf
-   USE phycst
-   USE dom_oce
+
+   USE phycst , ONLY: r1_rau0                ! physical constant
+   USE dom_oce, ONLY: e3t_b, e3t_n, r1_e1e2t ! time and space domain
+
    USE in_out_manager
 
@@ -20,5 +22,5 @@
    PRIVATE
 
-   PUBLIC isf_dynnxt ! isf_tranxt
+   PUBLIC isf_dynnxt
 
 CONTAINS
@@ -34,5 +36,5 @@
       INTEGER ,                     INTENT(in   ) :: kt
       !
-      REAL(wp),                     INTENT(in   ) :: pcoef           ! atfp * rdt
+      REAL(wp),                     INTENT(in   ) :: pcoef           ! atfp * rdt * r1_rau0
       !!-------------------------- IN  -------------------------------------
       !!--------------------------------------------------------------------
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfpar.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfpar.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfpar.F90	(revision 11852)
@@ -14,18 +14,20 @@
    !!   isfpar       : compute ice shelf melt using a prametrisation of ice shelf cavities
    !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers
+   !USE oce            ! ocean dynamics and tracers
    USE isf            ! ice shelf
-   USE isfutils       !
-   USE isfparmlt      ! ice shelf parametrisation
-   USE isftbl         ! ice shelf depth average
-   USE isfdiags       ! ice shelf diagnostics
-   USE dom_oce        ! ocean space and time domain
-   USE phycst         ! physical constants
-   USE eosbn2         ! equation of state
+   !
+   USE isfrst   , ONLY: isfrst_write, isfrst_read ! ice shelf restart read/write subroutine
+   USE isftbl   , ONLY: isf_tbl_ktop, isf_tbl_lvl ! ice shelf top boundary layer properties subroutine
+   USE isfutils , ONLY: debug, read_2dcstdta      ! ice shelf debug subroutine
+   USE isfparmlt, ONLY: isfpar_mlt     ! ice shelf melt formulation subroutine
+   USE isfdiags , ONLY: isf_diags_flx  ! ice shelf diags subroutine
+   !
+   USE dom_oce  , ONLY: jpi,jpj        ! ocean space and time domain
+   USE phycst   , ONLY: r1_rau0_rcp    ! physical constants
    !
    USE in_out_manager ! I/O manager
    USE iom            ! I/O library
    USE fldread        ! read input field at current time step
-   USE lbclnk         !
+   USE lbclnk         ! lbc_lnk
 
    IMPLICIT NONE
@@ -80,4 +82,13 @@
       ptsc(:,:,jp_tem) = zqh(:,:) * r1_rau0_rcp
       !
+      ! write restart variables (qoceisf, qhcisf, fwfisf for now and before)
+      IF (lrst_oce) CALL isfrst_write(kt, 'par', ptsc, pqfwf)
+      !
+      IF ( ln_isfdebug ) THEN
+         CALL debug('isf_par: ptsc T',ptsc(:,:,1))
+         CALL debug('isf_par: ptsc S',ptsc(:,:,2))
+         CALL debug('isf_par: pqfwf fwf',pqfwf(:,:))
+      END IF
+      !
    END SUBROUTINE isf_par
 
@@ -100,6 +111,4 @@
       rhisf_tbl_par(:,:)  = 1e-20     ; rfrac_tbl_par(:,:)    = 0.0_wp
       !
-      mskisf_par(:,:) = 0
-      !
       ! define isf tbl tickness, top and bottom indice
       CALL read_2dcstdta(TRIM(sn_isfpar_zmax%clname), TRIM(sn_isfpar_zmax%clvar), ztblmax)
@@ -110,5 +119,5 @@
       ztblmin(:,:) = ztblmin(:,:) * ssmask(:,:)
       !
-      ! if param used under an ice shelf overwrite ztblmax by the ice shelf draft
+      ! if param used under an ice shelf overwrite ztblmin by the ice shelf draft
       WHERE ( risfdep > 0._wp .AND. ztblmin > 0._wp )
          ztblmin(:,:) = risfdep(:,:)
@@ -127,7 +136,6 @@
       END WHERE
       !
-      ! compute misfkb_par, rhisf_tbl
-      rhisf_tbl_par(:,:) = rhisf0_tbl_par(:,:)
-      CALL isf_tbl_lvl( ht_n * mskisf_par, e3t_n, misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par )
+      ! read par variable from restart
+      IF ( ln_rstart ) CALL isfrst_read('par', risf_par_tsc, fwfisf_par, risf_par_tsc_b, fwfisf_par_b)
       !
       SELECT CASE ( TRIM(cn_isfpar_mlt) )
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfparmlt.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfparmlt.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfparmlt.F90	(revision 11852)
@@ -8,15 +8,17 @@
    !!----------------------------------------------------------------------
 
-   USE oce            ! ocean dynamics and tracers
    USE isf            ! ice shelf
-   USE isftbl         ! ice shelf depth average
-   USE dom_oce        ! ocean space and time domain
-   USE phycst         ! physical constants
-   USE eosbn2         ! equation of state
-
-   USE in_out_manager ! I/O manager
-   USE iom            ! I/O library
-   USE fldread        !
-   USE lib_fortran    !
+   USE isftbl , ONLY: isf_tbl   ! ice shelf depth average
+
+   USE dom_oce                  ! ocean space and time domain
+   USE oce    , ONLY: tsn       ! ocean dynamics and tracers
+   USE phycst , ONLY: rcp, rau0 ! physical constants
+   USE eosbn2 , ONLY: eos_fzp   ! equation of state
+
+   USE in_out_manager              ! I/O manager
+   USE iom        , ONLY: iom_put  ! I/O library
+   USE fldread    , ONLY: fld_read !
+   USE lib_fortran, ONLY: glob_sum !
+   USE lib_mpp    , ONLY: ctl_stop !
 
    IMPLICIT NONE
@@ -91,5 +93,5 @@
       !
       ! 0. ------------Read specified runoff
-      CALL fld_read ( kt, nn_fsbc, sf_isfpar_fwf   )
+      CALL fld_read ( kt, 1, sf_isfpar_fwf   )
       !
       ! compute ptfrz
@@ -153,5 +155,4 @@
       CALL iom_put('isfthermald_par',( ztfrz(:,:) - ztavg(:,:) ) * mskisf_par(:,:))
       !
-      !
    END SUBROUTINE isfpar_mlt_bg03
 
@@ -180,5 +181,5 @@
       !
       ! 0. ------------Read specified runoff
-      CALL fld_read ( kt, nn_fsbc, sf_isfpar_fwf   )
+      CALL fld_read ( kt, 1, sf_isfpar_fwf   )
       !
       ! 1. ------------Mean freezing point (needed for heat content flux)
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfrst.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfrst.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfrst.F90	(revision 11852)
@@ -10,6 +10,6 @@
    !!   isfrst : read/write iceshelf variables in/from restart
    !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers
-   USE isf            ! ice shelf variable
+   !
+   USE dom_oce, ONLY: jpi,jpj,jpk,jpts ! time and space domain
    !
    USE in_out_manager ! I/O manager
@@ -61,8 +61,10 @@
       !
       IF( lwxios ) THEN
-          CALL iom_set_rstw_var_active(TRIM(chc_b ))
-          CALL iom_set_rstw_var_active(TRIM(csc_b ))
-          CALL iom_set_rstw_var_active(TRIM(cfwf_b))
+         CALL iom_set_rstw_var_active(TRIM(chc_b ))
+         CALL iom_set_rstw_var_active(TRIM(csc_b ))
+         CALL iom_set_rstw_var_active(TRIM(cfwf_b))
       ENDIF
+
+      CALL FLUSH(numout)
 
    END SUBROUTINE isfrst_read
@@ -74,6 +76,6 @@
       !!-------------------------- OUT --------------------------------------
       !!-------------------------- IN  --------------------------------------
-      INTEGER                     , INTENT(in   ) :: kt
-      CHARACTER(LEN=256)          , INTENT(in   ) :: cdisf
+      INTEGER                          , INTENT(in   ) :: kt
+      CHARACTER(LEN=256)               , INTENT(in   ) :: cdisf
       REAL(wp), DIMENSION(jpi,jpj)     , INTENT(in   ) :: pfwf
       REAL(wp), DIMENSION(jpi,jpj,jpts), INTENT(in   ) :: ptsc
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfstp.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfstp.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfstp.F90	(revision 11852)
@@ -13,26 +13,18 @@
    !!   isfstp       : compute iceshelf melt and heat flux
    !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers
-   USE dom_oce        ! ocean space and time domain
-   USE domvvl, ONLY : ln_vvl_zstar
-   USE phycst         ! physical constants
-   USE eosbn2         ! equation of state
-   USE sbc_oce        ! surface boundary condition: ocean fields
-   USE zdfdrg         ! vertical physics: top/bottom drag coef.
    !
+   USE isf            ! isf variables
+   USE isfload, ONLY: isf_load                      ! ice shelf load
+   USE isftbl , ONLY: isf_tbl_lvl                   ! ice shelf boundary layer
+   USE isfpar , ONLY: isf_par, isf_par_init         ! ice shelf parametrisation
+   USE isfcav , ONLY: isf_cav, isf_cav_init         ! ice shelf cavity
+   USE isfcpl , ONLY: isfcpl_rst_write, isfcpl_init ! isf variables
+
+   USE dom_oce, ONLY: ht_n, e3t_n, ln_isfcav, ln_linssh ! ocean space and time domain
+   USE domvvl,  ONLY: ln_vvl_zstar                      ! zstar logical
+   USE zdfdrg,  ONLY: r_Cdmin_top, r_ke0_top            ! vertical physics: top/bottom drag coef.
+   !
+   USE lib_mpp, ONLY: ctl_stop, ctl_nam
    USE in_out_manager ! I/O manager
-   USE iom            ! I/O library
-   USE fldread        ! read input field at current time step
-   USE lbclnk         !
-   USE lib_fortran    ! glob_sum
-   !
-   USE isfrst         ! iceshelf restart
-   USE isftbl         ! ice shelf boundary layer
-   USE isfpar         ! ice shelf parametrisation
-   USE isfcav         ! ice shelf cavity
-   USE isfload        ! ice shelf load
-   USE isfcpl         ! isf variables
-   USE isf            ! isf variables
-   USE isfutils
 
    IMPLICIT NONE
@@ -82,7 +74,4 @@
          CALL isf_cav( kt, risf_cav_tsc, fwfisf_cav)
          !
-         ! write restart variables (risf_cav_tsc, fwfisf for now and before)
-         IF (lrst_oce) CALL isfrst_write(kt, 'cav', risf_cav_tsc, fwfisf_cav)
-         !
       END IF
       ! 
@@ -102,14 +91,7 @@
          CALL isf_par( kt, risf_par_tsc, fwfisf_par)
          !
-         ! write restart variables (qoceisf, qhcisf, fwfisf for now and before)
-         IF (lrst_oce) CALL isfrst_write(kt, 'par', risf_par_tsc, fwfisf_par)
-         !
-      END IF
-
-      IF ( ln_isfcpl ) THEN
-         ! 
-         IF (lrst_oce) CALL isfcpl_rst_write(kt)
-         !
-      END IF
+      END IF
+      !
+      IF ( ln_isfcpl .AND. lrst_oce ) CALL isfcpl_rst_write(kt)
       !
    END SUBROUTINE isf_stp
@@ -148,52 +130,14 @@
          !
          !---------------------------------------------------------------------------------------------------------------------
-         ! initialisation ice sheet coupling
-         IF( ln_isfcpl ) THEN 
-            !
-            ! start on an euler time step
-            neuler = 0
-            !
-            ! ice sheet coupling: extrapolation of restart to fill new wet cell and compute divergence correction
-            CALL isfcpl_init()
-            !
-            ! all before fields set to now values
-            tsb  (:,:,:,:) = tsn  (:,:,:,:)
-            ub   (:,:,:)   = un   (:,:,:)
-            vb   (:,:,:)   = vn   (:,:,:)
-            sshb (:,:)     = sshn (:,:)
-            e3t_b(:,:,:)   = e3t_n(:,:,:)
- 
-            ! prepare writing restart
-            IF( lwxios ) CALL iom_set_rstw_var_active('ssmask')
-            IF( lwxios ) CALL iom_set_rstw_var_active('tmask')
-            IF( lwxios ) CALL iom_set_rstw_var_active('e3t_n')
-            IF( lwxios ) CALL iom_set_rstw_var_active('e3u_n')
-            IF( lwxios ) CALL iom_set_rstw_var_active('e3v_n')
-            !
-         END IF
-         !
-         !---------------------------------------------------------------------------------------------------------------------
          ! initialisation melt in the cavity
-         IF ( ln_isfcav_mlt ) THEN
-            !
-            ! initialisation  of cav variable
-            CALL isf_cav_init()
-            !
-            ! read cav variable from restart
-            IF ( ln_rstart ) CALL isfrst_read('cav', risf_cav_tsc, fwfisf_cav, risf_cav_tsc_b, fwfisf_cav_b)
-            !
-         END IF
+         IF ( ln_isfcav_mlt ) CALL isf_cav_init()
          !
          !---------------------------------------------------------------------------------------------------------------------
          ! initialisation parametrised melt
-         IF ( ln_isfpar_mlt ) THEN
-            !
-            ! initialisation  of par variable
-            CALL isf_par_init()
-            !
-            ! read par variable from restart
-            IF ( ln_rstart ) CALL isfrst_read('par', risf_par_tsc, fwfisf_par, risf_par_tsc_b, fwfisf_par_b)
-            !
-         END IF
+         IF ( ln_isfpar_mlt ) CALL isf_par_init()
+         !
+         !---------------------------------------------------------------------------------------------------------------------
+         ! initialisation ice sheet coupling
+         IF( ln_isfcpl ) CALL isfcpl_init()
          !
       END IF
@@ -224,7 +168,8 @@
                WRITE(numout,*) '         gamma formulation                       cn_gammablk = ', TRIM(cn_gammablk) 
                IF ( TRIM(cn_gammablk) .NE. 'spe' ) THEN 
-                  WRITE(numout,*) '            gammat coefficient                      rn_gammat0  = ', rn_gammat0  
-                  WRITE(numout,*) '            gammas coefficient                      rn_gammas0  = ', rn_gammas0  
-                  WRITE(numout,*) '            top drag coef. used (from namdrg_top)   rn_Cd0      = ', r_Cdmin_top 
+                  WRITE(numout,*) '            gammat coefficient                       rn_gammat0  = ', rn_gammat0  
+                  WRITE(numout,*) '            gammas coefficient                       rn_gammas0  = ', rn_gammas0  
+                  WRITE(numout,*) '            top drag coef.    used (from namdrg_top) rn_Cd0      = ', r_Cdmin_top
+                  WRITE(numout,*) '            top background ke used (from namdrg_top) rn_ke0      = ', r_ke0_top
                END IF
             END IF
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isftbl.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isftbl.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isftbl.F90	(revision 11852)
@@ -14,8 +14,7 @@
    !!----------------------------------------------------------------------
 
+   USE isf     ! ice shelf variables
+
    USE dom_oce ! vertical scale factor
-   USE lbclnk  ! lbc_lnk subroutine
-   USE isfutils
-   USE isf
 
    IMPLICIT NONE
@@ -69,7 +68,4 @@
          CALL isf_tbl_avg( miku, ikbot, zhtbl, zfrac, e3u_n, pvarin, zvarout )
          !
-         ! check if needed (probably yes)
-         CALL lbc_lnk('sbcisf', pvarout,'U',-1.)
-         !
          ! compute tbl property at T point
          pvarout(1,:) = 0._wp
@@ -92,7 +88,4 @@
          CALL isf_tbl_avg( mikv, ikbot, zhtbl, zfrac, e3v_n, pvarin, zvarout )
          !
-         ! check if needed (probably yes)
-         CALL lbc_lnk('sbcisf', pvarout,'V',-1.)
-         !
          ! pvarout is an averaging of wet point
          pvarout(:,1) = 0._wp
@@ -110,6 +103,4 @@
          !
       END SELECT
-      !
-      IF (ln_isfdebug) CALL debug('isf_tbl pvarout:',pvarout)
       !
    END SUBROUTINE isf_tbl
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfutils.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfutils.F90	(revision 11844)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfutils.F90	(revision 11852)
@@ -12,7 +12,8 @@
    !!----------------------------------------------------------------------
 
-   USE iom
-   USE lib_fortran
-   USE lib_mpp
+   USE iom           , ONLY: iom_open, iom_get, iom_close, jpdom_data ! read input file
+   USE lib_fortran   , ONLY: glob_sum, glob_min, glob_max             ! compute global value
+   USE dom_oce       , ONLY: jpi,jpj,jpk                              ! domain size
+   USE in_out_manager, ONLY: wp, lwp, numout                          ! miscelenious
 
    IMPLICIT NONE
