Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icectl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icectl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icectl.F90	(revision 10314)
@@ -77,5 +77,6 @@
       IF( icount == 0 ) THEN
          !                          ! water flux
-         pdiag_fv = glob_sum( -( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) +                  &
+         pdiag_fv = glob_sum( 'icectl',                                                                       &
+            &                 -( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) +                  &
             &                    wfx_opw(:,:) + wfx_res(:,:) + wfx_dyn(:,:) + wfx_lam(:,:) + wfx_pnd(:,:)  +  &
             &                    wfx_snw_sni(:,:) + wfx_snw_sum(:,:) + wfx_snw_dyn(:,:) + wfx_snw_sub(:,:) +  &
@@ -84,18 +85,20 @@
          !
          !                          ! salt flux
-         pdiag_fs = glob_sum(  ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  &
+         pdiag_fs = glob_sum( 'icectl',                                                                     &
+            &                  ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  &
             &                    sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:) + sfx_lam(:,:)    &
             &                  ) *  e1e2t(:,:) ) * zconv 
          !
          !                          ! heat flux
-         pdiag_ft = glob_sum(  ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:)  & 
+         pdiag_ft = glob_sum( 'icectl',                                                                    &
+            &                  ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:)  & 
             &                  - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) - hfx_sub(:,:) - hfx_spr(:,:)   &
             &                  ) *  e1e2t(:,:) ) * zconv
 
-         pdiag_v = glob_sum( SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t * zconv )
-
-         pdiag_s = glob_sum( SUM( sv_i * rhoi            , dim=3 ) * e1e2t * zconv )
-
-         pdiag_t = glob_sum( (  SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 )     &
+         pdiag_v = glob_sum( 'icectl', SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t * zconv )
+
+         pdiag_s = glob_sum( 'icectl', SUM( sv_i * rhoi            , dim=3 ) * e1e2t * zconv )
+
+         pdiag_t = glob_sum( 'icectl', (  SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 )     &
             &                 + SUM( SUM( e_s(:,:,1:nlay_s,:), dim=4 ), dim=3 ) ) * e1e2t ) * zconv
 
@@ -103,5 +106,6 @@
 
          ! water flux
-         zfv  = glob_sum( -( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) +                  &
+         zfv = glob_sum( 'icectl',                                                                        &
+            &             -( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) +                  &
             &                wfx_opw(:,:) + wfx_res(:,:) + wfx_dyn(:,:) + wfx_lam(:,:) + wfx_pnd(:,:)  +  &
             &                wfx_snw_sni(:,:) + wfx_snw_sum(:,:) + wfx_snw_dyn(:,:) + wfx_snw_sub(:,:) +  &
@@ -110,34 +114,37 @@
 
          ! salt flux
-         zfs  = glob_sum(  ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  &
+         zfs = glob_sum( 'icectl',                                                                       &
+            &              ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  &
             &                sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:) + sfx_lam(:,:)    & 
             &              ) * e1e2t(:,:) ) * zconv - pdiag_fs
 
          ! heat flux
-         zft  = glob_sum(  ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:)  & 
+         zft = glob_sum( 'icectl',                                                                      &
+            &              ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:)  & 
             &              - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) - hfx_sub(:,:) - hfx_spr(:,:)   &
             &              ) * e1e2t(:,:) ) * zconv - pdiag_ft
  
          ! outputs
-         zv = ( ( glob_sum( SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t ) * zconv  &
+         zv = ( ( glob_sum( 'icectl', SUM( v_i * rhoi + v_s * rhos, dim=3 ) * e1e2t ) * zconv  &
             &     - pdiag_v ) * r1_rdtice - zfv ) * rday
 
-         zs = ( ( glob_sum( SUM( sv_i * rhoi            , dim=3 ) * e1e2t ) * zconv  &
+         zs = ( ( glob_sum( 'icectl', SUM( sv_i * rhoi            , dim=3 ) * e1e2t ) * zconv  &
             &     - pdiag_s ) * r1_rdtice + zfs ) * rday
 
-         zt = ( glob_sum( (  SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 )   &
+         zt = ( glob_sum( 'icectl',                                                                &
+            &             (  SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 )                       &
             &              + SUM( SUM( e_s(:,:,1:nlay_s,:), dim=4 ), dim=3 ) ) * e1e2t ) * zconv   &
             &   - pdiag_t ) * r1_rdtice + zft
 
          ! zvtrp and zetrp must be close to 0 if the advection scheme is conservative
-         zvtrp = glob_sum( ( diag_trp_vi * rhoi + diag_trp_vs * rhos ) * e1e2t  ) * zconv * rday 
-         zetrp = glob_sum( ( diag_trp_ei        + diag_trp_es        ) * e1e2t  ) * zconv
-
-         zvmin = glob_min( v_i )
-         zamax = glob_max( SUM( a_i, dim=3 ) )
-         zamin = glob_min( a_i )
+         zvtrp = glob_sum( 'icectl', ( diag_trp_vi * rhoi + diag_trp_vs * rhos ) * e1e2t  ) * zconv * rday 
+         zetrp = glob_sum( 'icectl', ( diag_trp_ei        + diag_trp_es        ) * e1e2t  ) * zconv
+
+         zvmin = glob_min( 'icectl', v_i )
+         zamax = glob_max( 'icectl', SUM( a_i, dim=3 ) )
+         zamin = glob_min( 'icectl', a_i )
 
          ! set threshold values and calculate the ice area (+epsi10 to set a threshold > 0 when there is no ice) 
-         zarea   = glob_sum( SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2
+         zarea   = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2
          zv_sill = zarea * 2.5e-5
          zs_sill = zarea * 25.e-5
@@ -184,16 +191,16 @@
 
       ! water flux
-      zvfx  = glob_sum( ( wfx_ice + wfx_snw + wfx_spr + wfx_sub + diag_vice + diag_vsnw ) * e1e2t ) * zconv * rday
+      zvfx  = glob_sum( 'icectl', ( wfx_ice + wfx_snw + wfx_spr + wfx_sub + diag_vice + diag_vsnw ) * e1e2t ) * zconv * rday
 
       ! salt flux
-      zsfx  = glob_sum( ( sfx + diag_sice ) * e1e2t ) * zconv * rday
+      zsfx  = glob_sum( 'icectl', ( sfx + diag_sice ) * e1e2t ) * zconv * rday
 
       ! heat flux
-      zhfx  = glob_sum( ( qt_atm_oi - qt_oce_ai - diag_heat - diag_trp_ei - diag_trp_es   &
+      zhfx  = glob_sum( 'icectl', ( qt_atm_oi - qt_oce_ai - diag_heat - diag_trp_ei - diag_trp_es   &
       !  &              - SUM( qevap_ice * a_i_b, dim=3 )                           & !!clem: I think this line must be commented (but need check)
          &              ) * e1e2t ) * zconv
 
       ! set threshold values and calculate the ice area (+epsi10 to set a threshold > 0 when there is no ice) 
-      zarea   = glob_sum( SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2
+      zarea   = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2
       zv_sill = zarea * 2.5e-5
       zs_sill = zarea * 25.e-5
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icedia.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icedia.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icedia.F90	(revision 10314)
@@ -85,19 +85,19 @@
       ! 1 -  Contents !
       ! ----------------------- !
-      zbg_ivol = glob_sum( vt_i(:,:) * e1e2t(:,:) ) * 1.e-9                  ! ice volume (km3)
-      zbg_svol = glob_sum( vt_s(:,:) * e1e2t(:,:) ) * 1.e-9                  ! snow volume (km3)
-      zbg_area = glob_sum( at_i(:,:) * e1e2t(:,:) ) * 1.e-6                  ! area (km2)
-      zbg_isal = glob_sum( SUM( sv_i(:,:,:), dim=3 ) * e1e2t(:,:) ) * 1.e-9 ! salt content (pss*km3)
-      zbg_item = glob_sum( et_i * e1e2t(:,:) ) * 1.e-20                      ! heat content (1.e20 J)
-      zbg_stem = glob_sum( et_s * e1e2t(:,:) ) * 1.e-20                      ! heat content (1.e20 J)
+      zbg_ivol = glob_sum( 'icedia', vt_i(:,:) * e1e2t(:,:) ) * 1.e-9                  ! ice volume (km3)
+      zbg_svol = glob_sum( 'icedia', vt_s(:,:) * e1e2t(:,:) ) * 1.e-9                  ! snow volume (km3)
+      zbg_area = glob_sum( 'icedia', at_i(:,:) * e1e2t(:,:) ) * 1.e-6                  ! area (km2)
+      zbg_isal = glob_sum( 'icedia', SUM( sv_i(:,:,:), dim=3 ) * e1e2t(:,:) ) * 1.e-9  ! salt content (pss*km3)
+      zbg_item = glob_sum( 'icedia', et_i * e1e2t(:,:) ) * 1.e-20                      ! heat content (1.e20 J)
+      zbg_stem = glob_sum( 'icedia', et_s * e1e2t(:,:) ) * 1.e-20                      ! heat content (1.e20 J)
       
       ! ---------------------------!
       ! 2 - Trends due to forcing  !
       ! ---------------------------!
-      z_frc_volbot = r1_rau0 * glob_sum( - ( wfx_ice(:,:) + wfx_snw(:,:) + wfx_err_sub(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! freshwater flux ice/snow-ocean 
-      z_frc_voltop = r1_rau0 * glob_sum( - ( wfx_sub(:,:) + wfx_spr(:,:) )                    * e1e2t(:,:) ) * 1.e-9   ! freshwater flux ice/snow-atm
-      z_frc_sal    = r1_rau0 * glob_sum( -       sfx(:,:)                                     * e1e2t(:,:) ) * 1.e-9   ! salt fluxes ice/snow-ocean
-      z_frc_tembot =           glob_sum(   qt_oce_ai(:,:)                                     * e1e2t(:,:) ) * 1.e-20  ! heat on top of ocean (and below ice)
-      z_frc_temtop =           glob_sum(   qt_atm_oi(:,:)                                     * e1e2t(:,:) ) * 1.e-20  ! heat on top of ice-coean
+      z_frc_volbot = r1_rau0 * glob_sum( 'icedia', -( wfx_ice(:,:) + wfx_snw(:,:) + wfx_err_sub(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! freshwater flux ice/snow-ocean 
+      z_frc_voltop = r1_rau0 * glob_sum( 'icedia', -( wfx_sub(:,:) + wfx_spr(:,:) )                    * e1e2t(:,:) ) * 1.e-9   ! freshwater flux ice/snow-atm
+      z_frc_sal    = r1_rau0 * glob_sum( 'icedia', -      sfx(:,:)                                     * e1e2t(:,:) ) * 1.e-9   ! salt fluxes ice/snow-ocean
+      z_frc_tembot =           glob_sum( 'icedia',  qt_oce_ai(:,:)                                     * e1e2t(:,:) ) * 1.e-20  ! heat on top of ocean (and below ice)
+      z_frc_temtop =           glob_sum( 'icedia',  qt_atm_oi(:,:)                                     * e1e2t(:,:) ) * 1.e-20  ! heat on top of ice-coean
       !
       frc_voltop  = frc_voltop  + z_frc_voltop  * rdt_ice ! km3
@@ -110,7 +110,7 @@
       ! 3 -  Content variations !
       ! ----------------------- !
-      zdiff_vol = r1_rau0 * glob_sum( ( rhoi*vt_i(:,:) + rhos*vt_s(:,:) - vol_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! freshwater trend (km3) 
-      zdiff_sal = r1_rau0 * glob_sum( ( rhoi* SUM( sv_i(:,:,:), dim=3 ) - sal_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! salt content trend (km3*pss)
-      zdiff_tem =           glob_sum( ( et_i(:,:) + et_s(:,:)           - tem_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-20  ! heat content trend (1.e20 J)
+      zdiff_vol = r1_rau0 * glob_sum( 'icedia', ( rhoi*vt_i(:,:) + rhos*vt_s(:,:) - vol_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! freshwater trend (km3) 
+      zdiff_sal = r1_rau0 * glob_sum( 'icedia', ( rhoi* SUM( sv_i(:,:,:), dim=3 ) - sal_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! salt content trend (km3*pss)
+      zdiff_tem =           glob_sum( 'icedia', ( et_i(:,:) + et_s(:,:)           - tem_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-20  ! heat content trend (1.e20 J)
       !                               + SUM( qevap_ice * a_i_b, dim=3 )       !! clem: I think this term should not be there (but needs a check)
 
@@ -125,5 +125,5 @@
       ! 5 - Diagnostics writing !
       ! ----------------------- !
-!!gm I don't understand the division by the ocean surface (i.e. glob_sum( e1e2t(:,:) ) * 1.e-20 * kt*rdt )
+!!gm I don't understand the division by the ocean surface (i.e. glob_sum( 'icedia', e1e2t(:,:) ) * 1.e-20 * kt*rdt )
 !!   and its multiplication bu kt ! is it really what we want ? what is this quantity ?
 !!   IF it is really what we want, compute it at kt=nit000, not 3 time by time-step !
@@ -135,5 +135,5 @@
       IF( iom_use('ibgheatco')    )   CALL iom_put( 'ibgheatco' , zdiff_tem     )   ! ice/snow heat content drift       (1.e20 J)
       IF( iom_use('ibgheatfx')    )   CALL iom_put( 'ibgheatfx' ,               &   ! ice/snow heat flux drift          (W/m2)
-         &                                                     zdiff_tem /glob_sum( e1e2t(:,:) * 1.e-20 * kt*rdt ) )
+         &                                                     zdiff_tem /glob_sum( 'icedia', e1e2t(:,:) * 1.e-20 * kt*rdt ) )
 
       IF( iom_use('ibgfrcvoltop') )   CALL iom_put( 'ibgfrcvoltop' , frc_voltop )   ! vol  forcing ice/snw-atm          (km3 equivalent ocean water) 
@@ -143,7 +143,7 @@
       IF( iom_use('ibgfrctembot') )   CALL iom_put( 'ibgfrctembot' , frc_tembot )   ! heat on top of ocean(below ice)   (1.e20 J)   
       IF( iom_use('ibgfrchfxtop') )   CALL iom_put( 'ibgfrchfxtop' ,            &   ! heat on top of ice/snw/ocean      (W/m2) 
-         &                                                          frc_temtop / glob_sum( e1e2t(:,:) ) * 1.e-20 * kt*rdt  )
+         &                                                          frc_temtop / glob_sum( 'icedia', e1e2t(:,:) ) * 1.e-20 * kt*rdt  )
       IF( iom_use('ibgfrchfxbot') )   CALL iom_put( 'ibgfrchfxbot' ,            &   ! heat on top of ocean(below ice)   (W/m2) 
-         &                                                          frc_tembot / glob_sum( e1e2t(:,:) ) * 1.e-20 * kt*rdt  )
+         &                                                          frc_tembot / glob_sum( 'icedia', e1e2t(:,:) ) * 1.e-20 * kt*rdt  )
 
       IF( iom_use('ibgvol_tot' )  )   CALL iom_put( 'ibgvol_tot'  , zbg_ivol     )   ! ice volume                       (km3)
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icewri.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icewri.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icewri.F90	(revision 10314)
@@ -184,11 +184,11 @@
          ELSEWHERE               ;   zmsk00(:,:) = 0.
          END WHERE 
-         zdiag_area_nh = glob_sum( at_i(:,:) * zmsk00(:,:) * e1e2t(:,:) )
-         zdiag_volu_nh = glob_sum( vt_i(:,:) * zmsk00(:,:) * e1e2t(:,:) )
+         zdiag_area_nh = glob_sum( 'icewri', at_i(:,:) * zmsk00(:,:) * e1e2t(:,:) )
+         zdiag_volu_nh = glob_sum( 'icewri', vt_i(:,:) * zmsk00(:,:) * e1e2t(:,:) )
          !
          WHERE( ff_t > 0._wp .AND. at_i > 0.15 )   ; zmsk00(:,:) = 1.0e-12
          ELSEWHERE                                 ; zmsk00(:,:) = 0.
          END WHERE 
-         zdiag_extt_nh = glob_sum( zmsk00(:,:) * e1e2t(:,:) )
+         zdiag_extt_nh = glob_sum( 'icewri', zmsk00(:,:) * e1e2t(:,:) )
          !
          IF( iom_use('NH_icearea') )   CALL iom_put( "NH_icearea" ,  zdiag_area_nh )
@@ -203,11 +203,11 @@
          ELSEWHERE            ; zmsk00(:,:) = 0.
          END WHERE 
-         zdiag_area_sh = glob_sum( at_i(:,:) * zmsk00(:,:) * e1e2t(:,:) ) 
-         zdiag_volu_sh = glob_sum( vt_i(:,:) * zmsk00(:,:) * e1e2t(:,:) )
+         zdiag_area_sh = glob_sum( 'icewri', at_i(:,:) * zmsk00(:,:) * e1e2t(:,:) ) 
+         zdiag_volu_sh = glob_sum( 'icewri', vt_i(:,:) * zmsk00(:,:) * e1e2t(:,:) )
          !
          WHERE( ff_t < 0._wp .AND. at_i > 0.15 ); zmsk00(:,:) = 1.0e-12
          ELSEWHERE                              ; zmsk00(:,:) = 0.
          END WHERE 
-         zdiag_extt_sh = glob_sum( zmsk00(:,:) * e1e2t(:,:) )
+         zdiag_extt_sh = glob_sum( 'icewri', zmsk00(:,:) * e1e2t(:,:) )
          !
          IF( iom_use('SH_icearea') ) CALL iom_put( "SH_icearea", zdiag_area_sh )
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdydyn2d.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdydyn2d.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdydyn2d.F90	(revision 10314)
@@ -109,6 +109,6 @@
          pva2d(ii,ij) = ( pva2d(ii,ij) + zwgt * ( dta%v2d(jb) - pva2d(ii,ij) ) ) * vmask(ii,ij,1)
       END DO 
-      CALL lbc_bdy_lnk( pua2d, 'U', -1., ib_bdy ) 
-      CALL lbc_bdy_lnk( pva2d, 'V', -1., ib_bdy)   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( 'bdydyn2d', pua2d, 'U', -1., ib_bdy ) 
+      CALL lbc_bdy_lnk( 'bdydyn2d', pva2d, 'V', -1., ib_bdy)   ! Boundary points should be updated
       !
    END SUBROUTINE bdy_dyn2d_frs
@@ -169,5 +169,5 @@
       END DO
 
-      CALL lbc_bdy_lnk( spgu(:,:), 'T', 1., ib_bdy )
+      CALL lbc_bdy_lnk( 'bdydyn2d', spgu(:,:), 'T', 1., ib_bdy )
       !
       igrd = 2      ! Flather bc on u-velocity; 
@@ -207,6 +207,6 @@
          pva2d(ii,ij) = zforc + (1._wp - z1_2*zflag) * zcorr * vmask(ii,ij,1)
       END DO
-      CALL lbc_bdy_lnk( pua2d, 'U', -1., ib_bdy )   ! Boundary points should be updated
-      CALL lbc_bdy_lnk( pva2d, 'V', -1., ib_bdy )   !
+      CALL lbc_bdy_lnk( 'bdydyn2d', pua2d, 'U', -1., ib_bdy )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( 'bdydyn2d', pva2d, 'V', -1., ib_bdy )   !
       !
    END SUBROUTINE bdy_dyn2d_fla
@@ -243,6 +243,6 @@
       CALL bdy_orlanski_2d( idx, igrd, pvb2d, pva2d, dta%v2d, ll_npo )
       !
-      CALL lbc_bdy_lnk( pua2d, 'U', -1., ib_bdy )   ! Boundary points should be updated
-      CALL lbc_bdy_lnk( pva2d, 'V', -1., ib_bdy )   !
+      CALL lbc_bdy_lnk( 'bdydyn2d', pua2d, 'U', -1., ib_bdy )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( 'bdydyn2d', pva2d, 'V', -1., ib_bdy )   !
       !
    END SUBROUTINE bdy_dyn2d_orlanski
@@ -291,5 +291,5 @@
 
          ! Boundary points should be updated
-         CALL lbc_bdy_lnk( zssh(:,:), 'T', 1., ib_bdy )
+         CALL lbc_bdy_lnk( 'bdydyn2d', zssh(:,:), 'T', 1., ib_bdy )
       END DO
 
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdydyn3d.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdydyn3d.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdydyn3d.F90	(revision 10314)
@@ -97,6 +97,6 @@
          END DO
       END DO
-      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )   ! Boundary points should be updated  
-      CALL lbc_bdy_lnk( va, 'V', -1., ib_bdy )   
+      CALL lbc_bdy_lnk( 'bdydyn3d', ua, 'U', -1., ib_bdy )   ! Boundary points should be updated  
+      CALL lbc_bdy_lnk( 'bdydyn3d', va, 'V', -1., ib_bdy )   
       !
       IF( kt == nit000 )   CLOSE( unit = 102 )
@@ -144,6 +144,6 @@
          END DO
       END DO
-      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )   ! Boundary points should be updated  
-      CALL lbc_bdy_lnk( va, 'V', -1., ib_bdy )   
+      CALL lbc_bdy_lnk( 'bdydyn3d', ua, 'U', -1., ib_bdy )   ! Boundary points should be updated  
+      CALL lbc_bdy_lnk( 'bdydyn3d', va, 'V', -1., ib_bdy )   
       !
       IF( kt == nit000 )   CLOSE( unit = 102 )
@@ -187,5 +187,5 @@
       END DO
       !
-      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )   ;   CALL lbc_bdy_lnk( va, 'V', -1.,ib_bdy )   ! Boundary points should be updated
+      CALL lbc_bdy_lnk( 'bdydyn3d', ua, 'U', -1., ib_bdy )   ;   CALL lbc_bdy_lnk( 'bdydyn3d', va, 'V', -1.,ib_bdy )   ! Boundary points should be updated
       !
       IF( kt == nit000 )   CLOSE( unit = 102 )
@@ -234,6 +234,6 @@
          END DO
       END DO 
-      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )    ! Boundary points should be updated
-      CALL lbc_bdy_lnk( va, 'V', -1., ib_bdy )   
+      CALL lbc_bdy_lnk( 'bdydyn3d', ua, 'U', -1., ib_bdy )    ! Boundary points should be updated
+      CALL lbc_bdy_lnk( 'bdydyn3d', va, 'V', -1., ib_bdy )   
       !
       IF( kt == nit000 )   CLOSE( unit = 102 )
@@ -270,6 +270,6 @@
       CALL bdy_orlanski_3d( idx, igrd, vb, va, dta%v3d, ll_npo )
       !
-      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )    ! Boundary points should be updated
-      CALL lbc_bdy_lnk( va, 'V', -1., ib_bdy )   
+      CALL lbc_bdy_lnk( 'bdydyn3d', ua, 'U', -1., ib_bdy )    ! Boundary points should be updated
+      CALL lbc_bdy_lnk( 'bdydyn3d', va, 'V', -1., ib_bdy )   
       !
    END SUBROUTINE bdy_dyn3d_orlanski
@@ -351,6 +351,6 @@
       CALL bdy_nmn( idx, igrd, va )
       !
-      CALL lbc_bdy_lnk( ua, 'U', -1., ib_bdy )    ! Boundary points should be updated
-      CALL lbc_bdy_lnk( va, 'V', -1., ib_bdy )
+      CALL lbc_bdy_lnk( 'bdydyn3d', ua, 'U', -1., ib_bdy )    ! Boundary points should be updated
+      CALL lbc_bdy_lnk( 'bdydyn3d', va, 'V', -1., ib_bdy )
       !
    END SUBROUTINE bdy_dyn3d_nmn
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdyice.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdyice.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdyice.F90	(revision 10314)
@@ -135,7 +135,7 @@
          ENDDO
       ENDDO
-      CALL lbc_bdy_lnk( a_i(:,:,:), 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( h_i(:,:,:), 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( h_s(:,:,:), 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', a_i(:,:,:), 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', h_i(:,:,:), 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', h_s(:,:,:), 'T', 1., jbdy )
 
       DO jl = 1, jpl
@@ -244,19 +244,19 @@
       END DO ! jl
 
-      CALL lbc_bdy_lnk( a_i (:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( h_i (:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( h_s (:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( oa_i(:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( a_ip(:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( v_ip(:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( s_i (:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( t_su(:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( v_i (:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( v_s (:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( sv_i(:,:,:)  , 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( t_s (:,:,:,:), 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( e_s (:,:,:,:), 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( t_i (:,:,:,:), 'T', 1., jbdy )
-      CALL lbc_bdy_lnk( e_i (:,:,:,:), 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', a_i (:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', h_i (:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', h_s (:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', oa_i(:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', a_ip(:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', v_ip(:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', s_i (:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', t_su(:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', v_i (:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', v_s (:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', sv_i(:,:,:)  , 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', t_s (:,:,:,:), 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', e_s (:,:,:,:), 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', t_i (:,:,:,:), 'T', 1., jbdy )
+      CALL lbc_bdy_lnk( 'bdyice', e_i (:,:,:,:), 'T', 1., jbdy )
       !      
    END SUBROUTINE bdy_ice_frs
@@ -317,5 +317,5 @@
                   !
                END DO
-               CALL lbc_bdy_lnk( u_ice(:,:), 'U', -1., jbdy )
+               CALL lbc_bdy_lnk( 'bdyice', u_ice(:,:), 'U', -1., jbdy )
                !
             CASE ( 'V' )
@@ -340,5 +340,5 @@
                   !
                END DO
-               CALL lbc_bdy_lnk( v_ice(:,:), 'V', -1., jbdy )
+               CALL lbc_bdy_lnk( 'bdyice', v_ice(:,:), 'V', -1., jbdy )
                !
             END SELECT
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdytra.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdytra.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdytra.F90	(revision 10314)
@@ -71,5 +71,5 @@
             END SELECT
             ! Boundary points should be updated
-            CALL lbc_bdy_lnk( tsa(:,:,:,jn), 'T', 1., ib_bdy )
+            CALL lbc_bdy_lnk( 'bdytra', tsa(:,:,:,jn), 'T', 1., ib_bdy )
             ! 
          END DO
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdyvol.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdyvol.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/BDY/bdyvol.F90	(revision 10314)
@@ -87,5 +87,5 @@
       IF( lk_mpp )   CALL mpp_sum( 'bdyvol', z_cflxemp )     ! sum over the global domain
 !!gm   by :
-!!gm      z_cflxemp = glob_sum(  ( emp(:,:)-rnf(:,:)+fwfisf(:,:) ) * bdytmask(:,:) * e1e2t(:,:)  ) / rau0
+!!gm      z_cflxemp = glob_sum(  'bdyvol', ( emp(:,:)-rnf(:,:)+fwfisf(:,:) ) * bdytmask(:,:) * e1e2t(:,:)  ) / rau0
 !!gm
 
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DIA/diacfl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DIA/diacfl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DIA/diacfl.F90	(revision 10314)
@@ -54,7 +54,7 @@
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
-      INTEGER :: ji, jj, jk   ! dummy loop indices
-      REAL(wp)::   z2dt, zCu_max, zCv_max, zCw_max       ! local scalars
-      INTEGER , DIMENSION(3)           ::   iloc_u , iloc_v , iloc_w , iloc   ! workspace
+      INTEGER                ::   ji, jj, jk                            ! dummy loop indices
+      REAL(wp)               ::   z2dt, zCu_max, zCv_max, zCw_max       ! local scalars
+      INTEGER , DIMENSION(3) ::   iloc_u , iloc_v , iloc_w , iloc       ! workspace
 !!gm this does not work      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zCu_cfl, zCv_cfl, zCw_cfl         ! workspace
       !!----------------------------------------------------------------------
@@ -80,7 +80,7 @@
       !                    ! calculate maximum values and locations
       IF( lk_mpp ) THEN
-         CALL mpp_maxloc( zCu_cfl, umask, zCu_max, iloc_u(1), iloc_u(2), iloc_u(3) )
-         CALL mpp_maxloc( zCv_cfl, vmask, zCv_max, iloc_v(1), iloc_v(2), iloc_v(3) )
-         CALL mpp_maxloc( zCw_cfl, wmask, zCw_max, iloc_w(1), iloc_w(2), iloc_w(3) )
+         CALL mpp_maxloc( 'diacfl', zCu_cfl, umask, zCu_max, iloc_u )
+         CALL mpp_maxloc( 'diacfl', zCv_cfl, vmask, zCv_max, iloc_v )
+         CALL mpp_maxloc( 'diacfl', zCw_cfl, wmask, zCw_max, iloc_w )
       ELSE
          iloc = MAXLOC( ABS( zcu_cfl(:,:,:) ) )
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DIA/diahsb.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DIA/diahsb.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DIA/diahsb.F90	(revision 10314)
@@ -91,16 +91,16 @@
       ! 1 - Trends due to forcing !
       ! ------------------------- !
-      z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) * surf(:,:) )   ! volume fluxes
-      z_frc_trd_t =           glob_sum( sbc_tsc(:,:,jp_tem) * surf(:,:) )                       ! heat fluxes
-      z_frc_trd_s =           glob_sum( sbc_tsc(:,:,jp_sal) * surf(:,:) )                       ! salt fluxes
+      z_frc_trd_v = r1_rau0 * glob_sum( 'diahsb', - ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) * surf(:,:) )   ! volume fluxes
+      z_frc_trd_t =           glob_sum( 'diahsb', sbc_tsc(:,:,jp_tem) * surf(:,:) )                       ! heat fluxes
+      z_frc_trd_s =           glob_sum( 'diahsb', sbc_tsc(:,:,jp_sal) * surf(:,:) )                       ! salt fluxes
       !                    !  Add runoff    heat & salt input
-      IF( ln_rnf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( rnf_tsc(:,:,jp_tem) * surf(:,:) )
-      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( rnf_tsc(:,:,jp_sal) * surf(:,:) )
+      IF( ln_rnf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( 'diahsb', rnf_tsc(:,:,jp_tem) * surf(:,:) )
+      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( 'diahsb', rnf_tsc(:,:,jp_sal) * surf(:,:) )
       !                    ! Add ice shelf heat & salt input
-      IF( ln_isf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( risf_tsc(:,:,jp_tem) * surf(:,:) )
+      IF( ln_isf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( 'diahsb', risf_tsc(:,:,jp_tem) * surf(:,:) )
       !                    ! Add penetrative solar radiation
-      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( qsr     (:,:) * surf(:,:) )
+      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( 'diahsb', qsr     (:,:) * surf(:,:) )
       !                    ! Add geothermal heat flux
-      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( qgh_trd0(:,:) * surf(:,:) )
+      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( 'diahsb', qgh_trd0(:,:) * surf(:,:) )
       !
       IF( ln_linssh ) THEN
@@ -116,6 +116,6 @@
             z2d1(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_sal)
          END IF
-         z_wn_trd_t = - glob_sum( z2d0 ) 
-         z_wn_trd_s = - glob_sum( z2d1 )
+         z_wn_trd_t = - glob_sum( 'diahsb', z2d0 ) 
+         z_wn_trd_s = - glob_sum( 'diahsb', z2d1 )
       ENDIF
 
@@ -135,5 +135,5 @@
 
       !                    ! volume variation (calculated with ssh)
-      zdiff_v1 = glob_sum_full( surf(:,:)*sshn(:,:) - surf_ini(:,:)*ssh_ini(:,:) )
+      zdiff_v1 = glob_sum_full( 'diahsb', surf(:,:)*sshn(:,:) - surf_ini(:,:)*ssh_ini(:,:) )
 
       !                    ! heat & salt content variation (associated with ssh)
@@ -150,20 +150,20 @@
             z2d1(:,:) = surf(:,:) * ( tsn(:,:,1,jp_sal) * sshn(:,:) - ssh_sc_loc_ini(:,:) ) 
          END IF
-         z_ssh_hc = glob_sum_full( z2d0 ) 
-         z_ssh_sc = glob_sum_full( z2d1 ) 
-      ENDIF
-      !
-      DO jk = 1, jpkm1     ! volume variation (calculated with scale factors)
+         z_ssh_hc = glob_sum_full( 'diahsb', z2d0 ) 
+         z_ssh_sc = glob_sum_full( 'diahsb', z2d1 ) 
+      ENDIF
+      !
+      DO jk = 1, jpkm1           ! volume variation (calculated with scale factors)
          zwrk(:,:,jk) = ( surf(:,:)*e3t_n(:,:,jk) - surf_ini(:,:)*e3t_ini(:,:,jk) ) * tmask(:,:,jk)
       END DO
-      zdiff_v2 = glob_sum_full( zwrk(:,:,:) )
+      zdiff_v2 = glob_sum_full( 'diahsb', zwrk(:,:,:) )
       DO jk = 1, jpkm1           ! heat content variation
          zwrk(:,:,jk) = ( surf(:,:)*e3t_n(:,:,jk)*tsn(:,:,jk,jp_tem) - surf_ini(:,:)*hc_loc_ini(:,:,jk) ) * tmask(:,:,jk)
       END DO
-      zdiff_hc = glob_sum_full( zwrk(:,:,:) )
+      zdiff_hc = glob_sum_full( 'diahsb', zwrk(:,:,:) )
       DO jk = 1, jpkm1           ! salt content variation
          zwrk(:,:,jk) = ( surf(:,:)*e3t_n(:,:,jk)*tsn(:,:,jk,jp_sal) - surf_ini(:,:)*sc_loc_ini(:,:,jk) ) * tmask(:,:,jk)
       END DO
-      zdiff_sc = glob_sum_full( zwrk(:,:,:) )
+      zdiff_sc = glob_sum_full( 'diahsb', zwrk(:,:,:) )
 
       ! ------------------------ !
@@ -187,9 +187,9 @@
          zwrk(:,:,jk) = surf(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk)
       END DO
-      zvol_tot = glob_sum_full( zwrk(:,:,:) )
+      zvol_tot = glob_sum_full( 'diahsb', zwrk(:,:,:) )
 
 !!gm to be added ?
 !      IF( ln_linssh ) THEN            ! fixed volume, add the ssh contribution
-!        zvol_tot = zvol_tot + glob_sum( surf(:,:) * sshn(:,:) )
+!        zvol_tot = zvol_tot + glob_sum( 'diahsb', surf(:,:) * sshn(:,:) )
 !      ENDIF
 !!gm end
@@ -409,6 +409,6 @@
       ! 2 - Time independant variables and file opening !
       ! ----------------------------------------------- !
-      surf(:,:) = e1e2t(:,:) * tmask_i(:,:)     ! masked surface grid cell area
-      surf_tot  = glob_sum( surf(:,:) )         ! total ocean surface area
+      surf(:,:) = e1e2t(:,:) * tmask_i(:,:)               ! masked surface grid cell area
+      surf_tot  = glob_sum( 'diahsb', surf(:,:) )         ! total ocean surface area
 
       IF( ln_bdy ) CALL ctl_warn( 'dia_hsb_init: heat/salt budget does not consider open boundary fluxes' )         
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/closea.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/closea.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/closea.F90	(revision 10314)
@@ -237,5 +237,5 @@
          surfe(:) = 0.e0_wp
          !
-         surf(jncs+1) = glob_sum( e1e2t(:,:) )   ! surface of the global ocean
+         surf(jncs+1) = glob_sum( 'closea', e1e2t(:,:) )   ! surface of the global ocean
          !
          !                                        ! surface areas of closed seas 
@@ -243,5 +243,5 @@
             ztmp2d(:,:) = 0.e0_wp
             WHERE( closea_mask(:,:) == jc ) ztmp2d(:,:) = e1e2t(:,:) * tmask_i(:,:)
-            surf(jc) = glob_sum( ztmp2d(:,:) )
+            surf(jc) = glob_sum( 'closea', ztmp2d(:,:) )
          END DO
          !
@@ -254,5 +254,5 @@
                ztmp2d(:,:) = 0.e0_wp
                WHERE( closea_mask_rnf(:,:) == jcr .and. closea_mask(:,:) == 0 ) ztmp2d(:,:) = e1e2t(:,:) * tmask_i(:,:)
-               surfr(jcr) = glob_sum( ztmp2d(:,:) )
+               surfr(jcr) = glob_sum( 'closea', ztmp2d(:,:) )
             END DO
          ENDIF
@@ -263,5 +263,5 @@
                ztmp2d(:,:) = 0.e0_wp
                WHERE( closea_mask_empmr(:,:) == jce .and. closea_mask(:,:) == 0 ) ztmp2d(:,:) = e1e2t(:,:) * tmask_i(:,:)
-               surfe(jce) = glob_sum( ztmp2d(:,:) )
+               surfe(jce) = glob_sum( 'closea', ztmp2d(:,:) )
             END DO
          ENDIF
@@ -301,5 +301,5 @@
          ztmp2d(:,:) = 0.e0_wp
          WHERE( closea_mask(:,:) == jc ) ztmp2d(:,:) = e1e2t(:,:) * ( emp(:,:)-rnf(:,:) ) * tmask_i(:,:)
-         zfwf(jc) = glob_sum( ztmp2d(:,:) )
+         zfwf(jc) = glob_sum( 'closea', ztmp2d(:,:) )
       END DO
       zfwf_total = SUM(zfwf)
@@ -316,5 +316,5 @@
             ztmp2d(:,:) = 0.e0_wp
             WHERE( closea_mask_rnf(:,:) == jcr .and. closea_mask(:,:) > 0 ) ztmp2d(:,:) = e1e2t(:,:) * ( emp(:,:)-rnf(:,:) ) * tmask_i(:,:)
-            zfwfr(jcr) = glob_sum( ztmp2d(:,:) )
+            zfwfr(jcr) = glob_sum( 'closea', ztmp2d(:,:) )
             !
             ! The following if avoids the redistribution of the round off
@@ -345,5 +345,5 @@
             ztmp2d(:,:) = 0.e0_wp
             WHERE( closea_mask_empmr(:,:) == jce .and. closea_mask(:,:) > 0 ) ztmp2d(:,:) = e1e2t(:,:) * ( emp(:,:)-rnf(:,:) ) * tmask_i(:,:)
-            zfwfe(jce) = glob_sum( ztmp2d(:,:) )
+            zfwfe(jce) = glob_sum( 'closea', ztmp2d(:,:) )
             !
             ! The following if avoids the redistribution of the round off
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domain.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domain.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domain.F90	(revision 10314)
@@ -469,5 +469,5 @@
       !! ** Method  :   compute and print extrema of masked scale factors
       !!----------------------------------------------------------------------
-      INTEGER ::   iimi1, ijmi1, iimi2, ijmi2, iima1, ijma1, iima2, ijma2
+      INTEGER, DIMENSION(2) ::   imi1, imi2, ima1, ima2
       INTEGER, DIMENSION(2) ::   iloc   ! 
       REAL(wp) ::   ze1min, ze1max, ze2min, ze2max
@@ -475,8 +475,8 @@
       !
       IF(lk_mpp) THEN
-         CALL mpp_minloc( e1t(:,:), tmask_i(:,:), ze1min, iimi1,ijmi1 )
-         CALL mpp_minloc( e2t(:,:), tmask_i(:,:), ze2min, iimi2,ijmi2 )
-         CALL mpp_maxloc( e1t(:,:), tmask_i(:,:), ze1max, iima1,ijma1 )
-         CALL mpp_maxloc( e2t(:,:), tmask_i(:,:), ze2max, iima2,ijma2 )
+         CALL mpp_minloc( 'domain', e1t(:,:), tmask_i(:,:), ze1min, imi1 )
+         CALL mpp_minloc( 'domain', e2t(:,:), tmask_i(:,:), ze2min, imi2 )
+         CALL mpp_maxloc( 'domain', e1t(:,:), tmask_i(:,:), ze1max, ima1 )
+         CALL mpp_maxloc( 'domain', e2t(:,:), tmask_i(:,:), ze2max, ima2 )
       ELSE
          ze1min = MINVAL( e1t(:,:), mask = tmask_i(:,:) == 1._wp )    
@@ -486,15 +486,15 @@
          !
          iloc  = MINLOC( e1t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iimi1 = iloc(1) + nimpp - 1
-         ijmi1 = iloc(2) + njmpp - 1
+         imi1(1) = iloc(1) + nimpp - 1
+         imi1(2) = iloc(2) + njmpp - 1
          iloc  = MINLOC( e2t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iimi2 = iloc(1) + nimpp - 1
-         ijmi2 = iloc(2) + njmpp - 1
+         imi2(1) = iloc(1) + nimpp - 1
+         imi2(2) = iloc(2) + njmpp - 1
          iloc  = MAXLOC( e1t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iima1 = iloc(1) + nimpp - 1
-         ijma1 = iloc(2) + njmpp - 1
+         ima1(1) = iloc(1) + nimpp - 1
+         ima1(2) = iloc(2) + njmpp - 1
          iloc  = MAXLOC( e2t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iima2 = iloc(1) + nimpp - 1
-         ijma2 = iloc(2) + njmpp - 1
+         ima2(1) = iloc(1) + nimpp - 1
+         ima2(2) = iloc(2) + njmpp - 1
       ENDIF
       IF(lwp) THEN
@@ -502,8 +502,8 @@
          WRITE(numout,*) 'dom_ctl : extrema of the masked scale factors'
          WRITE(numout,*) '~~~~~~~'
-         WRITE(numout,"(14x,'e1t maxi: ',1f10.2,' at i = ',i5,' j= ',i5)") ze1max, iima1, ijma1
-         WRITE(numout,"(14x,'e1t mini: ',1f10.2,' at i = ',i5,' j= ',i5)") ze1min, iimi1, ijmi1
-         WRITE(numout,"(14x,'e2t maxi: ',1f10.2,' at i = ',i5,' j= ',i5)") ze2max, iima2, ijma2
-         WRITE(numout,"(14x,'e2t mini: ',1f10.2,' at i = ',i5,' j= ',i5)") ze2min, iimi2, ijmi2
+         WRITE(numout,"(14x,'e1t maxi: ',1f10.2,' at i = ',i5,' j= ',i5)") ze1max, ima1(1), ima1(2)
+         WRITE(numout,"(14x,'e1t mini: ',1f10.2,' at i = ',i5,' j= ',i5)") ze1min, imi1(1), imi1(2)
+         WRITE(numout,"(14x,'e2t maxi: ',1f10.2,' at i = ',i5,' j= ',i5)") ze2max, ima2(1), ima2(2)
+         WRITE(numout,"(14x,'e2t mini: ',1f10.2,' at i = ',i5,' j= ',i5)") ze2min, imi2(1), imi2(2)
       ENDIF
       !
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domngb.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domngb.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domngb.F90	(revision 10314)
@@ -67,5 +67,6 @@
       
       IF( lk_mpp ) THEN  
-         CALL mpp_minloc( zdist(:,:), zmask, zmini, kii, kjj)
+         CALL mpp_minloc( 'domngb', zdist(:,:), zmask, zmini, iloc)
+         kii = iloc(1) ; kjj = iloc(2)
       ELSE
          iloc(:) = MINLOC( zdist(:,:), mask = zmask(:,:) == 1.e0 )
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domvvl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domvvl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/DOM/domvvl.F90	(revision 10314)
@@ -435,6 +435,6 @@
          IF( ( z_tmax >  rn_zdef_max ) .OR. ( z_tmin < - rn_zdef_max ) ) THEN
             IF( lk_mpp ) THEN
-               CALL mpp_maxloc( ze3t, tmask, z_tmax, ijk_max(1), ijk_max(2), ijk_max(3) )
-               CALL mpp_minloc( ze3t, tmask, z_tmin, ijk_min(1), ijk_min(2), ijk_min(3) )
+               CALL mpp_maxloc( 'domvvl', ze3t, tmask, z_tmax, ijk_max )
+               CALL mpp_minloc( 'domvvl', ze3t, tmask, z_tmin, ijk_min )
             ELSE
                ijk_max = MAXLOC( ze3t(:,:,:) )
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/ICB/icbutl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/ICB/icbutl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/ICB/icbutl.F90	(revision 10314)
@@ -73,11 +73,11 @@
       va_e(:,:) = 0._wp   ;   va_e(1:jpi,1:jpj) = vtau (:,:) * vmask(:,:,1) ! maybe mask useless because mask applied in sbcblk
       !
-      CALL lbc_lnk_icb( uo_e, 'U', -1._wp, 1, 1 )
-      CALL lbc_lnk_icb( vo_e, 'V', -1._wp, 1, 1 )
-      CALL lbc_lnk_icb( ff_e, 'F', +1._wp, 1, 1 )
-      CALL lbc_lnk_icb( ua_e, 'U', -1._wp, 1, 1 )
-      CALL lbc_lnk_icb( va_e, 'V', -1._wp, 1, 1 )
-      CALL lbc_lnk_icb( fr_e, 'T', +1._wp, 1, 1 )
-      CALL lbc_lnk_icb( tt_e, 'T', +1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', uo_e, 'U', -1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', vo_e, 'V', -1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', ff_e, 'F', +1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', ua_e, 'U', -1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', va_e, 'V', -1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', fr_e, 'T', +1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', tt_e, 'T', +1._wp, 1, 1 )
 #if defined key_si3
       hicth(:,:) = 0._wp ;  hicth(1:jpi,1:jpj) = hm_i (:,:)  
@@ -85,7 +85,7 @@
       vi_e(:,:) = 0._wp ;   vi_e(1:jpi, 1:jpj) = v_ice(:,:)
       !
-      CALL lbc_lnk_icb( hicth, 'T', +1._wp, 1, 1 )
-      CALL lbc_lnk_icb( ui_e , 'U', -1._wp, 1, 1 )
-      CALL lbc_lnk_icb( vi_e , 'V', -1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', hicth, 'T', +1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', ui_e , 'U', -1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', vi_e , 'V', -1._wp, 1, 1 )
 #endif
 
@@ -102,5 +102,5 @@
       ssh_e(0,jpj+1)     = ssh_e(1,jpj)
       ssh_e(jpi+1,jpj+1) = ssh_e(jpi,jpj)
-      CALL lbc_lnk_icb( ssh_e, 'T', +1._wp, 1, 1 )
+      CALL lbc_lnk_icb( 'icbutl', ssh_e, 'T', +1._wp, 1, 1 )
       !
    END SUBROUTINE icb_utl_copy
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lbc_lnk_generic.h90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lbc_lnk_generic.h90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lbc_lnk_generic.h90	(revision 10314)
@@ -46,9 +46,10 @@
 
 #if defined MULTI
-   SUBROUTINE ROUTINE_LNK( ptab, cd_nat, psgn, kfld, cd_mpp, pval )
+   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn, kfld, cd_mpp, pval )
       INTEGER                     , INTENT(in   ) ::   kfld        ! number of pt3d arrays
 #else
-   SUBROUTINE ROUTINE_LNK( ptab, cd_nat, psgn      , cd_mpp, pval )
+   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn      , cd_mpp, pval )
 #endif
+      CHARACTER(len=*)            , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       ARRAY_TYPE(:,:,:,:,:)                                        ! array or pointer of arrays on which the boundary condition is applied
       CHARACTER(len=1)            , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lbclnk.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lbclnk.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lbclnk.F90	(revision 10314)
@@ -90,5 +90,5 @@
    !
    INTERFACE lbc_bdy_lnk
-      MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d
+      MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d, lbc_bdy_lnk_4d
    END INTERFACE
    !
@@ -179,6 +179,18 @@
    !!----------------------------------------------------------------------
    
-   SUBROUTINE lbc_bdy_lnk_3d( pt3d, cd_type, psgn, ib_bdy )
-      !!----------------------------------------------------------------------
+   SUBROUTINE lbc_bdy_lnk_4d( cdname, pt4d, cd_type, psgn, ib_bdy )
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*)          , INTENT(in   ) ::   cdname      ! name of the calling subroutine
+      REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt4d      ! 3D array on which the lbc is applied
+      CHARACTER(len=1)          , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points
+      REAL(wp)                  , INTENT(in   ) ::   psgn      ! sign used across north fold 
+      INTEGER                   , INTENT(in   ) ::   ib_bdy    ! BDY boundary set
+      !!----------------------------------------------------------------------
+      CALL lbc_lnk_4d( cdname, pt4d, cd_type, psgn)
+   END SUBROUTINE lbc_bdy_lnk_4d
+
+   SUBROUTINE lbc_bdy_lnk_3d( cdname, pt3d, cd_type, psgn, ib_bdy )
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*)          , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pt3d      ! 3D array on which the lbc is applied
       CHARACTER(len=1)          , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points
@@ -186,10 +198,11 @@
       INTEGER                   , INTENT(in   ) ::   ib_bdy    ! BDY boundary set
       !!----------------------------------------------------------------------
-      CALL lbc_lnk_3d( pt3d, cd_type, psgn)
+      CALL lbc_lnk_3d( cdname, pt3d, cd_type, psgn)
    END SUBROUTINE lbc_bdy_lnk_3d
 
 
-   SUBROUTINE lbc_bdy_lnk_2d( pt2d, cd_type, psgn, ib_bdy )
-      !!----------------------------------------------------------------------
+   SUBROUTINE lbc_bdy_lnk_2d( cdname, pt2d, cd_type, psgn, ib_bdy )
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*)        , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pt2d      ! 3D array on which the lbc is applied
       CHARACTER(len=1)        , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points
@@ -197,5 +210,5 @@
       INTEGER                 , INTENT(in   ) ::   ib_bdy    ! BDY boundary set
       !!----------------------------------------------------------------------
-      CALL lbc_lnk_2d( pt2d, cd_type, psgn)
+      CALL lbc_lnk_2d( cdname, pt2d, cd_type, psgn)
    END SUBROUTINE lbc_bdy_lnk_2d
 
@@ -203,6 +216,7 @@
 !!gm  This routine should be removed with an optional halos size added in argument of generic routines
 
-   SUBROUTINE lbc_lnk_2d_icb( pt2d, cd_type, psgn, ki, kj )
-      !!----------------------------------------------------------------------
+   SUBROUTINE lbc_lnk_2d_icb( cdname, pt2d, cd_type, psgn, ki, kj )
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*)        , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pt2d      ! 2D array on which the lbc is applied
       CHARACTER(len=1)        , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points
@@ -210,5 +224,5 @@
       INTEGER                 , INTENT(in   ) ::   ki, kj    ! sizes of extra halo (not needed in non-mpp)
       !!----------------------------------------------------------------------
-      CALL lbc_lnk_2d( pt2d, cd_type, psgn )
+      CALL lbc_lnk_2d( cdname, pt2d, cd_type, psgn )
    END SUBROUTINE lbc_lnk_2d_icb
 !!gm end
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lib_mpp.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lib_mpp.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lib_mpp.F90	(revision 10314)
@@ -84,5 +84,4 @@
    PUBLIC   mpp_min, mpp_max, mpp_sum, mpp_minloc, mpp_maxloc
    PUBLIC   mpp_ilor
-   PUBLIC   mpp_max_multiple
    PUBLIC   mppscatter, mppgather
    PUBLIC   mpp_ini_znl
@@ -112,7 +111,4 @@
       MODULE PROCEDURE mpp_maxloc2d ,mpp_maxloc3d
    END INTERFACE
-   INTERFACE mpp_max_multiple
-      MODULE PROCEDURE mppmax_real_multiple
-   END INTERFACE
 
    !! ========================= !!
@@ -163,5 +159,7 @@
    INTEGER, PUBLIC                               ::   ncom_fsbc = 1                !: copy of sbc time step # nn_fsbc
    INTEGER, PUBLIC                               ::   ncom_dttrc = 1               !: copy of top time step # nn_dttrc
+   INTEGER, PUBLIC                               ::   ncom_freq                    !: frequency of comm diagnostic
    INTEGER, PUBLIC , DIMENSION(:,:), ALLOCATABLE ::   ncomm_sequence               !: size of communicated arrays (halos)
+   INTEGER, PARAMETER, PUBLIC                    ::   ncom_rec_max = 2000          !: max number of communication record
    INTEGER, PUBLIC                               ::   n_sequence_lbc = 0           !: # of communicated arraysvia lbc
    INTEGER, PUBLIC                               ::   n_sequence_glb = 0           !: # of global communications
@@ -721,186 +719,34 @@
 #  undef OPERATION_SUM_DD
 
-   SUBROUTINE mppmax_real_multiple( pt1d, kdim, kcom  )
-      !!----------------------------------------------------------------------
-      !!                  ***  routine mppmax_real  ***
-      !!
-      !! ** Purpose :   Maximum across processor of each element of a 1D arrays
-      !!
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(kdim), INTENT(inout) ::   pt1d   ! 1D arrays
-      INTEGER                  , INTENT(in   ) ::   kdim
-      INTEGER , OPTIONAL       , INTENT(in   ) ::   kcom   ! local communicator
-      !!
-      INTEGER  ::   ierror, ilocalcomm
-      REAL(wp), DIMENSION(kdim) ::  zwork
-      !!----------------------------------------------------------------------
-      ilocalcomm = mpi_comm_oce
-      IF( PRESENT(kcom) )   ilocalcomm = kcom
-      !
-      CALL mpi_allreduce( pt1d, zwork, kdim, mpi_double_precision, mpi_max, ilocalcomm, ierror )
-      pt1d(:) = zwork(:)
-      !
-   END SUBROUTINE mppmax_real_multiple
-
-
-   SUBROUTINE mpp_minloc2d( ptab, pmask, pmin, ki,kj )
-      !!------------------------------------------------------------------------
-      !!             ***  routine mpp_minloc  ***
-      !!
-      !! ** Purpose :   Compute the global minimum of an array ptab
-      !!              and also give its global position
-      !!
-      !! ** Method  :   Use MPI_ALLREDUCE with MPI_MINLOC
-      !!
-      !!--------------------------------------------------------------------------
-      REAL(wp), DIMENSION (jpi,jpj), INTENT(in   ) ::   ptab    ! Local 2D array
-      REAL(wp), DIMENSION (jpi,jpj), INTENT(in   ) ::   pmask   ! Local mask
-      REAL(wp)                     , INTENT(  out) ::   pmin    ! Global minimum of ptab
-      INTEGER                      , INTENT(  out) ::   ki, kj  ! index of minimum in global frame
-      !
-      INTEGER :: ierror
-      INTEGER , DIMENSION(2)   ::   ilocs
-      REAL(wp) ::   zmin   ! local minimum
-      REAL(wp), DIMENSION(2,1) ::   zain, zaout
-      !!-----------------------------------------------------------------------
-      !
-      zmin  = MINVAL( ptab(:,:) , mask= pmask == 1._wp )
-      ilocs = MINLOC( ptab(:,:) , mask= pmask == 1._wp )
-      !
-      ki = ilocs(1) + nimpp - 1
-      kj = ilocs(2) + njmpp - 1
-      !
-      zain(1,:)=zmin
-      zain(2,:)=ki+10000.*kj
-      !
-      CALL MPI_ALLREDUCE( zain,zaout, 1, MPI_2DOUBLE_PRECISION,MPI_MINLOC,MPI_COMM_OCE,ierror)
-      !
-      pmin = zaout(1,1)
-      kj = INT(zaout(2,1)/10000.)
-      ki = INT(zaout(2,1) - 10000.*kj )
-      !
-   END SUBROUTINE mpp_minloc2d
-
-
-   SUBROUTINE mpp_minloc3d( ptab, pmask, pmin, ki, kj ,kk)
-      !!------------------------------------------------------------------------
-      !!             ***  routine mpp_minloc  ***
-      !!
-      !! ** Purpose :   Compute the global minimum of an array ptab
-      !!              and also give its global position
-      !!
-      !! ** Method  :   Use MPI_ALLREDUCE with MPI_MINLOC
-      !!
-      !!--------------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptab         ! Local 2D array
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pmask        ! Local mask
-      REAL(wp)                  , INTENT(  out) ::   pmin         ! Global minimum of ptab
-      INTEGER                   , INTENT(  out) ::   ki, kj, kk   ! index of minimum in global frame
-      !
-      INTEGER  ::   ierror
-      REAL(wp) ::   zmin     ! local minimum
-      INTEGER , DIMENSION(3)   ::   ilocs
-      REAL(wp), DIMENSION(2,1) ::   zain, zaout
-      !!-----------------------------------------------------------------------
-      !
-      zmin  = MINVAL( ptab(:,:,:) , mask= pmask == 1._wp )
-      ilocs = MINLOC( ptab(:,:,:) , mask= pmask == 1._wp )
-      !
-      ki = ilocs(1) + nimpp - 1
-      kj = ilocs(2) + njmpp - 1
-      kk = ilocs(3)
-      !
-      zain(1,:) = zmin
-      zain(2,:) = ki + 10000.*kj + 100000000.*kk
-      !
-      CALL MPI_ALLREDUCE( zain,zaout, 1, MPI_2DOUBLE_PRECISION,MPI_MINLOC,MPI_COMM_OCE,ierror)
-      !
-      pmin = zaout(1,1)
-      kk   = INT( zaout(2,1) / 100000000. )
-      kj   = INT( zaout(2,1) - kk * 100000000. ) / 10000
-      ki   = INT( zaout(2,1) - kk * 100000000. -kj * 10000. )
-      !
-   END SUBROUTINE mpp_minloc3d
-
-
-   SUBROUTINE mpp_maxloc2d( ptab, pmask, pmax, ki, kj )
-      !!------------------------------------------------------------------------
-      !!             ***  routine mpp_maxloc  ***
-      !!
-      !! ** Purpose :   Compute the global maximum of an array ptab
-      !!              and also give its global position
-      !!
-      !! ** Method  :   Use MPI_ALLREDUCE with MPI_MINLOC
-      !!
-      !!--------------------------------------------------------------------------
-      REAL(wp), DIMENSION (jpi,jpj), INTENT(in   ) ::   ptab     ! Local 2D array
-      REAL(wp), DIMENSION (jpi,jpj), INTENT(in   ) ::   pmask    ! Local mask
-      REAL(wp)                     , INTENT(  out) ::   pmax     ! Global maximum of ptab
-      INTEGER                      , INTENT(  out) ::   ki, kj   ! index of maximum in global frame
-      !!
-      INTEGER  :: ierror
-      INTEGER, DIMENSION (2)   ::   ilocs
-      REAL(wp) :: zmax   ! local maximum
-      REAL(wp), DIMENSION(2,1) ::   zain, zaout
-      !!-----------------------------------------------------------------------
-      !
-      zmax  = MAXVAL( ptab(:,:) , mask= pmask == 1._wp )
-      ilocs = MAXLOC( ptab(:,:) , mask= pmask == 1._wp )
-      !
-      ki = ilocs(1) + nimpp - 1
-      kj = ilocs(2) + njmpp - 1
-      !
-      zain(1,:) = zmax
-      zain(2,:) = ki + 10000. * kj
-      !
-      CALL MPI_ALLREDUCE( zain,zaout, 1, MPI_2DOUBLE_PRECISION,MPI_MAXLOC,MPI_COMM_OCE,ierror)
-      !
-      pmax = zaout(1,1)
-      kj   = INT( zaout(2,1) / 10000.     )
-      ki   = INT( zaout(2,1) - 10000.* kj )
-      !
-   END SUBROUTINE mpp_maxloc2d
-
-
-   SUBROUTINE mpp_maxloc3d( ptab, pmask, pmax, ki, kj, kk )
-      !!------------------------------------------------------------------------
-      !!             ***  routine mpp_maxloc  ***
-      !!
-      !! ** Purpose :  Compute the global maximum of an array ptab
-      !!              and also give its global position
-      !!
-      !! ** Method : Use MPI_ALLREDUCE with MPI_MINLOC
-      !!
-      !!--------------------------------------------------------------------------
-      REAL(wp), DIMENSION (:,:,:), INTENT(in   ) ::   ptab         ! Local 2D array
-      REAL(wp), DIMENSION (:,:,:), INTENT(in   ) ::   pmask        ! Local mask
-      REAL(wp)                   , INTENT(  out) ::   pmax         ! Global maximum of ptab
-      INTEGER                    , INTENT(  out) ::   ki, kj, kk   ! index of maximum in global frame
-      !
-      INTEGER  ::   ierror   ! local integer
-      REAL(wp) ::   zmax     ! local maximum
-      REAL(wp), DIMENSION(2,1) ::   zain, zaout
-      INTEGER , DIMENSION(3)   ::   ilocs
-      !!-----------------------------------------------------------------------
-      !
-      zmax  = MAXVAL( ptab(:,:,:) , mask= pmask == 1._wp )
-      ilocs = MAXLOC( ptab(:,:,:) , mask= pmask == 1._wp )
-      !
-      ki = ilocs(1) + nimpp - 1
-      kj = ilocs(2) + njmpp - 1
-      kk = ilocs(3)
-      !
-      zain(1,:) = zmax
-      zain(2,:) = ki + 10000.*kj + 100000000.*kk
-      !
-      CALL MPI_ALLREDUCE( zain,zaout, 1, MPI_2DOUBLE_PRECISION,MPI_MAXLOC,MPI_COMM_OCE,ierror)
-      !
-      pmax = zaout(1,1)
-      kk   = INT( zaout(2,1) / 100000000. )
-      kj   = INT( zaout(2,1) - kk * 100000000. ) / 10000
-      ki   = INT( zaout(2,1) - kk * 100000000. -kj * 10000. )
-      !
-   END SUBROUTINE mpp_maxloc3d
-
+   !!----------------------------------------------------------------------
+   !!    ***  mpp_minloc2d, mpp_minloc3d, mpp_maxloc2d, mpp_maxloc3d
+   !!   
+   !!----------------------------------------------------------------------
+   !!
+#  define OPERATION_MINLOC
+#  define DIM_2d
+#     define ROUTINE_LOC           mpp_minloc2d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_2d
+#  define DIM_3d
+#     define ROUTINE_LOC           mpp_minloc3d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_3d
+#  undef OPERATION_MINLOC
+
+#  define OPERATION_MAXLOC
+#  define DIM_2d
+#     define ROUTINE_LOC           mpp_maxloc2d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_2d
+#  define DIM_3d
+#     define ROUTINE_LOC           mpp_maxloc3d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_3d
+#  undef OPERATION_MAXLOC
 
    SUBROUTINE mppsync()
@@ -1247,7 +1093,11 @@
       !
       itaille = jpimax * ( ipj + 2*kextj )
+      !
+      IF( ln_timing ) CALL tic_tac(.TRUE.)
       CALL MPI_ALLGATHER( znorthloc_e(1,1-kextj)    , itaille, MPI_DOUBLE_PRECISION,    &
          &                znorthgloio_e(1,1-kextj,1), itaille, MPI_DOUBLE_PRECISION,    &
          &                ncomm_north, ierr )
+      !
+      IF( ln_timing ) CALL tic_tac(.FALSE.)
       !
       DO jr = 1, ndim_rank_north            ! recover the global north array
@@ -1281,5 +1131,5 @@
 
 
-   SUBROUTINE mpp_lnk_2d_icb( pt2d, cd_type, psgn, kexti, kextj )
+   SUBROUTINE mpp_lnk_2d_icb( cdname, pt2d, cd_type, psgn, kexti, kextj )
       !!----------------------------------------------------------------------
       !!                  ***  routine mpp_lnk_2d_icb  ***
@@ -1303,4 +1153,5 @@
       !!                    nono   : number for local neighboring processors
       !!----------------------------------------------------------------------
+      CHARACTER(len=*)                                        , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       REAL(wp), DIMENSION(1-kexti:jpi+kexti,1-kextj:jpj+kextj), INTENT(inout) ::   pt2d     ! 2D array with extra halo
       CHARACTER(len=1)                                        , INTENT(in   ) ::   cd_type  ! nature of ptab array grid-points
@@ -1322,4 +1173,5 @@
       iprecj = nn_hls + kextj
 
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, 1, 1, 1, ld_lbc = .TRUE. )
 
       ! 1. standard boundary treatment
@@ -1373,4 +1225,6 @@
       !                           ! Migrations
       imigr = ipreci * ( jpj + 2*kextj )
+      !
+      IF( ln_timing ) CALL tic_tac(.TRUE.)
       !
       SELECT CASE ( nbondi )
@@ -1392,4 +1246,6 @@
       END SELECT
       !
+      IF( ln_timing ) CALL tic_tac(.FALSE.)
+      !
       !                           ! Write Dirichlet lateral conditions
       iihom = jpi - nn_hls
@@ -1426,4 +1282,6 @@
       !                           ! Migrations
       imigr = iprecj * ( jpi + 2*kexti )
+      !
+      IF( ln_timing ) CALL tic_tac(.TRUE.)
       !
       SELECT CASE ( nbondj )
@@ -1445,4 +1303,6 @@
       END SELECT
       !
+      IF( ln_timing ) CALL tic_tac(.FALSE.)
+      !
       !                           ! Write Dirichlet lateral conditions
       ijhom = jpj - nn_hls
@@ -1466,4 +1326,99 @@
    END SUBROUTINE mpp_lnk_2d_icb
 
+
+   SUBROUTINE mpp_report( cdname, kpk, kpl, kpf, ld_lbc, ld_glb )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_report  ***
+      !!
+      !! ** Purpose :   report use of mpp routines per time-setp
+      !!
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*),           INTENT(in   ) ::   cdname      ! name of the calling subroutine
+      INTEGER         , OPTIONAL, INTENT(in   ) ::   kpk, kpl, kpf
+      LOGICAL         , OPTIONAL, INTENT(in   ) ::   ld_lbc, ld_glb
+      !!
+      LOGICAL ::   ll_lbc, ll_glb
+      INTEGER ::    ji,  jj,  jk,  jh, jf   ! dummy loop indices
+      !!----------------------------------------------------------------------
+      !
+      ll_lbc = .FALSE.
+      IF( PRESENT(ld_lbc) ) ll_lbc = ld_lbc
+      ll_glb = .FALSE.
+      IF( PRESENT(ld_glb) ) ll_glb = ld_glb
+      !
+      ! find the smallest common frequency: default = frequency product, if multiple, choose the larger of the 2 frequency
+      ncom_freq = ncom_fsbc * ncom_dttrc
+      IF( MOD( MAX(ncom_fsbc,ncom_dttrc), MIN(ncom_fsbc,ncom_dttrc) ) == 0 ) ncom_freq = MAX(ncom_fsbc,ncom_dttrc)
+      !
+      IF ( ncom_stp == nit000+ncom_freq ) THEN   ! avoid to count extra communications in potential initializations at nit000
+         IF( ll_lbc ) THEN
+            IF( .NOT. ALLOCATED(ncomm_sequence) ) ALLOCATE( ncomm_sequence(ncom_rec_max,2) )
+            IF( .NOT. ALLOCATED(    crname_lbc) ) ALLOCATE(     crname_lbc(ncom_rec_max  ) )
+            n_sequence_lbc = n_sequence_lbc + 1
+            IF( n_sequence_lbc > ncom_rec_max ) CALL ctl_stop( 'STOP', 'lnk_generic, increase ncom_rec_max' )   ! deadlock
+            crname_lbc(n_sequence_lbc) = cdname     ! keep the name of the calling routine
+            ncomm_sequence(n_sequence_lbc,1) = kpk*kpl   ! size of 3rd and 4th dimensions
+            ncomm_sequence(n_sequence_lbc,2) = kpf       ! number of arrays to be treated (multi)
+         ENDIF
+         IF( ll_glb ) THEN
+            IF( .NOT. ALLOCATED(crname_glb) ) ALLOCATE( crname_glb(ncom_rec_max) )
+            n_sequence_glb = n_sequence_glb + 1
+            IF( n_sequence_glb > ncom_rec_max ) CALL ctl_stop( 'STOP', 'lnk_generic, increase ncom_rec_max' )   ! deadlock
+            crname_glb(n_sequence_glb) = cdname     ! keep the name of the calling routine
+         ENDIF
+      ELSE IF ( ncom_stp == nit000+2*ncom_freq ) THEN
+         CALL ctl_opn( numcom, 'communication_report.txt', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea )
+         WRITE(numcom,*) ' '
+         WRITE(numcom,*) ' ------------------------------------------------------------'
+         WRITE(numcom,*) ' Communication pattern report (second oce+sbc+top time step):'
+         WRITE(numcom,*) ' ------------------------------------------------------------'
+         WRITE(numcom,*) ' '
+         WRITE(numcom,'(A,I4)') ' Exchanged halos : ', n_sequence_lbc
+         jj = 0; jk = 0; jf = 0; jh = 0
+         DO ji = 1, n_sequence_lbc
+            IF ( ncomm_sequence(ji,1) .GT. 1 ) jk = jk + 1
+            IF ( ncomm_sequence(ji,2) .GT. 1 ) jf = jf + 1
+            IF ( ncomm_sequence(ji,1) .GT. 1 .AND. ncomm_sequence(ji,2) .GT. 1 ) jj = jj + 1
+            jh = MAX (jh, ncomm_sequence(ji,1)*ncomm_sequence(ji,2))
+         END DO
+         WRITE(numcom,'(A,I3)') ' 3D Exchanged halos : ', jk
+         WRITE(numcom,'(A,I3)') ' Multi arrays exchanged halos : ', jf
+         WRITE(numcom,'(A,I3)') '   from which 3D : ', jj
+         WRITE(numcom,'(A,I10)') ' Array max size : ', jh*jpi*jpj
+         WRITE(numcom,*) ' '
+         WRITE(numcom,*) ' lbc_lnk called'
+         jj = 1
+         DO ji = 2, n_sequence_lbc
+            IF( crname_lbc(ji-1) /= crname_lbc(ji) ) THEN
+               WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_lbc(ji-1))
+               jj = 0
+            END IF
+            jj = jj + 1 
+         END DO
+         WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_lbc(n_sequence_lbc))
+         WRITE(numcom,*) ' '
+         IF ( n_sequence_glb > 0 ) THEN
+            WRITE(numcom,'(A,I4)') ' Global communications : ', n_sequence_glb
+            jj = 1
+            DO ji = 2, n_sequence_glb
+               IF( crname_glb(ji-1) /= crname_glb(ji) ) THEN
+                  WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_glb(ji-1))
+                  jj = 0
+               END IF
+               jj = jj + 1 
+            END DO
+            WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_glb(n_sequence_glb))
+            DEALLOCATE(crname_glb)
+         ELSE
+            WRITE(numcom,*) ' No MPI global communication '
+         ENDIF
+         WRITE(numcom,*) ' '
+         WRITE(numcom,*) ' -----------------------------------------------'
+         WRITE(numcom,*) ' '
+         DEALLOCATE(ncomm_sequence)
+         DEALLOCATE(crname_lbc)
+      ENDIF
+   END SUBROUTINE mpp_report
+
    
    SUBROUTINE tic_tac (ld_tic, ld_global)
@@ -1482,5 +1437,4 @@
     END IF
     
-#if defined key_mpp_mpi
     IF ( ld_tic ) THEN
        tic_wt(ii) = MPI_Wtime()                                                    ! start count tic->tac (waiting time)
@@ -1490,5 +1444,4 @@
        tic_ct = MPI_Wtime()                                                        ! start count tac->tic (waiting time)
     ENDIF
-#endif
     
    END SUBROUTINE tic_tac
@@ -1502,5 +1455,5 @@
 
    INTERFACE mpp_sum
-      MODULE PROCEDURE mpp_sum_a2s, mpp_sum_as, mpp_sum_ai, mpp_sum_s, mpp_sum_i, mppsum_realdd, mppsum_a_realdd
+      MODULE PROCEDURE mppsum_int, mppsum_a_int, mppsum_real, mppsum_a_real, mppsum_realdd, mppsum_a_realdd
    END INTERFACE
    INTERFACE mpp_max
@@ -1516,7 +1469,4 @@
       MODULE PROCEDURE mpp_maxloc2d ,mpp_maxloc3d
    END INTERFACE
-   INTERFACE mpp_max_multiple
-      MODULE PROCEDURE mppmax_real_multiple
-   END INTERFACE
 
    LOGICAL, PUBLIC, PARAMETER ::   lk_mpp = .FALSE.      !: mpp flag
@@ -1545,129 +1495,148 @@
    END SUBROUTINE mppsync
 
-   SUBROUTINE mpp_sum_as( parr, kdim, kcom )      ! Dummy routine
-      REAL   , DIMENSION(:) :: parr
-      INTEGER               :: kdim
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mpp_sum_as: You should not have seen this print! error?', kdim, parr(1), kcom
-   END SUBROUTINE mpp_sum_as
-
-   SUBROUTINE mpp_sum_a2s( parr, kdim, kcom )      ! Dummy routine
-      REAL   , DIMENSION(:,:) :: parr
-      INTEGER               :: kdim
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mpp_sum_a2s: You should not have seen this print! error?', kdim, parr(1,1), kcom
-   END SUBROUTINE mpp_sum_a2s
-
-   SUBROUTINE mpp_sum_ai( karr, kdim, kcom )      ! Dummy routine
-      INTEGER, DIMENSION(:) :: karr
-      INTEGER               :: kdim
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mpp_sum_ai: You should not have seen this print! error?', kdim, karr(1), kcom
-   END SUBROUTINE mpp_sum_ai
-
-   SUBROUTINE mpp_sum_s( psca, kcom )            ! Dummy routine
-      REAL                  :: psca
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mpp_sum_s: You should not have seen this print! error?', psca, kcom
-   END SUBROUTINE mpp_sum_s
-
-   SUBROUTINE mpp_sum_i( kint, kcom )            ! Dummy routine
-      integer               :: kint
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mpp_sum_i: You should not have seen this print! error?', kint, kcom
-   END SUBROUTINE mpp_sum_i
-
-   SUBROUTINE mppsum_realdd( ytab, kcom )
-      COMPLEX(wp), INTENT(inout)         :: ytab    ! input scalar
-      INTEGER , INTENT( in  ), OPTIONAL :: kcom
-      WRITE(*,*) 'mppsum_realdd: You should not have seen this print! error?', ytab
-   END SUBROUTINE mppsum_realdd
-
-   SUBROUTINE mppsum_a_realdd( ytab, kdim, kcom )
-      INTEGER , INTENT( in )                        ::   kdim      ! size of ytab
-      COMPLEX(wp), DIMENSION(kdim), INTENT( inout ) ::   ytab      ! input array
-      INTEGER , INTENT( in  ), OPTIONAL :: kcom
-      WRITE(*,*) 'mppsum_a_realdd: You should not have seen this print! error?', kdim, ytab(1), kcom
-   END SUBROUTINE mppsum_a_realdd
-
-   SUBROUTINE mppmax_a_real( parr, kdim, kcom )
-      REAL   , DIMENSION(:) :: parr
-      INTEGER               :: kdim
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmax_a_real: You should not have seen this print! error?', kdim, parr(1), kcom
-   END SUBROUTINE mppmax_a_real
-
-   SUBROUTINE mppmax_real( psca, kcom )
-      REAL                  :: psca
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmax_real: You should not have seen this print! error?', psca, kcom
-   END SUBROUTINE mppmax_real
-
-   SUBROUTINE mppmin_a_real( parr, kdim, kcom )
-      REAL   , DIMENSION(:) :: parr
-      INTEGER               :: kdim
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmin_a_real: You should not have seen this print! error?', kdim, parr(1), kcom
-   END SUBROUTINE mppmin_a_real
-
-   SUBROUTINE mppmin_real( psca, kcom )
-      REAL                  :: psca
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmin_real: You should not have seen this print! error?', psca, kcom
-   END SUBROUTINE mppmin_real
-
-   SUBROUTINE mppmax_a_int( karr, kdim ,kcom)
-      INTEGER, DIMENSION(:) :: karr
-      INTEGER               :: kdim
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmax_a_int: You should not have seen this print! error?', kdim, karr(1), kcom
-   END SUBROUTINE mppmax_a_int
-
-   SUBROUTINE mppmax_int( kint, kcom)
-      INTEGER               :: kint
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmax_int: You should not have seen this print! error?', kint, kcom
-   END SUBROUTINE mppmax_int
-
-   SUBROUTINE mppmin_a_int( karr, kdim, kcom )
-      INTEGER, DIMENSION(:) :: karr
-      INTEGER               :: kdim
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmin_a_int: You should not have seen this print! error?', kdim, karr(1), kcom
-   END SUBROUTINE mppmin_a_int
-
-   SUBROUTINE mppmin_int( kint, kcom )
-      INTEGER               :: kint
-      INTEGER, OPTIONAL     :: kcom
-      WRITE(*,*) 'mppmin_int: You should not have seen this print! error?', kint, kcom
-   END SUBROUTINE mppmin_int
-
-   SUBROUTINE mpp_minloc2d( ptab, pmask, pmin, ki, kj )
-      REAL                   :: pmin
-      REAL , DIMENSION (:,:) :: ptab, pmask
-      INTEGER :: ki, kj
-      WRITE(*,*) 'mpp_minloc2d: You should not have seen this print! error?', pmin, ki, kj, ptab(1,1), pmask(1,1)
-   END SUBROUTINE mpp_minloc2d
-
-   SUBROUTINE mpp_minloc3d( ptab, pmask, pmin, ki, kj, kk )
-      REAL                     :: pmin
-      REAL , DIMENSION (:,:,:) :: ptab, pmask
-      INTEGER :: ki, kj, kk
-      WRITE(*,*) 'mpp_minloc3d: You should not have seen this print! error?', pmin, ki, kj, kk, ptab(1,1,1), pmask(1,1,1)
-   END SUBROUTINE mpp_minloc3d
-
-   SUBROUTINE mpp_maxloc2d( ptab, pmask, pmax, ki, kj )
-      REAL                   :: pmax
-      REAL , DIMENSION (:,:) :: ptab, pmask
-      INTEGER :: ki, kj
-      WRITE(*,*) 'mpp_maxloc2d: You should not have seen this print! error?', pmax, ki, kj, ptab(1,1), pmask(1,1)
-   END SUBROUTINE mpp_maxloc2d
-
-   SUBROUTINE mpp_maxloc3d( ptab, pmask, pmax, ki, kj, kk )
-      REAL                     :: pmax
-      REAL , DIMENSION (:,:,:) :: ptab, pmask
-      INTEGER :: ki, kj, kk
-      WRITE(*,*) 'mpp_maxloc3d: You should not have seen this print! error?', pmax, ki, kj, kk, ptab(1,1,1), pmask(1,1,1)
-   END SUBROUTINE mpp_maxloc3d
+   !!----------------------------------------------------------------------
+   !!    ***  mppmax_a_int, mppmax_int, mppmax_a_real, mppmax_real  ***
+   !!   
+   !!----------------------------------------------------------------------
+   !!
+#  define OPERATION_MAX
+#  define INTEGER_TYPE
+#  define DIM_0d
+#     define ROUTINE_ALLREDUCE           mppmax_int
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_0d
+#  define DIM_1d
+#     define ROUTINE_ALLREDUCE           mppmax_a_int
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_1d
+#  undef INTEGER_TYPE
+!
+#  define REAL_TYPE
+#  define DIM_0d
+#     define ROUTINE_ALLREDUCE           mppmax_real
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_0d
+#  define DIM_1d
+#     define ROUTINE_ALLREDUCE           mppmax_a_real
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_1d
+#  undef REAL_TYPE
+#  undef OPERATION_MAX
+   !!----------------------------------------------------------------------
+   !!    ***  mppmin_a_int, mppmin_int, mppmin_a_real, mppmin_real  ***
+   !!   
+   !!----------------------------------------------------------------------
+   !!
+#  define OPERATION_MIN
+#  define INTEGER_TYPE
+#  define DIM_0d
+#     define ROUTINE_ALLREDUCE           mppmin_int
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_0d
+#  define DIM_1d
+#     define ROUTINE_ALLREDUCE           mppmin_a_int
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_1d
+#  undef INTEGER_TYPE
+!
+#  define REAL_TYPE
+#  define DIM_0d
+#     define ROUTINE_ALLREDUCE           mppmin_real
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_0d
+#  define DIM_1d
+#     define ROUTINE_ALLREDUCE           mppmin_a_real
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_1d
+#  undef REAL_TYPE
+#  undef OPERATION_MIN
+
+   !!----------------------------------------------------------------------
+   !!    ***  mppsum_a_int, mppsum_int, mppsum_a_real, mppsum_real  ***
+   !!   
+   !!   Global sum of 1D array or a variable (integer, real or complex)
+   !!----------------------------------------------------------------------
+   !!
+#  define OPERATION_SUM
+#  define INTEGER_TYPE
+#  define DIM_0d
+#     define ROUTINE_ALLREDUCE           mppsum_int
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_0d
+#  define DIM_1d
+#     define ROUTINE_ALLREDUCE           mppsum_a_int
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_1d
+#  undef INTEGER_TYPE
+!
+#  define REAL_TYPE
+#  define DIM_0d
+#     define ROUTINE_ALLREDUCE           mppsum_real
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_0d
+#  define DIM_1d
+#     define ROUTINE_ALLREDUCE           mppsum_a_real
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_1d
+#  undef REAL_TYPE
+#  undef OPERATION_SUM
+
+#  define OPERATION_SUM_DD
+#  define COMPLEX_TYPE
+#  define DIM_0d
+#     define ROUTINE_ALLREDUCE           mppsum_realdd
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_0d
+#  define DIM_1d
+#     define ROUTINE_ALLREDUCE           mppsum_a_realdd
+#     include "mpp_allreduce_generic.h90"
+#     undef ROUTINE_ALLREDUCE
+#  undef DIM_1d
+#  undef COMPLEX_TYPE
+#  undef OPERATION_SUM_DD
+
+   !!----------------------------------------------------------------------
+   !!    ***  mpp_minloc2d, mpp_minloc3d, mpp_maxloc2d, mpp_maxloc3d
+   !!   
+   !!----------------------------------------------------------------------
+   !!
+#  define OPERATION_MINLOC
+#  define DIM_2d
+#     define ROUTINE_LOC           mpp_minloc2d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_2d
+#  define DIM_3d
+#     define ROUTINE_LOC           mpp_minloc3d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_3d
+#  undef OPERATION_MINLOC
+
+#  define OPERATION_MAXLOC
+#  define DIM_2d
+#     define ROUTINE_LOC           mpp_maxloc2d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_2d
+#  define DIM_3d
+#     define ROUTINE_LOC           mpp_maxloc3d
+#     include "mpp_loc_generic.h90"
+#     undef ROUTINE_LOC
+#  undef DIM_3d
+#  undef OPERATION_MAXLOC
 
    SUBROUTINE mpp_ilor( ld_switch, ldlast, kcom )
@@ -1692,11 +1661,4 @@
    END SUBROUTINE mpp_comm_free
    
-   SUBROUTINE mppmax_real_multiple( ptab, kdim , kcom  )
-      REAL, DIMENSION(:) ::   ptab   ! 
-      INTEGER            ::   kdim   ! 
-      INTEGER, OPTIONAL  ::   kcom   ! 
-      WRITE(*,*) 'mppmax_real_multiple: You should not have seen this print! error?', ptab(1), kdim
-   END SUBROUTINE mppmax_real_multiple
-
 #endif
 
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_allreduce_generic.h90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_allreduce_generic.h90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_allreduce_generic.h90	(revision 10314)
@@ -42,8 +42,12 @@
       INTEGER, OPTIONAL, INTENT(in   ) ::   kdim        ! optional pointer dimension
       INTEGER, OPTIONAL, INTENT(in   ) ::   kcom        ! optional communicator
+#if defined key_mpp_mpi
       !
       INTEGER :: ipi, ii, ierr
       INTEGER :: ierror, ilocalcomm
       TMP_TYPE(:)
+      !!-----------------------------------------------------------------------
+      !
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ld_glb = .TRUE. )
       !
       ilocalcomm = mpi_comm_oce
@@ -55,23 +59,16 @@
          ipi = I_SIZE(ptab)   ! 1st dimension
       ENDIF
-
+      !
+      ALLOCATE(work(ipi))
       IF( ln_timing ) CALL tic_tac(.TRUE., ld_global = .TRUE.)
-      ALLOCATE(work(ipi))
       CALL mpi_allreduce( ARRAY_IN(:), work, ipi, MPI_TYPE, MPI_OPERATION, ilocalcomm, ierror )
+      IF( ln_timing ) CALL tic_tac(.FALSE., ld_global = .TRUE.)
       DO ii = 1, ipi
          ARRAY_IN(ii) = work(ii)
       ENDDO
       DEALLOCATE(work)
-      IF( ln_timing ) CALL tic_tac(.FALSE., ld_global = .TRUE.)
-      !
-      IF( narea == 1 .AND. ncom_stp == nit000+5 ) THEN
-            IF( .NOT. ALLOCATED( crname_glb) ) THEN
-               ALLOCATE( crname_glb(2000), STAT=ierr )
-               IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'allreduce_generic, cannot allocate crname' )
-            ENDIF
-            n_sequence_glb = n_sequence_glb + 1
-            IF( n_sequence_glb > 2000 ) CALL ctl_stop( 'STOP', 'allreduce_generic, increase crname_glb first dimension' )
-            crname_glb(n_sequence_glb)   = cdname    ! keep the name of the calling routine
-      ENDIF
+#else
+      WRITE(*,*) 'ROUTINE_ALLREDUCE: You should not have seen this print! error?'
+#endif
 
    END SUBROUTINE ROUTINE_ALLREDUCE
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_bdy_generic.h90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_bdy_generic.h90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_bdy_generic.h90	(revision 10314)
@@ -21,5 +21,5 @@
 #   endif
 
-   SUBROUTINE ROUTINE_BDY( ptab, cd_nat, psgn      , kb_bdy )
+   SUBROUTINE ROUTINE_BDY( cdname, ptab, cd_nat, psgn      , kb_bdy )
       !!----------------------------------------------------------------------
       !!                  ***  routine mpp_lnk_bdy_3d  ***
@@ -42,4 +42,5 @@
       !!
       !!----------------------------------------------------------------------
+      CHARACTER(len=*)            , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       ARRAY_TYPE(:,:,:,:,:)   ! array or pointer of arrays on which the boundary condition is applied
       CHARACTER(len=1)            , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
@@ -61,4 +62,6 @@
       ipl = L_SIZE(ptab)   ! 4th    -
       ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
+      !
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
       !      
       ALLOCATE( zt3ns(jpi,nn_hls,ipk,ipl,ipf,2), zt3sn(jpi,nn_hls,ipk,ipl,ipf,2),   &
@@ -132,4 +135,6 @@
          imigr = nn_hls * jpj * ipk * ipl
          !
+         IF( ln_timing ) CALL tic_tac(.TRUE.)
+         !
          SELECT CASE ( nbondi_bdy(IBD_IN(jf)) )
          CASE ( -1 )
@@ -150,4 +155,6 @@
          END SELECT
          !
+         IF( ln_timing ) CALL tic_tac(.FALSE.)
+         !
          !                           ! Write Dirichlet lateral conditions
          iihom = nlci-nn_hls
@@ -205,4 +212,6 @@
          imigr = nn_hls * jpi * ipk * ipl
          !
+         IF( ln_timing ) CALL tic_tac(.TRUE.)
+         ! 
          SELECT CASE ( nbondj_bdy(IBD_IN(jf)) )
          CASE ( -1 )
@@ -222,4 +231,6 @@
             IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err)
          END SELECT
+         !
+         IF( ln_timing ) CALL tic_tac(.FALSE.)
          !
          !                           ! Write Dirichlet lateral conditions
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_lnk_generic.h90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_lnk_generic.h90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_lnk_generic.h90	(revision 10314)
@@ -63,5 +63,4 @@
       INTEGER  ::   ml_req1, ml_req2, ml_err     ! for key_mpi_isend
       INTEGER  ::   ierr
-      INTEGER  ::   icom_freq
       REAL(wp) ::   zland
       INTEGER , DIMENSION(MPI_STATUS_SIZE)      ::   ml_stat        ! for key_mpi_isend
@@ -73,4 +72,6 @@
       ipl = L_SIZE(ptab)   ! 4th    -
       ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
+      !
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
       !
       ALLOCATE( zt3ns(jpi,nn_hls,ipk,ipl,ipf,2), zt3sn(jpi,nn_hls,ipk,ipl,ipf,2),   &
@@ -151,79 +152,5 @@
       !
       !                           ! Migrations
-      imigr = nn_hls * jpj * ipk * ipl * ipf
-      !
-      IF( narea == 1 ) THEN
-
-         ! find the smallest common frequency: default = frequency product, if multiple, choose the larger of the 2 frequency
-         icom_freq = ncom_fsbc * ncom_dttrc
-         IF( MOD( MAX(ncom_fsbc,ncom_dttrc), MIN(ncom_fsbc,ncom_dttrc) ) == 0 ) icom_freq = MAX(ncom_fsbc,ncom_dttrc)
-         
-         IF ( ncom_stp == nit000+icom_freq ) THEN   ! avoid to count extra communications in potential initializations at nit000
-            IF( .NOT. ALLOCATED( ncomm_sequence) ) THEN
-               ALLOCATE( ncomm_sequence(2000,2), STAT=ierr )
-               IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'lnk_generic, cannot allocate ncomm_sequence' )
-               ALLOCATE( crname_lbc(2000), STAT=ierr )
-               IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'lnk_generic, cannot allocate crname' )
-            ENDIF
-            n_sequence_lbc = n_sequence_lbc + 1
-            IF( n_sequence_lbc > 2000 ) CALL ctl_stop( 'STOP', 'lnk_generic, increase ncomm_sequence first dimension' )
-            ncomm_sequence(n_sequence_lbc,1) = ipk*ipl   ! size of 3rd and 4th dimensions
-            ncomm_sequence(n_sequence_lbc,2) = ipf       ! number of arrays to be treated (multi)
-            crname_lbc    (n_sequence_lbc)   = cdname    ! keep the name of the calling routine
-         ELSE IF ( ncom_stp == (nit000+2*icom_freq) ) THEN
-            IF ( numcom == -1 ) THEN
-               CALL ctl_opn( numcom, 'communication_report.txt', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea )
-               WRITE(numcom,*) ' '
-               WRITE(numcom,*) ' ------------------------------------------------------------'
-               WRITE(numcom,*) ' Communication pattern report (second oce+sbc+top time step):'
-               WRITE(numcom,*) ' ------------------------------------------------------------'
-               WRITE(numcom,*) ' '
-               WRITE(numcom,'(A,I4)') ' Exchanged halos : ', n_sequence_lbc
-               jj = 0; jk = 0; jf = 0; jh = 0
-               DO ji = 1, n_sequence_lbc
-                  IF ( ncomm_sequence(ji,1) .GT. 1 ) jk = jk + 1
-                  IF ( ncomm_sequence(ji,2) .GT. 1 ) jf = jf + 1
-                  IF ( ncomm_sequence(ji,1) .GT. 1 .AND. ncomm_sequence(ji,2) .GT. 1 ) jj = jj + 1
-                  jh = MAX (jh, ncomm_sequence(ji,1)*ncomm_sequence(ji,2))
-               END DO
-               WRITE(numcom,'(A,I3)') ' 3D Exchanged halos : ', jk
-               WRITE(numcom,'(A,I3)') ' Multi arrays exchanged halos : ', jf
-               WRITE(numcom,'(A,I3)') '   from which 3D : ', jj
-               WRITE(numcom,'(A,I10)') ' Array max size : ', jh*jpi*jpj
-               WRITE(numcom,*) ' '
-               WRITE(numcom,*) ' lbc_lnk called'
-               jj = 1
-               DO ji = 2, n_sequence_lbc
-                  IF( crname_lbc(ji-1) /= crname_lbc(ji) ) THEN
-                    WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_lbc(ji-1))
-                    jj = 0
-                  END IF
-                  jj = jj + 1 
-               END DO
-               WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_lbc(n_sequence_lbc))
-               WRITE(numcom,*) ' '
-               IF ( n_sequence_glb > 0 ) THEN
-                  WRITE(numcom,'(A,I4)') ' Global communications : ', n_sequence_glb
-                  jj = 1
-                  DO ji = 2, n_sequence_glb
-                     IF( crname_glb(ji-1) /= crname_glb(ji) ) THEN
-                       WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_glb(ji-1))
-                       jj = 0
-                     END IF
-                     jj = jj + 1 
-                  END DO
-                  WRITE(numcom,'(A, I4, A, A)') ' - ', jj,' times by subroutine ', TRIM(crname_glb(n_sequence_glb))
-                  DEALLOCATE(crname_glb)
-               ELSE
-                  WRITE(numcom,*) ' No MPI global communication '
-               ENDIF
-               WRITE(numcom,*) ' '
-               WRITE(numcom,*) ' -----------------------------------------------'
-               WRITE(numcom,*) ' '
-               DEALLOCATE(ncomm_sequence)
-               DEALLOCATE(crname_lbc)
-            ENDIF
-         ENDIF
-      ENDIF
+      imigr = nn_hls * jpj * ipk * ipl * ipf      
       !
       IF( ln_timing ) CALL tic_tac(.TRUE.)
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_loc_generic.h90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_loc_generic.h90	(revision 10314)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/mpp_loc_generic.h90	(revision 10314)
@@ -0,0 +1,84 @@
+                          !==  IN: ptab is an array  ==!
+#      define ARRAY_TYPE(i,j,k)    REAL(wp)          , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define MASK_TYPE(i,j,k)     REAL(wp)          , INTENT(in   ) ::   MASK_IN(i,j,k)
+#   if defined DIM_2d
+#      define ARRAY_IN(i,j,k)   ptab(i,j)
+#      define MASK_IN(i,j,k)    pmask(i,j)
+#      define INDEX_TYPE(k)        INTEGER           , INTENT(  out) ::   kindex(2)
+#      define K_SIZE(ptab)      1
+#   endif
+#   if defined DIM_3d
+#      define ARRAY_IN(i,j,k)   ptab(i,j,k)
+#      define MASK_IN(i,j,k)    pmask(i,j,k)
+#      define INDEX_TYPE(k)        INTEGER           , INTENT(  out) ::   kindex(3)
+#      define K_SIZE(ptab)      SIZE(ptab,3)
+#   endif
+#   if defined OPERATION_MAXLOC
+#      define MPI_OPERATION mpi_maxloc
+#   endif
+#   if defined OPERATION_MINLOC
+#      define MPI_OPERATION mpi_minloc
+#   endif
+
+   SUBROUTINE ROUTINE_LOC( cdname, ptab, pmask, pmin, kindex )
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*), INTENT(in   ) ::   cdname  ! name of the calling subroutine
+      ARRAY_TYPE(:,:,:)                                ! array on which loctrans operation is applied
+      MASK_TYPE(:,:,:)                                 ! local mask
+      REAL(wp)        , INTENT(  out) ::   pmin    ! Global minimum of ptab
+      INDEX_TYPE(:)                                ! index of minimum in global frame
+# if defined key_mpp_mpi
+      !
+      INTEGER  ::   ierror, ii, idim
+      REAL(wp) ::   zmin     ! local minimum
+      INTEGER , DIMENSION(:), ALLOCATABLE  ::   ilocs
+      REAL(wp), DIMENSION(2,1) ::   zain, zaout
+      !!-----------------------------------------------------------------------
+      !
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ld_glb = .TRUE. )
+      !
+      idim = SIZE(kindex)
+      ALLOCATE ( ilocs(idim) )
+      !
+      zmin  = MINVAL( ARRAY_IN(:,:,:) , mask= MASK_IN(:,:,:) == 1._wp )
+      ilocs = MINLOC( ARRAY_IN(:,:,:) , mask= MASK_IN(:,:,:) == 1._wp )
+      !
+      DO ii = 1, idim
+        IF (ii == 1) kindex(1) = ilocs(1) + nimpp - 1
+        IF (ii == 2) kindex(2) = ilocs(2) + njmpp - 1
+        IF (ii == 3) kindex(3) = ilocs(3)
+      ENDDO
+      ! 
+      DEALLOCATE (ilocs)
+      !
+      zain(1,:) = zmin
+      zain(2,:) = kindex(1) + 10000.* kindex(2)
+      IF ( idim == 3) zain(2,:) = zain(2,:) + 100000000.*kindex(3)
+      !
+      IF( ln_timing ) CALL tic_tac(.TRUE., ld_global = .TRUE.)
+      CALL MPI_ALLREDUCE( zain, zaout, 1, MPI_2DOUBLE_PRECISION, MPI_OPERATION ,MPI_COMM_OCE, ierror)
+      IF( ln_timing ) CALL tic_tac(.FALSE., ld_global = .TRUE.)
+      !
+      pmin = zaout(1,1)
+      IF ( idim == 3) THEN
+        kindex(3)   = INT( zaout(2,1) / 100000000. )
+        kindex(2)   = INT( zaout(2,1) - kindex(3) * 100000000. ) / 10000
+        kindex(1)   = INT( zaout(2,1) - kindex(3) * 100000000. -kindex(2) * 10000. )
+      ELSE
+        kindex(2)   = INT( zaout(2,1) / 10000 )
+        kindex(1)   = INT( zaout(2,1) -kindex(2) * 10000. )
+      ENDIF
+#else
+      kindex = 0 ; pmin = 0.
+      WRITE(*,*) 'ROUTINE_LOC: You should not have seen this print! error?'
+#endif
+
+   END SUBROUTINE ROUTINE_LOC
+
+#undef ARRAY_TYPE
+#undef MAX_TYPE
+#undef ARRAY_IN
+#undef MASK_IN
+#undef K_SIZE
+#undef MPI_OPERATION
+#undef INDEX_TYPE
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/SBC/sbcapr.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/SBC/sbcapr.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/SBC/sbcapr.F90	(revision 10314)
@@ -94,5 +94,5 @@
       !
       IF( ln_ref_apr ) THEN                        !* Compute whole inner domain mean masked ocean surface
-         tarea = glob_sum( e1e2t(:,:) )
+         tarea = glob_sum( 'sbcapr', e1e2t(:,:) )
          IF(lwp) WRITE(numout,*) '         Variable ref. Patm computed over a ocean surface of ', tarea*1e-6, 'km2'
       ELSE
@@ -141,5 +141,5 @@
          !
          !                                                  !* update the reference atmospheric pressure (if necessary)
-         IF( ln_ref_apr )   rn_pref = glob_sum( sf_apr(1)%fnow(:,:,1) * e1e2t(:,:) ) / tarea
+         IF( ln_ref_apr )   rn_pref = glob_sum( 'sbcapr', sf_apr(1)%fnow(:,:,1) * e1e2t(:,:) ) / tarea
          !
          !                                                  !* Patm related forcing at kt
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/SBC/sbcfwb.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/SBC/sbcfwb.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/SBC/sbcfwb.F90	(revision 10314)
@@ -86,5 +86,5 @@
          IF( kn_fwb == 3 .AND. ln_isfcav    )   CALL ctl_stop( 'sbc_fwb: nn_fwb = 3 with ln_isfcav = .TRUE. not working, we stop ' )
          !
-         area = glob_sum( e1e2t(:,:) * tmask(:,:,1))           ! interior global domain surface
+         area = glob_sum( 'sbcfwb', e1e2t(:,:) * tmask(:,:,1))           ! interior global domain surface
          ! isf cavities are excluded because it can feedback to the melting with generation of inhibition of plumes
          ! and in case of no melt, it can generate HSSW.
@@ -102,5 +102,5 @@
          !
          IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN
-            z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf(:,:) - snwice_fmass(:,:) ) ) / area   ! sum over the global domain
+            z_fwf = glob_sum( 'sbcfwb', e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf(:,:) - snwice_fmass(:,:) ) ) / area   ! sum over the global domain
             zcoef = z_fwf * rcp
             emp(:,:) = emp(:,:) - z_fwf              * tmask(:,:,1)
@@ -127,5 +127,5 @@
             a_fwb_b = a_fwb                           ! mean sea level taking into account the ice+snow
                                                       ! sum over the global domain
-            a_fwb   = glob_sum( e1e2t(:,:) * ( sshn(:,:) + snwice_mass(:,:) * r1_rau0 ) )
+            a_fwb   = glob_sum( 'sbcfwb', e1e2t(:,:) * ( sshn(:,:) + snwice_mass(:,:) * r1_rau0 ) )
             a_fwb   = a_fwb * 1.e+3 / ( area * rday * 365. )     ! convert in Kg/m3/s = mm/s
 !!gm        !                                                      !!bug 365d year 
@@ -155,8 +155,8 @@
             ztmsk_neg(:,:) = tmask_i(:,:) - ztmsk_pos(:,:)
             !
-            zsurf_neg = glob_sum( e1e2t(:,:)*ztmsk_neg(:,:) )  ! Area filled by <0 and >0 erp 
-            zsurf_pos = glob_sum( e1e2t(:,:)*ztmsk_pos(:,:) )
+            zsurf_neg = glob_sum( 'sbcfwb', e1e2t(:,:)*ztmsk_neg(:,:) )  ! Area filled by <0 and >0 erp 
+            zsurf_pos = glob_sum( 'sbcfwb', e1e2t(:,:)*ztmsk_pos(:,:) )
             !                                                  ! fwf global mean (excluding ocean to ice/snow exchanges) 
-            z_fwf     = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf(:,:) - snwice_fmass(:,:) ) ) / area
+            z_fwf     = glob_sum( 'sbcfwb', e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf(:,:) - snwice_fmass(:,:) ) ) / area
             !            
             IF( z_fwf < 0._wp ) THEN         ! spread out over >0 erp area to increase evaporation
@@ -168,9 +168,9 @@
             ENDIF
             !
-            zsum_fwf   = glob_sum( e1e2t(:,:) * z_fwf )         ! fwf global mean over <0 or >0 erp area
+            zsum_fwf   = glob_sum( 'sbcfwb', e1e2t(:,:) * z_fwf )         ! fwf global mean over <0 or >0 erp area
 !!gm :  zsum_fwf   = z_fwf * area   ???  it is right?  I think so....
             z_fwf_nsrf =  zsum_fwf / ( zsurf_tospread + rsmall )
             !                                                  ! weight to respect erp field 2D structure 
-            zsum_erp   = glob_sum( ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) )
+            zsum_erp   = glob_sum( 'sbcfwb', ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) )
             z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( zsum_erp + rsmall )
             !                                                  ! final correction term to apply
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/ZDF/zdfiwm.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/ZDF/zdfiwm.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/ZDF/zdfiwm.F90	(revision 10314)
@@ -463,7 +463,7 @@
       ecri_iwm(:,:) = ecri_iwm(:,:) * ssmask(:,:)
 
-      zbot = glob_sum( e1e2t(:,:) * ebot_iwm(:,:) )
-      zpyc = glob_sum( e1e2t(:,:) * epyc_iwm(:,:) )
-      zcri = glob_sum( e1e2t(:,:) * ecri_iwm(:,:) )
+      zbot = glob_sum( 'zdfiwm', e1e2t(:,:) * ebot_iwm(:,:) )
+      zpyc = glob_sum( 'zdfiwm', e1e2t(:,:) * epyc_iwm(:,:) )
+      zcri = glob_sum( 'zdfiwm', e1e2t(:,:) * ecri_iwm(:,:) )
       IF(lwp) THEN
          WRITE(numout,*) '      High-mode wave-breaking energy:             ', zbot * 1.e-12_wp, 'TW'
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/lib_fortran.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/lib_fortran.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/lib_fortran.F90	(revision 10314)
@@ -34,6 +34,5 @@
 
    INTERFACE glob_sum
-      MODULE PROCEDURE glob_sum_1d, glob_sum_2d, glob_sum_3d, &
-         &             glob_sum_2d_a, glob_sum_3d_a
+      MODULE PROCEDURE glob_sum_1d, glob_sum_2d, glob_sum_3d
    END INTERFACE
    INTERFACE glob_sum_full
@@ -41,8 +40,8 @@
    END INTERFACE
    INTERFACE glob_min
-      MODULE PROCEDURE glob_min_2d, glob_min_3d,glob_min_2d_a, glob_min_3d_a 
+      MODULE PROCEDURE glob_min_2d, glob_min_3d
    END INTERFACE
    INTERFACE glob_max
-      MODULE PROCEDURE glob_max_2d, glob_max_3d,glob_max_2d_a, glob_max_3d_a 
+      MODULE PROCEDURE glob_max_2d, glob_max_3d
    END INTERFACE
 
@@ -62,378 +61,69 @@
 CONTAINS
 
-   ! --- SUM ---
-   FUNCTION glob_sum_1d( ptab, kdim )
-      !!----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_sum_1d ***
-      !!
-      !! ** Purpose : perform a sum in calling DDPDD routine
-      !!----------------------------------------------------------------------
-      INTEGER , INTENT(in) :: kdim
-      REAL(wp), INTENT(in), DIMENSION(kdim) ::   ptab
-      REAL(wp)                              ::   glob_sum_1d   ! global sum
-      !!
-      COMPLEX(wp)::   ctmp
-      REAL(wp)   ::   ztmp
-      INTEGER    ::   ji   ! dummy loop indices
-      !!-----------------------------------------------------------------------
-      !
-      ztmp = 0.e0
-      ctmp = CMPLX( 0.e0, 0.e0, wp )
-      DO ji = 1, kdim
-         ztmp =  ptab(ji)
-         CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-         END DO
-      IF( lk_mpp )   CALL mpp_sum( 'lib_fortran', ctmp )   ! sum over the global domain
-      glob_sum_1d = REAL(ctmp,wp)
-      !
-   END FUNCTION glob_sum_1d
-
-   FUNCTION glob_sum_2d( ptab )
-      !!----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_sum_2d ***
-      !!
-      !! ** Purpose : perform a sum in calling DDPDD routine
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptab
-      REAL(wp)                             ::   glob_sum_2d   ! global masked sum
-      !!
-      COMPLEX(wp)::   ctmp
-      REAL(wp)   ::   ztmp
-      INTEGER    ::   ji, jj   ! dummy loop indices
-      !!-----------------------------------------------------------------------
-      !
-      ztmp = 0.e0
-      ctmp = CMPLX( 0.e0, 0.e0, wp )
-      DO jj = 1, jpj
-         DO ji =1, jpi
-         ztmp =  ptab(ji,jj) * tmask_i(ji,jj)
-         CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-         END DO
-      END DO
-      IF( lk_mpp )   CALL mpp_sum( 'lib_fortran', ctmp )   ! sum over the global domain
-      glob_sum_2d = REAL(ctmp,wp)
-      !
-   END FUNCTION glob_sum_2d
-
-
-   FUNCTION glob_sum_3d( ptab )
-      !!----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_sum_3d ***
-      !!
-      !! ** Purpose : perform a sum on a 3D array in calling DDPDD routine
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab
-      REAL(wp)                               ::   glob_sum_3d   ! global masked sum
-      !!
-      COMPLEX(wp)::   ctmp
-      REAL(wp)   ::   ztmp
-      INTEGER    ::   ji, jj, jk   ! dummy loop indices
-      INTEGER    ::   ijpk ! local variables: size of ptab
-      !!-----------------------------------------------------------------------
-      !
-      ijpk = SIZE(ptab,3)
-      !
-      ztmp = 0.e0
-      ctmp = CMPLX( 0.e0, 0.e0, wp )
-      DO jk = 1, ijpk
-         DO jj = 1, jpj
-            DO ji =1, jpi
-            ztmp =  ptab(ji,jj,jk) * tmask_i(ji,jj)
-            CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-            END DO
-         END DO
-      END DO
-      IF( lk_mpp )   CALL mpp_sum( 'lib_fortran', ctmp )   ! sum over the global domain
-      glob_sum_3d = REAL(ctmp,wp)
-      !
-   END FUNCTION glob_sum_3d
-
-
-   FUNCTION glob_sum_2d_a( ptab1, ptab2 )
-      !!----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_sum_2d_a ***
-      !!
-      !! ** Purpose : perform a sum on two 2D arrays in calling DDPDD routine
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptab1, ptab2
-      REAL(wp)                             ::   glob_sum_2d_a   ! global masked sum
-      !!
-      COMPLEX(wp)::   ctmp
-      REAL(wp)   ::   ztmp
-      INTEGER    ::   ji, jj   ! dummy loop indices
-      !!-----------------------------------------------------------------------
-      !
-      ztmp = 0.e0
-      ctmp = CMPLX( 0.e0, 0.e0, wp )
-      DO jj = 1, jpj
-         DO ji =1, jpi
-         ztmp =  ptab1(ji,jj) * tmask_i(ji,jj)
-         CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-         ztmp =  ptab2(ji,jj) * tmask_i(ji,jj)
-         CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-         END DO
-      END DO
-      IF( lk_mpp )   CALL mpp_sum( 'lib_fortran', ctmp )   ! sum over the global domain
-      glob_sum_2d_a = REAL(ctmp,wp)
-      !
-   END FUNCTION glob_sum_2d_a
-
-
-   FUNCTION glob_sum_3d_a( ptab1, ptab2 )
-      !!----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_sum_3d_a ***
-      !!
-      !! ** Purpose : perform a sum on two 3D array in calling DDPDD routine
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab1, ptab2
-      REAL(wp)                               ::   glob_sum_3d_a   ! global masked sum
-      !!
-      COMPLEX(wp)::   ctmp
-      REAL(wp)   ::   ztmp
-      INTEGER    ::   ji, jj, jk   ! dummy loop indices
-      INTEGER    ::   ijpk ! local variables: size of ptab
-      !!-----------------------------------------------------------------------
-      !
-      ijpk = SIZE(ptab1,3)
-      !
-      ztmp = 0.e0
-      ctmp = CMPLX( 0.e0, 0.e0, wp )
-      DO jk = 1, ijpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ztmp =  ptab1(ji,jj,jk) * tmask_i(ji,jj)
-               CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-               ztmp =  ptab2(ji,jj,jk) * tmask_i(ji,jj)
-               CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-            END DO
-         END DO    
-      END DO
-      IF( lk_mpp )   CALL mpp_sum( 'lib_fortran', ctmp )   ! sum over the global domain
-      glob_sum_3d_a = REAL(ctmp,wp)
-      !
-   END FUNCTION glob_sum_3d_a   
-
-   FUNCTION glob_sum_full_2d( ptab )
-      !!----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_sum_full_2d ***
-      !!
-      !! ** Purpose : perform a sum in calling DDPDD routine
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptab
-      REAL(wp)                             ::   glob_sum_full_2d   ! global sum (nomask)
-      !!
-      COMPLEX(wp)::   ctmp
-      REAL(wp)   ::   ztmp
-      INTEGER    ::   ji, jj   ! dummy loop indices
-      !!-----------------------------------------------------------------------
-      !
-      ztmp = 0.e0
-      ctmp = CMPLX( 0.e0, 0.e0, wp )
-      DO jj = 1, jpj
-         DO ji =1, jpi
-         ztmp =  ptab(ji,jj) * tmask_h(ji,jj) 
-         CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-         END DO
-      END DO
-      IF( lk_mpp )   CALL mpp_sum( 'lib_fortran', ctmp )   ! sum over the global domain
-      glob_sum_full_2d = REAL(ctmp,wp)
-      !
-   END FUNCTION glob_sum_full_2d
-
-   FUNCTION glob_sum_full_3d( ptab )
-      !!----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_sum_full_3d ***
-      !!
-      !! ** Purpose : perform a sum on a 3D array in calling DDPDD routine
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab
-      REAL(wp)                               ::   glob_sum_full_3d   ! global sum (nomask)
-      !!
-      COMPLEX(wp)::   ctmp
-      REAL(wp)   ::   ztmp
-      INTEGER    ::   ji, jj, jk   ! dummy loop indices
-      INTEGER    ::   ijpk ! local variables: size of ptab
-      !!-----------------------------------------------------------------------
-      !
-      ijpk = SIZE(ptab,3)
-      !
-      ztmp = 0.e0
-      ctmp = CMPLX( 0.e0, 0.e0, wp )
-      DO jk = 1, ijpk
-         DO jj = 1, jpj
-            DO ji =1, jpi
-            ztmp =  ptab(ji,jj,jk) * tmask_h(ji,jj)
-            CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-            END DO
-         END DO
-      END DO
-      IF( lk_mpp )   CALL mpp_sum( 'lib_fortran', ctmp )   ! sum over the global domain
-      glob_sum_full_3d = REAL(ctmp,wp)
-      !
-   END FUNCTION glob_sum_full_3d
-
-   ! --- MIN ---
-   FUNCTION glob_min_2d( ptab ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_min_2D  ***
-      !!
-      !! ** Purpose : perform a masked min on the inner global domain of a 2D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptab          ! input 2D array
-      REAL(wp)                             ::   glob_min_2d   ! global masked min
-      !!-----------------------------------------------------------------------
-      !
-      glob_min_2d = MINVAL( ptab(:,:)*tmask_i(:,:) )
-      IF( lk_mpp )   CALL mpp_min( 'lib_fortran', glob_min_2d )
-      !
-   END FUNCTION glob_min_2d
- 
-   FUNCTION glob_min_3d( ptab ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_min_3D  ***
-      !!
-      !! ** Purpose : perform a masked min on the inner global domain of a 3D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab          ! input 3D array
-      REAL(wp)                               ::   glob_min_3d   ! global masked min
-      !!
-      INTEGER :: jk
-      INTEGER :: ijpk ! local variable: size of the 3d dimension of ptab
-      !!-----------------------------------------------------------------------
-      !
-      ijpk = SIZE(ptab,3)
-      !
-      glob_min_3d = MINVAL( ptab(:,:,1)*tmask_i(:,:) )
-      DO jk = 2, ijpk
-         glob_min_3d = MIN( glob_min_3d, MINVAL( ptab(:,:,jk)*tmask_i(:,:) ) )
-      END DO
-      IF( lk_mpp )   CALL mpp_min( 'lib_fortran', glob_min_3d )
-      !
-   END FUNCTION glob_min_3d
-
-
-   FUNCTION glob_min_2d_a( ptab1, ptab2 ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_min_2D _a ***
-      !!
-      !! ** Purpose : perform a masked min on the inner global domain of two 2D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptab1, ptab2    ! input 2D array
-      REAL(wp)            , DIMENSION(2)   ::   glob_min_2d_a   ! global masked min
-      !!-----------------------------------------------------------------------
-      !             
-      glob_min_2d_a(1) = MINVAL( ptab1(:,:)*tmask_i(:,:) )
-      glob_min_2d_a(2) = MINVAL( ptab2(:,:)*tmask_i(:,:) )
-      IF( lk_mpp )   CALL mpp_min( 'lib_fortran', glob_min_2d_a, 2 )
-      !
-   END FUNCTION glob_min_2d_a
- 
- 
-   FUNCTION glob_min_3d_a( ptab1, ptab2 ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_min_3D_a ***
-      !!
-      !! ** Purpose : perform a masked min on the inner global domain of two 3D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab1, ptab2    ! input 3D array
-      REAL(wp)            , DIMENSION(2)     ::   glob_min_3d_a   ! global masked min
-      !!
-      INTEGER :: jk
-      INTEGER :: ijpk ! local variable: size of the 3d dimension of ptab
-      !!-----------------------------------------------------------------------
-      !
-      ijpk = SIZE(ptab1,3)
-      !
-      glob_min_3d_a(1) = MINVAL( ptab1(:,:,1)*tmask_i(:,:) )
-      glob_min_3d_a(2) = MINVAL( ptab2(:,:,1)*tmask_i(:,:) )
-      DO jk = 2, ijpk
-         glob_min_3d_a(1) = MIN( glob_min_3d_a(1), MINVAL( ptab1(:,:,jk)*tmask_i(:,:) ) )
-         glob_min_3d_a(2) = MIN( glob_min_3d_a(2), MINVAL( ptab2(:,:,jk)*tmask_i(:,:) ) )
-      END DO
-      IF( lk_mpp )   CALL mpp_min( 'lib_fortran', glob_min_3d_a, 2 )
-      !
-   END FUNCTION glob_min_3d_a
-
-   ! --- MAX ---
-   FUNCTION glob_max_2d( ptab ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_max_2D  ***
-      !!
-      !! ** Purpose : perform a masked max on the inner global domain of a 2D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptab          ! input 2D array
-      REAL(wp)                             ::   glob_max_2d   ! global masked max
-      !!-----------------------------------------------------------------------
-      !
-      glob_max_2d = MAXVAL( ptab(:,:)*tmask_i(:,:) )
-      IF( lk_mpp )   CALL mpp_max( 'lib_fortran', glob_max_2d )
-      !
-   END FUNCTION glob_max_2d
- 
-   FUNCTION glob_max_3d( ptab ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_max_3D  ***
-      !!
-      !! ** Purpose : perform a masked max on the inner global domain of a 3D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab          ! input 3D array
-      REAL(wp)                               ::   glob_max_3d   ! global masked max
-      !!
-      INTEGER :: jk
-      INTEGER :: ijpk ! local variable: size of the 3d dimension of ptab
-      !!-----------------------------------------------------------------------
-      !
-      ijpk = SIZE(ptab,3)
-      !
-      glob_max_3d = MAXVAL( ptab(:,:,1)*tmask_i(:,:) )
-      DO jk = 2, ijpk
-         glob_max_3d = MAX( glob_max_3d, MAXVAL( ptab(:,:,jk)*tmask_i(:,:) ) )
-      END DO
-      IF( lk_mpp )   CALL mpp_max( 'lib_fortran', glob_max_3d )
-      !
-   END FUNCTION glob_max_3d
-
-
-   FUNCTION glob_max_2d_a( ptab1, ptab2 ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_max_2D _a ***
-      !!
-      !! ** Purpose : perform a masked max on the inner global domain of two 2D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptab1, ptab2    ! input 2D array
-      REAL(wp)            , DIMENSION(2)   ::   glob_max_2d_a   ! global masked max
-      !!-----------------------------------------------------------------------
-      !             
-      glob_max_2d_a(1) = MAXVAL( ptab1(:,:)*tmask_i(:,:) )
-      glob_max_2d_a(2) = MAXVAL( ptab2(:,:)*tmask_i(:,:) )
-      IF( lk_mpp )   CALL mpp_max( 'lib_fortran', glob_max_2d_a, 2 )
-      !
-   END FUNCTION glob_max_2d_a
- 
- 
-   FUNCTION glob_max_3d_a( ptab1, ptab2 ) 
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  glob_max_3D_a ***
-      !!
-      !! ** Purpose : perform a masked max on the inner global domain of two 3D array
-      !!-----------------------------------------------------------------------
-      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab1, ptab2    ! input 3D array
-      REAL(wp)            , DIMENSION(2)     ::   glob_max_3d_a   ! global masked max
-      !!
-      INTEGER :: jk
-      INTEGER :: ijpk ! local variable: size of the 3d dimension of ptab
-      !!-----------------------------------------------------------------------
-      !
-      ijpk = SIZE(ptab1,3)
-      !
-      glob_max_3d_a(1) = MAXVAL( ptab1(:,:,1)*tmask_i(:,:) )
-      glob_max_3d_a(2) = MAXVAL( ptab2(:,:,1)*tmask_i(:,:) )
-      DO jk = 2, ijpk
-         glob_max_3d_a(1) = MAX( glob_max_3d_a(1), MAXVAL( ptab1(:,:,jk)*tmask_i(:,:) ) )
-         glob_max_3d_a(2) = MAX( glob_max_3d_a(2), MAXVAL( ptab2(:,:,jk)*tmask_i(:,:) ) )
-      END DO
-      IF( lk_mpp )   CALL mpp_max( 'lib_fortran', glob_max_3d_a, 2 )
-      !
-   END FUNCTION glob_max_3d_a
+#  define GLOBSUM_CODE
+
+#     define DIM_1d
+#     define FUNCTION_GLOBSUM           glob_sum_1d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBSUM
+#     undef DIM_1d
+
+#     define DIM_2d
+#     define OPERATION_GLOBSUM
+#     define FUNCTION_GLOBSUM           glob_sum_2d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBSUM
+#     undef OPERATION_GLOBSUM
+#     define OPERATION_FULL_GLOBSUM
+#     define FUNCTION_GLOBSUM           glob_sum_full_2d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBSUM
+#     undef OPERATION_FULL_GLOBSUM
+#     undef DIM_2d
+
+#     define DIM_3d
+#     define OPERATION_GLOBSUM
+#     define FUNCTION_GLOBSUM           glob_sum_3d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBSUM
+#     undef OPERATION_GLOBSUM
+#     define OPERATION_FULL_GLOBSUM
+#     define FUNCTION_GLOBSUM           glob_sum_full_3d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBSUM
+#     undef OPERATION_FULL_GLOBSUM
+#     undef DIM_3d
+
+#  undef GLOBSUM_CODE
+
+
+#  define GLOBMINMAX_CODE
+
+#     define DIM_2d
+#     define OPERATION_GLOBMIN
+#     define FUNCTION_GLOBMINMAX           glob_min_2d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBMINMAX
+#     undef OPERATION_GLOBMIN
+#     define OPERATION_GLOBMAX
+#     define FUNCTION_GLOBMINMAX           glob_max_2d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBMINMAX
+#     undef OPERATION_GLOBMAX
+#     undef DIM_2d
+
+#     define DIM_3d
+#     define OPERATION_GLOBMIN
+#     define FUNCTION_GLOBMINMAX           glob_min_3d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBMINMAX
+#     undef OPERATION_GLOBMIN
+#     define OPERATION_GLOBMAX
+#     define FUNCTION_GLOBMINMAX           glob_max_3d
+#     include "lib_fortran_generic.h90"
+#     undef FUNCTION_GLOBMINMAX
+#     undef OPERATION_GLOBMAX
+#     undef DIM_3d
+#  undef GLOBMINMAX_CODE
 
 
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/lib_fortran_generic.h90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/lib_fortran_generic.h90	(revision 10314)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/lib_fortran_generic.h90	(revision 10314)
@@ -0,0 +1,140 @@
+#if defined GLOBSUM_CODE
+!                          ! FUNCTION FUNCTION_GLOBSUM !
+#   if defined DIM_1d
+#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_IN(i,j,k)   ptab(i)
+#      define ARRAY2_IN(i,j,k)  ptab2(i)
+#      define J_SIZE(ptab)      1
+#      define K_SIZE(ptab)      1
+#      define MASK_ARRAY(i,j)   1.
+#   endif
+#   if defined DIM_2d
+#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_IN(i,j,k)   ptab(i,j)
+#      define ARRAY2_IN(i,j,k)  ptab2(i,j)
+#      define J_SIZE(ptab)      SIZE(ptab,2)
+#      define K_SIZE(ptab)      1
+#   endif
+#   if defined DIM_3d
+#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_IN(i,j,k)   ptab(i,j,k)
+#      define ARRAY2_IN(i,j,k)  ptab2(i,j,k)
+#      define J_SIZE(ptab)      SIZE(ptab,2)
+#      define K_SIZE(ptab)      SIZE(ptab,3)
+#   endif
+#   if defined OPERATION_GLOBSUM
+#      define MASK_ARRAY(i,j)   tmask_i(i,j)
+#   endif
+#   if defined OPERATION_FULL_GLOBSUM
+#      define MASK_ARRAY(i,j)   tmask_h(i,j)
+#   endif
+
+   FUNCTION FUNCTION_GLOBSUM( cdname, ptab )
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*),  INTENT(in   ) ::   cdname  ! name of the calling subroutine
+      ARRAY_TYPE(:,:,:)                             ! array on which operation is applied
+      REAL(wp)   ::  FUNCTION_GLOBSUM
+      !
+      !!-----------------------------------------------------------------------
+      !
+      REAL(wp)                              ::   FUNCTION_GLOB_OP   ! global sum
+      !!
+      COMPLEX(wp)::   ctmp
+      REAL(wp)   ::   ztmp
+      INTEGER    ::   ji, jj, jk   ! dummy loop indices
+      INTEGER    ::   ipi, ipj, ipk    ! dimensions
+      !!-----------------------------------------------------------------------
+      !
+      ipi = SIZE(ptab,1)   ! 1st dimension
+      ipj = J_SIZE(ptab)   ! 2nd dimension
+      ipk = K_SIZE(ptab)   ! 3rd dimension
+      !
+      ztmp = 0.e0
+      ctmp = CMPLX( 0.e0, 0.e0, wp )
+   
+      DO jk = 1, ipk
+        DO jj = 1, ipj
+          DO ji = 1, ipi
+             ztmp =  ARRAY_IN(ji,jj,jk) * MASK_ARRAY(ji,jj)
+             CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
+          END DO
+        END DO
+      END DO
+      IF( lk_mpp )   CALL mpp_sum( cdname, ctmp )   ! sum over the global domain
+      FUNCTION_GLOBSUM = REAL(ctmp,wp)
+
+   END FUNCTION FUNCTION_GLOBSUM
+
+#undef ARRAY_TYPE
+#undef ARRAY2_TYPE
+#undef ARRAY_IN
+#undef ARRAY2_IN
+#undef J_SIZE
+#undef K_SIZE
+#undef MASK_ARRAY
+!
+# endif
+#if defined GLOBMINMAX_CODE
+!                          ! FUNCTION FUNCTION_GLOBMINMAX !
+#   if defined DIM_2d
+#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_IN(i,j,k)   ptab(i,j)
+#      define ARRAY2_IN(i,j,k)  ptab2(i,j)
+#      define K_SIZE(ptab)      1
+#   endif
+#   if defined DIM_3d
+#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_IN(i,j,k)   ptab(i,j,k)
+#      define ARRAY2_IN(i,j,k)  ptab2(i,j,k)
+#      define K_SIZE(ptab)      SIZE(ptab,3)
+#   endif
+#   if defined OPERATION_GLOBMIN
+#      define SCALAR_OPERATION min
+#      define ARRAY_OPERATION minval
+#      define MPP_OPERATION mpp_min
+#   endif
+#   if defined OPERATION_GLOBMAX
+#      define SCALAR_OPERATION max
+#      define ARRAY_OPERATION maxval
+#      define MPP_OPERATION mpp_max
+#   endif
+
+   FUNCTION FUNCTION_GLOBMINMAX( cdname, ptab )
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*),  INTENT(in   ) ::   cdname  ! name of the calling subroutine
+      ARRAY_TYPE(:,:,:)                             ! array on which operation is applied
+      REAL(wp)   ::  FUNCTION_GLOBMINMAX
+      !
+      !!-----------------------------------------------------------------------
+      !
+      REAL(wp)                              ::   FUNCTION_GLOB_OP   ! global sum
+      !!
+      COMPLEX(wp)::   ctmp
+      REAL(wp)   ::   ztmp
+      INTEGER    ::   jk       ! dummy loop indices
+      INTEGER    ::   ipk      ! dimensions
+      !!-----------------------------------------------------------------------
+      !
+      ipk = K_SIZE(ptab)   ! 3rd dimension
+      !
+      ztmp = ARRAY_OPERATION( ARRAY_IN(:,:,1)*tmask_i(:,:) )
+      DO jk = 2, ipk
+         ztmp = SCALAR_OPERATION(ztmp, ARRAY_OPERATION( ARRAY_IN(:,:,jk)*tmask_i(:,:) ))
+      ENDDO
+
+      IF( lk_mpp ) CALL MPP_OPERATION( cdname, ztmp)
+
+      FUNCTION_GLOBMINMAX = ztmp
+
+
+   END FUNCTION FUNCTION_GLOBMINMAX
+
+#undef ARRAY_TYPE
+#undef ARRAY2_TYPE
+#undef ARRAY_IN
+#undef ARRAY2_IN
+#undef K_SIZE
+#undef SCALAR_OPERATION
+#undef ARRAY_OPERATION
+#undef MPP_OPERATION
+# endif
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/stpctl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/stpctl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/stpctl.F90	(revision 10314)
@@ -61,8 +61,8 @@
       !!
       INTEGER  ::   ji, jj, jk             ! dummy loop indices
-      INTEGER  ::   iih, ijh               ! local integers
-      INTEGER  ::   iiu, iju, iku          !   -       -
-      INTEGER  ::   iis1, ijs1, iks1       !   -       -
-      INTEGER  ::   iis2, ijs2, iks2       !   -       -
+      INTEGER  ::   ih(2)                  ! local integers
+      INTEGER  ::   iu(3)                  !   -       -
+      INTEGER  ::   is1(3)                 !   -       -
+      INTEGER  ::   is2(3)                 !   -       -
       REAL(wp) ::   zzz                    ! local real 
       INTEGER , DIMENSION(3) ::   ilocu, ilocs1, ilocs2
@@ -112,5 +112,5 @@
       !
       IF( lk_mpp ) THEN
-         CALL mpp_max_multiple( zmax(:), 5 )    ! max over the global domain
+         CALL mpp_max( "stpctl", zmax )    ! max over the global domain
          !
          nstop = NINT( zmax(5) )                 ! nstop indicator sheared among all local domains
@@ -129,8 +129,8 @@
          &  ISNAN( zmax(1) + zmax(2) + zmax(3) )  ) THEN   ! NaN encounter in the tests
          IF( lk_mpp ) THEN
-            CALL mpp_maxloc( ABS(sshn)        , ssmask(:,:)  , zzz, iih , ijh        )
-            CALL mpp_maxloc( ABS(un)          , umask (:,:,:), zzz, iiu , iju , iku  )
-            CALL mpp_minloc( tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, iis1, ijs1, iks1 )
-            CALL mpp_maxloc( tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, iis2, ijs2, iks2 )
+            CALL mpp_maxloc( 'stpctl', ABS(sshn)        , ssmask(:,:)  , zzz, ih  )
+            CALL mpp_maxloc( 'stpctl', ABS(un)          , umask (:,:,:), zzz, iu  )
+            CALL mpp_minloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is1 )
+            CALL mpp_maxloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is2 )
          ELSE
             iloch  = MINLOC( ABS( sshn(:,:)   )                               )
@@ -138,8 +138,8 @@
             ilocs1 = MINLOC( tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )
             ilocs2 = MAXLOC( tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )
-            iih  = iloch (1) + nimpp - 1   ;   ijh  = iloch (2) + njmpp - 1
-            iiu  = ilocu (1) + nimpp - 1   ;   iju  = ilocu (2) + njmpp - 1   ;   iku  = ilocu (3)
-            iis1 = ilocs1(1) + nimpp - 1   ;   ijs1 = ilocs1(2) + njmpp - 1   ;   iks1 = ilocs1(3)
-            iis2 = ilocs2(1) + nimpp - 1   ;   ijs2 = ilocs2(2) + njmpp - 1   ;   iks2 = ilocs2(3)
+            ih(1)  = iloch (1) + nimpp - 1   ;   ih(2)  = iloch (2) + njmpp - 1
+            iu(1)  = ilocu (1) + nimpp - 1   ;   iu(2)  = ilocu (2) + njmpp - 1   ;   iu(3)  = ilocu (3)
+            is1(1) = ilocs1(1) + nimpp - 1   ;   is1(2) = ilocs1(2) + njmpp - 1   ;   is1(3) = ilocs1(3)
+            is2(1) = ilocs2(1) + nimpp - 1   ;   is2(2) = ilocs2(2) + njmpp - 1   ;   is2(3) = ilocs2(3)
          ENDIF
          IF(lwp) THEN
@@ -147,8 +147,8 @@
             WRITE(numout,*) ' stp_ctl: |ssh| > 10 m  or  |U| > 10 m/s  or  S <= 0  or  S >= 100  or  NaN encounter in the tests'
             WRITE(numout,*) ' ======= '
-            WRITE(numout,9100) kt,   zmax(1), iih , ijh
-            WRITE(numout,9200) kt,   zmax(2), iiu , iju , iku
-            WRITE(numout,9300) kt, - zmax(3), iis1, ijs1, iks1
-            WRITE(numout,9400) kt,   zmax(4), iis2, ijs2, iks2
+            WRITE(numout,9100) kt,   zmax(1), ih(1) , ih(2)
+            WRITE(numout,9200) kt,   zmax(2), iu(1) , iu(2) , iu(3)
+            WRITE(numout,9300) kt, - zmax(3), is1(1), is1(2), is1(3)
+            WRITE(numout,9400) kt,   zmax(4), is2(1), is2(2), is2(3)
             WRITE(numout,*)
             WRITE(numout,*) '          output of last computed fields in output.abort.nc file'
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/SAS/stpctl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/SAS/stpctl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/SAS/stpctl.F90	(revision 10314)
@@ -88,7 +88,5 @@
       zmax(3) = MAXVAL(     -tm_i (:,:)+273.15_wp , mask = ssmask(:,:) == 1._wp )   ! min ice temperature
       !
-      IF( lk_mpp ) THEN
-         CALL mpp_max_multiple( zmax(:), 3 )    ! max over the global domain
-      ENDIF
+      IF( lk_mpp ) CALL mpp_max( "stpctl", zmax )    ! max over the global domain
       !
       IF( MOD( kt, nwrite ) == 1 .AND. lwp ) THEN
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/C14/trcwri_c14.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/C14/trcwri_c14.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/C14/trcwri_c14.F90	(revision 10314)
@@ -96,22 +96,22 @@
     
       IF( iom_use("AtmC14") ) THEN
-         zarea = glob_sum( e1e2t(:,:) )           ! global ocean surface
-         ztemp = glob_sum( c14sbc(:,:) * e1e2t(:,:) )
+         zarea = glob_sum( 'trcwri_c14', e1e2t(:,:) )           ! global ocean surface
+         ztemp = glob_sum( 'trcwri_c14', c14sbc(:,:) * e1e2t(:,:) )
          ztemp = ( ztemp / zarea - 1._wp ) * 1000._wp
          CALL iom_put( "AtmC14" , ztemp )   ! Global atmospheric DeltaC14 [permil]
       ENDIF
       IF( iom_use("K_C14") ) THEN
-         ztemp = glob_sum ( exch_c14(:,:) * e1e2t(:,:) )
+         ztemp = glob_sum ( 'trcwri_c14', exch_c14(:,:) * e1e2t(:,:) )
          ztemp = rsiyea * ztemp / zarea
          CALL iom_put( "K_C14" , ztemp )   ! global mean exchange velocity for C14/C ratio [m/yr]
       ENDIF
       IF( iom_use("K_CO2") ) THEN
-         zarea = glob_sum( e1e2t(:,:) )           ! global ocean surface
-         ztemp = glob_sum ( exch_co2(:,:) * e1e2t(:,:) )
+         zarea = glob_sum( 'trcwri_c14', e1e2t(:,:) )           ! global ocean surface
+         ztemp = glob_sum ( 'trcwri_c14', exch_co2(:,:) * e1e2t(:,:) )
          ztemp = 360000._wp * ztemp / zarea       ! cm/h units: directly comparable with literature
          CALL iom_put( "K_CO2", ztemp )  !  global mean CO2 piston velocity [cm/hr]
       ENDIF
       IF( iom_use("C14Inv") ) THEN
-         ztemp = glob_sum( trn(:,:,:,jp_c14) * cvol(:,:,:) )
+         ztemp = glob_sum( 'trcwri_c14', trn(:,:,:,jp_c14) * cvol(:,:,:) )
          ztemp = atomc14 * xdicsur * ztemp
          CALL iom_put( "C14Inv", ztemp )  !  Radiocarbon ocean inventory [10^26 atoms]
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P2Z/p2zexp.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P2Z/p2zexp.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P2Z/p2zexp.F90	(revision 10314)
@@ -230,5 +230,5 @@
       END DO
       CALL lbc_lnk( 'p2zexp', cmask , 'T', 1. )      ! lateral boundary conditions on cmask   (sign unchanged)
-      areacot = glob_sum( e1e2t(:,:) * cmask(:,:) )
+      areacot = glob_sum( 'p2zexp', e1e2t(:,:) * cmask(:,:) )
       !
       IF( ln_rsttr ) THEN
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zflx.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zflx.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zflx.F90	(revision 10314)
@@ -172,7 +172,7 @@
       END DO
 
-      t_oce_co2_flx     = glob_sum( oce_co2(:,:) )                    !  Total Flux of Carbon
+      t_oce_co2_flx     = glob_sum( 'p4zflx', oce_co2(:,:) )                    !  Total Flux of Carbon
       t_oce_co2_flx_cum = t_oce_co2_flx_cum + t_oce_co2_flx       !  Cumulative Total Flux of Carbon
-!      t_atm_co2_flx     = glob_sum( satmco2(:,:) * e1e2t(:,:) )       ! Total atmospheric pCO2
+!      t_atm_co2_flx     = glob_sum( 'p4zflx', satmco2(:,:) * e1e2t(:,:) )       ! Total atmospheric pCO2
       t_atm_co2_flx     =  atcco2      ! Total atmospheric pCO2
  
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zprod.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zprod.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zprod.F90	(revision 10314)
@@ -360,5 +360,5 @@
     ! Total primary production per year
     IF( iom_use( "tintpp" ) .OR. ( ln_check_mass .AND. kt == nitend .AND. knt == nrdttrc )  )  &
-         & tpp = glob_sum( ( zprorcan(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
+         & tpp = glob_sum( 'p4zprod', ( zprorcan(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
 
     IF( lk_iomput ) THEN
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsbc.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsbc.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsbc.F90	(revision 10314)
@@ -368,5 +368,5 @@
                ztimes_riv = 1._wp / REAL(ntimes_riv, wp) 
                DO jm = 1, ntimes_riv
-                  rivinput(ifpr) = rivinput(ifpr) + glob_sum( zriver(:,:,jm) * tmask(:,:,1) * ztimes_riv ) 
+                  rivinput(ifpr) = rivinput(ifpr) + glob_sum( 'p4zsbc', zriver(:,:,jm) * tmask(:,:,1) * ztimes_riv ) 
                END DO
                DEALLOCATE( zriver)
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsink.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsink.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsink.F90	(revision 10314)
@@ -208,5 +208,5 @@
      ! Total carbon export per year
      IF( iom_use( "tcexp" ) .OR. ( ln_check_mass .AND. kt == nitend .AND. knt == nrdttrc )  )  &
-        &   t_oce_co2_exp = glob_sum( ( sinking(:,:,ik100) + sinking2(:,:,ik100) ) * e1e2t(:,:) * tmask(:,:,1) )
+        &   t_oce_co2_exp = glob_sum( 'p4zsink', ( sinking(:,:,ik100) + sinking2(:,:,ik100) ) * e1e2t(:,:) * tmask(:,:,1) )
      !
      IF( lk_iomput ) THEN
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsms.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 10314)
@@ -355,10 +355,10 @@
          !                                                ! --------------------------- !
          ! set total alkalinity, phosphate, nitrate & silicate
-         zarea          = 1._wp / glob_sum( cvol(:,:,:) ) * 1e6              
-
-         zalksumn = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
-         zpo4sumn = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r
-         zno3sumn = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3
-         zsilsumn = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
+         zarea          = 1._wp / glob_sum( 'p4zsms', cvol(:,:,:) ) * 1e6              
+
+         zalksumn = glob_sum( 'p4zsms', trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
+         zpo4sumn = glob_sum( 'p4zsms', trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r
+         zno3sumn = glob_sum( 'p4zsms', trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3
+         zsilsumn = glob_sum( 'p4zsms', trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
  
          IF(lwp) WRITE(numout,*) '       TALKN mean : ', zalksumn
@@ -376,8 +376,8 @@
          !
          IF( .NOT. ln_top_euler ) THEN
-            zalksumb = glob_sum( trb(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
-            zpo4sumb = glob_sum( trb(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r
-            zno3sumb = glob_sum( trb(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3
-            zsilsumb = glob_sum( trb(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
+            zalksumb = glob_sum( 'p4zsms', trb(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
+            zpo4sumb = glob_sum( 'p4zsms', trb(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r
+            zno3sumb = glob_sum( 'p4zsms', trb(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3
+            zsilsumb = glob_sum( 'p4zsms', trb(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
  
             IF(lwp) WRITE(numout,*) ' '
@@ -442,5 +442,5 @@
         ENDIF
         !
-        no3budget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
+        no3budget = glob_sum( 'p4zsms', zwork(:,:,:) * cvol(:,:,:)  )  
         no3budget = no3budget / areatot
         CALL iom_put( "pno3tot", no3budget )
@@ -460,5 +460,5 @@
         ENDIF
         !
-        po4budget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
+        po4budget = glob_sum( 'p4zsms', zwork(:,:,:) * cvol(:,:,:)  )  
         po4budget = po4budget / areatot
         CALL iom_put( "ppo4tot", po4budget )
@@ -468,5 +468,5 @@
          zwork(:,:,:) =  trn(:,:,:,jpsil) + trn(:,:,:,jpgsi) + trn(:,:,:,jpdsi) 
          !
-         silbudget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
+         silbudget = glob_sum( 'p4zsms', zwork(:,:,:) * cvol(:,:,:)  )  
          silbudget = silbudget / areatot
          CALL iom_put( "psiltot", silbudget )
@@ -476,5 +476,5 @@
          zwork(:,:,:) =  trn(:,:,:,jpno3) * rno3 + trn(:,:,:,jptal) + trn(:,:,:,jpcal) * 2.              
          !
-         alkbudget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )         !
+         alkbudget = glob_sum( 'p4zsms', zwork(:,:,:) * cvol(:,:,:)  )         !
          alkbudget = alkbudget / areatot
          CALL iom_put( "palktot", alkbudget )
@@ -487,5 +487,5 @@
          IF( ln_ligand)  zwork(:,:,:) = zwork(:,:,:) + trn(:,:,:,jpfep)                
          !
-         ferbudget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
+         ferbudget = glob_sum( 'p4zsms', zwork(:,:,:) * cvol(:,:,:)  )  
          ferbudget = ferbudget / areatot
          CALL iom_put( "pfertot", ferbudget )
@@ -496,16 +496,16 @@
       ! --------------------------------------------------------------------------------
       IF( iom_use( "tnfix" ) .OR.  ( ln_check_mass .AND. kt == nitend )  ) THEN
-         znitrpottot  = glob_sum ( nitrpot(:,:,:) * nitrfix * cvol(:,:,:) )
+         znitrpottot  = glob_sum ( 'p4zsms', nitrpot(:,:,:) * nitrfix * cvol(:,:,:) )
          CALL iom_put( "tnfix"  , znitrpottot * xfact3 )  ! Global  nitrogen fixation molC/l  to molN/m3 
       ENDIF
       !
       IF( iom_use( "tdenit" ) .OR.  ( ln_check_mass .AND. kt == nitend )  ) THEN
-         zrdenittot = glob_sum ( denitr(:,:,:) * rdenit * xnegtr(:,:,:) * cvol(:,:,:) )
-         zsdenittot = glob_sum ( sdenit(:,:) * e1e2t(:,:) * tmask(:,:,1) )
+         zrdenittot = glob_sum ( 'p4zsms', denitr(:,:,:) * rdenit * xnegtr(:,:,:) * cvol(:,:,:) )
+         zsdenittot = glob_sum ( 'p4zsms', sdenit(:,:) * e1e2t(:,:) * tmask(:,:,1) )
          CALL iom_put( "tdenit" , ( zrdenittot + zsdenittot ) * xfact3 )  ! Total denitrification molC/l to molN/m3 
       ENDIF
       !
       IF( ln_check_mass .AND. kt == nitend ) THEN   ! Compute the budget of NO3, ALK, Si, Fer
-         t_atm_co2_flx  = t_atm_co2_flx / glob_sum( e1e2t(:,:) )
+         t_atm_co2_flx  = t_atm_co2_flx / glob_sum( 'p4zsms', e1e2t(:,:) )
          t_oce_co2_flx  = t_oce_co2_flx         * xfact1 * (-1 )
          tpp            = tpp           * 1000. * xfact1
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p5zprod.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p5zprod.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/PISCES/P4Z/p5zprod.F90	(revision 10314)
@@ -459,5 +459,5 @@
     ! Total primary production per year
     IF( iom_use( "tintpp" ) .OR. ( ln_check_mass .AND. kt == nitend .AND. knt == nrdttrc )  )  &
-      & tpp = glob_sum( ( zprorcan(:,:,:) + zprorcad(:,:,:) + zprorcap(:,:,:) ) * cvol(:,:,:) )
+      & tpp = glob_sum( 'p5zprod', ( zprorcan(:,:,:) + zprorcad(:,:,:) + zprorcap(:,:,:) ) * cvol(:,:,:) )
 
     IF( lk_iomput ) THEN
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/TRP/trcrad.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/TRP/trcrad.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/TRP/trcrad.F90	(revision 10314)
@@ -150,9 +150,9 @@
             ENDIF
             !                                                         ! sum over the global domain 
-            ztrcorb = glob_sum( MIN( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) )
-            ztrcorn = glob_sum( MIN( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) )
-            !
-            ztrmasb = glob_sum( MAX( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) )
-            ztrmasn = glob_sum( MAX( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) )
+            ztrcorb = glob_sum( 'trcrad', MIN( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) )
+            ztrcorn = glob_sum( 'trcrad', MIN( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) )
+            !
+            ztrmasb = glob_sum( 'trcrad', MAX( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) )
+            ztrmasn = glob_sum( 'trcrad', MAX( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) )
             !
             IF( ztrcorb /= 0 ) THEN
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcbdy.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcbdy.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcbdy.F90	(revision 10314)
@@ -71,5 +71,5 @@
             END SELECT
             ! Boundary points should be updated
-            CALL lbc_bdy_lnk( tra(:,:,:,jn), 'T', 1., ib_bdy )
+            CALL lbc_bdy_lnk( 'trcbdy', tra(:,:,:,jn), 'T', 1., ib_bdy )
             !
          END DO
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcini.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcini.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcini.F90	(revision 10314)
@@ -119,9 +119,9 @@
       END DO
       !                          ! total volume of the ocean 
-      areatot = glob_sum( cvol(:,:,:) )
+      areatot = glob_sum( 'trcini', cvol(:,:,:) )
       !
       trai(:) = 0._wp            ! initial content of all tracers
       DO jn = 1, jptra
-         trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   )
+         trai(jn) = trai(jn) + glob_sum( 'trcini', trn(:,:,:,jn) * cvol(:,:,:)   )
       END DO
 
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcnam.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcnam.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcnam.F90	(revision 10314)
@@ -23,5 +23,7 @@
    USE trdtrc_oce  !
    USE iom         ! I/O manager
+#if defined key_mpp_mpi
    USE lib_mpp, ONLY: ncom_dttrc
+#endif
 
    IMPLICIT NONE
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcrst.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcrst.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcrst.F90	(revision 10314)
@@ -316,5 +316,5 @@
       !
       DO jn = 1, jptra
-         ztraf = glob_sum( trn(:,:,:,jn) * zvol(:,:,:) )
+         ztraf = glob_sum( 'trcrst', trn(:,:,:,jn) * zvol(:,:,:) )
          zmin  = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
          zmax  = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcstp.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcstp.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcstp.F90	(revision 10314)
@@ -73,5 +73,5 @@
             cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk)
          END DO
-         areatot         = glob_sum( cvol(:,:,:) )
+         areatot         = glob_sum( 'trcstp', cvol(:,:,:) )
       ENDIF
       !
@@ -107,5 +107,5 @@
       ztrai = 0._wp                                                   !  content of all tracers
       DO jn = 1, jptra
-         ztrai = ztrai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   )
+         ztrai = ztrai + glob_sum( 'trcstp', trn(:,:,:,jn) * cvol(:,:,:)   )
       END DO
       IF( lwp ) WRITE(numstr,9300) kt,  ztrai / areatot
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/BENCH/MY_SRC/zdfiwm.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/BENCH/MY_SRC/zdfiwm.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/BENCH/MY_SRC/zdfiwm.F90	(revision 10314)
@@ -468,7 +468,7 @@
       ecri_iwm(:,:) = ecri_iwm(:,:) * ssmask(:,:)
 
-      zbot = glob_sum( e1e2t(:,:) * ebot_iwm(:,:) )
-      zpyc = glob_sum( e1e2t(:,:) * epyc_iwm(:,:) )
-      zcri = glob_sum( e1e2t(:,:) * ecri_iwm(:,:) )
+      zbot = glob_sum( 'zdfiwm', e1e2t(:,:) * ebot_iwm(:,:) )
+      zpyc = glob_sum( 'zdfiwm', e1e2t(:,:) * epyc_iwm(:,:) )
+      zcri = glob_sum( 'zdfiwm', e1e2t(:,:) * ecri_iwm(:,:) )
       IF(lwp) THEN
          WRITE(numout,*) '      High-mode wave-breaking energy:             ', zbot * 1.e-12_wp, 'TW'
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/CANAL/MY_SRC/domvvl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/CANAL/MY_SRC/domvvl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/CANAL/MY_SRC/domvvl.F90	(revision 10314)
@@ -412,6 +412,6 @@
          IF( ( z_tmax >  rn_zdef_max ) .OR. ( z_tmin < - rn_zdef_max ) ) THEN
             IF( lk_mpp ) THEN
-               CALL mpp_maxloc( ze3t, tmask, z_tmax, ijk_max(1), ijk_max(2), ijk_max(3) )
-               CALL mpp_minloc( ze3t, tmask, z_tmin, ijk_min(1), ijk_min(2), ijk_min(3) )
+               CALL mpp_maxloc( 'domvvl', ze3t, tmask, z_tmax, ijk_max(1), ijk_max(2), ijk_max(3) )
+               CALL mpp_minloc( 'domvvl', ze3t, tmask, z_tmin, ijk_min(1), ijk_min(2), ijk_min(3) )
             ELSE
                ijk_max = MAXLOC( ze3t(:,:,:) )
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/CANAL/MY_SRC/stpctl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/CANAL/MY_SRC/stpctl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/CANAL/MY_SRC/stpctl.F90	(revision 10314)
@@ -120,7 +120,7 @@
          &  ISNAN( zmax(1) + zmax(2) + zmax(3) )  ) THEN   ! NaN encounter in the tests
          IF( lk_mpp ) THEN
-            CALL mpp_maxloc( ABS(sshn)        , ssmask(:,:)  , zzz, iih, ijh )
-            CALL mpp_maxloc( ABS(un)          , umask (:,:,:), zzz, iiu, iju, iku )
-!           CALL mpp_minloc( tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, iis, ijs, iks )
+            CALL mpp_maxloc( 'stpctl', ABS(sshn)        , ssmask(:,:)  , zzz, iih, ijh )
+            CALL mpp_maxloc( 'stpctl', ABS(un)          , umask (:,:,:), zzz, iiu, iju, iku )
+!           CALL mpp_minloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, iis, ijs, iks )
          ELSE
             iloch = MINLOC( ABS( sshn(:,:)   )                               )
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/VORTEX/MY_SRC/domvvl.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/VORTEX/MY_SRC/domvvl.F90	(revision 10313)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/tests/VORTEX/MY_SRC/domvvl.F90	(revision 10314)
@@ -435,6 +435,6 @@
          IF( ( z_tmax >  rn_zdef_max ) .OR. ( z_tmin < - rn_zdef_max ) ) THEN
             IF( lk_mpp ) THEN
-               CALL mpp_maxloc( ze3t, tmask, z_tmax, ijk_max(1), ijk_max(2), ijk_max(3) )
-               CALL mpp_minloc( ze3t, tmask, z_tmin, ijk_min(1), ijk_min(2), ijk_min(3) )
+               CALL mpp_maxloc( 'domvvl', ze3t, tmask, z_tmax, ijk_max(1), ijk_max(2), ijk_max(3) )
+               CALL mpp_minloc( 'domvvl', ze3t, tmask, z_tmin, ijk_min(1), ijk_min(2), ijk_min(3) )
             ELSE
                ijk_max = MAXLOC( ze3t(:,:,:) )
