Index: NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/cfgs/SHARED/namelist_ref
===================================================================
--- NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/cfgs/SHARED/namelist_ref	(revision 12802)
+++ NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/cfgs/SHARED/namelist_ref	(revision 12803)
@@ -335,5 +335,4 @@
    sn_rcv_tauwoc =   'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
    sn_rcv_tauw   =   'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
-   sn_rcv_wdrag  =   'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/LBC/lib_mpp.F90
===================================================================
--- NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/LBC/lib_mpp.F90	(revision 12802)
+++ NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/LBC/lib_mpp.F90	(revision 12803)
@@ -666,4 +666,7 @@
 
    SUBROUTINE mppstop( ld_abort ) 
+
+      USE mod_oasis      ! coupling routines
+
       !!----------------------------------------------------------------------
       !!                  ***  routine mppstop  ***
@@ -679,4 +682,14 @@
       IF( PRESENT(ld_abort) ) ll_abort = ld_abort
       !
+
+#if defined key_oasis3
+      ! If we're trying to shut down cleanly then we need to consider the fact
+      ! that this could be part of an MPMD configuration - we don't want to
+      ! leave other components deadlocked.
+
+      CALL oasis_abort(nproc,"mppstop","NEMO initiated abort")
+
+
+#else
 #if defined key_mpp_mpi
       IF(ll_abort) THEN
@@ -689,4 +702,5 @@
       IF( ll_abort ) STOP 123
       !
+#endif
    END SUBROUTINE mppstop
 
Index: NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/cpl_oasis3.F90
===================================================================
--- NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/cpl_oasis3.F90	(revision 12802)
+++ NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/cpl_oasis3.F90	(revision 12803)
@@ -42,4 +42,5 @@
    PUBLIC   cpl_freq
    PUBLIC   cpl_finalize
+   
 
    INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
@@ -86,5 +87,5 @@
 
    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   exfld   ! Temporary buffer for receiving
-
+      
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -448,4 +449,5 @@
                      WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(nldi:nlei,nldj:nlej,jc))
                      WRITE(numout,*) '****************'
+                     CALL FLUSH(numout)
                   ENDIF
                   
@@ -519,5 +521,5 @@
          CALL oasis_get_freqs(id,      1, itmp, info)
 #endif
-         cpl_freq = itmp(1)
+         cpl_freq = itmp(1) 
       ENDIF
       !
Index: NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/geo2ocean.F90
===================================================================
--- NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/geo2ocean.F90	(revision 12802)
+++ NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/geo2ocean.F90	(revision 12803)
@@ -26,4 +26,5 @@
    PRIVATE
 
+   PUBLIC   repcmo    ! called in sbccpl
    PUBLIC   rot_rep   ! called in sbccpl, fldread, and cyclone
    PUBLIC   geo2oce   ! called in sbccpl
@@ -50,4 +51,45 @@
    !!----------------------------------------------------------------------
 CONTAINS
+
+   SUBROUTINE repcmo ( pxu1, pyu1, pxv1, pyv1,   &
+                       px2 , py2 , kchoix  )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE repcmo  ***
+      !!
+      !! ** Purpose :   Change vector componantes from a geographic grid to a
+      !!      stretched coordinates grid.
+      !!
+      !! ** Method  :   Initialization of arrays at the first call.
+      !!
+      !! ** Action  : - px2 : first  componante (defined at u point)
+      !!              - py2 : second componante (defined at v point)
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pxu1, pyu1   ! geographic vector componantes at u-point
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pxv1, pyv1   ! geographic vector componantes at v-point
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   px2          ! i-componante (defined at u-point)
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   py2          ! j-componante (defined at v-point)
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( IN ) ::   &
+         kchoix   ! type of transformation
+                  ! = 1 change from geographic to model grid.
+                  ! =-1 change from model to geographic grid
+      !!----------------------------------------------------------------------
+ 
+      SELECT CASE (kchoix)
+      CASE ( 1)
+        ! Change from geographic to stretched coordinate
+        ! ----------------------------------------------
+     
+        CALL rot_rep( pxu1, pyu1, 'U', 'en->i',px2 )
+        CALL rot_rep( pxv1, pyv1, 'V', 'en->j',py2 )
+      CASE (-1)
+       ! Change from stretched to geographic coordinate
+       ! ----------------------------------------------
+     
+       CALL rot_rep( pxu1, pyu1, 'U', 'ij->e',px2 )
+       CALL rot_rep( pxv1, pyv1, 'V', 'ij->n',py2 )
+     END SELECT
+     
+   END SUBROUTINE repcmo
 
    SUBROUTINE rot_rep ( pxin, pyin, cd_type, cdtodo, prot )
Index: NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/sbccpl.F90
===================================================================
--- NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/sbccpl.F90	(revision 12802)
+++ NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/SBC/sbccpl.F90	(revision 12803)
@@ -412,5 +412,9 @@
          srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
          srcv(jpr_itx1:jpr_itz1)%clgrid  = 'F'        ! ice components given at F-point
-         srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
+         !srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
+! Currently needed for HadGEM3 - but shouldn't affect anyone else for the moment
+         srcv(jpr_otx1)%laction = .TRUE. 
+         srcv(jpr_oty1)%laction = .TRUE.
+!
          srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 only
       CASE( 'T,I' ) 
@@ -1121,5 +1125,6 @@
       LOGICAL  ::   llnewtx, llnewtau      ! update wind stress components and module??
       INTEGER  ::   ji, jj, jn             ! dummy loop indices
-      INTEGER  ::   isec                   ! number of seconds since nit000 (assuming rdt did not change since nit000)
+      INTEGER  ::   isec                   ! number of seconds since nit000 (assuming rdttra did not change since nit000)
+      INTEGER  ::   ikchoix
       REAL(wp) ::   zcumulneg, zcumulpos   ! temporary scalars     
       REAL(wp) ::   zcoef                  ! temporary scalar
@@ -1127,5 +1132,5 @@
       REAL(wp) ::   zcdrag = 1.5e-3        ! drag coefficient
       REAL(wp) ::   zzx, zzy               ! temporary variables
-      REAL(wp), DIMENSION(jpi,jpj) ::   ztx, zty, zmsk, zemp, zqns, zqsr
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztx, zty, zmsk, zemp, zqns, zqsr, ztx2, zty2
       !!----------------------------------------------------------------------
       !
@@ -1174,12 +1179,34 @@
             IF( TRIM( sn_rcv_tau%clvor ) == 'eastward-northward' ) THEN   ! 2 components oriented along the local grid
                !                                                       ! (geographical to local grid -> rotate the components)
-               CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->i', ztx )   
-               IF( srcv(jpr_otx2)%laction ) THEN
-                  CALL rot_rep( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), srcv(jpr_otx2)%clgrid, 'en->j', zty )   
-               ELSE
-                  CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->j', zty )  
+               IF( srcv(jpr_otx1)%clgrid == 'U' .AND. (.NOT. srcv(jpr_otx2)%laction) ) THEN
+                  ! Temporary code for HadGEM3 - will be removed eventually.
+		  ! Only applies when we have only taux on U grid and tauy on V grid
+ 	          DO jj=2,jpjm1
+ 	             DO ji=2,jpim1
+ 	                  ztx(ji,jj)=0.25*vmask(ji,jj,1)                &
+ 	                     *(frcv(jpr_otx1)%z3(ji,jj,1)+frcv(jpr_otx1)%z3(ji-1,jj,1)    &
+ 	                     +frcv(jpr_otx1)%z3(ji,jj+1,1)+frcv(jpr_otx1)%z3(ji-1,jj+1,1))
+ 	                  zty(ji,jj)=0.25*umask(ji,jj,1)                &
+ 	                     *(frcv(jpr_oty1)%z3(ji,jj,1)+frcv(jpr_oty1)%z3(ji+1,jj,1)    &
+ 	                     +frcv(jpr_oty1)%z3(ji,jj-1,1)+frcv(jpr_oty1)%z3(ji+1,jj-1,1))
+ 	             ENDDO
+ 	          ENDDO
+ 	                
+ 	          ikchoix = 1
+ 	          CALL repcmo (frcv(jpr_otx1)%z3(:,:,1),zty,ztx,frcv(jpr_oty1)%z3(:,:,1),ztx2,zty2,ikchoix)
+ 	          CALL lbc_lnk ('jpr_otx1', ztx2,'U', -1. )
+ 	          CALL lbc_lnk ('jpr_oty1', zty2,'V', -1. )
+ 	          frcv(jpr_otx1)%z3(:,:,1)=ztx2(:,:)
+ 	          frcv(jpr_oty1)%z3(:,:,1)=zty2(:,:)
+ 	       ELSE
+ 	          CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->i', ztx )   
+ 	          frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
+ 	          IF( srcv(jpr_otx2)%laction ) THEN
+ 	             CALL rot_rep( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), srcv(jpr_otx2)%clgrid, 'en->j', zty )   
+ 	          ELSE
+ 	             CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->j', zty ) 
+ 	          ENDIF
+          frcv(jpr_oty1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 2nd grid  
                ENDIF
-               frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
-               frcv(jpr_oty1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 2nd grid
             ENDIF
             !                              
@@ -2177,4 +2204,5 @@
       !
       INTEGER ::   ji, jj, jl   ! dummy loop indices
+      INTEGER ::   ikchoix
       INTEGER ::   isec, info   ! local integer
       REAL(wp) ::   zumax, zvmax
@@ -2453,5 +2481,5 @@
          !                                                  j+1   j     -----V---F
          ! surface velocity always sent from T point                     !       |
-         !                                                        j      |   T   U
+         ! [except for HadGEM3]                                   j      |   T   U
          !                                                               |       |
          !                                                   j    j-1   -I-------|
@@ -2465,10 +2493,20 @@
             SELECT CASE( TRIM( sn_snd_crt%cldes ) )
             CASE( 'oce only'             )      ! C-grid ==> T
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj  ,1) )
-                     zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + vn(ji  ,jj-1,1) ) 
+               IF ( TRIM( sn_snd_crt%clvgrd ) == 'T' ) THEN
+                  DO jj = 2, jpjm1
+                     DO ji = fs_2, fs_jpim1   ! vector opt.
+                        zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj  ,1) )
+                        zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + vn(ji  ,jj-1,1) ) 
+                     END DO
                   END DO
-               END DO
+               ELSE
+! Temporarily Changed for UKV
+                  DO jj = 2, jpjm1
+                     DO ji = 2, jpim1
+                        zotx1(ji,jj) = un(ji,jj,1)
+                        zoty1(ji,jj) = vn(ji,jj,1)
+                     END DO
+                  END DO
+               ENDIF
             CASE( 'weighted oce and ice' )      ! Ocean and Ice on C-grid ==> T  
                DO jj = 2, jpjm1
@@ -2498,14 +2536,38 @@
          IF( TRIM( sn_snd_crt%clvor ) == 'eastward-northward' ) THEN             ! Rotation of the components
             !                                                                     ! Ocean component
-            CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->e', ztmp1 )       ! 1st component 
-            CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->n', ztmp2 )       ! 2nd component 
-            zotx1(:,:) = ztmp1(:,:)                                                   ! overwrite the components 
-            zoty1(:,:) = ztmp2(:,:)
-            IF( ssnd(jps_ivx1)%laction ) THEN                                     ! Ice component
-               CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->e', ztmp1 )    ! 1st component 
-               CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->n', ztmp2 )    ! 2nd component 
-               zitx1(:,:) = ztmp1(:,:)                                                ! overwrite the components 
-               zity1(:,:) = ztmp2(:,:)
-            ENDIF
+            IF ( TRIM( sn_snd_crt%clvgrd ) == 'T' ) THEN
+               CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->e', ztmp1 )       ! 1st component
+               CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->n', ztmp2 )       ! 2nd component
+               zotx1(:,:) = ztmp1(:,:)                                                   ! overwrite the components
+               zoty1(:,:) = ztmp2(:,:)
+               IF( ssnd(jps_ivx1)%laction ) THEN                                  ! Ice component
+                  CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->e', ztmp1 )    ! 1st component
+                  CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->n', ztmp2 )    ! 2nd component
+                  zitx1(:,:) = ztmp1(:,:)                                                ! overwrite the components
+                  zity1(:,:) = ztmp2(:,:)
+               ENDIF
+            ELSE
+               ! Temporary code for HadGEM3 - will be removed eventually.
+               ! Only applies when we want uvel on U grid and vvel on V grid
+               ! Rotate U and V onto geographic grid before sending.
+
+               DO jj=2,jpjm1
+                  DO ji=2,jpim1
+                     ztmp1(ji,jj)=0.25*vmask(ji,jj,1)                  &
+                          *(zotx1(ji,jj)+zotx1(ji-1,jj)    &
+                          +zotx1(ji,jj+1)+zotx1(ji-1,jj+1))
+                     ztmp2(ji,jj)=0.25*umask(ji,jj,1)                  &
+                          *(zoty1(ji,jj)+zoty1(ji+1,jj)    &
+                          +zoty1(ji,jj-1)+zoty1(ji+1,jj-1))
+                  ENDDO
+               ENDDO
+               
+               ! Ensure any N fold and wrap columns are updated
+               CALL lbc_lnk('zotx1', ztmp1, 'V', -1.0)
+               CALL lbc_lnk('zoty1', ztmp2, 'U', -1.0)
+               
+               ikchoix = -1
+               CALL repcmo (zotx1,ztmp2,ztmp1,zoty1,zotx1,zoty1,ikchoix)
+           ENDIF
          ENDIF
          !
Index: NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/nemogcm.F90
===================================================================
--- NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/nemogcm.F90	(revision 12802)
+++ NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/nemogcm.F90	(revision 12803)
@@ -87,4 +87,5 @@
    USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges 
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
+   USE sbccpl 
 #if defined key_iomput
    USE xios           ! xIOserver
@@ -199,4 +200,7 @@
             ENDIF
             
+            IF (lk_oasis) THEN
+               CALL sbc_cpl_snd( istp )  ! Coupling to atmos
+            ENDIF
             CALL stp        ( istp ) 
             istp = istp + 1
@@ -209,5 +213,5 @@
          !
          DO WHILE( istp <= nitend .AND. nstop == 0 )
-            CALL stp_diurnal( istp )   ! time step only the diurnal SST 
+            CALL stp_diurnal( istp )   ! time step only the diurnal SST
             istp = istp + 1
          END DO
@@ -279,5 +283,5 @@
       IF( Agrif_Root() ) THEN
          IF( lk_oasis ) THEN
-            CALL cpl_init( "oceanx", ilocal_comm )                               ! nemo local communicator given by oasis
+            CALL cpl_init( "toyoce", ilocal_comm )                     ! nemo local communicator given by oasis
             CALL xios_initialize( "not used"       , local_comm =ilocal_comm )   ! send nemo communicator to xios
          ELSE
@@ -289,5 +293,5 @@
       IF( lk_oasis ) THEN
          IF( Agrif_Root() ) THEN
-            CALL cpl_init( "oceanx", ilocal_comm )          ! nemo local communicator given by oasis
+            CALL cpl_init( "toyoce", ilocal_comm )                      ! nemo local communicator given by oasis
          ENDIF
          CALL mpp_start( ilocal_comm )
@@ -498,4 +502,9 @@
       !
       IF(lwp) WRITE(numout,cform_aaa)           ! Flag AAAAAAA
+      
+      IF (nstop > 0) THEN
+        CALL CTL_STOP('STOP','Critical errors in NEMO initialisation')
+      END IF
+      
       !
       IF( ln_timing    )   CALL timing_stop( 'nemo_init')
Index: NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/step.F90
===================================================================
--- NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/step.F90	(revision 12802)
+++ NEMO/branches/UKMO/r4.0-HEAD_r12713_dan_test_clems_branch/src/OCE/step.F90	(revision 12803)
@@ -311,6 +311,5 @@
       ! Coupled mode
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-!!gm why lk_oasis and not lk_cpl ????
-      IF( lk_oasis   )   CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges
+      !IF( lk_oasis         )   CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges
       !
 #if defined key_iomput
