Index: branches/UKMO/dev_r5518_ww3_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/UKMO/dev_r5518_ww3_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 5849)
+++ branches/UKMO/dev_r5518_ww3_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 5851)
@@ -105,11 +105,8 @@
    INTEGER, PARAMETER ::   jpr_e3t1st = 41            ! first T level thickness 
    INTEGER, PARAMETER ::   jpr_fraqsr = 42            ! fraction of solar net radiation absorbed in the first ocean level
-#if defined key_ww3
-   INTEGER, PARAMETER ::   jpr_hsig   = 43            ! Hsig
-   INTEGER, PARAMETER ::   jpr_phioc  = 44            ! Wave=>ocean energy flux
-   INTEGER, PARAMETER ::   jprcv      = 44            ! total number of fields received 
-#else
-   INTEGER, PARAMETER ::   jprcv      = 42            ! total number of fields received 
-#endif
+   INTEGER, PARAMETER ::   jpr_mslp   = 43            ! mean sea level pressure
+   INTEGER, PARAMETER ::   jpr_hsig   = 44            ! Hsig
+   INTEGER, PARAMETER ::   jpr_phioc  = 45            ! Wave=>ocean energy flux
+   INTEGER, PARAMETER ::   jprcv      = 45            ! total number of fields received 
 
    INTEGER, PARAMETER ::   jps_fice   =  1            ! ice fraction sent to the atmosphere
@@ -141,12 +138,8 @@
    INTEGER, PARAMETER ::   jps_e3t1st = 27            ! first level depth (vvl)
    INTEGER, PARAMETER ::   jps_fraqsr = 28            ! fraction of solar net radiation absorbed in the first ocean level
-#if defined key_ww3
    INTEGER, PARAMETER ::   jps_ficet  = 29            ! total ice fraction 
    INTEGER, PARAMETER ::   jps_ocxw   = 30            ! currents on grid 1 
    INTEGER, PARAMETER ::   jps_ocyw   = 31            ! currents on grid 1 
    INTEGER, PARAMETER ::   jpsnd      = 31            ! total number of fields sended
-#else
-   INTEGER, PARAMETER ::   jpsnd      = 28            ! total number of fields sended
-#endif
 
    !                                                         !!** namelist namsbc_cpl **
@@ -162,5 +155,5 @@
    ! Received from the atmosphere                     !
    TYPE(FLD_C) ::   sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau, sn_rcv_dqnsdt, sn_rcv_qsr, sn_rcv_qns, sn_rcv_emp, sn_rcv_rnf
-   TYPE(FLD_C) ::   sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2                        
+   TYPE(FLD_C) ::   sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2, sn_rcv_mslp                          
    ! Send to waves
    TYPE(FLD_C) ::   sn_snd_ifrac, sn_snd_crtw
@@ -179,4 +172,7 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   albedo_oce_mix     ! ocean albedo sent to atmosphere (mix clear/overcast sky)
 
+   REAL(wp) ::   rpref = 101000._wp   ! reference atmospheric pressure[N/m2]
+   REAL(wp) ::   r1_grau              ! = 1.e0 / (grav * rau0)
+
    INTEGER , ALLOCATABLE, SAVE, DIMENSION(    :) ::   nrcvinfo           ! OASIS info argument
 
@@ -196,5 +192,5 @@
       !!             ***  FUNCTION sbc_cpl_alloc  ***
       !!----------------------------------------------------------------------
-      INTEGER :: ierr(3)
+      INTEGER :: ierr(4)
       !!----------------------------------------------------------------------
       ierr(:) = 0
@@ -207,4 +203,6 @@
       ALLOCATE( xcplmask(jpi,jpj,0:nn_cplmodel) , STAT=ierr(3) )
       !
+      IF( .NOT. ln_apr_dyn ) ALLOCATE( ssh_ib(jpi,jpj), ssh_ibb(jpi,jpj), apr(jpi, jpj), STAT=ierr(4) )
+
       sbc_cpl_alloc = MAXVAL( ierr )
       IF( lk_mpp            )   CALL mpp_sum ( sbc_cpl_alloc )
@@ -233,10 +231,9 @@
       REAL(wp), POINTER, DIMENSION(:,:) ::   zacs, zaos
       !!
-      NAMELIST/namsbc_cpl/  sn_snd_temp , sn_snd_alb  , sn_snd_thick, sn_snd_crt   , sn_snd_co2,      &
-         &                  sn_snd_ifrac, sn_snd_crtw ,                                               &
-         &                  sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau  , sn_rcv_dqnsdt, sn_rcv_qsr,      &
-         &                  sn_rcv_hsig, sn_rcv_phioc ,                                               &
-         &                  sn_rcv_qns , sn_rcv_emp   , sn_rcv_rnf  , sn_rcv_cal   , sn_rcv_iceflx,   &
-         &                  sn_rcv_co2 , nn_cplmodel  , ln_usecplmask
+      NAMELIST/namsbc_cpl/  sn_snd_temp , sn_snd_alb  , sn_snd_thick , sn_snd_crt   , sn_snd_co2,      &
+         &                  sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau   , sn_rcv_dqnsdt, sn_rcv_qsr,      &
+         &                  sn_snd_ifrac, sn_snd_crtw , sn_rcv_hsig  , sn_rcv_phioc ,                  &
+         &                  sn_rcv_qns , sn_rcv_emp   , sn_rcv_rnf   , sn_rcv_cal   , sn_rcv_iceflx,   &
+         &                  sn_rcv_co2 , nn_cplmodel  , ln_usecplmask, sn_rcv_mslp
       !!---------------------------------------------------------------------
       !
@@ -291,4 +288,5 @@
          WRITE(numout,*)'                      - mesh          = ', sn_snd_crt%clvgrd
          WRITE(numout,*)'      oce co2 flux                    = ', TRIM(sn_snd_co2%cldes   ), ' (', TRIM(sn_snd_co2%clcat   ), ')'
+         WRITE(numout,*)'      mean sea level pressure         = ', TRIM(sn_rcv_mslp%cldes  ), ' (', TRIM(sn_rcv_mslp%clcat  ), ')'
          WRITE(numout,*)'      surface current to waves        = ', TRIM(sn_snd_crtw%cldes   ), ' (', TRIM(sn_snd_crtw%clcat   ), ')'
          WRITE(numout,*)'                      - referential   = ', sn_snd_crtw%clvref
@@ -496,4 +494,10 @@
       !                                                      ! ------------------------- !
       srcv(jpr_co2 )%clname = 'O_AtmCO2'   ;   IF( TRIM(sn_rcv_co2%cldes   ) == 'coupled' )    srcv(jpr_co2 )%laction = .TRUE.
+
+      !                                                      ! ------------------------- !
+      !                                                      ! Mean Sea Level Pressure   !
+      !                                                      ! ------------------------- !
+      srcv(jpr_mslp)%clname = 'O_MSLP'     ;   IF( TRIM(sn_rcv_mslp%cldes  ) == 'coupled' )    srcv(jpr_mslp)%laction = .TRUE.
+
       !                                                      ! ------------------------- !
       !                                                      !   topmelt and botmelt     !   
@@ -1163,4 +1167,19 @@
       !
       CALL wrk_dealloc( jpi,jpj, ztx, zty, zmsk, zemp, zqns, zqsr )
+      !
+      !                                                      ! ========================= !
+      !                                                      ! Mean Sea Level Pressure   !   (taum)
+      !                                                      ! ========================= !
+      !
+      IF( srcv(jpr_mslp)%laction ) THEN                    ! UKMO SHELF effect of atmospheric pressure on SSH
+         IF( kt /= nit000 )   ssh_ibb(:,:) = ssh_ib(:,:)    !* Swap of ssh_ib fields
+
+         r1_grau = 1.e0 / (grav * rau0)               !* constant for optimization
+         ssh_ib(:,:) = - ( frcv(jpr_mslp)%z3(:,:,1) - rpref ) * r1_grau    ! equivalent ssh (inverse barometer)
+         apr   (:,:) =     frcv(jpr_mslp)%z3(:,:,1)                        !atmospheric pressure
+
+         IF( kt == nit000 ) ssh_ibb(:,:) = ssh_ib(:,:)  ! correct this later (read from restart if possible)
+      END IF
+
       !
       IF( nn_timing == 1 )  CALL timing_stop('sbc_cpl_rcv')
