Index: /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90
===================================================================
--- /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90	(revision 9497)
+++ /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90	(revision 9498)
@@ -30,7 +30,4 @@
    USE ioipsl         ! I/O IPSL library
    USE in_out_manager ! I/O Manager
-#if defined key_nemocice_decomp
-   USE ice_domain_size, only: nx_global, ny_global
-#endif
 
    IMPLICIT NONE
Index: /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90
===================================================================
--- /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 9497)
+++ /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 9498)
@@ -88,22 +88,8 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fr_iu              !: ice fraction at NEMO U point
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fr_iv              !: ice fraction at NEMO V point
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sstfrz             !: sea surface freezing temperature
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tsfc_ice           !: sea-ice surface skin temperature (on categories)
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   kn_ice             !: sea-ice surface layer thermal conductivity (on cats)
-
+   
    ! variables used in the coupled interface
    INTEGER , PUBLIC, PARAMETER ::   jpl = ncat
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   u_ice, v_ice          ! jpi, jpj
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  a_p, ht_p ! Meltpond fraction and depth
-   
-   !
-   
-   !
-#if defined key_asminc
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ndaice_da          !: NEMO fresh water flux to ocean due to data assim
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   nfresh_da          !: NEMO salt flux to ocean due to data assim
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   nfsalt_da          !: NEMO ice concentration change/second from data assim
-#endif
-      
    
    ! already defined in ice.F90 for LIM3
Index: /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 9497)
+++ /branches/UKMO/dev_merge_2017_CICE_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 9498)
@@ -13,6 +13,5 @@
    USE dom_oce         ! ocean space and time domain
    USE domvvl
-   USE eosbn2, only : eos_fzp ! Function to calculate freezing point of seawater
-   USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic, rt0
+   USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic
    USE in_out_manager  ! I/O manager
    USE iom, ONLY : iom_put,iom_use              ! I/O manager library !!Joakim edit
@@ -34,6 +33,6 @@
    USE ice_gather_scatter
    USE ice_calendar, only: dt
+   USE ice_state, only: aice,aicen,uvel,vvel,vsno,vsnon,vice,vicen
 # if defined key_cice4
-   USE ice_state, only: aice,aicen,uvel,vvel,vsno,vsnon,vice,vicen
    USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow,  &
                 strocnxT,strocnyT,                               & 
@@ -42,27 +41,15 @@
                 flatn_f,fsurfn_f,fcondtopn_f,                    &
                 uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl,   &
-                swvdr,swvdf,swidr,swidf,Tf
+                swvdr,swvdf,swidr,swidf
    USE ice_therm_vertical, only: calc_Tsfc
 #else
-   USE ice_state, only: aice,aicen,uvel,nt_hpnd,trcrn,vvel,vsno,&
-                vsnon,vice,vicen,nt_Tsfc
    USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow,  &
                 strocnxT,strocnyT,                               & 
-                sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_ai,      &
-                fresh_ai,fhocn_ai,fswthru_ai,frzmlt,             &
+                sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_ai,     &
+                fresh_ai,fhocn_ai,fswthru_ai,frzmlt,          &
                 flatn_f,fsurfn_f,fcondtopn_f,                    &
-#ifdef key_asminc
-                daice_da,fresh_da,fsalt_da,                    &
-#endif
                 uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl,   &
-                swvdr,swvdf,swidr,swidf,Tf,                      &
-		!! When using NEMO with CICE, this change requires use of 
-		!! one of the following two CICE branches:
-		!! - at CICE5.0,   hadax/r1015_GSI8_with_GSI7
-		!! - at CICE5.1.2, hadax/vn5.1.2_GSI8
-                keffn_top,Tn_top
-
-   USE ice_therm_shared, only: calc_Tsfc, heat_capacity
-   USE ice_shortwave, only: apeffn
+                swvdr,swvdf,swidr,swidf
+   USE ice_therm_shared, only: calc_Tsfc
 #endif
    USE ice_forcing, only: frcvdr,frcvdf,frcidr,frcidf
@@ -168,5 +155,5 @@
       INTEGER, INTENT( in  ) ::   ksbc                ! surface forcing type
       REAL(wp), DIMENSION(jpi,jpj) :: ztmp1, ztmp2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztfrz3d
+      REAL(wp) ::   zcoefu, zcoefv, zcoeff            ! local scalar
       INTEGER  ::   ji, jj, jl, jk                    ! dummy loop indices
       !!---------------------------------------------------------------------
@@ -177,8 +164,17 @@
       jj_off = INT ( (jpjglo - ny_global) / 2 )
 
-      ! Initialize CICE
+#if defined key_nemocice_decomp
+      ! Pass initial SST from NEMO to CICE so ice is initialised correctly if
+      ! there is no restart file.
+      ! Values from a CICE restart file would overwrite this
+      IF ( .NOT. ln_rstart ) THEN    
+         CALL nemo2cice( tsn(:,:,1,jp_tem) , sst , 'T' , 1.) 
+      ENDIF  
+#endif
+
+! Initialize CICE
       CALL CICE_Initialize
 
-      ! Do some CICE consistency checks
+! Do some CICE consistency checks
       IF ( (ksbc == jp_flx) .OR. (ksbc == jp_purecpl) ) THEN
          IF ( calc_strair .OR. calc_Tsfc ) THEN
@@ -192,29 +188,16 @@
 
 
-      ! allocate sbc_ice and sbc_cice arrays
-      IF( sbc_ice_alloc()      /= 0 )   CALL ctl_stop( 'STOP', 'sbc_ice_alloc : unable to allocate arrays' )
+! allocate sbc_ice and sbc_cice arrays
+      IF( sbc_ice_alloc()      /= 0 )   CALL ctl_stop( 'STOP', 'sbc_ice_cice_alloc : unable to allocate arrays' )
       IF( sbc_ice_cice_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_ice_cice_alloc : unable to allocate cice arrays' )
 
-      ! Ensure that no temperature points are below freezing if not a NEMO restart
+! Ensure ocean temperatures are nowhere below freezing if not a NEMO restart
       IF( .NOT. ln_rstart ) THEN
-
-         DO jk=1,jpk
-             CALL eos_fzp( tsn(:,:,jk,jp_sal), ztfrz3d(:,:,jk), gdept_n(:,:,jk) )
-         ENDDO
-         tsn(:,:,:,jp_tem) = MAX( tsn(:,:,:,jp_tem), ztfrz3d )
+         tsn(:,:,:,jp_tem) = MAX (tsn(:,:,:,jp_tem),Tocnfrz)
          tsb(:,:,:,jp_tem) = tsn(:,:,:,jp_tem)
-
-#if defined key_nemocice_decomp
-         ! Pass initial SST from NEMO to CICE so ice is initialised correctly if
-         ! there is no restart file.
-         ! Values from a CICE restart file would overwrite this
-         CALL nemo2cice( tsn(:,:,1,jp_tem) , sst , 'T' , 1.) 
-#endif
-
-      ENDIF  
-
-      ! calculate surface freezing temperature and send to CICE
-      CALL  eos_fzp(sss_m(:,:), sstfrz(:,:), gdept_n(:,:,1)) 
-      CALL nemo2cice(sstfrz,Tf, 'T', 1. )
+      ENDIF
+
+      fr_iu(:,:)=0.0
+      fr_iv(:,:)=0.0
 
       CALL cice2nemo(aice,fr_i, 'T', 1. )
@@ -227,6 +210,4 @@
 ! T point to U point
 ! T point to V point
-      fr_iu(:,:)=0.0
-      fr_iv(:,:)=0.0
       DO jj=1,jpjm1
          DO ji=1,jpim1
@@ -287,17 +268,5 @@
          ENDIF
       ENDIF
-
-#if defined key_asminc
-	   ! Initialize fresh water and salt fluxes from data assim   
-	   !  and data assimilation index to cice 
-	   nfresh_da(:,:) = 0.0   
-	   nfsalt_da(:,:) = 0.0   
-	   ndaice_da(:,:) = 0.0         
-#endif
-      !
-      ! In coupled mode get extra fields from CICE for passing back to atmosphere
- 
-      IF ( ksbc == jp_purecpl ) CALL cice_sbc_hadgam(nit000)
-      ! 
+      !
    END SUBROUTINE cice_sbc_init
 
@@ -352,16 +321,4 @@
          CALL nemo2cice(ztmp,stray,'F', -1. )
 
-
-! Alex West: From configuration GSI8 onwards, when NEMO is used with CICE in
-! HadGEM3 the 'time-travelling ice' coupling approach is used, whereby 
-! atmosphere-ice fluxes are passed as pseudo-local values, formed by dividing
-! gridbox mean fluxes in the UM by future ice concentration obtained through 	
-! OASIS.  This allows for a much more realistic apportionment of energy through
-! the ice - and conserves energy.
-! Therefore the fluxes are now divided by ice concentration in the coupled
-! formulation (jp_purecpl) as well as for jp_flx.  This NEMO branch should only
-! be used at UM10.2 onwards (unless an explicit GSI8 UM branch is included), at
-! which point the GSI8 UM changes were committed.
-
 ! Surface downward latent heat flux (CI_5)
          IF (ksbc == jp_flx) THEN
@@ -369,13 +326,24 @@
                ztmpn(:,:,jl)=qla_ice(:,:,1)*a_i(:,:,jl)
             ENDDO
-         ELSE IF (ksbc == jp_purecpl) THEN
-            DO jl=1,ncat
-               ztmpn(:,:,jl)=qla_ice(:,:,jl)*a_i(:,:,jl)
+         ELSE
+! emp_ice is set in sbc_cpl_ice_flx as sublimation-snow
+            qla_ice(:,:,1)= - ( emp_ice(:,:)+sprecip(:,:) ) * Lsub
+! End of temporary code
+            DO jj=1,jpj
+               DO ji=1,jpi
+                  IF (fr_i(ji,jj).eq.0.0) THEN
+                     DO jl=1,ncat
+                        ztmpn(ji,jj,jl)=0.0
+                     ENDDO
+                     ! This will then be conserved in CICE
+                     ztmpn(ji,jj,1)=qla_ice(ji,jj,1)
+                  ELSE
+                     DO jl=1,ncat
+                        ztmpn(ji,jj,jl)=qla_ice(ji,jj,1)*a_i(ji,jj,jl)/fr_i(ji,jj)
+                     ENDDO
+                  ENDIF
+               ENDDO
             ENDDO
-	 ELSE
-           !In coupled mode - qla_ice calculated in sbc_cpl for each category
-           ztmpn(:,:,1:ncat)=qla_ice(:,:,1:ncat)
          ENDIF
-
          DO jl=1,ncat
             CALL nemo2cice(ztmpn(:,:,jl),flatn_f(:,:,jl,:),'T', 1. )
@@ -383,5 +351,5 @@
 ! GBM conductive flux through ice (CI_6)
 !  Convert to GBM
-            IF (ksbc == jp_flx .OR. ksbc == jp_purecpl) THEN
+            IF (ksbc == jp_flx) THEN
                ztmp(:,:) = botmelt(:,:,jl)*a_i(:,:,jl)
             ELSE
@@ -392,5 +360,5 @@
 ! GBM surface heat flux (CI_7)
 !  Convert to GBM
-            IF (ksbc == jp_flx .OR. ksbc == jp_purecpl) THEN
+            IF (ksbc == jp_flx) THEN
                ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))*a_i(:,:,jl) 
             ELSE
@@ -441,10 +409,4 @@
       ENDIF
 
-#if defined key_asminc
-!Ice concentration change (from assimilation)
-      ztmp(:,:)=ndaice_da(:,:)*tmask(:,:,1)
-      Call nemo2cice(ztmp,daice_da,'T', 1. )
-#endif 
-
 ! Snowfall
 ! Ensure fsnow is positive (as in CICE routine prepare_forcing)
@@ -458,12 +420,10 @@
       CALL nemo2cice(ztmp,frain,'T', 1. ) 
 
-! Recalculate freezing temperature and send to CICE 
-      CALL eos_fzp(sss_m(:,:), sstfrz(:,:), gdept_n(:,:,1)) 
-      CALL nemo2cice(sstfrz,Tf,'T', 1. )
-
 ! Freezing/melting potential
 ! Calculated over NEMO leapfrog timestep (hence 2*dt)
-      nfrzmlt(:,:)=rau0*rcp*e3t_m(:,:)*(sstfrz(:,:)-sst_m(:,:))/(2.0*dt) 
-      CALL nemo2cice(nfrzmlt,frzmlt,'T', 1. )
+      nfrzmlt(:,:) = rau0 * rcp * e3t_m(:,:) * ( Tocnfrz-sst_m(:,:) ) / ( 2.0*dt )
+
+      ztmp(:,:) = nfrzmlt(:,:)
+      CALL nemo2cice(ztmp,frzmlt,'T', 1. )
 
 ! SST  and SSS
@@ -471,11 +431,4 @@
       CALL nemo2cice(sst_m,sst,'T', 1. )
       CALL nemo2cice(sss_m,sss,'T', 1. )
-
-      IF( ksbc == jp_purecpl ) THEN
-! Sea ice surface skin temperature
-         DO jl=1,ncat
-           CALL nemo2cice(tsfc_ice(:,:,jl), trcrn(:,:,nt_tsfc,jl,:),'T',1.)
-         ENDDO 
-      ENDIF
 
 ! x comp and y comp of surface ocean current
@@ -710,11 +663,10 @@
       INTEGER  ::   ierror
       !!---------------------------------------------------------------------
-#if defined key_asminc
-! Import fresh water and salt flux due to seaice da
-      CALL cice2nemo(fresh_da, nfresh_da,'T',1.0)
-      CALL cice2nemo(fsalt_da, nfsalt_da,'T',1.0)
-#endif
-
-      !
+      !
+      IF( kt == nit000 )  THEN
+         IF(lwp) WRITE(numout,*)'cice_sbc_hadgam'
+         IF( sbc_cpl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' )
+      ENDIF
+
       !                                         ! =========================== !
       !                                         !   Prepare Coupling fields   !
@@ -734,32 +686,4 @@
          CALL cice2nemo( vicen(:,:,jl,:), h_i(:,:,jl),'T', 1. )
       END DO
-
-#if ! defined key_cice4
-! Meltpond fraction and depth
-      DO jl = 1,ncat
-         CALL cice2nemo(apeffn(:,:,jl,:),a_p(:,:,jl),'T', 1. )
-         CALL cice2nemo(trcrn(:,:,nt_hpnd,jl,:),ht_p(:,:,jl),'T', 1. )
-      ENDDO
-#endif
-
-
-! If using multilayers thermodynamics in CICE then get top layer temperature
-! and effective conductivity       
-!! When using NEMO with CICE, this change requires use of 
-!! one of the following two CICE branches:
-!! - at CICE5.0,   hadax/r1015_GSI8_with_GSI7
-!! - at CICE5.1.2, hadax/vn5.1.2_GSI8
-      IF (heat_capacity) THEN
-         DO jl = 1,ncat
-            CALL cice2nemo(Tn_top(:,:,jl,:),tn_ice(:,:,jl),'T', 1. )
-            CALL cice2nemo(keffn_top(:,:,jl,:),kn_ice(:,:,jl),'T', 1. )
-         ENDDO
-! Convert surface temperature to Kelvin
-         tn_ice(:,:,:)=tn_ice(:,:,:)+rt0
-      ELSE
-         tn_ice(:,:,:) = 0.0
-         kn_ice(:,:,:) = 0.0
-      ENDIF       
-
       !
    END SUBROUTINE cice_sbc_hadgam
