Index: NEMO/branches/UKMO/NEMO_4.0.4_ocean_mean_fluxes/src/OCE/SBC/sbccpl.F90
===================================================================
--- NEMO/branches/UKMO/NEMO_4.0.4_ocean_mean_fluxes/src/OCE/SBC/sbccpl.F90	(revision 14422)
+++ NEMO/branches/UKMO/NEMO_4.0.4_ocean_mean_fluxes/src/OCE/SBC/sbccpl.F90	(revision 14423)
@@ -120,6 +120,10 @@
    INTEGER, PARAMETER ::   jpr_tauwy  = 56   ! y component of the ocean stress from waves
    INTEGER, PARAMETER ::   jpr_ts_ice = 57   ! Sea ice surface temp
-
-   INTEGER, PARAMETER ::   jprcv      = 57   ! total number of fields received  
+   INTEGER, PARAMETER ::   jpr_grnm   = 58   ! Greenland ice mass 
+   INTEGER, PARAMETER ::   jpr_antm   = 59   ! Antarctic ice mass 
+   INTEGER, PARAMETER ::   jpr_rnf_1d = 60   ! 1D river runoff 
+   INTEGER, PARAMETER ::   jpr_qtr    = 61   ! Transmitted solar
+
+   INTEGER, PARAMETER ::   jprcv      = 61   ! total number of fields received
 
    INTEGER, PARAMETER ::   jps_fice   =  1   ! ice fraction sent to the atmosphere
@@ -192,4 +196,6 @@
    TYPE(FLD_C) ::   sn_rcv_hsig, sn_rcv_phioc, sn_rcv_sdrfx, sn_rcv_sdrfy, sn_rcv_wper, sn_rcv_wnum, sn_rcv_tauwoc, &
                     sn_rcv_wdrag, sn_rcv_wfreq
+   ! Transmitted solar
+   TYPE(FLD_C) ::   sn_rcv_qtr
    !                                   ! Other namelist parameters
    INTEGER     ::   nn_cplmodel           ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
@@ -274,4 +280,5 @@
          &                  sn_rcv_w10m  , sn_rcv_taumod, sn_rcv_tau  , sn_rcv_dqnsdt, sn_rcv_qsr   ,  & 
          &                  sn_rcv_sdrfx , sn_rcv_sdrfy , sn_rcv_wper , sn_rcv_wnum  , sn_rcv_tauwoc,  &
+         &                  sn_rcv_qtr   ,                                                             &
          &                  sn_rcv_wdrag , sn_rcv_qns   , sn_rcv_emp  , sn_rcv_rnf   , sn_rcv_cal   ,  &
          &                  sn_rcv_iceflx, sn_rcv_co2   , sn_rcv_mslp ,                                &
@@ -319,4 +326,5 @@
          WRITE(numout,*)'      ice shelf                       = ', TRIM(sn_rcv_isf%cldes   ), ' (', TRIM(sn_rcv_isf%clcat   ), ')'
          WRITE(numout,*)'      sea ice heat fluxes             = ', TRIM(sn_rcv_iceflx%cldes), ' (', TRIM(sn_rcv_iceflx%clcat), ')'
+         WRITE(numout,*)'      transmitted solar               = ', TRIM(sn_rcv_qtr%cldes   ), ' (', TRIM(sn_rcv_qtr%clcat   ), ')'
          WRITE(numout,*)'      atm co2                         = ', TRIM(sn_rcv_co2%cldes   ), ' (', TRIM(sn_rcv_co2%clcat   ), ')'
          WRITE(numout,*)'      significant wave heigth         = ', TRIM(sn_rcv_hsig%cldes  ), ' (', TRIM(sn_rcv_hsig%clcat  ), ')' 
@@ -588,4 +596,17 @@
          srcv(jpr_topm:jpr_botm)%laction = .TRUE.
       ENDIF
+      !                                                      ! ------------------------- !
+      !                                                      !    transmitted solar      !   
+      !                                                      ! ------------------------- !
+      srcv(jpr_qtr )%clname = 'OQtr'
+      IF( TRIM(sn_rcv_qtr%cldes) == 'coupled' ) THEN
+         IF ( TRIM( sn_rcv_qtr%clcat ) == 'yes' ) THEN
+            srcv(jpr_qtr)%nct = nn_cats_cpl
+         ELSE
+            CALL ctl_stop( 'sbc_cpl_init: sn_rcv_qtr%clcat should always be set to yes currently' )
+         ENDIF
+         srcv(jpr_qtr)%laction = .TRUE.
+      ENDIF
+
       !                                                      ! ------------------------- !
       !                                                      !    ice skin temperature   !   
@@ -1673,4 +1694,25 @@
       ziceld(:,:) = 1._wp - picefr(:,:)
       zcptn (:,:) = rcp * sst_m(:,:)
+
+#if defined key_si3      
+      !                                                      ! ========================= !
+      SELECT CASE( TRIM( sn_rcv_iceflx%cldes ) )             !  ice topmelt and botmelt  !
+      !                                                      ! ========================= !
+      CASE ('coupled')
+         IF (ln_scale_ice_flux) THEN
+            WHERE( a_i(:,:,:) > 1.e-10_wp )
+               qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
+               qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
+            ELSEWHERE
+               qml_ice(:,:,:) = 0.0_wp
+               qcn_ice(:,:,:) = 0.0_wp
+            END WHERE
+         ELSE
+            qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:)
+            qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:)
+         ENDIF
+      END SELECT
+#endif
+
       !
       !                                                      ! ========================= !
@@ -1840,8 +1882,16 @@
       !                                                      ! ========================= !
       CASE( 'oce only' )         ! the required field is directly provided
-         zqns_tot(:,:) = frcv(jpr_qnsoce)%z3(:,:,1)
-         ! For Met Office sea ice non-solar fluxes are already delt with by JULES so setting to zero
-         ! here so the only flux is the ocean only one.
-         zqns_ice(:,:,:) = 0._wp 
+
+         ! Get the sea ice non solar heat flux from conductive, melting and sublimation fluxes
+         IF( TRIM(sn_rcv_iceflx%cldes) == 'coupled' ) THEN
+            zqns_ice(:,:,:) = qml_ice(:,:,:) + qcn_ice(:,:,:) + evap_ice(:,:,:) * rLsub
+         ELSE
+            zqns_ice(:,:,:) = 0._wp
+         ENDIF
+
+         ! Calculate the total non solar heat flux. The ocean only non solar heat flux (zqns_oce) will be recalculated after this CASE
+         ! statement to be consistent with other coupling methods even though .zqns_oce = frcv(jpr_qnsoce)%z3(:,:,1)
+         zqns_tot(:,:) = frcv(jpr_qnsoce)%z3(:,:,1) * ziceld(:,:) + SUM( zqns_ice(:,:,:) * a_i(:,:,:), dim=3 )
+         
       CASE( 'conservative' )     ! the required fields are directly provided
          zqns_tot(:,:) = frcv(jpr_qnsmix)%z3(:,:,1)
@@ -1982,7 +2032,8 @@
       !                                                      ! ========================= !
       CASE( 'oce only' )
-         zqsr_tot(:,:  ) = MAX( 0._wp , frcv(jpr_qsroce)%z3(:,:,1) )
-         ! For Met Office sea ice solar fluxes are already delt with by JULES so setting to zero
-         ! here so the only flux is the ocean only one.
+         zqsr_tot(:,:  ) = MAX( 0._wp , frcv(jpr_qsroce)%z3(:,:,1) ) * ziceld(:,:)
+
+         ! For the Met Office the only sea ice solar flux is the transmitted qsr which is added onto zqsr_ice
+         ! further down. Therefore start zqsr_ice off at zero.
          zqsr_ice(:,:,:) = 0._wp
       CASE( 'conservative' )
@@ -2038,67 +2089,5 @@
       ENDIF
 
-#if defined key_si3
-      ! --- solar flux over ocean --- !
-      !         note: ziceld cannot be = 0 since we limit the ice concentration to amax
-      zqsr_oce = 0._wp
-      WHERE( ziceld /= 0._wp )  zqsr_oce(:,:) = ( zqsr_tot(:,:) - SUM( a_i * zqsr_ice, dim=3 ) ) / ziceld(:,:)
-
-      IF( ln_mixcpl ) THEN   ;   qsr_oce(:,:) = qsr_oce(:,:) * xcplmask(:,:,0) +  zqsr_oce(:,:)* zmsk(:,:)
-      ELSE                   ;   qsr_oce(:,:) = zqsr_oce(:,:)   ;   ENDIF
-#endif
-
-      IF( ln_mixcpl ) THEN
-         qsr_tot(:,:) = qsr(:,:) * ziceld(:,:) + SUM( qsr_ice(:,:,:) * a_i(:,:,:), dim=3 )   ! total flux from blk
-         qsr_tot(:,:) = qsr_tot(:,:) * xcplmask(:,:,0) +  zqsr_tot(:,:)* zmsk(:,:)
-         DO jl = 1, jpl
-            qsr_ice(:,:,jl) = qsr_ice(:,:,jl) * xcplmask(:,:,0) +  zqsr_ice(:,:,jl)* zmsk(:,:)
-         END DO
-      ELSE
-         qsr_tot(:,:  ) = zqsr_tot(:,:  )
-         qsr_ice(:,:,:) = zqsr_ice(:,:,:)
-      ENDIF
-
-      !                                                      ! ========================= !
-      SELECT CASE( TRIM( sn_rcv_dqnsdt%cldes ) )             !          d(qns)/dt        !
-      !                                                      ! ========================= !
-      CASE ('coupled')
-         IF ( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN
-            zdqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl)
-         ELSE
-            ! Set all category values equal for the moment
-            DO jl=1,jpl
-               zdqns_ice(:,:,jl) = frcv(jpr_dqnsdt)%z3(:,:,1)
-            ENDDO
-         ENDIF
-      CASE( 'none' ) 
-         zdqns_ice(:,:,:) = 0._wp
-      END SELECT
-      
-      IF( ln_mixcpl ) THEN
-         DO jl=1,jpl
-            dqns_ice(:,:,jl) = dqns_ice(:,:,jl) * xcplmask(:,:,0) + zdqns_ice(:,:,jl) * zmsk(:,:)
-         ENDDO
-      ELSE
-         dqns_ice(:,:,:) = zdqns_ice(:,:,:)
-      ENDIF
-
 #if defined key_si3      
-      !                                                      ! ========================= !
-      SELECT CASE( TRIM( sn_rcv_iceflx%cldes ) )             !  ice topmelt and botmelt  !
-      !                                                      ! ========================= !
-      CASE ('coupled')
-         IF (ln_scale_ice_flux) THEN
-            WHERE( a_i(:,:,:) > 1.e-10_wp )
-               qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
-               qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
-            ELSEWHERE
-               qml_ice(:,:,:) = 0.0_wp
-               qcn_ice(:,:,:) = 0.0_wp
-            END WHERE
-         ELSE
-            qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:)
-            qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:)
-         ENDIF
-      END SELECT
       !                                                      ! ========================= !
       !                                                      !      Transmitted Qsr      !   [W/m2]
@@ -2132,7 +2121,24 @@
       ELSEIF( ln_cndflx .AND. .NOT.ln_cndemulate ) THEN      !==  conduction flux as surface forcing  ==!
          !
-         !          ! ===> here we must receive the qtr_ice_top array from the coupler
-         !                 for now just assume zero (fully opaque ice)
-         zqtr_ice_top(:,:,:) = 0._wp
+         SELECT CASE( TRIM( sn_rcv_qtr%cldes ) )
+         !
+         !      ! ===> here we receive the qtr_ice_top array from the coupler
+         CASE ('coupled')
+            IF (ln_scale_ice_flux) THEN
+               WHERE( a_i(:,:,:) > 0.0_wp ) zqtr_ice_top(:,:,:) = frcv(jpr_qtr)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
+               WHERE( a_i(:,:,:) <= 0.0_wp ) zqtr_ice_top(:,:,:) = 0.0_wp
+            ELSE
+               zqtr_ice_top(:,:,:) = frcv(jpr_qtr)%z3(:,:,:)
+            ENDIF
+
+            ! Add retrieved transmitted solar radiation onto the ice and total solar radiation
+            zqsr_ice(:,:,:) = zqsr_ice(:,:,:) + zqtr_ice_top(:,:,:)
+            zqsr_tot(:,:) = zqsr_tot(:,:) + SUM( zqtr_ice_top(:,:,:) * a_i(:,:,:), dim=3 )
+
+         !      if we are not getting this data from the coupler then assume zero (fully opaque ice)
+         CASE ('none')
+            zqtr_ice_top(:,:,:) = 0._wp
+         END SELECT
+
          !
       ENDIF
@@ -2145,4 +2151,50 @@
          qtr_ice_top(:,:,:) = zqtr_ice_top(:,:,:)
       ENDIF
+
+      ! --- solar flux over ocean --- !
+      !         note: ziceld cannot be = 0 since we limit the ice concentration to amax
+      zqsr_oce = 0._wp
+      WHERE( ziceld /= 0._wp )  zqsr_oce(:,:) = ( zqsr_tot(:,:) - SUM( a_i * zqsr_ice, dim=3 ) ) / ziceld(:,:)
+
+      IF( ln_mixcpl ) THEN   ;   qsr_oce(:,:) = qsr_oce(:,:) * xcplmask(:,:,0) +  zqsr_oce(:,:)* zmsk(:,:)
+      ELSE                   ;   qsr_oce(:,:) = zqsr_oce(:,:)   ;   ENDIF
+#endif
+
+      IF( ln_mixcpl ) THEN
+         qsr_tot(:,:) = qsr(:,:) * ziceld(:,:) + SUM( qsr_ice(:,:,:) * a_i(:,:,:), dim=3 )   ! total flux from blk
+         qsr_tot(:,:) = qsr_tot(:,:) * xcplmask(:,:,0) +  zqsr_tot(:,:)* zmsk(:,:)
+         DO jl = 1, jpl
+            qsr_ice(:,:,jl) = qsr_ice(:,:,jl) * xcplmask(:,:,0) +  zqsr_ice(:,:,jl)* zmsk(:,:)
+         END DO
+      ELSE
+         qsr_tot(:,:  ) = zqsr_tot(:,:  )
+         qsr_ice(:,:,:) = zqsr_ice(:,:,:)
+      ENDIF
+
+      !                                                      ! ========================= !
+      SELECT CASE( TRIM( sn_rcv_dqnsdt%cldes ) )             !          d(qns)/dt        !
+      !                                                      ! ========================= !
+      CASE ('coupled')
+         IF ( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN
+            zdqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl)
+         ELSE
+            ! Set all category values equal for the moment
+            DO jl=1,jpl
+               zdqns_ice(:,:,jl) = frcv(jpr_dqnsdt)%z3(:,:,1)
+            ENDDO
+         ENDIF
+      CASE( 'none' ) 
+         zdqns_ice(:,:,:) = 0._wp
+      END SELECT
+      
+      IF( ln_mixcpl ) THEN
+         DO jl=1,jpl
+            dqns_ice(:,:,jl) = dqns_ice(:,:,jl) * xcplmask(:,:,0) + zdqns_ice(:,:,jl) * zmsk(:,:)
+         ENDDO
+      ELSE
+         dqns_ice(:,:,:) = zdqns_ice(:,:,:)
+      ENDIF
+
+#if defined key_si3
       !                                                      ! ================== !
       !                                                      !   ice skin temp.   !
