Index: trunk/NEMO/OPA_SRC/lib_mpp.F90
===================================================================
--- trunk/NEMO/OPA_SRC/lib_mpp.F90	(revision 299)
+++ trunk/NEMO/OPA_SRC/lib_mpp.F90	(revision 300)
@@ -81,6 +81,4 @@
    !! * Share module variables
    LOGICAL, PUBLIC, PARAMETER ::   lk_mpp = .TRUE.       !: mpp flag
-   LOGICAL, PUBLIC ::   lk_bsend = .FALSE.       !: mpp_bsend flag
-   LOGICAL, PUBLIC ::   lk_isend = .FALSE.       !: mpp_isend flag
 
 
@@ -112,4 +110,8 @@
    INTEGER, DIMENSION(:), ALLOCATABLE ::   &
       nrank_north          ! dimension ndim_rank_north, number of the procs belonging to ncomm_north
+   CHARACTER (len=1) ::  &
+      c_mpi_send = 'S'     ! type od mpi send/recieve (S=standard, B=bsend, I=isend)
+   LOGICAL  ::           &
+      l_isend = .FALSE.    ! isend use indicator (T if c_mpi_send='I')
 
 
@@ -260,19 +262,36 @@
       !! * Local variables   (MPI version)
       INTEGER ::   mynode, ierr
-      !!----------------------------------------------------------------------
-      ! Enroll in MPI
-      ! -------------
-#  if defined key_mpi_bsend
-      lk_bsend = .TRUE.       !: mpp_bsend flag
-#  endif
-#  if defined key_mpi_isend
-      lk_isend = .TRUE.       !: mpp_isend flag
-#  endif
-
-      IF(lk_bsend) THEN
+      NAMELIST/nam_mpp/ c_mpi_send
+      !!----------------------------------------------------------------------
+
+      WRITE(numout,*)
+      WRITE(numout,*) 'mynode : mpi initialisation'
+      WRITE(numout,*) '~~~~~~ '
+      WRITE(numout,*)
+
+      ! Namelist namrun : parameters of the run
+      REWIND( numnam )
+      READ  ( numnam, nam_mpp )
+
+      WRITE(numout,*) '        Namelist nam_mpp'
+      WRITE(numout,*) '           mpi send type            c_mpi_send = ', c_mpi_send
+
+      SELECT CASE ( c_mpi_send )
+      CASE ( 'S' )                ! Standard mpi send (blocking)
+         WRITE(numout,*) '           Standard blocking mpi send (send)'
+         CALL mpi_init( ierr )
+      CASE ( 'B' )                ! Buffer mpi send (blocking)
+         WRITE(numout,*) '           Buffer blocking mpi send (bsend)'
          CALL mpi_init_opa( ierr )
-      ELSE
+      CASE ( 'I' )                ! Immediate mpi send (non-blocking send)
+         WRITE(numout,*) '           Immediate non-blocking send (isend)'
+         l_isend = .TRUE.
          CALL mpi_init( ierr )
-      ENDIF
+      CASE DEFAULT
+         WRITE(numout,cform_err)
+         WRITE(numout,*) '           bad value for c_mpi_send = ', c_mpi_send
+         nstop = nstop + 1
+      END SELECT
+
       CALL mpi_comm_rank( mpi_comm_world, rank, ierr )
       CALL mpi_comm_size( mpi_comm_world, size, ierr )
@@ -606,5 +625,5 @@
          CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req1 )
          CALL mpprecv( 1, t3ew(1,1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
       CASE ( 0 )
          CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
@@ -612,10 +631,10 @@
          CALL mpprecv( 1, t3ew(1,1,1,2), imigr )
          CALL mpprecv( 2, t3we(1,1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
-         IF(lk_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
       CASE ( 1 )
          CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
          CALL mpprecv( 2, t3we(1,1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
       END SELECT
 #endif
@@ -684,5 +703,5 @@
          CALL mppsend( 4, t3sn(1,1,1,1), imigr, nono, ml_req1 )
          CALL mpprecv( 3, t3ns(1,1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
       CASE ( 0 )
          CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 )
@@ -690,10 +709,10 @@
          CALL mpprecv( 3, t3ns(1,1,1,2), imigr )
          CALL mpprecv( 4, t3sn(1,1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
-         IF(lk_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err)
       CASE ( 1 ) 
          CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 )
          CALL mpprecv( 4, t3sn(1,1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
       END SELECT
 
@@ -885,5 +904,5 @@
             CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req1 )
             CALL mpprecv( 1, t3ew(1,1,1,2), imigr )
-            IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
          CASE ( 0 )
             CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
@@ -891,10 +910,10 @@
             CALL mpprecv( 1, t3ew(1,1,1,2), imigr )
             CALL mpprecv( 2, t3we(1,1,1,2), imigr )
-            IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-            IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
          CASE ( 1 )
             CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 )
             CALL mpprecv( 2, t3we(1,1,1,2), imigr )
-            IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
          END SELECT
 #endif
@@ -1041,5 +1060,5 @@
          CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req1 )
          CALL mpprecv( 1, t2ew(1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
       CASE ( 0 )
          CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
@@ -1047,10 +1066,10 @@
          CALL mpprecv( 1, t2ew(1,1,2), imigr )
          CALL mpprecv( 2, t2we(1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-         IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
       CASE ( 1 )
          CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
          CALL mpprecv( 2, t2we(1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
       END SELECT
 
@@ -1118,5 +1137,5 @@
          CALL mppsend( 4, t2sn(1,1,1), imigr, nono, ml_req1 )
          CALL mpprecv( 3, t2ns(1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
       CASE ( 0 )
          CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 )
@@ -1124,10 +1143,10 @@
          CALL mpprecv( 3, t2ns(1,1,2), imigr )
          CALL mpprecv( 4, t2sn(1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-         IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
       CASE ( 1 )
          CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 )
          CALL mpprecv( 4, t2sn(1,1,2), imigr )
-         IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
       END SELECT
   
@@ -1317,5 +1336,5 @@
             CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req1 )
             CALL mpprecv( 1, t2ew(1,1,2), imigr )
-            IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
          CASE ( 0 )
             CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
@@ -1323,10 +1342,10 @@
             CALL mpprecv( 1, t2ew(1,1,2), imigr )
             CALL mpprecv( 2, t2we(1,1,2), imigr )
-            IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-            IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
          CASE ( 1 )
             CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 )
             CALL mpprecv( 2, t2we(1,1,2), imigr )
-            IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
          END SELECT 
 #endif
@@ -1424,5 +1443,5 @@
        CALL mppsend(3,t2p1(1,1,1),imigr,nono, ml_req1)
        CALL mpprecv(3,t2p1(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
 
 #endif      
@@ -1453,5 +1472,5 @@
        CALL mppsend(3,t2p1(1,1,1),imigr,nono, ml_req1)
        CALL mpprecv(3,t2p1(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
 
 #endif      
@@ -1516,5 +1535,5 @@
        CALL mppsend(2,t2we(1,1,1),imigr,noea, ml_req1)
        CALL mpprecv(1,t2ew(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
     CASE ( 0 )
        CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1)
@@ -1522,11 +1541,11 @@
        CALL mpprecv(1,t2ew(1,1,2),imigr)
        CALL mpprecv(2,t2we(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-       IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
 
     CASE ( 1 )
        CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1)
        CALL mpprecv(2,t2we(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
 
     END SELECT
@@ -1609,5 +1628,5 @@
        CALL mppsend(4,t2sn(1,1,1),imigr,nono, ml_req1)
        CALL mpprecv(3,t2ns(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
 
     CASE ( 0 )
@@ -1616,11 +1635,11 @@
        CALL mpprecv(3,t2ns(1,1,2),imigr)
        CALL mpprecv(4,t2sn(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-       IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
 
     CASE ( 1 )
        CALL mppsend(3,t2ns(1,1,1),imigr,noso, ml_req1)
        CALL mpprecv(4,t2sn(1,1,2),imigr)
-       IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
     END SELECT
 
@@ -1675,15 +1694,16 @@
       INTEGER ::   iflag
 
-     IF(lk_bsend) THEN
-       CALL mpi_bsend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   &
-         &                          mpi_comm_world, iflag )
-     ELSEIF (lk_isend) THEN
-! Carefull here : one more argument for mpi_isend : the mpi request identifier..
-       CALL mpi_isend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   &
-         &                          mpi_comm_world, md_req, iflag )
-     ELSE
-       CALL mpi_send( pmess, kbytes, mpi_double_precision, kdest, ktyp,   &
-         &                          mpi_comm_world, iflag )
-     ENDIF
+      SELECT CASE ( c_mpi_send )
+      CASE ( 'S' )                ! Standard mpi send (blocking)
+         CALL mpi_send ( pmess, kbytes, mpi_double_precision, kdest, ktyp,   &
+            &                          mpi_comm_world, iflag )
+      CASE ( 'B' )                ! Buffer mpi send (blocking)
+         CALL mpi_bsend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   &
+            &                          mpi_comm_world, iflag )
+      CASE ( 'I' )                ! Immediate mpi send (non-blocking send)
+         ! Be carefull, one more argument here : the mpi request identifier..
+         CALL mpi_isend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   &
+            &                          mpi_comm_world, md_req, iflag )
+      END SELECT
 #endif
 
@@ -2934,5 +2954,5 @@
           CALL mppsend(2,t2we(1,1,1),imigr,noea, ml_req1)
           CALL mpprecv(1,t2ew(1,1,2),imigr)
-          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
        ELSEIF( nbondi == 0 ) THEN
           CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1)
@@ -2940,10 +2960,10 @@
           CALL mpprecv(1,t2ew(1,1,2),imigr)
           CALL mpprecv(2,t2we(1,1,2),imigr)
-          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-          IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
        ELSEIF( nbondi == 1 ) THEN
           CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1)
           CALL mpprecv(2,t2we(1,1,2),imigr)
-          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
        ENDIF
 #endif
@@ -3005,5 +3025,5 @@
           CALL mppsend(4,t2sn(1,1,1),imigr,nono, ml_req1)
           CALL mpprecv(3,t2ns(1,1,2),imigr)
-          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
        ELSEIF( nbondj == 0 ) THEN
           CALL mppsend(3,t2ns(1,1,1),imigr,noso, ml_req1)
@@ -3011,10 +3031,10 @@
           CALL mpprecv(3,t2ns(1,1,2),imigr)
           CALL mpprecv(4,t2sn(1,1,2),imigr)
-          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
-          IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err)
        ELSEIF( nbondj == 1 ) THEN
           CALL mppsend(3,t2ns(1,1,1),imigr,noso, ml_req1)
           CALL mpprecv(4,t2sn(1,1,2),imigr)
-          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
+          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err)
        ENDIF
 
Index: trunk/NEMO/OPA_SRC/opa.F90
===================================================================
--- trunk/NEMO/OPA_SRC/opa.F90	(revision 299)
+++ trunk/NEMO/OPA_SRC/opa.F90	(revision 300)
@@ -8,4 +8,5 @@
    !!   opa_model      : solve ocean dynamics, tracer and/or sea-ice
    !!   opa_flg        : initialisation of algorithm flag 
+   !!   opa_closefile  : close remaining files
    !!----------------------------------------------------------------------
    !! * Modules used
@@ -123,4 +124,11 @@
       OPEN( UNIT=numnam, FILE='namelist', FORM='FORMATTED', STATUS='OLD' )
 
+      WRITE(numout,*)
+      WRITE(numout,*) '                 L O D Y C - I P S L'
+      WRITE(numout,*) '                     O P A model'
+      WRITE(numout,*) '            Ocean General Circulation Model'
+      WRITE(numout,*) '               version OPA 9.0  (2005) '
+      WRITE(numout,*)
+      WRITE(numout,*)
 
       ! Nodes selection
@@ -128,15 +136,4 @@
       narea = narea + 1    ! mynode return the rank of proc (0 --> jpnij -1 )
       lwp   = narea == 1
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) '                 L O D Y C - I P S L'
-         WRITE(numout,*) '                     O P A model'
-         WRITE(numout,*) '            Ocean General Circulation Model'
-         WRITE(numout,*) '               version OPA 9.0  (2005) '
-         WRITE(numout,*)
-         WRITE(numout,*) '                   PROC number: ', narea
-         WRITE(numout,*)
-      ENDIF
 
       !                                     ! ============================== !
