Index: /trunk/NEMO/OPA_SRC/DIA/diafwb.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/DIA/diafwb.F90	(revision 406)
+++ /trunk/NEMO/OPA_SRC/DIA/diafwb.F90	(revision 407)
@@ -68,4 +68,5 @@
       !! * Local declarations
       INTEGER :: ji, jj, jk, jt   ! dummy loop indices
+      INTEGER :: ii0, ii1, ij0, ij1
       REAL(wp) ::   zarea, zvol, zwei
       REAL(wp) ::  ztemi(4), ztemo(4), zsali(4), zsalo(4), zflxi(4), zflxo(4)
@@ -137,4 +138,5 @@
          END DO
          IF( lk_mpp )   CALL mpp_sum( a_saln )      ! sum over the global domain
+         IF( lk_mpp )   CALL mpp_sum( zvol )      ! sum over the global domain
          
          a_aminus = a_aminus / ( nitend - nit000 + 1 )
@@ -186,11 +188,11 @@
          CASE ( 4 )                                  !  ORCA_R4 configuration
             !                                        ! =======================
-            ji =  mi1(70)
-            jj =  mj1(52)
+            ii0 = 70   ;   ii1 = 70
+            ij0 = 52   ;   ij1 = 52
             !                                        ! =======================
          CASE ( 2 )                                  !  ORCA_R2 configuration
             !                                        ! =======================
-            ji = mi1(139)
-            jj = mj1(102)
+            ii0 = 139   ;   ii1 = 139
+            ij0 = 102   ;   ij1 = 102
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
@@ -202,20 +204,23 @@
          END SELECT
          ! 
-      
-      DO jk = 1, 18 
-         zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
-         zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
-         zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
-
-         IF( un(ji,jj,jk) > 0.e0 ) THEN 
-            zflxi(1) = zflxi(1) +    zu
-            ztemi(1) = ztemi(1) + zt*zu
-            zsali(1) = zsali(1) + zs*zu
-         ELSE
-            zflxo(1) = zflxo(1) +    zu
-            ztemo(1) = ztemo(1) + zt*zu
-            zsalo(1) = zsalo(1) + zs*zu
-         ENDIF
-      END DO
+         DO ji = mi0(ii0), mi1(ii1)
+            DO jj = mj0(ij0), mj1(ij1)
+               DO jk = 1, 18 
+                  zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
+                  zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
+                  zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
+
+                  IF( un(ji,jj,jk) > 0.e0 ) THEN 
+                     zflxi(1) = zflxi(1) +    zu
+                     ztemi(1) = ztemi(1) + zt*zu
+                     zsali(1) = zsali(1) + zs*zu
+                  ELSE
+                     zflxo(1) = zflxo(1) +    zu
+                     ztemo(1) = ztemo(1) + zt*zu
+                     zsalo(1) = zsalo(1) + zs*zu
+                  ENDIF
+               END DO
+            END DO
+         END DO
       ENDIF
       
@@ -227,11 +232,11 @@
          CASE ( 4 )                                  !  ORCA_R4 configuration
             !                                        ! =======================
-            ji =  mi1(69  )
-            jj =  mj1(52  )
+            ii0 = 69   ;   ii1 = 69
+            ij0 = 52   ;   ij1 = 52
             !                                        ! =======================
          CASE ( 2 )                                  !  ORCA_R2 configuration
             !                                        ! =======================
-            ji = mi1(137)
-            jj = mj1(102)
+            ii0 = 137   ;   ii1 = 137
+            ij0 = 102   ;   ij1 = 102
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
@@ -243,20 +248,23 @@
          END SELECT
          ! 
-      
-      DO jk = 1, 23 
-         zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
-         zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
-         zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
-         
-         IF( un(ji,jj,jk) > 0.e0 ) THEN 
-            zflxi(2) = zflxi(2) +    zu
-            ztemi(2) = ztemi(2) + zt*zu
-            zsali(2) = zsali(2) + zs*zu
-         ELSE
-            zflxo(2) = zflxo(2) +    zu
-            ztemo(2) = ztemo(2) + zt*zu
-            zsalo(2) = zsalo(2) + zs*zu
-         ENDIF
-      END DO
+         DO ji = mi0(ii0), mi1(ii1)
+            DO jj = mj0(ij0), mj1(ij1)
+               DO jk = 1, 23 
+                  zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
+                  zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
+                  zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
+                  
+                  IF( un(ji,jj,jk) > 0.e0 ) THEN 
+                     zflxi(2) = zflxi(2) +    zu
+                     ztemi(2) = ztemi(2) + zt*zu
+                     zsali(2) = zsali(2) + zs*zu
+                  ELSE
+                     zflxo(2) = zflxo(2) +    zu
+                     ztemo(2) = ztemo(2) + zt*zu
+                     zsalo(2) = zsalo(2) + zs*zu
+                  ENDIF
+               END DO
+            END DO
+         END DO
       ENDIF
 
@@ -268,11 +276,11 @@
          CASE ( 4 )                                  !  ORCA_R4 configuration
             !                                        ! =======================
-            ji =  mi1(83  )
-            jj =  mj1(45  )
+            ii0 = 83   ;   ii1 = 83
+            ij0 = 45   ;   ij1 = 45
             !                                        ! =======================
          CASE ( 2 )                                  !  ORCA_R2 configuration
             !                                        ! =======================
-            ji = mi1(161)
-            jj = mj1( 88)
+            ii0 = 161   ;   ii1 = 161
+            ij0 = 88    ;   ij1 = 88 
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
@@ -284,20 +292,23 @@
          END SELECT
          ! 
-      
-      DO jk = 1, 15 
-         zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
-         zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
-         zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
-         
-         IF( un(ji,jj,jk) > 0.e0 ) THEN 
-            zflxi(3) = zflxi(3) +    zu
-            ztemi(3) = ztemi(3) + zt*zu
-            zsali(3) = zsali(3) + zs*zu
-         ELSE
-            zflxo(3) = zflxo(3) +    zu
-            ztemo(3) = ztemo(3) + zt*zu
-            zsalo(3) = zsalo(3) + zs*zu
-         ENDIF
-      END DO
+         DO ji = mi0(ii0), mi1(ii1)
+            DO jj = mj0(ij0), mj1(ij1)
+               DO jk = 1, 15 
+                  zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
+                  zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
+                  zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
+                  
+                  IF( un(ji,jj,jk) > 0.e0 ) THEN 
+                     zflxi(3) = zflxi(3) +    zu
+                     ztemi(3) = ztemi(3) + zt*zu
+                     zsali(3) = zsali(3) + zs*zu
+                  ELSE
+                     zflxo(3) = zflxo(3) +    zu
+                     ztemo(3) = ztemo(3) + zt*zu
+                     zsalo(3) = zsalo(3) + zs*zu
+                  ENDIF
+               END DO
+            END DO
+         END DO
       ENDIF
 
@@ -309,11 +320,11 @@
          CASE ( 4 )                                  !  ORCA_R4 configuration
             !                                        ! =======================
-            ji =   1     ! Not in the domain
-            jj =   1  
+            ii0 = 1     ;   ii1 = 1  
+            ij0 = 1     ;   ij1 = 1  
             !                                        ! =======================
          CASE ( 2 )                                  !  ORCA_R2 configuration
             !                                        ! =======================
-            ji = mi1(146)
-            jj = mj1(116)
+            ii0 = 146   ;   ii1 = 146 
+            ij0 = 116   ;   ij1 = 116
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
@@ -325,20 +336,23 @@
          END SELECT
          ! 
-      
-      DO jk = 1, 20
-         zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
-         zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
-         zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
-         
-         IF( un(ji,jj,jk) > 0.e0 ) THEN 
-            zflxi(4) = zflxi(4) +    zu
-            ztemi(4) = ztemi(4) + zt*zu
-            zsali(4) = zsali(4) + zs*zu
-         ELSE
-            zflxo(4) = zflxo(4) +    zu
-            ztemo(4) = ztemo(4) + zt*zu
-            zsalo(4) = zsalo(4) + zs*zu
-         ENDIF
-      END DO
+         DO ji = mi0(ii0), mi1(ii1)
+            DO jj = mj0(ij0), mj1(ij1)
+               DO jk = 1, 20
+                  zt = 0.5 * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) )
+                  zs = 0.5 * ( sn(ji,jj,jk) + sn(ji+1,jj,jk) )
+                  zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj)
+                  
+                  IF( un(ji,jj,jk) > 0.e0 ) THEN 
+                     zflxi(4) = zflxi(4) +    zu
+                     ztemi(4) = ztemi(4) + zt*zu
+                     zsali(4) = zsali(4) + zs*zu
+                  ELSE
+                     zflxo(4) = zflxo(4) +    zu
+                     ztemo(4) = ztemo(4) + zt*zu
+                     zsalo(4) = zsalo(4) + zs*zu
+                  ENDIF
+               END DO
+            END DO
+         END DO
       ENDIF
 
@@ -364,4 +378,13 @@
             a_salo(jt) = a_salo(jt) /   FLOAT( nitend - nit000 + 1 )
          END DO
+         IF( lk_mpp ) THEN
+            CALL mpp_sum( a_flxi, 4 )      ! sum over the global domain
+            CALL mpp_sum( a_temi, 4 )      ! sum over the global domain
+            CALL mpp_sum( a_sali, 4 )      ! sum over the global domain
+
+            CALL mpp_sum( a_flxo, 4 )      ! sum over the global domain
+            CALL mpp_sum( a_temo, 4 )      ! sum over the global domain
+            CALL mpp_sum( a_salo, 4 )      ! sum over the global domain
+         ENDIF
       ENDIF
 
