Index: branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90
===================================================================
--- branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90	(revision 7778)
+++ branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90	(revision 7784)
@@ -32,5 +32,5 @@
    PRIVATE
 
-   PUBLIC   sbc_isf, sbc_isf_div, sbc_isf_alloc  ! routine called in sbcmod and divcur
+   PUBLIC   sbc_isf, sbc_isf_init, sbc_isf_div, sbc_isf_alloc  ! routine called in sbcmod and divcur
 
    ! public in order to be able to output then 
@@ -83,133 +83,14 @@
  
   SUBROUTINE sbc_isf(kt)
+
     INTEGER, INTENT(in)          ::   kt         ! ocean time step
-    INTEGER                      ::   ji, jj, jk, ijkmin, inum, ierror
+    INTEGER                      ::   ji, jj, jk
     INTEGER                      ::   ikt, ikb   ! top and bottom level of the isf boundary layer
-    REAL(wp)                     ::   rmin
     REAL(wp)                     ::   zhk
     REAL(wp)                     ::   zt_frz, zpress
-    CHARACTER(len=256)           ::   cfisf , cvarzisf, cvarhisf   ! name for isf file
-    CHARACTER(LEN=256)           :: cnameis                     ! name of iceshelf file
-    CHARACTER (LEN=32)           :: cvarLeff                    ! variable name for efficient Length scale
-    INTEGER           ::   ios           ! Local integer output status for namelist read
-
     REAL(wp), DIMENSION(:,:,:), POINTER :: zfwfisf3d, zqhcisf3d, zqlatisf3d
     REAL(wp), DIMENSION(:,:  ), POINTER :: zqhcisf2d
     REAL(wp)                            :: zhisf
 
-      !
-      !!---------------------------------------------------------------------
-      NAMELIST/namsbc_isf/ nn_isfblk, rn_hisf_tbl, ln_divisf, ln_conserve, rn_gammat0, rn_gammas0, nn_gammablk, &
-                         & sn_fwfisf, sn_qisf, sn_rnfisf, sn_depmax_isf, sn_depmin_isf, sn_Leff_isf
-      !
-      !
-      !                                         ! ====================== !
-      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
-         !                                      ! ====================== !
-         REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs 
-         READ  ( numnam_ref, namsbc_isf, IOSTAT = ios, ERR = 901)
-901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in reference namelist', lwp )
-
-         REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
-         READ  ( numnam_cfg, namsbc_isf, IOSTAT = ios, ERR = 902 )
-902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist', lwp )
-         IF(lwm) WRITE ( numond, namsbc_isf )
-
-
-         IF ( lwp ) WRITE(numout,*)
-         IF ( lwp ) WRITE(numout,*) 'sbc_isf: heat flux of the ice shelf'
-         IF ( lwp ) WRITE(numout,*) '~~~~~~~~~'
-         IF ( lwp ) WRITE(numout,*) 'sbcisf :' 
-         IF ( lwp ) WRITE(numout,*) '~~~~~~~~'
-         IF ( lwp ) WRITE(numout,*) '        nn_isf      = ', nn_isf
-         IF ( lwp ) WRITE(numout,*) '        nn_isfblk   = ', nn_isfblk
-         IF ( lwp ) WRITE(numout,*) '        rn_hisf_tbl = ', rn_hisf_tbl
-         IF ( lwp ) WRITE(numout,*) '        ln_divisf   = ', ln_divisf 
-         IF ( lwp ) WRITE(numout,*) '        nn_gammablk = ', nn_gammablk 
-         IF ( lwp ) WRITE(numout,*) '        rn_tfri2    = ', rn_tfri2 
-         IF (ln_divisf) THEN       ! keep it in the namelist ??? used true anyway as for runoff ? (PM)
-            rdivisf = 1._wp
-         ELSE
-            rdivisf = 0._wp
-         END IF
-         !
-         ! Allocate public variable
-         IF ( sbc_isf_alloc()  /= 0 )         CALL ctl_stop( 'STOP', 'sbc_isf : unable to allocate arrays' )
-         !
-         ! initialisation
-         qisf(:,:)        = 0._wp  ; fwfisf(:,:) = 0._wp
-         risf_tsc(:,:,:)  = 0._wp
-         !
-         ! define isf tbl tickness, top and bottom indice
-         IF      (nn_isf == 1) THEN
-            rhisf_tbl(:,:) = rn_hisf_tbl
-            misfkt(:,:)    = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
-         ELSE IF ((nn_isf == 3) .OR. (nn_isf == 2)) THEN
-            IF( .NOT.l_isfcpl ) THEN
-               ALLOCATE( sf_rnfisf(1), STAT=ierror )
-               ALLOCATE( sf_rnfisf(1)%fnow(jpi,jpj,1), sf_rnfisf(1)%fdta(jpi,jpj,1,2) )
-               CALL fld_fill( sf_rnfisf, (/ sn_rnfisf /), cn_dirisf, 'sbc_isf_init', 'read fresh water flux isf data', 'namsbc_isf' )
-             ENDIF
-
-            !: read effective lenght (BG03)
-            IF (nn_isf == 2) THEN
-               ! Read Data and save some integral values
-               CALL iom_open( sn_Leff_isf%clname, inum )
-               cvarLeff  = 'soLeff'               !: variable name for Efficient Length scale
-               CALL iom_get( inum, jpdom_data, cvarLeff, risfLeff , 1)
-               CALL iom_close(inum)
-               !
-               risfLeff = risfLeff*1000           !: convertion in m
-            END IF
-
-           ! read depth of the top and bottom of the isf top boundary layer (in this case, isf front depth and grounding line depth)
-            CALL iom_open( sn_depmax_isf%clname, inum )
-            cvarhisf = TRIM(sn_depmax_isf%clvar)
-            CALL iom_get( inum, jpdom_data, cvarhisf, rhisf_tbl, 1) !: depth of deepest point of the ice shelf base
-            CALL iom_close(inum)
-            !
-            CALL iom_open( sn_depmin_isf%clname, inum )
-            cvarzisf = TRIM(sn_depmin_isf%clvar)
-            CALL iom_get( inum, jpdom_data, cvarzisf, rzisf_tbl, 1) !: depth of shallowest point of the ice shelves base
-            CALL iom_close(inum)
-            !
-            rhisf_tbl(:,:) = rhisf_tbl(:,:) - rzisf_tbl(:,:)        !: tickness isf boundary layer
-
-           !! compute first level of the top boundary layer
-           DO ji = 1, jpi
-              DO jj = 1, jpj
-                  jk = 2
-                  DO WHILE ( jk .LE. mbkt(ji,jj) .AND. gdepw_0(ji,jj,jk) < rzisf_tbl(ji,jj) ) ;  jk = jk + 1 ;  END DO
-                  misfkt(ji,jj) = jk-1
-               END DO
-            END DO
-
-         ELSE IF ( nn_isf == 4 ) THEN
-            ! as in nn_isf == 1
-            rhisf_tbl(:,:) = rn_hisf_tbl
-            misfkt(:,:)    = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
-            
-            ! load variable used in fldread (use for temporal interpolation of isf fwf forcing)
-            IF( .NOT.l_isfcpl ) THEN
-               ALLOCATE( sf_fwfisf(1), sf_qisf(1), STAT=ierror )
-               ALLOCATE( sf_fwfisf(1)%fnow(jpi,jpj,1), sf_fwfisf(1)%fdta(jpi,jpj,1,2) )
-               ALLOCATE( sf_qisf(1)%fnow(jpi,jpj,1), sf_qisf(1)%fdta(jpi,jpj,1,2) )
-               CALL fld_fill( sf_fwfisf, (/ sn_fwfisf /), cn_dirisf, 'sbc_isf_init', 'read fresh water flux isf data', 'namsbc_isf' )
-               !CALL fld_fill( sf_qisf  , (/ sn_qisf   /), cn_dirisf, 'sbc_isf_init', 'read heat flux isf data'       , 'namsbc_isf' )
-            ENDIF
-         END IF
-         
-         ! save initial top boundary layer thickness         
-         rhisf_tbl_0(:,:) = rhisf_tbl(:,:)
-
-      END IF
-
-      !                                            ! ---------------------------------------- !
-      IF( kt /= nit000 ) THEN                      !          Swap of forcing fields          !
-         !                                         ! ---------------------------------------- !
-         fwfisf_b  (:,:  ) = fwfisf  (:,:  )               ! Swap the ocean forcing fields except at nit000
-         risf_tsc_b(:,:,:) = risf_tsc(:,:,:)               ! where before fields are set at the end of the routine
-         !
-      ENDIF
 
       IF( MOD( kt-1, nn_fsbc) == 0 ) THEN
@@ -340,21 +221,147 @@
             !
          END IF
-         !
-         IF( kt == nit000 ) THEN                          !   set the forcing field at nit000 - 1    !
-            IF( ln_rstart .AND.    &                     ! Restart: read in restart file
-                 & iom_varid( numror, 'fwf_isf_b', ldstop = .FALSE. ) > 0 ) THEN
-               IF(lwp) WRITE(numout,*) '          nit000-1 isf tracer content forcing fields read in the restart file'
-               CALL iom_get( numror, jpdom_autoglo, 'fwf_isf_b', fwfisf_b(:,:) )   ! before salt content isf_tsc trend
-               CALL iom_get( numror, jpdom_autoglo, 'isf_sc_b', risf_tsc_b(:,:,jp_sal) )   ! before salt content isf_tsc trend
-               CALL iom_get( numror, jpdom_autoglo, 'isf_hc_b', risf_tsc_b(:,:,jp_tem) )   ! before salt content isf_tsc trend
-            ELSE
-               fwfisf_b(:,:)    = fwfisf(:,:)
-               risf_tsc_b(:,:,:)= risf_tsc(:,:,:)
-            END IF
-         ENDIF
          ! 
       END IF
-  
+      !
+      !
+      IF( kt == nit000 ) THEN                          !   set the forcing field at nit000 - 1    !
+         IF( ln_rstart .AND.    &                     ! Restart: read in restart file
+              & iom_varid( numror, 'fwf_isf_b', ldstop = .FALSE. ) > 0 ) THEN
+            IF(lwp) WRITE(numout,*) '          nit000-1 isf tracer content forcing fields read in the restart file'
+            CALL iom_get( numror, jpdom_autoglo, 'fwf_isf_b', fwfisf_b(:,:) ) ! before salt content isf_tsc trend
+            CALL iom_get( numror, jpdom_autoglo, 'isf_sc_b', risf_tsc_b(:,:,jp_sal) )   ! before salt content isf_tsc trend
+            CALL iom_get( numror, jpdom_autoglo, 'isf_hc_b', risf_tsc_b(:,:,jp_tem) )   ! before salt content isf_tsc trend
+         ELSE
+            fwfisf_b(:,:)    = fwfisf(:,:)
+            risf_tsc_b(:,:,:)= risf_tsc(:,:,:)
+         END IF
+      ENDIF
+      !
+      IF( lrst_oce ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'sbc : isf surface tracer content forcing fields written in ocean restart file ',   &
+            &                    'at it= ', kt,' date= ', ndastp
+         IF(lwp) WRITE(numout,*) '~~~~'
+         CALL iom_rstput( kt, nitrst, numrow, 'fwf_isf_b', fwfisf(:,:) )
+         CALL iom_rstput( kt, nitrst, numrow, 'isf_hc_b' , risf_tsc(:,:,jp_tem) )
+         CALL iom_rstput( kt, nitrst, numrow, 'isf_sc_b' , risf_tsc(:,:,jp_sal) )
+      ENDIF
+       !
   END SUBROUTINE sbc_isf
+
+  SUBROUTINE sbc_isf_init
+
+    INTEGER                      ::   ji, jj, jk, ijkmin, inum, ierror
+    INTEGER                      ::   ikt, ikb   ! top and bottom level of the isf boundary layer
+    REAL(wp)                     ::   zhk
+    CHARACTER(len=256)           ::   cfisf , cvarzisf, cvarhisf   ! name for isf file
+    CHARACTER(LEN=256)           :: cnameis                     ! name of iceshelf file
+    CHARACTER (LEN=32)           :: cvarLeff                    ! variable name for efficient Length scale
+    INTEGER           ::   ios           ! Local integer output status for namelist read
+
+      !
+      !!---------------------------------------------------------------------
+      NAMELIST/namsbc_isf/ nn_isfblk, rn_hisf_tbl, ln_divisf, ln_conserve, rn_gammat0, rn_gammas0, nn_gammablk, &
+                         & sn_fwfisf, sn_qisf, sn_rnfisf, sn_depmax_isf, sn_depmin_isf, sn_Leff_isf
+      !
+      !
+         REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs 
+         READ  ( numnam_ref, namsbc_isf, IOSTAT = ios, ERR = 901)
+901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in reference namelist', lwp )
+
+         REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
+         READ  ( numnam_cfg, namsbc_isf, IOSTAT = ios, ERR = 902 )
+902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist', lwp )
+         IF(lwm) WRITE ( numond, namsbc_isf )
+
+
+         IF ( lwp ) WRITE(numout,*)
+         IF ( lwp ) WRITE(numout,*) 'sbc_isf: heat flux of the ice shelf'
+         IF ( lwp ) WRITE(numout,*) '~~~~~~~~~'
+         IF ( lwp ) WRITE(numout,*) 'sbcisf :' 
+         IF ( lwp ) WRITE(numout,*) '~~~~~~~~'
+         IF ( lwp ) WRITE(numout,*) '        nn_isf      = ', nn_isf
+         IF ( lwp ) WRITE(numout,*) '        nn_isfblk   = ', nn_isfblk
+         IF ( lwp ) WRITE(numout,*) '        rn_hisf_tbl = ', rn_hisf_tbl
+         IF ( lwp ) WRITE(numout,*) '        ln_divisf   = ', ln_divisf 
+         IF ( lwp ) WRITE(numout,*) '        nn_gammablk = ', nn_gammablk 
+         IF ( lwp ) WRITE(numout,*) '        rn_tfri2    = ', rn_tfri2 
+         IF (ln_divisf) THEN       ! keep it in the namelist ??? used true anyway as for runoff ? (PM)
+            rdivisf = 1._wp
+         ELSE
+            rdivisf = 0._wp
+         END IF
+         !
+         ! Allocate public variable
+         IF ( sbc_isf_alloc()  /= 0 )         CALL ctl_stop( 'STOP', 'sbc_isf : unable to allocate arrays' )
+         !
+         ! initialisation
+         qisf(:,:)        = 0._wp  ; fwfisf(:,:) = 0._wp
+         risf_tsc(:,:,:)  = 0._wp
+         !
+         ! define isf tbl tickness, top and bottom indice
+         IF      (nn_isf == 1) THEN
+            rhisf_tbl(:,:) = rn_hisf_tbl
+            misfkt(:,:)    = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
+         ELSE IF ((nn_isf == 3) .OR. (nn_isf == 2)) THEN
+            IF( .NOT.l_isfcpl ) THEN
+               ALLOCATE( sf_rnfisf(1), STAT=ierror )
+               ALLOCATE( sf_rnfisf(1)%fnow(jpi,jpj,1), sf_rnfisf(1)%fdta(jpi,jpj,1,2) )
+               CALL fld_fill( sf_rnfisf, (/ sn_rnfisf /), cn_dirisf, 'sbc_isf_init', 'read fresh water flux isf data', 'namsbc_isf' )
+             ENDIF
+
+            !: read effective lenght (BG03)
+            IF (nn_isf == 2) THEN
+               ! Read Data and save some integral values
+               CALL iom_open( sn_Leff_isf%clname, inum )
+               cvarLeff  = 'soLeff'               !: variable name for Efficient Length scale
+               CALL iom_get( inum, jpdom_data, cvarLeff, risfLeff , 1)
+               CALL iom_close(inum)
+               !
+               risfLeff = risfLeff*1000           !: convertion in m
+            END IF
+
+           ! read depth of the top and bottom of the isf top boundary layer (in this case, isf front depth and grounding line depth)
+            CALL iom_open( sn_depmax_isf%clname, inum )
+            cvarhisf = TRIM(sn_depmax_isf%clvar)
+            CALL iom_get( inum, jpdom_data, cvarhisf, rhisf_tbl, 1) !: depth of deepest point of the ice shelf base
+            CALL iom_close(inum)
+            !
+            CALL iom_open( sn_depmin_isf%clname, inum )
+            cvarzisf = TRIM(sn_depmin_isf%clvar)
+            CALL iom_get( inum, jpdom_data, cvarzisf, rzisf_tbl, 1) !: depth of shallowest point of the ice shelves base
+            CALL iom_close(inum)
+            !
+            rhisf_tbl(:,:) = rhisf_tbl(:,:) - rzisf_tbl(:,:)        !: tickness isf boundary layer
+
+           !! compute first level of the top boundary layer
+           DO ji = 1, jpi
+              DO jj = 1, jpj
+                  jk = 2
+                  DO WHILE ( jk .LE. mbkt(ji,jj) .AND. gdepw_0(ji,jj,jk) < rzisf_tbl(ji,jj) ) ;  jk = jk + 1 ;  END DO
+                  misfkt(ji,jj) = jk-1
+               END DO
+            END DO
+
+         ELSE IF ( nn_isf == 4 ) THEN
+            ! as in nn_isf == 1
+            rhisf_tbl(:,:) = rn_hisf_tbl
+            misfkt(:,:)    = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
+            
+            ! load variable used in fldread (use for temporal interpolation of isf fwf forcing)
+            IF( .NOT.l_isfcpl ) THEN
+               ALLOCATE( sf_fwfisf(1), sf_qisf(1), STAT=ierror )
+               ALLOCATE( sf_fwfisf(1)%fnow(jpi,jpj,1), sf_fwfisf(1)%fdta(jpi,jpj,1,2) )
+               ALLOCATE( sf_qisf(1)%fnow(jpi,jpj,1), sf_qisf(1)%fdta(jpi,jpj,1,2) )
+               CALL fld_fill( sf_fwfisf, (/ sn_fwfisf /), cn_dirisf, 'sbc_isf_init', 'read fresh water flux isf data', 'namsbc_isf' )
+               !CALL fld_fill( sf_qisf  , (/ sn_qisf   /), cn_dirisf, 'sbc_isf_init', 'read heat flux isf data'       , 'namsbc_isf' )
+            ENDIF
+         END IF
+         ! save initial top boundary layer thickness         
+         rhisf_tbl_0(:,:) = rhisf_tbl(:,:)
+         ! 
+   END SUBROUTINE sbc_isf_init
+      
+
 
   INTEGER FUNCTION sbc_isf_alloc()
Index: branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 7778)
+++ branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 7784)
@@ -300,4 +300,6 @@
       IF( ln_ssr           )   CALL sbc_ssr_init               ! Sea-Surface Restoring initialisation
       !
+      IF( nn_isf   /= 0    )   CALL sbc_isf_init               ! Compute iceshelves
+
                                CALL sbc_rnf_init               ! Runof initialisation
       !
@@ -343,4 +345,8 @@
             rnf_b    (:,:  ) = rnf    (:,:  )
             rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:)
+         ENDIF
+         IF( nn_isf /= 0  )  THEN
+            fwfisf_b  (:,:  ) = fwfisf  (:,:  )               
+            risf_tsc_b(:,:,:) = risf_tsc(:,:,:)              
          ENDIF
       ENDIF
Index: branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90
===================================================================
--- branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 7778)
+++ branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 7784)
@@ -248,13 +248,4 @@
             END DO
          END DO
-         IF( lrst_oce ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'sbc : isf surface tracer content forcing fields written in ocean restart file ',   &
-               &                    'at it= ', kt,' date= ', ndastp
-            IF(lwp) WRITE(numout,*) '~~~~'
-            CALL iom_rstput( kt, nitrst, numrow, 'fwf_isf_b', fwfisf(:,:)          )
-            CALL iom_rstput( kt, nitrst, numrow, 'isf_hc_b' , risf_tsc(:,:,jp_tem) )
-            CALL iom_rstput( kt, nitrst, numrow, 'isf_sc_b' , risf_tsc(:,:,jp_sal) )
-         ENDIF
       END IF
       !
