Index: /LMDZ5/trunk/libf/dyn3dmem/abort_gcm.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/abort_gcm.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/abort_gcm.F	(revision 1823)
@@ -12,5 +12,5 @@
       USE ioipsl_getincom
 #endif
-      USE parallel
+      USE parallel_lmdz
 #include "iniprint.h"
  
Index: /LMDZ5/trunk/libf/dyn3dmem/addfi_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/addfi_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/addfi_loc.F	(revision 1823)
@@ -5,5 +5,5 @@
      S          pucov, pvcov, pteta, pq   , pps ,
      S          pdufi, pdvfi, pdhfi,pdqfi, pdpfi  )
-      USE parallel
+      USE parallel_lmdz
       USE infotrac, ONLY : nqtot
       USE control_mod, ONLY : planet_type
Index: /LMDZ5/trunk/libf/dyn3dmem/advect_new_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/advect_new_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/advect_new_loc.F	(revision 1823)
@@ -4,5 +4,5 @@
       SUBROUTINE advect_new_loc(ucov,vcov,teta,w,massebx,masseby,
      &                        du,dv,dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_loc
       USE advect_new_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/advect_new_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/advect_new_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/advect_new_mod.F90	(revision 1823)
@@ -16,5 +16,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -38,5 +38,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
     TYPE(distrib),INTENT(IN) :: dist
Index: /LMDZ5/trunk/libf/dyn3dmem/advtrac_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/advtrac_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/advtrac_loc.F	(revision 1823)
@@ -17,5 +17,5 @@
 c            M.A Filiberti (04/2002)
 c
-      USE parallel
+      USE parallel_lmdz
       USE Write_Field_loc
       USE Write_Field
Index: /LMDZ5/trunk/libf/dyn3dmem/advtrac_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/advtrac_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/advtrac_mod.F90	(revision 1823)
@@ -8,5 +8,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE infotrac
   USE vlspltgen_mod
@@ -24,5 +24,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE vlspltgen_mod
   IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/allocate_field_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/allocate_field_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/allocate_field_mod.F90	(revision 1823)
@@ -51,5 +51,5 @@
 
   SUBROUTINE allocate1d_u1d(field,d)
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
   REAL,POINTER :: field(:)
@@ -67,5 +67,5 @@
 
   SUBROUTINE allocate2d_u1d(field,dim1,d)
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
   REAL,POINTER :: field(:,:)
@@ -83,5 +83,5 @@
 
   SUBROUTINE allocate3d_u1d(field,dim1,dim2,d)
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
   REAL,POINTER :: field(:,:,:)
@@ -101,5 +101,5 @@
 
   SUBROUTINE allocate1d_v1d(field,d)
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
   REAL,POINTER :: field(:)
@@ -117,5 +117,5 @@
 
   SUBROUTINE allocate2d_v1d(field,dim1,d)
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
   REAL,POINTER :: field(:,:)
@@ -133,5 +133,5 @@
 
   SUBROUTINE allocate3d_v1d(field,dim1,dim2,d)
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
   REAL,POINTER :: field(:,:,:)
@@ -157,5 +157,5 @@
 
   SUBROUTINE allocate1d_u2d(field,d)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -174,5 +174,5 @@
 
   SUBROUTINE allocate2d_u2d(field,dim1,d)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -191,5 +191,5 @@
 
   SUBROUTINE allocate3d_u2d(field,dim1,dim2,d)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -210,5 +210,5 @@
 
   SUBROUTINE allocate1d_v2d(field,d)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -227,5 +227,5 @@
 
   SUBROUTINE allocate2d_v2d(field,dim1,d)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -244,5 +244,5 @@
 
   SUBROUTINE allocate3d_v2d(field,dim1,dim2,d)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -279,5 +279,5 @@
 
   SUBROUTINE switch1d_u1d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -315,5 +315,5 @@
   
   SUBROUTINE switch2d_u1d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -351,5 +351,5 @@
 
   SUBROUTINE switch3d_u1d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -390,5 +390,5 @@
 
   SUBROUTINE switch1d_v1d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -426,5 +426,5 @@
   
   SUBROUTINE switch2d_v1d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -462,5 +462,5 @@
 
   SUBROUTINE switch3d_v1d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -509,5 +509,5 @@
 
   SUBROUTINE switch1d_u2d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE dimensions_mod
@@ -546,5 +546,5 @@
   
   SUBROUTINE switch2d_u2d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE dimensions_mod
@@ -583,5 +583,5 @@
 
   SUBROUTINE switch3d_u2d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE dimensions_mod
@@ -623,5 +623,5 @@
 
   SUBROUTINE switch1d_v2d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE dimensions_mod
@@ -660,5 +660,5 @@
   
   SUBROUTINE switch2d_v2d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE dimensions_mod
@@ -697,5 +697,5 @@
 
   SUBROUTINE switch3d_v2d(field,old_dist,new_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE dimensions_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/bands.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/bands.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/bands.F90	(revision 1823)
@@ -3,5 +3,5 @@
 !
   module Bands
-  USE parallel
+  USE parallel_lmdz
     integer, parameter :: bands_caldyn=1
     integer, parameter :: bands_vanleer=2
@@ -27,5 +27,5 @@
   
   subroutine AllocateBands
-    use parallel
+    USE parallel_lmdz
     implicit none
     
@@ -41,5 +41,5 @@
   
   subroutine Read_distrib
-    use parallel
+    USE parallel_lmdz
     implicit none
 
@@ -104,5 +104,5 @@
    
    SUBROUTINE  Set_Bands 
-     USE parallel
+     USE parallel_lmdz
 #ifdef CPP_PHYS
 ! Ehouarn: what follows is only related to // physics
@@ -168,5 +168,5 @@
     subroutine AdjustBands_caldyn(new_dist)
       use times
-      use parallel
+      USE parallel_lmdz
       implicit none
       TYPE(distrib),INTENT(INOUT) :: new_dist
@@ -235,5 +235,5 @@
     subroutine AdjustBands_vanleer(new_dist)
       use times
-      use parallel
+      USE parallel_lmdz
       implicit none
       TYPE(distrib),INTENT(INOUT) :: new_dist
@@ -304,5 +304,5 @@
     subroutine AdjustBands_dissip(new_dist)
       use times
-      use parallel
+      USE parallel_lmdz
       implicit none
       TYPE(distrib),INTENT(INOUT) :: new_dist
@@ -377,5 +377,5 @@
       USE mod_phys_lmdz_para, only : klon_mpi_para_nb
 #endif
-      USE parallel
+      USE parallel_lmdz
       implicit none
 
@@ -428,5 +428,5 @@
 
     subroutine WriteBands
-    USE parallel
+    USE parallel_lmdz
     implicit none
     include "dimensions.h"
Index: /LMDZ5/trunk/libf/dyn3dmem/bernoui_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/bernoui_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/bernoui_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE bernoui_loc (ngrid,nlay,pphi,pecin,pbern)
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/bilan_dyn_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/bilan_dyn_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/bilan_dyn_loc.F	(revision 1823)
@@ -13,5 +13,5 @@
       USE IOIPSL
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/caladvtrac_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/caladvtrac_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/caladvtrac_loc.F	(revision 1823)
@@ -7,5 +7,5 @@
      *                   p ,masse, dq ,  teta,
      *                   flxw, pk, iapptrac)
-      USE parallel 
+      USE parallel_lmdz 
       USE infotrac, ONLY : nqtot
       USE control_mod, ONLY : iapp_tracvl,planet_type
Index: /LMDZ5/trunk/libf/dyn3dmem/caladvtrac_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/caladvtrac_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/caladvtrac_mod.F90	(revision 1823)
@@ -22,5 +22,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE infotrac
   USE advtrac_mod, ONLY : advtrac_allocate
@@ -57,5 +57,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE groupe_mod
   IMPLICIT NONE
@@ -76,5 +76,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE advtrac_mod, ONLY : advtrac_switch_vanleer 
   IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/caldyn_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/caldyn_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/caldyn_loc.F	(revision 1823)
@@ -10,5 +10,5 @@
      $ (itau,ucov,vcov,teta,ps,masse,pk,pkf,phis ,
      $  phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time )
-      USE parallel
+      USE parallel_lmdz
       USE Write_Field_loc
       USE caldyn_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/caldyn_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/caldyn_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/caldyn_mod.F90	(revision 1823)
@@ -21,5 +21,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   USE advect_new_mod,ONLY : advect_new_allocate
@@ -49,5 +49,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE advect_new_mod,ONLY : advect_new_switch_caldyn
   IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/calfis_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/calfis_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/calfis_loc.F	(revision 1823)
@@ -37,5 +37,5 @@
       USE IOPHY
 #endif
-      USE parallel, ONLY : omp_chunk, using_mpi,jjb_u,jje_u,jjb_v,jje_v
+      USE parallel_lmdz,ONLY:omp_chunk,using_mpi,jjb_u,jje_u,jjb_v,jje_v
       USE Write_Field
       Use Write_field_p
Index: /LMDZ5/trunk/libf/dyn3dmem/call_calfis_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/call_calfis_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/call_calfis_mod.F90	(revision 1823)
@@ -37,5 +37,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   USE infotrac
@@ -75,5 +75,5 @@
                          phis_dyn,q_dyn,flxw_dyn)
   USE dimensions_mod
-  USE parallel
+  USE parallel_lmdz
   USE times
   USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dmem/call_dissip_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/call_dissip_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/call_dissip_mod.F90	(revision 1823)
@@ -23,5 +23,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   USE dissip_mod, ONLY : dissip_allocate
@@ -52,5 +52,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE dissip_mod, ONLY : dissip_switch_dissip
   IMPLICIT NONE
@@ -79,5 +79,5 @@
   SUBROUTINE call_dissip(ucov_dyn,vcov_dyn,teta_dyn,p_dyn,pk_dyn,ps_dyn)
   USE dimensions_mod
-  USE parallel
+  USE parallel_lmdz
   USE times
   USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dmem/ce0l.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/ce0l.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/ce0l.F90	(revision 1823)
@@ -22,5 +22,5 @@
   USE mod_const_mpi
   USE infotrac
-  USE parallel, ONLY: finalize_parallel
+  USE parallel_lmdz
   USE indice_sol_mod
 
Index: /LMDZ5/trunk/libf/dyn3dmem/conf_gcm.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/conf_gcm.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/conf_gcm.F	(revision 1823)
@@ -17,5 +17,5 @@
       use mod_filtre_fft_loc, ONLY : use_filtre_fft_loc=>use_filtre_fft
       use mod_hallo, ONLY : use_mpi_alloc
-      use parallel, ONLY : omp_chunk
+      USE parallel_lmdz, ONLY : omp_chunk
       USE infotrac, ONLY : type_trac
       use assert_m, only: assert
Index: /LMDZ5/trunk/libf/dyn3dmem/convflu_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/convflu_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/convflu_loc.F	(revision 1823)
@@ -15,5 +15,5 @@
 c     nbniv   est le nombre de niveaux vert. de  xflu et de yflu .
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/convmas1_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/convmas1_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/convmas1_loc.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas1_loc (pbaru, pbarv, convm )
 c
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/convmas2_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/convmas2_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/convmas2_loc.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas2_loc ( convm )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/convmas_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/convmas_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/convmas_loc.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas_loc (pbaru, pbarv, convm )
 c
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/covcont_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/covcont_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/covcont_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE covcont_loc (klevel,ucov, vcov, ucont, vcont )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/covnat_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/covnat_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/covnat_loc.F	(revision 1823)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE covnat_loc(klevel,ucov, vcov, unat, vnat )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/dissip_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dissip_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dissip_loc.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE dissip_loc( vcov,ucov,teta,p, dv,du,dh )
 c
-      USE parallel
+      USE parallel_lmdz
       USE write_field_loc
       USE dissip_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/dissip_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dissip_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dissip_mod.F90	(revision 1823)
@@ -8,5 +8,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   USE gradiv2_mod, ONLY : gradiv2_allocate
@@ -25,5 +25,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE gradiv2_mod,ONLY : gradiv2_switch_dissip
   USE nxgraro2_mod,ONLY : nxgraro2_switch_dissip
Index: /LMDZ5/trunk/libf/dyn3dmem/diverg_gam_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/diverg_gam_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/diverg_gam_loc.F	(revision 1823)
@@ -9,5 +9,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/diverg_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/diverg_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/diverg_p.F	(revision 1823)
@@ -8,5 +8,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/divergf_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/divergf_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/divergf_loc.F	(revision 1823)
@@ -8,5 +8,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE PARALLEL
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/divgrad2_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/divgrad2_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/divgrad2_loc.F	(revision 1823)
@@ -10,5 +10,5 @@
 c         divgra     est  un argument  de sortie pour le s-prg
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dmem/divgrad2_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/divgrad2_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/divgrad2_mod.F90	(revision 1823)
@@ -8,5 +8,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -22,5 +22,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
     TYPE(distrib),INTENT(IN) :: dist
Index: /LMDZ5/trunk/libf/dyn3dmem/dteta1_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dteta1_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dteta1_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE dteta1_loc ( teta, pbaru, pbarv, dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       USE mod_filtreg_p
Index: /LMDZ5/trunk/libf/dyn3dmem/dudv1_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dudv1_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dudv1_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE dudv1_loc ( vorpot, pbaru, pbarv, du, dv )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/dudv2_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dudv2_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dudv2_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE dudv2_loc ( teta, pkf, bern, du, dv  )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/dynetat0_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dynetat0_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dynetat0_loc.F	(revision 1823)
@@ -6,5 +6,5 @@
       USE infotrac
       use control_mod, only : planet_type
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/dynredem_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dynredem_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dynredem_loc.F	(revision 1823)
@@ -7,5 +7,5 @@
       USE IOIPSL
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE infotrac
@@ -528,5 +528,5 @@
       SUBROUTINE dynredem1_loc(fichnom,time,
      .                     vcov,ucov,teta,q,masse,ps)
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE infotrac
Index: /LMDZ5/trunk/libf/dyn3dmem/dynredem_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/dynredem_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/dynredem_mod.F90	(revision 1823)
@@ -8,5 +8,5 @@
   SUBROUTINE dynredem_write_u(ncid,id,var,ll)
   USE dimensions_mod
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -73,5 +73,5 @@
   SUBROUTINE dynredem_write_v(ncid,id,var,ll)
   USE dimensions_mod
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
@@ -138,5 +138,5 @@
   SUBROUTINE dynredem_read_u(ncid,id,var,ll)
   USE dimensions_mod
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/enercin_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/enercin_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/enercin_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE enercin_loc ( vcov, ucov, vcont, ucont, ecin )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/exner_hyb_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/exner_hyb_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/exner_hyb_loc.F	(revision 1823)
@@ -29,5 +29,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       USE write_field_loc
Index: /LMDZ5/trunk/libf/dyn3dmem/exner_milieu_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/exner_milieu_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/exner_milieu_loc.F	(revision 1823)
@@ -26,5 +26,5 @@
 c    ( voir note de Fr.Hourdin )  ,
 c
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/filtreg_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/filtreg_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/filtreg_p.F	(revision 1823)
@@ -3,5 +3,5 @@
       SUBROUTINE filtreg_p ( champ, ibeg, iend, nlat, nbniv, 
      &     ifiltre, iaire, griscal ,iter)
-      USE Parallel, only : OMP_CHUNK
+      USE parallel_lmdz, only : OMP_CHUNK
       USE mod_filtre_fft
       USE timer_filtre
Index: /LMDZ5/trunk/libf/dyn3dmem/flumass_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/flumass_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/flumass_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE flumass_loc(massebx,masseby,vcont,ucont,pbaru,pbarv)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/friction_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/friction_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/friction_loc.F	(revision 1823)
@@ -4,5 +4,5 @@
 c=======================================================================
       SUBROUTINE friction_loc(ucov,vcov,pdt)
-      USE parallel
+      USE parallel_lmdz
       USE control_mod
 #ifdef CPP_IOIPSL
Index: /LMDZ5/trunk/libf/dyn3dmem/gcm.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/gcm.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/gcm.F	(revision 1823)
@@ -11,5 +11,5 @@
 
       USE mod_const_mpi, ONLY: init_const_mpi
-      USE parallel
+      USE parallel_lmdz
       USE infotrac
       USE mod_interface_dyn_phys
Index: /LMDZ5/trunk/libf/dyn3dmem/geopot_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/geopot_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/geopot_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE geopot_loc ( ngrid, teta, pk, pks, phis, phi )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
       
Index: /LMDZ5/trunk/libf/dyn3dmem/getparam.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/getparam.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/getparam.F90	(revision 1823)
@@ -18,5 +18,5 @@
 CONTAINS
   SUBROUTINE ini_getparam(fichier)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -28,5 +28,5 @@
 
   SUBROUTINE fin_getparam
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -37,5 +37,5 @@
 
   SUBROUTINE getparamr(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -63,5 +63,5 @@
 
   SUBROUTINE getparami(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -90,5 +90,5 @@
 
   SUBROUTINE getparaml(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/gr_dyn_fi_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/gr_dyn_fi_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/gr_dyn_fi_p.F	(revision 1823)
@@ -7,5 +7,5 @@
       USE mod_interface_dyn_phys
       USE dimphy
-      USE PARALLEL
+      USE parallel_lmdz
       IMPLICIT NONE
 c=======================================================================
Index: /LMDZ5/trunk/libf/dyn3dmem/gr_fi_dyn_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/gr_fi_dyn_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/gr_fi_dyn_p.F	(revision 1823)
@@ -7,5 +7,5 @@
       USE mod_interface_dyn_phys
       USE dimphy
-      use parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c=======================================================================
Index: /LMDZ5/trunk/libf/dyn3dmem/gr_u_scal_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/gr_u_scal_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/gr_u_scal_loc.F	(revision 1823)
@@ -25,5 +25,5 @@
 c
 c=======================================================================
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c-----------------------------------------------------------------------
Index: /LMDZ5/trunk/libf/dyn3dmem/gr_v_scal_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/gr_v_scal_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/gr_v_scal_loc.F	(revision 1823)
@@ -25,5 +25,5 @@
 c
 c=======================================================================
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c-----------------------------------------------------------------------
Index: /LMDZ5/trunk/libf/dyn3dmem/grad_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/grad_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/grad_loc.F	(revision 1823)
@@ -10,5 +10,5 @@
 c       pgx  et  pgy    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/grad_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/grad_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/grad_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c       pgx  et  pgy    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/gradiv2_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/gradiv2_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/gradiv2_loc.F	(revision 1823)
@@ -13,5 +13,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE Write_field_p
Index: /LMDZ5/trunk/libf/dyn3dmem/gradiv2_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/gradiv2_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/gradiv2_mod.F90	(revision 1823)
@@ -10,5 +10,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -26,5 +26,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
     TYPE(distrib),INTENT(IN) :: dist
Index: /LMDZ5/trunk/libf/dyn3dmem/groupe_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/groupe_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/groupe_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       subroutine groupe_loc(pext,pbaru,pbarv,pbarum,pbarvm,wm)
-      USE parallel
+      USE parallel_lmdz
       USE Write_field_loc
       USE groupe_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/groupe_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/groupe_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/groupe_mod.F90	(revision 1823)
@@ -9,5 +9,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE infotrac
   USE advtrac_mod, ONLY : advtrac_allocate 
@@ -27,5 +27,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
     TYPE(distrib),INTENT(IN) :: dist
Index: /LMDZ5/trunk/libf/dyn3dmem/groupeun_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/groupeun_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/groupeun_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE groupeun_loc(jjmax,llmax,sb,se,jjb,jje,q)
-      USE parallel
+      USE parallel_lmdz
       USE Write_Field_p
       IMPLICIT NONE
@@ -135,5 +135,5 @@
       SUBROUTINE init_groupeun_loc(airen_tab, aires_tab)
 
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/guide_loc_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/guide_loc_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/guide_loc_mod.F90	(revision 1823)
@@ -12,5 +12,5 @@
   USE Write_Field_loc
   use netcdf, only: nf90_nowrite, nf90_open, nf90_inq_varid, nf90_close
-  USE parallel
+  USE parallel_lmdz
   USE pres2lev_mod
 
@@ -293,5 +293,5 @@
 !=======================================================================
   SUBROUTINE guide_main(itau,ucov,vcov,teta,q,masse,ps)
-    use parallel
+    USE parallel_lmdz
     USE control_mod
     USE write_field_loc
@@ -858,5 +858,5 @@
 !=======================================================================
   SUBROUTINE guide_interp(psi,teta)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE Bands
@@ -1975,5 +1975,5 @@
 !=======================================================================
   SUBROUTINE guide_out(varname,hsize,vsize,field,factt)
-    USE parallel
+    USE parallel_lmdz
     IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/iniacademic_loc.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/iniacademic_loc.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/iniacademic_loc.F90	(revision 1823)
@@ -7,5 +7,5 @@
   USE infotrac, ONLY : nqtot
   USE control_mod, ONLY: day_step,planet_type
-  USE parallel
+  USE parallel_lmdz
 #ifdef CPP_IOIPSL
   USE IOIPSL
Index: /LMDZ5/trunk/libf/dyn3dmem/initdynav_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/initdynav_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/initdynav_loc.F	(revision 1823)
@@ -8,5 +8,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       USE parallel_lmdz
        use Write_field
        use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/initfluxsto_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/initfluxsto_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/initfluxsto_p.F	(revision 1823)
@@ -10,5 +10,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       USE parallel_lmdz
        use Write_field
        use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/inithist_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/inithist_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/inithist_loc.F	(revision 1823)
@@ -8,5 +8,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       USE parallel_lmdz
        use Write_field
        use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dmem/integrd_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/integrd_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/integrd_loc.F	(revision 1823)
@@ -5,5 +5,5 @@
      $  (  nq,vcovm1,ucovm1,tetam1,psm1,massem1,
      $     dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps0,masse,phis) !,finvmaold)
-      USE parallel
+      USE parallel_lmdz
       USE control_mod
       USE mod_filtreg_p
Index: /LMDZ5/trunk/libf/dyn3dmem/integrd_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/integrd_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/integrd_mod.F90	(revision 1823)
@@ -12,5 +12,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   USE advect_new_mod,ONLY : advect_new_allocate
@@ -30,5 +30,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
     TYPE(distrib),INTENT(IN) :: dist
Index: /LMDZ5/trunk/libf/dyn3dmem/laplacien_gam_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/laplacien_gam_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/laplacien_gam_loc.F	(revision 1823)
@@ -11,5 +11,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/laplacien_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/laplacien_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/laplacien_loc.F	(revision 1823)
@@ -9,5 +9,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/laplacien_rot_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/laplacien_rot_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/laplacien_rot_loc.F	(revision 1823)
@@ -10,5 +10,5 @@
 c      rotout           est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/laplacien_rotgam_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/laplacien_rotgam_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/laplacien_rotgam_loc.F	(revision 1823)
@@ -9,5 +9,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/leapfrog_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/leapfrog_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/leapfrog_loc.F	(revision 1823)
@@ -13,5 +13,5 @@
 
        USE misc_mod
-       USE parallel
+       USE parallel_lmdz
        USE times
        USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dmem/leapfrog_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/leapfrog_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/leapfrog_mod.F90	(revision 1823)
@@ -40,5 +40,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   USE infotrac
@@ -96,5 +96,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE caldyn_mod,ONLY : caldyn_switch_caldyn
   USE integrd_mod,ONLY : integrd_switch_caldyn
@@ -145,5 +145,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE call_dissip_mod,ONLY : call_dissip_switch_dissip
   IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/massbar_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/massbar_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/massbar_loc.F	(revision 1823)
@@ -13,5 +13,5 @@
 c     
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/massbarxy_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/massbarxy_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/massbarxy_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE massbarxy_loc(  masse, massebxy )
-      USE parallel
+      USE parallel_lmdz
       implicit none
 c **********************************************************************
Index: /LMDZ5/trunk/libf/dyn3dmem/massdair_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/massdair_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/massdair_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE massdair_loc( p, masse )
-      USE parallel
+      USE parallel_lmdz
 c
 c *********************************************************************
Index: /LMDZ5/trunk/libf/dyn3dmem/mod_filtreg_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/mod_filtreg_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/mod_filtreg_p.F	(revision 1823)
@@ -5,5 +5,5 @@
       SUBROUTINE filtreg_p ( champ,jjb,jje, ibeg, iend, nlat, nbniv, 
      &     ifiltre, iaire, griscal ,iter)
-      USE Parallel, only : OMP_CHUNK
+      USE parallel_lmdz, only : OMP_CHUNK
       USE mod_filtre_fft_loc
       USE timer_filtre
Index: /LMDZ5/trunk/libf/dyn3dmem/mod_hallo.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/mod_hallo.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/mod_hallo.F90	(revision 1823)
@@ -1,4 +1,4 @@
 module mod_Hallo
-USE parallel
+USE parallel_lmdz
 implicit none
   logical,save :: use_mpi_alloc
@@ -340,5 +340,5 @@
 
   SUBROUTINE Register_SwapField1d_u(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -371,5 +371,5 @@
 
   SUBROUTINE Register_SwapField2d_u1d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
     IMPLICIT NONE
@@ -405,5 +405,5 @@
 
   SUBROUTINE Register_SwapField3d_u(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -440,5 +440,5 @@
 
  SUBROUTINE Register_SwapField1d_u2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
 
@@ -472,5 +472,5 @@
 
   SUBROUTINE Register_SwapField2d_u2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
 
@@ -507,5 +507,5 @@
 
   SUBROUTINE Register_SwapField3d_u2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -546,5 +546,5 @@
 
   SUBROUTINE Register_SwapField1d_v(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -577,5 +577,5 @@
 
   SUBROUTINE Register_SwapField2d_v1d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -611,5 +611,5 @@
 
   SUBROUTINE Register_SwapField3d_v(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -647,5 +647,5 @@
 
   SUBROUTINE Register_SwapField1d_v2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -678,5 +678,5 @@
 
   SUBROUTINE Register_SwapField2d_v2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -712,5 +712,5 @@
 
   SUBROUTINE Register_SwapField3d_v2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -747,5 +747,5 @@
 
   SUBROUTINE Register_SwapField_gen_u(FieldS,FieldR,ll,old_dist,new_dist,Up,Down,a_request)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
       IMPLICIT NONE
@@ -800,5 +800,5 @@
 
   SUBROUTINE Register_SwapField_gen_v(FieldS,FieldR,ll,old_dist,new_dist,Up,Down,a_request)
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
     IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/nxgrad_gam_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/nxgrad_gam_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/nxgrad_gam_loc.F	(revision 1823)
@@ -9,5 +9,5 @@
 c       x  et y    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/nxgrad_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/nxgrad_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/nxgrad_loc.F	(revision 1823)
@@ -9,5 +9,5 @@
 c       x  et y    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/nxgraro2_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/nxgraro2_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/nxgraro2_loc.F	(revision 1823)
@@ -13,5 +13,5 @@
 c
       USE write_Field_p
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dmem/nxgraro2_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/nxgraro2_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/nxgraro2_mod.F90	(revision 1823)
@@ -10,5 +10,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE dimensions_mod
   IMPLICIT NONE
@@ -26,5 +26,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
     TYPE(distrib),INTENT(IN) :: dist
Index: /LMDZ5/trunk/libf/dyn3dmem/nxgrarot_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/nxgrarot_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/nxgrarot_p.F	(revision 1823)
@@ -13,5 +13,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE write_field_p
Index: DZ5/trunk/libf/dyn3dmem/parallel.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/parallel.F90	(revision 1822)
+++ 	(revision )
@@ -1,755 +1,0 @@
-! 
-! $Id$
-!
-  module parallel
-  USE mod_const_mpi
-    
-    INTEGER,PARAMETER :: halo_max=3
-    
-    LOGICAL,SAVE :: using_mpi
-    LOGICAL,SAVE :: using_omp
-    
-    integer, save :: mpi_size
-    integer, save :: mpi_rank
-    integer, save :: jj_begin
-    integer, save :: jj_end
-    integer, save :: jj_nb
-    integer, save :: ij_begin
-    integer, save :: ij_end
-    logical, save :: pole_nord
-    logical, save :: pole_sud
-
-    integer,save  :: jjb_u
-    integer,save  :: jje_u
-    integer,save  :: jjnb_u
-    integer,save  :: jjb_v
-    integer,save  :: jje_v
-    integer,save  :: jjnb_v    
-
-    integer,save  :: ijb_u
-    integer,save  :: ije_u
-    integer,save  :: ijnb_u    
-    
-    integer,save  :: ijb_v
-    integer,save  :: ije_v
-    integer,save  :: ijnb_v    
-     
-    
-    integer, allocatable, save, dimension(:) :: jj_begin_para
-    integer, allocatable, save, dimension(:) :: jj_end_para
-    integer, allocatable, save, dimension(:) :: jj_nb_para
-    integer, save :: OMP_CHUNK
-    integer, save :: omp_rank
-    integer, save :: omp_size  
-!$OMP THREADPRIVATE(omp_rank)
-
-    TYPE distrib
-      integer :: jj_begin
-      integer :: jj_end
-      integer :: jj_nb
-      integer :: ij_begin
-      integer :: ij_end
-
-      integer  :: jjb_u
-      integer  :: jje_u
-      integer  :: jjnb_u
-      integer  :: jjb_v
-      integer  :: jje_v
-      integer  :: jjnb_v    
- 
-      integer  :: ijb_u
-      integer  :: ije_u
-      integer  :: ijnb_u    
-    
-      integer  :: ijb_v
-      integer  :: ije_v
-      integer  :: ijnb_v    
-     
-    
-      integer, pointer :: jj_begin_para(:) => NULL()
-      integer, pointer :: jj_end_para(:) => NULL()
-      integer, pointer :: jj_nb_para(:) => NULL()
-    END TYPE distrib  
-    
-    INTERFACE ASSIGNMENT (=)
-      MODULE PROCEDURE copy_distrib
-    END INTERFACE
-    TYPE(distrib),SAVE :: current_dist
-    
- contains
- 
-    subroutine init_parallel
-    USE vampir
-    implicit none
-#ifdef CPP_MPI
-      include 'mpif.h'
-#endif
-#include "dimensions.h"
-#include "paramet.h"
-#include "iniprint.h"
-
-      integer :: ierr
-      integer :: i,j
-      integer :: type_size
-      integer, dimension(3) :: blocklen,type
-      integer :: comp_id
-      character(len=4)  :: num
-      character(len=20) :: filename
- 
-#ifdef CPP_OMP    
-      INTEGER :: OMP_GET_NUM_THREADS
-      EXTERNAL OMP_GET_NUM_THREADS
-      INTEGER :: OMP_GET_THREAD_NUM
-      EXTERNAL OMP_GET_THREAD_NUM
-#endif  
-
-#ifdef CPP_MPI
-       using_mpi=.TRUE.
-#else
-       using_mpi=.FALSE.
-#endif
-      
-
-#ifdef CPP_OMP
-       using_OMP=.TRUE.
-#else
-       using_OMP=.FALSE.
-#endif
-      
-      call InitVampir
-      
-      IF (using_mpi) THEN
-#ifdef CPP_MPI
-        call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr)
-        call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr)
-#endif
-      ELSE
-        mpi_size=1
-        mpi_rank=0
-      ENDIF
-
-
-! Open text output file with mpi_rank in suffix of file name 
-      IF (lunout /= 5 .and. lunout /= 6) THEN
-         WRITE(num,'(I4.4)') mpi_rank
-         filename='lmdz.out_'//num
-         IF (mpi_rank .NE. 0) THEN
-            OPEN(UNIT=lunout,FILE=TRIM(filename),ACTION='write', &
-               STATUS='unknown',FORM='formatted',IOSTAT=ierr) 
-         ENDIF
-      ENDIF
-
-      
-      allocate(jj_begin_para(0:mpi_size-1))
-      allocate(jj_end_para(0:mpi_size-1))
-      allocate(jj_nb_para(0:mpi_size-1))
-      
-      do i=0,mpi_size-1
-        jj_nb_para(i)=(jjm+1)/mpi_size
-        if ( i < MOD((jjm+1),mpi_size) ) jj_nb_para(i)=jj_nb_para(i)+1
-        
-        if (jj_nb_para(i) <= 2 ) then
-          
-         write(lunout,*)"Arret : le nombre de bande de lattitude par process est trop faible (<2)."
-         write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude"
-          
-#ifdef CPP_MPI
-          IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr)
-#endif          
-        endif
-        
-      enddo
-      
-!      jj_nb_para(0)=11
-!      jj_nb_para(1)=25
-!      jj_nb_para(2)=25
-!      jj_nb_para(3)=12      
-
-      j=1
-      
-      do i=0,mpi_size-1 
-        
-        jj_begin_para(i)=j
-        jj_end_para(i)=j+jj_Nb_para(i)-1
-        j=j+jj_Nb_para(i)
-      
-      enddo
-      
-      jj_begin = jj_begin_para(mpi_rank)
-      jj_end   = jj_end_para(mpi_rank)
-      jj_nb    = jj_nb_para(mpi_rank)
-      
-      ij_begin=(jj_begin-1)*iip1+1
-      ij_end=jj_end*iip1
-      
-      if (mpi_rank.eq.0) then
-        pole_nord=.TRUE.
-      else 
-        pole_nord=.FALSE.
-      endif
-      
-      if (mpi_rank.eq.mpi_size-1) then
-        pole_sud=.TRUE.
-      else 
-        pole_sud=.FALSE.
-      endif
-        
-      write(lunout,*)"init_parallel: jj_begin",jj_begin
-      write(lunout,*)"init_parallel: jj_end",jj_end
-      write(lunout,*)"init_parallel: ij_begin",ij_begin
-      write(lunout,*)"init_parallel: ij_end",ij_end
-      jjb_u=MAX(jj_begin-halo_max,1)
-      jje_u=MIN(jj_end+halo_max,jjp1)
-      jjnb_u=jje_u-jjb_u+1
-
-      jjb_v=MAX(jj_begin-halo_max,1)
-      jje_v=MIN(jj_end+halo_max,jjm)
-      jjnb_v=jje_v-jjb_v+1
-
-      ijb_u=MAX(ij_begin-halo_max*iip1,1)
-      ije_u=MIN(ij_end+halo_max*iip1,ip1jmp1)
-      ijnb_u=ije_u-ijb_u+1
-
-      ijb_v=MAX(ij_begin-halo_max*iip1,1)
-      ije_v=MIN(ij_end+halo_max*iip1,ip1jm)
-      ijnb_v=ije_v-ijb_v+1
-      
-!$OMP PARALLEL
-
-#ifdef CPP_OMP
-!$OMP MASTER
-        omp_size=OMP_GET_NUM_THREADS()
-!$OMP END MASTER
-        omp_rank=OMP_GET_THREAD_NUM()    
-#else    
-        omp_size=1
-        omp_rank=0
-#endif
-!$OMP END PARALLEL         
-      CALL create_distrib(jj_nb_para,current_dist)
-      
-    end subroutine init_parallel
-
-    SUBROUTINE create_distrib(jj_nb_new,d)
-    IMPLICIT NONE
-      INCLUDE "dimensions.h"
-      INCLUDE "paramet.h"
-      
-      INTEGER,INTENT(IN) :: jj_Nb_New(0:MPI_Size-1)
-      TYPE(distrib),INTENT(INOUT) :: d
-      INTEGER :: i  
-  
-      IF (.NOT. ASSOCIATED(d%jj_nb_para)) ALLOCATE(d%jj_nb_para(0:MPI_Size-1))
-      IF (.NOT. ASSOCIATED(d%jj_begin_para)) ALLOCATE(d%jj_begin_para(0:MPI_Size-1))
-      IF (.NOT. ASSOCIATED(d%jj_end_para)) ALLOCATE(d%jj_end_para(0:MPI_Size-1))
-      
-      d%jj_Nb_Para=jj_Nb_New
-      
-      d%jj_begin_para(0)=1
-      d%jj_end_para(0)=d%jj_Nb_Para(0)
-      
-      do i=1,mpi_size-1 
-        
-        d%jj_begin_para(i)=d%jj_end_para(i-1)+1
-        d%jj_end_para(i)=d%jj_begin_para(i)+d%jj_Nb_para(i)-1
-      
-      enddo
-      
-      d%jj_begin = d%jj_begin_para(mpi_rank)
-      d%jj_end   = d%jj_end_para(mpi_rank)
-      d%jj_nb    = d%jj_nb_para(mpi_rank)
-      
-      d%ij_begin=(d%jj_begin-1)*iip1+1
-      d%ij_end=d%jj_end*iip1
-
-      d%jjb_u=MAX(d%jj_begin-halo_max,1)
-      d%jje_u=MIN(d%jj_end+halo_max,jjp1)
-      d%jjnb_u=d%jje_u-d%jjb_u+1
-
-      d%jjb_v=MAX(d%jj_begin-halo_max,1)
-      d%jje_v=MIN(d%jj_end+halo_max,jjm)
-      d%jjnb_v=d%jje_v-d%jjb_v+1
-
-      d%ijb_u=MAX(d%ij_begin-halo_max*iip1,1)
-      d%ije_u=MIN(d%ij_end+halo_max*iip1,ip1jmp1)
-      d%ijnb_u=d%ije_u-d%ijb_u+1
-
-      d%ijb_v=MAX(d%ij_begin-halo_max*iip1,1)
-      d%ije_v=MIN(d%ij_end+halo_max*iip1,ip1jm)
-      d%ijnb_v=d%ije_v-d%ijb_v+1      
-
-    END SUBROUTINE create_distrib
-
-      
-    SUBROUTINE Set_Distrib(d)
-    IMPLICIT NONE
-
-    INCLUDE "dimensions.h"
-    INCLUDE "paramet.h"
-    TYPE(distrib),INTENT(IN) :: d
-
-      jj_begin = d%jj_begin
-      jj_end = d%jj_end
-      jj_nb = d%jj_nb
-      ij_begin = d%ij_begin
-      ij_end = d%ij_end
-
-      jjb_u = d%jjb_u
-      jje_u = d%jje_u
-      jjnb_u = d%jjnb_u
-      jjb_v = d%jjb_v
-      jje_v = d%jje_v
-      jjnb_v = d%jjnb_v
- 
-      ijb_u = d%ijb_u
-      ije_u = d%ije_u
-      ijnb_u = d%ijnb_u
-    
-      ijb_v = d%ijb_v
-      ije_v = d%ije_v
-      ijnb_v = d%ijnb_v
-     
-    
-      jj_begin_para(:) = d%jj_begin_para(:)
-      jj_end_para(:) = d%jj_end_para(:)
-      jj_nb_para(:) = d%jj_nb_para(:)
-      current_dist=d 
-
-    END SUBROUTINE Set_Distrib
-
-    SUBROUTINE copy_distrib(dist,new_dist)
-    IMPLICIT NONE
-
-    INCLUDE "dimensions.h"
-    INCLUDE "paramet.h"
-    TYPE(distrib),INTENT(INOUT) :: dist
-    TYPE(distrib),INTENT(IN) :: new_dist
-
-     dist%jj_begin = new_dist%jj_begin
-     dist%jj_end = new_dist%jj_end
-     dist%jj_nb = new_dist%jj_nb
-     dist%ij_begin = new_dist%ij_begin
-     dist%ij_end = new_dist%ij_end
-
-     dist%jjb_u = new_dist%jjb_u
-     dist%jje_u = new_dist%jje_u
-     dist%jjnb_u = new_dist%jjnb_u
-     dist%jjb_v = new_dist%jjb_v
-     dist%jje_v = new_dist%jje_v
-     dist%jjnb_v = new_dist%jjnb_v
-   
-     dist%ijb_u = new_dist%ijb_u
-     dist%ije_u = new_dist%ije_u
-     dist%ijnb_u = new_dist%ijnb_u
-     
-     dist%ijb_v = new_dist%ijb_v
-     dist%ije_v = new_dist%ije_v
-     dist%ijnb_v = new_dist%ijnb_v
-         
-     
-     dist%jj_begin_para(:) = new_dist%jj_begin_para(:)
-     dist%jj_end_para(:) = new_dist%jj_end_para(:)
-     dist%jj_nb_para(:) = new_dist%jj_nb_para(:)
- 
-    END SUBROUTINE copy_distrib
-    
-    
-    SUBROUTINE get_current_distrib(d)
-    IMPLICIT NONE
-
-    INCLUDE "dimensions.h"
-    INCLUDE "paramet.h"
-    TYPE(distrib),INTENT(OUT) :: d
-
-     d=current_dist
-
-    END SUBROUTINE get_current_distrib
-    
-    subroutine Finalize_parallel
-#ifdef CPP_COUPLE
-    use mod_prism_proto
-! Ehouarn: surface_data module is in 'phylmd' ...
-      use surface_data, only : type_ocean
-      implicit none
-#else
-      implicit none
-! without the surface_data module, we declare (and set) a dummy 'type_ocean'
-      character(len=6),parameter :: type_ocean="dummy"
-#endif
-! #endif of #ifdef CPP_EARTH
-
-      include "dimensions.h"
-      include "paramet.h"
-#ifdef CPP_MPI
-      include 'mpif.h'
-#endif      
-
-      integer :: ierr
-      integer :: i
-
-      if (allocated(jj_begin_para)) deallocate(jj_begin_para)
-      if (allocated(jj_end_para))   deallocate(jj_end_para)
-      if (allocated(jj_nb_para))    deallocate(jj_nb_para)
-
-      if (type_ocean == 'couple') then
-#ifdef CPP_COUPLE
-         call prism_terminate_proto(ierr)
-         IF (ierr .ne. PRISM_Ok) THEN
-            call abort_gcm('Finalize_parallel',' Probleme dans prism_terminate_proto ',1)
-         endif
-#endif 
-      else
-#ifdef CPP_MPI
-         IF (using_mpi) call MPI_FINALIZE(ierr)
-#endif
-      end if
-      
-    end subroutine Finalize_parallel
-        
-    subroutine Pack_Data(Field,ij,ll,row,Buffer)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      integer, intent(in) :: ij,ll,row
-      real,dimension(ij,ll),intent(in) ::Field
-      real,dimension(ll*iip1*row), intent(out) :: Buffer 
-            
-      integer :: Pos
-      integer :: i,l
-      
-      Pos=0
-      do l=1,ll
-        do i=1,row*iip1
-          Pos=Pos+1
-          Buffer(Pos)=Field(i,l)
-        enddo
-      enddo
-      
-    end subroutine Pack_data 
-     
-    subroutine Unpack_Data(Field,ij,ll,row,Buffer)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      integer, intent(in) :: ij,ll,row
-      real,dimension(ij,ll),intent(out) ::Field
-      real,dimension(ll*iip1*row), intent(in) :: Buffer 
-            
-      integer :: Pos
-      integer :: i,l
-      
-      Pos=0
-      
-      do l=1,ll
-        do i=1,row*iip1
-          Pos=Pos+1
-          Field(i,l)=Buffer(Pos)
-        enddo
-      enddo
-      
-    end subroutine UnPack_data
-
-    
-    SUBROUTINE barrier
-    IMPLICIT NONE
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-    
-!$OMP CRITICAL (MPI)      
-#ifdef CPP_MPI
-      IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-    
-    END SUBROUTINE barrier
-       
-      
-    subroutine exchange_hallo(Field,ij,ll,up,down)
-    USE Vampir
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: up,down
-      
-      INTEGER :: ierr
-      LOGICAL :: SendUp,SendDown
-      LOGICAL :: RecvUp,RecvDown
-      INTEGER, DIMENSION(4) :: Request
-#ifdef CPP_MPI
-      INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status
-#else
-      INTEGER, DIMENSION(1,4) :: Status
-#endif
-      INTEGER :: NbRequest
-      REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down
-      REAL, dimension(:),allocatable :: Buffer_Recv_up,Buffer_Recv_down
-      INTEGER :: Buffer_size      
-
-      IF (using_mpi) THEN
-
-        CALL barrier
-      
-        call VTb(VThallo)
-      
-        SendUp=.TRUE.
-        SendDown=.TRUE.
-        RecvUp=.TRUE.
-        RecvDown=.TRUE.
-          
-        IF (pole_nord) THEN
-          SendUp=.FALSE.
-          RecvUp=.FALSE.
-        ENDIF
-    
-        IF (pole_sud) THEN
-          SendDown=.FALSE.
-          RecvDown=.FALSE.
-        ENDIF
-        
-        if (up.eq.0) then
-          SendDown=.FALSE.
-          RecvUp=.FALSE.
-        endif
-      
-        if (down.eq.0) then
-          SendUp=.FALSE.
-          RecvDown=.FALSE.
-        endif
-      
-        NbRequest=0
-  
-        IF (SendUp) THEN
-          NbRequest=NbRequest+1
-          buffer_size=down*iip1*ll
-          allocate(Buffer_Send_up(Buffer_size))
-          call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up)
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_ISSEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        ENDIF
-  
-        IF (SendDown) THEN
-          NbRequest=NbRequest+1
-           
-          buffer_size=up*iip1*ll
-          allocate(Buffer_Send_down(Buffer_size))
-          call PACK_Data(Field(ij_end+1-up*iip1,1),ij,ll,up,Buffer_send_down)
-        
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_ISSEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        ENDIF
-    
-  
-        IF (RecvUp) THEN
-          NbRequest=NbRequest+1
-          buffer_size=up*iip1*ll
-          allocate(Buffer_recv_up(Buffer_size))
-              
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1,  &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-     
-       
-        ENDIF
-  
-        IF (RecvDown) THEN
-          NbRequest=NbRequest+1
-          buffer_size=down*iip1*ll
-          allocate(Buffer_recv_down(Buffer_size))
-        
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        
-        ENDIF
-  
-#ifdef CPP_MPI
-        if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr)
-#endif
-        IF (RecvUp)  call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up)
-        IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down)  
-
-        call VTe(VThallo)
-        call barrier
-      
-      ENDIF  ! using_mpi
-      
-      RETURN
-      
-    end subroutine exchange_Hallo
-    
-
-    subroutine Gather_Field(Field,ij,ll,rank)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h" 
-#include "iniprint.h"
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll,rank
-      REAL, dimension(ij,ll) :: Field
-      REAL, dimension(:),allocatable :: Buffer_send   
-      REAL, dimension(:),allocatable :: Buffer_Recv
-      INTEGER, dimension(0:MPI_Size-1) :: Recv_count, displ
-      INTEGER :: ierr
-      INTEGER ::i
-      
-      IF (using_mpi) THEN
-
-        if (ij==ip1jmp1) then 
-           allocate(Buffer_send(iip1*ll*(jj_end-jj_begin+1)))
-           call Pack_Data(Field(ij_begin,1),ij,ll,jj_end-jj_begin+1,Buffer_send)
-        else if (ij==ip1jm) then
-           allocate(Buffer_send(iip1*ll*(min(jj_end,jjm)-jj_begin+1)))
-           call Pack_Data(Field(ij_begin,1),ij,ll,min(jj_end,jjm)-jj_begin+1,Buffer_send)
-        else
-           write(lunout,*)ij  
-        stop 'erreur dans Gather_Field'
-        endif
-        
-        if (MPI_Rank==rank) then
-          allocate(Buffer_Recv(ij*ll))
-
-!CDIR NOVECTOR
-          do i=0,MPI_Size-1
-             
-            if (ij==ip1jmp1) then 
-              Recv_count(i)=(jj_end_para(i)-jj_begin_para(i)+1)*ll*iip1
-            else if (ij==ip1jm) then
-              Recv_count(i)=(min(jj_end_para(i),jjm)-jj_begin_para(i)+1)*ll*iip1
-            else
-              stop 'erreur dans Gather_Field'
-            endif
-                   
-            if (i==0) then 
-              displ(i)=0 
-            else
-              displ(i)=displ(i-1)+Recv_count(i-1)
-            endif
-            
-          enddo
-          
-        else
-          ! Ehouarn: When in debug mode, ifort complains (for call MPI_GATHERV
-          !          below) about Buffer_Recv() being not allocated.
-          !          So make a dummy allocation.
-          allocate(Buffer_Recv(1))
-        endif ! of if (MPI_Rank==rank)
-  
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-        call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8,   &
-                          Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      
-        if (MPI_Rank==rank) then                  
-      
-          if (ij==ip1jmp1) then 
-            do i=0,MPI_Size-1
-              call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                 &
-                               jj_end_para(i)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
-            enddo
-          else if (ij==ip1jm) then
-            do i=0,MPI_Size-1
-               call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                       &
-                               min(jj_end_para(i),jjm)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
-            enddo
-          endif
-        endif 
-      ENDIF ! using_mpi
-      
-    end subroutine Gather_Field
-
-
-    subroutine AllGather_Field(Field,ij,ll)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: ierr
-      
-      IF (using_mpi) THEN
-        call Gather_Field(Field,ij,ll,0)
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-      call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      ENDIF
-      
-    end subroutine AllGather_Field
-    
-   subroutine Broadcast_Field(Field,ij,ll,rank)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: rank
-      INTEGER :: ierr
-      
-      IF (using_mpi) THEN
-      
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-      call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      
-      ENDIF
-    end subroutine Broadcast_Field
-        
-   
-!  Subroutine verif_hallo(Field,ij,ll,up,down)
-!    implicit none
-!#include "dimensions.h"
-!#include "paramet.h"    
-!    include 'mpif.h'
-!    
-!      INTEGER :: ij,ll
-!      REAL, dimension(ij,ll) :: Field
-!      INTEGER :: up,down 
-!      
-!      REAL,dimension(ij,ll): NewField
-!      
-!      NewField=0
-!      
-!      ijb=ij_begin
-!      ije=ij_end
-!      if (pole_nord) 
-!      NewField(ij_be       
-
-  end module parallel
Index: /LMDZ5/trunk/libf/dyn3dmem/parallel_lmdz.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/parallel_lmdz.F90	(revision 1823)
+++ /LMDZ5/trunk/libf/dyn3dmem/parallel_lmdz.F90	(revision 1823)
@@ -0,0 +1,755 @@
+! 
+! $Id$
+!
+  MODULE parallel_lmdz
+  USE mod_const_mpi
+    
+    INTEGER,PARAMETER :: halo_max=3
+    
+    LOGICAL,SAVE :: using_mpi
+    LOGICAL,SAVE :: using_omp
+    
+    integer, save :: mpi_size
+    integer, save :: mpi_rank
+    integer, save :: jj_begin
+    integer, save :: jj_end
+    integer, save :: jj_nb
+    integer, save :: ij_begin
+    integer, save :: ij_end
+    logical, save :: pole_nord
+    logical, save :: pole_sud
+
+    integer,save  :: jjb_u
+    integer,save  :: jje_u
+    integer,save  :: jjnb_u
+    integer,save  :: jjb_v
+    integer,save  :: jje_v
+    integer,save  :: jjnb_v    
+
+    integer,save  :: ijb_u
+    integer,save  :: ije_u
+    integer,save  :: ijnb_u    
+    
+    integer,save  :: ijb_v
+    integer,save  :: ije_v
+    integer,save  :: ijnb_v    
+     
+    
+    integer, allocatable, save, dimension(:) :: jj_begin_para
+    integer, allocatable, save, dimension(:) :: jj_end_para
+    integer, allocatable, save, dimension(:) :: jj_nb_para
+    integer, save :: OMP_CHUNK
+    integer, save :: omp_rank
+    integer, save :: omp_size  
+!$OMP THREADPRIVATE(omp_rank)
+
+    TYPE distrib
+      integer :: jj_begin
+      integer :: jj_end
+      integer :: jj_nb
+      integer :: ij_begin
+      integer :: ij_end
+
+      integer  :: jjb_u
+      integer  :: jje_u
+      integer  :: jjnb_u
+      integer  :: jjb_v
+      integer  :: jje_v
+      integer  :: jjnb_v    
+ 
+      integer  :: ijb_u
+      integer  :: ije_u
+      integer  :: ijnb_u    
+    
+      integer  :: ijb_v
+      integer  :: ije_v
+      integer  :: ijnb_v    
+     
+    
+      integer, pointer :: jj_begin_para(:) => NULL()
+      integer, pointer :: jj_end_para(:) => NULL()
+      integer, pointer :: jj_nb_para(:) => NULL()
+    END TYPE distrib  
+    
+    INTERFACE ASSIGNMENT (=)
+      MODULE PROCEDURE copy_distrib
+    END INTERFACE
+    TYPE(distrib),SAVE :: current_dist
+    
+ contains
+ 
+    subroutine init_parallel
+    USE vampir
+    implicit none
+#ifdef CPP_MPI
+      include 'mpif.h'
+#endif
+#include "dimensions.h"
+#include "paramet.h"
+#include "iniprint.h"
+
+      integer :: ierr
+      integer :: i,j
+      integer :: type_size
+      integer, dimension(3) :: blocklen,type
+      integer :: comp_id
+      character(len=4)  :: num
+      character(len=20) :: filename
+ 
+#ifdef CPP_OMP    
+      INTEGER :: OMP_GET_NUM_THREADS
+      EXTERNAL OMP_GET_NUM_THREADS
+      INTEGER :: OMP_GET_THREAD_NUM
+      EXTERNAL OMP_GET_THREAD_NUM
+#endif  
+
+#ifdef CPP_MPI
+       using_mpi=.TRUE.
+#else
+       using_mpi=.FALSE.
+#endif
+      
+
+#ifdef CPP_OMP
+       using_OMP=.TRUE.
+#else
+       using_OMP=.FALSE.
+#endif
+      
+      call InitVampir
+      
+      IF (using_mpi) THEN
+#ifdef CPP_MPI
+        call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr)
+        call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr)
+#endif
+      ELSE
+        mpi_size=1
+        mpi_rank=0
+      ENDIF
+
+
+! Open text output file with mpi_rank in suffix of file name 
+      IF (lunout /= 5 .and. lunout /= 6) THEN
+         WRITE(num,'(I4.4)') mpi_rank
+         filename='lmdz.out_'//num
+         IF (mpi_rank .NE. 0) THEN
+            OPEN(UNIT=lunout,FILE=TRIM(filename),ACTION='write', &
+               STATUS='unknown',FORM='formatted',IOSTAT=ierr) 
+         ENDIF
+      ENDIF
+
+      
+      allocate(jj_begin_para(0:mpi_size-1))
+      allocate(jj_end_para(0:mpi_size-1))
+      allocate(jj_nb_para(0:mpi_size-1))
+      
+      do i=0,mpi_size-1
+        jj_nb_para(i)=(jjm+1)/mpi_size
+        if ( i < MOD((jjm+1),mpi_size) ) jj_nb_para(i)=jj_nb_para(i)+1
+        
+        if (jj_nb_para(i) <= 2 ) then
+          
+         write(lunout,*)"Arret : le nombre de bande de lattitude par process est trop faible (<2)."
+         write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude"
+          
+#ifdef CPP_MPI
+          IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr)
+#endif          
+        endif
+        
+      enddo
+      
+!      jj_nb_para(0)=11
+!      jj_nb_para(1)=25
+!      jj_nb_para(2)=25
+!      jj_nb_para(3)=12      
+
+      j=1
+      
+      do i=0,mpi_size-1 
+        
+        jj_begin_para(i)=j
+        jj_end_para(i)=j+jj_Nb_para(i)-1
+        j=j+jj_Nb_para(i)
+      
+      enddo
+      
+      jj_begin = jj_begin_para(mpi_rank)
+      jj_end   = jj_end_para(mpi_rank)
+      jj_nb    = jj_nb_para(mpi_rank)
+      
+      ij_begin=(jj_begin-1)*iip1+1
+      ij_end=jj_end*iip1
+      
+      if (mpi_rank.eq.0) then
+        pole_nord=.TRUE.
+      else 
+        pole_nord=.FALSE.
+      endif
+      
+      if (mpi_rank.eq.mpi_size-1) then
+        pole_sud=.TRUE.
+      else 
+        pole_sud=.FALSE.
+      endif
+        
+      write(lunout,*)"init_parallel: jj_begin",jj_begin
+      write(lunout,*)"init_parallel: jj_end",jj_end
+      write(lunout,*)"init_parallel: ij_begin",ij_begin
+      write(lunout,*)"init_parallel: ij_end",ij_end
+      jjb_u=MAX(jj_begin-halo_max,1)
+      jje_u=MIN(jj_end+halo_max,jjp1)
+      jjnb_u=jje_u-jjb_u+1
+
+      jjb_v=MAX(jj_begin-halo_max,1)
+      jje_v=MIN(jj_end+halo_max,jjm)
+      jjnb_v=jje_v-jjb_v+1
+
+      ijb_u=MAX(ij_begin-halo_max*iip1,1)
+      ije_u=MIN(ij_end+halo_max*iip1,ip1jmp1)
+      ijnb_u=ije_u-ijb_u+1
+
+      ijb_v=MAX(ij_begin-halo_max*iip1,1)
+      ije_v=MIN(ij_end+halo_max*iip1,ip1jm)
+      ijnb_v=ije_v-ijb_v+1
+      
+!$OMP PARALLEL
+
+#ifdef CPP_OMP
+!$OMP MASTER
+        omp_size=OMP_GET_NUM_THREADS()
+!$OMP END MASTER
+        omp_rank=OMP_GET_THREAD_NUM()    
+#else    
+        omp_size=1
+        omp_rank=0
+#endif
+!$OMP END PARALLEL         
+      CALL create_distrib(jj_nb_para,current_dist)
+      
+    end subroutine init_parallel
+
+    SUBROUTINE create_distrib(jj_nb_new,d)
+    IMPLICIT NONE
+      INCLUDE "dimensions.h"
+      INCLUDE "paramet.h"
+      
+      INTEGER,INTENT(IN) :: jj_Nb_New(0:MPI_Size-1)
+      TYPE(distrib),INTENT(INOUT) :: d
+      INTEGER :: i  
+  
+      IF (.NOT. ASSOCIATED(d%jj_nb_para)) ALLOCATE(d%jj_nb_para(0:MPI_Size-1))
+      IF (.NOT. ASSOCIATED(d%jj_begin_para)) ALLOCATE(d%jj_begin_para(0:MPI_Size-1))
+      IF (.NOT. ASSOCIATED(d%jj_end_para)) ALLOCATE(d%jj_end_para(0:MPI_Size-1))
+      
+      d%jj_Nb_Para=jj_Nb_New
+      
+      d%jj_begin_para(0)=1
+      d%jj_end_para(0)=d%jj_Nb_Para(0)
+      
+      do i=1,mpi_size-1 
+        
+        d%jj_begin_para(i)=d%jj_end_para(i-1)+1
+        d%jj_end_para(i)=d%jj_begin_para(i)+d%jj_Nb_para(i)-1
+      
+      enddo
+      
+      d%jj_begin = d%jj_begin_para(mpi_rank)
+      d%jj_end   = d%jj_end_para(mpi_rank)
+      d%jj_nb    = d%jj_nb_para(mpi_rank)
+      
+      d%ij_begin=(d%jj_begin-1)*iip1+1
+      d%ij_end=d%jj_end*iip1
+
+      d%jjb_u=MAX(d%jj_begin-halo_max,1)
+      d%jje_u=MIN(d%jj_end+halo_max,jjp1)
+      d%jjnb_u=d%jje_u-d%jjb_u+1
+
+      d%jjb_v=MAX(d%jj_begin-halo_max,1)
+      d%jje_v=MIN(d%jj_end+halo_max,jjm)
+      d%jjnb_v=d%jje_v-d%jjb_v+1
+
+      d%ijb_u=MAX(d%ij_begin-halo_max*iip1,1)
+      d%ije_u=MIN(d%ij_end+halo_max*iip1,ip1jmp1)
+      d%ijnb_u=d%ije_u-d%ijb_u+1
+
+      d%ijb_v=MAX(d%ij_begin-halo_max*iip1,1)
+      d%ije_v=MIN(d%ij_end+halo_max*iip1,ip1jm)
+      d%ijnb_v=d%ije_v-d%ijb_v+1      
+
+    END SUBROUTINE create_distrib
+
+      
+    SUBROUTINE Set_Distrib(d)
+    IMPLICIT NONE
+
+    INCLUDE "dimensions.h"
+    INCLUDE "paramet.h"
+    TYPE(distrib),INTENT(IN) :: d
+
+      jj_begin = d%jj_begin
+      jj_end = d%jj_end
+      jj_nb = d%jj_nb
+      ij_begin = d%ij_begin
+      ij_end = d%ij_end
+
+      jjb_u = d%jjb_u
+      jje_u = d%jje_u
+      jjnb_u = d%jjnb_u
+      jjb_v = d%jjb_v
+      jje_v = d%jje_v
+      jjnb_v = d%jjnb_v
+ 
+      ijb_u = d%ijb_u
+      ije_u = d%ije_u
+      ijnb_u = d%ijnb_u
+    
+      ijb_v = d%ijb_v
+      ije_v = d%ije_v
+      ijnb_v = d%ijnb_v
+     
+    
+      jj_begin_para(:) = d%jj_begin_para(:)
+      jj_end_para(:) = d%jj_end_para(:)
+      jj_nb_para(:) = d%jj_nb_para(:)
+      current_dist=d 
+
+    END SUBROUTINE Set_Distrib
+
+    SUBROUTINE copy_distrib(dist,new_dist)
+    IMPLICIT NONE
+
+    INCLUDE "dimensions.h"
+    INCLUDE "paramet.h"
+    TYPE(distrib),INTENT(INOUT) :: dist
+    TYPE(distrib),INTENT(IN) :: new_dist
+
+     dist%jj_begin = new_dist%jj_begin
+     dist%jj_end = new_dist%jj_end
+     dist%jj_nb = new_dist%jj_nb
+     dist%ij_begin = new_dist%ij_begin
+     dist%ij_end = new_dist%ij_end
+
+     dist%jjb_u = new_dist%jjb_u
+     dist%jje_u = new_dist%jje_u
+     dist%jjnb_u = new_dist%jjnb_u
+     dist%jjb_v = new_dist%jjb_v
+     dist%jje_v = new_dist%jje_v
+     dist%jjnb_v = new_dist%jjnb_v
+   
+     dist%ijb_u = new_dist%ijb_u
+     dist%ije_u = new_dist%ije_u
+     dist%ijnb_u = new_dist%ijnb_u
+     
+     dist%ijb_v = new_dist%ijb_v
+     dist%ije_v = new_dist%ije_v
+     dist%ijnb_v = new_dist%ijnb_v
+         
+     
+     dist%jj_begin_para(:) = new_dist%jj_begin_para(:)
+     dist%jj_end_para(:) = new_dist%jj_end_para(:)
+     dist%jj_nb_para(:) = new_dist%jj_nb_para(:)
+ 
+    END SUBROUTINE copy_distrib
+    
+    
+    SUBROUTINE get_current_distrib(d)
+    IMPLICIT NONE
+
+    INCLUDE "dimensions.h"
+    INCLUDE "paramet.h"
+    TYPE(distrib),INTENT(OUT) :: d
+
+     d=current_dist
+
+    END SUBROUTINE get_current_distrib
+    
+    subroutine Finalize_parallel
+#ifdef CPP_COUPLE
+    use mod_prism_proto
+! Ehouarn: surface_data module is in 'phylmd' ...
+      use surface_data, only : type_ocean
+      implicit none
+#else
+      implicit none
+! without the surface_data module, we declare (and set) a dummy 'type_ocean'
+      character(len=6),parameter :: type_ocean="dummy"
+#endif
+! #endif of #ifdef CPP_EARTH
+
+      include "dimensions.h"
+      include "paramet.h"
+#ifdef CPP_MPI
+      include 'mpif.h'
+#endif      
+
+      integer :: ierr
+      integer :: i
+
+      if (allocated(jj_begin_para)) deallocate(jj_begin_para)
+      if (allocated(jj_end_para))   deallocate(jj_end_para)
+      if (allocated(jj_nb_para))    deallocate(jj_nb_para)
+
+      if (type_ocean == 'couple') then
+#ifdef CPP_COUPLE
+         call prism_terminate_proto(ierr)
+         IF (ierr .ne. PRISM_Ok) THEN
+            call abort_gcm('Finalize_parallel',' Probleme dans prism_terminate_proto ',1)
+         endif
+#endif 
+      else
+#ifdef CPP_MPI
+         IF (using_mpi) call MPI_FINALIZE(ierr)
+#endif
+      end if
+      
+    end subroutine Finalize_parallel
+        
+    subroutine Pack_Data(Field,ij,ll,row,Buffer)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      integer, intent(in) :: ij,ll,row
+      real,dimension(ij,ll),intent(in) ::Field
+      real,dimension(ll*iip1*row), intent(out) :: Buffer 
+            
+      integer :: Pos
+      integer :: i,l
+      
+      Pos=0
+      do l=1,ll
+        do i=1,row*iip1
+          Pos=Pos+1
+          Buffer(Pos)=Field(i,l)
+        enddo
+      enddo
+      
+    end subroutine Pack_data 
+     
+    subroutine Unpack_Data(Field,ij,ll,row,Buffer)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      integer, intent(in) :: ij,ll,row
+      real,dimension(ij,ll),intent(out) ::Field
+      real,dimension(ll*iip1*row), intent(in) :: Buffer 
+            
+      integer :: Pos
+      integer :: i,l
+      
+      Pos=0
+      
+      do l=1,ll
+        do i=1,row*iip1
+          Pos=Pos+1
+          Field(i,l)=Buffer(Pos)
+        enddo
+      enddo
+      
+    end subroutine UnPack_data
+
+    
+    SUBROUTINE barrier
+    IMPLICIT NONE
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+    
+!$OMP CRITICAL (MPI)      
+#ifdef CPP_MPI
+      IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+    
+    END SUBROUTINE barrier
+       
+      
+    subroutine exchange_hallo(Field,ij,ll,up,down)
+    USE Vampir
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: up,down
+      
+      INTEGER :: ierr
+      LOGICAL :: SendUp,SendDown
+      LOGICAL :: RecvUp,RecvDown
+      INTEGER, DIMENSION(4) :: Request
+#ifdef CPP_MPI
+      INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status
+#else
+      INTEGER, DIMENSION(1,4) :: Status
+#endif
+      INTEGER :: NbRequest
+      REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down
+      REAL, dimension(:),allocatable :: Buffer_Recv_up,Buffer_Recv_down
+      INTEGER :: Buffer_size      
+
+      IF (using_mpi) THEN
+
+        CALL barrier
+      
+        call VTb(VThallo)
+      
+        SendUp=.TRUE.
+        SendDown=.TRUE.
+        RecvUp=.TRUE.
+        RecvDown=.TRUE.
+          
+        IF (pole_nord) THEN
+          SendUp=.FALSE.
+          RecvUp=.FALSE.
+        ENDIF
+    
+        IF (pole_sud) THEN
+          SendDown=.FALSE.
+          RecvDown=.FALSE.
+        ENDIF
+        
+        if (up.eq.0) then
+          SendDown=.FALSE.
+          RecvUp=.FALSE.
+        endif
+      
+        if (down.eq.0) then
+          SendUp=.FALSE.
+          RecvDown=.FALSE.
+        endif
+      
+        NbRequest=0
+  
+        IF (SendUp) THEN
+          NbRequest=NbRequest+1
+          buffer_size=down*iip1*ll
+          allocate(Buffer_Send_up(Buffer_size))
+          call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up)
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_ISSEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        ENDIF
+  
+        IF (SendDown) THEN
+          NbRequest=NbRequest+1
+           
+          buffer_size=up*iip1*ll
+          allocate(Buffer_Send_down(Buffer_size))
+          call PACK_Data(Field(ij_end+1-up*iip1,1),ij,ll,up,Buffer_send_down)
+        
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_ISSEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        ENDIF
+    
+  
+        IF (RecvUp) THEN
+          NbRequest=NbRequest+1
+          buffer_size=up*iip1*ll
+          allocate(Buffer_recv_up(Buffer_size))
+              
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1,  &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+     
+       
+        ENDIF
+  
+        IF (RecvDown) THEN
+          NbRequest=NbRequest+1
+          buffer_size=down*iip1*ll
+          allocate(Buffer_recv_down(Buffer_size))
+        
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        
+        ENDIF
+  
+#ifdef CPP_MPI
+        if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr)
+#endif
+        IF (RecvUp)  call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up)
+        IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down)  
+
+        call VTe(VThallo)
+        call barrier
+      
+      ENDIF  ! using_mpi
+      
+      RETURN
+      
+    end subroutine exchange_Hallo
+    
+
+    subroutine Gather_Field(Field,ij,ll,rank)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h" 
+#include "iniprint.h"
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll,rank
+      REAL, dimension(ij,ll) :: Field
+      REAL, dimension(:),allocatable :: Buffer_send   
+      REAL, dimension(:),allocatable :: Buffer_Recv
+      INTEGER, dimension(0:MPI_Size-1) :: Recv_count, displ
+      INTEGER :: ierr
+      INTEGER ::i
+      
+      IF (using_mpi) THEN
+
+        if (ij==ip1jmp1) then 
+           allocate(Buffer_send(iip1*ll*(jj_end-jj_begin+1)))
+           call Pack_Data(Field(ij_begin,1),ij,ll,jj_end-jj_begin+1,Buffer_send)
+        else if (ij==ip1jm) then
+           allocate(Buffer_send(iip1*ll*(min(jj_end,jjm)-jj_begin+1)))
+           call Pack_Data(Field(ij_begin,1),ij,ll,min(jj_end,jjm)-jj_begin+1,Buffer_send)
+        else
+           write(lunout,*)ij  
+        stop 'erreur dans Gather_Field'
+        endif
+        
+        if (MPI_Rank==rank) then
+          allocate(Buffer_Recv(ij*ll))
+
+!CDIR NOVECTOR
+          do i=0,MPI_Size-1
+             
+            if (ij==ip1jmp1) then 
+              Recv_count(i)=(jj_end_para(i)-jj_begin_para(i)+1)*ll*iip1
+            else if (ij==ip1jm) then
+              Recv_count(i)=(min(jj_end_para(i),jjm)-jj_begin_para(i)+1)*ll*iip1
+            else
+              stop 'erreur dans Gather_Field'
+            endif
+                   
+            if (i==0) then 
+              displ(i)=0 
+            else
+              displ(i)=displ(i-1)+Recv_count(i-1)
+            endif
+            
+          enddo
+          
+        else
+          ! Ehouarn: When in debug mode, ifort complains (for call MPI_GATHERV
+          !          below) about Buffer_Recv() being not allocated.
+          !          So make a dummy allocation.
+          allocate(Buffer_Recv(1))
+        endif ! of if (MPI_Rank==rank)
+  
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+        call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8,   &
+                          Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      
+        if (MPI_Rank==rank) then                  
+      
+          if (ij==ip1jmp1) then 
+            do i=0,MPI_Size-1
+              call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                 &
+                               jj_end_para(i)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
+            enddo
+          else if (ij==ip1jm) then
+            do i=0,MPI_Size-1
+               call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                       &
+                               min(jj_end_para(i),jjm)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
+            enddo
+          endif
+        endif 
+      ENDIF ! using_mpi
+      
+    end subroutine Gather_Field
+
+
+    subroutine AllGather_Field(Field,ij,ll)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: ierr
+      
+      IF (using_mpi) THEN
+        call Gather_Field(Field,ij,ll,0)
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+      call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      ENDIF
+      
+    end subroutine AllGather_Field
+    
+   subroutine Broadcast_Field(Field,ij,ll,rank)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: rank
+      INTEGER :: ierr
+      
+      IF (using_mpi) THEN
+      
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+      call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      
+      ENDIF
+    end subroutine Broadcast_Field
+        
+   
+!  Subroutine verif_hallo(Field,ij,ll,up,down)
+!    implicit none
+!#include "dimensions.h"
+!#include "paramet.h"    
+!    include 'mpif.h'
+!    
+!      INTEGER :: ij,ll
+!      REAL, dimension(ij,ll) :: Field
+!      INTEGER :: up,down 
+!      
+!      REAL,dimension(ij,ll): NewField
+!      
+!      NewField=0
+!      
+!      ijb=ij_begin
+!      ije=ij_end
+!      if (pole_nord) 
+!      NewField(ij_be       
+
+  end MODULE parallel_lmdz
Index: /LMDZ5/trunk/libf/dyn3dmem/pression_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/pression_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/pression_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE pression_loc( ngrid, ap, bp, ps, p )
-      USE parallel
+      USE parallel_lmdz
 c
 
Index: /LMDZ5/trunk/libf/dyn3dmem/qminimum_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/qminimum_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/qminimum_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE qminimum_loc( q,nq,deltap )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT none
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/rotat_nfil_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/rotat_nfil_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/rotat_nfil_loc.F	(revision 1823)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/rotat_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/rotat_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/rotat_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/rotatf_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/rotatf_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/rotatf_loc.F	(revision 1823)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/sw_case_williamson91_6_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/sw_case_williamson91_6_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/sw_case_williamson91_6_loc.F	(revision 1823)
@@ -26,5 +26,5 @@
 c
 c=======================================================================
-      USE parallel
+      USE parallel_lmdz
 
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/times.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/times.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/times.F90	(revision 1823)
@@ -25,5 +25,5 @@
   
   subroutine init_timer
-    use parallel
+    USE parallel_lmdz
     implicit none
 #include "dimensions.h"
@@ -101,5 +101,5 @@
 
   subroutine stop_timer(no_timer)
-    use parallel
+    USE parallel_lmdz
     implicit none
     integer :: no_timer
@@ -136,5 +136,5 @@
    
   subroutine allgather_timer
-    use parallel
+    USE parallel_lmdz
     implicit none
 #ifdef CPP_MPI    
@@ -171,5 +171,5 @@
   
   subroutine allgather_timer_average
-    use parallel
+    USE parallel_lmdz
     implicit none
 #ifdef CPP_MPI
Index: /LMDZ5/trunk/libf/dyn3dmem/top_bound_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/top_bound_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/top_bound_loc.F	(revision 1823)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE top_bound_loc(vcov,ucov,teta,masse,dt)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/tourpot_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/tourpot_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/tourpot_loc.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE tourpot_loc ( vcov, ucov, massebxy, vorpot )
-      USE parallel
+      USE parallel_lmdz
       USE mod_filtreg_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/vitvert_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/vitvert_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/vitvert_loc.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE vitvert_loc ( convm , w )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dmem/vlsplt_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/vlsplt_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/vlsplt_loc.F	(revision 1823)
@@ -13,5 +13,5 @@
 c
 c   --------------------------------------------------------------------
-      USE Parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -348,5 +348,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -737,5 +737,5 @@
 c
 c   --------------------------------------------------------------------
-      USE Parallel
+      USE parallel_lmdz
       USE vlz_mod
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/vlspltgen_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/vlspltgen_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/vlspltgen_loc.F	(revision 1823)
@@ -23,5 +23,5 @@
 c     pk exner au milieu des couches necessaire pour calculer Qsat
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE Write_Field_loc
Index: /LMDZ5/trunk/libf/dyn3dmem/vlspltgen_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/vlspltgen_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/vlspltgen_mod.F90	(revision 1823)
@@ -13,5 +13,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE infotrac
   USE vlz_mod,ONLY : vlz_allocate 
@@ -36,5 +36,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   USE vlz_mod,ONLY : vlz_switch_vanleer 
   IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dmem/vlspltqs_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/vlspltqs_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/vlspltqs_loc.F	(revision 1823)
@@ -8,5 +8,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -360,5 +360,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dmem/vlz_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/vlz_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/vlz_mod.F90	(revision 1823)
@@ -11,5 +11,5 @@
   USE bands
   USE allocate_field_mod
-  USE parallel
+  USE parallel_lmdz
   USE infotrac
   USE dimensions_mod
@@ -28,5 +28,5 @@
   USE allocate_field_mod
   USE bands
-  USE parallel
+  USE parallel_lmdz
   IMPLICIT NONE
     TYPE(distrib),INTENT(IN) :: dist
Index: /LMDZ5/trunk/libf/dyn3dmem/write_field_loc.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/write_field_loc.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/write_field_loc.F90	(revision 1823)
@@ -34,5 +34,5 @@
 
    SUBROUTINE write_field_u_gen(name,Field,ll)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     USE mod_hallo
@@ -98,5 +98,5 @@
 
    SUBROUTINE write_field_v_gen(name,Field,ll)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dmem/write_field_p.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/write_field_p.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/write_field_p.F90	(revision 1823)
@@ -9,5 +9,5 @@
   
   subroutine write_field1D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
@@ -30,5 +30,5 @@
 
   subroutine write_field2D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
@@ -51,5 +51,5 @@
   
   subroutine write_field3D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
Index: /LMDZ5/trunk/libf/dyn3dmem/writedynav_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/writedynav_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/writedynav_loc.F	(revision 1823)
@@ -9,5 +9,5 @@
       USE ioipsl
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE misc_mod
       USE infotrac, ONLY : nqtot, ttext
Index: /LMDZ5/trunk/libf/dyn3dmem/writehist_loc.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dmem/writehist_loc.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dmem/writehist_loc.F	(revision 1823)
@@ -9,5 +9,5 @@
       USE ioipsl
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE misc_mod
       USE infotrac, ONLY : nqtot, ttext
Index: /LMDZ5/trunk/libf/dyn3dpar/abort_gcm.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/abort_gcm.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/abort_gcm.F	(revision 1823)
@@ -12,5 +12,5 @@
       USE ioipsl_getincom
 #endif
-      USE parallel
+      USE parallel_lmdz
 #include "iniprint.h"
  
Index: /LMDZ5/trunk/libf/dyn3dpar/addfi_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/addfi_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/addfi_p.F	(revision 1823)
@@ -5,5 +5,5 @@
      S          pucov, pvcov, pteta, pq   , pps ,
      S          pdufi, pdvfi, pdhfi,pdqfi, pdpfi  )
-      USE parallel
+      USE parallel_lmdz
       USE infotrac, ONLY : nqtot
       USE control_mod, ONLY : planet_type
Index: /LMDZ5/trunk/libf/dyn3dpar/advect_new_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/advect_new_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/advect_new_p.F	(revision 1823)
@@ -4,5 +4,5 @@
       SUBROUTINE advect_new_p(ucov,vcov,teta,w,massebx,masseby,
      &                        du,dv,dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/advect_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/advect_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/advect_p.F	(revision 1823)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE advect_p(ucov,vcov,teta,w,massebx,masseby,du,dv,dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/advtrac_p.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/advtrac_p.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/advtrac_p.F90	(revision 1823)
@@ -10,5 +10,5 @@
   !            M.A Filiberti (04/2002)
   !
-  USE parallel
+  USE parallel_lmdz
   USE Write_Field_p
   USE Bands
Index: /LMDZ5/trunk/libf/dyn3dpar/bands.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/bands.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/bands.F90	(revision 1823)
@@ -19,5 +19,5 @@
   
   subroutine AllocateBands
-    use parallel
+    USE parallel_lmdz
     implicit none
     
@@ -33,5 +33,5 @@
   
   subroutine Read_distrib
-    use parallel
+    USE parallel_lmdz
     implicit none
 
@@ -92,5 +92,5 @@
    
    SUBROUTINE  Set_Bands 
-     USE parallel
+     USE parallel_lmdz
 #ifdef CPP_PHYS
 ! Ehouarn: what follows is only related to // physics
@@ -134,5 +134,5 @@
     subroutine AdjustBands_caldyn
       use times
-      use parallel
+      USE parallel_lmdz
       implicit none
 
@@ -199,5 +199,5 @@
     subroutine AdjustBands_vanleer
       use times
-      use parallel
+      USE parallel_lmdz
       implicit none
 
@@ -265,5 +265,5 @@
     subroutine AdjustBands_dissip
       use times
-      use parallel
+      USE parallel_lmdz
       implicit none
 
@@ -335,5 +335,5 @@
       USE mod_phys_lmdz_para, only : klon_mpi_para_nb
 #endif
-      USE parallel
+      USE parallel_lmdz
       implicit none
 
@@ -385,5 +385,5 @@
 
     subroutine WriteBands
-    USE parallel
+    USE parallel_lmdz
     implicit none
     include "dimensions.h"
Index: /LMDZ5/trunk/libf/dyn3dpar/bernoui_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/bernoui_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/bernoui_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE bernoui_p (ngrid,nlay,pphi,pecin,pbern)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/bilan_dyn_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/bilan_dyn_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/bilan_dyn_p.F	(revision 1823)
@@ -13,5 +13,5 @@
       USE IOIPSL
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dpar/caladvtrac_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/caladvtrac_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/caladvtrac_p.F	(revision 1823)
@@ -7,5 +7,5 @@
      *                   p ,masse, dq ,  teta,
      *                   flxw, pk, iapptrac)
-      USE parallel
+      USE parallel_lmdz
       USE infotrac, ONLY : nqtot
       USE control_mod, ONLY : iapp_tracvl,planet_type
Index: /LMDZ5/trunk/libf/dyn3dpar/caldyn_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/caldyn_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/caldyn_p.F	(revision 1823)
@@ -10,5 +10,5 @@
      $ (itau,ucov,vcov,teta,ps,masse,pk,pkf,phis ,
      $  phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time )
-      USE parallel
+      USE parallel_lmdz
       USE Write_Field_p
       
Index: /LMDZ5/trunk/libf/dyn3dpar/calfis_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/calfis_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/calfis_p.F	(revision 1823)
@@ -34,5 +34,5 @@
       USE IOPHY
 #endif
-      USE parallel, ONLY : omp_chunk, using_mpi
+      USE parallel_lmdz, ONLY : omp_chunk, using_mpi
       USE Write_Field
       Use Write_field_p
Index: /LMDZ5/trunk/libf/dyn3dpar/ce0l.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/ce0l.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/ce0l.F90	(revision 1823)
@@ -22,5 +22,5 @@
   USE mod_const_mpi
   USE infotrac
-  USE parallel, ONLY: finalize_parallel
+  USE parallel_lmdz
   USE indice_sol_mod
 
Index: /LMDZ5/trunk/libf/dyn3dpar/conf_gcm.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/conf_gcm.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/conf_gcm.F	(revision 1823)
@@ -16,5 +16,5 @@
       use mod_filtre_fft, ONLY : use_filtre_fft
       use mod_hallo, ONLY : use_mpi_alloc
-      use parallel, ONLY : omp_chunk
+      USE parallel_lmdz, ONLY : omp_chunk
       USE infotrac, ONLY : type_trac
       use assert_m, only: assert
Index: /LMDZ5/trunk/libf/dyn3dpar/convflu_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/convflu_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/convflu_p.F	(revision 1823)
@@ -15,5 +15,5 @@
 c     nbniv   est le nombre de niveaux vert. de  xflu et de yflu .
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/convmas1_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/convmas1_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/convmas1_p.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas1_p (pbaru, pbarv, convm )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/convmas2_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/convmas2_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/convmas2_p.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas2_p ( convm )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/convmas_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/convmas_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/convmas_p.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas_p (pbaru, pbarv, convm )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/covcont_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/covcont_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/covcont_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE covcont_p (klevel,ucov, vcov, ucont, vcont )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/covnat_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/covnat_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/covnat_p.F	(revision 1823)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE covnat_p(klevel,ucov, vcov, unat, vnat )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/dissip_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/dissip_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/dissip_p.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE dissip_p( vcov,ucov,teta,p, dv,du,dh )
 c
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/diverg_gam_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/diverg_gam_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/diverg_gam_p.F	(revision 1823)
@@ -9,5 +9,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/diverg_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/diverg_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/diverg_p.F	(revision 1823)
@@ -8,5 +8,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/divergf_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/divergf_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/divergf_p.F	(revision 1823)
@@ -8,5 +8,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE PARALLEL
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/divgrad2_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/divgrad2_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/divgrad2_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c         divgra     est  un argument  de sortie pour le s-prg
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dpar/divgrad_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/divgrad_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/divgrad_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE divgrad_p (klevel,h, lh, divgra_out )
-      USE parallel
+      USE parallel_lmdz
       USE times
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/dteta1_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/dteta1_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/dteta1_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE dteta1_p ( teta, pbaru, pbarv, dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/dudv1_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/dudv1_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/dudv1_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE dudv1_p ( vorpot, pbaru, pbarv, du, dv )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/dudv2_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/dudv2_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/dudv2_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE dudv2_p ( teta, pkf, bern, du, dv  )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/dynredem_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/dynredem_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/dynredem_p.F	(revision 1823)
@@ -7,5 +7,5 @@
       USE IOIPSL
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE infotrac
       use netcdf95, only: NF95_PUT_VAR
@@ -467,5 +467,5 @@
       SUBROUTINE dynredem1_p(fichnom,time,
      .                     vcov,ucov,teta,q,masse,ps)
-      USE parallel
+      USE parallel_lmdz
       USE infotrac
       USE control_mod
Index: /LMDZ5/trunk/libf/dyn3dpar/enercin_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/enercin_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/enercin_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE enercin_p ( vcov, ucov, vcont, ucont, ecin )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/exner_hyb_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/exner_hyb_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/exner_hyb_p.F	(revision 1823)
@@ -29,5 +29,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/exner_milieu_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/exner_milieu_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/exner_milieu_p.F	(revision 1823)
@@ -26,5 +26,5 @@
 c    ( voir note de Fr.Hourdin )  ,
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/filtreg_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/filtreg_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/filtreg_p.F	(revision 1823)
@@ -3,5 +3,5 @@
       SUBROUTINE filtreg_p ( champ, ibeg, iend, nlat, nbniv, 
      &     ifiltre, iaire, griscal ,iter)
-      USE Parallel, only : OMP_CHUNK
+      USE parallel_lmdz, only : OMP_CHUNK
       USE mod_filtre_fft
       USE timer_filtre
Index: /LMDZ5/trunk/libf/dyn3dpar/flumass_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/flumass_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/flumass_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE flumass_p(massebx,masseby, vcont, ucont, pbaru, pbarv)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/fluxstokenc_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/fluxstokenc_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/fluxstokenc_p.F	(revision 1823)
@@ -8,5 +8,5 @@
 
        USE IOIPSL
-       USE parallel
+       USE parallel_lmdz
        USE misc_mod
        USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dpar/friction_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/friction_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/friction_p.F	(revision 1823)
@@ -4,5 +4,5 @@
 c=======================================================================
       SUBROUTINE friction_p(ucov,vcov,pdt)
-      USE parallel
+      USE parallel_lmdz
       USE control_mod
 #ifdef CPP_IOIPSL
Index: /LMDZ5/trunk/libf/dyn3dpar/gcm.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/gcm.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/gcm.F	(revision 1823)
@@ -11,5 +11,5 @@
 
       USE mod_const_mpi, ONLY: init_const_mpi
-      USE parallel
+      USE parallel_lmdz
       USE infotrac
       USE mod_interface_dyn_phys
Index: /LMDZ5/trunk/libf/dyn3dpar/geopot_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/geopot_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/geopot_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE geopot_p ( ngrid, teta, pk, pks, phis, phi )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
       
Index: /LMDZ5/trunk/libf/dyn3dpar/getparam.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/getparam.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/getparam.F90	(revision 1823)
@@ -18,5 +18,5 @@
 CONTAINS
   SUBROUTINE ini_getparam(fichier)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -28,5 +28,5 @@
 
   SUBROUTINE fin_getparam
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -37,5 +37,5 @@
 
   SUBROUTINE getparamr(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -63,5 +63,5 @@
 
   SUBROUTINE getparami(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -90,5 +90,5 @@
 
   SUBROUTINE getparaml(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/gr_dyn_fi_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/gr_dyn_fi_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/gr_dyn_fi_p.F	(revision 1823)
@@ -7,5 +7,5 @@
       USE mod_interface_dyn_phys
       USE dimphy
-      USE PARALLEL
+      USE parallel_lmdz
       IMPLICIT NONE
 c=======================================================================
Index: /LMDZ5/trunk/libf/dyn3dpar/gr_fi_dyn_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/gr_fi_dyn_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/gr_fi_dyn_p.F	(revision 1823)
@@ -7,5 +7,5 @@
       USE mod_interface_dyn_phys
       USE dimphy
-      use parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c=======================================================================
Index: /LMDZ5/trunk/libf/dyn3dpar/gr_u_scal_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/gr_u_scal_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/gr_u_scal_p.F	(revision 1823)
@@ -25,5 +25,5 @@
 c
 c=======================================================================
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c-----------------------------------------------------------------------
Index: /LMDZ5/trunk/libf/dyn3dpar/gr_v_scal_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/gr_v_scal_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/gr_v_scal_p.F	(revision 1823)
@@ -25,5 +25,5 @@
 c
 c=======================================================================
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c-----------------------------------------------------------------------
Index: /LMDZ5/trunk/libf/dyn3dpar/grad_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/grad_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/grad_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c       pgx  et  pgy    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/gradiv2_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/gradiv2_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/gradiv2_p.F	(revision 1823)
@@ -13,5 +13,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE Write_field_p
Index: /LMDZ5/trunk/libf/dyn3dpar/gradiv_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/gradiv_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/gradiv_p.F	(revision 1823)
@@ -14,5 +14,5 @@
 c
 c     
-      USE parallel
+      USE parallel_lmdz
       USE times
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/groupe_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/groupe_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/groupe_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       subroutine groupe_p(pext,pbaru,pbarv,pbarum,pbarvm,wm)
-      USE parallel
+      USE parallel_lmdz
       implicit none
 
Index: /LMDZ5/trunk/libf/dyn3dpar/groupeun_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/groupeun_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/groupeun_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE groupeun_p(jjmax,llmax,jjb,jje,q)
-      USE parallel
+      USE parallel_lmdz
       USE Write_Field_p
       IMPLICIT NONE
@@ -135,5 +135,5 @@
       SUBROUTINE INIT_GROUPEUN_P(airen_tab, aires_tab)
 
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/guide_p_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/guide_p_mod.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/guide_p_mod.F90	(revision 1823)
@@ -292,5 +292,5 @@
 !=======================================================================
   SUBROUTINE guide_main(itau,ucov,vcov,teta,q,masse,ps)
-    use parallel
+    USE parallel_lmdz
     USE control_mod
     
@@ -653,5 +653,5 @@
 !=======================================================================
   SUBROUTINE guide_interp(psi,teta)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE Bands
@@ -1636,5 +1636,5 @@
 !=======================================================================
   SUBROUTINE guide_out(varname,hsize,vsize,field,factt)
-    USE parallel
+    USE parallel_lmdz
     IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/initdynav_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/initdynav_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/initdynav_p.F	(revision 1823)
@@ -8,5 +8,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       USE parallel_lmdz
        use Write_field
        use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dpar/initfluxsto_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/initfluxsto_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/initfluxsto_p.F	(revision 1823)
@@ -10,5 +10,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       USE parallel_lmdz
        use Write_field
        use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dpar/inithist_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/inithist_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/inithist_p.F	(revision 1823)
@@ -9,5 +9,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       USE parallel_lmdz
        use Write_field
        use misc_mod
Index: /LMDZ5/trunk/libf/dyn3dpar/integrd_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/integrd_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/integrd_p.F	(revision 1823)
@@ -5,5 +5,5 @@
      $  (  nq,vcovm1,ucovm1,tetam1,psm1,massem1,
      $     dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps0,masse,phis) !,finvmaold)
-      USE parallel
+      USE parallel_lmdz
       USE control_mod, only : planet_type
       IMPLICIT NONE
Index: /LMDZ5/trunk/libf/dyn3dpar/laplacien_gam_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/laplacien_gam_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/laplacien_gam_p.F	(revision 1823)
@@ -11,5 +11,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/laplacien_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/laplacien_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/laplacien_p.F	(revision 1823)
@@ -9,5 +9,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/laplacien_rot_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/laplacien_rot_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/laplacien_rot_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c      rotout           est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/laplacien_rotgam_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/laplacien_rotgam_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/laplacien_rotgam_p.F	(revision 1823)
@@ -9,5 +9,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/leapfrog_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/leapfrog_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/leapfrog_p.F	(revision 1823)
@@ -9,5 +9,5 @@
 
        USE misc_mod
-       USE parallel
+       USE parallel_lmdz
        USE times
        USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dpar/massbar_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/massbar_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/massbar_p.F	(revision 1823)
@@ -13,5 +13,5 @@
 c     
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/massbarxy_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/massbarxy_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/massbarxy_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE massbarxy_p(  masse, massebxy )
-      USE parallel
+      USE parallel_lmdz
       implicit none
 c **********************************************************************
Index: /LMDZ5/trunk/libf/dyn3dpar/massdair_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/massdair_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/massdair_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE massdair_p( p, masse )
-      USE parallel
+      USE parallel_lmdz
 c
 c *********************************************************************
Index: /LMDZ5/trunk/libf/dyn3dpar/mod_hallo.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/mod_hallo.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/mod_hallo.F90	(revision 1823)
@@ -1,4 +1,4 @@
 module mod_Hallo
-USE parallel
+USE parallel_lmdz
 implicit none
   logical,save :: use_mpi_alloc
Index: /LMDZ5/trunk/libf/dyn3dpar/nxgrad_gam_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/nxgrad_gam_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/nxgrad_gam_p.F	(revision 1823)
@@ -9,5 +9,5 @@
 c       x  et y    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/nxgrad_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/nxgrad_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/nxgrad_p.F	(revision 1823)
@@ -9,5 +9,5 @@
 c       x  et y    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/nxgraro2_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/nxgraro2_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/nxgraro2_p.F	(revision 1823)
@@ -13,5 +13,5 @@
 c
       USE write_Field_p
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE mod_hallo
Index: /LMDZ5/trunk/libf/dyn3dpar/nxgrarot_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/nxgrarot_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/nxgrarot_p.F	(revision 1823)
@@ -13,5 +13,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE write_field_p
Index: DZ5/trunk/libf/dyn3dpar/parallel.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/parallel.F90	(revision 1822)
+++ 	(revision )
@@ -1,587 +1,0 @@
-! 
-! $Id$
-!
-  module parallel
-  USE mod_const_mpi
-    
-    LOGICAL,SAVE :: using_mpi=.TRUE.
-    LOGICAL,SAVE :: using_omp
-    
-    integer, save :: mpi_size
-    integer, save :: mpi_rank
-    integer, save :: jj_begin
-    integer, save :: jj_end
-    integer, save :: jj_nb
-    integer, save :: ij_begin
-    integer, save :: ij_end
-    logical, save :: pole_nord
-    logical, save :: pole_sud
-    
-    integer, allocatable, save, dimension(:) :: jj_begin_para
-    integer, allocatable, save, dimension(:) :: jj_end_para
-    integer, allocatable, save, dimension(:) :: jj_nb_para
-    integer, save :: OMP_CHUNK
-    integer, save :: omp_rank
-    integer, save :: omp_size  
-!$OMP THREADPRIVATE(omp_rank)
-
- contains
- 
-    subroutine init_parallel
-    USE vampir
-    implicit none
-#ifdef CPP_MPI
-      include 'mpif.h'
-#endif
-#include "dimensions.h"
-#include "paramet.h"
-#include "iniprint.h"
-
-      integer :: ierr
-      integer :: i,j
-      integer :: type_size
-      integer, dimension(3) :: blocklen,type
-      integer :: comp_id
-      character(len=4)  :: num
-      character(len=20) :: filename
- 
-#ifdef CPP_OMP    
-      INTEGER :: OMP_GET_NUM_THREADS
-      EXTERNAL OMP_GET_NUM_THREADS
-      INTEGER :: OMP_GET_THREAD_NUM
-      EXTERNAL OMP_GET_THREAD_NUM
-#endif  
-
-#ifdef CPP_MPI
-       using_mpi=.TRUE.
-#else
-       using_mpi=.FALSE.
-#endif
-      
-
-#ifdef CPP_OMP
-       using_OMP=.TRUE.
-#else
-       using_OMP=.FALSE.
-#endif
-      
-      call InitVampir
-      
-      IF (using_mpi) THEN
-#ifdef CPP_MPI
-        call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr)
-        call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr)
-#endif
-      ELSE
-        mpi_size=1
-        mpi_rank=0
-      ENDIF
-
-
-! Open text output file with mpi_rank in suffix of file name 
-      IF (lunout /= 5 .and. lunout /= 6) THEN
-         WRITE(num,'(I4.4)') mpi_rank
-         filename='lmdz.out_'//num
-         IF (mpi_rank .NE. 0) THEN
-            OPEN(UNIT=lunout,FILE=TRIM(filename),ACTION='write', &
-               STATUS='unknown',FORM='formatted',IOSTAT=ierr) 
-         ENDIF
-      ENDIF
-
-      
-      allocate(jj_begin_para(0:mpi_size-1))
-      allocate(jj_end_para(0:mpi_size-1))
-      allocate(jj_nb_para(0:mpi_size-1))
-      
-      do i=0,mpi_size-1
-        jj_nb_para(i)=(jjm+1)/mpi_size
-        if ( i < MOD((jjm+1),mpi_size) ) jj_nb_para(i)=jj_nb_para(i)+1
-        
-        if (jj_nb_para(i) <= 2 ) then
-          
-         write(lunout,*)"Arret : le nombre de bande de lattitude par process est trop faible (<2)."
-         write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude"
-          
-#ifdef CPP_MPI
-          IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr)
-#endif          
-        endif
-        
-      enddo
-      
-!      jj_nb_para(0)=11
-!      jj_nb_para(1)=25
-!      jj_nb_para(2)=25
-!      jj_nb_para(3)=12      
-
-      j=1
-      
-      do i=0,mpi_size-1 
-        
-        jj_begin_para(i)=j
-        jj_end_para(i)=j+jj_Nb_para(i)-1
-        j=j+jj_Nb_para(i)
-      
-      enddo
-      
-      jj_begin = jj_begin_para(mpi_rank)
-      jj_end   = jj_end_para(mpi_rank)
-      jj_nb    = jj_nb_para(mpi_rank)
-      
-      ij_begin=(jj_begin-1)*iip1+1
-      ij_end=jj_end*iip1
-      
-      if (mpi_rank.eq.0) then
-        pole_nord=.TRUE.
-      else 
-        pole_nord=.FALSE.
-      endif
-      
-      if (mpi_rank.eq.mpi_size-1) then
-        pole_sud=.TRUE.
-      else 
-        pole_sud=.FALSE.
-      endif
-        
-      write(lunout,*)"init_parallel: jj_begin",jj_begin
-      write(lunout,*)"init_parallel: jj_end",jj_end
-      write(lunout,*)"init_parallel: ij_begin",ij_begin
-      write(lunout,*)"init_parallel: ij_end",ij_end
-
-!$OMP PARALLEL
-
-#ifdef CPP_OMP
-!$OMP MASTER
-        omp_size=OMP_GET_NUM_THREADS()
-!$OMP END MASTER
-        omp_rank=OMP_GET_THREAD_NUM()    
-#else    
-        omp_size=1
-        omp_rank=0
-#endif
-!$OMP END PARALLEL         
-    
-    end subroutine init_parallel
-
-    
-    subroutine SetDistrib(jj_Nb_New)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      INTEGER,dimension(0:MPI_Size-1) :: jj_Nb_New
-      INTEGER :: i  
-  
-      jj_Nb_Para=jj_Nb_New
-      
-      jj_begin_para(0)=1
-      jj_end_para(0)=jj_Nb_Para(0)
-      
-      do i=1,mpi_size-1 
-        
-        jj_begin_para(i)=jj_end_para(i-1)+1
-        jj_end_para(i)=jj_begin_para(i)+jj_Nb_para(i)-1
-      
-      enddo
-      
-      jj_begin = jj_begin_para(mpi_rank)
-      jj_end   = jj_end_para(mpi_rank)
-      jj_nb    = jj_nb_para(mpi_rank)
-      
-      ij_begin=(jj_begin-1)*iip1+1
-      ij_end=jj_end*iip1
-
-    end subroutine SetDistrib
-
-
-
-    
-    subroutine Finalize_parallel
-#ifdef CPP_COUPLE
-    use mod_prism_proto
-! Ehouarn: surface_data module is in 'phylmd' ...
-      use surface_data, only : type_ocean
-      implicit none
-#else
-      implicit none
-! without the surface_data module, we declare (and set) a dummy 'type_ocean'
-      character(len=6),parameter :: type_ocean="dummy"
-#endif
-! #endif of #ifdef CPP_EARTH
-
-      include "dimensions.h"
-      include "paramet.h"
-#ifdef CPP_MPI
-      include 'mpif.h'
-#endif      
-
-      integer :: ierr
-      integer :: i
-
-      if (allocated(jj_begin_para)) deallocate(jj_begin_para)
-      if (allocated(jj_end_para))   deallocate(jj_end_para)
-      if (allocated(jj_nb_para))    deallocate(jj_nb_para)
-
-      if (type_ocean == 'couple') then
-#ifdef CPP_COUPLE
-         call prism_terminate_proto(ierr)
-         IF (ierr .ne. PRISM_Ok) THEN
-            call abort_gcm('Finalize_parallel',' Probleme dans prism_terminate_proto ',1)
-         endif
-#endif 
-      else
-#ifdef CPP_MPI
-         IF (using_mpi) call MPI_FINALIZE(ierr)
-#endif
-      end if
-      
-    end subroutine Finalize_parallel
-        
-    subroutine Pack_Data(Field,ij,ll,row,Buffer)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      integer, intent(in) :: ij,ll,row
-      real,dimension(ij,ll),intent(in) ::Field
-      real,dimension(ll*iip1*row), intent(out) :: Buffer 
-            
-      integer :: Pos
-      integer :: i,l
-      
-      Pos=0
-      do l=1,ll
-        do i=1,row*iip1
-          Pos=Pos+1
-          Buffer(Pos)=Field(i,l)
-        enddo
-      enddo
-      
-    end subroutine Pack_data 
-     
-    subroutine Unpack_Data(Field,ij,ll,row,Buffer)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      integer, intent(in) :: ij,ll,row
-      real,dimension(ij,ll),intent(out) ::Field
-      real,dimension(ll*iip1*row), intent(in) :: Buffer 
-            
-      integer :: Pos
-      integer :: i,l
-      
-      Pos=0
-      
-      do l=1,ll
-        do i=1,row*iip1
-          Pos=Pos+1
-          Field(i,l)=Buffer(Pos)
-        enddo
-      enddo
-      
-    end subroutine UnPack_data
-
-    
-    SUBROUTINE barrier
-    IMPLICIT NONE
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-    
-!$OMP CRITICAL (MPI)      
-#ifdef CPP_MPI
-      IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-    
-    END SUBROUTINE barrier
-       
-      
-    subroutine exchange_hallo(Field,ij,ll,up,down)
-    USE Vampir
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: up,down
-      
-      INTEGER :: ierr
-      LOGICAL :: SendUp,SendDown
-      LOGICAL :: RecvUp,RecvDown
-      INTEGER, DIMENSION(4) :: Request
-#ifdef CPP_MPI
-      INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status
-#else
-      INTEGER, DIMENSION(1,4) :: Status
-#endif
-      INTEGER :: NbRequest
-      REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down
-      REAL, dimension(:),allocatable :: Buffer_Recv_up,Buffer_Recv_down
-      INTEGER :: Buffer_size      
-
-      IF (using_mpi) THEN
-
-        CALL barrier
-      
-        call VTb(VThallo)
-      
-        SendUp=.TRUE.
-        SendDown=.TRUE.
-        RecvUp=.TRUE.
-        RecvDown=.TRUE.
-          
-        IF (pole_nord) THEN
-          SendUp=.FALSE.
-          RecvUp=.FALSE.
-        ENDIF
-    
-        IF (pole_sud) THEN
-          SendDown=.FALSE.
-          RecvDown=.FALSE.
-        ENDIF
-        
-        if (up.eq.0) then
-          SendDown=.FALSE.
-          RecvUp=.FALSE.
-        endif
-      
-        if (down.eq.0) then
-          SendUp=.FALSE.
-          RecvDown=.FALSE.
-        endif
-      
-        NbRequest=0
-  
-        IF (SendUp) THEN
-          NbRequest=NbRequest+1
-          buffer_size=down*iip1*ll
-          allocate(Buffer_Send_up(Buffer_size))
-          call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up)
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_ISSEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        ENDIF
-  
-        IF (SendDown) THEN
-          NbRequest=NbRequest+1
-           
-          buffer_size=up*iip1*ll
-          allocate(Buffer_Send_down(Buffer_size))
-          call PACK_Data(Field(ij_end+1-up*iip1,1),ij,ll,up,Buffer_send_down)
-        
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_ISSEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        ENDIF
-    
-  
-        IF (RecvUp) THEN
-          NbRequest=NbRequest+1
-          buffer_size=up*iip1*ll
-          allocate(Buffer_recv_up(Buffer_size))
-              
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1,  &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-     
-       
-        ENDIF
-  
-        IF (RecvDown) THEN
-          NbRequest=NbRequest+1
-          buffer_size=down*iip1*ll
-          allocate(Buffer_recv_down(Buffer_size))
-        
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        
-        ENDIF
-  
-#ifdef CPP_MPI
-        if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr)
-#endif
-        IF (RecvUp)  call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up)
-        IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down)  
-
-        call VTe(VThallo)
-        call barrier
-      
-      ENDIF  ! using_mpi
-      
-      RETURN
-      
-    end subroutine exchange_Hallo
-    
-
-    subroutine Gather_Field(Field,ij,ll,rank)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h" 
-#include "iniprint.h"
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll,rank
-      REAL, dimension(ij,ll) :: Field
-      REAL, dimension(:),allocatable :: Buffer_send   
-      REAL, dimension(:),allocatable :: Buffer_Recv
-      INTEGER, dimension(0:MPI_Size-1) :: Recv_count, displ
-      INTEGER :: ierr
-      INTEGER ::i
-      
-      IF (using_mpi) THEN
-
-        if (ij==ip1jmp1) then 
-           allocate(Buffer_send(iip1*ll*(jj_end-jj_begin+1)))
-           call Pack_Data(Field(ij_begin,1),ij,ll,jj_end-jj_begin+1,Buffer_send)
-        else if (ij==ip1jm) then
-           allocate(Buffer_send(iip1*ll*(min(jj_end,jjm)-jj_begin+1)))
-           call Pack_Data(Field(ij_begin,1),ij,ll,min(jj_end,jjm)-jj_begin+1,Buffer_send)
-        else
-           write(lunout,*)ij  
-        stop 'erreur dans Gather_Field'
-        endif
-        
-        if (MPI_Rank==rank) then
-          allocate(Buffer_Recv(ij*ll))
-
-!CDIR NOVECTOR
-          do i=0,MPI_Size-1
-             
-            if (ij==ip1jmp1) then 
-              Recv_count(i)=(jj_end_para(i)-jj_begin_para(i)+1)*ll*iip1
-            else if (ij==ip1jm) then
-              Recv_count(i)=(min(jj_end_para(i),jjm)-jj_begin_para(i)+1)*ll*iip1
-            else
-              stop 'erreur dans Gather_Field'
-            endif
-                   
-            if (i==0) then 
-              displ(i)=0 
-            else
-              displ(i)=displ(i-1)+Recv_count(i-1)
-            endif
-            
-          enddo
-          
-        else
-          ! Ehouarn: When in debug mode, ifort complains (for call MPI_GATHERV
-          !          below) about Buffer_Recv() being not allocated.
-          !          So make a dummy allocation.
-          allocate(Buffer_Recv(1))
-        endif ! of if (MPI_Rank==rank)
-  
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-        call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8,   &
-                          Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      
-        if (MPI_Rank==rank) then                  
-      
-          if (ij==ip1jmp1) then 
-            do i=0,MPI_Size-1
-              call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                 &
-                               jj_end_para(i)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
-            enddo
-          else if (ij==ip1jm) then
-            do i=0,MPI_Size-1
-               call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                       &
-                               min(jj_end_para(i),jjm)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
-            enddo
-          endif
-        endif 
-      ENDIF ! using_mpi
-      
-    end subroutine Gather_Field
-
-
-    subroutine AllGather_Field(Field,ij,ll)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: ierr
-      
-      IF (using_mpi) THEN
-        call Gather_Field(Field,ij,ll,0)
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-      call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      ENDIF
-      
-    end subroutine AllGather_Field
-    
-   subroutine Broadcast_Field(Field,ij,ll,rank)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: rank
-      INTEGER :: ierr
-      
-      IF (using_mpi) THEN
-      
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-      call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      
-      ENDIF
-    end subroutine Broadcast_Field
-        
-   
-!  Subroutine verif_hallo(Field,ij,ll,up,down)
-!    implicit none
-!#include "dimensions.h"
-!#include "paramet.h"    
-!    include 'mpif.h'
-!    
-!      INTEGER :: ij,ll
-!      REAL, dimension(ij,ll) :: Field
-!      INTEGER :: up,down 
-!      
-!      REAL,dimension(ij,ll): NewField
-!      
-!      NewField=0
-!      
-!      ijb=ij_begin
-!      ije=ij_end
-!      if (pole_nord) 
-!      NewField(ij_be       
-
-  end module parallel
Index: /LMDZ5/trunk/libf/dyn3dpar/parallel_lmdz.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/parallel_lmdz.F90	(revision 1823)
+++ /LMDZ5/trunk/libf/dyn3dpar/parallel_lmdz.F90	(revision 1823)
@@ -0,0 +1,587 @@
+! 
+! $Id: parallel.F90 1810 2013-07-24 08:06:39Z emillour $
+!
+  MODULE parallel_lmdz
+  USE mod_const_mpi
+    
+    LOGICAL,SAVE :: using_mpi=.TRUE.
+    LOGICAL,SAVE :: using_omp
+    
+    integer, save :: mpi_size
+    integer, save :: mpi_rank
+    integer, save :: jj_begin
+    integer, save :: jj_end
+    integer, save :: jj_nb
+    integer, save :: ij_begin
+    integer, save :: ij_end
+    logical, save :: pole_nord
+    logical, save :: pole_sud
+    
+    integer, allocatable, save, dimension(:) :: jj_begin_para
+    integer, allocatable, save, dimension(:) :: jj_end_para
+    integer, allocatable, save, dimension(:) :: jj_nb_para
+    integer, save :: OMP_CHUNK
+    integer, save :: omp_rank
+    integer, save :: omp_size  
+!$OMP THREADPRIVATE(omp_rank)
+
+ contains
+ 
+    subroutine init_parallel
+    USE vampir
+    implicit none
+#ifdef CPP_MPI
+      include 'mpif.h'
+#endif
+#include "dimensions.h"
+#include "paramet.h"
+#include "iniprint.h"
+
+      integer :: ierr
+      integer :: i,j
+      integer :: type_size
+      integer, dimension(3) :: blocklen,type
+      integer :: comp_id
+      character(len=4)  :: num
+      character(len=20) :: filename
+ 
+#ifdef CPP_OMP    
+      INTEGER :: OMP_GET_NUM_THREADS
+      EXTERNAL OMP_GET_NUM_THREADS
+      INTEGER :: OMP_GET_THREAD_NUM
+      EXTERNAL OMP_GET_THREAD_NUM
+#endif  
+
+#ifdef CPP_MPI
+       using_mpi=.TRUE.
+#else
+       using_mpi=.FALSE.
+#endif
+      
+
+#ifdef CPP_OMP
+       using_OMP=.TRUE.
+#else
+       using_OMP=.FALSE.
+#endif
+      
+      call InitVampir
+      
+      IF (using_mpi) THEN
+#ifdef CPP_MPI
+        call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr)
+        call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr)
+#endif
+      ELSE
+        mpi_size=1
+        mpi_rank=0
+      ENDIF
+
+
+! Open text output file with mpi_rank in suffix of file name 
+      IF (lunout /= 5 .and. lunout /= 6) THEN
+         WRITE(num,'(I4.4)') mpi_rank
+         filename='lmdz.out_'//num
+         IF (mpi_rank .NE. 0) THEN
+            OPEN(UNIT=lunout,FILE=TRIM(filename),ACTION='write', &
+               STATUS='unknown',FORM='formatted',IOSTAT=ierr) 
+         ENDIF
+      ENDIF
+
+      
+      allocate(jj_begin_para(0:mpi_size-1))
+      allocate(jj_end_para(0:mpi_size-1))
+      allocate(jj_nb_para(0:mpi_size-1))
+      
+      do i=0,mpi_size-1
+        jj_nb_para(i)=(jjm+1)/mpi_size
+        if ( i < MOD((jjm+1),mpi_size) ) jj_nb_para(i)=jj_nb_para(i)+1
+        
+        if (jj_nb_para(i) <= 2 ) then
+          
+         write(lunout,*)"Arret : le nombre de bande de lattitude par process est trop faible (<2)."
+         write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude"
+          
+#ifdef CPP_MPI
+          IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr)
+#endif          
+        endif
+        
+      enddo
+      
+!      jj_nb_para(0)=11
+!      jj_nb_para(1)=25
+!      jj_nb_para(2)=25
+!      jj_nb_para(3)=12      
+
+      j=1
+      
+      do i=0,mpi_size-1 
+        
+        jj_begin_para(i)=j
+        jj_end_para(i)=j+jj_Nb_para(i)-1
+        j=j+jj_Nb_para(i)
+      
+      enddo
+      
+      jj_begin = jj_begin_para(mpi_rank)
+      jj_end   = jj_end_para(mpi_rank)
+      jj_nb    = jj_nb_para(mpi_rank)
+      
+      ij_begin=(jj_begin-1)*iip1+1
+      ij_end=jj_end*iip1
+      
+      if (mpi_rank.eq.0) then
+        pole_nord=.TRUE.
+      else 
+        pole_nord=.FALSE.
+      endif
+      
+      if (mpi_rank.eq.mpi_size-1) then
+        pole_sud=.TRUE.
+      else 
+        pole_sud=.FALSE.
+      endif
+        
+      write(lunout,*)"init_parallel: jj_begin",jj_begin
+      write(lunout,*)"init_parallel: jj_end",jj_end
+      write(lunout,*)"init_parallel: ij_begin",ij_begin
+      write(lunout,*)"init_parallel: ij_end",ij_end
+
+!$OMP PARALLEL
+
+#ifdef CPP_OMP
+!$OMP MASTER
+        omp_size=OMP_GET_NUM_THREADS()
+!$OMP END MASTER
+        omp_rank=OMP_GET_THREAD_NUM()    
+#else    
+        omp_size=1
+        omp_rank=0
+#endif
+!$OMP END PARALLEL         
+    
+    end subroutine init_parallel
+
+    
+    subroutine SetDistrib(jj_Nb_New)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      INTEGER,dimension(0:MPI_Size-1) :: jj_Nb_New
+      INTEGER :: i  
+  
+      jj_Nb_Para=jj_Nb_New
+      
+      jj_begin_para(0)=1
+      jj_end_para(0)=jj_Nb_Para(0)
+      
+      do i=1,mpi_size-1 
+        
+        jj_begin_para(i)=jj_end_para(i-1)+1
+        jj_end_para(i)=jj_begin_para(i)+jj_Nb_para(i)-1
+      
+      enddo
+      
+      jj_begin = jj_begin_para(mpi_rank)
+      jj_end   = jj_end_para(mpi_rank)
+      jj_nb    = jj_nb_para(mpi_rank)
+      
+      ij_begin=(jj_begin-1)*iip1+1
+      ij_end=jj_end*iip1
+
+    end subroutine SetDistrib
+
+
+
+    
+    subroutine Finalize_parallel
+#ifdef CPP_COUPLE
+    use mod_prism_proto
+! Ehouarn: surface_data module is in 'phylmd' ...
+      use surface_data, only : type_ocean
+      implicit none
+#else
+      implicit none
+! without the surface_data module, we declare (and set) a dummy 'type_ocean'
+      character(len=6),parameter :: type_ocean="dummy"
+#endif
+! #endif of #ifdef CPP_EARTH
+
+      include "dimensions.h"
+      include "paramet.h"
+#ifdef CPP_MPI
+      include 'mpif.h'
+#endif      
+
+      integer :: ierr
+      integer :: i
+
+      if (allocated(jj_begin_para)) deallocate(jj_begin_para)
+      if (allocated(jj_end_para))   deallocate(jj_end_para)
+      if (allocated(jj_nb_para))    deallocate(jj_nb_para)
+
+      if (type_ocean == 'couple') then
+#ifdef CPP_COUPLE
+         call prism_terminate_proto(ierr)
+         IF (ierr .ne. PRISM_Ok) THEN
+            call abort_gcm('Finalize_parallel',' Probleme dans prism_terminate_proto ',1)
+         endif
+#endif 
+      else
+#ifdef CPP_MPI
+         IF (using_mpi) call MPI_FINALIZE(ierr)
+#endif
+      end if
+      
+    end subroutine Finalize_parallel
+        
+    subroutine Pack_Data(Field,ij,ll,row,Buffer)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      integer, intent(in) :: ij,ll,row
+      real,dimension(ij,ll),intent(in) ::Field
+      real,dimension(ll*iip1*row), intent(out) :: Buffer 
+            
+      integer :: Pos
+      integer :: i,l
+      
+      Pos=0
+      do l=1,ll
+        do i=1,row*iip1
+          Pos=Pos+1
+          Buffer(Pos)=Field(i,l)
+        enddo
+      enddo
+      
+    end subroutine Pack_data 
+     
+    subroutine Unpack_Data(Field,ij,ll,row,Buffer)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      integer, intent(in) :: ij,ll,row
+      real,dimension(ij,ll),intent(out) ::Field
+      real,dimension(ll*iip1*row), intent(in) :: Buffer 
+            
+      integer :: Pos
+      integer :: i,l
+      
+      Pos=0
+      
+      do l=1,ll
+        do i=1,row*iip1
+          Pos=Pos+1
+          Field(i,l)=Buffer(Pos)
+        enddo
+      enddo
+      
+    end subroutine UnPack_data
+
+    
+    SUBROUTINE barrier
+    IMPLICIT NONE
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+    
+!$OMP CRITICAL (MPI)      
+#ifdef CPP_MPI
+      IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+    
+    END SUBROUTINE barrier
+       
+      
+    subroutine exchange_hallo(Field,ij,ll,up,down)
+    USE Vampir
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: up,down
+      
+      INTEGER :: ierr
+      LOGICAL :: SendUp,SendDown
+      LOGICAL :: RecvUp,RecvDown
+      INTEGER, DIMENSION(4) :: Request
+#ifdef CPP_MPI
+      INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status
+#else
+      INTEGER, DIMENSION(1,4) :: Status
+#endif
+      INTEGER :: NbRequest
+      REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down
+      REAL, dimension(:),allocatable :: Buffer_Recv_up,Buffer_Recv_down
+      INTEGER :: Buffer_size      
+
+      IF (using_mpi) THEN
+
+        CALL barrier
+      
+        call VTb(VThallo)
+      
+        SendUp=.TRUE.
+        SendDown=.TRUE.
+        RecvUp=.TRUE.
+        RecvDown=.TRUE.
+          
+        IF (pole_nord) THEN
+          SendUp=.FALSE.
+          RecvUp=.FALSE.
+        ENDIF
+    
+        IF (pole_sud) THEN
+          SendDown=.FALSE.
+          RecvDown=.FALSE.
+        ENDIF
+        
+        if (up.eq.0) then
+          SendDown=.FALSE.
+          RecvUp=.FALSE.
+        endif
+      
+        if (down.eq.0) then
+          SendUp=.FALSE.
+          RecvDown=.FALSE.
+        endif
+      
+        NbRequest=0
+  
+        IF (SendUp) THEN
+          NbRequest=NbRequest+1
+          buffer_size=down*iip1*ll
+          allocate(Buffer_Send_up(Buffer_size))
+          call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up)
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_ISSEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        ENDIF
+  
+        IF (SendDown) THEN
+          NbRequest=NbRequest+1
+           
+          buffer_size=up*iip1*ll
+          allocate(Buffer_Send_down(Buffer_size))
+          call PACK_Data(Field(ij_end+1-up*iip1,1),ij,ll,up,Buffer_send_down)
+        
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_ISSEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        ENDIF
+    
+  
+        IF (RecvUp) THEN
+          NbRequest=NbRequest+1
+          buffer_size=up*iip1*ll
+          allocate(Buffer_recv_up(Buffer_size))
+              
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1,  &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+     
+       
+        ENDIF
+  
+        IF (RecvDown) THEN
+          NbRequest=NbRequest+1
+          buffer_size=down*iip1*ll
+          allocate(Buffer_recv_down(Buffer_size))
+        
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        
+        ENDIF
+  
+#ifdef CPP_MPI
+        if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr)
+#endif
+        IF (RecvUp)  call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up)
+        IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down)  
+
+        call VTe(VThallo)
+        call barrier
+      
+      ENDIF  ! using_mpi
+      
+      RETURN
+      
+    end subroutine exchange_Hallo
+    
+
+    subroutine Gather_Field(Field,ij,ll,rank)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h" 
+#include "iniprint.h"
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll,rank
+      REAL, dimension(ij,ll) :: Field
+      REAL, dimension(:),allocatable :: Buffer_send   
+      REAL, dimension(:),allocatable :: Buffer_Recv
+      INTEGER, dimension(0:MPI_Size-1) :: Recv_count, displ
+      INTEGER :: ierr
+      INTEGER ::i
+      
+      IF (using_mpi) THEN
+
+        if (ij==ip1jmp1) then 
+           allocate(Buffer_send(iip1*ll*(jj_end-jj_begin+1)))
+           call Pack_Data(Field(ij_begin,1),ij,ll,jj_end-jj_begin+1,Buffer_send)
+        else if (ij==ip1jm) then
+           allocate(Buffer_send(iip1*ll*(min(jj_end,jjm)-jj_begin+1)))
+           call Pack_Data(Field(ij_begin,1),ij,ll,min(jj_end,jjm)-jj_begin+1,Buffer_send)
+        else
+           write(lunout,*)ij  
+        stop 'erreur dans Gather_Field'
+        endif
+        
+        if (MPI_Rank==rank) then
+          allocate(Buffer_Recv(ij*ll))
+
+!CDIR NOVECTOR
+          do i=0,MPI_Size-1
+             
+            if (ij==ip1jmp1) then 
+              Recv_count(i)=(jj_end_para(i)-jj_begin_para(i)+1)*ll*iip1
+            else if (ij==ip1jm) then
+              Recv_count(i)=(min(jj_end_para(i),jjm)-jj_begin_para(i)+1)*ll*iip1
+            else
+              stop 'erreur dans Gather_Field'
+            endif
+                   
+            if (i==0) then 
+              displ(i)=0 
+            else
+              displ(i)=displ(i-1)+Recv_count(i-1)
+            endif
+            
+          enddo
+          
+        else
+          ! Ehouarn: When in debug mode, ifort complains (for call MPI_GATHERV
+          !          below) about Buffer_Recv() being not allocated.
+          !          So make a dummy allocation.
+          allocate(Buffer_Recv(1))
+        endif ! of if (MPI_Rank==rank)
+  
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+        call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8,   &
+                          Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      
+        if (MPI_Rank==rank) then                  
+      
+          if (ij==ip1jmp1) then 
+            do i=0,MPI_Size-1
+              call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                 &
+                               jj_end_para(i)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
+            enddo
+          else if (ij==ip1jm) then
+            do i=0,MPI_Size-1
+               call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                       &
+                               min(jj_end_para(i),jjm)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
+            enddo
+          endif
+        endif 
+      ENDIF ! using_mpi
+      
+    end subroutine Gather_Field
+
+
+    subroutine AllGather_Field(Field,ij,ll)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: ierr
+      
+      IF (using_mpi) THEN
+        call Gather_Field(Field,ij,ll,0)
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+      call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      ENDIF
+      
+    end subroutine AllGather_Field
+    
+   subroutine Broadcast_Field(Field,ij,ll,rank)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: rank
+      INTEGER :: ierr
+      
+      IF (using_mpi) THEN
+      
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+      call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      
+      ENDIF
+    end subroutine Broadcast_Field
+        
+   
+!  Subroutine verif_hallo(Field,ij,ll,up,down)
+!    implicit none
+!#include "dimensions.h"
+!#include "paramet.h"    
+!    include 'mpif.h'
+!    
+!      INTEGER :: ij,ll
+!      REAL, dimension(ij,ll) :: Field
+!      INTEGER :: up,down 
+!      
+!      REAL,dimension(ij,ll): NewField
+!      
+!      NewField=0
+!      
+!      ijb=ij_begin
+!      ije=ij_end
+!      if (pole_nord) 
+!      NewField(ij_be       
+
+  end MODULE parallel_lmdz
Index: /LMDZ5/trunk/libf/dyn3dpar/pression_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/pression_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/pression_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE pression_p( ngrid, ap, bp, ps, p )
-      USE parallel
+      USE parallel_lmdz
 c
 
Index: /LMDZ5/trunk/libf/dyn3dpar/qminimum_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/qminimum_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/qminimum_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE qminimum_p( q,nq,deltap )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT none
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/rotat_nfil_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/rotat_nfil_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/rotat_nfil_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/rotat_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/rotat_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/rotat_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/rotatf_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/rotatf_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/rotatf_p.F	(revision 1823)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/times.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/times.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/times.F90	(revision 1823)
@@ -25,5 +25,5 @@
   
   subroutine init_timer
-    use parallel
+    USE parallel_lmdz
     implicit none
 #include "dimensions.h"
@@ -101,5 +101,5 @@
 
   subroutine stop_timer(no_timer)
-    use parallel
+    USE parallel_lmdz
     implicit none
     integer :: no_timer
@@ -136,5 +136,5 @@
    
   subroutine allgather_timer
-    use parallel
+    USE parallel_lmdz
     implicit none
 #ifdef CPP_MPI    
@@ -171,5 +171,5 @@
   
   subroutine allgather_timer_average
-    use parallel
+    USE parallel_lmdz
     implicit none
 #ifdef CPP_MPI
Index: /LMDZ5/trunk/libf/dyn3dpar/top_bound_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/top_bound_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/top_bound_p.F	(revision 1823)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE top_bound_p(vcov,ucov,teta,masse,dt)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/tourpot_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/tourpot_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/tourpot_p.F	(revision 1823)
@@ -1,4 +1,4 @@
       SUBROUTINE tourpot_p ( vcov, ucov, massebxy, vorpot )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/vitvert_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/vitvert_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/vitvert_p.F	(revision 1823)
@@ -1,5 +1,5 @@
       SUBROUTINE vitvert_p ( convm , w )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: /LMDZ5/trunk/libf/dyn3dpar/vlsplt_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/vlsplt_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/vlsplt_p.F	(revision 1823)
@@ -18,5 +18,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE Vampir
@@ -203,5 +203,5 @@
 c
 c   --------------------------------------------------------------------
-      USE Parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -538,5 +538,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -927,5 +927,5 @@
 c
 c   --------------------------------------------------------------------
-      USE Parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/vlspltgen_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/vlspltgen_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/vlspltgen_p.F	(revision 1823)
@@ -22,5 +22,5 @@
 c     pk exner au milieu des couches necessaire pour calculer Qsat
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE Write_Field_p
Index: /LMDZ5/trunk/libf/dyn3dpar/vlspltqs_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/vlspltqs_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/vlspltqs_p.F	(revision 1823)
@@ -22,5 +22,5 @@
 c     pk exner au milieu des couches necessaire pour calculer Qsat
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE VAMPIR
@@ -231,5 +231,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -583,5 +583,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: /LMDZ5/trunk/libf/dyn3dpar/write_field_p.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/write_field_p.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/write_field_p.F90	(revision 1823)
@@ -9,5 +9,5 @@
   
   subroutine write_field1D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
@@ -30,5 +30,5 @@
 
   subroutine write_field2D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
@@ -51,5 +51,5 @@
   
   subroutine write_field3D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
Index: /LMDZ5/trunk/libf/dyn3dpar/writedynav_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/writedynav_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/writedynav_p.F	(revision 1823)
@@ -9,5 +9,5 @@
       USE ioipsl
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE misc_mod
       USE infotrac
Index: /LMDZ5/trunk/libf/dyn3dpar/writehist_p.F
===================================================================
--- /LMDZ5/trunk/libf/dyn3dpar/writehist_p.F	(revision 1822)
+++ /LMDZ5/trunk/libf/dyn3dpar/writehist_p.F	(revision 1823)
@@ -9,5 +9,5 @@
       USE ioipsl
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE misc_mod
       USE infotrac
Index: /LMDZ5/trunk/libf/filtrez/mod_filtre_fft.F90
===================================================================
--- /LMDZ5/trunk/libf/filtrez/mod_filtre_fft.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/filtrez/mod_filtre_fft.F90	(revision 1823)
@@ -118,5 +118,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -179,5 +179,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -241,5 +241,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
Index: /LMDZ5/trunk/libf/filtrez/mod_filtre_fft_loc.F90
===================================================================
--- /LMDZ5/trunk/libf/filtrez/mod_filtre_fft_loc.F90	(revision 1822)
+++ /LMDZ5/trunk/libf/filtrez/mod_filtre_fft_loc.F90	(revision 1823)
@@ -107,5 +107,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -187,5 +187,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -250,5 +250,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
