Index: branches/UKMO/r6232_HZG_WAVE-coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/UKMO/r6232_HZG_WAVE-coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 7878)
+++ branches/UKMO/r6232_HZG_WAVE-coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 7905)
@@ -168,5 +168,5 @@
    TYPE(FLD_C) ::   sn_snd_ifrac, sn_snd_crtw, sn_snd_wlev  
    ! Received from waves  
-   TYPE(FLD_C) ::   sn_rcv_hsig,sn_rcv_phioc,sn_rcv_sdrfx,sn_rcv_sdrfy,sn_rcv_wper, &
+   TYPE(FLD_C) ::   sn_rcv_hsig,sn_rcv_phioc,sn_rcv_sdrft,sn_rcv_wper, &
                     sn_rcv_wfreq,sn_rcv_wnum,sn_rcv_tauoc,sn_rcv_wdrag
    ! Other namelist parameters                        !
@@ -244,8 +244,7 @@
          &                  sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau   , sn_rcv_dqnsdt, sn_rcv_qsr,      &  
          &                  sn_snd_ifrac, sn_snd_crtw , sn_snd_wlev  , sn_rcv_hsig  , sn_rcv_phioc ,   &  
-         &                  sn_rcv_sdrfx, sn_rcv_sdrfy, sn_rcv_wper  , sn_rcv_wnum  , sn_rcv_wfreq,    &
-         &                  sn_rcv_tauoc, sn_rcv_wdrag, sn_rcv_qns   , sn_rcv_emp   , sn_rcv_rnf,      &
-         &                  sn_rcv_cal , sn_rcv_iceflx, sn_rcv_co2   , sn_rcv_mslp  , nn_cplmodel,     &
-         &                  ln_usecplmask
+         &                  sn_rcv_sdrft, sn_rcv_wper  , sn_rcv_wnum  , sn_rcv_wfreq, sn_rcv_tauoc,    &
+         &                  sn_rcv_wdrag, sn_rcv_qns   , sn_rcv_emp   , sn_rcv_rnf  , sn_rcv_cal ,     &
+         &                  sn_rcv_iceflx, sn_rcv_co2   , sn_rcv_mslp  , nn_cplmodel, ln_usecplmask
       !!---------------------------------------------------------------------
       !
@@ -290,6 +289,5 @@
          WRITE(numout,*)'      significant wave heigth         = ', TRIM(sn_rcv_hsig%cldes  ), ' (', TRIM(sn_rcv_hsig%clcat  ), ')'  
          WRITE(numout,*)'      wave to oce energy flux         = ', TRIM(sn_rcv_phioc%cldes ), ' (', TRIM(sn_rcv_phioc%clcat ), ')'  
-         WRITE(numout,*)'      Surface Stokes drift grid u     = ', TRIM(sn_rcv_sdrfx%cldes ), ' (', TRIM(sn_rcv_sdrfx%clcat ), ')'  
-         WRITE(numout,*)'      Surface Stokes drift grid v     = ', TRIM(sn_rcv_sdrfy%cldes ), ' (', TRIM(sn_rcv_sdrfy%clcat ), ')'  
+         WRITE(numout,*)'      Surface Stokes drift u,v        = ', TRIM(sn_rcv_sdrft%cldes ), ' (', TRIM(sn_rcv_sdrft%clcat ), ')'  
          WRITE(numout,*)'      Mean wave period                = ', TRIM(sn_rcv_wper%cldes  ), ' (', TRIM(sn_rcv_wper%clcat  ), ')'  
          WRITE(numout,*)'      Mean wave number                = ', TRIM(sn_rcv_wnum%cldes  ), ' (', TRIM(sn_rcv_wnum%clcat  ), ')'  
@@ -549,12 +547,9 @@
       ENDIF 
       srcv(jpr_sdrftx)%clname = 'O_Sdrfx'    ! Stokes drift in the u direction 
-      IF( TRIM(sn_rcv_sdrfx%cldes ) == 'coupled' )  THEN 
+      srcv(jpr_sdrfty)%clname = 'O_Sdrfy'    ! Stokes drift in the v direction 
+      IF( TRIM(sn_rcv_sdrft%cldes ) == 'coupled' )  THEN 
          srcv(jpr_sdrftx)%laction = .TRUE. 
-         cpl_sdrftx = .TRUE. 
-      ENDIF 
-      srcv(jpr_sdrfty)%clname = 'O_Sdrfy'    ! Stokes drift in the v direction 
-      IF( TRIM(sn_rcv_sdrfy%cldes ) == 'coupled' )  THEN 
          srcv(jpr_sdrfty)%laction = .TRUE. 
-         cpl_sdrfty = .TRUE. 
+         cpl_sdrft = .TRUE. 
       ENDIF 
       srcv(jpr_wper)%clname = 'O_WPer'       ! mean wave period 
@@ -964,5 +959,4 @@
       !!                        emp          upward mass flux [evap. - precip. (- runoffs) (- calving)] (ocean only case)
       !!----------------------------------------------------------------------
-      USE zdf_oce,  ONLY : ln_zdfqiao
       USE sbcflx ,  ONLY : ln_shelf_flx
 
@@ -1171,12 +1165,10 @@
       IF( ln_sdw ) THEN  ! Stokes Drift correction activated 
       !                                                      ! ========================= !  
-      !                                                      !       Stokes drift u      ! 
+      !                                                      !     Stokes drift u,v      ! 
       !                                                      ! ========================= !  
-         IF( srcv(jpr_sdrftx)%laction ) ut0sd(:,:) = frcv(jpr_sdrftx)%z3(:,:,1) 
-      ! 
-      !                                                      ! ========================= !  
-      !                                                      !       Stokes drift v      ! 
-      !                                                      ! ========================= !  
-         IF( srcv(jpr_sdrfty)%laction ) vt0sd(:,:) = frcv(jpr_sdrfty)%z3(:,:,1) 
+         IF( srcv(jpr_sdrftx)%laction .AND. srcv(jpr_sdrfty)%laction ) THEN
+                                        ut0sd(:,:) = frcv(jpr_sdrftx)%z3(:,:,1) 
+                                        vt0sd(:,:) = frcv(jpr_sdrfty)%z3(:,:,1) 
+         ENDIF
       ! 
       !                                                      ! ========================= !  
@@ -1201,6 +1193,6 @@
       
          ! Calculate the 3D Stokes drift both in coupled and not fully uncoupled mode 
-         IF( srcv(jpr_sdrftx)%laction .OR. srcv(jpr_sdrfty)%laction .OR. srcv(jpr_wper)%laction & 
-                                      .OR. srcv(jpr_hsig)%laction   .OR. srcv(jpr_wfreq)%laction) & 
+         IF( (srcv(jpr_sdrftx)%laction .AND. srcv(jpr_sdrfty)%laction) .OR. srcv(jpr_wper)%laction & 
+                                        .OR. srcv(jpr_hsig)%laction   .OR. srcv(jpr_wfreq)%laction) & 
             CALL sbc_stokes() 
       ENDIF 
@@ -1215,4 +1207,6 @@
       IF( srcv(jpr_phioc)%laction .AND. ln_phioc ) THEN
          rn_crban(:,:) = 29.0 * frcv(jpr_phioc)%z3(:,:,1)
+         WHERE( rn_crban <    0.0 ) rn_crban = 0.0
+         WHERE( rn_crban > 1000.0 ) rn_crban = 1000.0
       ENDIF
       
