Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/cfgs/WED025/EXPREF/namelist_cfg
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/cfgs/WED025/EXPREF/namelist_cfg	(revision 11489)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/cfgs/WED025/EXPREF/namelist_cfg	(revision 11494)
@@ -130,5 +130,4 @@
       !                    !     =2 annual global mean of e-p-r set to zero
    ln_rnf      = .true.    !  runoffs                                   (T   => fill namsbc_rnf)
-   ln_isf      = .true.
 /
 !-----------------------------------------------------------------------
@@ -209,9 +208,16 @@
 /
 !-----------------------------------------------------------------------
-&namisf       !  Top boundary layer (ISF)                              (ln_isf = T .AND. ln_isfcav: read (ln_read_cfg=T) 
-!-----------------------------------------------------------------------                         or set or usr_def_zgr )
-   cn_isfdir = './'
+&namisf       !  Top boundary layer (ISF)                               (default: OFF)
+!-----------------------------------------------------------------------
+   !
+   ! ---------------- general -------------------------------
+   !
+   ln_isf = .true.            ! activate ice shelf module
+   cn_isfdir = './'           ! directory for all ice shelf input file
+   !
+   ! ---------------- cavities opened -------------------------------
+   !
    cn_isfload = 'isomip'
-
+   !
    ln_isfcav_mlt = .true.     ! ice shelf melting into the cavity
       cn_isfcav_mlt = '3eq'   ! ice shelf melting formulation (spe/2eq/3eq/oasis)
@@ -219,5 +225,5 @@
       !                       ! 2eq = ISOMIP  like: 2 equations formulation (Hunter et al., 2006)
       !                       ! 3eq = ISOMIP+ like: 3 equations formulation (Asay-Davis et al., 2015)
-      !                       ! oasis = fwfisf is given by oasis
+      !                       ! oasis = fwfisf is given by oasis and pattern by file sn_isfcav_fwf
       !              !  cn_isfcav_mlt = 2eq or 3eq cases:
       cn_gammablk = 'ad15'    ! scheme to compute gammat/s (spe,ad15,hj99)
@@ -234,9 +240,13 @@
       !           !  file name  ! frequency (hours) ! variable  ! time interp.!  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
       !           !             !  (if <0  months)  !   name    !  (logical)  !  (T/F)  ! 'monthly' ! filename ! pairing  ! filename      !
-      sn_isfcav_fwf = 'isfmlt_cav',      -12       , 'fwflisf' ,  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
-
-
-   ln_isfpar_mlt = .false.   ! ice shelf melting parametrised
+      sn_isfcav_fwf = 'isfmlt_cav',      -12.      , 'fwflisf' ,  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
+   !
+   ! ---------------- cavities parametrised -------------------------------
+   !
+   ln_isfpar_mlt = .true.    ! ice shelf melting parametrised
       cn_isfpar_mlt = 'spe'  ! ice shelf melting parametrisation (spe/bg03/oasis)
+      !                      ! spe   = fwfisf is read from a forcing field
+      !                      ! bg03  = melt computed using Beckmann and Goosse parametrisation
+      !                      ! oasis = fwfisf is given by oasis and pattern by file sn_isfpar_fwf
       !
       !* all cases
@@ -244,12 +254,13 @@
       !           !  file name  ! frequency (hours) ! variable  ! time interp.!  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
       !           !             !  (if <0  months)  !   name    !  (logical)  !  (T/F)  ! 'monthly' ! filename ! pairing  ! filename      !
-      sn_isfpar_zmax = 'isfmlt_par',       0        ,'sozisfmax',  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
-      sn_isfpar_zmin = 'isfmlt_par',       0        ,'sozisfmin',  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
+      sn_isfpar_zmax = 'isfmlt_par',      -12.      , 'sozisfmax' ,  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
+      sn_isfpar_zmin = 'isfmlt_par',      -12.      , 'sozisfmin' ,  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
       !* 'spe' and 'oasis' case
-      sn_isfpar_fwf = 'isfmlt_par' ,      -12       ,'fwfisf'   ,  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
+      sn_isfpar_fwf = 'isfmlt_par' ,      -12.      , 'sofwfisf' ,  .false.    , .true.  , 'yearly'   ,    ''    ,   ''     ,    ''
       !* 'bg03' case
-      sn_isfpar_Leff = 'isfmlt_par',       0        ,'Leff'     ,  .false.    , .true.  , 'yearly'  ,    ''    ,   ''     ,    ''
-
-   
+      sn_isfpar_Leff = 'isfmlt_par',       0.       , 'Leff'     ,  .false.    , .true.  , 'yearly'   ,    ''    ,   ''     ,    ''
+   !
+   ! ---------------- ice sheet coupling -------------------------------
+   !
    ln_isfcpl = .false.
       nn_drown       = 10        ! number of iteration of the extrapolation loop (fill the new wet cells)
Index: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/DIA/diawri.F90
===================================================================
--- NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/DIA/diawri.F90	(revision 11489)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/DIA/diawri.F90	(revision 11494)
@@ -915,4 +915,5 @@
          END IF
          IF (ln_isfpar_mlt) THEN
+            CALL iom_rstput( 0, 0, inum, 'isfmsk_par', REAL(mskisf_par,8)  )    ! now k-velocity
             CALL iom_rstput( 0, 0, inum, 'fwfisf_par', fwfisf_par          )    ! now k-velocity
             CALL iom_rstput( 0, 0, inum, 'rhisf_par_tbl', rhisf_tbl_par    )    ! now k-velocity
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 11489)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfcavmlt.F90	(revision 11494)
@@ -42,5 +42,5 @@
       !!----------------------------------------------------------------------
       !!
-      !! ** Purpose    : compute ice shelf fwf/heqt fluxes 
+      !! ** Purpose    : compute or read ice shelf fwf/heat fluxes in the ice shelf cavity
       !!
       !!---------------------------------------------------------------------
@@ -189,21 +189,21 @@
             !
             ! compute coeficient to solve the 2nd order equation
-            zeps1 = rau0_rcp*pgt(ji,jj)
-            zeps2 = rLfusisf*rau0*pgs(ji,jj)
-            zeps3 = rhoisf*rcpisf*rkappa/MAX(risfdep(ji,jj),zeps)
-            zeps4 = risf_lamb2+risf_lamb3*risfdep(ji,jj)
-            zeps6 = zeps4-pttbl(ji,jj)
-            zeps7 = zeps4-rtsurf
+            zeps1 = rau0_rcp * pgt(ji,jj)
+            zeps2 = rLfusisf * rau0 * pgs(ji,jj)
+            zeps3 = rhoisf * rcpisf * rkappa / MAX(risfdep(ji,jj),zeps)
+            zeps4 = risf_lamb2 + risf_lamb3 * risfdep(ji,jj)
+            zeps6 = zeps4 - pttbl(ji,jj)
+            zeps7 = zeps4 - rtsurf
             !
             ! solve the 2nd order equation to find zsfrz
             zaqe  = risf_lamb1 * (zeps1 + zeps3)
-            zaqer = 0.5_wp/MIN(zaqe,-zeps)
-            zbqe  = zeps1*zeps6+zeps3*zeps7-zeps2
-            zcqe  = zeps2*pstbl(ji,jj)
-            zdis  = zbqe*zbqe-4.0_wp*zaqe*zcqe               
+            zaqer = 0.5_wp / MIN(zaqe,-zeps)
+            zbqe  = zeps1 * zeps6 + zeps3 * zeps7 - zeps2
+            zcqe  = zeps2 * pstbl(ji,jj)
+            zdis  = zbqe * zbqe - 4.0_wp * zaqe * zcqe               
             !
             ! Presumably zdis can never be negative because gammas is very small compared to gammat
-            zsfrz=(-zbqe-SQRT(zdis))*zaqer
-            IF ( zsfrz < 0.0_wp ) zsfrz=(-zbqe+SQRT(zdis))*zaqer  ! check this if this if is needed
+            zsfrz=(-zbqe - SQRT(zdis)) * zaqer
+            IF ( zsfrz < 0.0_wp ) zsfrz=(-zbqe + SQRT(zdis)) * zaqer  ! check this if this if is needed
             !
             ! compute t freeze (eq. 25)
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 11489)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfpar.F90	(revision 11494)
@@ -43,5 +43,5 @@
    SUBROUTINE isf_par( kt, ptsc, pqfwf )
       !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE sbc_isf_cav  ***
+      !!                     ***  ROUTINE isf_par ***      
       !!
       !! ** Purpose :   
@@ -79,5 +79,5 @@
       zqh(:,:) = ( zqhc (:,:) + zqoce(:,:) )
       !
-      ! lbclnk on melt
+      ! lbclnk on melt and heat fluxes
       CALL lbc_lnk_multi( 'isfmlt', zqh, 'T', 1., pqfwf, 'T', 1.)
       !
@@ -120,5 +120,5 @@
       !
       ! if param used under an ice shelf overwrite ztblmax by the ice shelf draft
-      WHERE ( risfdep > 0._wp )
+      WHERE ( risfdep > 0._wp .AND. ztblmin > 0._wp )
          ztblmin(:,:) = risfdep(:,:)
       END WHERE
@@ -130,8 +130,4 @@
       rhisf0_tbl_par(:,:) = ztblmax(:,:) - ztblmin(:,:)
       !
-      ! compute misfkb_par, rhisf_tbl
-      rhisf_tbl_par(:,:) = rhisf0_tbl_par(:,:)
-      CALL isf_tbl_lvl( ht_n, e3t_n, misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par )
-      !
       ! define iceshelf parametrisation mask
       mskisf_par = 0
@@ -140,15 +136,19 @@
       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 )
+      !
       SELECT CASE ( TRIM(cn_isfpar_mlt) )
          !
       CASE ( 'spe' )
-
+         !
          ALLOCATE( sf_isfpar_fwf(1), STAT=ierr )
          ALLOCATE( sf_isfpar_fwf(1)%fnow(jpi,jpj,1), sf_isfpar_fwf(1)%fdta(jpi,jpj,1,2) )
          CALL fld_fill( sf_isfpar_fwf, (/ sn_isfpar_fwf /), cn_isfdir, 'isf_par_init', 'read fresh water flux isf data', 'namisf' )
-
+         !
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) '      ==>>>   ice melt read from forcing field (cn_isfmlt_par = spe)'
-
+         !
       CASE ( 'bg03' )
          !
@@ -161,8 +161,8 @@
          !
       CASE ( 'oasis' )
-
+         !
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) '      ==>>>    isf melt provided by OASIS (cn_isfmlt_par = oasis)'
-
+         !
       CASE DEFAULT
          CALL ctl_stop( 'sbc_isf_init: wrong value of nn_isf' )
@@ -171,3 +171,3 @@
    END SUBROUTINE isf_par_init
 
-   END MODULE isfpar
+END MODULE isfpar
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 11489)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfparmlt.F90	(revision 11494)
@@ -37,7 +37,7 @@
 ! -------------------------------------------------------------------------------------------------------
 
-  SUBROUTINE isfpar_mlt( kt, pqfwf, pqoce, pqhc )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE sbc_isf  ***
+  SUBROUTINE isfpar_mlt( kt, pqhc, pqoce, pqfwf )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isfpar_mlt  ***
       !!
       !! ** Purpose : Compute Salt and Heat fluxes related to ice_shelf 
@@ -49,5 +49,5 @@
       !!----------------------------------------------------------------------
       !!-------------------------- OUT -------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqfwf,pqoce, pqhc  ! fresh water, ice-ocean heat and heat content fluxes
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqfwf, pqoce, pqhc  ! fresh water, ice-ocean heat and heat content fluxes
       !!-------------------------- IN  -------------------------------------
       INTEGER, INTENT(in) ::   kt   ! ocean time step
@@ -72,5 +72,5 @@
 ! -------------------------------------------------------------------------------------------------------
 
-   SUBROUTINE isfpar_mlt_spe(kt, pqhc, pqfwf, pqoce)
+   SUBROUTINE isfpar_mlt_spe(kt, pqhc, pqoce, pqfwf)
       !!---------------------------------------------------------------------
       !!                  ***  ROUTINE isfpar_mlt_spe  ***
@@ -81,5 +81,5 @@
       !!----------------------------------------------------------------------
       !!-------------------------- OUT -------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqhc, pqfwf,pqoce  ! fresh water and ice-ocean heat fluxes
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqhc, pqfwf, pqoce  ! fresh water and ice-ocean heat fluxes
       !!-------------------------- IN  -------------------------------------
       INTEGER,  INTENT(in) :: kt
@@ -122,5 +122,5 @@
       !!----------------------------------------------------------------------
       !!-------------------------- OUT -------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqhc, pqfwf,pqoce  ! fresh water and ice-ocean heat fluxes
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqhc, pqfwf, pqoce  ! fresh water and ice-ocean heat fluxes
       !!-------------------------- IN  -------------------------------------
       INTEGER,  INTENT(in) :: kt
@@ -158,9 +158,10 @@
    SUBROUTINE isfpar_mlt_oasis(kt, pqhc , pqoce, pqfwf )
       !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE isfpar_oasis  ***
       !!
       !! ** Purpose    : scale the fwf read from input file by the total amount received by the sbccpl interface
       !!
-      !! ** Purpose    : - read ice shelf melt from forcing file => pattern
-      !!                 - total amount of fwf is given by sbccpl (fwfisf_oasis)
+      !! ** Purpose    : - read ice shelf melt from forcing file and scale it by the input file total amount => pattern
+      !!                 - compute total amount of fwf given by sbccpl (fwfisf_oasis)
       !!                 - scale fwf and compute heat fluxes
       !!
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 11489)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isftbl.F90	(revision 11494)
@@ -210,6 +210,6 @@
       !
       ! phtbl need to be bounded by water column thickness before
-      ! test: if phtbl = water column thickness, should return mbathy
-      ! test: if phtbl = 0 should return ktop
+      ! test: if htbl = water column thickness, should return mbathy
+      ! test: if htbl = 0 should return ktop (phtbl cap to e3t(ji,jj,1))
       !
       ! get ktbl
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 11489)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfutils.F90	(revision 11494)
@@ -38,11 +38,12 @@
       REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) :: pvar          ! output variable
       !!-------------------------- IN  -------------------------------------
-      CHARACTER(len=256)          , INTENT(in   ) :: cdfile, cdvar ! input file name and variable name
+      CHARACTER(len=256)          , INTENT(in   ) :: cdfile   ! input file name
+      CHARACTER(len=34)           , INTENT(in   ) :: cdvar    ! variable name
       !!--------------------------------------------------------------------
       INTEGER :: inum
       !!--------------------------------------------------------------------
 
-      CALL iom_open( cdfile, inum )
-      CALL iom_get( inum, jpdom_data, cdvar, pvar, 1)
+      CALL iom_open( TRIM(cdfile), inum )
+      CALL iom_get( inum, jpdom_data, TRIM(cdvar), pvar)
       CALL iom_close(inum)
 
