Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OOO_SRC/nemogcm.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OOO_SRC/nemogcm.F90	(revision 4856)
+++ branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OOO_SRC/nemogcm.F90	(revision 4857)
@@ -54,9 +54,5 @@
    USE icbini          ! handle bergs, initialisation
    USE icbstp          ! handle bergs, calving, themodynamics and transport
-#if defined key_oasis3
    USE cpl_oasis3      ! OASIS3 coupling
-#elif defined key_oasis4
-   USE cpl_oasis4      ! OASIS4 coupling (not working)
-#endif
    USE lib_mpp         ! distributed memory computing
 #if defined key_iomput
@@ -166,22 +162,23 @@
 #if defined key_iomput
       IF( Agrif_Root() ) THEN
-# if defined key_oasis3 || defined key_oasis4
-         CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis
-         CALL xios_initialize( "oceanx",local_comm=ilocal_comm )
-# else
-         CALL  xios_initialize( "nemo",return_comm=ilocal_comm )
-# endif
+         IF( lk_cpl ) THEN
+            CALL cpl_init( ilocal_comm )                               ! nemo local communicator given by oasis
+            CALL xios_initialize( "oceanx",local_comm=ilocal_comm )    ! send nemo communicator to xios
+         ELSE
+            CALL  xios_initialize( "nemo",return_comm=ilocal_comm )    ! nemo local communicator given by xios
+         ENDIF
+      ENDIF
       ENDIF
       narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection
 #else
-# if defined key_oasis3 || defined key_oasis4
-      IF( Agrif_Root() ) THEN
-         CALL cpl_prism_init( ilocal_comm )                 ! nemo local communicator given by oasis
-      ENDIF
-      narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection (control print return in cltxt)
-# else
-      ilocal_comm = 0
-      narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop )                ! Nodes selection (control print return in cltxt)
-# endif
+      IF( lk_cpl ) THEN
+         IF( Agrif_Root() ) THEN
+            CALL cpl_init( ilocal_comm )                               ! nemo local communicator given by oasis
+         ENDIF
+         narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection (control print return in cltxt)
+      ELSE
+         ilocal_comm = 0
+         narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop )                ! Nodes selection (control print return in cltxt)
+      ENDIF
 #endif
       narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 )
Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 4856)
+++ branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 4857)
@@ -2,6 +2,5 @@
    !!======================================================================
    !!                    ***  MODULE cpl_oasis  ***
-   !! Coupled O/A : coupled ocean-atmosphere case using OASIS3 V. prism_2_4
-   !!               special case: NEMO OPA/LIM coupled to ECHAM5
+   !! Coupled O/A : coupled ocean-atmosphere case using OASIS3-MCT
    !!=====================================================================
    !! History :   
@@ -15,19 +14,16 @@
    !!   3.4  !  11-11  (C. Harris) Changes to allow mutiple category fields
    !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3
+   !!----------------------------------------------------------------------
+   !!   cpl_init     : initialization of coupled mode communication
+   !!   cpl_define   : definition of grid and fields
+   !!   cpl_snd     : snd out fields in coupled mode
+   !!   cpl_rcv     : receive fields in coupled mode
+   !!   cpl_finalize : finalize the coupled mode communication
+   !!----------------------------------------------------------------------
 #if defined key_oasis3
-   !!----------------------------------------------------------------------
-   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3
-   !!----------------------------------------------------------------------
-   !!   cpl_prism_init     : initialization of coupled mode communication
-   !!   cpl_prism_define   : definition of grid and fields
-   !!   cpl_prism_snd     : snd out fields in coupled mode
-   !!   cpl_prism_rcv     : receive fields in coupled mode
-   !!   cpl_prism_finalize : finalize the coupled mode communication
-   !!----------------------------------------------------------------------
-   USE mod_prism_proto              ! OASIS3 prism module
-   USE mod_prism_def_partition_proto! OASIS3 prism module for partitioning
-   USE mod_prism_put_proto          ! OASIS3 prism module for snding
-   USE mod_prism_get_proto          ! OASIS3 prism module for receiving
-   USE mod_comprism_proto           ! OASIS3 prism module to get coupling frequency
+   USE mod_oasis                    ! OASIS3-MCT module
+#endif
    USE par_oce                      ! ocean parameters
    USE dom_oce                      ! ocean space and time domain
@@ -38,16 +34,33 @@
    PRIVATE
 
-   PUBLIC   cpl_prism_init
-   PUBLIC   cpl_prism_define
-   PUBLIC   cpl_prism_snd
-   PUBLIC   cpl_prism_rcv
-   PUBLIC   cpl_prism_freq
-   PUBLIC   cpl_prism_finalize
-
-   LOGICAL, PUBLIC, PARAMETER ::   lk_cpl = .TRUE.   !: coupled flag
+   PUBLIC   cpl_init
+   PUBLIC   cpl_define
+   PUBLIC   cpl_snd
+   PUBLIC   cpl_rcv
+   PUBLIC   cpl_freq
+   PUBLIC   cpl_finalize
+
    INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
    INTEGER, PUBLIC            ::   OASIS_idle = 0    !: return code if nothing done by oasis
-   INTEGER                    ::   ncomp_id          ! id returned by prism_init_comp
+   INTEGER                    ::   ncomp_id          ! id returned by oasis_init_comp
    INTEGER                    ::   nerror            ! return error code
+#if defined key_oasis3
+   LOGICAL, PUBLIC, PARAMETER ::   lk_cpl = .TRUE.   !: coupled flag
+#else
+   LOGICAL, PUBLIC, PARAMETER ::   lk_cpl = .FALSE.  !: coupled flag
+   ! OASIS Variables not used. defined only for compilation purpose
+   INTEGER                    ::   OASIS_Out         = -1
+   INTEGER                    ::   OASIS_REAL        = -1
+   INTEGER                    ::   OASIS_Ok          = -1
+   INTEGER                    ::   OASIS_In          = -1
+   INTEGER                    ::   OASIS_Sent        = -1
+   INTEGER                    ::   OASIS_SentOut     = -1
+   INTEGER                    ::   OASIS_ToRest      = -1
+   INTEGER                    ::   OASIS_ToRestOut   = -1
+   INTEGER                    ::   OASIS_Recvd       = -1
+   INTEGER                    ::   OASIS_RecvOut     = -1
+   INTEGER                    ::   OASIS_FromRest    = -1
+   INTEGER                    ::   OASIS_FromRestOut = -1
+#endif
 
    INTEGER, PARAMETER ::   nmaxfld=40    ! Maximum number of coupling fields
@@ -73,7 +86,7 @@
 CONTAINS
 
-   SUBROUTINE cpl_prism_init( kl_comm )
+   SUBROUTINE cpl_init( kl_comm )
       !!-------------------------------------------------------------------
-      !!             ***  ROUTINE cpl_prism_init  ***
+      !!             ***  ROUTINE cpl_init  ***
       !!
       !! ** Purpose :   Initialize coupled mode communication for ocean
@@ -89,9 +102,9 @@
 
       !------------------------------------------------------------------
-      ! 1st Initialize the PRISM system for the application
-      !------------------------------------------------------------------
-      CALL prism_init_comp_proto ( ncomp_id, 'oceanx', nerror )
-      IF ( nerror /= PRISM_Ok ) &
-         CALL prism_abort_proto (ncomp_id, 'cpl_prism_init', 'Failure in prism_init_comp_proto')
+      ! 1st Initialize the OASIS system for the application
+      !------------------------------------------------------------------
+      CALL oasis_init_comp ( ncomp_id, 'oceanx', nerror )
+      IF ( nerror /= OASIS_Ok ) &
+         CALL oasis_abort (ncomp_id, 'cpl_init', 'Failure in oasis_init_comp')
 
       !------------------------------------------------------------------
@@ -99,14 +112,14 @@
       !------------------------------------------------------------------
 
-      CALL prism_get_localcomm_proto ( kl_comm, nerror )
-      IF ( nerror /= PRISM_Ok ) &
-         CALL prism_abort_proto (ncomp_id, 'cpl_prism_init','Failure in prism_get_localcomm_proto' )
-      !
-   END SUBROUTINE cpl_prism_init
-
-
-   SUBROUTINE cpl_prism_define( krcv, ksnd )
+      CALL oasis_get_localcomm ( kl_comm, nerror )
+      IF ( nerror /= OASIS_Ok ) &
+         CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' )
+      !
+   END SUBROUTINE cpl_init
+
+
+   SUBROUTINE cpl_define( krcv, ksnd )
       !!-------------------------------------------------------------------
-      !!             ***  ROUTINE cpl_prism_define  ***
+      !!             ***  ROUTINE cpl_define  ***
       !!
       !! ** Purpose :   Define grid and field information for ocean
@@ -125,5 +138,5 @@
 
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'cpl_prism_define : initialization in coupled ocean/atmosphere case'
+      IF(lwp) WRITE(numout,*) 'cpl_define : initialization in coupled ocean/atmosphere case'
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~'
       IF(lwp) WRITE(numout,*)
@@ -141,5 +154,5 @@
       ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror)
       IF( nerror > 0 ) THEN
-         CALL prism_abort_proto ( ncomp_id, 'cpl_prism_define', 'Failure in allocating exfld')   ;   RETURN
+         CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld')   ;   RETURN
       ENDIF
       !
@@ -161,5 +174,5 @@
       ENDIF
       
-      CALL prism_def_partition_proto ( id_part, paral, nerror )
+      CALL oasis_def_partition ( id_part, paral, nerror )
       !
       ! ... Announce send variables. 
@@ -173,10 +186,10 @@
                   zclname=ssnd(ji)%clname
                ENDIF
-               WRITE(numout,*) "Define",ji,jc,zclname," for",PRISM_Out
-               CALL prism_def_var_proto (ssnd(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
-                    PRISM_Out, ishape, PRISM_REAL, nerror)
-               IF ( nerror /= PRISM_Ok ) THEN
+               WRITE(numout,*) "Define",ji,jc,zclname," for",OASIS_Out
+               CALL oasis_def_var (ssnd(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
+                    OASIS_Out, ishape, OASIS_REAL, nerror)
+               IF ( nerror /= OASIS_Ok ) THEN
                   WRITE(numout,*) 'Failed to define transient ', ji, TRIM(zclname)
-                  CALL prism_abort_proto ( ssnd(ji)%nid(jc), 'cpl_prism_define', 'Failure in prism_def_var')
+                  CALL oasis_abort ( ssnd(ji)%nid(jc), 'cpl_define', 'Failure in oasis_def_var')
                ENDIF
             END DO
@@ -194,10 +207,10 @@
                   zclname=srcv(ji)%clname
                ENDIF
-               WRITE(numout,*) "Define",ji,jc,zclname," for",PRISM_In
-               CALL prism_def_var_proto ( srcv(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
-                    &                      PRISM_In    , ishape   , PRISM_REAL, nerror)
-               IF ( nerror /= PRISM_Ok ) THEN
+               WRITE(numout,*) "Define",ji,jc,zclname," for",OASIS_In
+               CALL oasis_def_var ( srcv(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
+                    &                      OASIS_In    , ishape   , OASIS_REAL, nerror)
+               IF ( nerror /= OASIS_Ok ) THEN
                   WRITE(numout,*) 'Failed to define transient ', ji, TRIM(zclname)
-                  CALL prism_abort_proto ( srcv(ji)%nid(jc), 'cpl_prism_define', 'Failure in prism_def_var')
+                  CALL oasis_abort ( srcv(ji)%nid(jc), 'cpl_define', 'Failure in oasis_def_var')
                ENDIF
             END DO
@@ -209,13 +222,13 @@
       !------------------------------------------------------------------
       
-      CALL prism_enddef_proto(nerror)
-      IF( nerror /= PRISM_Ok )   CALL prism_abort_proto ( ncomp_id, 'cpl_prism_define', 'Failure in prism_enddef')
-      !
-   END SUBROUTINE cpl_prism_define
+      CALL oasis_enddef(nerror)
+      IF( nerror /= OASIS_Ok )   CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in oasis_enddef')
+      !
+   END SUBROUTINE cpl_define
    
    
-   SUBROUTINE cpl_prism_snd( kid, kstep, pdata, kinfo )
+   SUBROUTINE cpl_snd( kid, kstep, pdata, kinfo )
       !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_snd  ***
+      !!              ***  ROUTINE cpl_snd  ***
       !!
       !! ** Purpose : - At each coupling time-step,this routine sends fields
@@ -234,14 +247,14 @@
       DO jc = 1, ssnd(kid)%nct
 
-         CALL prism_put_proto ( ssnd(kid)%nid(jc), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo )
+         CALL oasis_put ( ssnd(kid)%nid(jc), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo )
          
          IF ( ln_ctl ) THEN        
-            IF ( kinfo == PRISM_Sent     .OR. kinfo == PRISM_ToRest .OR.   &
-                 & kinfo == PRISM_SentOut  .OR. kinfo == PRISM_ToRestOut ) THEN
+            IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   &
+                 & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN
                WRITE(numout,*) '****************'
-               WRITE(numout,*) 'prism_put_proto: Outgoing ', ssnd(kid)%clname
-               WRITE(numout,*) 'prism_put_proto: ivarid ', ssnd(kid)%nid(jc)
-               WRITE(numout,*) 'prism_put_proto:  kstep ', kstep
-               WRITE(numout,*) 'prism_put_proto:   info ', kinfo
+               WRITE(numout,*) 'oasis_put: Outgoing ', ssnd(kid)%clname
+               WRITE(numout,*) 'oasis_put: ivarid ', ssnd(kid)%nid(jc)
+               WRITE(numout,*) 'oasis_put:  kstep ', kstep
+               WRITE(numout,*) 'oasis_put:   info ', kinfo
                WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
                WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
@@ -253,10 +266,10 @@
       ENDDO
       !
-    END SUBROUTINE cpl_prism_snd
-
-
-   SUBROUTINE cpl_prism_rcv( kid, kstep, pdata, kinfo )
+    END SUBROUTINE cpl_snd
+
+
+   SUBROUTINE cpl_rcv( kid, kstep, pdata, kinfo )
       !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_rcv  ***
+      !!              ***  ROUTINE cpl_rcv  ***
       !!
       !! ** Purpose : - At each coupling time-step,this routine receives fields
@@ -276,9 +289,9 @@
       DO jc = 1, srcv(kid)%nct
 
-         CALL prism_get_proto ( srcv(kid)%nid(jc), kstep, exfld, kinfo )         
+         CALL oasis_get ( srcv(kid)%nid(jc), kstep, exfld, kinfo )         
          
          llaction = .false.
-         IF( kinfo == PRISM_Recvd   .OR. kinfo == PRISM_FromRest .OR.   &
-              kinfo == PRISM_RecvOut .OR. kinfo == PRISM_FromRestOut )   llaction = .TRUE.
+         IF( kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
+              kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut )   llaction = .TRUE.
          
          IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc)
@@ -295,8 +308,8 @@
             IF ( ln_ctl ) THEN        
                WRITE(numout,*) '****************'
-               WRITE(numout,*) 'prism_get_proto: Incoming ', srcv(kid)%clname
-               WRITE(numout,*) 'prism_get_proto: ivarid '  , srcv(kid)%nid(jc)
-               WRITE(numout,*) 'prism_get_proto:   kstep', kstep
-               WRITE(numout,*) 'prism_get_proto:   info ', kinfo
+               WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname
+               WRITE(numout,*) 'oasis_get: ivarid '  , srcv(kid)%nid(jc)
+               WRITE(numout,*) 'oasis_get:   kstep', kstep
+               WRITE(numout,*) 'oasis_get:   info ', kinfo
                WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
                WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
@@ -311,51 +324,115 @@
       ENDDO
       !
-   END SUBROUTINE cpl_prism_rcv
-
-
-   INTEGER FUNCTION cpl_prism_freq( kid )  
+   END SUBROUTINE cpl_rcv
+
+
+   INTEGER FUNCTION cpl_freq( kid )  
       !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_freq  ***
+      !!              ***  ROUTINE cpl_freq  ***
       !!
       !! ** Purpose : - send back the coupling frequency for a particular field
       !!----------------------------------------------------------------------
-      INTEGER,INTENT(in) ::   kid   ! variable index 
+      INTEGER,INTENT(in) ::   kid   ! variable index
+      !!
+      INTEGER :: info
       !!----------------------------------------------------------------------
-      cpl_prism_freq = ig_def_freq( kid )
-      !
-   END FUNCTION cpl_prism_freq
-
-
-   SUBROUTINE cpl_prism_finalize
+      CALL oasis_get_freqs(kid, 1, cpl_freq, info)
+      !
+   END FUNCTION cpl_freq
+
+
+   SUBROUTINE cpl_finalize
       !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_finalize  ***
+      !!              ***  ROUTINE cpl_finalize  ***
       !!
       !! ** Purpose : - Finalizes the coupling. If MPI_init has not been
-      !!      called explicitly before cpl_prism_init it will also close
+      !!      called explicitly before cpl_init it will also close
       !!      MPI communication.
       !!----------------------------------------------------------------------
       !
       DEALLOCATE( exfld )
-      CALL prism_terminate_proto( nerror )         
-      !
-   END SUBROUTINE cpl_prism_finalize
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default case          Dummy module          Forced Ocean/Atmosphere
-   !!----------------------------------------------------------------------
-   USE in_out_manager               ! I/O manager
-   LOGICAL, PUBLIC, PARAMETER :: lk_cpl = .FALSE.   !: coupled flag
-   PUBLIC cpl_prism_init
-   PUBLIC cpl_prism_finalize
-CONTAINS
-   SUBROUTINE cpl_prism_init (kl_comm) 
-      INTEGER, INTENT(out)   :: kl_comm       ! local communicator of the model
-      kl_comm = -1
-      WRITE(numout,*) 'cpl_prism_init: Error you sould not be there...'
-   END SUBROUTINE cpl_prism_init
-   SUBROUTINE cpl_prism_finalize
-      WRITE(numout,*) 'cpl_prism_finalize: Error you sould not be there...'
-   END SUBROUTINE cpl_prism_finalize
+      IF (nstop == 0) THEN
+         CALL oasis_terminate( nerror )         
+      ELSE
+         CALL oasis_abort( ncomp_id, "cpl_finalize", "NEMO ABORT STOP" )
+      ENDIF       
+      !
+   END SUBROUTINE cpl_finalize
+
+#if ! defined key_oasis3
+
+   !!----------------------------------------------------------------------
+   !!   No OASIS Library          OASIS3 Dummy module...
+   !!----------------------------------------------------------------------
+
+   SUBROUTINE oasis_init_comp(k1,cd1,k2)
+      CHARACTER(*), INTENT(in   ) ::  cd1
+      INTEGER     , INTENT(  out) ::  k1,k2
+      k1 = -1 ; k2 = -1
+      WRITE(numout,*) 'oasis_init_comp: Error you sould not be there...', cd1
+   END SUBROUTINE oasis_init_comp
+
+   SUBROUTINE oasis_abort(k1,cd1,cd2)
+      INTEGER     , INTENT(in   ) ::  k1
+      CHARACTER(*), INTENT(in   ) ::  cd1,cd2
+      WRITE(numout,*) 'oasis_abort: Error you sould not be there...', cd1, cd2
+   END SUBROUTINE oasis_abort
+
+   SUBROUTINE oasis_get_localcomm(k1,k2)
+      INTEGER     , INTENT(  out) ::  k1,k2
+      k1 = -1 ; k2 = -1
+      WRITE(numout,*) 'oasis_get_localcomm: Error you sould not be there...'
+   END SUBROUTINE oasis_get_localcomm
+
+   SUBROUTINE oasis_def_partition(k1,k2,k3)
+      INTEGER     , INTENT(  out) ::  k1,k3
+      INTEGER     , INTENT(in   ) ::  k2(5)
+      k1 = k2(1) ; k3 = k2(5)
+      WRITE(numout,*) 'oasis_def_partition: Error you sould not be there...'
+   END SUBROUTINE oasis_def_partition
+
+   SUBROUTINE oasis_def_var(k1,cd1,k2,k3,k4,k5,k6,k7)
+      CHARACTER(*), INTENT(in   ) ::  cd1
+      INTEGER     , INTENT(in   ) ::  k2,k3(2),k4,k5(2,2),k6
+      INTEGER     , INTENT(  out) ::  k1,k7
+      k1 = -1 ; k7 = -1
+      WRITE(numout,*) 'oasis_def_var: Error you sould not be there...', cd1
+   END SUBROUTINE oasis_def_var
+
+   SUBROUTINE oasis_enddef(k1)
+      INTEGER     , INTENT(  out) ::  k1
+      k1 = -1
+      WRITE(numout,*) 'oasis_enddef: Error you sould not be there...'
+   END SUBROUTINE oasis_enddef
+  
+   SUBROUTINE oasis_put(k1,k2,p1,k3)
+      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::  p1
+      INTEGER                 , INTENT(in   ) ::  k1,k2
+      INTEGER                 , INTENT(  out) ::  k3
+      k3 = -1
+      WRITE(numout,*) 'oasis_put: Error you sould not be there...'
+   END SUBROUTINE oasis_put
+
+   SUBROUTINE oasis_get(k1,k2,p1,k3)
+      REAL(wp), DIMENSION(:,:), INTENT(  out) ::  p1
+      INTEGER                 , INTENT(in   ) ::  k1,k2
+      INTEGER                 , INTENT(  out) ::  k3
+      p1(1,1) = -1. ; k3 = -1
+      WRITE(numout,*) 'oasis_get: Error you sould not be there...'
+   END SUBROUTINE oasis_get
+
+   SUBROUTINE oasis_get_freqs(k1,k2,k3,k4)
+      INTEGER     , INTENT(in   ) ::  k1,k2
+      INTEGER     , INTENT(  out) ::  k3,k4
+      k3 = k1 ; k4 = k2
+      WRITE(numout,*) 'oasis_get_freqs: Error you sould not be there...'
+   END SUBROUTINE oasis_get_freqs
+
+   SUBROUTINE oasis_terminate(k1)
+      INTEGER     , INTENT(  out) ::  k1
+      k1 = -1
+      WRITE(numout,*) 'oasis_terminate: Error you sould not be there...'
+   END SUBROUTINE oasis_terminate
+   
 #endif
 
Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis4.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis4.F90	(revision 4856)
+++ 	(revision )
@@ -1,481 +1,0 @@
-MODULE cpl_oasis4
-   !!======================================================================
-   !!                    ***  MODULE cpl_oasis  ***
-   !! Coupled O/A : coupled ocean-atmosphere case using OASIS4
-   !!=====================================================================
-   !! History :   
-   !!   9.0  !  2004-06  (R. Redler, NEC Laboratories Europe, St Augustin, Germany) Original code
-   !!    -   !  2004-11  (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Kiel, Germany) revision
-   !!    -   !  2004-11  (V. Gayler, MPI M&D) Grid writing
-   !!    -   !  2005-08  (R. Redler, W. Park) frld initialization, paral(2) revision
-   !!    -   !  2005-09  (R. Redler) extended to allow for communication over root only
-   !!    -   !  2006-01  (W. Park) modification of physical part
-   !!    -   !  2006-02  (R. Redler, W. Park) buffer array fix for root exchange
-   !!    -   !  2010-10  (E. Maisonnave and S. Masson) complete rewrite
-   !!----------------------------------------------------------------------
-#if defined key_oasis4
-   !!----------------------------------------------------------------------
-   !!   'key_oasis4'                    coupled Ocean/Atmosphere via OASIS4
-   !!----------------------------------------------------------------------
-   !!   cpl_prism_init     : initialization of coupled mode communication
-   !!   cpl_prism_define   : definition of grid and fields
-   !!   cpl_prism_snd      : snd out fields in coupled mode
-   !!   cpl_prism_rcv      : receive fields in coupled mode
-   !!   cpl_prism_update_time : update date sent to Oasis
-   !!   cpl_prism_finalize : finalize the coupled mode communication
-   !!----------------------------------------------------------------------
-   USE prism            ! OASIS4 prism module
-   USE par_oce          ! ocean parameters
-   USE dom_oce          ! ocean space and time domain
-   USE domwri           ! ocean space and time domain
-   USE in_out_manager   ! I/O manager
-   USE lbclnk           ! ocean lateral boundary conditions (or mpp link)
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC cpl_prism_init
-   PUBLIC cpl_prism_define
-   PUBLIC cpl_prism_snd
-   PUBLIC cpl_prism_rcv
-   PUBLIC cpl_prism_update_time
-   PUBLIC cpl_prism_finalize
-   
-!   LOGICAL, PUBLIC, PARAMETER :: lk_cpl = .TRUE.    ! coupled flag
-   INTEGER                    :: ncomp_id           ! id returned by prism_init_comp
-   INTEGER                    :: nerror             ! return error code
-   INTEGER, PUBLIC            :: OASIS_Rcv  = 1     ! return code if received field
-   INTEGER, PUBLIC            :: OASIS_idle = 0     ! return code if nothing done by oasis
-
-   INTEGER, PARAMETER :: nmaxfld=40    ! Maximum number of coupling fields
-   
-   TYPE, PUBLIC ::   FLD_CPL            ! Type for coupling field information
-      LOGICAL            ::   laction   ! To be coupled or not
-      CHARACTER(len = 8) ::   clname    ! Name of the coupling field   
-      CHARACTER(len = 1) ::   clgrid    ! Grid type  
-      REAL(wp)           ::   nsgn      ! Control of the sign change
-      INTEGER            ::   nid       ! Id of the field
-   END TYPE FLD_CPL
-
-   TYPE(FLD_CPL), DIMENSION(nmaxfld), PUBLIC :: srcv, ssnd   ! Coupling fields
-
-   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: exfld  ! Temporary buffer for receiving
-
-   TYPE(PRISM_Time_struct), PUBLIC    :: date            ! date info for send operation
-   TYPE(PRISM_Time_struct), PUBLIC    :: date_bound(2)   ! date info for send operation
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id$
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE cpl_prism_init( kl_comm ) 
-      !!-------------------------------------------------------------------
-      !!             ***  ROUTINE cpl_prism_init  ***
-      !!
-      !! ** Purpose :   Initialize coupled mode communication for ocean
-      !!    exchange between AGCM, OGCM and COUPLER. (OASIS4 software)
-      !!
-      !! ** Method  :   OASIS4 MPI communication 
-      !!--------------------------------------------------------------------
-      INTEGER, INTENT(out) ::   kl_comm   ! local communicator of the model
-      !!--------------------------------------------------------------------
-      
-      CALL prism_init( 'nemo', nerror )
-
-      !------------------------------------------------------------------
-      ! 2nd Initialize the PRISM system for the component
-      !------------------------------------------------------------------
-      CALL prism_init_comp( ncomp_id, 'oceanx', nerror )
-      IF( nerror /= PRISM_Success )   CALL prism_abort( ncomp_id, 'cpl_prism_init', 'Failure in prism_init_comp' )
-
-      !------------------------------------------------------------------
-      ! 3rd Get an MPI communicator fr OPA local communication
-      !------------------------------------------------------------------
-      CALL prism_get_localcomm( ncomp_id, kl_comm, nerror )
-      IF( nerror /= PRISM_Success )   CALL prism_abort( ncomp_id, 'cpl_prism_init', 'Failure in prism_get_localcomm' )
-      !
-   END SUBROUTINE cpl_prism_init
-
-
-   SUBROUTINE cpl_prism_define( krcv, ksnd )
-      !!-------------------------------------------------------------------
-      !!             ***  ROUTINE cpl_prism_define  ***
-      !!
-      !! ** Purpose :   Define grid and field information for ocean
-      !!    exchange between AGCM, OGCM and COUPLER. (OASIS4 software)
-      !!
-      !! ** Method  :   OASIS4 MPI communication 
-      !!--------------------------------------------------------------------
-      INTEGER, INTENT(in) :: krcv, ksnd     ! Number of received and sent coupling fields
-      !
-      INTEGER, DIMENSION(4)      :: igrid     ! ids returned by prism_def_grid
-      INTEGER, DIMENSION(4)      :: iptid     ! ids returned by prism_set_points
-      INTEGER, DIMENSION(4)      :: imskid    ! ids returned by prism_set_mask
-      INTEGER, DIMENSION(4)      :: iishift   ! 
-      INTEGER, DIMENSION(4)      :: ijshift   ! 
-      INTEGER, DIMENSION(4)      :: iioff     ! 
-      INTEGER, DIMENSION(4)      :: ijoff     ! 
-      INTEGER, DIMENSION(4)      :: itmp      ! 
-      INTEGER, DIMENSION(1,3)    :: iextent   ! 
-      INTEGER, DIMENSION(1,3)    :: ioffset   ! 
-
-      INTEGER                    :: ishape(2,3)    ! shape of arrays passed to PSMILe
-      INTEGER                    :: data_type      ! data type of transients
-
-      LOGICAL                    :: new_points
-      LOGICAL                    :: new_mask
-      LOGICAL, ALLOCATABLE, SAVE :: llmask(:,:,:) ! jpi,jpj,1
-
-      INTEGER                    :: ji, jj, jg, jc   ! local loop indicees
-      INTEGER                    :: ii, ij           ! index
-      INTEGER, DIMENSION(1)      :: ind              ! index
-
-      CHARACTER(len=32)          :: clpt_name     ! name of the grid points
-      CHARACTER(len=7)           :: cltxt 
-      CHARACTER(len=1), DIMENSION(4) :: clgrd = (/ 'T','U','V','F' /)     ! name of the grid points
-
-      TYPE(PRISM_Time_struct)    :: tmpdate
-      INTEGER                    :: idate_incr      ! date increment
-      REAL(wp), POINTER, DIMENSION(:,:)   ::   zlon, zlat
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zclo, zcla
-      !!--------------------------------------------------------------------
-      
-      CALL wrk_alloc( jpi,jpj, zlon, zlat )
-      CALL wrk_alloc( jpi,jpj,jpk, zclo, zcla )
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'cpl_prism_define : initialization in coupled ocean/atmosphere case'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~'
-      IF(lwp) WRITE(numout,*)
-
-      !
-      ! ... Allocate memory for data exchange
-      !
-      ALLOCATE( exfld(nlei-nldi+1, nlej-nldj+1, 1), stat = nerror )
-      IF ( nerror > 0 ) THEN
-         CALL prism_abort( ncomp_id, 'cpl_prism_define', 'Failure in allocating exfld' )
-         RETURN
-      ENDIF
-
-      IF(.not. ALLOCATED(mask))THEN
-         ALLOCATE(llmask(jpi,jpj,1), Stat=ji)
-         IF(ji /= 0)THEN
-            CALL prism_abort( ncomp_id, 'cpl_prism_define', 'Failure in allocating llmask' )
-            RETURN
-         END IF
-      END IF
-
-      ! -----------------------------------------------------------------
-      ! ... Define the shape of the valid region without the halo and overlaps between cpus
-      !     For serial configuration (key_mpp_mpi not being active)
-      !     nl* is set to the global values 1 and jp*glo.
-      ! -----------------------------------------------------------------
-
-      ishape(:,1) = (/ 1, nlei-nldi+1 /)
-      ishape(:,2) = (/ 1, nlej-nldj+1 /)
-      ishape(:,3) = (/ 1,           1 /)
-          
-      DO ji = 1, 4
-         CALL prism_def_grid( igrid(ji), 'orca'//clgrd(ji), ncomp_id, ishape, PRISM_irrlonlat_regvrt, nerror )
-         IF( nerror /= PRISM_Success )   CALL prism_abort (ncomp_id, 'cpl_prism_define',   &
-            &                                                        'Failure in prism_def_grid of '//clgrd(jg)//'-point' )
-      END DO
-      
-      ! -----------------------------------------------------------------
-      ! ... Define the partition 
-      ! -----------------------------------------------------------------
-      
-      iextent(1,:) = (/    nlei-nldi+1,    nlej-nldj+1, 1 /)
-      ioffset(1,:) = (/ nldi-1+nimpp-1, nldj-1+njmpp-1, 0 /)
-      
-      DO ji = 1, 4
-         CALL prism_def_partition( igrid(ji), 1, ioffset, iextent, nerror )
-         IF( nerror /= PRISM_Success )   CALL prism_abort (ncomp_id, 'cpl_prism_define',   &
-            &                                                        'Failure in prism_def_partition of '//clgrd(jg)//'-point' )
-      END DO
-
-      ! -----------------------------------------------------------------
-      ! ... Define the elements, i.e. specify the corner points for each
-      !     volume element. In case OPA runs on level coordinates (regular
-      !     in the vertical) we only need to give the 4 horizontal corners
-      !     for a volume element plus the vertical position of the upper
-      !     and lower face. Nevertheless the volume element has 8 corners.
-      ! -----------------------------------------------------------------
-      
-      iioff(:) = (/0,1,0,1/)
-      ijoff(:) = (/0,0,1,1/) 
-      iishift(:) = (/0,1,1,0/)
-      ijshift(:) = (/0,0,1,1/)
-
-      DO jg = 1, 4    ! ... the t,u,v,f-points
-
-         cltxt = clgrd(jg)//'-point'
-         
-         ! -----------------------------------------------------------------
-         ! ... Convert OPA masks to logicals and define the masks
-         ! -----------------------------------------------------------------
-         SELECT CASE( jg ) 
-         CASE(1)   ;   llmask(:,:,1) = ( tmask(:,:,1)  ) == 1.
-         CASE(2)   ;   llmask(:,:,1) = ( umask(:,:,1)  ) == 1.
-         CASE(3)   ;   llmask(:,:,1) = ( vmask(:,:,1)  ) == 1.
-         CASE(4)   ;   llmask(:,:,1) = ( fmask(:,:,1)  ) == 1.
-!         CASE(1)   ;   llmask(:,:,1) = ( tmask(:,:,1) * dom_uniq('T') ) == 1.
-!         CASE(2)   ;   llmask(:,:,1) = ( umask(:,:,1) * dom_uniq('U') ) == 1.
-!         CASE(3)   ;   llmask(:,:,1) = ( vmask(:,:,1) * dom_uniq('V') ) == 1.
-!         CASE(4)   ;   llmask(:,:,1) = ( fmask(:,:,1) * dom_uniq('F') ) == 1.
-         END SELECT
-         CALL prism_set_mask( imskid(jg), igrid(jg), ishape, llmask(nldi:nlei, nldj:nlej, 1), .TRUE., nerror )
-         IF( nerror /= PRISM_Success )   CALL prism_abort( ncomp_id, 'cpl_prism_define', 'Failure in prism_set_mask for '//cltxt )
-
-         ! -----------------------------------------------------------------
-         ! ... Define the corners
-         ! -----------------------------------------------------------------
-         SELECT CASE( jg ) 
-         CASE(1)   ;   zlon(:,:) = glamf(:,:)   ;   zlat(:,:) = gphif(:,:)
-         CASE(2)   ;   zlon(:,:) = glamv(:,:)   ;   zlat(:,:) = gphiv(:,:)
-         CASE(3)   ;   zlon(:,:) = glamu(:,:)   ;   zlat(:,:) = gphiu(:,:) 
-         CASE(4)   ;   zlon(:,:) = glamt(:,:)   ;   zlat(:,:) = gphit(:,:)
-         END SELECT
-
-         DO jc = 1, 4   ! corner number (anti-clockwise, starting from the bottom left corner)
-            DO jj = 2, jpjm1
-               DO ji = 2, jpim1   ! NO vector opt.
-                  ii = ji-1 + iioff(jg) + iishift(jc)
-                  ij = jj-1 + ijoff(jg) + ijshift(jc)
-                  zclo(ji,jj,jc) = zlon(ii,ij)
-                  zcla(ji,jj,jc) = zlat(ii,ij)
-               END DO
-            END DO
-            CALL lbc_lnk( zclo(:,:,jc), clgrd(jg), 1. )   ;   CALL lbc_lnk( zcla(:,:,jc), clgrd(jg), 1. )
-         END DO
-
-         CALL prism_set_corners( igrid(jg), 8, ishape, zclo(nldi:nlei, nldj:nlej,:),   &
-            &                                          zcla(nldi:nlei, nldj:nlej,:), RESHAPE( (/-1.,1./), (/1,2/) ), nerror )
-         IF( nerror /= PRISM_Success )   CALL prism_abort( ncomp_id, 'cpl_prism_define', 'Failure in prism_set_corners of '//cltxt )    
-
-         ! -----------------------------------------------------------------
-         ! ... Define the center points
-         ! -----------------------------------------------------------------
-         SELECT CASE( jg ) 
-         CASE(1)   ;   zlon(:,:) = glamt(:,:)   ;   zlat(:,:) = gphit(:,:)
-         CASE(2)   ;   zlon(:,:) = glamu(:,:)   ;   zlat(:,:) = gphiu(:,:)
-         CASE(3)   ;   zlon(:,:) = glamv(:,:)   ;   zlat(:,:) = gphiv(:,:)
-         CASE(4)   ;   zlon(:,:) = glamf(:,:)   ;   zlat(:,:) = gphif(:,:)
-         END SELECT
-
-         CALL prism_set_points ( iptid(jg), cltxt, igrid(jg), ishape, zlon(nldi:nlei, nldj:nlej),   &
-         &                                                            zlat(nldi:nlei, nldj:nlej), (/0./), .TRUE., nerror )
-         IF( nerror /= PRISM_Success )   CALL prism_abort ( ncomp_id, 'cpl_prism_define', 'Failure in prism_set_points '//cltxt )
-
-      END DO
-
-      ! ... Announce send variables. 
-      !
-      DO ji = 1, ksnd
-         IF ( ssnd(ji)%laction ) THEN 
-            
-            itmp(:) = 0
-            WHERE( clgrd == ssnd(ji)%clgrid  ) itmp = 1
-            ind(:) = maxloc( itmp )
-            WRITE(6,*) ' grid for field ', ind(1), ssnd(ji)%clname
-             ind(1) = 1
-
-            CALL prism_def_var( ssnd(ji)%nid, ssnd(ji)%clname, igrid(ind(1)), iptid(ind(1)),  imskid(ind(1)), (/ 3, 0/),   &
-               &                ishape, PRISM_Double_Precision, nerror )
-            IF ( nerror /= PRISM_Success )   CALL prism_abort( ssnd(ji)%nid, 'cpl_prism_define',   &
-               &                                               'Failure in prism_def_var for '//TRIM(ssnd(ji)%clname))
-
-         ENDIF
-      END DO
-      !
-      ! ... Announce received variables. 
-      !
-      DO ji = 1, krcv
-         IF ( srcv(ji)%laction ) THEN 
-
-            itmp(:) = 0
-            WHERE( clgrd == srcv(ji)%clgrid  ) itmp = 1
-            ind(:) = maxloc( itmp )
-            WRITE(6,*) ' grid for field ', ind(1), srcv(ji)%clname
-             ind(1) = 1
- 
-            CALL prism_def_var( srcv(ji)%nid, srcv(ji)%clname, igrid(ind(1)), iptid(ind(1)), imskid(ind(1)), (/ 3, 0/),   &
-               &                ishape, PRISM_Double_Precision, nerror )
-            IF ( nerror /= PRISM_Success )   CALL prism_abort( srcv(ji)%nid, 'cpl_prism_define',   &
-               &                                               'Failure in prism_def_var for '//TRIM(srcv(ji)%clname))
-
-         ENDIF
-      END DO
-      
-      !------------------------------------------------------------------
-      ! End of definition phase
-      !------------------------------------------------------------------
-      
-      CALL prism_enddef( nerror )
-      IF ( nerror /= PRISM_Success )   CALL prism_abort ( ncomp_id, 'cpl_prism_define', 'Failure in prism_enddef')
-      
-      CALL wrk_dealloc( jpi,jpj, zlon, zlat )
-      CALL wrk_dealloc( jpi,jpj,jpk, zclo, zcla )
-      !
-   END SUBROUTINE cpl_prism_define
-   
-   
-   SUBROUTINE cpl_prism_snd( kid, kstep, pdata, kinfo )
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_snd  ***
-      !!
-      !! ** Purpose : - At each coupling time-step,this routine sends fields
-      !!      like sst or ice cover to the coupler or remote application.
-      !!----------------------------------------------------------------------
-      INTEGER                 , INTENT(in   ) ::   kid     ! variable intex in the array
-      INTEGER                 , INTENT(  out) ::   kinfo   ! OASIS4 info argument
-      INTEGER                 , INTENT(in   ) ::   kstep   ! ocean time-step in seconds
-      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   pdata
-      !!--------------------------------------------------------------------
-      !
-      ! snd data to OASIS4
-      !
-      exfld(:,:,1) = pdata(nldi:nlei, nldj:nlej)
-      CALL prism_put( ssnd(kid)%nid, date, date_bound, exfld, kinfo, nerror )
-      IF ( nerror /= PRISM_Success )   CALL prism_abort( ssnd(kid)%nid, 'cpl_prism_snd',   &
-         &                                               'Failure in prism_put for '//TRIM(ssnd(kid)%clname) )
-
-      IF( ln_ctl ) THEN        
-         IF ( kinfo >= PRISM_Cpl     .OR. kinfo == PRISM_Rst .OR.   &
-            & kinfo == PRISM_RstTimeop ) THEN
-            WRITE(numout,*) '****************'
-            WRITE(numout,*) 'prism_put: Outgoing ', ssnd(kid)%clname
-            WRITE(numout,*) 'prism_put: ivarid ', ssnd(kid)%nid
-            WRITE(numout,*) 'prism_put:  kstep ', kstep
-            WRITE(numout,*) 'prism_put:   info ', kinfo
-            WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata)
-            WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata)
-            WRITE(numout,*) '     -     Sum value is ', SUM(pdata)
-            WRITE(numout,*) '****************'
-         ENDIF
-      ENDIF
-      !
-   END SUBROUTINE cpl_prism_snd
-
-
-   SUBROUTINE cpl_prism_rcv( kid, kstep, pdata, kinfo )
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_rcv  ***
-      !!
-      !! ** Purpose : - At each coupling time-step,this routine receives fields
-      !!      like stresses and fluxes from the coupler or remote application.
-      !!----------------------------------------------------------------------
-      INTEGER                 , INTENT(in   ) ::   kid     ! variable intex in the array
-      INTEGER                 , INTENT(in   ) ::   kstep   ! ocean time-step in seconds
-      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pdata   ! IN to keep the value if nothing is done
-      INTEGER                 , INTENT(  out) ::   kinfo   ! OASIS4 info argument
-      !
-      LOGICAL                :: llaction
-      !!--------------------------------------------------------------------
-      !
-      ! receive local data from OASIS4 on every process
-      !
-      CALL prism_get( srcv(kid)%nid, date, date_bound, exfld, kinfo, nerror )         
-      IF ( nerror /= PRISM_Success )   CALL prism_abort( srcv(kid)%nid, 'cpl_prism_rcv',   &
-         &                                               'Failure in prism_get for '//TRIM(srcv(kid)%clname) )
-
-      WRITE(numout,*) 'prism_get: Incoming ', srcv(kid)%clname
-      call flush(numout)
-      llaction = .false.
-      IF( kinfo == PRISM_Cpl )  llaction = .TRUE.
-
-      IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid
-
-      IF ( llaction ) THEN
-
-         kinfo = OASIS_Rcv
-         pdata(nldi:nlei, nldj:nlej) = exfld(:,:,1)
-         
-         !--- Fill the overlap areas and extra hallows (mpp)
-         !--- check periodicity conditions (all cases)
-         CALL lbc_lnk( pdata, srcv(kid)%clgrid, srcv(kid)%nsgn )   
-         
-         IF ( ln_ctl ) THEN        
-            WRITE(numout,*) '****************'
-            WRITE(numout,*) 'prism_get: Incoming ', srcv(kid)%clname
-            WRITE(numout,*) 'prism_get: ivarid '  , srcv(kid)%nid
-            WRITE(numout,*) 'prism_get:   kstep', kstep
-            WRITE(numout,*) 'prism_get:   info ', kinfo
-            WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata)
-            WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata)
-            WRITE(numout,*) '     -     Sum value is ', SUM(pdata)
-            WRITE(numout,*) '****************'
-         ENDIF
-
-      ELSE
-         kinfo = OASIS_idle     
-      ENDIF
-      !
-   END SUBROUTINE cpl_prism_rcv
-
-
-   SUBROUTINE cpl_prism_finalize
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_finalize  ***
-      !!
-      !! ** Purpose : - Finalizes the coupling. If MPI_init has not been
-      !!      called explicitly before cpl_prism_init it will also close
-      !!      MPI communication.
-      !!----------------------------------------------------------------------
-      !
-      DEALLOCATE(exfld)
-      CALL prism_terminate ( nerror )         
-      !
-   END SUBROUTINE cpl_prism_finalize
-
-
-   SUBROUTINE cpl_prism_update_time(kt)
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_update_time  ***
-      !!
-      !! ** Purpose : - Increment date with model timestep
-      !!                called explicitly at the end of each timestep
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean model time step index
-
-      TYPE(PRISM_Time_struct) ::   tmpdate
-      INTEGER                 ::   idate_incr   ! date increment
-      !!----------------------------------------------------------------------
-
-      IF( kt == nit000 ) THEN      ! Define the actual date 
-         !
-         ! date is determined by adding days since beginning of the run to the corresponding initial date.
-         ! Note that OPA internal info about the start date of the experiment is bypassed.
-         ! Instead we rely sololy on the info provided by the SCC.xml file.
-         !
-         date = PRISM_Jobstart_date
-         !
-         !
-         ! lower/upper bound is determined by adding half a time step
-         !
-         idate_incr = 0.5 * NINT ( rdttra(1) )
-         tmpdate = date   ;   CALL PRISM_calc_newdate ( tmpdate, -idate_incr, nerror )   ;   date_bound(1) = tmpdate
-         tmpdate = date   ;   CALL PRISM_calc_newdate ( tmpdate,  idate_incr, nerror )   ;   date_bound(2) = tmpdate
-         !
-      ELSE      ! Date update
-         !
-         idate_incr  = rdttra(1)
-         CALL PRISM_calc_newdate( date, idate_incr, nerror )
-         date_bound(1) = date_bound(2)
-         tmpdate = date_bound(2)
-         CALL PRISM_calc_newdate( tmpdate, idate_incr, nerror )
-         date_bound(2) = tmpdate
-         !
-      END IF
-      !
-   END SUBROUTINE cpl_prism_update_time
-
-#endif
-
-   !!=====================================================================
-END MODULE cpl_oasis4
Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/oasis4_date.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/oasis4_date.F90	(revision 4856)
+++ 	(revision )
@@ -1,41 +1,0 @@
-MODULE oasis4_date
-   !!======================================================================
-   !!                     ***  MODULE oasis_date  ***  
-   !!   Date and related information required to couple NEMO via OASIS4
-   !!   Made separate from cpl_oasis4 module to allow wider use.
-   !!======================================================================
-   !! History :  2.0  ! 2005-12  (R. Hill, Met. Office) Original code
-   !!----------------------------------------------------------------------
-#if defined key_oasis4
-   !!----------------------------------------------------------------------
-   !!   'key_oasis4'                                   coupled with OASIS-4
-   !!----------------------------------------------------------------------
-   !##################### WARNING coupled mode ###############################
-   !##################### WARNING coupled mode ###############################
-   !   Following line must be enabled if coupling with OASIS
-   !   USE PRISM
-   !##################### WARNING coupled mode ###############################
-   !##################### WARNING coupled mode ###############################
-
-   PRIVATE
-   IMPLICIT NONE
-
-   INTEGER, PUBLIC :: date_err, date_info   !: 
-
-   TYPE(PRISM_Time_struct), PUBLIC ::   dates            !: date info for send operation
-   TYPE(PRISM_Time_struct), PUBLIC ::   dates_bound(2)   !: date info for send operation
-   TYPE(PRISM_Time_struct), PUBLIC ::   dater            !: date info for receive operation
-   TYPE(PRISM_Time_struct), PUBLIC ::   dater_bound(2)   !: date info for receive operation
-   TYPE(PRISM_Time_struct), PUBLIC ::   tmpdate          !:
-   
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option            Dummy module                   NO OASIS-4
-   !!----------------------------------------------------------------------
-#endif
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id$
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!======================================================================
-END MODULE oasis4_date
Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 4856)
+++ branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 4857)
@@ -9,7 +9,4 @@
    !!            3.4  ! 2011_11  (C. Harris) more flexibility + multi-category fields
    !!----------------------------------------------------------------------
-#if defined key_oasis3 || defined key_oasis4
-   !!----------------------------------------------------------------------
-   !!   'key_oasis3' or 'key_oasis4'   Coupled Ocean/Atmosphere formulation
    !!----------------------------------------------------------------------
    !!   namsbc_cpl      : coupled formulation namlist
@@ -34,10 +31,5 @@
    USE ice_2           ! ice variables
 #endif
-#if defined key_oasis3
    USE cpl_oasis3      ! OASIS3 coupling
-#endif
-#if defined key_oasis4
-   USE cpl_oasis4      ! OASIS4 coupling
-#endif
    USE geo2ocean       ! 
    USE oce   , ONLY : tsn, un, vn
@@ -58,5 +50,6 @@
    IMPLICIT NONE
    PRIVATE
-
+!EM XIOS-OASIS-MCT compliance
+   PUBLIC   sbc_cpl_init       ! routine called by sbcmod.F90
    PUBLIC   sbc_cpl_rcv        ! routine called by sbc_ice_lim(_2).F90
    PUBLIC   sbc_cpl_snd        ! routine called by step.F90
@@ -604,7 +597,7 @@
       ! ================================ !
 
-      CALL cpl_prism_define(jprcv, jpsnd)            
-      !
-      IF( ln_dm2dc .AND. ( cpl_prism_freq( jpr_qsroce ) + cpl_prism_freq( jpr_qsrmix ) /= 86400 ) )   &
+      CALL cpl_define(jprcv, jpsnd)            
+      !
+      IF( ln_dm2dc .AND. ( cpl_freq( jpr_qsroce ) + cpl_freq( jpr_qsrmix ) /= 86400 ) )   &
          &   CALL ctl_stop( 'sbc_cpl_init: diurnal cycle reconstruction (ln_dm2dc) needs daily couping for solar radiation' )
 
@@ -678,11 +671,8 @@
       !
       CALL wrk_alloc( jpi,jpj, ztx, zty )
-
-      IF( kt == nit000 )   CALL sbc_cpl_init( k_ice )          ! initialisation
-
       !                                                 ! Receive all the atmos. fields (including ice information)
       isec = ( kt - nit000 ) * NINT( rdttra(1) )             ! date of exchanges
       DO jn = 1, jprcv                                       ! received fields sent by the atmosphere
-         IF( srcv(jn)%laction )   CALL cpl_prism_rcv( jn, isec, frcv(jn)%z3, nrcvinfo(jn) )
+         IF( srcv(jn)%laction )   CALL cpl_rcv( jn, isec, frcv(jn)%z3, nrcvinfo(jn) )
       END DO
 
@@ -1334,5 +1324,5 @@
       !! ** Purpose :   provide the ocean-ice informations to the atmosphere
       !!
-      !! ** Method  :   send to the atmosphere through a call to cpl_prism_snd
+      !! ** Method  :   send to the atmosphere through a call to cpl_snd
       !!              all the needed fields (as defined in sbc_cpl_init)
       !!----------------------------------------------------------------------
@@ -1378,7 +1368,7 @@
          CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%cldes' )
          END SELECT
-         IF( ssnd(jps_toce)%laction )   CALL cpl_prism_snd( jps_toce, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
-         IF( ssnd(jps_tice)%laction )   CALL cpl_prism_snd( jps_tice, isec, ztmp3, info )
-         IF( ssnd(jps_tmix)%laction )   CALL cpl_prism_snd( jps_tmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         IF( ssnd(jps_toce)%laction )   CALL cpl_snd( jps_toce, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         IF( ssnd(jps_tice)%laction )   CALL cpl_snd( jps_tice, isec, ztmp3, info )
+         IF( ssnd(jps_tmix)%laction )   CALL cpl_snd( jps_tmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
       ENDIF
       !
@@ -1388,5 +1378,5 @@
       IF( ssnd(jps_albice)%laction ) THEN                         ! ice 
          ztmp3(:,:,1:jpl) = alb_ice(:,:,1:jpl) * a_i(:,:,1:jpl)
-         CALL cpl_prism_snd( jps_albice, isec, ztmp3, info )
+         CALL cpl_snd( jps_albice, isec, ztmp3, info )
       ENDIF
       IF( ssnd(jps_albmix)%laction ) THEN                         ! mixed ice-ocean
@@ -1395,5 +1385,5 @@
             ztmp1(:,:) = ztmp1(:,:) + alb_ice(:,:,jl) * a_i(:,:,jl)
          ENDDO
-         CALL cpl_prism_snd( jps_albmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
+         CALL cpl_snd( jps_albmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
       ENDIF
       !                                                      ! ------------------------- !
@@ -1407,5 +1397,5 @@
          CASE default    ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' )
          END SELECT
-         CALL cpl_prism_snd( jps_fice, isec, ztmp3, info )
+         CALL cpl_snd( jps_fice, isec, ztmp3, info )
       ENDIF
 
@@ -1432,6 +1422,6 @@
          CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%cldes' )
          END SELECT
-         IF( ssnd(jps_hice)%laction )   CALL cpl_prism_snd( jps_hice, isec, ztmp3, info )
-         IF( ssnd(jps_hsnw)%laction )   CALL cpl_prism_snd( jps_hsnw, isec, ztmp4, info )
+         IF( ssnd(jps_hice)%laction )   CALL cpl_snd( jps_hice, isec, ztmp3, info )
+         IF( ssnd(jps_hsnw)%laction )   CALL cpl_snd( jps_hsnw, isec, ztmp4, info )
       ENDIF
       !
@@ -1440,5 +1430,5 @@
       !                                                      !  CO2 flux from PISCES     ! 
       !                                                      ! ------------------------- !
-      IF( ssnd(jps_co2)%laction )   CALL cpl_prism_snd( jps_co2, isec, RESHAPE ( oce_co2, (/jpi,jpj,1/) ) , info )
+      IF( ssnd(jps_co2)%laction )   CALL cpl_snd( jps_co2, isec, RESHAPE ( oce_co2, (/jpi,jpj,1/) ) , info )
       !
 #endif
@@ -1563,11 +1553,11 @@
          ENDIF
          !
-         IF( ssnd(jps_ocx1)%laction )   CALL cpl_prism_snd( jps_ocx1, isec, RESHAPE ( zotx1, (/jpi,jpj,1/) ), info )   ! ocean x current 1st grid
-         IF( ssnd(jps_ocy1)%laction )   CALL cpl_prism_snd( jps_ocy1, isec, RESHAPE ( zoty1, (/jpi,jpj,1/) ), info )   ! ocean y current 1st grid
-         IF( ssnd(jps_ocz1)%laction )   CALL cpl_prism_snd( jps_ocz1, isec, RESHAPE ( zotz1, (/jpi,jpj,1/) ), info )   ! ocean z current 1st grid
+         IF( ssnd(jps_ocx1)%laction )   CALL cpl_snd( jps_ocx1, isec, RESHAPE ( zotx1, (/jpi,jpj,1/) ), info )   ! ocean x current 1st grid
+         IF( ssnd(jps_ocy1)%laction )   CALL cpl_snd( jps_ocy1, isec, RESHAPE ( zoty1, (/jpi,jpj,1/) ), info )   ! ocean y current 1st grid
+         IF( ssnd(jps_ocz1)%laction )   CALL cpl_snd( jps_ocz1, isec, RESHAPE ( zotz1, (/jpi,jpj,1/) ), info )   ! ocean z current 1st grid
          !
-         IF( ssnd(jps_ivx1)%laction )   CALL cpl_prism_snd( jps_ivx1, isec, RESHAPE ( zitx1, (/jpi,jpj,1/) ), info )   ! ice   x current 1st grid
-         IF( ssnd(jps_ivy1)%laction )   CALL cpl_prism_snd( jps_ivy1, isec, RESHAPE ( zity1, (/jpi,jpj,1/) ), info )   ! ice   y current 1st grid
-         IF( ssnd(jps_ivz1)%laction )   CALL cpl_prism_snd( jps_ivz1, isec, RESHAPE ( zitz1, (/jpi,jpj,1/) ), info )   ! ice   z current 1st grid
+         IF( ssnd(jps_ivx1)%laction )   CALL cpl_snd( jps_ivx1, isec, RESHAPE ( zitx1, (/jpi,jpj,1/) ), info )   ! ice   x current 1st grid
+         IF( ssnd(jps_ivy1)%laction )   CALL cpl_snd( jps_ivy1, isec, RESHAPE ( zity1, (/jpi,jpj,1/) ), info )   ! ice   y current 1st grid
+         IF( ssnd(jps_ivz1)%laction )   CALL cpl_snd( jps_ivz1, isec, RESHAPE ( zitz1, (/jpi,jpj,1/) ), info )   ! ice   z current 1st grid
          ! 
       ENDIF
@@ -1580,35 +1570,4 @@
    END SUBROUTINE sbc_cpl_snd
    
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                            NO coupling
-   !!----------------------------------------------------------------------
-   USE par_kind        ! kind definition
-CONTAINS
-   SUBROUTINE sbc_cpl_snd( kt )
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', kt
-   END SUBROUTINE sbc_cpl_snd
-   !
-   SUBROUTINE sbc_cpl_rcv( kt, k_fsbc, k_ice )     
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', kt, k_fsbc, k_ice
-   END SUBROUTINE sbc_cpl_rcv
-   !
-   SUBROUTINE sbc_cpl_ice_tau( p_taui, p_tauj )     
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_taui   ! i- & j-components of atmos-ice stress [N/m2]
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_tauj   ! at I-point (B-grid) or U & V-point (C-grid)
-      p_taui(:,:) = 0.   ;   p_tauj(:,:) = 0. ! stupid definition to avoid warning message when compiling...
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?'
-   END SUBROUTINE sbc_cpl_ice_tau
-   !
-   SUBROUTINE sbc_cpl_ice_flx( p_frld , palbi   , psst    , pist  )
-      REAL(wp), INTENT(in   ), DIMENSION(:,:  ) ::   p_frld     ! lead fraction                [0 to 1]
-      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   palbi   ! ice albedo
-      REAL(wp), INTENT(in   ), DIMENSION(:,:  ), OPTIONAL ::   psst    ! sea surface temperature      [Celcius]
-      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   pist    ! ice surface temperature      [Kelvin]
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', p_frld(1,1), palbi(1,1,1), psst(1,1), pist(1,1,1) 
-   END SUBROUTINE sbc_cpl_ice_flx
-   
-#endif
-
    !!======================================================================
 END MODULE sbccpl
Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 4856)
+++ branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 4857)
@@ -611,5 +611,4 @@
 
 
-#if defined key_oasis3 || defined key_oasis4
    SUBROUTINE cice_sbc_hadgam( kt )
       !!---------------------------------------------------------------------
@@ -653,10 +652,4 @@
    END SUBROUTINE cice_sbc_hadgam
 
-#else
-   SUBROUTINE cice_sbc_hadgam( kt )    ! Dummy routine
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-      WRITE(*,*) 'cice_sbc_hadgam: You should not have seen this print! error?'
-   END SUBROUTINE cice_sbc_hadgam
-#endif
 
    SUBROUTINE cice_sbc_final
Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 4856)
+++ branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 4857)
@@ -265,4 +265,6 @@
       IF( nn_ice == 4 )   CALL cice_sbc_init( nsbc )      ! CICE initialisation
       !
+      IF( nsbc   == 5 )   CALL sbc_cpl_init (nn_ice)      ! OASIS initialisation. must be done before first time step
+
    END SUBROUTINE sbc_init
 
@@ -337,5 +339,4 @@
       CASE(  2 )   ;         CALL sbc_ice_lim_2( kt, nsbc )          ! LIM-2 ice model
       CASE(  3 )   ;         CALL sbc_ice_lim  ( kt, nsbc )          ! LIM-3 ice model
-      !is it useful?
       CASE(  4 )   ;         CALL sbc_ice_cice ( kt, nsbc )          ! CICE ice model
       END SELECT                                              
Index: branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 4856)
+++ branches/2014/dev_4728_CNRS04_coupled_interface/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 4857)
@@ -69,9 +69,5 @@
    USE icbini          ! handle bergs, initialisation
    USE icbstp          ! handle bergs, calving, themodynamics and transport
-#if defined key_oasis3
    USE cpl_oasis3      ! OASIS3 coupling
-#elif defined key_oasis4
-   USE cpl_oasis4      ! OASIS4 coupling (not working)
-#endif
    USE c1d             ! 1D configuration
    USE step_c1d        ! Time stepping loop for the 1D configuration
@@ -201,15 +197,14 @@
       !
       CALL nemo_closefile
+      !
 #if defined key_iomput
       CALL xios_finalize                ! end mpp communications with xios
-# if defined key_oasis3 || defined key_oasis4
-      CALL cpl_prism_finalize           ! end coupling and mpp communications with OASIS
-# endif
+      IF( lk_cpl ) CALL cpl_finalize    ! end coupling and mpp communications with OASIS
 #else
-# if defined key_oasis3 || defined key_oasis4
-      CALL cpl_prism_finalize           ! end coupling and mpp communications with OASIS
-# else
-      IF( lk_mpp )   CALL mppstop       ! end mpp communications
-# endif
+      IF( lk_cpl ) THEN 
+         CALL cpl_finalize              ! end coupling and mpp communications with OASIS
+      ELSE
+         IF( lk_mpp )   CALL mppstop    ! end mpp communications
+      ENDIF
 #endif
       !
@@ -281,22 +276,22 @@
 #if defined key_iomput
       IF( Agrif_Root() ) THEN
-# if defined key_oasis3 || defined key_oasis4
-         CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis
-         CALL xios_initialize( "oceanx",local_comm=ilocal_comm )
-# else
-         CALL  xios_initialize( "nemo",return_comm=ilocal_comm )
-# endif
+         IF( lk_cpl ) THEN
+            CALL cpl_init( ilocal_comm )                               ! nemo local communicator given by oasis
+            CALL xios_initialize( "oceanx",local_comm=ilocal_comm )    ! send nemo communicator to xios
+         ELSE
+            CALL  xios_initialize( "nemo",return_comm=ilocal_comm )    ! nemo local communicator given by xios
+         ENDIF
       ENDIF
       narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection
 #else
-# if defined key_oasis3 || defined key_oasis4
-      IF( Agrif_Root() ) THEN
-         CALL cpl_prism_init( ilocal_comm )                 ! nemo local communicator given by oasis
-      ENDIF
-      narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection (control print return in cltxt)
-# else
-      ilocal_comm = 0
-      narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop )                 ! Nodes selection (control print return in cltxt)
-# endif
+      IF( lk_cpl ) THEN
+         IF( Agrif_Root() ) THEN
+            CALL cpl_init( ilocal_comm )                       ! nemo local communicator given by oasis
+         ENDIF
+         narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection (control print return in cltxt)
+      ELSE
+         ilocal_comm = 0
+         narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop )                ! Nodes selection (control print return in cltxt)
+      ENDIF
 #endif
       narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 )
