Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mppini.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mppini.F90	(revision 10421)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mppini.F90	(revision 10422)
@@ -149,5 +149,6 @@
       INTEGER ::   iarea0                     !   -       -
       INTEGER ::   ierr, ios                  ! 
-      INTEGER ::   inbi, inbj, iimax,  ijmax  ! 
+      INTEGER ::   inbi, inbj, iimax,  ijmax, icnt1, icnt2
+      LOGICAL ::   llbest
       INTEGER, ALLOCATABLE, DIMENSION(:)     ::   iin, ii_nono, ii_noea          ! 1D workspace
       INTEGER, ALLOCATABLE, DIMENSION(:)     ::   ijn, ii_noso, ii_nowe          !  -     -
@@ -184,14 +185,19 @@
       IF( jpni < 1 .OR. jpnj < 1 ) THEN
          CALL mpp_init_bestpartition( mppsize, jpni, jpnj )
+         llbest = .TRUE.
       ELSE
-         CALL mpp_init_bestpartition( mppsize, inbi, inbj )
+         CALL mpp_init_bestpartition( mppsize, inbi, inbj, icnt2 )
          CALL mpp_basic_decomposition( jpni, jpnj, jpimax, jpjmax )
          CALL mpp_basic_decomposition( inbi, inbj,  iimax,  ijmax )
          IF( iimax*ijmax < jpimax*jpjmax ) THEN
-            WRITE(ctmp1,*) '   The chosen domain decomposition ', jpni, jpnj
-            WRITE(ctmp2,*) '   has larger MPI subdomains ', jpimax, jpjmax, jpimax*jpjmax
-            WRITE(ctmp3,*) '   than the following domain decompostion ', inbi, inbj
-            WRITE(ctmp4,*) '   which MPI subdomains size is ', iimax, ijmax, iimax*ijmax
-            CALL ctl_warn( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4, '    --- YOU ARE WASTING CPU... ---' )
+            llbest = .FALSE.
+            icnt1 = jpni*jpnj - mppsize
+            WRITE(ctmp1,9000) '   The chosen domain decomposition ', jpni, ' x ', jpnj, ' with ', icnt1, ' land sub-domains'
+            WRITE(ctmp2,9000) '   has larger MPI subdomains (jpi = ', jpimax, ', jpj = ', jpjmax, ', jpi*jpj = ', jpimax*jpjmax, ')'
+            WRITE(ctmp3,9000) '   than the following domain decompostion ', inbi, ' x ', inbj, ' with ', icnt2, ' land sub-domains'
+            WRITE(ctmp4,9000) '   which MPI subdomains size is jpi = ', iimax, ', jpj = ', ijmax, ', jpi*jpj = ', iimax*ijmax, ' '
+            CALL ctl_warn( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4, ' ', '    --- YOU ARE WASTING CPU... ---', ' ' )
+         ELSE
+            llbest = .TRUE.
          ENDIF
       ENDIF
@@ -203,7 +209,7 @@
 
       IF( mppsize < inijmin ) THEN
-         WRITE(ctmp1,*) '   With this specified domain decomposition: jpni =', jpni, ' jpnj =', jpnj
-         WRITE(ctmp2,*) '   we can eliminate only ', jpni*jpnj - inijmin, ' land mpi subdomains therefore '
-         WRITE(ctmp3,*) '   the number of ocean mpi subdomains (', inijmin,') exceed the number of MPI processes:', mppsize
+         WRITE(ctmp1,9001) '   With this specified domain decomposition: jpni = ', jpni, ' jpnj = ', jpnj
+         WRITE(ctmp2,9002) '   we can eliminate only ', jpni*jpnj - inijmin, ' land mpi subdomains therefore '
+         WRITE(ctmp3,9001) '   the number of ocean mpi subdomains (', inijmin,') exceed the number of MPI processes:', mppsize
          WRITE(ctmp4,*) '   ==>>> There is the list of best domain decompositions you should use: '
          CALL ctl_stop( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4 )
@@ -213,7 +219,7 @@
 
       IF( mppsize > jpni*jpnj ) THEN
-         WRITE(ctmp1,*) '   The number of mpi processes: ', mppsize
-         WRITE(ctmp2,*) '   exceeds the maximum number of subdomains (ocean+land) = ', jpni*jpnj
-         WRITE(ctmp3,*) '   defined by the following domain decomposition: jpni =', jpni, ' jpnj =', jpnj
+         WRITE(ctmp1,9003) '   The number of mpi processes: ', mppsize
+         WRITE(ctmp2,9003) '   exceeds the maximum number of subdomains (ocean+land) = ', jpni*jpnj
+         WRITE(ctmp3,9001) '   defined by the following domain decomposition: jpni = ', jpni, ' jpnj = ', jpnj
          WRITE(ctmp4,*) '   ==>>> There is the list of best domain decompositions you should use: '
          CALL ctl_stop( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4 )
@@ -224,18 +230,23 @@
       jpnij = mppsize   ! force jpnij definition <-- remove as much land subdomains as needed to reach this condition
       IF( mppsize > inijmin ) THEN
-         WRITE(ctmp1,*) '   The number of mpi processes: ', mppsize
-         WRITE(ctmp2,*) '   exceeds the maximum number of ocean subdomains = ', inijmin
-         WRITE(ctmp3,*) '   we suppressed ', jpni*jpnj - mppsize, ' land subdomains '
-         WRITE(ctmp4,*) '   BUT we had to keep ', mppsize - inijmin, ' land subdomains that are useless...'
-         CALL ctl_warn( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4 )
+         WRITE(ctmp1,9003) '   The number of mpi processes: ', mppsize
+         WRITE(ctmp2,9003) '   exceeds the maximum number of ocean subdomains = ', inijmin
+         WRITE(ctmp3,9002) '   we suppressed ', jpni*jpnj - mppsize, ' land subdomains '
+         WRITE(ctmp4,9002) '   BUT we had to keep ', mppsize - inijmin, ' land subdomains that are useless...'
+         CALL ctl_warn( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4, ' ', '    --- YOU ARE WASTING CPU... ---', ' ' )
       ELSE   ! mppsize = inijmin
          IF(lwp) THEN
-            WRITE(numout,*) 'mpp_init: You use an optimal domain decomposition'
+            IF(llbest) WRITE(numout,*) 'mpp_init: You use an optimal domain decomposition'
             WRITE(numout,*) '~~~~~~~~ '
-            WRITE(numout,*) '   Number of mpi processes: ', mppsize
-            WRITE(numout,*) '   Number of ocean subdomains = ', inijmin
-            WRITE(numout,*) '   Number of suppressed land subdomains = ', jpni*jpnj - inijmin
-         ENDIF
-      ENDIF
+            WRITE(numout,9003) '   Number of mpi processes: ', mppsize
+            WRITE(numout,9003) '   Number of ocean subdomains = ', inijmin
+            WRITE(numout,9003) '   Number of suppressed land subdomains = ', jpni*jpnj - inijmin
+            WRITE(numout,*)
+         ENDIF
+      ENDIF
+9000  FORMAT (a, i4, a, i4, a, i7, a)
+9001  FORMAT (a, i4, a, i4)
+9002  FORMAT (a, i4, a)
+9003  FORMAT (a, i5)
 
       IF( numbot /= -1 )   CALL iom_close( numbot )
@@ -722,5 +733,5 @@
 
 
-   SUBROUTINE mpp_init_bestpartition( knbij, knbi, knbj, ldlist )
+   SUBROUTINE mpp_init_bestpartition( knbij, knbi, knbj, knbcnt, ldlist )
       !!----------------------------------------------------------------------
       !!                 ***  ROUTINE mpp_init_bestpartition  ***
@@ -732,4 +743,5 @@
       INTEGER,           INTENT(in   ) ::   knbij         ! total number if subdomains               (knbi*knbj)
       INTEGER, OPTIONAL, INTENT(  out) ::   knbi, knbj    ! number if subdomains along i and j (knbi and knbj)
+      INTEGER, OPTIONAL, INTENT(  out) ::   knbcnt        ! number of land subdomains
       LOGICAL, OPTIONAL, INTENT(in   ) ::   ldlist        ! .true.: print the list the best domain decompositions (with land)
       !
@@ -831,4 +843,5 @@
          knbi = inbi1(ii)
          knbj = inbj1(ii)
+         IF(PRESENT(knbcnt))   knbcnt = 0
          DEALLOCATE( inbi1, inbj1, inbij1, iszi1, iszj1, iszij1 )
          RETURN
@@ -897,4 +910,5 @@
       knbi = inbi0(ii)
       knbj = inbj0(ii)
+      IF(PRESENT(knbcnt))   knbcnt = knbi * knbj - inbij
       DEALLOCATE( inbi0, inbj0 )
       !
