Index: branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 3189)
+++ branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 3193)
@@ -19,4 +19,5 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE wrk_nemo        ! work arrays
+   USE timing          ! Timing
    USE daymod          ! calendar
    USE fldread         ! read input fields
@@ -110,5 +111,7 @@
       INTEGER, INTENT(in) ::   nsbc    ! surface forcing type
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('sbc_ice_cice')
+      !
       !                                        !----------------------!
       IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN     !  Ice time-step only  !
@@ -129,4 +132,6 @@
 
       ENDIF                                          ! End sea-ice time step only
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('sbc_ice_cice')
 
    END SUBROUTINE sbc_ice_cice
@@ -142,4 +147,6 @@
       INTEGER  ::   ji, jj, jpl                        ! dummy loop indices
 
+      IF( nn_timing == 1 )  CALL timing_start('cice_sbc_init')
+      !
       IF(lwp) WRITE(numout,*)'cice_sbc_init'
 
@@ -148,13 +155,13 @@
 
 ! Do some CICE consistency checks
-     IF ( (nsbc == 2) .OR. (nsbc == 5) ) THEN
-        IF ( calc_strair .OR. calc_Tsfc ) THEN
-           CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=F and calc_Tsfc=F in ice_in' )
-        ENDIF
-     ELSEIF (nsbc == 4) THEN
-        IF ( .NOT. (calc_strair .AND. calc_Tsfc) ) THEN
-           CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=T and calc_Tsfc=T in ice_in' )
-        ENDIF
-     ENDIF
+      IF ( (nsbc == 2) .OR. (nsbc == 5) ) THEN
+         IF ( calc_strair .OR. calc_Tsfc ) THEN
+            CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=F and calc_Tsfc=F in ice_in' )
+         ENDIF
+      ELSEIF (nsbc == 4) THEN
+         IF ( .NOT. (calc_strair .AND. calc_Tsfc) ) THEN
+            CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=T and calc_Tsfc=T in ice_in' )
+         ENDIF
+      ENDIF
 
 
@@ -169,26 +176,28 @@
       ENDIF
 
-     fr_iu(:,:)=0.0
-     fr_iv(:,:)=0.0
-
-     CALL cice2nemo(aice,fr_i, 'T', 1. )
-     IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
-        DO jpl=1,ncat
-           CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
-        ENDDO
-     ENDIF
+      fr_iu(:,:)=0.0
+      fr_iv(:,:)=0.0
+
+      CALL cice2nemo(aice,fr_i, 'T', 1. )
+      IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
+         DO jpl=1,ncat
+            CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
+         ENDDO
+      ENDIF
 
 ! T point to U point
 ! T point to V point
-     DO jj=1,jpjm1
-        DO ji=1,jpim1
-           fr_iu(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji+1,jj))*umask(ji,jj,1)
-           fr_iv(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji,jj+1))*vmask(ji,jj,1)
-        ENDDO
-     ENDDO
-
-     CALL lbc_lnk ( fr_iu , 'U', 1. )
-     CALL lbc_lnk ( fr_iv , 'V', 1. )
-
+      DO jj=1,jpjm1
+         DO ji=1,jpim1
+            fr_iu(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji+1,jj))*umask(ji,jj,1)
+            fr_iv(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji,jj+1))*vmask(ji,jj,1)
+         ENDDO
+      ENDDO
+
+      CALL lbc_lnk ( fr_iu , 'U', 1. )
+      CALL lbc_lnk ( fr_iv , 'V', 1. )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_init')
+      !
    END SUBROUTINE cice_sbc_init
 
@@ -207,12 +216,14 @@
       !!---------------------------------------------------------------------
 
+      IF( nn_timing == 1 )  CALL timing_start('cice_sbc_in')
+      !
       CALL wrk_alloc( jpi,jpj, ztmp )
       CALL wrk_alloc( jpi,jpj,ncat, ztmpn )
 
-     IF( kt == nit000 )  THEN
+      IF( kt == nit000 )  THEN
          IF(lwp) WRITE(numout,*)'cice_sbc_in'
-     ENDIF
-
-     ztmp(:,:)=0.0
+      ENDIF
+
+      ztmp(:,:)=0.0
 
 ! Aggregate ice concentration already set in cice_sbc_out (or cice_sbc_init on 
@@ -221,100 +232,100 @@
 ! forced and coupled case 
 
-     IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
-
-     ztmpn(:,:,:)=0.0
+      IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
+
+         ztmpn(:,:,:)=0.0
 
 ! x comp of wind stress (CI_1)
 ! U point to F point
-     DO jj=1,jpjm1
-        DO ji=1,jpi
-           ztmp(ji,jj)=0.5*(fr_iu(ji,jj)*utau(ji,jj)      &
-                              +fr_iu(ji,jj+1)*utau(ji,jj+1))*fmask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL nemo2cice(ztmp,strax,'F', -1. )
+         DO jj=1,jpjm1
+            DO ji=1,jpi
+               ztmp(ji,jj) = 0.5 * (  fr_iu(ji,jj) * utau(ji,jj)      &
+                                    + fr_iu(ji,jj+1) * utau(ji,jj+1) ) * fmask(ji,jj,1)
+            ENDDO
+         ENDDO
+         CALL nemo2cice(ztmp,strax,'F', -1. )
 
 ! y comp of wind stress (CI_2)
 ! V point to F point
-     DO jj=1,jpj
-        DO ji=1,jpim1
-           ztmp(ji,jj)=0.5*(fr_iv(ji,jj)*vtau(ji,jj)      &
-                              +fr_iv(ji+1,jj)*vtau(ji+1,jj))*fmask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL nemo2cice(ztmp,stray,'F', -1. )
+         DO jj=1,jpj
+            DO ji=1,jpim1
+               ztmp(ji,jj) = 0.5 * (  fr_iv(ji,jj) * vtau(ji,jj)      &
+                                    + fr_iv(ji+1,jj) * vtau(ji+1,jj) ) * fmask(ji,jj,1)
+            ENDDO
+         ENDDO
+         CALL nemo2cice(ztmp,stray,'F', -1. )
 
 ! Surface downward latent heat flux (CI_5)
-    IF (nsbc == 2) THEN
-        DO jpl=1,ncat
-           ztmpn(:,:,jpl)=qla_ice(:,:,1)*a_i(:,:,jpl)
-        ENDDO
-     ELSE
+         IF (nsbc == 2) THEN
+            DO jpl=1,ncat
+               ztmpn(:,:,jpl)=qla_ice(:,:,1)*a_i(:,:,jpl)
+            ENDDO
+         ELSE
 ! emp_ice is set in sbc_cpl_ice_flx as sublimation-snow
-        qla_ice(:,:,1)= - ( emp_ice(:,:)+sprecip(:,:) ) * Lsub
+            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 jpl=1,ncat
-                    ztmpn(ji,jj,jpl)=0.0
-                 ENDDO
-                 ! This will then be conserved in CICE
-                 ztmpn(ji,jj,1)=qla_ice(ji,jj,1)
-              ELSE
-                 DO jpl=1,ncat
-                    ztmpn(ji,jj,jpl)=qla_ice(ji,jj,1)*a_i(ji,jj,jpl)/fr_i(ji,jj)
-                 ENDDO
-              ENDIF
-           ENDDO
-        ENDDO
-     ENDIF
-     DO jpl=1,ncat
-        CALL nemo2cice(ztmpn(:,:,jpl),flatn_f(:,:,jpl,:),'T', 1. )
+            DO jj=1,jpj
+               DO ji=1,jpi
+                  IF (fr_i(ji,jj).eq.0.0) THEN
+                     DO jpl=1,ncat
+                        ztmpn(ji,jj,jpl)=0.0
+                     ENDDO
+                     ! This will then be conserved in CICE
+                     ztmpn(ji,jj,1)=qla_ice(ji,jj,1)
+                  ELSE
+                     DO jpl=1,ncat
+                        ztmpn(ji,jj,jpl)=qla_ice(ji,jj,1)*a_i(ji,jj,jpl)/fr_i(ji,jj)
+                     ENDDO
+                  ENDIF
+               ENDDO
+            ENDDO
+         ENDIF
+         DO jpl=1,ncat
+            CALL nemo2cice(ztmpn(:,:,jpl),flatn_f(:,:,jpl,:),'T', 1. )
 
 ! GBM conductive flux through ice (CI_6)
 !  Convert to GBM
-        IF (nsbc == 2) THEN
-           ztmp(:,:) = botmelt(:,:,jpl)*a_i(:,:,jpl)
-        ELSE
-           ztmp(:,:) = botmelt(:,:,jpl)
-        ENDIF
-        CALL nemo2cice(ztmp,fcondtopn_f(:,:,jpl,:),'T', 1. )
+            IF (nsbc == 2) THEN
+               ztmp(:,:) = botmelt(:,:,jpl)*a_i(:,:,jpl)
+            ELSE
+               ztmp(:,:) = botmelt(:,:,jpl)
+            ENDIF
+            CALL nemo2cice(ztmp,fcondtopn_f(:,:,jpl,:),'T', 1. )
 
 ! GBM surface heat flux (CI_7)
 !  Convert to GBM
-        IF (nsbc == 2) THEN
-           ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))*a_i(:,:,jpl) 
-        ELSE
-           ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))
-        ENDIF
-        CALL nemo2cice(ztmp,fsurfn_f(:,:,jpl,:),'T', 1. )
-     ENDDO
-
-     ELSE IF (nsbc == 4) THEN
+            IF (nsbc == 2) THEN
+               ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))*a_i(:,:,jpl) 
+            ELSE
+               ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))
+            ENDIF
+            CALL nemo2cice(ztmp,fsurfn_f(:,:,jpl,:),'T', 1. )
+         ENDDO
+
+      ELSE IF (nsbc == 4) THEN
 
 ! Pass CORE forcing fields to CICE (which will calculate heat fluxes etc itself)
 ! x comp and y comp of atmosphere surface wind (CICE expects on T points)
-        ztmp(:,:) = wndi_ice(:,:)
-        CALL nemo2cice(ztmp,uatm,'T', -1. )
-        ztmp(:,:) = wndj_ice(:,:)
-        CALL nemo2cice(ztmp,vatm,'T', -1. )
-        ztmp(:,:) = SQRT ( wndi_ice(:,:)**2 + wndj_ice(:,:)**2 )
-        CALL nemo2cice(ztmp,wind,'T', 1. )        ! Wind speed (m/s)
-        ztmp(:,:) = qsr_ice(:,:,1)
-        CALL nemo2cice(ztmp,fsw,'T', 1. )      ! Incoming short-wave (W/m^2)
-        ztmp(:,:) = qlw_ice(:,:,1)
-        CALL nemo2cice(ztmp,flw,'T', 1. )      ! Incoming long-wave (W/m^2)
-        ztmp(:,:) = tatm_ice(:,:)
-        CALL nemo2cice(ztmp,Tair,'T', 1. )    ! Air temperature (K)
-        CALL nemo2cice(ztmp,potT,'T', 1. )    ! Potential temp (K)
+         ztmp(:,:) = wndi_ice(:,:)
+         CALL nemo2cice(ztmp,uatm,'T', -1. )
+         ztmp(:,:) = wndj_ice(:,:)
+         CALL nemo2cice(ztmp,vatm,'T', -1. )
+         ztmp(:,:) = SQRT ( wndi_ice(:,:)**2 + wndj_ice(:,:)**2 )
+         CALL nemo2cice(ztmp,wind,'T', 1. )    ! Wind speed (m/s)
+         ztmp(:,:) = qsr_ice(:,:,1)
+         CALL nemo2cice(ztmp,fsw,'T', 1. )     ! Incoming short-wave (W/m^2)
+         ztmp(:,:) = qlw_ice(:,:,1)
+         CALL nemo2cice(ztmp,flw,'T', 1. )     ! Incoming long-wave (W/m^2)
+         ztmp(:,:) = tatm_ice(:,:)
+         CALL nemo2cice(ztmp,Tair,'T', 1. )    ! Air temperature (K)
+         CALL nemo2cice(ztmp,potT,'T', 1. )    ! Potential temp (K)
 ! Following line uses MAX(....) to avoid problems if tatm_ice has unset halo rows  
-        ztmp(:,:) = 101000. / ( 287.04 * MAX(1.0,tatm_ice(:,:)) )    
-                                                  ! Constant (101000.) atm pressure assumed
-        CALL nemo2cice(ztmp,rhoa,'T', 1. )        ! Air density (kg/m^3)
-        ztmp(:,:) = qatm_ice(:,:)
-        CALL nemo2cice(ztmp,Qa,'T', 1. )      ! Specific humidity (kg/kg)
-        ztmp(:,:)=10.0
-        CALL nemo2cice(ztmp,zlvl,'T', 1. )        ! Atmos level height (m)
+         ztmp(:,:) = 101000. / ( 287.04 * MAX(1.0,tatm_ice(:,:)) )    
+                                               ! Constant (101000.) atm pressure assumed
+         CALL nemo2cice(ztmp,rhoa,'T', 1. )    ! Air density (kg/m^3)
+         ztmp(:,:) = qatm_ice(:,:)
+         CALL nemo2cice(ztmp,Qa,'T', 1. )      ! Specific humidity (kg/kg)
+         ztmp(:,:)=10.0
+         CALL nemo2cice(ztmp,zlvl,'T', 1. )    ! Atmos level height (m)
 
 ! May want to check all values are physically realistic (as in CICE routine 
@@ -322,11 +333,11 @@
 
 ! Divide shortwave into spectral bands (as in prepare_forcing)
-         ztmp(:,:)=qsr_ice(:,:,1)*frcvdr                ! visible direct
+         ztmp(:,:)=qsr_ice(:,:,1)*frcvdr       ! visible direct
          CALL nemo2cice(ztmp,swvdr,'T', 1. )             
-         ztmp(:,:)=qsr_ice(:,:,1)*frcvdf                ! visible diffuse
+         ztmp(:,:)=qsr_ice(:,:,1)*frcvdf       ! visible diffuse
          CALL nemo2cice(ztmp,swvdf,'T', 1. )              
-         ztmp(:,:)=qsr_ice(:,:,1)*frcidr                ! near IR direct
+         ztmp(:,:)=qsr_ice(:,:,1)*frcidr       ! near IR direct
          CALL nemo2cice(ztmp,swidr,'T', 1. )
-         ztmp(:,:)=qsr_ice(:,:,1)*frcidf                ! near IR diffuse
+         ztmp(:,:)=qsr_ice(:,:,1)*frcidf       ! near IR diffuse
          CALL nemo2cice(ztmp,swidf,'T', 1. )
 
@@ -335,10 +346,10 @@
 ! Snowfall
 ! Ensure fsnow is positive (as in CICE routine prepare_forcing)  
-     ztmp(:,:)=MAX(fr_i(:,:)*sprecip(:,:),0.0)  
-     CALL nemo2cice(ztmp,fsnow,'T', 1. ) 
+      ztmp(:,:)=MAX(fr_i(:,:)*sprecip(:,:),0.0)  
+      CALL nemo2cice(ztmp,fsnow,'T', 1. ) 
 
 ! Rainfall
-     ztmp(:,:)=fr_i(:,:)*(tprecip(:,:)-sprecip(:,:))
-     CALL nemo2cice(ztmp,frain,'T', 1. ) 
+      ztmp(:,:)=fr_i(:,:)*(tprecip(:,:)-sprecip(:,:))
+      CALL nemo2cice(ztmp,frain,'T', 1. ) 
 
 ! Freezing/melting potential
@@ -347,56 +358,58 @@
 ! May be better using sst_m if not coupling to CICE every time-step
 
-!     nfrzmlt(:,:)=rau0*rcp*fse3t(:,:,1)*(Tocnfrz-sst_m(:,:))/(2.0*dt)
-     nfrzmlt(:,:)=rau0*rcp*fse3t(:,:,1)*(Tocnfrz-tsb(:,:,1,jp_tem))/(2.0*dt)
-
-     ztmp(:,:) = nfrzmlt(:,:)
-     CALL nemo2cice(ztmp,frzmlt,'T', 1. )
+!      nfrzmlt(:,:)=rau0*rcp*fse3t(:,:,1)*(Tocnfrz-sst_m(:,:))/(2.0*dt)
+      nfrzmlt(:,:)=rau0*rcp*fse3t(:,:,1)*(Tocnfrz-tsb(:,:,1,jp_tem))/(2.0*dt)
+
+      ztmp(:,:) = nfrzmlt(:,:)
+      CALL nemo2cice(ztmp,frzmlt,'T', 1. )
 
 ! SST  and SSS
 
-     CALL nemo2cice(sst_m,sst,'T', 1. )
-     CALL nemo2cice(sss_m,sss,'T', 1. )
+      CALL nemo2cice(sst_m,sst,'T', 1. )
+      CALL nemo2cice(sss_m,sss,'T', 1. )
 
 ! x comp and y comp of surface ocean current
 ! U point to F point
-     DO jj=1,jpjm1
-        DO ji=1,jpi
-           ztmp(ji,jj)=0.5*(ssu_m(ji,jj)+ssu_m(ji,jj+1))*fmask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL nemo2cice(ztmp,uocn,'F', -1. )
+      DO jj=1,jpjm1
+         DO ji=1,jpi
+            ztmp(ji,jj)=0.5*(ssu_m(ji,jj)+ssu_m(ji,jj+1))*fmask(ji,jj,1)
+         ENDDO
+      ENDDO
+      CALL nemo2cice(ztmp,uocn,'F', -1. )
 
 ! V point to F point
-     DO jj=1,jpj
-        DO ji=1,jpim1
-           ztmp(ji,jj)=0.5*(ssv_m(ji,jj)+ssv_m(ji+1,jj))*fmask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL nemo2cice(ztmp,vocn,'F', -1. )
+      DO jj=1,jpj
+         DO ji=1,jpim1
+            ztmp(ji,jj)=0.5*(ssv_m(ji,jj)+ssv_m(ji+1,jj))*fmask(ji,jj,1)
+         ENDDO
+      ENDDO
+      CALL nemo2cice(ztmp,vocn,'F', -1. )
 
 ! x comp and y comp of sea surface slope (on F points)
 ! T point to F point
-     DO jj=1,jpjm1
-        DO ji=1,jpim1
-           ztmp(ji,jj)=0.5 * (  (ssh_m(ji+1,jj  )-ssh_m(ji,jj  ))/e1u(ji,jj  )   &
-                              + (ssh_m(ji+1,jj+1)-ssh_m(ji,jj+1))/e1u(ji,jj+1) ) & 
-                           *  fmask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL nemo2cice(ztmp,ss_tltx,'F', -1. )
+      DO jj=1,jpjm1
+         DO ji=1,jpim1
+            ztmp(ji,jj)=0.5 * (  (ssh_m(ji+1,jj  )-ssh_m(ji,jj  ))/e1u(ji,jj  )   &
+                               + (ssh_m(ji+1,jj+1)-ssh_m(ji,jj+1))/e1u(ji,jj+1) ) & 
+                            *  fmask(ji,jj,1)
+         ENDDO
+      ENDDO
+      CALL nemo2cice(ztmp,ss_tltx,'F', -1. )
 
 ! T point to F point
-     DO jj=1,jpjm1
-        DO ji=1,jpim1
-           ztmp(ji,jj)=0.5 * (  (ssh_m(ji  ,jj+1)-ssh_m(ji  ,jj))/e2v(ji  ,jj)   &
-                              + (ssh_m(ji+1,jj+1)-ssh_m(ji+1,jj))/e2v(ji+1,jj) ) &
-                           *  fmask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL nemo2cice(ztmp,ss_tlty,'F', -1. )
+      DO jj=1,jpjm1
+         DO ji=1,jpim1
+            ztmp(ji,jj)=0.5 * (  (ssh_m(ji  ,jj+1)-ssh_m(ji  ,jj))/e2v(ji  ,jj)   &
+                               + (ssh_m(ji+1,jj+1)-ssh_m(ji+1,jj))/e2v(ji+1,jj) ) &
+                            *  fmask(ji,jj,1)
+         ENDDO
+      ENDDO
+      CALL nemo2cice(ztmp,ss_tlty,'F', -1. )
 
       CALL wrk_dealloc( jpi,jpj, ztmp )
       CALL wrk_dealloc( jpi,jpj,ncat, ztmpn )
-     !
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_in')
+      !
    END SUBROUTINE cice_sbc_in
 
@@ -414,4 +427,6 @@
       !!---------------------------------------------------------------------
 
+      IF( nn_timing == 1 )  CALL timing_start('cice_sbc_out')
+      !
       CALL wrk_alloc( jpi,jpj, ztmp )
       
@@ -421,25 +436,25 @@
       
 ! x comp of ocean-ice stress 
-     CALL cice2nemo(strocnx,ztmp,'F', -1. )
-     ss_iou(:,:)=0.0
+      CALL cice2nemo(strocnx,ztmp,'F', -1. )
+      ss_iou(:,:)=0.0
 ! F point to U point
-     DO jj=2,jpjm1
-        DO ji=2,jpim1
-           ss_iou(ji,jj)=0.5*( ztmp(ji,jj-1) + ztmp(ji,jj) ) * umask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL lbc_lnk( ss_iou , 'U', -1. )
+      DO jj=2,jpjm1
+         DO ji=2,jpim1
+            ss_iou(ji,jj) = 0.5 * ( ztmp(ji,jj-1) + ztmp(ji,jj) ) * umask(ji,jj,1)
+         ENDDO
+      ENDDO
+      CALL lbc_lnk( ss_iou , 'U', -1. )
 
 ! y comp of ocean-ice stress 
-     CALL cice2nemo(strocny,ztmp,'F', -1. )
-     ss_iov(:,:)=0.0
+      CALL cice2nemo(strocny,ztmp,'F', -1. )
+      ss_iov(:,:)=0.0
 ! F point to V point
 
-     DO jj=1,jpjm1
-        DO ji=2,jpim1
-           ss_iov(ji,jj)=0.5*( ztmp(ji-1,jj) + ztmp(ji,jj) ) * vmask(ji,jj,1)
-        ENDDO
-     ENDDO
-     CALL lbc_lnk( ss_iov , 'V', -1. )
+      DO jj=1,jpjm1
+         DO ji=2,jpim1
+            ss_iov(ji,jj) = 0.5 * ( ztmp(ji-1,jj) + ztmp(ji,jj) ) * vmask(ji,jj,1)
+         ENDDO
+      ENDDO
+      CALL lbc_lnk( ss_iov , 'V', -1. )
 
 ! x and y comps of surface stress
@@ -447,35 +462,35 @@
 ! [Note that fr_iu hasn't yet been updated, so still from start of CICE timestep]
 
-     utau(:,:)=(1.0-fr_iu(:,:))*utau(:,:)-ss_iou(:,:)
-     vtau(:,:)=(1.0-fr_iv(:,:))*vtau(:,:)-ss_iov(:,:)     
+      utau(:,:)=(1.0-fr_iu(:,:))*utau(:,:)-ss_iou(:,:)
+      vtau(:,:)=(1.0-fr_iv(:,:))*vtau(:,:)-ss_iov(:,:)     
 
 ! Freshwater fluxes 
 
-     IF (nsbc == 2) THEN
+      IF (nsbc == 2) THEN
 ! Note that emp from the forcing files is evap*(1-aice)-(tprecip-aice*sprecip)
 ! What we want here is evap*(1-aice)-tprecip*(1-aice) hence manipulation below
 ! Not ideal since aice won't be the same as in the atmosphere.  
 ! Better to use evap and tprecip? (but for now don't read in evap in this case)
-        emp(:,:)  = emp(:,:)+fr_i(:,:)*(tprecip(:,:)-sprecip(:,:))
-     ELSE IF (nsbc == 4) THEN
-        emp(:,:)  = (1.0-fr_i(:,:))*emp(:,:)        
-     ELSE IF (nsbc ==5) THEN
+         emp(:,:)  = emp(:,:)+fr_i(:,:)*(tprecip(:,:)-sprecip(:,:))
+      ELSE IF (nsbc == 4) THEN
+         emp(:,:)  = (1.0-fr_i(:,:))*emp(:,:)        
+      ELSE IF (nsbc ==5) THEN
 ! emp_tot is set in sbc_cpl_ice_flx (call from cice_sbc_in above) 
-        emp(:,:) = emp_tot(:,:)+tprecip(:,:)*fr_i(:,:) 
-     ENDIF
+         emp(:,:) = emp_tot(:,:)+tprecip(:,:)*fr_i(:,:) 
+      ENDIF
 
 ! Subtract fluxes from CICE to get freshwater equivalent flux used in 
 ! salinity calculation
-     CALL cice2nemo(fresh_gbm,ztmp,'T', 1. )
-     emps(:,:)=emp(:,:)-ztmp(:,:)
+      CALL cice2nemo(fresh_gbm,ztmp,'T', 1. )
+      emps(:,:)=emp(:,:)-ztmp(:,:)
 ! Note the 1000.0 is to convert from kg salt to g salt (needed for PSU)
-     CALL cice2nemo(fsalt_gbm,ztmp,'T', 1. )
-     DO jj=1,jpj
-        DO ji=1,jpi
-           IF (sss_m(ji,jj).gt.0.0) THEN
-           emps(ji,jj)=emps(ji,jj)+ztmp(ji,jj)*1000.0/sss_m(ji,jj)
-           ENDIF
-        ENDDO
-     ENDDO
+      CALL cice2nemo(fsalt_gbm,ztmp,'T', 1. )
+      DO jj=1,jpj
+         DO ji=1,jpi
+            IF (sss_m(ji,jj).gt.0.0) THEN
+               emps(ji,jj)=emps(ji,jj)+ztmp(ji,jj)*1000.0/sss_m(ji,jj)
+            ENDIF
+         ENDDO
+      ENDDO
 
 ! No longer remove precip over ice from free surface calculation on basis that the
@@ -487,15 +502,15 @@
 ! ocean rather than floating on top
 
-     emp(:,:)  = emp(:,:) - tprecip(:,:)*fr_i(:,:)
+      emp(:,:)  = emp(:,:) - tprecip(:,:)*fr_i(:,:)
 
 ! Take sublimation into account
-     IF (nsbc == 5 ) THEN 
-        emp(:,:) = emp(:,:) + ( emp_ice(:,:) + sprecip(:,:) )
-     ELSE IF (nsbc == 2 ) THEN
-        emp(:,:) = emp(:,:) - qla_ice(:,:,1) / Lsub
-     ENDIF
-
-     CALL lbc_lnk( emp , 'T', 1. )
-     CALL lbc_lnk( emps , 'T', 1. )
+      IF (nsbc == 5 ) THEN 
+         emp(:,:) = emp(:,:) + ( emp_ice(:,:) + sprecip(:,:) )
+      ELSE IF (nsbc == 2 ) THEN
+         emp(:,:) = emp(:,:) - qla_ice(:,:,1) / Lsub
+      ENDIF
+
+      CALL lbc_lnk( emp , 'T', 1. )
+      CALL lbc_lnk( emps , 'T', 1. )
 
 ! Solar penetrative radiation and non solar surface heat flux
@@ -503,58 +518,60 @@
 ! Scale qsr and qns according to ice fraction (bulk formulae only)
 
-     IF (nsbc == 4) THEN
-        qsr(:,:)=qsr(:,:)*(1.0-fr_i(:,:))
-        qns(:,:)=qns(:,:)*(1.0-fr_i(:,:))
-     ENDIF
+      IF (nsbc == 4) THEN
+         qsr(:,:)=qsr(:,:)*(1.0-fr_i(:,:))
+         qns(:,:)=qns(:,:)*(1.0-fr_i(:,:))
+      ENDIF
 ! Take into account snow melting except for fully coupled when already in qns_tot
-     IF (nsbc == 5) THEN
-        qsr(:,:)= qsr_tot(:,:)
-        qns(:,:)= qns_tot(:,:)
-     ELSE
-        qns(:,:)= qns(:,:)-sprecip(:,:)*Lfresh*(1.0-fr_i(:,:))
-     ENDIF
+      IF (nsbc == 5) THEN
+         qsr(:,:)= qsr_tot(:,:)
+         qns(:,:)= qns_tot(:,:)
+      ELSE
+         qns(:,:)= qns(:,:)-sprecip(:,:)*Lfresh*(1.0-fr_i(:,:))
+      ENDIF
 
 ! Now add in ice / snow related terms
 ! [fswthru will be zero unless running with calc_Tsfc=T in CICE]
-     CALL cice2nemo(fswthru_gbm,ztmp,'T', 1. )
-     qsr(:,:)=qsr(:,:)+ztmp(:,:)
-     CALL lbc_lnk( qsr , 'T', 1. )
-
-     DO jj=1,jpj
-        DO ji=1,jpi
+      CALL cice2nemo(fswthru_gbm,ztmp,'T', 1. )
+      qsr(:,:)=qsr(:,:)+ztmp(:,:)
+      CALL lbc_lnk( qsr , 'T', 1. )
+
+      DO jj=1,jpj
+         DO ji=1,jpi
             nfrzmlt(ji,jj)=MAX(nfrzmlt(ji,jj),0.0)
-        ENDDO
-     ENDDO
-
-     CALL cice2nemo(fhocn_gbm,ztmp,'T', 1. )
-     qns(:,:)=qns(:,:)+nfrzmlt(:,:)+ztmp(:,:)
-
-     CALL lbc_lnk( qns , 'T', 1. )
+         ENDDO
+      ENDDO
+
+      CALL cice2nemo(fhocn_gbm,ztmp,'T', 1. )
+      qns(:,:)=qns(:,:)+nfrzmlt(:,:)+ztmp(:,:)
+
+      CALL lbc_lnk( qns , 'T', 1. )
 
 ! Prepare for the following CICE time-step
 
-     CALL cice2nemo(aice,fr_i,'T', 1. )
-     IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
-        DO jpl=1,ncat
-           CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
-        ENDDO
-     ENDIF
+      CALL cice2nemo(aice,fr_i,'T', 1. )
+      IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
+         DO jpl=1,ncat
+            CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
+         ENDDO
+      ENDIF
 
 ! T point to U point
 ! T point to V point
-     DO jj=1,jpjm1
-        DO ji=1,jpim1
-           fr_iu(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji+1,jj))*umask(ji,jj,1)
-           fr_iv(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji,jj+1))*vmask(ji,jj,1)
-        ENDDO
-     ENDDO
-
-     CALL lbc_lnk ( fr_iu , 'U', 1. )
-     CALL lbc_lnk ( fr_iv , 'V', 1. )
+      DO jj=1,jpjm1
+         DO ji=1,jpim1
+            fr_iu(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji+1,jj))*umask(ji,jj,1)
+            fr_iv(ji,jj)=0.5*(fr_i(ji,jj)+fr_i(ji,jj+1))*vmask(ji,jj,1)
+         ENDDO
+      ENDDO
+
+      CALL lbc_lnk ( fr_iu , 'U', 1. )
+      CALL lbc_lnk ( fr_iv , 'V', 1. )
 
 ! Release work space
 
       CALL wrk_dealloc( jpi,jpj, ztmp )
-     !
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_out')
+      !
    END SUBROUTINE cice_sbc_out
 
@@ -570,11 +587,13 @@
       !!---------------------------------------------------------------------
 
-     INTEGER  ::   jpl                        ! dummy loop index
-     INTEGER  ::   ierror
-
-     IF( kt == nit000 )  THEN
+      INTEGER  ::   jpl                        ! dummy loop index
+      INTEGER  ::   ierror
+
+      IF( nn_timing == 1 )  CALL timing_start('cice_sbc_hadgam')
+      !
+      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
+      ENDIF
 
       !                                         ! =========================== !
@@ -584,6 +603,6 @@
 ! x and y comp of ice velocity
 
-        CALL cice2nemo(uvel,u_ice,'F', -1. )
-        CALL cice2nemo(vvel,v_ice,'F', -1. )
+      CALL cice2nemo(uvel,u_ice,'F', -1. )
+      CALL cice2nemo(vvel,v_ice,'F', -1. )
 
 ! Ice concentration (CO_1) = a_i calculated at end of cice_sbc_out  
@@ -591,9 +610,11 @@
 ! Snow and ice thicknesses (CO_2 and CO_3)
 
-     DO jpl = 1,ncat
-        CALL cice2nemo(vsnon(:,:,jpl,:),ht_s(:,:,jpl),'T', 1. )
-        CALL cice2nemo(vicen(:,:,jpl,:),ht_i(:,:,jpl),'T', 1. )
-     ENDDO
-
+      DO jpl = 1,ncat
+         CALL cice2nemo(vsnon(:,:,jpl,:),ht_s(:,:,jpl),'T', 1. )
+         CALL cice2nemo(vicen(:,:,jpl,:),ht_i(:,:,jpl),'T', 1. )
+      ENDDO
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_hadgam')
+      !
    END SUBROUTINE cice_sbc_hadgam
 
@@ -613,5 +634,5 @@
       IF(lwp) WRITE(numout,*)'cice_sbc_final'
 
-      call CICE_Finalize
+      CALL CICE_Finalize
 
    END SUBROUTINE cice_sbc_final
@@ -750,87 +771,87 @@
       !!---------------------------------------------------------------------
 
-     CHARACTER(len=1), INTENT( in ) ::   &
-         cd_type       ! nature of pn grid-point
-         !             !   = T or F gridpoints
-     REAL(wp), INTENT( in ) ::   &
-         psgn          ! control of the sign change
-         !             !   =-1 , the sign is modified following the type of b.c. used
-         !             !   = 1 , no sign change
-     REAL(wp), DIMENSION(jpi,jpj) :: pn
+      CHARACTER(len=1), INTENT( in ) ::   &
+          cd_type       ! nature of pn grid-point
+          !             !   = T or F gridpoints
+      REAL(wp), INTENT( in ) ::   &
+          psgn          ! control of the sign change
+          !             !   =-1 , the sign is modified following the type of b.c. used
+          !             !   = 1 , no sign change
+      REAL(wp), DIMENSION(jpi,jpj) :: pn
 #if !defined key_nemocice_decomp
-     REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg
+      REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg
 #endif
-     REAL (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: pc
-     INTEGER (int_kind) :: &
-        field_type,        &! id for type of field (scalar, vector, angle)
-        grid_loc            ! id for location on horizontal grid
+      REAL (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: pc
+      INTEGER (int_kind) :: &
+         field_type,        &! id for type of field (scalar, vector, angle)
+         grid_loc            ! id for location on horizontal grid
                             !  (center, NEcorner, Nface, Eface)
 
-     INTEGER  ::   ji, jj, jn                      ! dummy loop indices
-
-!    A. Ensure all haloes are filled in NEMO field (pn)
-
-     CALL lbc_lnk( pn , cd_type, psgn )
+      INTEGER  ::   ji, jj, jn                      ! dummy loop indices
+
+!     A. Ensure all haloes are filled in NEMO field (pn)
+
+      CALL lbc_lnk( pn , cd_type, psgn )
 
 #if defined key_nemocice_decomp
 
-     ! Copy local domain data from NEMO to CICE field
-     pc(:,:,1)=0.0
-     DO jj=2,ny_block
-        DO ji=2,nx_block
-           pc(ji,jj,1)=pn(ji,jj-1)
-        ENDDO
-     ENDDO
+      ! Copy local domain data from NEMO to CICE field
+      pc(:,:,1)=0.0
+      DO jj=2,ny_block
+         DO ji=2,nx_block
+            pc(ji,jj,1)=pn(ji,jj-1)
+         ENDDO
+      ENDDO
 
 #else
 
-!    B. Gather pn into global array (png)
-
-     IF ( jpnij > 1) THEN
-        CALL mppsync
-        CALL mppgather (pn,0,png) 
-        CALL mppsync
-     ELSE
-        png(:,:,1)=pn(:,:)
-     ENDIF
-
-!    C. Map png into CICE global array (pcg)
+!     B. Gather pn into global array (png)
+
+      IF ( jpnij > 1) THEN
+         CALL mppsync
+         CALL mppgather (pn,0,png) 
+         CALL mppsync
+      ELSE
+         png(:,:,1)=pn(:,:)
+      ENDIF
+
+!     C. Map png into CICE global array (pcg)
 
 ! Need to make sure this is robust to changes in NEMO halo rows....
 ! (may be OK but not 100% sure)
 
-     IF (nproc==0) THEN     
+      IF (nproc==0) THEN     
 !        pcg(:,:)=0.0
-        DO jn=1,jpnij
-           DO jj=1,nlcjt(jn)-1
-              DO ji=2,nlcit(jn)-1
-                 pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)=png(ji,jj,jn)       
-              ENDDO
-           ENDDO
-        ENDDO
-     ENDIF
+         DO jn=1,jpnij
+            DO jj=1,nlcjt(jn)-1
+               DO ji=2,nlcit(jn)-1
+                  pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)=png(ji,jj,jn)       
+               ENDDO
+            ENDDO
+         ENDDO
+      ENDIF
 
 #endif
 
-     SELECT CASE ( cd_type )
-        CASE ( 'T' )
-           grid_loc=field_loc_center
-        CASE ( 'F' )                              
-           grid_loc=field_loc_NEcorner
-     END SELECT
-
-     SELECT CASE ( NINT(psgn) )
-        CASE ( -1 )
-           field_type=field_type_vector
-        CASE ( 1 )                              
-           field_type=field_type_scalar
-     END SELECT
+      SELECT CASE ( cd_type )
+         CASE ( 'T' )
+            grid_loc=field_loc_center
+         CASE ( 'F' )                              
+            grid_loc=field_loc_NEcorner
+      END SELECT
+
+      SELECT CASE ( NINT(psgn) )
+         CASE ( -1 )
+            field_type=field_type_vector
+         CASE ( 1 )                              
+            field_type=field_type_scalar
+      END SELECT
 
 #if defined key_nemocice_decomp
-     ! Ensure CICE halos are up to date
-     call ice_HaloUpdate (pc, halo_info, grid_loc, field_type)
+      ! Ensure CICE halos are up to date
+      CALL ice_HaloUpdate (pc, halo_info, grid_loc, field_type)
 #else
-!    D. Scatter pcg to CICE blocks (pc) + update halos
-     call scatter_global(pc, pcg, 0, distrb_info, grid_loc, field_type)
+!     D. Scatter pcg to CICE blocks (pc) + update halos
+      CALL scatter_global(pc, pcg, 0, distrb_info, grid_loc, field_type)
 #endif
 
@@ -856,58 +877,58 @@
       !!---------------------------------------------------------------------
 
-     CHARACTER(len=1), INTENT( in ) ::   &
-         cd_type       ! nature of pn grid-point
-         !             !   = T or F gridpoints
-     REAL(wp), INTENT( in ) ::   &
-         psgn          ! control of the sign change
-         !             !   =-1 , the sign is modified following the type of b.c. used
-         !             !   = 1 , no sign change
-     REAL(wp), DIMENSION(jpi,jpj) :: pn
+      CHARACTER(len=1), INTENT( in ) ::   &
+          cd_type       ! nature of pn grid-point
+          !             !   = T or F gridpoints
+      REAL(wp), INTENT( in ) ::   &
+          psgn          ! control of the sign change
+          !             !   =-1 , the sign is modified following the type of b.c. used
+          !             !   = 1 , no sign change
+      REAL(wp), DIMENSION(jpi,jpj) :: pn
 
 #if defined key_nemocice_decomp
-     INTEGER (int_kind) :: &
-        field_type,        & ! id for type of field (scalar, vector, angle)
-        grid_loc             ! id for location on horizontal grid
-                             ! (center, NEcorner, Nface, Eface)
+      INTEGER (int_kind) :: &
+         field_type,        & ! id for type of field (scalar, vector, angle)
+         grid_loc             ! id for location on horizontal grid
+                              ! (center, NEcorner, Nface, Eface)
 #else
-     REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg
+      REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg
 #endif
 
-     REAL (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: pc
-
-     INTEGER  ::   ji, jj, jn                      ! dummy loop indices
+      REAL (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: pc
+
+      INTEGER  ::   ji, jj, jn                      ! dummy loop indices
 
 
 #if defined key_nemocice_decomp
 
-     SELECT CASE ( cd_type )
-        CASE ( 'T' )
-           grid_loc=field_loc_center
-        CASE ( 'F' )                              
-           grid_loc=field_loc_NEcorner
-     END SELECT
-
-     SELECT CASE ( NINT(psgn) )
-        CASE ( -1 )
-           field_type=field_type_vector
-        CASE ( 1 )                              
-           field_type=field_type_scalar
-     END SELECT
-
-     call ice_HaloUpdate (pc, halo_info, grid_loc, field_type)
-
-
-     pn(:,:)=0.0
-     DO jj=1,jpjm1
-        DO ji=1,jpim1
-           pn(ji,jj)=pc(ji,jj+1,1)
-        ENDDO
-     ENDDO
+      SELECT CASE ( cd_type )
+         CASE ( 'T' )
+            grid_loc=field_loc_center
+         CASE ( 'F' )                              
+            grid_loc=field_loc_NEcorner
+      END SELECT
+
+      SELECT CASE ( NINT(psgn) )
+         CASE ( -1 )
+            field_type=field_type_vector
+         CASE ( 1 )                              
+            field_type=field_type_scalar
+      END SELECT
+
+      CALL ice_HaloUpdate (pc, halo_info, grid_loc, field_type)
+
+
+      pn(:,:)=0.0
+      DO jj=1,jpjm1
+         DO ji=1,jpim1
+            pn(ji,jj)=pc(ji,jj+1,1)
+         ENDDO
+      ENDDO
 
 #else
 
-!     A. Gather CICE blocks (pc) into global array (pcg) 
-
-     call gather_global(pcg, pc, 0, distrb_info)
+!      A. Gather CICE blocks (pc) into global array (pcg) 
+
+      CALL gather_global(pcg, pc, 0, distrb_info)
 
 !     B. Map pcg into NEMO global array (png)
@@ -916,30 +937,30 @@
 ! (may be OK but not spent much time thinking about it)
 
-     IF (nproc==0) THEN
-        png(:,:,:)=0.0
-        DO jn=1,jpnij
-           DO jj=1,nlcjt(jn)-1
-              DO ji=2,nlcit(jn)-1
-                 png(ji,jj,jn)=pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)      
-              ENDDO
-           ENDDO
-        ENDDO
-     ENDIF
-
-!    C. Scatter png into NEMO field (pn) for each processor
-
-     IF ( jpnij > 1) THEN
-        CALL mppsync
-        CALL mppscatter (png,0,pn) 
-        CALL mppsync
-     ELSE
-        pn(:,:)=png(:,:,1)
-     ENDIF
+      IF (nproc==0) THEN
+         png(:,:,:)=0.0
+         DO jn=1,jpnij
+            DO jj=1,nlcjt(jn)-1
+               DO ji=2,nlcit(jn)-1
+                  png(ji,jj,jn)=pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)      
+               ENDDO
+            ENDDO
+         ENDDO
+      ENDIF
+
+!     C. Scatter png into NEMO field (pn) for each processor
+
+      IF ( jpnij > 1) THEN
+         CALL mppsync
+         CALL mppscatter (png,0,pn) 
+         CALL mppsync
+      ELSE
+         pn(:,:)=png(:,:,1)
+      ENDIF
 
 #endif
 
-!    D. Ensure all haloes are filled in pn
-
-     CALL lbc_lnk( pn , cd_type, psgn )
+!     D. Ensure all haloes are filled in pn
+
+      CALL lbc_lnk( pn , cd_type, psgn )
 
    END SUBROUTINE cice2nemo
