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 11403)
+++ NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isf.F90	(revision 11423)
@@ -22,45 +22,40 @@
    PRIVATE
 
-   PUBLIC   isf_alloc, isf_alloc_par, isf_alloc_cav
-
-   ! public in order to be able to output then 
-
-   LOGICAL, PUBLIC :: ln_isfpar_mlt                  !: logical for the computation of melt inside the cavity
-   LOGICAL, PUBLIC :: ln_isfcav_mlt                  !: logical for the use of ice shelf parametrisation
-   REAL(wp), PUBLIC ::   rn_hisf_tbl                 !: thickness of top boundary layer [m]
-   REAL(wp), PUBLIC ::   rn_gammat0                  !: temperature exchange coeficient    []
-   REAL(wp), PUBLIC ::   rn_gammas0                  !: salinity    exchange coeficient    []
-   REAL(wp), PUBLIC ::   rn_htbl                     !: Losch top boundary layer thickness [m]
-   CHARACTER(LEN=256), PUBLIC :: cn_isfload          !: ice shelf load computation method
-   CHARACTER(LEN=256), PUBLIC :: cn_gammablk         !: gamma formulation
-   CHARACTER(LEN=256), PUBLIC :: cn_isfcav_mlt, cn_isfpar_mlt !: melt formulation (cavity/param)
-   TYPE(FLD_N), PUBLIC                                  :: sn_isfcav_fwf   !: information about the isf melting file to be read
-   TYPE(FLD_N), PUBLIC                                  :: sn_isfpar_fwf   !: information about the isf melting file to be read
-   TYPE(FLD_N), PUBLIC                                  :: sn_isfpar_zmax  !: information about the grounding line depth file to be read
-   TYPE(FLD_N), PUBLIC                                  :: sn_isfpar_zmin  !: information about the calving   line depth file to be read
-   TYPE(FLD_N), PUBLIC                                  :: sn_isfpar_Leff  !: information about the effective length     file to be read
-
-   LOGICAL, PUBLIC :: l_isfcpl
-   !
-   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   misfkt_par, misfkt_cav   !: Level of ice shelf base
-   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   misfkb_par, misfkb_cav   !: Level of ice shelf base
-   !
-   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   mskisf_par, mskisf_cav   !: Level of ice shelf base
-   !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   risfload                     !: ice shelf load
-   !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   rhisf_tbl_0                  !: thickness of tbl (initial value)  [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   rhisf_tbl_cav, rhisf_tbl_par !: thickness of tbl                  [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   rfrac_tbl_cav, rfrac_tbl_par !: fraction of the deepest cell affect by isf tbl  []
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   rhisf0_tbl_par
-   !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fwfisf_cpl
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fwfisf_par, fwfisf_par_b !: net fwf from the ice shelf        [kg/m2/s]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fwfisf_cav, fwfisf_cav_b !: net fwf from the ice shelf        [kg/m2/s]
-   !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   risfLeff
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   risf_cav_tsc_b, risf_cav_tsc     !: before and now T & S isf contents [K.m/s & PSU.m/s]  
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   risf_par_tsc_b, risf_par_tsc     !: before and now T & S isf contents [K.m/s & PSU.m/s]  
-
+   PUBLIC   isf_alloc, isf_alloc_par, isf_alloc_cav, isf_alloc_cpl
+   !
+   !-------------------------------------------------------
+   ! 0 :              namelist parameter
+   !-------------------------------------------------------
+   !
+   ! 0.1 -------- ice shelf cavity parameter --------------
+   CHARACTER(LEN=256), PUBLIC :: cn_isfdir
+   CHARACTER(LEN=256), PUBLIC :: cn_isfload      !: ice shelf load computation method
+   !
+   ! 0.2 -------- ice shelf cavity melt namelist parameter -------------
+   LOGICAL           , PUBLIC :: ln_isfcav_mlt   !: logical for the use of ice shelf parametrisation
+   REAL(wp)          , PUBLIC :: rn_gammat0      !: temperature exchange coeficient    []
+   REAL(wp)          , PUBLIC :: rn_gammas0      !: salinity    exchange coeficient    []
+   REAL(wp)          , PUBLIC :: rn_htbl         !: Losch top boundary layer thickness [m]
+   CHARACTER(LEN=256), PUBLIC :: cn_gammablk     !: gamma formulation
+   CHARACTER(LEN=256), PUBLIC :: cn_isfcav_mlt   !: melt formulation (cavity/param)
+   TYPE(FLD_N)       , PUBLIC :: sn_isfcav_fwf   !: information about the isf melting file to be read
+   !
+   ! 0.3 -------- ice shelf param. melt namelist parameter -------------
+   LOGICAL           , PUBLIC :: ln_isfpar_mlt   !: logical for the computation of melt inside the cavity
+   CHARACTER(LEN=256), PUBLIC :: cn_isfpar_mlt   !: melt formulation (cavity/param)
+   TYPE(FLD_N)       , PUBLIC :: sn_isfpar_fwf   !: information about the isf melting file to be read
+   TYPE(FLD_N)       , PUBLIC :: sn_isfpar_zmax  !: information about the grounding line depth file to be read
+   TYPE(FLD_N)       , PUBLIC :: sn_isfpar_zmin  !: information about the calving   line depth file to be read
+   TYPE(FLD_N)       , PUBLIC :: sn_isfpar_Leff  !: information about the effective length     file to be read
+   !
+   ! 0.4 -------- coupling namelist parameter -------------
+   LOGICAL, PUBLIC :: ln_isfcpl      !:
+   LOGICAL, PUBLIC :: ln_isfcpl_cons !:
+   INTEGER, PUBLIC :: nn_drown       !:
+   !
+   !-------------------------------------------------------
+   ! 1 :              ice shelf parameter
+   !-------------------------------------------------------
+   !
    REAL(wp), PARAMETER, PUBLIC :: rLfusisf = 0.334e6_wp    !: latent heat of fusion of ice shelf     [J/kg]
    REAL(wp), PARAMETER, PUBLIC :: rcpisf = 2000.0_wp       !: specific heat of ice shelf             [J/kg/K]
@@ -68,20 +63,44 @@
    REAL(wp), PARAMETER, PUBLIC :: rhoisf = 920.0_wp        !: volumic mass of ice shelf              [kg/m3]
    REAL(wp), PARAMETER, PUBLIC :: rtsurf = -20.0           !: surface temperature                    [C]
-   REAL(wp), PARAMETER, PUBLIC :: risf_eps = 1.e-20_wp        
-
-   REAL(wp), PUBLIC            :: risf_lamb1, risf_lamb2, risf_lamb3  ! freezing point linearization coeficient
-
+   !
+   !-------------------------------------------------------
+   ! 2 :              ice shelf global variables
+   !-------------------------------------------------------
+   !
+   ! 0.1 -------- ice shelf cavity parameter --------------
+   LOGICAL , PUBLIC            :: l_isfoasis
    REAL(wp), PUBLIC            :: r1_Lfusisf               !: 1/rLfusisf
-
-   TYPE(FLD)  , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: sf_isfcav_fwf
-   TYPE(FLD)  , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: sf_isfpar_fwf
-
-!: Variable used in fldread to read the forcing file (nn_isf == 4 .OR. nn_isf == 3)
-   CHARACTER(len=100), PUBLIC           :: cn_dirisf  = './' !: Root directory for location of ssr files
-   TYPE(FLD_N)       , PUBLIC           :: sn_fwfisf         !: information about the isf melting file to be read
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_fwfisf
-   TYPE(FLD_N)       , PUBLIC           :: sn_rnfisf         !: information about the isf melting param.   file to be read
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_rnfisf           
-   
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)    ::   risfload                    !: ice shelf load
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)    ::   fwfisf_oasis
+   !
+   ! 0.2 -------- ice shelf cavity melt namelist parameter -------------
+   INTEGER  , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: mskisf_cav                    !:
+   INTEGER  , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: misfkt_cav   , misfkb_cav     !: 
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: rhisf_tbl_cav, rfrac_tbl_cav  !: 
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: fwfisf_cav   , fwfisf_cav_b   !: before and now net fwf from the ice shelf        [kg/m2/s]
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: risf_cav_tsc , risf_cav_tsc_b !: before and now T & S isf contents [K.m/s & PSU.m/s]  
+   TYPE(FLD), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     :: sf_isfcav_fwf                 !:
+   !
+   REAL(wp) , PUBLIC                                      :: risf_lamb1, risf_lamb2, risf_lamb3  ! freezing point linearization coeficient
+   !
+   ! 0.3 -------- ice shelf param. melt namelist parameter -------------
+   INTEGER  , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: mskisf_par                    !:
+   INTEGER  , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: misfkt_par   , misfkb_par     !:
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: rhisf_tbl_par, rfrac_tbl_par  !: 
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: fwfisf_par   , fwfisf_par_b   !: before and now net fwf from the ice shelf        [kg/m2/s]
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: risf_par_tsc , risf_par_tsc_b !: before and now T & S isf contents [K.m/s & PSU.m/s]  
+   TYPE(FLD), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     :: sf_isfpar_fwf                 !:
+   !
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: rhisf0_tbl_par                !: thickness of tbl (initial value)  [m]
+   REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: risfLeff                      !:
+   !
+   ! 0.4 -------- coupling namelist parameter -------------
+   LOGICAL , PUBLIC                                        :: ll_isfcpl      !:
+   LOGICAL , PUBLIC                                        :: ll_isfcpl_cons !:
+   INTEGER , PUBLIC                                        ::   nstp_iscpl   !:
+   REAL(wp), PUBLIC                                        ::   rdt_iscpl    !: 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   risfcpl_vol, risfcpl_cons_vol  !:
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   risfcpl_tsc, risfcpl_cons_tsc  !:
+   !
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -121,4 +140,5 @@
       CALL mpp_sum ( 'isf', ierr )
       IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'isf: failed to allocate arrays.' )
+      !
    END SUBROUTINE isf_alloc_par
 
@@ -145,4 +165,59 @@
       ierr = ierr + ialloc
       !
+      CALL mpp_sum ( 'isf', ierr )
+      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'isf: failed to allocate arrays.' )
+      !
+   END SUBROUTINE isf_alloc_cav
+
+   SUBROUTINE isf_alloc_cpl()
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isf_alloc_cpl  ***
+      !!
+      !! ** Purpose : 
+      !!
+      !! ** Method  : 
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER :: ierr, ialloc
+      !!----------------------------------------------------------------------
+      ierr = 0
+      !
+      ALLOCATE( risfcpl_tsc(jpi,jpj,jpk,jpts)      , risfcpl_vol(jpi,jpj,jpk)      ,             &
+         &      risfcpl_cons_tsc(jpi,jpj,jpk,jpts) , risfcpl_cons_vol(jpi,jpj,jpk) , STAT=ialloc )
+      ierr = ierr + ialloc
+      !
+      CALL mpp_sum ( 'isf', ierr )
+      IF( ierr /= 0 )   CALL ctl_warn('STOP','isfcpl: failed to allocate arrays.')
+      !
+   END SUBROUTINE isf_alloc_cpl
+
+   SUBROUTINE isf_alloc()
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isf_alloc  ***
+      !!
+      !! ** Purpose : 
+      !!
+      !! ** Method  : 
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER :: ierr, ialloc
+      !!----------------------------------------------------------------------
+      !
+      ierr = 0       ! set to zero if no array to be allocated
+      !
+      ALLOCATE(fwfisf_par(jpi,jpj)  , fwfisf_par_b(jpi,jpj), &
+         &     fwfisf_cav(jpi,jpj)  , fwfisf_cav_b(jpi,jpj), &
+         &     fwfisf_oasis(jpi,jpj),            STAT=ialloc )
+      ierr = ierr + ialloc
+      !
+      ALLOCATE(risf_par_tsc(jpi,jpj,jpts), risf_par_tsc_b(jpi,jpj,jpts), STAT=ialloc )
+      ierr = ierr + ialloc
+      !
+      ALLOCATE(risf_cav_tsc(jpi,jpj,jpts), risf_cav_tsc_b(jpi,jpj,jpts), STAT=ialloc )
+      ierr = ierr + ialloc
+      !
+      ALLOCATE(risfload(jpi,jpj), STAT=ialloc)
+      ierr = ierr + ialloc
+      !
       ALLOCATE( mskisf_cav(jpi,jpj), STAT=ialloc)
       ierr = ierr + ialloc
@@ -150,38 +225,6 @@
       CALL mpp_sum ( 'isf', ierr )
       IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'isf: failed to allocate arrays.' )
-   END SUBROUTINE isf_alloc_cav
-
-   SUBROUTINE isf_alloc()
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE isf_alloc  ***
-      !!
-      !! ** Purpose : 
-      !!
-      !! ** Method  : 
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER :: ierr, ialloc
-      !!----------------------------------------------------------------------
-      !
-      ierr = 0       ! set to zero if no array to be allocated
-      !
-      ALLOCATE(fwfisf_par(jpi,jpj), fwfisf_par_b(jpi,jpj), &
-         &     fwfisf_cav(jpi,jpj), fwfisf_cav_b(jpi,jpj), &
-         &     fwfisf_cpl(jpi,jpj),            STAT=ialloc )
-      ierr = ierr + ialloc
-      !
-      ALLOCATE(risf_par_tsc(jpi,jpj,jpts), risf_par_tsc_b(jpi,jpj,jpts), STAT=ialloc )
-      ierr = ierr + ialloc
-      !
-      ALLOCATE(risf_cav_tsc(jpi,jpj,jpts), risf_cav_tsc_b(jpi,jpj,jpts), STAT=ialloc )
-      ierr = ierr + ialloc
-      !
-      ALLOCATE(risfload(jpi,jpj), STAT=ialloc)
-      ierr = ierr + ialloc
-      !
-      CALL mpp_sum ( 'isf', ierr )
-      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'isf: failed to allocate arrays.' )
 
    END SUBROUTINE isf_alloc
-   !
+
 END MODULE isf
