Index: trunk/DOC/chantiers/commit_importants.log
===================================================================
--- trunk/DOC/chantiers/commit_importants.log	(revision 1542)
+++ trunk/DOC/chantiers/commit_importants.log	(revision 1543)
@@ -1685,2 +1685,35 @@
 - moved "iniprint.h" from dyn3d_common to misc (NB: it is used in both physics
   and dynamics; this should be cleaned up further...)
+
+**********************
+**** commit_v1543 ****
+**********************
+Ehouarn: Further adaptations to keep up with changes in LMDZ5 concerning
+physics/dynamics separation:
+* dyn3d:
+- adapted gcm.F so that all physics initializations are now done in iniphysiq.
+
+* dyn3dpar:
+- adapted gcm.F so that all physics initializations are now done in iniphysiq.
+- updated calfis_p.F to follow up with changes.
+- copied over updated "bands.F90" from LMDZ5.
+
+* dynphy_lonlat:
+- calfis_p.F90, mod_interface_dyn_phys.F90,
+  follow up of changes in phy_common/mod_* routines
+
+* phy_common:
+- added "geometry_mod.F90" to store information about the grid (replaces
+  phy*/comgeomphy.F90) and give variables friendlier names: rlond =>
+  longitude , rlatd => latitude, airephy => cell_area,
+  cuphy => dx , cvphy => dy
+- added "physics_distribution_mod.F90"
+- updated "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_mpi_data.F90",
+  "mod_phys_lmdz_para.F90", "mod_phys_lmdz_mpi_transfert.F90",
+  "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_omp_data.F90",
+  "mod_phys_lmdz_omp_transfert.F90", "write_field_phy.F90"
+  and "ioipsl_getin_p_mod.F90" to LMDZ5 versions.
+
+* phy[venus/titan/mars/std]:
+- removed "init_phys_lmdz.F90", "comgeomphy.F90"; adapted routines to use
+  geometry_mod (longitude, latitude, cell_area, etc.)
Index: trunk/LMDZ.COMMON/libf/dyn3d/gcm.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/gcm.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/dyn3d/gcm.F90	(revision 1543)
@@ -25,13 +25,9 @@
                              ok_dyn_ins,ok_dyn_ave,iecri,periodav,  &
                              less1day,fractday,ndynstep,nsplit_phys
+  USE mod_const_mpi, ONLY: COMM_LMDZ
   use cpdet_mod, only: ini_cpdet
   USE temps_mod, ONLY: calend,start_time,annee_ref,day_ref, &
      		itau_dyn,itau_phy,day_ini,jD_ref,jH_ref,day_end
 
-#ifdef INCA
-! Only INCA needs these informations (from the Earth's physics)
-  USE indice_sol_mod
-  USE mod_phys_lmdz_para, ONLY : klon_mpi_para_nb
-#endif
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -184,8 +180,8 @@
 ! A nettoyer. On ne veut qu'une ou deux routines d'interface 
 ! dynamique -> physique pour l'initialisation
-#ifdef CPP_PHYS
-  CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-!      call initcomgeomphy ! now done in iniphysiq
-#endif
+!#ifdef CPP_PHYS
+!  CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
+!!      call initcomgeomphy ! now done in iniphysiq
+!#endif
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
@@ -225,12 +221,4 @@
 #endif
 !-----------------------------------------------------------------------
-
-  IF (type_trac == 'inca') THEN
-#ifdef INCA
-    call init_const_lmdz(nbtr,anneeref,dayref,iphysiq,day_step,nday, &
-         nbsrf, is_oce,is_sic,is_ter,is_lic)
-    call init_inca_para(iim,jjm+1,klon,1,klon_mpi_para_nb,0)
-#endif
-  END IF
   !
   !
@@ -281,11 +269,4 @@
 
   endif ! of if (read_start)
-
-  IF (type_trac == 'inca') THEN
-#ifdef INCA
-     call init_inca_dim(klon,llm,iim,jjm, &
-          rlonu,rlatu,rlonv,rlatv)
-#endif
-  END IF
 
 
@@ -445,7 +426,9 @@
      ! Physics:
 #ifdef CPP_PHYS
-         CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys, &
-                      rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, &
-                      iflag_phys)
+     CALL iniphysiq(iim,jjm,llm, &
+          (jjm-1)*iim+2,comm_lmdz, &
+          daysec,day_ini,dtphys/nsplit_phys, &
+          rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, &
+          iflag_phys)
 #endif
   ENDIF ! of IF ((iflag_phys==1).or.(iflag_phys>=100))
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/bands.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/bands.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/bands.F90	(revision 1543)
@@ -1,4 +1,4 @@
 !
-! $Id: bands.F90 1615 2012-02-10 15:42:26Z emillour $
+! $Id: bands.F90 2351 2015-08-25 15:14:59Z emillour $
 !
   module Bands
@@ -19,5 +19,5 @@
   
   subroutine AllocateBands
-    use parallel_lmdz
+    USE parallel_lmdz
     implicit none
     
@@ -33,5 +33,5 @@
   
   subroutine Read_distrib
-    use parallel_lmdz
+    USE parallel_lmdz
     implicit none
 
@@ -93,12 +93,10 @@
    SUBROUTINE  Set_Bands 
      USE parallel_lmdz
-#ifdef CPP_PHYS
-! Ehouarn: what follows is only related to // physics
-     USE mod_phys_lmdz_para, ONLY : jj_para_begin,jj_para_end
-#endif
      IMPLICIT NONE
      INCLUDE 'dimensions.h'    
-     INTEGER :: i
-        
+     INTEGER :: i, ij
+     INTEGER :: jj_para_begin(0:mpi_size-1)
+     INTEGER :: jj_para_end(0:mpi_size-1)
+       
       do i=0,mpi_size-1
          jj_nb_vanleer2(i)=(jjm+1)/mpi_size
@@ -106,5 +104,15 @@
       enddo
           
-#ifdef CPP_PHYS
+      jj_para_begin(0)=1
+      ij=distrib_phys(0)+iim-1
+      jj_para_end(0)=((ij-1)/iim)+1
+      
+      DO i=1,mpi_Size-1
+        ij=ij+1
+        jj_para_begin(i)=((ij-1)/iim)+1
+        ij=ij+distrib_phys(i)-1
+        jj_para_end(i)=((ij-1)/iim)+1
+      ENDDO
+ 
       do i=0,MPI_Size-1
         jj_Nb_physic(i)=jj_para_end(i)-jj_para_begin(i)+1
@@ -127,5 +135,4 @@
         endif
       enddo
-#endif      
       
     end subroutine Set_Bands
@@ -134,5 +141,5 @@
     subroutine AdjustBands_caldyn
       use times
-      use parallel_lmdz
+      USE parallel_lmdz
       implicit none
 
@@ -199,5 +206,5 @@
     subroutine AdjustBands_vanleer
       use times
-      use parallel_lmdz
+      USE parallel_lmdz
       implicit none
 
@@ -265,5 +272,5 @@
     subroutine AdjustBands_dissip
       use times
-      use parallel_lmdz
+      USE parallel_lmdz
       implicit none
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 1543)
@@ -14,7 +14,7 @@
       USE parallel_lmdz
       USE infotrac
-#ifdef CPP_PHYS
-      USE mod_interface_dyn_phys
-#endif
+!#ifdef CPP_PHYS
+!      USE mod_interface_dyn_phys
+!#endif
       USE mod_hallo
       USE Bands
@@ -40,5 +40,4 @@
       USE mod_phys_lmdz_omp_data, ONLY: klon_omp 
       USE dimphy
-      USE comgeomphy
 #endif
       USE comconst_mod, ONLY: daysec,dtvr,dtphys,rad,g,r,cpp
@@ -196,11 +195,11 @@
       call Read_Distrib
 
-#ifdef CPP_PHYS
-        CALL init_phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
+!#ifdef CPP_PHYS
+!        CALL init_phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
 !#endif
 !      CALL set_bands
 !#ifdef CPP_PHYS
-      CALL Init_interface_dyn_phys
-#endif
+!      CALL Init_interface_dyn_phys
+!#endif
       CALL barrier
 
@@ -497,5 +496,7 @@
 !     &                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp,
 !     &                iflag_phys)
-         CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys,
+         CALL iniphysiq(iim,jjm,llm,
+     &                distrib_phys(mpi_rank),comm_lmdz,
+     &                daysec,day_ini,dtphys/nsplit_phys,
      &                rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp,
      &                iflag_phys)
Index: trunk/LMDZ.COMMON/libf/dynphy_lonlat/calfis_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dynphy_lonlat/calfis_p.F	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/dynphy_lonlat/calfis_p.F	(revision 1543)
@@ -29,5 +29,7 @@
 ! Ehouarn: if using (parallelized) physics
       USE dimphy
-      USE mod_phys_lmdz_para, mpi_root_xx=>mpi_root 
+      USE mod_phys_lmdz_mpi_data, mpi_root_xx=>mpi_master
+      USE mod_phys_lmdz_omp_data, ONLY: klon_omp, klon_omp_begin
+      USE mod_const_mpi, ONLY: COMM_LMDZ
       USE mod_interface_dyn_phys
 !      USE IOPHY
Index: trunk/LMDZ.COMMON/libf/dynphy_lonlat/mod_interface_dyn_phys.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dynphy_lonlat/mod_interface_dyn_phys.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/dynphy_lonlat/mod_interface_dyn_phys.F90	(revision 1543)
@@ -1,4 +1,4 @@
 ! 
-! $Id: mod_interface_dyn_phys.F90 1615 2012-02-10 15:42:26Z emillour $
+! $Id: mod_interface_dyn_phys.F90 2351 2015-08-25 15:14:59Z emillour $
 !
 MODULE mod_interface_dyn_phys
@@ -7,11 +7,10 @@
   
   
-#ifdef CPP_PHYS
-! Interface with parallel physics,
 CONTAINS
   
+#ifdef CPP_PARA
+! Interface with parallel physics,
   SUBROUTINE Init_interface_dyn_phys
-    USE mod_phys_lmdz_mpi_data, ONLY: klon_mpi, is_north_pole, is_south_pole, &
-                                      ii_begin, jj_begin, ii_end, jj_end
+    USE mod_phys_lmdz_mpi_data
     IMPLICIT NONE
     include 'dimensions.h'    
@@ -55,5 +54,9 @@
   
   END SUBROUTINE Init_interface_dyn_phys 
+#else
+  SUBROUTINE Init_interface_dyn_phys
+  ! dummy routine for seq case
+  END SUBROUTINE Init_interface_dyn_phys 
 #endif
-! of #ifdef CPP_PHYS
+! of #ifdef CPP_PARA
 END MODULE mod_interface_dyn_phys
Index: trunk/LMDZ.COMMON/libf/dynphy_lonlat/phytitan/iniphysiq_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dynphy_lonlat/phytitan/iniphysiq_mod.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/dynphy_lonlat/phytitan/iniphysiq_mod.F90	(revision 1543)
@@ -6,10 +6,13 @@
 CONTAINS
 
-SUBROUTINE iniphysiq(iim,jjm,nlayer,punjours, pdayref,ptimestep,         &
-                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv,                 &
+SUBROUTINE iniphysiq(iim,jjm,nlayer, &
+                     nbp, communicator, &
+                     punjours, pdayref,ptimestep, &
+                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv, &
                      prad,pg,pr,pcpp,iflag_phys)
-  USE dimphy, ONLY: klev ! number of atmospheric levels
-  USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns
-                                        ! (on full grid)
+  USE dimphy, ONLY: init_dimphy
+  USE mod_grid_phy_lmdz, ONLY: klon_glo,  & ! number of atmospheric columns (on full grid)
+                               regular_lonlat, &  ! regular longitude-latitude grid type
+                               nbp_lon, nbp_lat, nbp_lev
   USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid)
                                 klon_omp_begin, & ! start index of local omp subgrid
@@ -17,16 +20,19 @@
                                 klon_mpi_begin ! start indes of columns (on local mpi grid)
   USE control_mod, ONLY: nday
-  USE comgeomphy, ONLY: initcomgeomphy, &
-                        airephy, & ! physics grid area (m2)
-                        cuphy, & ! cu coeff. (u_covariant = cu * u)
-                        cvphy, & ! cv coeff. (v_covariant = cv * v)
-                        rlond, & ! longitudes
-                        rlatd ! latitudes
+  USE geometry_mod, ONLY : init_geometry
+!  USE comgeomphy, ONLY: initcomgeomphy, &
+!                        airephy, & ! physics grid area (m2)
+!                        cuphy, & ! cu coeff. (u_covariant = cu * u)
+!                        cvphy, & ! cv coeff. (v_covariant = cv * v)
+!                        rlond, & ! longitudes
+!                        rlatd ! latitudes
   USE temps_mod, ONLY: annee_ref, day_ref, day_ini, day_end
   USE time_phylmdz_mod, ONLY: init_time
+  USE physics_distribution_mod, ONLY : init_physics_distribution
   USE regular_lonlat_mod, ONLY : init_regular_lonlat, &
                                  east, west, north, south, &
                                  north_east, north_west, &
                                  south_west, south_east
+  USE mod_interface_dyn_phys, ONLY :  init_interface_dyn_phys
   USE nrtype, ONLY: pi
   IMPLICIT NONE
@@ -48,4 +54,6 @@
   INTEGER, INTENT (IN) :: iim ! number of atmospheric columns along longitudes
   INTEGER, INTENT (IN) :: jjm ! number of atompsheric columns along latitudes
+  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
+  INTEGER, INTENT(IN) :: communicator ! MPI communicator
   REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
   REAL, INTENT (IN) :: rlatv(jjm) ! latitude boundaries of the physics grid
@@ -60,5 +68,5 @@
 
   INTEGER :: ibegin, iend, offset
-  INTEGER :: i,j
+  INTEGER :: i,j,k
   CHARACTER (LEN=20) :: modname = 'iniphysiq'
   CHARACTER (LEN=80) :: abort_message
@@ -70,20 +78,31 @@
 
   ! global array, on full physics grid:
-  REAL,ALLOCATABLE :: latfi(:)
-  REAL,ALLOCATABLE :: lonfi(:)
-  REAL,ALLOCATABLE :: cufi(:)
-  REAL,ALLOCATABLE :: cvfi(:)
-  REAL,ALLOCATABLE :: airefi(:)
-
-  IF (nlayer/=klev) THEN
-    WRITE (lunout, *) 'STOP in ', trim(modname)
-    WRITE (lunout, *) 'Problem with dimensions :'
-    WRITE (lunout, *) 'nlayer     = ', nlayer
-    WRITE (lunout, *) 'klev   = ', klev
-    abort_message = ''
-    CALL abort_gcm(modname, 'Problem with dimensions', 1)
-  END IF
-
-  !call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
+  REAL,ALLOCATABLE :: latfi_glo(:)
+  REAL,ALLOCATABLE :: lonfi_glo(:)
+  REAL,ALLOCATABLE :: cufi_glo(:)
+  REAL,ALLOCATABLE :: cvfi_glo(:)
+  REAL,ALLOCATABLE :: airefi_glo(:)
+  REAL,ALLOCATABLE :: boundslonfi_glo(:,:)
+  REAL,ALLOCATABLE :: boundslatfi_glo(:,:)
+
+  ! local arrays, on given MPI/OpenMP domain:
+  REAL,ALLOCATABLE,SAVE :: latfi(:)
+  REAL,ALLOCATABLE,SAVE :: lonfi(:)
+  REAL,ALLOCATABLE,SAVE :: cufi(:)
+  REAL,ALLOCATABLE,SAVE :: cvfi(:)
+  REAL,ALLOCATABLE,SAVE :: airefi(:)
+  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
+  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
+!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
+
+  ! Initialize Physics distibution and parameters and interface with dynamics
+  IF (iim*jjm>1) THEN ! general 3D case
+    CALL init_physics_distribution(regular_lonlat,4, &
+                                 nbp,iim,jjm+1,nlayer,communicator)
+  ELSE ! For 1D model
+    CALL init_physics_distribution(regular_lonlat,4, &
+                                 1,1,1,nlayer,communicator)
+  ENDIF
+  CALL init_interface_dyn_phys
   
   ! init regular global longitude-latitude grid points and boundaries
@@ -110,36 +129,64 @@
 
   ! Generate global arrays on full physics grid
-  ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
-  ALLOCATE(airefi(klon_glo))
+  ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))
+  ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))
+  ALLOCATE(airefi_glo(klon_glo))
+  ALLOCATE(boundslonfi_glo(klon_glo,4))
+  ALLOCATE(boundslatfi_glo(klon_glo,4))
 
   IF (klon_glo>1) THEN ! general case
     ! North pole
-    latfi(1)=rlatu(1)
-    lonfi(1)=0.
-    cufi(1) = cu(1)
-    cvfi(1) = cv(1)
+    latfi_glo(1)=rlatu(1)
+    lonfi_glo(1)=0.
+    cufi_glo(1) = cu(1)
+    cvfi_glo(1) = cv(1)
+    boundslonfi_glo(1,north_east)=0
+    boundslatfi_glo(1,north_east)=PI/2
+    boundslonfi_glo(1,north_west)=2*PI
+    boundslatfi_glo(1,north_west)=PI/2
+    boundslonfi_glo(1,south_west)=2*PI
+    boundslatfi_glo(1,south_west)=rlatv(1)
+    boundslonfi_glo(1,south_east)=0
+    boundslatfi_glo(1,south_east)=rlatv(1)
     DO j=2,jjm
       DO i=1,iim
-        latfi((j-2)*iim+1+i)= rlatu(j)
-        lonfi((j-2)*iim+1+i)= rlonv(i)
-        cufi((j-2)*iim+1+i) = cu((j-1)*(iim+1)+i)
-        cvfi((j-2)*iim+1+i) = cv((j-1)*(iim+1)+i)
+        k=(j-2)*iim+1+i
+        latfi_glo(k)= rlatu(j)
+        lonfi_glo(k)= rlonv(i)
+        cufi_glo(k) = cu((j-1)*(iim+1)+i)
+        cvfi_glo(k) = cv((j-1)*(iim+1)+i)
+        boundslonfi_glo(k,north_east)=rlonu(i)
+        boundslatfi_glo(k,north_east)=rlatv(j-1)
+        boundslonfi_glo(k,north_west)=rlonu(i+1)
+        boundslatfi_glo(k,north_west)=rlatv(j-1)
+        boundslonfi_glo(k,south_west)=rlonu(i+1)
+        boundslatfi_glo(k,south_west)=rlatv(j)
+        boundslonfi_glo(k,south_east)=rlonu(i)
+        boundslatfi_glo(k,south_east)=rlatv(j)
       ENDDO
     ENDDO
     ! South pole
-    latfi(klon_glo)= rlatu(jjm+1)
-    lonfi(klon_glo)= 0.
-    cufi(klon_glo) = cu((iim+1)*jjm+1)
-    cvfi(klon_glo) = cv((iim+1)*jjm-iim)
+    latfi_glo(klon_glo)= rlatu(jjm+1)
+    lonfi_glo(klon_glo)= 0.
+    cufi_glo(klon_glo) = cu((iim+1)*jjm+1)
+    cvfi_glo(klon_glo) = cv((iim+1)*jjm-iim)
+    boundslonfi_glo(klon_glo,north_east)= 0
+    boundslatfi_glo(klon_glo,north_east)= rlatv(jjm)
+    boundslonfi_glo(klon_glo,north_west)= 2*PI
+    boundslatfi_glo(klon_glo,north_west)= rlatv(jjm)
+    boundslonfi_glo(klon_glo,south_west)= 2*PI
+    boundslatfi_glo(klon_glo,south_west)= -PI/2
+    boundslonfi_glo(klon_glo,south_east)= 0
+    boundslatfi_glo(klon_glo,south_east)= -Pi/2
 
     ! build airefi(), mesh area on physics grid
-    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi)
+    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi_glo)
     ! Poles are single points on physics grid
-    airefi(1)=sum(aire(1:iim,1))
-    airefi(klon_glo)=sum(aire(1:iim,jjm+1))
+    airefi_glo(1)=sum(aire(1:iim,1))
+    airefi_glo(klon_glo)=sum(aire(1:iim,jjm+1))
 
     ! Sanity check: do total planet area match between physics and dynamics?
     total_area_dyn=sum(aire(1:iim,1:jjm+1))
-    total_area_phy=sum(airefi(1:klon_glo))
+    total_area_phy=sum(airefi_glo(1:klon_glo))
     IF (total_area_dyn/=total_area_phy) THEN
       WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
@@ -154,21 +201,39 @@
   ELSE ! klon_glo==1, running the 1D model
     ! just copy over input values
-    latfi(1)=rlatu(1)
-    lonfi(1)=rlonv(1)
-    cufi(1)=cu(1)
-    cvfi(1)=cv(1)
-    airefi(1)=aire(1,1)
+    latfi_glo(1)=rlatu(1)
+    lonfi_glo(1)=rlonv(1)
+    cufi_glo(1)=cu(1)
+    cvfi_glo(1)=cv(1)
+    airefi_glo(1)=aire(1,1)
+    boundslonfi_glo(1,north_east)=rlonu(1)
+    boundslatfi_glo(1,north_east)=PI/2
+    boundslonfi_glo(1,north_west)=rlonu(2)
+    boundslatfi_glo(1,north_west)=PI/2
+    boundslonfi_glo(1,south_west)=rlonu(2)
+    boundslatfi_glo(1,south_west)=rlatv(1)
+    boundslonfi_glo(1,south_east)=rlonu(1)
+    boundslatfi_glo(1,south_east)=rlatv(1)
   ENDIF ! of IF (klon_glo>1)
 
 !$OMP PARALLEL 
-  ! Now generate local lon/lat/cu/cv/area arrays
-  CALL initcomgeomphy
+  ! Now generate local lon/lat/cu/cv/area/bounds arrays
+  ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
+  ALLOCATE(airefi(klon_omp))
+  ALLOCATE(boundslonfi(klon_omp,4))
+  ALLOCATE(boundslatfi(klon_omp,4))
+!  CALL initcomgeomphy
 
   offset = klon_mpi_begin - 1
-  airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end)
-  cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end)
-  cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end)
-  rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end)
-  rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
+  airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+
+  ! copy over local grid longitudes and latitudes
+  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
+                     airefi,cufi,cvfi)
 
   ! Initialize some physical constants
@@ -177,4 +242,7 @@
   ! Initialize some "temporal and calendar" related variables
   CALL init_time(annee_ref,day_ref,day_ini,day_end,nday,ptimestep)
+
+  ! Initialize dimphy module
+  CALL Init_dimphy(klon_omp,nlayer)
 
 !$OMP END PARALLEL
Index: trunk/LMDZ.COMMON/libf/dynphy_lonlat/phyvenus/iniphysiq_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dynphy_lonlat/phyvenus/iniphysiq_mod.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/dynphy_lonlat/phyvenus/iniphysiq_mod.F90	(revision 1543)
@@ -6,26 +6,32 @@
 CONTAINS
 
-SUBROUTINE iniphysiq(iim,jjm,nlayer,punjours, pdayref,ptimestep,         &
-                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv,                 &
+SUBROUTINE iniphysiq(iim,jjm,nlayer, &
+                     nbp, communicator, &
+                     punjours, pdayref,ptimestep, &
+                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv, &
                      prad,pg,pr,pcpp,iflag_phys)
-  USE dimphy, ONLY: klev ! number of atmospheric levels
-  USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns
-                                        ! (on full grid)
+  USE dimphy, ONLY: init_dimphy
+  USE mod_grid_phy_lmdz, ONLY: klon_glo,  & ! number of atmospheric columns (on full grid)
+                               regular_lonlat, &  ! regular longitude-latitude grid type
+                               nbp_lon, nbp_lat, nbp_lev
   USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid)
                                 klon_omp_begin, & ! start index of local omp subgrid
                                 klon_omp_end, & ! end index of local omp subgrid
                                 klon_mpi_begin ! start indes of columns (on local mpi grid)
-  USE comgeomphy, ONLY: initcomgeomphy, &
-                        airephy, & ! physics grid area (m2)
-                        cuphy, & ! cu coeff. (u_covariant = cu * u)
-                        cvphy, & ! cv coeff. (v_covariant = cv * v)
-                        rlond, & ! longitudes
-                        rlatd ! latitudes
+  USE geometry_mod, ONLY : init_geometry
+!  USE comgeomphy, ONLY: initcomgeomphy, &
+!                        airephy, & ! physics grid area (m2)
+!                        cuphy, & ! cu coeff. (u_covariant = cu * u)
+!                        cvphy, & ! cv coeff. (v_covariant = cv * v)
+!                        rlond, & ! longitudes
+!                        rlatd ! latitudes
   USE temps_mod, ONLY: annee_ref, day_ref, day_ini, day_end
   USE time_phylmdz_mod, ONLY: init_time
+  USE physics_distribution_mod, ONLY : init_physics_distribution
   USE regular_lonlat_mod, ONLY : init_regular_lonlat, &
                                  east, west, north, south, &
                                  north_east, north_west, &
                                  south_west, south_east
+  USE mod_interface_dyn_phys, ONLY :  init_interface_dyn_phys
   USE nrtype, ONLY: pi
   IMPLICIT NONE
@@ -47,4 +53,6 @@
   INTEGER, INTENT (IN) :: iim ! number of atmospheric columns along longitudes
   INTEGER, INTENT (IN) :: jjm ! number of atompsheric columns along latitudes
+  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
+  INTEGER, INTENT(IN) :: communicator ! MPI communicator
   REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
   REAL, INTENT (IN) :: rlatv(jjm) ! latitude boundaries of the physics grid
@@ -59,5 +67,5 @@
 
   INTEGER :: ibegin, iend, offset
-  INTEGER :: i,j
+  INTEGER :: i,j,k
   CHARACTER (LEN=20) :: modname = 'iniphysiq'
   CHARACTER (LEN=80) :: abort_message
@@ -69,20 +77,31 @@
 
   ! global array, on full physics grid:
-  REAL,ALLOCATABLE :: latfi(:)
-  REAL,ALLOCATABLE :: lonfi(:)
-  REAL,ALLOCATABLE :: cufi(:)
-  REAL,ALLOCATABLE :: cvfi(:)
-  REAL,ALLOCATABLE :: airefi(:)
-
-  IF (nlayer/=klev) THEN
-    WRITE (lunout, *) 'STOP in ', trim(modname)
-    WRITE (lunout, *) 'Problem with dimensions :'
-    WRITE (lunout, *) 'nlayer     = ', nlayer
-    WRITE (lunout, *) 'klev   = ', klev
-    abort_message = ''
-    CALL abort_gcm(modname, 'Problem with dimensions', 1)
-  END IF
-
-  !call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
+  REAL,ALLOCATABLE :: latfi_glo(:)
+  REAL,ALLOCATABLE :: lonfi_glo(:)
+  REAL,ALLOCATABLE :: cufi_glo(:)
+  REAL,ALLOCATABLE :: cvfi_glo(:)
+  REAL,ALLOCATABLE :: airefi_glo(:)
+  REAL,ALLOCATABLE :: boundslonfi_glo(:,:)
+  REAL,ALLOCATABLE :: boundslatfi_glo(:,:)
+
+  ! local arrays, on given MPI/OpenMP domain:
+  REAL,ALLOCATABLE,SAVE :: latfi(:)
+  REAL,ALLOCATABLE,SAVE :: lonfi(:)
+  REAL,ALLOCATABLE,SAVE :: cufi(:)
+  REAL,ALLOCATABLE,SAVE :: cvfi(:)
+  REAL,ALLOCATABLE,SAVE :: airefi(:)
+  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
+  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
+!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
+
+  ! Initialize Physics distibution and parameters and interface with dynamics
+  IF (iim*jjm>1) THEN ! general 3D case
+    CALL init_physics_distribution(regular_lonlat,4, &
+                                 nbp,iim,jjm+1,nlayer,communicator)
+  ELSE ! For 1D model
+    CALL init_physics_distribution(regular_lonlat,4, &
+                                 1,1,1,nlayer,communicator)
+  ENDIF
+  CALL init_interface_dyn_phys
   
   ! init regular global longitude-latitude grid points and boundaries
@@ -109,36 +128,64 @@
 
   ! Generate global arrays on full physics grid
-  ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
-  ALLOCATE(airefi(klon_glo))
+  ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))
+  ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))
+  ALLOCATE(airefi_glo(klon_glo))
+  ALLOCATE(boundslonfi_glo(klon_glo,4))
+  ALLOCATE(boundslatfi_glo(klon_glo,4))
 
   IF (klon_glo>1) THEN ! general case
     ! North pole
-    latfi(1)=rlatu(1)
-    lonfi(1)=0.
-    cufi(1) = cu(1)
-    cvfi(1) = cv(1)
+    latfi_glo(1)=rlatu(1)
+    lonfi_glo(1)=0.
+    cufi_glo(1) = cu(1)
+    cvfi_glo(1) = cv(1)
+    boundslonfi_glo(1,north_east)=0
+    boundslatfi_glo(1,north_east)=PI/2
+    boundslonfi_glo(1,north_west)=2*PI
+    boundslatfi_glo(1,north_west)=PI/2
+    boundslonfi_glo(1,south_west)=2*PI
+    boundslatfi_glo(1,south_west)=rlatv(1)
+    boundslonfi_glo(1,south_east)=0
+    boundslatfi_glo(1,south_east)=rlatv(1)
     DO j=2,jjm
       DO i=1,iim
-        latfi((j-2)*iim+1+i)= rlatu(j)
-        lonfi((j-2)*iim+1+i)= rlonv(i)
-        cufi((j-2)*iim+1+i) = cu((j-1)*(iim+1)+i)
-        cvfi((j-2)*iim+1+i) = cv((j-1)*(iim+1)+i)
+        k=(j-2)*iim+1+i
+        latfi_glo(k)= rlatu(j)
+        lonfi_glo(k)= rlonv(i)
+        cufi_glo(k) = cu((j-1)*(iim+1)+i)
+        cvfi_glo(k) = cv((j-1)*(iim+1)+i)
+        boundslonfi_glo(k,north_east)=rlonu(i)
+        boundslatfi_glo(k,north_east)=rlatv(j-1)
+        boundslonfi_glo(k,north_west)=rlonu(i+1)
+        boundslatfi_glo(k,north_west)=rlatv(j-1)
+        boundslonfi_glo(k,south_west)=rlonu(i+1)
+        boundslatfi_glo(k,south_west)=rlatv(j)
+        boundslonfi_glo(k,south_east)=rlonu(i)
+        boundslatfi_glo(k,south_east)=rlatv(j)
       ENDDO
     ENDDO
     ! South pole
-    latfi(klon_glo)= rlatu(jjm+1)
-    lonfi(klon_glo)= 0.
-    cufi(klon_glo) = cu((iim+1)*jjm+1)
-    cvfi(klon_glo) = cv((iim+1)*jjm-iim)
+    latfi_glo(klon_glo)= rlatu(jjm+1)
+    lonfi_glo(klon_glo)= 0.
+    cufi_glo(klon_glo) = cu((iim+1)*jjm+1)
+    cvfi_glo(klon_glo) = cv((iim+1)*jjm-iim)
+    boundslonfi_glo(klon_glo,north_east)= 0
+    boundslatfi_glo(klon_glo,north_east)= rlatv(jjm)
+    boundslonfi_glo(klon_glo,north_west)= 2*PI
+    boundslatfi_glo(klon_glo,north_west)= rlatv(jjm)
+    boundslonfi_glo(klon_glo,south_west)= 2*PI
+    boundslatfi_glo(klon_glo,south_west)= -PI/2
+    boundslonfi_glo(klon_glo,south_east)= 0
+    boundslatfi_glo(klon_glo,south_east)= -Pi/2
 
     ! build airefi(), mesh area on physics grid
-    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi)
+    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi_glo)
     ! Poles are single points on physics grid
-    airefi(1)=sum(aire(1:iim,1))
-    airefi(klon_glo)=sum(aire(1:iim,jjm+1))
+    airefi_glo(1)=sum(aire(1:iim,1))
+    airefi_glo(klon_glo)=sum(aire(1:iim,jjm+1))
 
     ! Sanity check: do total planet area match between physics and dynamics?
     total_area_dyn=sum(aire(1:iim,1:jjm+1))
-    total_area_phy=sum(airefi(1:klon_glo))
+    total_area_phy=sum(airefi_glo(1:klon_glo))
     IF (total_area_dyn/=total_area_phy) THEN
       WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
@@ -153,21 +200,39 @@
   ELSE ! klon_glo==1, running the 1D model
     ! just copy over input values
-    latfi(1)=rlatu(1)
-    lonfi(1)=rlonv(1)
-    cufi(1)=cu(1)
-    cvfi(1)=cv(1)
-    airefi(1)=aire(1,1)
+    latfi_glo(1)=rlatu(1)
+    lonfi_glo(1)=rlonv(1)
+    cufi_glo(1)=cu(1)
+    cvfi_glo(1)=cv(1)
+    airefi_glo(1)=aire(1,1)
+    boundslonfi_glo(1,north_east)=rlonu(1)
+    boundslatfi_glo(1,north_east)=PI/2
+    boundslonfi_glo(1,north_west)=rlonu(2)
+    boundslatfi_glo(1,north_west)=PI/2
+    boundslonfi_glo(1,south_west)=rlonu(2)
+    boundslatfi_glo(1,south_west)=rlatv(1)
+    boundslonfi_glo(1,south_east)=rlonu(1)
+    boundslatfi_glo(1,south_east)=rlatv(1)
   ENDIF ! of IF (klon_glo>1)
 
 !$OMP PARALLEL 
-  ! Now generate local lon/lat/cu/cv/area arrays
-  CALL initcomgeomphy
+  ! Now generate local lon/lat/cu/cv/area/bounds arrays
+  ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
+  ALLOCATE(airefi(klon_omp))
+  ALLOCATE(boundslonfi(klon_omp,4))
+  ALLOCATE(boundslatfi(klon_omp,4))
+!  CALL initcomgeomphy
 
   offset = klon_mpi_begin - 1
-  airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end)
-  cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end)
-  cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end)
-  rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end)
-  rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
+  airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+
+  ! copy over local grid longitudes and latitudes
+  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
+                     airefi,cufi,cvfi)
 
   ! Initialize some physical constants
@@ -176,4 +241,7 @@
   ! Initialize some "temporal and calendar" related variables
   CALL init_time(annee_ref,day_ref,day_ini,day_end,ptimestep)
+
+  ! Initialize dimphy module
+  CALL Init_dimphy(klon_omp,nlayer)
 
 !$OMP END PARALLEL
Index: trunk/LMDZ.COMMON/libf/phy_common/geometry_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/geometry_mod.F90	(revision 1543)
+++ trunk/LMDZ.COMMON/libf/phy_common/geometry_mod.F90	(revision 1543)
@@ -0,0 +1,74 @@
+MODULE geometry_mod
+
+! Store informations concerning the local (to MPI/OpenMP core) geometry
+
+  REAL,SAVE,ALLOCATABLE :: longitude(:) ! longitude of the cell (rad)
+!$OMP THREADPRIVATE(longitude)
+
+  REAL,SAVE,ALLOCATABLE :: latitude(:)! latitude of the cell (rad)
+!$OMP THREADPRIVATE(latitude)
+
+  REAL,SAVE,ALLOCATABLE :: longitude_deg(:) ! longitude of the cell (degree)
+!$OMP THREADPRIVATE(longitude_deg)
+
+  REAL,SAVE,ALLOCATABLE :: latitude_deg(:)! latitude of the cell (degree)
+!$OMP THREADPRIVATE(latitude_deg)
+
+  REAL,SAVE,ALLOCATABLE :: boundslon(:,:)  ! boundaries of the cell (rad)
+!$OMP THREADPRIVATE(boundslon)
+
+  REAL,SAVE,ALLOCATABLE :: boundslat(:,:) ! boundaries of the cell (rad)
+!$OMP THREADPRIVATE(boundslat)
+
+  REAL,SAVE,ALLOCATABLE :: dx(:)      ! resolution of longitude cell (valid only for 2D grid)
+!$OMP THREADPRIVATE(dx)
+  
+  REAL,SAVE,ALLOCATABLE :: dy(:)      ! resolution of latitude cell (valid only for 2D grid)
+!$OMP THREADPRIVATE(dy)
+
+  REAL,SAVE,ALLOCATABLE :: cell_area(:)      ! area of the cell
+!$OMP THREADPRIVATE(cell_area)
+
+
+CONTAINS
+
+  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
+                           boundslon_,boundslat_, &
+                           cell_area_,dx_,dy_)
+  USE mod_grid_phy_lmdz, ONLY: nvertex
+  USE nrtype, ONLY : PI
+  IMPLICIT NONE
+    INTEGER,INTENT(IN) :: klon ! number of columns for this MPI/OpenMP domain
+    REAL,INTENT(IN) :: longitude_(klon)
+    REAL,INTENT(IN) :: latitude_(klon)
+    REAL,INTENT(IN) :: boundslon_(klon,nvertex)
+    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
+    REAL,INTENT(IN) :: cell_area_(klon)
+    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
+    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
+    
+    ALLOCATE(longitude(klon))
+    ALLOCATE(latitude(klon))
+    ALLOCATE(longitude_deg(klon))
+    ALLOCATE(latitude_deg(klon))
+    ALLOCATE(boundslon(klon,nvertex))
+    ALLOCATE(boundslat(klon,nvertex))
+    ALLOCATE(cell_area(klon))
+    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
+    IF (PRESENT(dy_))ALLOCATE(dy(klon))
+    
+    longitude(:) = longitude_(:)
+    latitude(:) = latitude_(:)
+    longitude_deg(:) = longitude(:)*180./PI
+    latitude_deg(:) = latitude(:)*180./PI
+    boundslon(:,:) = boundslon_(:,:)
+    boundslat(:,:) = boundslat_(:,:)
+    cell_area(:) = cell_area_(:)
+    IF (PRESENT(dx_)) dx(:) = dx_(:)
+    IF (PRESENT(dy_)) dy(:) = dy_(:)
+    
+  END SUBROUTINE init_geometry
+
+
+END MODULE geometry_mod
+
Index: trunk/LMDZ.COMMON/libf/phy_common/ioipsl_getin_p_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/ioipsl_getin_p_mod.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/ioipsl_getin_p_mod.F90	(revision 1543)
@@ -12,5 +12,5 @@
 USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
 USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
-use mod_phys_lmdz_para, only : bcast
+USE mod_phys_lmdz_transfert_para, ONLY : bcast
 !-
 IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/phy_common/mod_grid_phy_lmdz.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/mod_grid_phy_lmdz.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/mod_grid_phy_lmdz.F90	(revision 1543)
@@ -1,4 +1,4 @@
 !
-!$Header$
+!$Id $
 !
 MODULE mod_grid_phy_lmdz
@@ -7,9 +7,14 @@
   PRIVATE :: grid1dTo2d_glo_igen, grid1dTo2d_glo_rgen, grid1dTo2d_glo_lgen, &
              grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen
-
+  
+  INTEGER,PARAMETER :: unstructured=0
+  INTEGER,PARAMETER :: regular_lonlat=1
+
+  INTEGER,SAVE :: grid_type
+  INTEGER,SAVE :: nvertex
   INTEGER,SAVE :: nbp_lon  ! == iim
-  INTEGER,SAVE :: nbp_lat  ! == jjmp1
+  INTEGER,SAVE :: nbp_lat  ! == jjmp1 (or == 1 if running 1D model)
   INTEGER,SAVE :: nbp_lev  ! == llm
-  INTEGER,SAVE :: klon_glo
+  INTEGER,SAVE :: klon_glo ! total number of atmospheric columns
 
   INTERFACE grid1dTo2d_glo
@@ -32,15 +37,18 @@
 
 
-  SUBROUTINE init_grid_phy_lmdz(iim,jjp1,llm)
+  SUBROUTINE init_grid_phy_lmdz(grid_type_,nvertex_,nbp_lon_,nbp_lat_,nbp_lev_)
   IMPLICIT NONE
-  INTEGER, INTENT(in) :: iim
-  INTEGER, INTENT(in) :: jjp1
-  INTEGER, INTENT(in) :: llm
-  
-    nbp_lon=iim
-    nbp_lat=jjp1
-    nbp_lev=llm
-    
-    ! Ehouarn: handle 1D case:
+  INTEGER,INTENT(IN)  :: grid_type_ 
+  INTEGER,INTENT(IN)  :: nvertex_ 
+  INTEGER, INTENT(IN) :: nbp_lon_
+  INTEGER, INTENT(IN) :: nbp_lat_
+  INTEGER, INTENT(IN) :: nbp_lev_
+  
+    grid_type = grid_type_
+    nvertex   = nvertex_
+    nbp_lon   = nbp_lon_
+    nbp_lat   = nbp_lat_
+    nbp_lev   = nbp_lev_
+    
     IF (nbp_lon*nbp_lat==1) THEN
       klon_glo=1
@@ -283,7 +291,9 @@
 
 !---------------------------------------------------------------- 
-!  fonctions generiques (privees)
+!  Generic (private) fonctions
 !---------------------------------------------------------------- 
+  
   SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -320,4 +330,5 @@
 
   SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -353,4 +364,5 @@
 
   SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
     
@@ -386,4 +398,5 @@
   
   SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -408,4 +421,5 @@
   
   SUBROUTINE grid2dTo1d_glo_rgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -430,4 +444,5 @@
     
   SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_data.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_data.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_data.F90	(revision 1543)
@@ -3,5 +3,5 @@
 !
 MODULE mod_phys_lmdz_mpi_data
-  USE mod_const_mpi
+!  USE mod_const_mpi
   
   INTEGER,SAVE :: ii_begin
@@ -35,5 +35,6 @@
   INTEGER,SAVE :: mpi_rank
   INTEGER,SAVE :: mpi_size
-  INTEGER,SAVE :: mpi_root
+  INTEGER,SAVE :: mpi_master
+!  INTEGER,SAVE :: mpi_root
   LOGICAL,SAVE :: is_mpi_root
   LOGICAL,SAVE :: is_using_mpi
@@ -43,15 +44,21 @@
   LOGICAL,SAVE :: is_south_pole
   INTEGER,SAVE :: COMM_LMDZ_PHY
+  INTEGER,SAVE :: MPI_REAL_LMDZ   ! MPI_REAL8
 
 CONTAINS
   
-  SUBROUTINE init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
-  USE mod_const_mpi, ONLY : COMM_LMDZ
+!  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+  SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator)
+!  USE mod_const_mpi, ONLY : COMM_LMDZ
   IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER,INTENT(in) :: nbp
+    INTEGER,INTENT(in) :: nbp_lon
+    INTEGER,INTENT(in) :: nbp_lat
+    INTEGER,INTENT(in) :: communicator
+    
+    INTEGER,ALLOCATABLE :: distrib(:)
     INTEGER :: ierr
     INTEGER :: klon_glo
@@ -64,14 +71,17 @@
 #endif
     
-    if (iim.eq.1) then
+    if ((nbp_lon.eq.1).and.(nbp_lat.eq.1)) then ! running 1D column model
        klon_glo=1
     else
-       klon_glo=iim*(jjp1-2)+2
+    ! The usual global physics grid: 1 point for each pole and nbp_lon points
+    ! for all other latitudes
+       klon_glo=nbp_lon*(nbp_lat-2)+2
     endif
     
-    COMM_LMDZ_PHY=COMM_LMDZ
+    COMM_LMDZ_PHY=communicator
 
     IF (is_using_mpi) THEN    
 #ifdef CPP_MPI
+      MPI_REAL_LMDZ=MPI_REAL8
       CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr)    
       CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr)
@@ -82,6 +92,17 @@
     ENDIF
     
+    ALLOCATE(distrib(0:mpi_size-1))
+
+    IF (is_using_mpi) THEN    
+#ifdef CPP_MPI
+    CALL MPI_ALLGATHER(nbp,1,MPI_INTEGER,distrib,1,MPI_INTEGER,COMM_LMDZ_PHY,ierr)
+#endif
+    ELSE
+     distrib(:)=nbp
+    ENDIF
+
+
     IF (mpi_rank == 0) THEN
-      mpi_root = 0
+      mpi_master = 0
       is_mpi_root = .true.
     ENDIF
@@ -115,5 +136,5 @@
   
       
-    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:nb_proc-1)
+    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:mpi_size-1)
 
     DO i=0,mpi_size-1
@@ -132,14 +153,14 @@
         ij_para_begin(i) = 1
       ELSE
-        ij_para_begin(i) = klon_mpi_para_begin(i)+iim-1
+        ij_para_begin(i) = klon_mpi_para_begin(i)+nbp_lon-1
       ENDIF
 
-      jj_para_begin(i) = (ij_para_begin(i)-1)/iim + 1
-      ii_para_begin(i) = MOD(ij_para_begin(i)-1,iim) + 1
+      jj_para_begin(i) = (ij_para_begin(i)-1)/nbp_lon + 1
+      ii_para_begin(i) = MOD(ij_para_begin(i)-1,nbp_lon) + 1
 
       
-      ij_para_end(i) = klon_mpi_para_end(i)+iim-1
-      jj_para_end(i) = (ij_para_end(i)-1)/iim + 1
-      ii_para_end(i) = MOD(ij_para_end(i)-1,iim) + 1
+      ij_para_end(i) = klon_mpi_para_end(i)+nbp_lon-1
+      jj_para_end(i) = (ij_para_end(i)-1)/nbp_lon + 1
+      ii_para_end(i) = MOD(ij_para_end(i)-1,nbp_lon) + 1
 
 
@@ -161,9 +182,10 @@
     klon_mpi       = klon_mpi_para_nb(mpi_rank)
    
-    CALL print_module_data
-    
-  END SUBROUTINE init_phys_lmdz_mpi_data
+    CALL Print_module_data
+    
+  END SUBROUTINE Init_phys_lmdz_mpi_data
 
   SUBROUTINE print_module_data
+!  USE print_control_mod, ONLY: lunout
   IMPLICIT NONE
   INCLUDE "iniprint.h" 
@@ -193,5 +215,5 @@
     WRITE(lunout,*) 'mpi_rank =', mpi_rank
     WRITE(lunout,*) 'mpi_size =', mpi_size
-    WRITE(lunout,*) 'mpi_root =', mpi_root
+    WRITE(lunout,*) 'mpi_master =', mpi_master
     WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
     WRITE(lunout,*) 'is_north_pole =', is_north_pole
Index: trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90	(revision 1543)
@@ -9,5 +9,5 @@
                      bcast_mpi_i,bcast_mpi_i1,bcast_mpi_i2,bcast_mpi_i3,bcast_mpi_i4, &
                      bcast_mpi_r,bcast_mpi_r1,bcast_mpi_r2,bcast_mpi_r3,bcast_mpi_r4, &
-		     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
+                     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
   END INTERFACE
 
@@ -15,5 +15,5 @@
     MODULE PROCEDURE scatter_mpi_i,scatter_mpi_i1,scatter_mpi_i2,scatter_mpi_i3, &
                      scatter_mpi_r,scatter_mpi_r1,scatter_mpi_r2,scatter_mpi_r3, &
-		     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
+                     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
   END INTERFACE
 
@@ -22,5 +22,5 @@
     MODULE PROCEDURE gather_mpi_i,gather_mpi_i1,gather_mpi_i2,gather_mpi_i3, &
                      gather_mpi_r,gather_mpi_r1,gather_mpi_r2,gather_mpi_r3, &
-		     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
+                     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
   END INTERFACE
   
@@ -28,5 +28,5 @@
     MODULE PROCEDURE scatter2D_mpi_i,scatter2D_mpi_i1,scatter2D_mpi_i2,scatter2D_mpi_i3, &
                      scatter2D_mpi_r,scatter2D_mpi_r1,scatter2D_mpi_r2,scatter2D_mpi_r3, &
-		     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
+                     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
   END INTERFACE
 
@@ -34,5 +34,5 @@
     MODULE PROCEDURE gather2D_mpi_i,gather2D_mpi_i1,gather2D_mpi_i2,gather2D_mpi_i3, &
                      gather2D_mpi_r,gather2D_mpi_r1,gather2D_mpi_r2,gather2D_mpi_r3, &
-		     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
+                     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
   END INTERFACE 
   
@@ -45,5 +45,5 @@
     MODULE PROCEDURE grid1dTo2d_mpi_i,grid1dTo2d_mpi_i1,grid1dTo2d_mpi_i2,grid1dTo2d_mpi_i3, &
                      grid1dTo2d_mpi_r,grid1dTo2d_mpi_r1,grid1dTo2d_mpi_r2,grid1dTo2d_mpi_r3, &
-		     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
+                     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
  END INTERFACE 
 
@@ -51,5 +51,5 @@
     MODULE PROCEDURE grid2dTo1d_mpi_i,grid2dTo1d_mpi_i1,grid2dTo1d_mpi_i2,grid2dTo1d_mpi_i3, &
                      grid2dTo1d_mpi_r,grid2dTo1d_mpi_r1,grid2dTo1d_mpi_r2,grid2dTo1d_mpi_r3, &
-		     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
+                     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
  END INTERFACE 
     
@@ -1236,5 +1236,5 @@
 
   SUBROUTINE bcast_mpi_cgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     IMPLICIT NONE
     
@@ -1250,5 +1250,5 @@
     
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1258,9 +1258,9 @@
       
   SUBROUTINE bcast_mpi_igen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
     INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
     
 #ifdef CPP_MPI
@@ -1272,5 +1272,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1281,9 +1281,32 @@
   
   SUBROUTINE bcast_mpi_rgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
     REAL,DIMENSION(nb),INTENT(INOUT) :: Var
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+    
+  END SUBROUTINE bcast_mpi_rgen
+  
+
+
+
+  SUBROUTINE bcast_mpi_lgen(var,nb)
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
     INTEGER,INTENT(IN) :: nb
+    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
     
 #ifdef CPP_MPI
@@ -1295,28 +1318,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-    
-  END SUBROUTINE bcast_mpi_rgen
-  
-
-
-
-  SUBROUTINE bcast_mpi_lgen(var,nb)
-    USE mod_phys_lmdz_mpi_data ,  mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
-    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) RETURN
-
-#ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1326,5 +1326,5 @@
 
   SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1365,5 +1365,5 @@
 #ifdef CPP_MPI 
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_INTEGER,VarOut,klon_mpi*dimsize,   &
-                      MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1371,5 +1371,5 @@
 
   SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1409,5 +1409,5 @@
 #ifdef CPP_MPI 
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_REAL_LMDZ,VarOut,klon_mpi*dimsize,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
 
 #endif
@@ -1417,5 +1417,5 @@
   
   SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1455,5 +1455,5 @@
 #ifdef CPP_MPI
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_LOGICAL,VarOut,klon_mpi*dimsize,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1464,5 +1464,5 @@
 
   SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1493,5 +1493,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
      
@@ -1500,8 +1500,8 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs,   &
-                     MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-
-		          
+                     MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1510,5 +1510,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1518,5 +1518,5 @@
 
   SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1542,5 +1542,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
     ENDIF
@@ -1553,7 +1553,7 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-		          
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1562,5 +1562,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1570,5 +1570,5 @@
 
   SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1599,5 +1599,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
     ENDIF
@@ -1606,7 +1606,7 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-		          
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1615,5 +1615,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1625,5 +1625,5 @@
 
   SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1633,7 +1633,7 @@
 #endif
    
+    INTEGER,INTENT(IN) :: nb
     INTEGER,DIMENSION(nb),INTENT(IN) :: VarIn
     INTEGER,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER,INTENT(IN) :: nb
     INTEGER :: ierr
    
@@ -1645,5 +1645,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
             
@@ -1651,5 +1651,5 @@
   
   SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
 
@@ -1660,7 +1660,7 @@
 #endif
     
+    INTEGER,INTENT(IN) :: nb
     REAL,DIMENSION(nb),INTENT(IN) :: VarIn
     REAL,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER,INTENT(IN) :: nb
     INTEGER :: ierr
  
@@ -1671,5 +1671,5 @@
    
 #ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1707,5 +1707,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1715,5 +1715,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1751,5 +1751,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1759,5 +1759,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1796,5 +1796,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1804,5 +1804,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1901,2 +1901,3 @@
 
 END MODULE mod_phys_lmdz_mpi_transfert
+
Index: trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_data.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_data.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_data.F90	(revision 1543)
@@ -1,4 +1,4 @@
 !
-!$Id: mod_phys_lmdz_omp_data.F90 1575 2011-09-21 13:57:48Z jghattas $
+!$Id: mod_phys_lmdz_omp_data.F90 2326 2015-07-10 12:24:29Z emillour $
 !
 MODULE mod_phys_lmdz_omp_data
@@ -20,5 +20,5 @@
 CONTAINS
   
-  SUBROUTINE init_phys_lmdz_omp_data(klon_mpi)
+  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
     USE dimphy
     IMPLICIT NONE
@@ -85,9 +85,9 @@
     klon_omp_end=klon_omp_para_end(omp_rank)
     
-    CALL print_module_data
+    CALL Print_module_data
     
-  END SUBROUTINE init_phys_lmdz_omp_data
+  END SUBROUTINE Init_phys_lmdz_omp_data
 
-  SUBROUTINE print_module_data
+  SUBROUTINE Print_module_data
   IMPLICIT NONE
   INCLUDE "iniprint.h"
@@ -106,4 +106,4 @@
 !$OMP END CRITICAL
 
-  END SUBROUTINE print_module_data
+  END SUBROUTINE Print_module_data
 END MODULE mod_phys_lmdz_omp_data
Index: trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_transfert.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_transfert.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_transfert.F90	(revision 1543)
@@ -25,5 +25,5 @@
                      bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, &
                      bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, &
-		     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
+                     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
   END INTERFACE
 
@@ -31,5 +31,5 @@
     MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, &
                      scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, &
-		     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
+                     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
   END INTERFACE
 
@@ -38,5 +38,5 @@
     MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, &
                      gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, &
-		     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
+                     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
   END INTERFACE
   
@@ -48,8 +48,15 @@
 
 
-  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp
+  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, omp_barrier
 
 CONTAINS
 
+  SUBROUTINE omp_barrier
+  IMPLICIT NONE
+
+!$OMP BARRIER
+
+  END SUBROUTINE omp_barrier
+  
   SUBROUTINE check_buffer_i(buff_size)
   IMPLICIT NONE
@@ -733,7 +740,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
     INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
 
     INTEGER :: i
@@ -757,7 +764,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
     REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
 
     INTEGER :: i
@@ -780,7 +787,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
   
     INTEGER :: i
Index: trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_para.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_para.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_para.F90	(revision 1543)
@@ -16,14 +16,14 @@
 CONTAINS
 
-  SUBROUTINE init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator)
   IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+    INTEGER,INTENT(in) :: nbp
+    INTEGER,INTENT(in) :: nbp_lon
+    INTEGER,INTENT(in) :: nbp_lat
+    INTEGER,INTENT(in) :: communicator
 
-    CALL init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+    CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,communicator)
 !$OMP PARALLEL
-    CALL init_phys_lmdz_omp_data(klon_mpi)
+    CALL Init_phys_lmdz_omp_data(klon_mpi)
     klon_loc=klon_omp
     IF (is_mpi_root .AND. is_omp_root) THEN 
@@ -32,5 +32,5 @@
        is_master=.FALSE.
      ENDIF
-    CALL test_transfert
+     CALL Test_transfert
 !$OMP END PARALLEL    
      IF (is_using_mpi .OR. is_using_omp) THEN
@@ -42,7 +42,7 @@
      ENDIF
       
-  END SUBROUTINE init_phys_lmdz_para
+  END SUBROUTINE Init_phys_lmdz_para
 
-  SUBROUTINE test_transfert
+  SUBROUTINE Test_transfert
   USE mod_grid_phy_lmdz
   IMPLICIT NONE
@@ -108,5 +108,5 @@
     
      
-   END SUBROUTINE test_transfert
+   END SUBROUTINE Test_transfert
   
 END MODULE mod_phys_lmdz_para
Index: trunk/LMDZ.COMMON/libf/phy_common/physics_distribution_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/physics_distribution_mod.F90	(revision 1543)
+++ trunk/LMDZ.COMMON/libf/phy_common/physics_distribution_mod.F90	(revision 1543)
@@ -0,0 +1,71 @@
+!
+!$Id: physics_distribution_mod.F90 2351 2015-08-25 15:14:59Z emillour $
+!
+MODULE physics_distribution_mod
+
+
+CONTAINS
+
+  SUBROUTINE init_physics_distribution(grid_type, nvertex, &
+                                       nbp, nbp_lon, nbp_lat, nbp_lev, &
+                                       communicator)
+  USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para
+  USE mod_grid_phy_lmdz, ONLY: init_grid_phy_lmdz
+  IMPLICIT NONE
+    INTEGER,INTENT(IN) :: grid_type 
+    INTEGER,INTENT(IN) :: nvertex 
+    INTEGER,INTENT(IN) :: nbp           
+    INTEGER,INTENT(IN) :: nbp_lon
+    INTEGER,INTENT(IN) :: nbp_lat
+    INTEGER,INTENT(IN) :: nbp_lev
+    INTEGER,INTENT(IN) :: communicator
+
+
+    CALL init_grid_phy_lmdz(grid_type,nvertex, nbp_lon,nbp_lat,nbp_lev)
+    CALL init_phys_lmdz_para(nbp,nbp_lon, nbp_lat, communicator)
+
+  END SUBROUTINE init_physics_distribution  
+
+!SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
+!  USE mod_phys_lmdz_para, ONLY: Init_phys_lmdz_para!, klon_omp
+!  USE mod_grid_phy_lmdz, ONLY: Init_grid_phy_lmdz!, nbp_lev
+!  USE dimphy, ONLY : Init_dimphy
+!  USE infotrac_phy, ONLY : type_trac
+!#ifdef REPROBUS
+!  USE CHEM_REP, ONLY : Init_chem_rep_phys
+!#endif
+
+!  IMPLICIT NONE
+  
+!    INTEGER,INTENT(in) :: iim
+!    INTEGER,INTENT(in) :: jjp1
+!    INTEGER,INTENT(in) :: llm
+!    INTEGER,INTENT(in) :: nb_proc
+!    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+
+
+!    CALL Init_grid_phy_lmdz(iim,jjp1,llm)
+!    CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+!!$OMP PARALLEL
+!    CALL Init_dimphy(klon_omp,nbp_lev)
+!
+!! Initialization of Reprobus
+!    IF (type_trac == 'repr') THEN
+!#ifdef REPROBUS
+!       CALL Init_chem_rep_phys(klon_omp,nbp_lev)
+!#endif
+!    END IF
+!
+!!$OMP END PARALLEL
+ 
+!END SUBROUTINE Init_Phys_lmdz  
+
+
+
+
+
+
+
+
+END MODULE physics_distribution_mod
+
Index: trunk/LMDZ.COMMON/libf/phy_common/write_field_phy.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/phy_common/write_field_phy.F90	(revision 1542)
+++ trunk/LMDZ.COMMON/libf/phy_common/write_field_phy.F90	(revision 1543)
@@ -1,25 +1,26 @@
 !
-! $Header$
+! $Id: write_field_phy.F90 2342 2015-08-19 13:21:38Z emillour $
 !
 MODULE write_field_phy
 
+  ! Dump a field on the global (nbp_lon by nbp_lat) physics grid
+  
   CONTAINS 
  
     SUBROUTINE WriteField_phy(name,Field,ll)
-    USE dimphy
-    USE mod_phys_lmdz_para
-    USE mod_grid_phy_lmdz
-    USE Write_Field
+    USE mod_phys_lmdz_para, ONLY: klon_omp, is_mpi_root, &
+                                  Gather
+    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, &
+                                 Grid1Dto2D_glo
+    USE Write_Field, ONLY: WriteField
     
     IMPLICIT NONE
-    include 'dimensions.h'
-    include 'paramet.h'
 
-    character(len=*)   :: name
-    INTEGER :: ll
-    real, dimension(klon_omp,ll) :: Field
-    real,save,allocatable :: Field_tmp(:,:)
+    CHARACTER(len=*),INTENT(IN) :: name
+    INTEGER,INTENT(IN) :: ll
+    REAL,INTENT(IN) :: Field(klon_omp,ll)
+
     real, dimension(klon_glo,ll):: New_Field
-    real, dimension(iim,jjp1,ll):: Field_2d
+    real, dimension(nbp_lon,nbp_lat,ll):: Field_2d
 
     CALL Gather(Field,New_Field)
Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 1542)
+++ trunk/LMDZ.GENERIC/README	(revision 1543)
@@ -1203,3 +1203,10 @@
    comgeomphy.F90 instead
 
-
+== 22/04/2016 ==
+- Updates and cleanup wrt dynamics/physics separation:
+  Removed init_phys_lmdz.F90 and comgeomphy.F90 from phystd;
+  comgeomphy is replaced by geometry_mod (located in phy_common).
+  Added physics_distribution_mod.F90 in phy_common and
+  mod_interface_dyn_phys.F90 in dynphy_lonlat.
+  Added nrtype.F90 (contains math const. like PI, etc.) in "misc"
+
Index: trunk/LMDZ.GENERIC/libf/dyn3d/gcm.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dyn3d/gcm.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/dyn3d/gcm.F	(revision 1543)
@@ -6,4 +6,5 @@
      &                       iconser, ecritphy, idissip
 !      use comgeomphy, only: initcomgeomphy
+      USE mod_const_mpi, ONLY: COMM_LMDZ
       use filtreg_mod, only: inifilr
       USE comvert_mod, ONLY: ap,bp
@@ -155,5 +156,4 @@
       REAL dtetaecdt(ip1jmp1,llm)
       REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm)
-      REAL vnat(ip1jm,llm),unat(ip1jmp1,llm)
 
 c-----------------------------------------------------------------------
@@ -177,14 +177,4 @@
 c-----------------------------------------------------------------------
       CALL defrun_new( 99, .TRUE. )
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! FH 2008/05/02
-! A nettoyer. On ne veut qu'une ou deux routines d'interface 
-! dynamique -> physique pour l'initialisation
-!#ifdef CPP_PHYS
-      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-!      call initcomgeomphy ! now done in iniphysiq
-!#endif
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 ! Initialize tracers
@@ -260,5 +250,7 @@
 !#ifdef CPP_PHYS
 !         CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys,
-         CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys,
+         CALL iniphysiq(iim,jjm,llm,
+     &                  (jjm-1)*iim+2,comm_lmdz,
+     &                  daysec,day_ini,dtphys,
      &                  rlatu,rlatv,rlonu,rlonv,
      &                  aire,cu,cv,rad,g,r,cpp,
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/mod_interface_dyn_phys.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/mod_interface_dyn_phys.F90	(revision 1543)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/mod_interface_dyn_phys.F90	(revision 1543)
@@ -0,0 +1,62 @@
+! 
+! $Id: mod_interface_dyn_phys.F90 2351 2015-08-25 15:14:59Z emillour $
+!
+MODULE mod_interface_dyn_phys
+  INTEGER,SAVE,dimension(:),allocatable :: index_i
+  INTEGER,SAVE,dimension(:),allocatable :: index_j
+  
+  
+CONTAINS
+  
+#ifdef CPP_PARA
+! Interface with parallel physics,
+  SUBROUTINE Init_interface_dyn_phys
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    include 'dimensions.h'    
+    
+    INTEGER :: i,j,k
+    
+    ALLOCATE(index_i(klon_mpi))
+    ALLOCATE(index_j(klon_mpi))
+    
+    k=1
+    IF (is_north_pole) THEN
+      index_i(k)=1
+      index_j(k)=1
+      k=2
+    ELSE
+      DO i=ii_begin,iim
+	index_i(k)=i
+	index_j(k)=jj_begin
+	k=k+1
+       ENDDO
+    ENDIF
+    
+    DO j=jj_begin+1,jj_end-1
+      DO i=1,iim
+	index_i(k)=i
+	index_j(k)=j
+	k=k+1
+      ENDDO
+    ENDDO
+    
+    IF (is_south_pole) THEN
+      index_i(k)=1
+      index_j(k)=jj_end
+    ELSE
+      DO i=1,ii_end
+	index_i(k)=i
+	index_j(k)=jj_end
+	k=k+1
+       ENDDO
+    ENDIF
+  
+  END SUBROUTINE Init_interface_dyn_phys 
+#else
+  SUBROUTINE Init_interface_dyn_phys
+  ! dummy routine for seq case
+  END SUBROUTINE Init_interface_dyn_phys 
+#endif
+! of #ifdef CPP_PARA
+END MODULE mod_interface_dyn_phys
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90	(revision 1543)
@@ -3,11 +3,14 @@
 CONTAINS
 
-subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep,           &
-               rlatudyn,rlatvdyn,rlonudyn,rlonvdyn,airedyn,cudyn,cvdyn,  &
+subroutine iniphysiq(ii,jj,nlayer, &
+                     nbp, communicator, &
+                     punjours, pdayref,ptimestep, &
+                     rlatudyn,rlatvdyn,rlonudyn,rlonvdyn, &
+                     airedyn,cudyn,cvdyn, &
                      prad,pg,pr,pcpp,iflag_phys)
 
-use dimphy, only : klev ! number of atmospheric levels
-use mod_grid_phy_lmdz, only : klon_glo ! number of atmospheric columns
-                                       ! (on full grid)
+use dimphy, only : init_dimphy
+use mod_grid_phy_lmdz, only : klon_glo, & ! number of atmospheric columns (on full grid)
+                              regular_lonlat  ! regular longitude-latitude grid type
 use mod_phys_lmdz_para, only : klon_omp, & ! number of columns (on local omp grid)
                                klon_omp_begin, & ! start index of local omp subgrid
@@ -15,10 +18,14 @@
                                klon_mpi_begin ! start indes of columns (on local mpi grid)
 use control_mod, only: nday 
-use comgeomphy, only : initcomgeomphy, &
-                       cell_area, & ! physics grid area (m2)
-                       dx, & ! cu coeff. (u_covariant = cu * u)
-                       dy, & ! cv coeff. (v_covariant = cv * v)
-                       longitude, & ! longitudes (rad)
-                       latitude ! latitudes (rad)
+use geometry_mod, only: init_geometry, &
+                        cell_area, & ! physics grid area (m2)
+                        longitude, & ! longitudes (rad)
+                        latitude ! latitudes (rad)
+!use comgeomphy, only : initcomgeomphy, &
+!                       cell_area, & ! physics grid area (m2)
+!                       dx, & ! cu coeff. (u_covariant = cu * u)
+!                       dy, & ! cv coeff. (v_covariant = cv * v)
+!                       longitude, & ! longitudes (rad)
+!                       latitude ! latitudes (rad)
 use surf_heat_transp_mod, only: ini_surf_heat_transp
 use infotrac, only : nqtot ! number of advected tracers
@@ -26,8 +33,10 @@
 USE comvert_mod, ONLY: ap,bp,preff
 use inifis_mod, only: inifis
+use physics_distribution_mod, only: init_physics_distribution
 use regular_lonlat_mod, only: init_regular_lonlat, &
                               east, west, north, south, &
                               north_east, north_west, &
                               south_west, south_east
+use mod_interface_dyn_phys, only: init_interface_dyn_phys
 use ioipsl_getin_p_mod, only: getin_p
 
@@ -47,4 +56,6 @@
 integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes
 integer,intent(in) :: jj  ! number of atompsheric columns along latitudes
+integer,intent(in) :: nbp ! number of physics columns for this MPI process
+integer,intent(in) :: communicator ! MPI communicator
 real,intent(in) :: rlatudyn(jj+1) ! latitudes of the physics grid
 real,intent(in) :: rlatvdyn(jj) ! latitude boundaries of the physics grid
@@ -59,5 +70,5 @@
 
 integer :: ibegin,iend,offset
-integer :: i,j
+integer :: i,j,k
 character(len=20) :: modname='iniphysiq'
 character(len=80) :: abort_message
@@ -71,31 +82,28 @@
 
 ! global array, on full physics grid:
-real,allocatable :: latfi(:)
-real,allocatable :: lonfi(:)
-real,allocatable :: cufi(:)
-real,allocatable :: cvfi(:)
-real,allocatable :: airefi(:)
+real,allocatable :: latfi_glo(:)
+real,allocatable :: lonfi_glo(:)
+real,allocatable :: cufi_glo(:)
+real,allocatable :: cvfi_glo(:)
+real,allocatable :: airefi_glo(:)
+real,allocatable :: boundslonfi_glo(:,:)
+real,allocatable :: boundslatfi_glo(:,:)
+
+! local arrays, on given MPI/OpenMP domain:
+real,allocatable,save :: latfi(:)
+real,allocatable,save :: lonfi(:)
+real,allocatable,save :: cufi(:)
+real,allocatable,save :: cvfi(:)
+real,allocatable,save :: airefi(:)
+real,allocatable,save :: boundslonfi(:,:)
+real,allocatable,save :: boundslatfi(:,:)
+!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
 
 pi=2.*asin(1.0)
 
-IF (nlayer.NE.klev) THEN
-  write(*,*) 'STOP in ',trim(modname)
-  write(*,*) 'Problem with dimensions :'
-  write(*,*) 'nlayer     = ',nlayer
-  write(*,*) 'klev   = ',klev
-  abort_message = ''
-  CALL abort_gcm (modname,abort_message,1)
-ENDIF
-
-!IF (ngrid.NE.klon_glo) THEN
-!  write(*,*) 'STOP in ',trim(modname)
-!  write(*,*) 'Problem with dimensions :'
-!  write(*,*) 'ngrid     = ',ngrid
-!  write(*,*) 'klon   = ',klon_glo
-!  abort_message = ''
-!  CALL abort_gcm (modname,abort_message,1)
-!ENDIF
-
-!call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
+! Initialize Physics distibution and parameters and interface with dynamics
+CALL init_physics_distribution(regular_lonlat,4, &
+                                 nbp,ii,jj+1,nlayer,communicator)
+CALL init_interface_dyn_phys
 
 ! init regular global longitude-latitude grid points and boundaries
@@ -122,32 +130,63 @@
 
 ! Generate global arrays on full physics grid
-allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
-latfi(1)=rlatudyn(1)
-lonfi(1)=0.
-cufi(1) = cudyn(1)
-cvfi(1) = cvdyn(1)
+allocate(latfi_glo(klon_glo),lonfi_glo(klon_glo))
+allocate(cufi_glo(klon_glo),cvfi_glo(klon_glo))
+allocate(airefi_glo(klon_glo))
+allocate(boundslonfi_glo(klon_glo,4))
+allocate(boundslatfi_glo(klon_glo,4))
+
+! North pole
+latfi_glo(1)=rlatudyn(1)
+lonfi_glo(1)=0.
+cufi_glo(1) = cudyn(1)
+cvfi_glo(1) = cvdyn(1)
+boundslonfi_glo(1,north_east)=0
+boundslatfi_glo(1,north_east)=PI/2
+boundslonfi_glo(1,north_west)=2*PI
+boundslatfi_glo(1,north_west)=PI/2
+boundslonfi_glo(1,south_west)=2*PI
+boundslatfi_glo(1,south_west)=rlatvdyn(1)
+boundslonfi_glo(1,south_east)=0
+boundslatfi_glo(1,south_east)=rlatvdyn(1)
 DO j=2,jj
   DO i=1,ii
-    latfi((j-2)*ii+1+i)= rlatudyn(j)
-    lonfi((j-2)*ii+1+i)= rlonvdyn(i)
-    cufi((j-2)*ii+1+i) = cudyn((j-1)*(ii+1)+i)
-    cvfi((j-2)*ii+1+i) = cvdyn((j-1)*(ii+1)+i)
+    k=(j-2)*ii+1+i
+    latfi_glo((j-2)*ii+1+i)= rlatudyn(j)
+    lonfi_glo((j-2)*ii+1+i)= rlonvdyn(i)
+    cufi_glo((j-2)*ii+1+i) = cudyn((j-1)*(ii+1)+i)
+    cvfi_glo((j-2)*ii+1+i) = cvdyn((j-1)*(ii+1)+i)
+    boundslonfi_glo(k,north_east)=rlonudyn(i)
+    boundslatfi_glo(k,north_east)=rlatvdyn(j-1)
+    boundslonfi_glo(k,north_west)=rlonudyn(i+1)
+    boundslatfi_glo(k,north_west)=rlatvdyn(j-1)
+    boundslonfi_glo(k,south_west)=rlonudyn(i+1)
+    boundslatfi_glo(k,south_west)=rlatvdyn(j)
+    boundslonfi_glo(k,south_east)=rlonudyn(i)
+    boundslatfi_glo(k,south_east)=rlatvdyn(j)
   ENDDO
 ENDDO
-latfi(klon_glo)= rlatudyn(jj+1)
-lonfi(klon_glo)= 0.
-cufi(klon_glo) = cudyn((ii+1)*jj+1)
-cvfi(klon_glo) = cvdyn((ii+1)*jj-ii)
+! South pole
+latfi_glo(klon_glo)= rlatudyn(jj+1)
+lonfi_glo(klon_glo)= 0.
+cufi_glo(klon_glo) = cudyn((ii+1)*jj+1)
+cvfi_glo(klon_glo) = cvdyn((ii+1)*jj-ii)
+boundslonfi_glo(klon_glo,north_east)= 0
+boundslatfi_glo(klon_glo,north_east)= rlatvdyn(jj)
+boundslonfi_glo(klon_glo,north_west)= 2*PI
+boundslatfi_glo(klon_glo,north_west)= rlatvdyn(jj)
+boundslonfi_glo(klon_glo,south_west)= 2*PI
+boundslatfi_glo(klon_glo,south_west)= -PI/2
+boundslonfi_glo(klon_glo,south_east)= 0
+boundslatfi_glo(klon_glo,south_east)= -Pi/2
 
 ! build airefi(), mesh area on physics grid
-allocate(airefi(klon_glo))
-CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,airedyn,airefi)
+CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,airedyn,airefi_glo)
 ! Poles are single points on physics grid
-airefi(1)=sum(airedyn(1:ii,1))
-airefi(klon_glo)=sum(airedyn(1:ii,jj+1))
+airefi_glo(1)=sum(airedyn(1:ii,1))
+airefi_glo(klon_glo)=sum(airedyn(1:ii,jj+1))
 
 ! Sanity check: do total planet area match between physics and dynamics?
 total_area_dyn=sum(airedyn(1:ii,1:jj+1))
-total_area_phy=sum(airefi(1:klon_glo))
+total_area_phy=sum(airefi_glo(1:klon_glo))
 IF (total_area_dyn/=total_area_phy) THEN
   WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
@@ -164,15 +203,24 @@
 !$OMP PARALLEL 
 ! Now generate local lon/lat/cu/cv/area arrays
-call initcomgeomphy
-
-!!!!$OMP PARALLEL PRIVATE(ibegin,iend) & 
-!!!	!$OMP SHARED(airefi,cufi,cvfi,lonfi,latfi)
+allocate(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
+allocate(airefi(klon_omp))
+allocate(boundslonfi(klon_omp,4))
+allocate(boundslatfi(klon_omp,4))
+!call initcomgeomphy
 
 offset=klon_mpi_begin-1
-cell_area(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end)
-dx(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end)
-dy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end)
-longitude(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end)
-latitude(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end)
+airefi(1:klon_omp)=airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+cufi(1:klon_omp)=cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+cvfi(1:klon_omp)=cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+lonfi(1:klon_omp)=lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+latfi(1:klon_omp)=latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+boundslonfi(1:klon_omp,:)=boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+boundslatfi(1:klon_omp,:)=boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+
+! copy over local grid longitudes and latitudes
+CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
+                   airefi,cufi,cvfi)
+
+call init_dimphy(klon_omp,nlayer) ! Initialize dimphy module
 
 ! copy over preff , ap() and bp() 
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F	(revision 1543)
@@ -15,4 +15,7 @@
 c=======================================================================
 
+      use mod_phys_lmdz_para, only: is_parallel, is_sequential,
+     &                              is_mpi_root, is_omp_root,
+     &                              is_master
       use infotrac, only: infotrac_init, nqtot, tname
       USE tracer_h, ONLY: igcm_co2_ice, igcm_h2o_vap, igcm_h2o_ice
@@ -20,5 +23,4 @@
       USE surfdat_h, ONLY: phisfi, albedodat,
      &                     zmea, zstd, zsig, zgam, zthe
-      USE comgeomfi_h, ONLY: lati, long, area
       use datafile_mod, only: datadir, surfdir
       use ioipsl_getin_p_mod, only: getin_p
@@ -26,26 +28,23 @@
       use phyredem, only: physdem0, physdem1
       use iostart, only: open_startphy
-      use comgeomphy, only: initcomgeomphy
       use slab_ice_h, only:noceanmx
       use filtreg_mod, only: inifilr
+      USE mod_const_mpi, ONLY: COMM_LMDZ
       USE comvert_mod, ONLY: ap,bp,aps,bps,pa,preff
       USE comconst_mod, ONLY: lllm,daysec,dtvr,dtphys,cpp,kappa,
-     .			rad,omeg,g,r,pi
+     .                        rad,omeg,g,r,pi
       USE serre_mod, ONLY: alphax
       USE temps_mod, ONLY: day_ini
       USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
-      use inifis_mod, only: inifis
+      use iniphysiq_mod, only: iniphysiq
       implicit none
 
-#include "dimensions.h"
-!#include "dimphys.h"
+      include "dimensions.h"
       integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) 
-!#include "planete.h"
-#include "paramet.h"
-#include "comgeom2.h"
-!#include "control.h"
-#include "comdissnew.h"
-#include "netcdf.inc"
-!#include "advtrac.h"
+      include "paramet.h"
+      include "comgeom2.h"
+      include "comdissnew.h"
+      include "netcdf.inc"
+
 c=======================================================================
 c   Declarations
@@ -54,5 +53,5 @@
 c Variables dimension du fichier "start_archive"
 c------------------------------------
-      CHARACTER	relief*3
+      CHARACTER        relief*3
 
 
@@ -94,8 +93,8 @@
 c variable physique
 c------------------
-      REAL tsurf(ngridmx)	! surface temperature
-      REAL tsoil(ngridmx,nsoilmx) ! soil temperature
-!      REAL co2ice(ngridmx)	! CO2 ice layer
-      REAL emis(ngridmx)	! surface emissivity
+      REAL tsurf(ngridmx)        ! surface temperature
+      REAL,ALLOCATABLE :: tsoil(:,:) ! soil temperature
+!      REAL co2ice(ngridmx)        ! CO2 ice layer
+      REAL emis(ngridmx)        ! surface emissivity
       real emisread             ! added by RW
       REAL,ALLOCATABLE :: qsurf(:,:)
@@ -103,5 +102,5 @@
 !      REAL rnaturfi(ngridmx)
       real alb(iip1,jjp1),albfi(ngridmx) ! albedos
-      real ith(iip1,jjp1,nsoilmx),ithfi(ngridmx,nsoilmx) ! thermal inertia (3D)
+      real,ALLOCATABLE :: ith(:,:,:),ithfi(:,:) ! thermal inertia (3D)
       real surfith(iip1,jjp1),surfithfi(ngridmx) ! surface thermal inertia (2D)
       REAL latfi(ngridmx),lonfi(ngridmx),airefi(ngridmx)
@@ -113,5 +112,5 @@
 
       REAL rnat(ngridmx)
-      REAL tslab(ngridmx,nsoilmx) ! slab ocean temperature
+      REAL,ALLOCATABLE :: tslab(:,:) ! slab ocean temperature
       REAL pctsrf_sic(ngridmx) ! sea ice cover
       REAL tsea_ice(ngridmx) ! temperature sea_ice
@@ -145,5 +144,5 @@
       character*80      fichnom
       character*250  filestring
-      integer Lmodif,iq,thermo
+      integer Lmodif,iq
       character modif*20
       real z_reel(iip1,jjp1)
@@ -155,9 +154,7 @@
       real val, val2, val3, val4 ! to store temporary variables
       real :: iceith=2000 ! thermal inertia of subterranean ice
-      integer iref,jref
 
       INTEGER :: itau
       
-      INTEGER :: nq,numvanle
       character(len=20) :: txt ! to store some text
       character(len=50) :: surfacefile ! "surface.nc" (or equivalent file)
@@ -166,7 +163,4 @@
       real :: profile(llm+1) ! to store an atmospheric profile + surface value
 
-!     added by RW for test
-      real pmean, phi0
-
 !     added by BC for equilibrium temperature startup
       real teque
@@ -193,9 +187,15 @@
                   ! make deliberate choice of these values elsewhere.
 
+      planet_type="generic"
+
 ! initialize "serial/parallel" related stuff
-      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-      call initcomgeomphy
+! (required because we call tabfi() below, before calling iniphysiq)
+      is_sequential=.true.
+      is_parallel=.false.
+      is_mpi_root=.true.
+      is_omp_root=.true.
+      is_master=.true.
+      
 ! Load tracer number and names:
-!      call iniadvtrac(nqtot,numvanle)
       call infotrac_init
 ! allocate arrays
@@ -203,6 +203,12 @@
       allocate(qsurf(ngridmx,nqtot))
       
-      planet_type="generic"
-
+! get value of nsoilmx and allocate corresponding arrays
+      nsoilmx=18 ! default value
+      call getin_p("nsoilmx",nsoilmx)
+      
+      allocate(tsoil(ngridmx,nsoilmx))
+      allocate(ith(iip1,jjp1,nsoilmx),ithfi(ngridmx,nsoilmx))
+      allocate(tslab(ngridmx,nsoilmx))
+      
 c=======================================================================
 c   Choice of the start file(s) to use
@@ -284,15 +290,4 @@
       IF (.not. ALLOCATED(zgam)) ALLOCATE(zgam(ngridmx))
       IF (.not. ALLOCATED(zthe)) ALLOCATE(zthe(ngridmx))
-      ! ALLOCATE ARRAYS in comsoil_h (if not already done)
-      IF (.not.ALLOCATED(layer))
-     . ALLOCATE(layer(nsoilmx))
-      IF (.not.ALLOCATED(mlayer))
-     . ALLOCATE(mlayer(0:nsoilmx-1))
-      IF (.not.ALLOCATED(inertiedat))
-     . ALLOCATE(inertiedat(ngridmx,nsoilmx))
-      ! ALLOCATE ARRAYS IN comgeomfi_h (done in inifis usually)
-      IF (.not. ALLOCATED(lati)) ALLOCATE(lati(ngridmx))
-      IF (.not. ALLOCATED(long)) ALLOCATE(long(ngridmx))
-      IF (.not. ALLOCATED(area)) ALLOCATE(area(ngridmx))
 
 c-----------------------------------------------------------------------
@@ -337,5 +332,5 @@
           write(*,*) i,tab_cntrl(i)
         enddo
-	
+        
         ! Lmodif set to 0 to disable modifications possibility in phyeta0                           
         write(*,*) 'Reading file START'
@@ -355,7 +350,7 @@
         do i=1,ngridmx
           albfi(i) = albedodat(i)
-	  do j=1,nsoilmx
+          do j=1,nsoilmx
            ithfi(i,j) = inertiedat(i,j)
-	  enddo
+          enddo
         ! build a surfithfi(:) using 1st layer of ithfi(:), which might
         ! be needed later on if reinitializing soil thermal inertia
@@ -371,5 +366,5 @@
       endif
 c-----------------------------------------------------------------------
-c		Initialisation des constantes dynamique
+c                Initialisation des constantes dynamique
 c-----------------------------------------------------------------------
 
@@ -451,30 +446,11 @@
       idum=0
 
-c Initialisation coordonnees /aires
-c -------------------------------
-! Note: rlatu(:) and rlonv(:) are commons defined in "comgeom.h"
-!       rlatu() and rlonv() are given in radians
-      latfi(1)=rlatu(1)
-      lonfi(1)=0.
-      DO j=2,jjm
-         DO i=1,iim
-            latfi((j-2)*iim+1+i)=rlatu(j)
-            lonfi((j-2)*iim+1+i)=rlonv(i)
-         ENDDO
-      ENDDO
-      latfi(ngridmx)=rlatu(jjp1)
-      lonfi(ngridmx)=0.
-       
-      ! build airefi(), mesh area on physics grid
-      CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
-      ! Poles are single points on physics grid
-      airefi(1)=sum(aire(1:iim,1))
-      airefi(ngridmx)=sum(aire(1:iim,jjm+1))
-
-! also initialize various physics flags/settings which might be needed
-!    (for instance initracer needs to know about some flags, and/or
-!      'datafile' path may be changed by user)
-      call inifis(ngridmx,llm,nqtot,day_ini,daysec,dtphys,
-     &                latfi,lonfi,airefi,rad,g,r,cpp)
+! Initialize the physics
+         CALL iniphysiq(iim,jjm,llm,
+     &                  (jjm-1)*iim+2,comm_lmdz,
+     &                  daysec,day_ini,dtphys,
+     &                  rlatu,rlatv,rlonu,rlonv,
+     &                  aire,cu,cv,rad,g,r,cpp,
+     &                  1)
 
 c=======================================================================
@@ -560,7 +536,7 @@
      &   rnat,pctsrf_sic,tslab,tsea_ice,sea_ice)
         write(*,*) "OK, read start_archive file"
-	! copy soil thermal inertia
-	ithfi(:,:)=inertiedat(:,:)
-	
+        ! copy soil thermal inertia
+        ithfi(:,:)=inertiedat(:,:)
+        
         ierr= NF_CLOSE(nid)
 
@@ -727,8 +703,8 @@
           DO j=1,jjp1
              DO i=1,iip1
-                alb(i,j) = alb_bb	! albedo
-		do isoil=1,nsoilmx
-                  ith(i,j,isoil) = ith_bb	! thermal inertia
-		enddo
+                alb(i,j) = alb_bb        ! albedo
+                do isoil=1,nsoilmx
+                  ith(i,j,isoil) = ith_bb        ! thermal inertia
+                enddo
              END DO
           END DO
@@ -867,5 +843,5 @@
          if (yes.eq.'y') then
            write(*,*) 'Value?'
-		read(*,*,iostat=ierr) psea
+                read(*,*,iostat=ierr) psea
              DO i=1,iip1
                DO j=1,jjp1
@@ -874,5 +850,5 @@
                   ENDDO
                ENDDO
-		write(*,*) 'psea=',psea
+                write(*,*) 'psea=',psea
           else
             write(*,*) 'no'
@@ -1467,15 +1443,15 @@
 !       ----------------------------------------------------------------------
 
-	else if (trim(modif) .eq. 'therm_ini_s') then
+        else if (trim(modif) .eq. 'therm_ini_s') then
 !          write(*,*)"surfithfi(1):",surfithfi(1)
-	  do isoil=1,nsoilmx
-	    inertiedat(1:ngridmx,isoil)=surfithfi(1:ngridmx)
-	  enddo
+          do isoil=1,nsoilmx
+            inertiedat(1:ngridmx,isoil)=surfithfi(1:ngridmx)
+          enddo
           write(*,*)'OK: Soil thermal inertia has been reset to referenc
      &e surface values'
-!	  write(*,*)"inertiedat(1,1):",inertiedat(1,1)
-	  ithfi(:,:)=inertiedat(:,:)
-	 ! recast ithfi() onto ith()
-	 call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith)
+!          write(*,*)"inertiedat(1,1):",inertiedat(1,1)
+          ithfi(:,:)=inertiedat(:,:)
+         ! recast ithfi() onto ith()
+         call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith)
 ! Check:
 !         do i=1,iip1
@@ -1485,5 +1461,5 @@
 !             enddo
 !           enddo
-!	 enddo
+!         enddo
 
 
@@ -1660,5 +1636,5 @@
 
 c=======================================================================
-c	Formats 
+c        Formats 
 c=======================================================================
 
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F	(revision 1543)
@@ -21,25 +21,28 @@
       use infotrac, only: infotrac_init, nqtot, tname
       USE comsoil_h
-      USE comgeomfi_h, ONLY: lati, long, area
+      
+!      USE comgeomfi_h, ONLY: lati, long, area
 !      use control_mod
-      use comgeomphy, only: initcomgeomphy
+!      use comgeomphy, only: initcomgeomphy
       use slab_ice_h, only: noceanmx
 ! to use  'getin'
       USE ioipsl_getincom
       USE planete_mod, only: year_day
+      USE mod_const_mpi, ONLY: COMM_LMDZ
       USE control_mod, only: planet_type
       USE callkeys_mod, ONLY: ok_slab_ocean
       use filtreg_mod, only: inifilr
       USE comvert_mod, ONLY: ap,bp
-      USE comconst_mod, ONLY: cpp,g
+      USE comconst_mod, ONLY: daysec,dtphys,rad,g,r,cpp
       USE logic_mod, ONLY: grireg
       USE temps_mod, ONLY: day_ini
+      USE iniphysiq_mod, ONLY: iniphysiq
       implicit none
 
-#include "dimensions.h"
+      include "dimensions.h"
       integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) 
-#include "paramet.h"
-#include "comdissip.h"
-#include "comgeom.h"
+      include "paramet.h"
+      include "comdissip.h"
+      include "comgeom.h"
 !#include "control.h"
 
@@ -47,5 +50,5 @@
 !#include "planete.h"
 !#include"advtrac.h"
-#include "netcdf.inc"
+      include "netcdf.inc"
 c-----------------------------------------------------------------------
 c   Declarations
@@ -68,7 +71,7 @@
 c Variable Physiques (grille physique)
 c ------------------------------------
-      REAL tsurf(ngridmx)	! Surface temperature
-      REAL tsoil(ngridmx,nsoilmx) ! Soil temperature
-      REAL co2ice(ngridmx)	! CO2 ice layer
+      REAL tsurf(ngridmx)        ! Surface temperature
+      REAL,ALLOCATABLE :: tsoil(:,:) ! Soil temperature
+      REAL co2ice(ngridmx)        ! CO2 ice layer
       REAL q2(ngridmx,llm+1)
       REAL,ALLOCATABLE :: qsurf(:,:)
@@ -93,6 +96,6 @@
       REAL T(ip1jmp1,llm),us(ip1jmp1,llm),vs(ip1jmp1,llm)
       REAL tsurfS(ip1jmp1)
-      REAL tsoilS(ip1jmp1,nsoilmx)
-      REAL ithS(ip1jmp1,nsoilmx) ! Soil Thermal Inertia
+      REAL,ALLOCATABLE :: tsoilS(:,:)
+      REAL,ALLOCATABLE :: ithS(:,:) ! Soil Thermal Inertia
       REAL co2iceS(ip1jmp1)
       REAL q2S(ip1jmp1,llm+1)
@@ -144,14 +147,4 @@
       grireg   = .TRUE.
 
-! initialize "serial/parallel" related stuff
-      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-      call initcomgeomphy
-
-      ! ALLOCATE ARRAYS IN comgeomfi_h (usually done in inifis)
-      ! this must be here for start2archive to work
-      IF (.not. ALLOCATED(lati)) ALLOCATE(lati(ngridmx))
-      IF (.not. ALLOCATED(long)) ALLOCATE(long(ngridmx))
-      IF (.not. ALLOCATED(area)) ALLOCATE(area(ngridmx))
-
       planet_type="generic"
 
@@ -160,5 +153,4 @@
 c=======================================================================
 ! Load tracer number and names:
-!      call iniadvtrac(nqtot,numvanle)
       call infotrac_init
 
@@ -168,5 +160,5 @@
       allocate(qsurfS(ip1jmp1,nqtot))
 ! other array allocations:
-      call ini_comsoil_h(ngridmx)
+!      call ini_comsoil_h(ngridmx) ! done via iniphysiq
 
       fichnom = 'start.nc'
@@ -198,5 +190,45 @@
 
       ierr = NF_CLOSE(nid1)
+
+! Get value of the "subsurface_layers" dimension from physics start file
+      fichnom = 'startfi.nc'
+      ierr = NF_OPEN (fichnom, NF_NOWRITE,nid1)
+       IF (ierr.NE.NF_NOERR) THEN
+         write(6,*)' Pb d''ouverture du fichier'//trim(fichnom)
+        CALL ABORT
+       ENDIF
+      ierr = NF_INQ_DIMID(nid1,"subsurface_layers",varid)
+      IF (ierr .NE. NF_NOERR) THEN
+       PRINT*, "start2archive: No subsurface_layers dimension!!"
+       CALL abort
+      ENDIF
+      ierr = NF_INQ_DIMLEN(nid1,varid,nsoilmx)
+      IF (ierr .NE. NF_NOERR) THEN
+       PRINT*, "start2archive: Failed reading subsurface_layers value!!"
+       CALL abort
+      ENDIF
+      ierr = NF_CLOSE(nid1)
       
+      ! allocate arrays of nsoilmx size
+      allocate(tsoil(ngridmx,nsoilmx))
+      allocate(tsoilS(ip1jmp1,nsoilmx))
+      allocate(ithS(ip1jmp1,nsoilmx))
+
+c-----------------------------------------------------------------------
+c   Initialisations 
+c-----------------------------------------------------------------------
+
+      CALL defrun_new(99, .FALSE. )
+      call iniconst
+      call inigeom
+      call inifilr
+
+! Initialize the physics
+         CALL iniphysiq(iim,jjm,llm,
+     &                  (jjm-1)*iim+2,comm_lmdz,
+     &                  daysec,day_ini,dtphys,
+     &                  rlatu,rlatv,rlonu,rlonv,
+     &                  aire,cu,cv,rad,g,r,cpp,
+     &                  1)
 
       fichnom = 'startfi.nc'
@@ -256,12 +288,4 @@
 c *****************************************************************
 
-c-----------------------------------------------------------------------
-c   Initialisations 
-c-----------------------------------------------------------------------
-
-      CALL defrun_new(99, .FALSE. )
-      call iniconst
-      call inigeom
-      call inifilr
       CALL pression(ip1jmp1, ap, bp, ps, p3d)
       call exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf)
Index: trunk/LMDZ.GENERIC/libf/misc/nrtype.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/misc/nrtype.F90	(revision 1543)
+++ trunk/LMDZ.GENERIC/libf/misc/nrtype.F90	(revision 1543)
@@ -0,0 +1,22 @@
+MODULE nrtype
+
+  implicit none
+
+  integer, parameter:: k8 = selected_real_kind(13)
+
+  ! Frequently used mathematical constants (with precision to spare):
+
+  REAL, PARAMETER :: PI=3.141592653589793238462643383279502884197
+  REAL, PARAMETER :: PIO2=1.57079632679489661923132169163975144209858
+  REAL, PARAMETER :: TWOPI=6.283185307179586476925286766559005768394
+  REAL, PARAMETER :: SQRT2=1.41421356237309504880168872420969807856967
+  REAL, PARAMETER :: EULER=0.5772156649015328606065120900824024310422
+
+  REAL(K8), PARAMETER:: &
+       PI_D = 3.141592653589793238462643383279502884197_k8
+  REAL(K8), PARAMETER:: &
+       PIO2_D=1.57079632679489661923132169163975144209858_k8
+  REAL(K8), PARAMETER:: &
+       TWOPI_D=6.283185307179586476925286766559005768394_k8
+
+END MODULE nrtype
Index: trunk/LMDZ.GENERIC/libf/phy_common/geometry_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/geometry_mod.F90	(revision 1543)
+++ trunk/LMDZ.GENERIC/libf/phy_common/geometry_mod.F90	(revision 1543)
@@ -0,0 +1,74 @@
+MODULE geometry_mod
+
+! Store informations concerning the local (to MPI/OpenMP core) geometry
+
+  REAL,SAVE,ALLOCATABLE :: longitude(:) ! longitude of the cell (rad)
+!$OMP THREADPRIVATE(longitude)
+
+  REAL,SAVE,ALLOCATABLE :: latitude(:)! latitude of the cell (rad)
+!$OMP THREADPRIVATE(latitude)
+
+  REAL,SAVE,ALLOCATABLE :: longitude_deg(:) ! longitude of the cell (degree)
+!$OMP THREADPRIVATE(longitude_deg)
+
+  REAL,SAVE,ALLOCATABLE :: latitude_deg(:)! latitude of the cell (degree)
+!$OMP THREADPRIVATE(latitude_deg)
+
+  REAL,SAVE,ALLOCATABLE :: boundslon(:,:)  ! boundaries of the cell (rad)
+!$OMP THREADPRIVATE(boundslon)
+
+  REAL,SAVE,ALLOCATABLE :: boundslat(:,:) ! boundaries of the cell (rad)
+!$OMP THREADPRIVATE(boundslat)
+
+  REAL,SAVE,ALLOCATABLE :: dx(:)      ! resolution of longitude cell (valid only for 2D grid)
+!$OMP THREADPRIVATE(dx)
+  
+  REAL,SAVE,ALLOCATABLE :: dy(:)      ! resolution of latitude cell (valid only for 2D grid)
+!$OMP THREADPRIVATE(dy)
+
+  REAL,SAVE,ALLOCATABLE :: cell_area(:)      ! area of the cell
+!$OMP THREADPRIVATE(cell_area)
+
+
+CONTAINS
+
+  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
+                           boundslon_,boundslat_, &
+                           cell_area_,dx_,dy_)
+  USE mod_grid_phy_lmdz, ONLY: nvertex
+  USE nrtype, ONLY : PI
+  IMPLICIT NONE
+    INTEGER,INTENT(IN) :: klon ! number of columns for this MPI/OpenMP domain
+    REAL,INTENT(IN) :: longitude_(klon)
+    REAL,INTENT(IN) :: latitude_(klon)
+    REAL,INTENT(IN) :: boundslon_(klon,nvertex)
+    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
+    REAL,INTENT(IN) :: cell_area_(klon)
+    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
+    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
+    
+    ALLOCATE(longitude(klon))
+    ALLOCATE(latitude(klon))
+    ALLOCATE(longitude_deg(klon))
+    ALLOCATE(latitude_deg(klon))
+    ALLOCATE(boundslon(klon,nvertex))
+    ALLOCATE(boundslat(klon,nvertex))
+    ALLOCATE(cell_area(klon))
+    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
+    IF (PRESENT(dy_))ALLOCATE(dy(klon))
+    
+    longitude(:) = longitude_(:)
+    latitude(:) = latitude_(:)
+    longitude_deg(:) = longitude(:)*180./PI
+    latitude_deg(:) = latitude(:)*180./PI
+    boundslon(:,:) = boundslon_(:,:)
+    boundslat(:,:) = boundslat_(:,:)
+    cell_area(:) = cell_area_(:)
+    IF (PRESENT(dx_)) dx(:) = dx_(:)
+    IF (PRESENT(dy_)) dy(:) = dy_(:)
+    
+  END SUBROUTINE init_geometry
+
+
+END MODULE geometry_mod
+
Index: trunk/LMDZ.GENERIC/libf/phy_common/ioipsl_getin_p_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/ioipsl_getin_p_mod.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phy_common/ioipsl_getin_p_mod.F90	(revision 1543)
@@ -12,5 +12,5 @@
 USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
 USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
-use mod_phys_lmdz_para, only : bcast
+USE mod_phys_lmdz_transfert_para, ONLY : bcast
 !-
 IMPLICIT NONE
Index: trunk/LMDZ.GENERIC/libf/phy_common/mod_grid_phy_lmdz.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/mod_grid_phy_lmdz.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phy_common/mod_grid_phy_lmdz.F90	(revision 1543)
@@ -1,4 +1,4 @@
 !
-!$Header$
+!$Id $
 !
 MODULE mod_grid_phy_lmdz
@@ -7,10 +7,14 @@
   PRIVATE :: grid1dTo2d_glo_igen, grid1dTo2d_glo_rgen, grid1dTo2d_glo_lgen, &
              grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen
-
+  
+  INTEGER,PARAMETER :: unstructured=0
+  INTEGER,PARAMETER :: regular_lonlat=1
+
+  INTEGER,SAVE :: grid_type
+  INTEGER,SAVE :: nvertex
   INTEGER,SAVE :: nbp_lon  ! == iim
-  INTEGER,SAVE :: nbp_lat  ! == jjmp1
+  INTEGER,SAVE :: nbp_lat  ! == jjmp1 (or == 1 if running 1D model)
   INTEGER,SAVE :: nbp_lev  ! == llm
-  INTEGER,SAVE :: klon_glo
-!$OMP THREADPRIVATE(nbp_lon,nbp_lat,nbp_lev,klon_glo)
+  INTEGER,SAVE :: klon_glo ! total number of atmospheric columns
 
   INTERFACE grid1dTo2d_glo
@@ -33,20 +37,23 @@
 
 
-  SUBROUTINE init_grid_phy_lmdz(iim,jjp1,llm)
+  SUBROUTINE init_grid_phy_lmdz(grid_type_,nvertex_,nbp_lon_,nbp_lat_,nbp_lev_)
   IMPLICIT NONE
-  INTEGER, INTENT(in) :: iim
-  INTEGER, INTENT(in) :: jjp1
-  INTEGER, INTENT(in) :: llm
-  
-    nbp_lon=iim
-    nbp_lat=jjp1
-    nbp_lev=llm
-    klon_glo=(iim*jjp1)-2*(iim-1)
-  
-  ! Ehouarn: handle 1D case:
-  if ((iim.eq.1).and.(jjp1.eq.2)) then
-    nbp_lat=1
-    klon_glo=1
-  endif
+  INTEGER,INTENT(IN)  :: grid_type_ 
+  INTEGER,INTENT(IN)  :: nvertex_ 
+  INTEGER, INTENT(IN) :: nbp_lon_
+  INTEGER, INTENT(IN) :: nbp_lat_
+  INTEGER, INTENT(IN) :: nbp_lev_
+  
+    grid_type = grid_type_
+    nvertex   = nvertex_
+    nbp_lon   = nbp_lon_
+    nbp_lat   = nbp_lat_
+    nbp_lev   = nbp_lev_
+    
+    IF (nbp_lon*nbp_lat==1) THEN
+      klon_glo=1
+    ELSE    
+      klon_glo=(nbp_lon*nbp_lat)-2*(nbp_lon-1)
+    ENDIF
   
   END SUBROUTINE init_grid_phy_lmdz
@@ -284,7 +291,9 @@
 
 !---------------------------------------------------------------- 
-!  fonctions generiques (privees)
+!  Generic (private) fonctions
 !---------------------------------------------------------------- 
+  
   SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -321,4 +330,5 @@
 
   SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -354,4 +364,5 @@
 
   SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
     
@@ -387,4 +398,5 @@
   
   SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -409,4 +421,5 @@
   
   SUBROUTINE grid2dTo1d_glo_rgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -431,4 +444,5 @@
     
   SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
Index: trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_data.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_data.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_data.F90	(revision 1543)
@@ -3,5 +3,5 @@
 !
 MODULE mod_phys_lmdz_mpi_data
-  USE mod_const_mpi, only: MPI_REAL_LMDZ, COMM_LMDZ
+!  USE mod_const_mpi
   
   INTEGER,SAVE :: ii_begin
@@ -16,6 +16,4 @@
   INTEGER,SAVE :: klon_mpi_end
   INTEGER,SAVE :: klon_mpi
-!!$OMP THREADPRIVATE(ii_begin,ii_end,jj_begin,jj_end,jj_nb,ij_begin,&
-!	!$OMP ij_end,ij_nb,klon_mpi_begin,klon_mpi_end,klon_mpi)
   
   INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb
@@ -33,15 +31,12 @@
   INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_begin
   INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_end 
-!!$OMP THREADPRIVATE(jj_para_nb,jj_para_begin,jj_para_end,ii_para_begin,ii_para_end,&
-!	!$OMP ij_para_nb,ij_para_begin,ij_para_end,klon_mpi_para_nb,klon_mpi_para_begin,&
-!	!$OMP klon_mpi_para_end)
 
   
   INTEGER,SAVE :: mpi_rank
   INTEGER,SAVE :: mpi_size
-  INTEGER,SAVE :: mpi_root
+  INTEGER,SAVE :: mpi_master
+!  INTEGER,SAVE :: mpi_root
   LOGICAL,SAVE :: is_mpi_root
   LOGICAL,SAVE :: is_using_mpi
-!!$OMP THREADPRIVATE(mpi_rank,mpi_size,mpi_root,is_mpi_root,is_using_mpi)
   
   
@@ -49,16 +44,21 @@
   LOGICAL,SAVE :: is_south_pole
   INTEGER,SAVE :: COMM_LMDZ_PHY
-!!$OMP THREADPRIVATE(is_north_pole,is_south_pole,COMM_LMDZ_PHY)
+  INTEGER,SAVE :: MPI_REAL_LMDZ   ! MPI_REAL8
 
 CONTAINS
   
-  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
-  USE mod_const_mpi, ONLY : COMM_LMDZ
+!  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+  SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator)
+!  USE mod_const_mpi, ONLY : COMM_LMDZ
   IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER,INTENT(in) :: nbp
+    INTEGER,INTENT(in) :: nbp_lon
+    INTEGER,INTENT(in) :: nbp_lat
+    INTEGER,INTENT(in) :: communicator
+    
+    INTEGER,ALLOCATABLE :: distrib(:)
     INTEGER :: ierr
     INTEGER :: klon_glo
@@ -71,14 +71,17 @@
 #endif
     
-    if (iim.eq.1) then
+    if ((nbp_lon.eq.1).and.(nbp_lat.eq.1)) then ! running 1D column model
        klon_glo=1
     else
-       klon_glo=iim*(jjp1-2)+2
+    ! The usual global physics grid: 1 point for each pole and nbp_lon points
+    ! for all other latitudes
+       klon_glo=nbp_lon*(nbp_lat-2)+2
     endif
     
-    COMM_LMDZ_PHY=COMM_LMDZ
+    COMM_LMDZ_PHY=communicator
 
     IF (is_using_mpi) THEN    
 #ifdef CPP_MPI
+      MPI_REAL_LMDZ=MPI_REAL8
       CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr)    
       CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr)
@@ -89,6 +92,17 @@
     ENDIF
     
+    ALLOCATE(distrib(0:mpi_size-1))
+
+    IF (is_using_mpi) THEN    
+#ifdef CPP_MPI
+    CALL MPI_ALLGATHER(nbp,1,MPI_INTEGER,distrib,1,MPI_INTEGER,COMM_LMDZ_PHY,ierr)
+#endif
+    ELSE
+     distrib(:)=nbp
+    ENDIF
+
+
     IF (mpi_rank == 0) THEN
-      mpi_root = 0
+      mpi_master = 0
       is_mpi_root = .true.
     ENDIF
@@ -122,5 +136,5 @@
   
       
-    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:nb_proc-1)
+    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:mpi_size-1)
 
     DO i=0,mpi_size-1
@@ -139,23 +153,15 @@
         ij_para_begin(i) = 1
       ELSE
-        ij_para_begin(i) = klon_mpi_para_begin(i)+iim-1
+        ij_para_begin(i) = klon_mpi_para_begin(i)+nbp_lon-1
       ENDIF
 
-      jj_para_begin(i) = (ij_para_begin(i)-1)/iim + 1
-      ii_para_begin(i) = MOD(ij_para_begin(i)-1,iim) + 1
+      jj_para_begin(i) = (ij_para_begin(i)-1)/nbp_lon + 1
+      ii_para_begin(i) = MOD(ij_para_begin(i)-1,nbp_lon) + 1
 
       
-      ij_para_end(i) = klon_mpi_para_end(i)+iim-1
-      jj_para_end(i) = (ij_para_end(i)-1)/iim + 1
-      ii_para_end(i) = MOD(ij_para_end(i)-1,iim) + 1
-
-      ! Ehouarn: handle 1D case:
-      if (klon_glo.eq.1) then
-        klon_mpi_para_end(i) = 1
-        klon_mpi_para_nb(i) = 1
-        ij_para_end(i) = 1
-        jj_para_end(i) = 1
-        ii_para_end(i) = 1
-      endif
+      ij_para_end(i) = klon_mpi_para_end(i)+nbp_lon-1
+      jj_para_end(i) = (ij_para_end(i)-1)/nbp_lon + 1
+      ii_para_end(i) = MOD(ij_para_end(i)-1,nbp_lon) + 1
+
 
       ij_para_nb(i) = ij_para_end(i)-ij_para_begin(i)+1
@@ -181,36 +187,37 @@
 
   SUBROUTINE print_module_data
+!  USE print_control_mod, ONLY: lunout
   IMPLICIT NONE
-!  INCLUDE "iniprint.h" 
-  
-    WRITE(*,*) 'ii_begin =', ii_begin
-    WRITE(*,*) 'ii_end =', ii_end
-    WRITE(*,*) 'jj_begin =',jj_begin
-    WRITE(*,*) 'jj_end =', jj_end
-    WRITE(*,*) 'jj_nb =', jj_nb
-    WRITE(*,*) 'ij_begin =', ij_begin
-    WRITE(*,*) 'ij_end =', ij_end
-    WRITE(*,*) 'ij_nb =', ij_nb
-    WRITE(*,*) 'klon_mpi_begin =', klon_mpi_begin
-    WRITE(*,*) 'klon_mpi_end =', klon_mpi_end
-    WRITE(*,*) 'klon_mpi =', klon_mpi
-    WRITE(*,*) 'jj_para_nb =', jj_para_nb
-    WRITE(*,*) 'jj_para_begin =', jj_para_begin
-    WRITE(*,*) 'jj_para_end =', jj_para_end
-    WRITE(*,*) 'ii_para_begin =', ii_para_begin
-    WRITE(*,*) 'ii_para_end =', ii_para_end
-    WRITE(*,*) 'ij_para_nb =', ij_para_nb
-    WRITE(*,*) 'ij_para_begin =', ij_para_begin
-    WRITE(*,*) 'ij_para_end =', ij_para_end
-    WRITE(*,*) 'klon_mpi_para_nb =', klon_mpi_para_nb
-    WRITE(*,*) 'klon_mpi_para_begin =', klon_mpi_para_begin
-    WRITE(*,*) 'klon_mpi_para_end  =', klon_mpi_para_end 
-    WRITE(*,*) 'mpi_rank =', mpi_rank
-    WRITE(*,*) 'mpi_size =', mpi_size
-    WRITE(*,*) 'mpi_root =', mpi_root
-    WRITE(*,*) 'is_mpi_root =', is_mpi_root
-    WRITE(*,*) 'is_north_pole =', is_north_pole
-    WRITE(*,*) 'is_south_pole =', is_south_pole
-    WRITE(*,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
+  INCLUDE "iniprint.h" 
+  
+    WRITE(lunout,*) 'ii_begin =', ii_begin
+    WRITE(lunout,*) 'ii_end =', ii_end
+    WRITE(lunout,*) 'jj_begin =',jj_begin
+    WRITE(lunout,*) 'jj_end =', jj_end
+    WRITE(lunout,*) 'jj_nb =', jj_nb
+    WRITE(lunout,*) 'ij_begin =', ij_begin
+    WRITE(lunout,*) 'ij_end =', ij_end
+    WRITE(lunout,*) 'ij_nb =', ij_nb
+    WRITE(lunout,*) 'klon_mpi_begin =', klon_mpi_begin
+    WRITE(lunout,*) 'klon_mpi_end =', klon_mpi_end
+    WRITE(lunout,*) 'klon_mpi =', klon_mpi
+    WRITE(lunout,*) 'jj_para_nb =', jj_para_nb
+    WRITE(lunout,*) 'jj_para_begin =', jj_para_begin
+    WRITE(lunout,*) 'jj_para_end =', jj_para_end
+    WRITE(lunout,*) 'ii_para_begin =', ii_para_begin
+    WRITE(lunout,*) 'ii_para_end =', ii_para_end
+    WRITE(lunout,*) 'ij_para_nb =', ij_para_nb
+    WRITE(lunout,*) 'ij_para_begin =', ij_para_begin
+    WRITE(lunout,*) 'ij_para_end =', ij_para_end
+    WRITE(lunout,*) 'klon_mpi_para_nb =', klon_mpi_para_nb
+    WRITE(lunout,*) 'klon_mpi_para_begin =', klon_mpi_para_begin
+    WRITE(lunout,*) 'klon_mpi_para_end  =', klon_mpi_para_end 
+    WRITE(lunout,*) 'mpi_rank =', mpi_rank
+    WRITE(lunout,*) 'mpi_size =', mpi_size
+    WRITE(lunout,*) 'mpi_master =', mpi_master
+    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
+    WRITE(lunout,*) 'is_north_pole =', is_north_pole
+    WRITE(lunout,*) 'is_south_pole =', is_south_pole
+    WRITE(lunout,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
   
   END SUBROUTINE print_module_data
Index: trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90	(revision 1543)
@@ -9,5 +9,5 @@
                      bcast_mpi_i,bcast_mpi_i1,bcast_mpi_i2,bcast_mpi_i3,bcast_mpi_i4, &
                      bcast_mpi_r,bcast_mpi_r1,bcast_mpi_r2,bcast_mpi_r3,bcast_mpi_r4, &
-		     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
+                     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
   END INTERFACE
 
@@ -15,5 +15,5 @@
     MODULE PROCEDURE scatter_mpi_i,scatter_mpi_i1,scatter_mpi_i2,scatter_mpi_i3, &
                      scatter_mpi_r,scatter_mpi_r1,scatter_mpi_r2,scatter_mpi_r3, &
-		     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
+                     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
   END INTERFACE
 
@@ -22,5 +22,5 @@
     MODULE PROCEDURE gather_mpi_i,gather_mpi_i1,gather_mpi_i2,gather_mpi_i3, &
                      gather_mpi_r,gather_mpi_r1,gather_mpi_r2,gather_mpi_r3, &
-		     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
+                     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
   END INTERFACE
   
@@ -28,5 +28,5 @@
     MODULE PROCEDURE scatter2D_mpi_i,scatter2D_mpi_i1,scatter2D_mpi_i2,scatter2D_mpi_i3, &
                      scatter2D_mpi_r,scatter2D_mpi_r1,scatter2D_mpi_r2,scatter2D_mpi_r3, &
-		     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
+                     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
   END INTERFACE
 
@@ -34,5 +34,5 @@
     MODULE PROCEDURE gather2D_mpi_i,gather2D_mpi_i1,gather2D_mpi_i2,gather2D_mpi_i3, &
                      gather2D_mpi_r,gather2D_mpi_r1,gather2D_mpi_r2,gather2D_mpi_r3, &
-		     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
+                     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
   END INTERFACE 
   
@@ -45,5 +45,5 @@
     MODULE PROCEDURE grid1dTo2d_mpi_i,grid1dTo2d_mpi_i1,grid1dTo2d_mpi_i2,grid1dTo2d_mpi_i3, &
                      grid1dTo2d_mpi_r,grid1dTo2d_mpi_r1,grid1dTo2d_mpi_r2,grid1dTo2d_mpi_r3, &
-		     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
+                     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
  END INTERFACE 
 
@@ -51,5 +51,5 @@
     MODULE PROCEDURE grid2dTo1d_mpi_i,grid2dTo1d_mpi_i1,grid2dTo1d_mpi_i2,grid2dTo1d_mpi_i3, &
                      grid2dTo1d_mpi_r,grid2dTo1d_mpi_r1,grid2dTo1d_mpi_r2,grid2dTo1d_mpi_r3, &
-		     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
+                     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
  END INTERFACE 
     
@@ -514,5 +514,5 @@
 
   SUBROUTINE scatter2D_mpi_i(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -528,5 +528,5 @@
 
   SUBROUTINE scatter2D_mpi_i1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -541,5 +541,5 @@
 
   SUBROUTINE scatter2D_mpi_i2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -555,5 +555,5 @@
   
   SUBROUTINE scatter2D_mpi_i3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -570,5 +570,5 @@
 
   SUBROUTINE scatter2D_mpi_r(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -585,5 +585,5 @@
 
   SUBROUTINE scatter2D_mpi_r1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
     REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
@@ -599,5 +599,5 @@
 
   SUBROUTINE scatter2D_mpi_r2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -613,5 +613,5 @@
   
   SUBROUTINE scatter2D_mpi_r3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -628,5 +628,5 @@
   
   SUBROUTINE scatter2D_mpi_l(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -643,5 +643,5 @@
 
   SUBROUTINE scatter2D_mpi_l1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -658,5 +658,5 @@
 
   SUBROUTINE scatter2D_mpi_l2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -672,5 +672,5 @@
   
   SUBROUTINE scatter2D_mpi_l3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -691,5 +691,5 @@
 
   SUBROUTINE gather2D_mpi_i(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -705,5 +705,5 @@
 
   SUBROUTINE gather2D_mpi_i1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -719,5 +719,5 @@
 
   SUBROUTINE gather2D_mpi_i2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -733,5 +733,5 @@
   
   SUBROUTINE gather2D_mpi_i3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -749,5 +749,5 @@
 
   SUBROUTINE gather2D_mpi_r(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -763,5 +763,5 @@
 
   SUBROUTINE gather2D_mpi_r1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -777,5 +777,5 @@
 
   SUBROUTINE gather2D_mpi_r2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -791,5 +791,5 @@
   
   SUBROUTINE gather2D_mpi_r3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -807,5 +807,5 @@
   
   SUBROUTINE gather2D_mpi_l(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -821,5 +821,5 @@
 
   SUBROUTINE gather2D_mpi_l1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -835,5 +835,5 @@
 
   SUBROUTINE gather2D_mpi_l2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -849,5 +849,5 @@
   
   SUBROUTINE gather2D_mpi_l3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -1236,5 +1236,5 @@
 
   SUBROUTINE bcast_mpi_cgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     IMPLICIT NONE
     
@@ -1250,5 +1250,5 @@
     
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1258,9 +1258,9 @@
       
   SUBROUTINE bcast_mpi_igen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
     INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
     
 #ifdef CPP_MPI
@@ -1272,5 +1272,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1281,9 +1281,32 @@
   
   SUBROUTINE bcast_mpi_rgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
     REAL,DIMENSION(nb),INTENT(INOUT) :: Var
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+    
+  END SUBROUTINE bcast_mpi_rgen
+  
+
+
+
+  SUBROUTINE bcast_mpi_lgen(var,nb)
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
     INTEGER,INTENT(IN) :: nb
+    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
     
 #ifdef CPP_MPI
@@ -1295,32 +1318,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-    
-  END SUBROUTINE bcast_mpi_rgen
-  
-
-
-
-  SUBROUTINE bcast_mpi_lgen(var,nb)
-    USE mod_phys_lmdz_mpi_data ,  mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
-    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) RETURN
-
-#ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_root_x,COMM_LMDZ_PHY,ierr)
-    if (ierr.ne.MPI_SUCCESS) then
-      write(*,*) "bcast_mpi error: ierr=",ierr
-      stop
-    endif
+    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1330,5 +1326,5 @@
 
   SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1369,5 +1365,5 @@
 #ifdef CPP_MPI 
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_INTEGER,VarOut,klon_mpi*dimsize,   &
-                      MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1375,5 +1371,5 @@
 
   SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1413,5 +1409,5 @@
 #ifdef CPP_MPI 
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_REAL_LMDZ,VarOut,klon_mpi*dimsize,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
 
 #endif
@@ -1421,5 +1417,5 @@
   
   SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1459,5 +1455,5 @@
 #ifdef CPP_MPI
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_LOGICAL,VarOut,klon_mpi*dimsize,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1468,5 +1464,5 @@
 
   SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1497,5 +1493,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
      
@@ -1504,8 +1500,8 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs,   &
-                     MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-
-		          
+                     MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1514,5 +1510,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1522,5 +1518,5 @@
 
   SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1546,5 +1542,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
     ENDIF
@@ -1557,7 +1553,7 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-		          
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1566,5 +1562,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1574,5 +1570,5 @@
 
   SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1603,5 +1599,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
     ENDIF
@@ -1610,7 +1606,7 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-		          
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1619,5 +1615,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1629,5 +1625,5 @@
 
   SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1637,7 +1633,7 @@
 #endif
    
+    INTEGER,INTENT(IN) :: nb
     INTEGER,DIMENSION(nb),INTENT(IN) :: VarIn
     INTEGER,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER,INTENT(IN) :: nb
     INTEGER :: ierr
    
@@ -1649,5 +1645,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
             
@@ -1655,5 +1651,5 @@
   
   SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
 
@@ -1664,7 +1660,7 @@
 #endif
     
+    INTEGER,INTENT(IN) :: nb
     REAL,DIMENSION(nb),INTENT(IN) :: VarIn
     REAL,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER,INTENT(IN) :: nb
     INTEGER :: ierr
  
@@ -1675,5 +1671,5 @@
    
 #ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1711,5 +1707,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1719,5 +1715,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1755,5 +1751,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1763,5 +1759,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1800,5 +1796,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1808,5 +1804,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1905,2 +1901,3 @@
 
 END MODULE mod_phys_lmdz_mpi_transfert
+
Index: trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_omp_data.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_omp_data.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_omp_data.F90	(revision 1543)
@@ -1,4 +1,4 @@
 !
-!$Id: mod_phys_lmdz_omp_data.F90 1575 2011-09-21 13:57:48Z jghattas $
+!$Id: mod_phys_lmdz_omp_data.F90 2326 2015-07-10 12:24:29Z emillour $
 !
 MODULE mod_phys_lmdz_omp_data
@@ -91,17 +91,17 @@
   SUBROUTINE Print_module_data
   IMPLICIT NONE
-!  INCLUDE "iniprint.h"
+  INCLUDE "iniprint.h"
 
 !$OMP CRITICAL  
-  WRITE(*,*)'--------> TASK ',omp_rank
-  WRITE(*,*)'omp_size =',omp_size
-  WRITE(*,*)'omp_rank =',omp_rank
-  WRITE(*,*)'is_omp_root =',is_omp_root
-  WRITE(*,*)'klon_omp_para_nb =',klon_omp_para_nb
-  WRITE(*,*)'klon_omp_para_begin =',klon_omp_para_begin
-  WRITE(*,*)'klon_omp_para_end =',klon_omp_para_end    
-  WRITE(*,*)'klon_omp =',klon_omp
-  WRITE(*,*)'klon_omp_begin =',klon_omp_begin
-  WRITE(*,*)'klon_omp_end =',klon_omp_end    
+  WRITE(lunout,*)'--------> TASK ',omp_rank
+  WRITE(lunout,*)'omp_size =',omp_size
+  WRITE(lunout,*)'omp_rank =',omp_rank
+  WRITE(lunout,*)'is_omp_root =',is_omp_root
+  WRITE(lunout,*)'klon_omp_para_nb =',klon_omp_para_nb
+  WRITE(lunout,*)'klon_omp_para_begin =',klon_omp_para_begin
+  WRITE(lunout,*)'klon_omp_para_end =',klon_omp_para_end    
+  WRITE(lunout,*)'klon_omp =',klon_omp
+  WRITE(lunout,*)'klon_omp_begin =',klon_omp_begin
+  WRITE(lunout,*)'klon_omp_end =',klon_omp_end    
 !$OMP END CRITICAL
 
Index: trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_omp_transfert.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_omp_transfert.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_omp_transfert.F90	(revision 1543)
@@ -25,5 +25,5 @@
                      bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, &
                      bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, &
-		     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
+                     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
   END INTERFACE
 
@@ -31,5 +31,5 @@
     MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, &
                      scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, &
-		     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
+                     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
   END INTERFACE
 
@@ -38,5 +38,5 @@
     MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, &
                      gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, &
-		     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
+                     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
   END INTERFACE
   
@@ -48,8 +48,15 @@
 
 
-  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp
+  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, omp_barrier
 
 CONTAINS
 
+  SUBROUTINE omp_barrier
+  IMPLICIT NONE
+
+!$OMP BARRIER
+
+  END SUBROUTINE omp_barrier
+  
   SUBROUTINE check_buffer_i(buff_size)
   IMPLICIT NONE
@@ -733,7 +740,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
     INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
 
     INTEGER :: i
@@ -757,7 +764,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
     REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
 
     INTEGER :: i
@@ -780,7 +787,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
   
     INTEGER :: i
@@ -802,5 +809,5 @@
 
   SUBROUTINE scatter_omp_igen(VarIn,VarOut,dimsize,Buff)
-    USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+    USE mod_phys_lmdz_omp_data
     USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
     IMPLICIT NONE
@@ -833,5 +840,5 @@
 
   SUBROUTINE scatter_omp_rgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -864,5 +871,5 @@
 
   SUBROUTINE scatter_omp_lgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -898,5 +905,5 @@
 
   SUBROUTINE gather_omp_igen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -930,5 +937,5 @@
 
   SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -962,5 +969,5 @@
 
   SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
Index: trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_para.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_para.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_para.F90	(revision 1543)
@@ -13,16 +13,15 @@
   
 !$OMP THREADPRIVATE(klon_loc,is_master)
-!$OMP THREADPRIVATE(is_sequential,is_parallel)
   
 CONTAINS
 
-  SUBROUTINE Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator)
   IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+    INTEGER,INTENT(in) :: nbp
+    INTEGER,INTENT(in) :: nbp_lon
+    INTEGER,INTENT(in) :: nbp_lat
+    INTEGER,INTENT(in) :: communicator
 
-    CALL Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+    CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,communicator)
 !$OMP PARALLEL
     CALL Init_phys_lmdz_omp_data(klon_mpi)
@@ -46,8 +45,7 @@
 
   SUBROUTINE Test_transfert
-  USE mod_grid_phy_lmdz, only: klon_glo, nbp_lev, nbp_lon, nbp_lat, &
-                               grid1dTo2d_glo, grid2dTo1d_glo
+  USE mod_grid_phy_lmdz
   IMPLICIT NONE
-!    INCLUDE "iniprint.h"
+    INCLUDE "iniprint.h"
  
     REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
@@ -83,5 +81,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      WRITE(*,*) "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
@@ -95,5 +93,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      WRITE(*,*) "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
@@ -105,5 +103,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
-      WRITE(*,*) "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
Index: trunk/LMDZ.GENERIC/libf/phy_common/physics_distribution_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phy_common/physics_distribution_mod.F90	(revision 1543)
+++ trunk/LMDZ.GENERIC/libf/phy_common/physics_distribution_mod.F90	(revision 1543)
@@ -0,0 +1,71 @@
+!
+!$Id: physics_distribution_mod.F90 2351 2015-08-25 15:14:59Z emillour $
+!
+MODULE physics_distribution_mod
+
+
+CONTAINS
+
+  SUBROUTINE init_physics_distribution(grid_type, nvertex, &
+                                       nbp, nbp_lon, nbp_lat, nbp_lev, &
+                                       communicator)
+  USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para
+  USE mod_grid_phy_lmdz, ONLY: init_grid_phy_lmdz
+  IMPLICIT NONE
+    INTEGER,INTENT(IN) :: grid_type 
+    INTEGER,INTENT(IN) :: nvertex 
+    INTEGER,INTENT(IN) :: nbp           
+    INTEGER,INTENT(IN) :: nbp_lon
+    INTEGER,INTENT(IN) :: nbp_lat
+    INTEGER,INTENT(IN) :: nbp_lev
+    INTEGER,INTENT(IN) :: communicator
+
+
+    CALL init_grid_phy_lmdz(grid_type,nvertex, nbp_lon,nbp_lat,nbp_lev)
+    CALL init_phys_lmdz_para(nbp,nbp_lon, nbp_lat, communicator)
+
+  END SUBROUTINE init_physics_distribution  
+
+!SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
+!  USE mod_phys_lmdz_para, ONLY: Init_phys_lmdz_para!, klon_omp
+!  USE mod_grid_phy_lmdz, ONLY: Init_grid_phy_lmdz!, nbp_lev
+!  USE dimphy, ONLY : Init_dimphy
+!  USE infotrac_phy, ONLY : type_trac
+!#ifdef REPROBUS
+!  USE CHEM_REP, ONLY : Init_chem_rep_phys
+!#endif
+
+!  IMPLICIT NONE
+  
+!    INTEGER,INTENT(in) :: iim
+!    INTEGER,INTENT(in) :: jjp1
+!    INTEGER,INTENT(in) :: llm
+!    INTEGER,INTENT(in) :: nb_proc
+!    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+
+
+!    CALL Init_grid_phy_lmdz(iim,jjp1,llm)
+!    CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+!!$OMP PARALLEL
+!    CALL Init_dimphy(klon_omp,nbp_lev)
+!
+!! Initialization of Reprobus
+!    IF (type_trac == 'repr') THEN
+!#ifdef REPROBUS
+!       CALL Init_chem_rep_phys(klon_omp,nbp_lev)
+!#endif
+!    END IF
+!
+!!$OMP END PARALLEL
+ 
+!END SUBROUTINE Init_Phys_lmdz  
+
+
+
+
+
+
+
+
+END MODULE physics_distribution_mod
+
Index: trunk/LMDZ.GENERIC/libf/phystd/comgeomphy.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/comgeomphy.F90	(revision 1542)
+++ 	(revision )
@@ -1,23 +1,0 @@
-module comgeomphy
-   real,save,allocatable :: cell_area(:) ! mesh area (m2)
-   real,save,allocatable :: dx(:) ! mesh width along longitude (m)
-   real,save,allocatable :: dy(:) ! mesh width along latitude (m)
-   real,save,allocatable :: latitude(:) ! in radians
-   real,save,allocatable :: longitude(:) ! in radians
-!$OMP THREADPRIVATE(cell_area,dx,dy,latitude,longitude)
-contains
-  
-  subroutine initcomgeomphy
-  USE mod_phys_lmdz_para, only: klon_omp
-  implicit none
-    
- 
-    allocate(cell_area(klon_omp))
-    allocate(dx(klon_omp))
-    allocate(dy(klon_omp))
-    allocate(latitude(klon_omp))
-    allocate(longitude(klon_omp))
-
-  end subroutine initcomgeomphy
-  
-end module comgeomphy
Index: trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90	(revision 1543)
@@ -11,5 +11,5 @@
       use aerosol_mod, only : iaero_co2
       USE surfdat_h, only: emisice, emissiv
-      USE comgeomphy, only: latitude ! in radians
+      USE geometry_mod, only: latitude ! in radians
       USE tracer_h, only: noms, rho_co2
       use comcstfi_mod, only: g, r, cpp
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/mod_interface_dyn_phys.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/mod_interface_dyn_phys.F90	(revision 1543)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/mod_interface_dyn_phys.F90	(revision 1543)
@@ -0,0 +1,1 @@
+link ../../dynphy_lonlat/mod_interface_dyn_phys.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 1543)
@@ -3,4 +3,6 @@
 ! to use  'getin'
       use ioipsl_getincom, only: getin
+      use dimphy, only : init_dimphy
+      use mod_grid_phy_lmdz, only : regular_lonlat
       use infotrac, only: nqtot, tname
       use surfdat_h, only: albedodat, phisfi, dryness, watercaptag,
@@ -9,8 +11,7 @@
      &                     dtemisice
       use comdiurn_h, only: sinlat, coslat, sinlon, coslon
-!      use comsaison_h
       use comsoil_h, only: nsoilmx, layer, mlayer, inertiedat, volcapa
       use phyredem, only: physdem0,physdem1
-      use comgeomphy, only: initcomgeomphy, cell_area
+      use geometry_mod, only: init_geometry
       use slab_ice_h, only: noceanmx
       use planete_mod, only: apoastr,periastr,year_day,peri_day,
@@ -27,4 +28,7 @@
       use regular_lonlat_mod, only: init_regular_lonlat
       use planete_mod, only: ini_planete_mod
+      use physics_distribution_mod, only: init_physics_distribution
+      use regular_lonlat_mod, only: init_regular_lonlat
+      use mod_interface_dyn_phys, only: init_interface_dyn_phys
       use inifis_mod, only: inifis
       implicit none
@@ -133,5 +137,5 @@
       character*20,allocatable :: nametrac(:)   ! name of the tracer (no need for adv trac common)
 
-      real :: latitude(1), longitude(1)
+      real :: latitude(1), longitude(1), cell_area(1)
 
 c=======================================================================
@@ -140,6 +144,6 @@
 ! initialize "serial/parallel" related stuff
 !      CALL init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
-      CALL init_phys_lmdz(1,1,llm,1,(/1/))
-      call initcomgeomphy
+!      CALL init_phys_lmdz(1,1,llm,1,(/1/))
+!      call initcomgeomphy
 
       !! those are defined in surfdat_h.F90
@@ -490,7 +494,13 @@
 
       ! initializations, as with iniphysiq.F90 for the 3D GCM
+      call init_physics_distribution(regular_lonlat,4,
+     &                               1,1,1,nlayer,1)
+      call init_interface_dyn_phys
       CALL init_regular_lonlat(1,1,longitude,latitude,
      &                   (/0.,0./),(/0.,0./))
-      
+      call init_geometry(1,longitude,latitude,
+     &                   (/0.,0.,0.,0./),(/0.,0.,0.,0./),
+     &                   cell_area)
+      call init_dimphy(1,nlayer) ! Initialize dimphy module
       call ini_planete_mod(nlayer,preff,ap,bp)
 
Index: trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90	(revision 1543)
@@ -10,5 +10,5 @@
   USE surfdat_h
   use comdiurn_h
-  USE comgeomphy, only: cell_area
+  USE geometry_mod, only: cell_area
   USE tracer_h
   use slab_ice_h
Index: trunk/LMDZ.GENERIC/libf/phystd/init_phys_lmdz.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/init_phys_lmdz.F90	(revision 1542)
+++ 	(revision )
@@ -1,27 +1,0 @@
-!
-! $Id$
-!
-SUBROUTINE init_phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
-  USE mod_phys_lmdz_omp_data, only: klon_omp
-  USE mod_grid_phy_lmdz, only: nbp_lev
-  USE mod_phys_lmdz_para, only: init_phys_lmdz_para
-  USE mod_grid_phy_lmdz, only: init_grid_phy_lmdz
-  USE dimphy, ONLY : init_dimphy
-
-  IMPLICIT NONE
-  
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: llm
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-
-
-    CALL init_grid_phy_lmdz(iim,jjp1,llm)
-    CALL init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
-!$OMP PARALLEL
-    CALL init_dimphy(klon_omp,nbp_lev)
-
-!$OMP END PARALLEL
- 
-END SUBROUTINE init_phys_lmdz  
Index: trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90	(revision 1543)
@@ -10,5 +10,5 @@
 ! create physics restart file and write time-independent variables
   use comsoil_h, only: volcapa, mlayer
-  use comgeomphy, only: cell_area
+  use geometry_mod, only: cell_area
   use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
                        emisice, emissiv,             &
Index: trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1543)
@@ -19,5 +19,5 @@
       use comsaison_h, only: mu0, fract, dist_star, declin, right_ascen
       use comsoil_h, only: nsoilmx, layer, mlayer, inertiedat
-      use comgeomphy, only: latitude, longitude, cell_area
+      use geometry_mod, only: latitude, longitude, cell_area
       USE comgeomfi_h, only: totarea, totarea_planet
       USE tracer_h, only: noms, mmol, radius, rho_q, qext, &
Index: trunk/LMDZ.GENERIC/libf/phystd/rings.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/rings.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/rings.F90	(revision 1543)
@@ -5,5 +5,5 @@
 
     use comdiurn_h, only: sinlat, sinlon, coslat, coslon
-    use comgeomphy, only: latitude ! (rad)
+    use geometry_mod, only: latitude ! (rad)
  
     implicit none   
Index: trunk/LMDZ.GENERIC/libf/phystd/soil.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/soil.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/soil.F	(revision 1543)
@@ -8,5 +8,5 @@
       use time_phylmdz_mod, only: daysec
       use planete_mod, only: year_day
-      use comgeomphy, only: longitude, latitude ! in radians
+      use geometry_mod, only: longitude, latitude ! in radians
 
       implicit none
Index: trunk/LMDZ.GENERIC/libf/phystd/surface_nature.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/surface_nature.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/surface_nature.F	(revision 1543)
@@ -4,5 +4,5 @@
       USE surfdat_h
       USE comsoil_h
-      USE comgeomphy, ONLY: cell_area
+      USE geometry_mod, ONLY: cell_area
       USE tracer_h
 
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1543)
@@ -40,5 +40,5 @@
 !=================================================================
       use surfdat_h, only: phisfi
-      use comgeomphy, only: cell_area
+      use geometry_mod, only: cell_area
       use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini
       USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root,
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1543)
@@ -13,5 +13,5 @@
 
 use comsoil_h, only: nsoilmx, inertiedat
-use comgeomphy, only: cell_area
+use geometry_mod, only: cell_area
 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq
 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1543)
@@ -43,5 +43,5 @@
 ! Addition by RW (2010) to allow OLR to be saved in .nc format
       use radinc_h, only : L_NSPECTI
-      use comgeomphy, only: cell_area
+      use geometry_mod, only: cell_area
       use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
       use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo,
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1543)
@@ -43,5 +43,5 @@
 ! Addition by RW (2010) to allow OSR to be saved in .nc format
       use radinc_h, only : L_NSPECTV
-      use comgeomphy, only: cell_area
+      use geometry_mod, only: cell_area
       use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
       use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo,
Index: trunk/LMDZ.MARS/README
===================================================================
--- trunk/LMDZ.MARS/README	(revision 1542)
+++ trunk/LMDZ.MARS/README	(revision 1543)
@@ -2270,2 +2270,9 @@
    comgeomphy.F90 instead
 
+== 22/04/2016 == EM
+- Updates and cleanup wrt dynamics/physics separation:
+  Removed init_phys_lmdz.F90 and comgeomphy.F90 from phymars;
+  comgeomphy is replaced by geometry_mod (located in phy_common).
+  Added physics_distribution_mod.F90 in phy_common and
+  mod_interface_dyn_phys.F90 in dynphy_lonlat.
+  Added nrtype.F90 (contains math const. like PI, etc.) in "misc"
Index: trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90
===================================================================
--- trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90	(revision 1543)
@@ -3,5 +3,5 @@
 
 use tracer_mod, only: noms, mmol
-use comgeomphy, only: cell_area
+use geometry_mod, only: cell_area
 
 implicit none
Index: trunk/LMDZ.MARS/libf/dyn3d/gcm.F
===================================================================
--- trunk/LMDZ.MARS/libf/dyn3d/gcm.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/dyn3d/gcm.F	(revision 1543)
@@ -7,4 +7,5 @@
       use filtreg_mod, only: inifilr
 !      use comgeomphy, only: initcomgeomphy
+      USE mod_const_mpi, ONLY: COMM_LMDZ
       USE comvert_mod, ONLY: ap,bp
       USE comconst_mod, ONLY: daysec,dtvr,dtphys,dtdiss,rad,g,r,cpp
@@ -160,14 +161,4 @@
 c-----------------------------------------------------------------------
       CALL defrun_new( 99, .TRUE. )
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! FH 2008/05/02
-! A nettoyer. On ne veut qu'une ou deux routines d'interface 
-! dynamique -> physique pour l'initialisation
-!#ifdef CPP_PHYS
-      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-!      call initcomgeomphy ! now done in iniphysiq
-!#endif
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 ! Initialize tracers
@@ -254,5 +245,7 @@
 !#ifdef CPP_PHYS
 !         CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys,
-         CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys,
+         CALL iniphysiq(iim,jjm,llm,
+     &                  (jjm-1)*iim+2,comm_lmdz,
+     &                  daysec,day_ini,dtphys,
      &                  rlatu,rlatv,rlonu,rlonv,
      &                  aire,cu,cv,rad,g,r,cpp,
Index: trunk/LMDZ.MARS/libf/dynphy_lonlat/mod_interface_dyn_phys.F90
===================================================================
--- trunk/LMDZ.MARS/libf/dynphy_lonlat/mod_interface_dyn_phys.F90	(revision 1543)
+++ trunk/LMDZ.MARS/libf/dynphy_lonlat/mod_interface_dyn_phys.F90	(revision 1543)
@@ -0,0 +1,62 @@
+! 
+! $Id: mod_interface_dyn_phys.F90 2351 2015-08-25 15:14:59Z emillour $
+!
+MODULE mod_interface_dyn_phys
+  INTEGER,SAVE,dimension(:),allocatable :: index_i
+  INTEGER,SAVE,dimension(:),allocatable :: index_j
+  
+  
+CONTAINS
+  
+#ifdef CPP_PARA
+! Interface with parallel physics,
+  SUBROUTINE Init_interface_dyn_phys
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    include 'dimensions.h'    
+    
+    INTEGER :: i,j,k
+    
+    ALLOCATE(index_i(klon_mpi))
+    ALLOCATE(index_j(klon_mpi))
+    
+    k=1
+    IF (is_north_pole) THEN
+      index_i(k)=1
+      index_j(k)=1
+      k=2
+    ELSE
+      DO i=ii_begin,iim
+	index_i(k)=i
+	index_j(k)=jj_begin
+	k=k+1
+       ENDDO
+    ENDIF
+    
+    DO j=jj_begin+1,jj_end-1
+      DO i=1,iim
+	index_i(k)=i
+	index_j(k)=j
+	k=k+1
+      ENDDO
+    ENDDO
+    
+    IF (is_south_pole) THEN
+      index_i(k)=1
+      index_j(k)=jj_end
+    ELSE
+      DO i=1,ii_end
+	index_i(k)=i
+	index_j(k)=jj_end
+	k=k+1
+       ENDDO
+    ENDIF
+  
+  END SUBROUTINE Init_interface_dyn_phys 
+#else
+  SUBROUTINE Init_interface_dyn_phys
+  ! dummy routine for seq case
+  END SUBROUTINE Init_interface_dyn_phys 
+#endif
+! of #ifdef CPP_PARA
+END MODULE mod_interface_dyn_phys
Index: trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/iniphysiq_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/iniphysiq_mod.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/iniphysiq_mod.F90	(revision 1543)
@@ -3,30 +3,34 @@
 CONTAINS
 
-subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep,           &
-                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv,                 &
+subroutine iniphysiq(ii,jj,nlayer, &
+                     nbp, communicator, &
+                     punjours, pdayref,ptimestep, &
+                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv, &
                      prad,pg,pr,pcpp,iflag_phys)
 
-use dimphy, only : klev ! number of atmospheric levels
-use mod_grid_phy_lmdz, only : klon_glo ! number of atmospheric columns
-                                       ! (on full grid)
+use dimphy, only : init_dimphy
+use mod_grid_phy_lmdz, only : klon_glo, & ! number of atmospheric columns (on full grid)
+                              regular_lonlat  ! regular longitude-latitude grid type
 use mod_phys_lmdz_para, only : klon_omp, & ! number of columns (on local omp grid)
                                klon_omp_begin, & ! start index of local omp subgrid
                                klon_omp_end, & ! end index of local omp subgrid
                                klon_mpi_begin ! start indes of columns (on local mpi grid)
-
-use comgeomphy, only : initcomgeomphy, &
-                       cell_area, & ! physics grid area (m2)
-                       dx, & ! cu coeff. (u_covariant = cu * u)
-                       dy, & ! cv coeff. (v_covariant = cv * v)
-                       longitude, & ! longitudes (rad)
-                       latitude ! latitudes (rad)
+use geometry_mod, only: init_geometry
+!use comgeomphy, only : initcomgeomphy, &
+!                       cell_area, & ! physics grid area (m2)
+!                       dx, & ! cu coeff. (u_covariant = cu * u)
+!                       dy, & ! cv coeff. (v_covariant = cv * v)
+!                       longitude, & ! longitudes (rad)
+!                       latitude ! latitudes (rad)
 use infotrac, only : nqtot ! number of advected tracers
 use comgeomfi_h, only: ini_fillgeom
 use temps_mod, only: day_ini, hour_ini
 use phys_state_var_init_mod, only: phys_state_var_init
+use physics_distribution_mod, only: init_physics_distribution
 use regular_lonlat_mod, only: init_regular_lonlat, &
                               east, west, north, south, &
                               north_east, north_west, &
                               south_west, south_east
+use mod_interface_dyn_phys, only: init_interface_dyn_phys
 
 implicit none
@@ -43,4 +47,6 @@
 integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes
 integer,intent(in) :: jj  ! number of atompsheric columns along latitudes
+integer,intent(in) :: nbp ! number of physics columns for this MPI process
+integer,intent(in) :: communicator ! MPI communicator
 real,intent(in) :: rlatu(jj+1) ! latitudes of the physics grid
 real,intent(in) :: rlatv(jj) ! latitude boundaries of the physics grid
@@ -55,5 +61,5 @@
 
 integer :: ibegin,iend,offset
-integer :: i,j
+integer :: i,j,k
 character(len=20) :: modname='iniphysiq'
 character(len=80) :: abort_message
@@ -66,29 +72,29 @@
 
 ! global array, on full physics grid:
-real,allocatable :: latfi(:)
-real,allocatable :: lonfi(:)
-real,allocatable :: cufi(:)
-real,allocatable :: cvfi(:)
-real,allocatable :: airefi(:)
+real,allocatable :: latfi_glo(:)
+real,allocatable :: lonfi_glo(:)
+real,allocatable :: cufi_glo(:)
+real,allocatable :: cvfi_glo(:)
+real,allocatable :: airefi_glo(:)
+real,allocatable :: boundslonfi_glo(:,:)
+real,allocatable :: boundslatfi_glo(:,:)
+
+! local arrays, on given MPI/OpenMP domain:
+real,allocatable,save :: latfi(:)
+real,allocatable,save :: lonfi(:)
+real,allocatable,save :: cufi(:)
+real,allocatable,save :: cvfi(:)
+real,allocatable,save :: airefi(:)
+real,allocatable,save :: boundslonfi(:,:)
+real,allocatable,save :: boundslatfi(:,:)
+!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
+
 
 pi=2.*asin(1.0)
 
-IF (nlayer.NE.klev) THEN
-  write(*,*) 'STOP in ',trim(modname)
-  write(*,*) 'Problem with dimensions :'
-  write(*,*) 'nlayer     = ',nlayer
-  write(*,*) 'klev   = ',klev
-  abort_message = ''
-  CALL abort_gcm (modname,abort_message,1)
-ENDIF
-
-!IF (ngrid.NE.klon_glo) THEN
-!  write(*,*) 'STOP in ',trim(modname)
-!  write(*,*) 'Problem with dimensions :'
-!  write(*,*) 'ngrid     = ',ngrid
-!  write(*,*) 'klon   = ',klon_glo
-!  abort_message = ''
-!  CALL abort_gcm (modname,abort_message,1)
-!ENDIF
+! Initialize Physics distibution and parameters and interface with dynamics
+CALL init_physics_distribution(regular_lonlat,4, &
+                                 nbp,ii,jj+1,nlayer,communicator)
+CALL init_interface_dyn_phys
 
 ! init regular global longitude-latitude grid points and boundaries
@@ -115,32 +121,63 @@
 
 ! Generate global arrays on full physics grid
-allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
-latfi(1)=rlatu(1)
-lonfi(1)=0.
-cufi(1) = cu(1)
-cvfi(1) = cv(1)
+allocate(latfi_glo(klon_glo),lonfi_glo(klon_glo))
+allocate(cufi_glo(klon_glo),cvfi_glo(klon_glo))
+allocate(airefi_glo(klon_glo))
+allocate(boundslonfi_glo(klon_glo,4))
+allocate(boundslatfi_glo(klon_glo,4))
+
+! North pole
+latfi_glo(1)=rlatu(1)
+lonfi_glo(1)=0.
+cufi_glo(1) = cu(1)
+cvfi_glo(1) = cv(1)
+boundslonfi_glo(1,north_east)=0
+boundslatfi_glo(1,north_east)=PI/2
+boundslonfi_glo(1,north_west)=2*PI
+boundslatfi_glo(1,north_west)=PI/2
+boundslonfi_glo(1,south_west)=2*PI
+boundslatfi_glo(1,south_west)=rlatv(1)
+boundslonfi_glo(1,south_east)=0
+boundslatfi_glo(1,south_east)=rlatv(1)
 DO j=2,jj
   DO i=1,ii
-    latfi((j-2)*ii+1+i)= rlatu(j)
-    lonfi((j-2)*ii+1+i)= rlonv(i)
-    cufi((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)
-    cvfi((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)
+    k=(j-2)*ii+1+i
+    latfi_glo((j-2)*ii+1+i)= rlatu(j)
+    lonfi_glo((j-2)*ii+1+i)= rlonv(i)
+    cufi_glo((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)
+    cvfi_glo((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)
+    boundslonfi_glo(k,north_east)=rlonu(i)
+    boundslatfi_glo(k,north_east)=rlatv(j-1)
+    boundslonfi_glo(k,north_west)=rlonu(i+1)
+    boundslatfi_glo(k,north_west)=rlatv(j-1)
+    boundslonfi_glo(k,south_west)=rlonu(i+1)
+    boundslatfi_glo(k,south_west)=rlatv(j)
+    boundslonfi_glo(k,south_east)=rlonu(i)
+    boundslatfi_glo(k,south_east)=rlatv(j)
   ENDDO
 ENDDO
-latfi(klon_glo)= rlatu(jj+1)
-lonfi(klon_glo)= 0.
-cufi(klon_glo) = cu((ii+1)*jj+1)
-cvfi(klon_glo) = cv((ii+1)*jj-ii)
+! South pole
+latfi_glo(klon_glo)= rlatu(jj+1)
+lonfi_glo(klon_glo)= 0.
+cufi_glo(klon_glo) = cu((ii+1)*jj+1)
+cvfi_glo(klon_glo) = cv((ii+1)*jj-ii)
+boundslonfi_glo(klon_glo,north_east)= 0
+boundslatfi_glo(klon_glo,north_east)= rlatv(jj)
+boundslonfi_glo(klon_glo,north_west)= 2*PI
+boundslatfi_glo(klon_glo,north_west)= rlatv(jj)
+boundslonfi_glo(klon_glo,south_west)= 2*PI
+boundslatfi_glo(klon_glo,south_west)= -PI/2
+boundslonfi_glo(klon_glo,south_east)= 0
+boundslatfi_glo(klon_glo,south_east)= -Pi/2
 
 ! build airefi(), mesh area on physics grid
-allocate(airefi(klon_glo))
-CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi)
+CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo)
 ! Poles are single points on physics grid
-airefi(1)=sum(aire(1:ii,1))
-airefi(klon_glo)=sum(aire(1:ii,jj+1))
+airefi_glo(1)=sum(aire(1:ii,1))
+airefi_glo(klon_glo)=sum(aire(1:ii,jj+1))
 
 ! Sanity check: do total planet area match between physics and dynamics?
 total_area_dyn=sum(aire(1:ii,1:jj+1))
-total_area_phy=sum(airefi(1:klon_glo))
+total_area_phy=sum(airefi_glo(1:klon_glo))
 IF (total_area_dyn/=total_area_phy) THEN
   WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
@@ -158,22 +195,31 @@
 !$OMP PARALLEL 
 ! Now generate local lon/lat/cu/cv/area arrays
-call initcomgeomphy
-
-!!!!$OMP PARALLEL PRIVATE(ibegin,iend) 
-!!!$OMP+         SHARED(parea,pcu,pcv,plon,plat)
+allocate(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
+allocate(airefi(klon_omp))
+allocate(boundslonfi(klon_omp,4))
+allocate(boundslatfi(klon_omp,4))
+!call initcomgeomphy
       
 offset=klon_mpi_begin-1
-cell_area(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end)
-dx(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end)
-dy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end)
-longitude(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end)
-latitude(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end)
+airefi(1:klon_omp)=airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+cufi(1:klon_omp)=cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+cvfi(1:klon_omp)=cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+lonfi(1:klon_omp)=lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+latfi(1:klon_omp)=latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
+boundslonfi(1:klon_omp,:)=boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+boundslatfi(1:klon_omp,:)=boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
+
+! copy over local grid longitudes and latitudes
+CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
+                   airefi,cufi,cvfi)
 
 ! copy some fundamental parameters to physics 
 ! and do some initializations 
+
+call init_dimphy(klon_omp,nlayer) ! Initialize dimphy module
 call phys_state_var_init(klon_omp,nlayer,nqtot, &
                          day_ini,hour_ini,punjours,ptimestep, &
                          prad,pg,pr,pcpp)
-call ini_fillgeom(klon_omp,latitude,longitude,cell_area)
+call ini_fillgeom(klon_omp,latfi,lonfi,airefi)
 call conf_phys(klon_omp,nlayer,nqtot)
 
Index: trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F
===================================================================
--- trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F	(revision 1543)
@@ -15,5 +15,8 @@
 c=======================================================================
 
-      use ioipsl_getincom, only: getin 
+      use ioipsl_getincom, only: getin
+      use mod_phys_lmdz_para, only: is_parallel, is_sequential,
+     &                              is_mpi_root, is_omp_root,
+     &                              is_master
       use infotrac, only: infotrac_init, nqtot, tname
       use tracer_mod, only: noms, mmol,
@@ -29,10 +32,8 @@
       use phyredem, only: physdem0, physdem1
       use iostart, only: open_startphy
-      use comgeomphy, only: initcomgeomphy
-!      use planete_h
       use dimradmars_mod, only: tauscaling
       use turb_mod, only: q2
-      use comgeomfi_h, only: ini_fillgeom
       use filtreg_mod, only: inifilr
+      USE mod_const_mpi, ONLY: COMM_LMDZ
       USE comvert_mod, ONLY: ap,bp,pa,preff
       USE comconst_mod, ONLY: lllm,daysec,dtphys,dtvr,
@@ -41,16 +42,16 @@
       USE temps_mod, ONLY: day_ini,hour_ini
       USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
-      USE phys_state_var_init_mod, ONLY: phys_state_var_init
+      USE iniphysiq_mod, ONLY: iniphysiq
 
       implicit none
 
-#include "dimensions.h"
+      include "dimensions.h"
       integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) 
-#include "paramet.h"
-#include "comgeom2.h"
-#include "comdissnew.h"
-#include "clesph0.h"
-#include "netcdf.inc"
-#include "datafile.h"
+      include "paramet.h"
+      include "comgeom2.h"
+      include "comdissnew.h"
+      include "clesph0.h"
+      include "netcdf.inc"
+      include "datafile.h"
 c=======================================================================
 c   Declarations
@@ -181,10 +182,13 @@
       planet_type="mars"
 
-! initialize "serial/parallel" related stuff
-      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-      call initcomgeomphy
-
+! initialize "serial/parallel" related stuff:
+! (required because we call tabfi() below, before calling iniphysiq)
+      is_sequential=.true.
+      is_parallel=.false.
+      is_mpi_root=.true.
+      is_omp_root=.true.
+      is_master=.true.
+      
 ! Load tracer number and names:
-!      call iniadvtrac(nqtot,numvanle)
       call infotrac_init
 ! allocate arrays
@@ -335,5 +339,4 @@
       mugaz = p_mugaz
       daysec = p_daysec
-!      write(*,*) 'aire',aire
 
 
@@ -349,33 +352,11 @@
       idum=0
 
-c Initialisation coordonnees /aires
-c -------------------------------
-! Note: rlatu(:) and rlonv(:) are commons defined in "comgeom.h"
-!       rlatu() and rlonv() are given in radians
-      latfi(1)=rlatu(1)
-      lonfi(1)=0.
-      DO j=2,jjm
-         DO i=1,iim
-            latfi((j-2)*iim+1+i)=rlatu(j)
-            lonfi((j-2)*iim+1+i)=rlonv(i)
-         ENDDO
-      ENDDO
-      latfi(ngridmx)=rlatu(jjp1)
-      lonfi(ngridmx)=0.
-      
-      ! build airefi(), mesh area on physics grid
-      CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
-      ! Poles are single points on physics grid
-      airefi(1)=sum(aire(1:iim,1))
-      airefi(ngridmx)=sum(aire(1:iim,jjm+1))
-
-! also initialize various physics flags/settings which might be needed
-!    (for instance initracer needs to know about some flags, and/or
-!      'datafile' path may be changed by user)
-      call phys_state_var_init(ngridmx,llm,nqtot,
-     &                         day_ini,hour_ini,daysec,dtphys,
-     &                         rad,g,r,cpp)
-      call ini_fillgeom(ngridmx,latfi,lonfi,airefi)
-      call conf_phys(ngridmx,llm,nqtot)
+! Initialize the physics
+         CALL iniphysiq(iim,jjm,llm,
+     &                  (jjm-1)*iim+2,comm_lmdz,
+     &                  daysec,day_ini,dtphys,
+     &                  rlatu,rlatv,rlonu,rlonv,
+     &                  aire,cu,cv,rad,g,r,cpp,
+     &                  1)
 
 c=======================================================================
Index: trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/start2archive.F
===================================================================
--- trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/start2archive.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/start2archive.F	(revision 1543)
@@ -23,19 +23,21 @@
       use surfdat_h, only: ini_surfdat_h, qsurf
       use comsoil_h, only: ini_comsoil_h
-      use comgeomphy, only: initcomgeomphy
+!      use comgeomphy, only: initcomgeomphy
       use filtreg_mod, only: inifilr
+      USE mod_const_mpi, ONLY: COMM_LMDZ
       use control_mod, only: planet_type
       USE comvert_mod, ONLY: ap,bp
-      USE comconst_mod, ONLY: g,cpp
+      USE comconst_mod, ONLY: daysec,dtphys,rad,g,r,cpp
       USE logic_mod, ONLY: grireg
       USE temps_mod, ONLY: day_ini,hour_ini
+      USE iniphysiq_mod, ONLY: iniphysiq
       implicit none
 
-#include "dimensions.h"
+      include "dimensions.h"
       integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) 
-#include "paramet.h"
-#include "comdissip.h"
-#include "comgeom.h"
-#include "netcdf.inc"
+      include "paramet.h"
+      include "comdissip.h"
+      include "comgeom.h"
+      include "netcdf.inc"
 
 c-----------------------------------------------------------------------
@@ -59,7 +61,7 @@
 c Variable Physiques (grille physique)
 c ------------------------------------
-      REAL tsurf(ngridmx)	! Surface temperature
+      REAL tsurf(ngridmx)        ! Surface temperature
       REAL tsoil(ngridmx,nsoilmx) ! Soil temperature
-      REAL co2ice(ngridmx)	! CO2 ice layer
+      REAL co2ice(ngridmx)        ! CO2 ice layer
       REAL tauscaling(ngridmx) ! dust conversion factor
       REAL q2(ngridmx,llm+1)
@@ -116,7 +118,5 @@
       CALL defrun_new(99, .TRUE. )
       grireg   = .TRUE.
-! initialize "serial/parallel" related stuff
-      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-      call initcomgeomphy
+
       planet_type='mars'
 
@@ -125,5 +125,4 @@
 c=======================================================================
 ! Load tracer number and names:
-!      call iniadvtrac(nqtot,numvanle)
       call infotrac_init
 
@@ -131,6 +130,4 @@
       allocate(q(ip1jmp1,llm,nqtot))
       allocate(qsurfS(ip1jmp1,nqtot))
-      call ini_surfdat_h(ngridmx,nqtot)
-      call ini_comsoil_h(ngridmx)
       
 
@@ -139,4 +136,20 @@
      .       ps,phis,timedyn)
 
+c-----------------------------------------------------------------------
+c   Initialisations 
+c-----------------------------------------------------------------------
+
+      CALL defrun_new(99, .FALSE. )
+      call iniconst
+      call inigeom
+      call inifilr
+
+! Initialize the physics
+         CALL iniphysiq(iim,jjm,llm,
+     &                  (jjm-1)*iim+2,comm_lmdz,
+     &                  daysec,day_ini,dtphys,
+     &                  rlatu,rlatv,rlonu,rlonv,
+     &                  aire,cu,cv,rad,g,r,cpp,
+     &                  1)
 
       fichnom = 'startfi.nc'
@@ -185,12 +198,4 @@
 c *****************************************************************
 
-c-----------------------------------------------------------------------
-c   Initialisations 
-c-----------------------------------------------------------------------
-
-      CALL defrun_new(99, .FALSE. )
-      call iniconst
-      call inigeom
-      call inifilr
       CALL pression(ip1jmp1, ap, bp, ps, p3d)
       call exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf)
Index: trunk/LMDZ.MARS/libf/misc/nrtype.F90
===================================================================
--- trunk/LMDZ.MARS/libf/misc/nrtype.F90	(revision 1543)
+++ trunk/LMDZ.MARS/libf/misc/nrtype.F90	(revision 1543)
@@ -0,0 +1,22 @@
+MODULE nrtype
+
+  implicit none
+
+  integer, parameter:: k8 = selected_real_kind(13)
+
+  ! Frequently used mathematical constants (with precision to spare):
+
+  REAL, PARAMETER :: PI=3.141592653589793238462643383279502884197
+  REAL, PARAMETER :: PIO2=1.57079632679489661923132169163975144209858
+  REAL, PARAMETER :: TWOPI=6.283185307179586476925286766559005768394
+  REAL, PARAMETER :: SQRT2=1.41421356237309504880168872420969807856967
+  REAL, PARAMETER :: EULER=0.5772156649015328606065120900824024310422
+
+  REAL(K8), PARAMETER:: &
+       PI_D = 3.141592653589793238462643383279502884197_k8
+  REAL(K8), PARAMETER:: &
+       PIO2_D=1.57079632679489661923132169163975144209858_k8
+  REAL(K8), PARAMETER:: &
+       TWOPI_D=6.283185307179586476925286766559005768394_k8
+
+END MODULE nrtype
Index: trunk/LMDZ.MARS/libf/phy_common/geometry_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/geometry_mod.F90	(revision 1543)
+++ trunk/LMDZ.MARS/libf/phy_common/geometry_mod.F90	(revision 1543)
@@ -0,0 +1,74 @@
+MODULE geometry_mod
+
+! Store informations concerning the local (to MPI/OpenMP core) geometry
+
+  REAL,SAVE,ALLOCATABLE :: longitude(:) ! longitude of the cell (rad)
+!$OMP THREADPRIVATE(longitude)
+
+  REAL,SAVE,ALLOCATABLE :: latitude(:)! latitude of the cell (rad)
+!$OMP THREADPRIVATE(latitude)
+
+  REAL,SAVE,ALLOCATABLE :: longitude_deg(:) ! longitude of the cell (degree)
+!$OMP THREADPRIVATE(longitude_deg)
+
+  REAL,SAVE,ALLOCATABLE :: latitude_deg(:)! latitude of the cell (degree)
+!$OMP THREADPRIVATE(latitude_deg)
+
+  REAL,SAVE,ALLOCATABLE :: boundslon(:,:)  ! boundaries of the cell (rad)
+!$OMP THREADPRIVATE(boundslon)
+
+  REAL,SAVE,ALLOCATABLE :: boundslat(:,:) ! boundaries of the cell (rad)
+!$OMP THREADPRIVATE(boundslat)
+
+  REAL,SAVE,ALLOCATABLE :: dx(:)      ! resolution of longitude cell (valid only for 2D grid)
+!$OMP THREADPRIVATE(dx)
+  
+  REAL,SAVE,ALLOCATABLE :: dy(:)      ! resolution of latitude cell (valid only for 2D grid)
+!$OMP THREADPRIVATE(dy)
+
+  REAL,SAVE,ALLOCATABLE :: cell_area(:)      ! area of the cell
+!$OMP THREADPRIVATE(cell_area)
+
+
+CONTAINS
+
+  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
+                           boundslon_,boundslat_, &
+                           cell_area_,dx_,dy_)
+  USE mod_grid_phy_lmdz, ONLY: nvertex
+  USE nrtype, ONLY : PI
+  IMPLICIT NONE
+    INTEGER,INTENT(IN) :: klon ! number of columns for this MPI/OpenMP domain
+    REAL,INTENT(IN) :: longitude_(klon)
+    REAL,INTENT(IN) :: latitude_(klon)
+    REAL,INTENT(IN) :: boundslon_(klon,nvertex)
+    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
+    REAL,INTENT(IN) :: cell_area_(klon)
+    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
+    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
+    
+    ALLOCATE(longitude(klon))
+    ALLOCATE(latitude(klon))
+    ALLOCATE(longitude_deg(klon))
+    ALLOCATE(latitude_deg(klon))
+    ALLOCATE(boundslon(klon,nvertex))
+    ALLOCATE(boundslat(klon,nvertex))
+    ALLOCATE(cell_area(klon))
+    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
+    IF (PRESENT(dy_))ALLOCATE(dy(klon))
+    
+    longitude(:) = longitude_(:)
+    latitude(:) = latitude_(:)
+    longitude_deg(:) = longitude(:)*180./PI
+    latitude_deg(:) = latitude(:)*180./PI
+    boundslon(:,:) = boundslon_(:,:)
+    boundslat(:,:) = boundslat_(:,:)
+    cell_area(:) = cell_area_(:)
+    IF (PRESENT(dx_)) dx(:) = dx_(:)
+    IF (PRESENT(dy_)) dy(:) = dy_(:)
+    
+  END SUBROUTINE init_geometry
+
+
+END MODULE geometry_mod
+
Index: trunk/LMDZ.MARS/libf/phy_common/ioipsl_getin_p_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/ioipsl_getin_p_mod.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phy_common/ioipsl_getin_p_mod.F90	(revision 1543)
@@ -12,5 +12,5 @@
 USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
 USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
-use mod_phys_lmdz_para, only : bcast
+USE mod_phys_lmdz_transfert_para, ONLY : bcast
 !-
 IMPLICIT NONE
Index: trunk/LMDZ.MARS/libf/phy_common/mod_grid_phy_lmdz.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/mod_grid_phy_lmdz.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phy_common/mod_grid_phy_lmdz.F90	(revision 1543)
@@ -1,4 +1,4 @@
 !
-!$Header$
+!$Id $
 !
 MODULE mod_grid_phy_lmdz
@@ -7,9 +7,14 @@
   PRIVATE :: grid1dTo2d_glo_igen, grid1dTo2d_glo_rgen, grid1dTo2d_glo_lgen, &
              grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen
-
+  
+  INTEGER,PARAMETER :: unstructured=0
+  INTEGER,PARAMETER :: regular_lonlat=1
+
+  INTEGER,SAVE :: grid_type
+  INTEGER,SAVE :: nvertex
   INTEGER,SAVE :: nbp_lon  ! == iim
-  INTEGER,SAVE :: nbp_lat  ! == jjmp1
+  INTEGER,SAVE :: nbp_lat  ! == jjmp1 (or == 1 if running 1D model)
   INTEGER,SAVE :: nbp_lev  ! == llm
-  INTEGER,SAVE :: klon_glo
+  INTEGER,SAVE :: klon_glo ! total number of atmospheric columns
 
   INTERFACE grid1dTo2d_glo
@@ -32,20 +37,23 @@
 
 
-  SUBROUTINE init_grid_phy_lmdz(iim,jjp1,llm)
+  SUBROUTINE init_grid_phy_lmdz(grid_type_,nvertex_,nbp_lon_,nbp_lat_,nbp_lev_)
   IMPLICIT NONE
-  INTEGER, INTENT(in) :: iim
-  INTEGER, INTENT(in) :: jjp1
-  INTEGER, INTENT(in) :: llm
-  
-    nbp_lon=iim
-    nbp_lat=jjp1
-    nbp_lev=llm
-    klon_glo=(iim*jjp1)-2*(iim-1)
-  
-  ! Ehouarn: handle 1D case:
-  if ((iim.eq.1).and.(jjp1.eq.2)) then
-    nbp_lat=1
-    klon_glo=1
-  endif
+  INTEGER,INTENT(IN)  :: grid_type_ 
+  INTEGER,INTENT(IN)  :: nvertex_ 
+  INTEGER, INTENT(IN) :: nbp_lon_
+  INTEGER, INTENT(IN) :: nbp_lat_
+  INTEGER, INTENT(IN) :: nbp_lev_
+  
+    grid_type = grid_type_
+    nvertex   = nvertex_
+    nbp_lon   = nbp_lon_
+    nbp_lat   = nbp_lat_
+    nbp_lev   = nbp_lev_
+    
+    IF (nbp_lon*nbp_lat==1) THEN
+      klon_glo=1
+    ELSE    
+      klon_glo=(nbp_lon*nbp_lat)-2*(nbp_lon-1)
+    ENDIF
   
   END SUBROUTINE init_grid_phy_lmdz
@@ -283,7 +291,9 @@
 
 !---------------------------------------------------------------- 
-!  fonctions generiques (privees)
+!  Generic (private) fonctions
 !---------------------------------------------------------------- 
+  
   SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -320,4 +330,5 @@
 
   SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -353,4 +364,5 @@
 
   SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
     
@@ -386,4 +398,5 @@
   
   SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -408,4 +421,5 @@
   
   SUBROUTINE grid2dTo1d_glo_rgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
@@ -430,4 +444,5 @@
     
   SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
+
     IMPLICIT NONE
 
Index: trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_data.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_data.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_data.F90	(revision 1543)
@@ -3,5 +3,5 @@
 !
 MODULE mod_phys_lmdz_mpi_data
-  USE mod_const_mpi, only: MPI_REAL_LMDZ, COMM_LMDZ
+!  USE mod_const_mpi
   
   INTEGER,SAVE :: ii_begin
@@ -35,5 +35,6 @@
   INTEGER,SAVE :: mpi_rank
   INTEGER,SAVE :: mpi_size
-  INTEGER,SAVE :: mpi_root
+  INTEGER,SAVE :: mpi_master
+!  INTEGER,SAVE :: mpi_root
   LOGICAL,SAVE :: is_mpi_root
   LOGICAL,SAVE :: is_using_mpi
@@ -43,15 +44,21 @@
   LOGICAL,SAVE :: is_south_pole
   INTEGER,SAVE :: COMM_LMDZ_PHY
+  INTEGER,SAVE :: MPI_REAL_LMDZ   ! MPI_REAL8
 
 CONTAINS
   
-  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
-  USE mod_const_mpi, ONLY : COMM_LMDZ
+!  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+  SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator)
+!  USE mod_const_mpi, ONLY : COMM_LMDZ
   IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER,INTENT(in) :: nbp
+    INTEGER,INTENT(in) :: nbp_lon
+    INTEGER,INTENT(in) :: nbp_lat
+    INTEGER,INTENT(in) :: communicator
+    
+    INTEGER,ALLOCATABLE :: distrib(:)
     INTEGER :: ierr
     INTEGER :: klon_glo
@@ -64,14 +71,17 @@
 #endif
     
-    if (iim.eq.1) then
+    if ((nbp_lon.eq.1).and.(nbp_lat.eq.1)) then ! running 1D column model
        klon_glo=1
     else
-       klon_glo=iim*(jjp1-2)+2
+    ! The usual global physics grid: 1 point for each pole and nbp_lon points
+    ! for all other latitudes
+       klon_glo=nbp_lon*(nbp_lat-2)+2
     endif
     
-    COMM_LMDZ_PHY=COMM_LMDZ
+    COMM_LMDZ_PHY=communicator
 
     IF (is_using_mpi) THEN    
 #ifdef CPP_MPI
+      MPI_REAL_LMDZ=MPI_REAL8
       CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr)    
       CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr)
@@ -82,6 +92,17 @@
     ENDIF
     
+    ALLOCATE(distrib(0:mpi_size-1))
+
+    IF (is_using_mpi) THEN    
+#ifdef CPP_MPI
+    CALL MPI_ALLGATHER(nbp,1,MPI_INTEGER,distrib,1,MPI_INTEGER,COMM_LMDZ_PHY,ierr)
+#endif
+    ELSE
+     distrib(:)=nbp
+    ENDIF
+
+
     IF (mpi_rank == 0) THEN
-      mpi_root = 0
+      mpi_master = 0
       is_mpi_root = .true.
     ENDIF
@@ -115,5 +136,5 @@
   
       
-    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:nb_proc-1)
+    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:mpi_size-1)
 
     DO i=0,mpi_size-1
@@ -132,23 +153,15 @@
         ij_para_begin(i) = 1
       ELSE
-        ij_para_begin(i) = klon_mpi_para_begin(i)+iim-1
+        ij_para_begin(i) = klon_mpi_para_begin(i)+nbp_lon-1
       ENDIF
 
-      jj_para_begin(i) = (ij_para_begin(i)-1)/iim + 1
-      ii_para_begin(i) = MOD(ij_para_begin(i)-1,iim) + 1
+      jj_para_begin(i) = (ij_para_begin(i)-1)/nbp_lon + 1
+      ii_para_begin(i) = MOD(ij_para_begin(i)-1,nbp_lon) + 1
 
       
-      ij_para_end(i) = klon_mpi_para_end(i)+iim-1
-      jj_para_end(i) = (ij_para_end(i)-1)/iim + 1
-      ii_para_end(i) = MOD(ij_para_end(i)-1,iim) + 1
-
-      ! Ehouarn: handle 1D case:
-      if (klon_glo.eq.1) then
-        klon_mpi_para_end(i) = 1
-        klon_mpi_para_nb(i) = 1
-        ij_para_end(i) = 1
-        jj_para_end(i) = 1
-        ii_para_end(i) = 1
-      endif
+      ij_para_end(i) = klon_mpi_para_end(i)+nbp_lon-1
+      jj_para_end(i) = (ij_para_end(i)-1)/nbp_lon + 1
+      ii_para_end(i) = MOD(ij_para_end(i)-1,nbp_lon) + 1
+
 
       ij_para_nb(i) = ij_para_end(i)-ij_para_begin(i)+1
@@ -174,36 +187,37 @@
 
   SUBROUTINE print_module_data
+!  USE print_control_mod, ONLY: lunout
   IMPLICIT NONE
-!  INCLUDE "iniprint.h" 
-  
-    WRITE(*,*) 'ii_begin =', ii_begin
-    WRITE(*,*) 'ii_end =', ii_end
-    WRITE(*,*) 'jj_begin =',jj_begin
-    WRITE(*,*) 'jj_end =', jj_end
-    WRITE(*,*) 'jj_nb =', jj_nb
-    WRITE(*,*) 'ij_begin =', ij_begin
-    WRITE(*,*) 'ij_end =', ij_end
-    WRITE(*,*) 'ij_nb =', ij_nb
-    WRITE(*,*) 'klon_mpi_begin =', klon_mpi_begin
-    WRITE(*,*) 'klon_mpi_end =', klon_mpi_end
-    WRITE(*,*) 'klon_mpi =', klon_mpi
-    WRITE(*,*) 'jj_para_nb =', jj_para_nb
-    WRITE(*,*) 'jj_para_begin =', jj_para_begin
-    WRITE(*,*) 'jj_para_end =', jj_para_end
-    WRITE(*,*) 'ii_para_begin =', ii_para_begin
-    WRITE(*,*) 'ii_para_end =', ii_para_end
-    WRITE(*,*) 'ij_para_nb =', ij_para_nb
-    WRITE(*,*) 'ij_para_begin =', ij_para_begin
-    WRITE(*,*) 'ij_para_end =', ij_para_end
-    WRITE(*,*) 'klon_mpi_para_nb =', klon_mpi_para_nb
-    WRITE(*,*) 'klon_mpi_para_begin =', klon_mpi_para_begin
-    WRITE(*,*) 'klon_mpi_para_end  =', klon_mpi_para_end 
-    WRITE(*,*) 'mpi_rank =', mpi_rank
-    WRITE(*,*) 'mpi_size =', mpi_size
-    WRITE(*,*) 'mpi_root =', mpi_root
-    WRITE(*,*) 'is_mpi_root =', is_mpi_root
-    WRITE(*,*) 'is_north_pole =', is_north_pole
-    WRITE(*,*) 'is_south_pole =', is_south_pole
-    WRITE(*,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
+  INCLUDE "iniprint.h" 
+  
+    WRITE(lunout,*) 'ii_begin =', ii_begin
+    WRITE(lunout,*) 'ii_end =', ii_end
+    WRITE(lunout,*) 'jj_begin =',jj_begin
+    WRITE(lunout,*) 'jj_end =', jj_end
+    WRITE(lunout,*) 'jj_nb =', jj_nb
+    WRITE(lunout,*) 'ij_begin =', ij_begin
+    WRITE(lunout,*) 'ij_end =', ij_end
+    WRITE(lunout,*) 'ij_nb =', ij_nb
+    WRITE(lunout,*) 'klon_mpi_begin =', klon_mpi_begin
+    WRITE(lunout,*) 'klon_mpi_end =', klon_mpi_end
+    WRITE(lunout,*) 'klon_mpi =', klon_mpi
+    WRITE(lunout,*) 'jj_para_nb =', jj_para_nb
+    WRITE(lunout,*) 'jj_para_begin =', jj_para_begin
+    WRITE(lunout,*) 'jj_para_end =', jj_para_end
+    WRITE(lunout,*) 'ii_para_begin =', ii_para_begin
+    WRITE(lunout,*) 'ii_para_end =', ii_para_end
+    WRITE(lunout,*) 'ij_para_nb =', ij_para_nb
+    WRITE(lunout,*) 'ij_para_begin =', ij_para_begin
+    WRITE(lunout,*) 'ij_para_end =', ij_para_end
+    WRITE(lunout,*) 'klon_mpi_para_nb =', klon_mpi_para_nb
+    WRITE(lunout,*) 'klon_mpi_para_begin =', klon_mpi_para_begin
+    WRITE(lunout,*) 'klon_mpi_para_end  =', klon_mpi_para_end 
+    WRITE(lunout,*) 'mpi_rank =', mpi_rank
+    WRITE(lunout,*) 'mpi_size =', mpi_size
+    WRITE(lunout,*) 'mpi_master =', mpi_master
+    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
+    WRITE(lunout,*) 'is_north_pole =', is_north_pole
+    WRITE(lunout,*) 'is_south_pole =', is_south_pole
+    WRITE(lunout,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
   
   END SUBROUTINE print_module_data
Index: trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90	(revision 1543)
@@ -9,5 +9,5 @@
                      bcast_mpi_i,bcast_mpi_i1,bcast_mpi_i2,bcast_mpi_i3,bcast_mpi_i4, &
                      bcast_mpi_r,bcast_mpi_r1,bcast_mpi_r2,bcast_mpi_r3,bcast_mpi_r4, &
-		     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
+                     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
   END INTERFACE
 
@@ -15,5 +15,5 @@
     MODULE PROCEDURE scatter_mpi_i,scatter_mpi_i1,scatter_mpi_i2,scatter_mpi_i3, &
                      scatter_mpi_r,scatter_mpi_r1,scatter_mpi_r2,scatter_mpi_r3, &
-		     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
+                     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
   END INTERFACE
 
@@ -22,5 +22,5 @@
     MODULE PROCEDURE gather_mpi_i,gather_mpi_i1,gather_mpi_i2,gather_mpi_i3, &
                      gather_mpi_r,gather_mpi_r1,gather_mpi_r2,gather_mpi_r3, &
-		     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
+                     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
   END INTERFACE
   
@@ -28,5 +28,5 @@
     MODULE PROCEDURE scatter2D_mpi_i,scatter2D_mpi_i1,scatter2D_mpi_i2,scatter2D_mpi_i3, &
                      scatter2D_mpi_r,scatter2D_mpi_r1,scatter2D_mpi_r2,scatter2D_mpi_r3, &
-		     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
+                     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
   END INTERFACE
 
@@ -34,5 +34,5 @@
     MODULE PROCEDURE gather2D_mpi_i,gather2D_mpi_i1,gather2D_mpi_i2,gather2D_mpi_i3, &
                      gather2D_mpi_r,gather2D_mpi_r1,gather2D_mpi_r2,gather2D_mpi_r3, &
-		     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
+                     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
   END INTERFACE 
   
@@ -45,5 +45,5 @@
     MODULE PROCEDURE grid1dTo2d_mpi_i,grid1dTo2d_mpi_i1,grid1dTo2d_mpi_i2,grid1dTo2d_mpi_i3, &
                      grid1dTo2d_mpi_r,grid1dTo2d_mpi_r1,grid1dTo2d_mpi_r2,grid1dTo2d_mpi_r3, &
-		     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
+                     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
  END INTERFACE 
 
@@ -51,5 +51,5 @@
     MODULE PROCEDURE grid2dTo1d_mpi_i,grid2dTo1d_mpi_i1,grid2dTo1d_mpi_i2,grid2dTo1d_mpi_i3, &
                      grid2dTo1d_mpi_r,grid2dTo1d_mpi_r1,grid2dTo1d_mpi_r2,grid2dTo1d_mpi_r3, &
-		     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
+                     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
  END INTERFACE 
     
@@ -514,5 +514,5 @@
 
   SUBROUTINE scatter2D_mpi_i(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -528,5 +528,5 @@
 
   SUBROUTINE scatter2D_mpi_i1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -541,5 +541,5 @@
 
   SUBROUTINE scatter2D_mpi_i2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -555,5 +555,5 @@
   
   SUBROUTINE scatter2D_mpi_i3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -570,5 +570,5 @@
 
   SUBROUTINE scatter2D_mpi_r(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -585,5 +585,5 @@
 
   SUBROUTINE scatter2D_mpi_r1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
     REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
@@ -599,5 +599,5 @@
 
   SUBROUTINE scatter2D_mpi_r2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -613,5 +613,5 @@
   
   SUBROUTINE scatter2D_mpi_r3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -628,5 +628,5 @@
   
   SUBROUTINE scatter2D_mpi_l(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -643,5 +643,5 @@
 
   SUBROUTINE scatter2D_mpi_l1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -658,5 +658,5 @@
 
   SUBROUTINE scatter2D_mpi_l2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -672,5 +672,5 @@
   
   SUBROUTINE scatter2D_mpi_l3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid2dTo1d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -691,5 +691,5 @@
 
   SUBROUTINE gather2D_mpi_i(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -705,5 +705,5 @@
 
   SUBROUTINE gather2D_mpi_i1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -719,5 +719,5 @@
 
   SUBROUTINE gather2D_mpi_i2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -733,5 +733,5 @@
   
   SUBROUTINE gather2D_mpi_i3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -749,5 +749,5 @@
 
   SUBROUTINE gather2D_mpi_r(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -763,5 +763,5 @@
 
   SUBROUTINE gather2D_mpi_r1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -777,5 +777,5 @@
 
   SUBROUTINE gather2D_mpi_r2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -791,5 +791,5 @@
   
   SUBROUTINE gather2D_mpi_r3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -807,5 +807,5 @@
   
   SUBROUTINE gather2D_mpi_l(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -821,5 +821,5 @@
 
   SUBROUTINE gather2D_mpi_l1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -835,5 +835,5 @@
 
   SUBROUTINE gather2D_mpi_l2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -849,5 +849,5 @@
   
   SUBROUTINE gather2D_mpi_l3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz, only: klon_glo, grid1dTo2d_glo
+    USE mod_grid_phy_lmdz
     IMPLICIT NONE
   
@@ -1236,5 +1236,5 @@
 
   SUBROUTINE bcast_mpi_cgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     IMPLICIT NONE
     
@@ -1250,5 +1250,5 @@
     
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1258,9 +1258,9 @@
       
   SUBROUTINE bcast_mpi_igen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
     INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
     
 #ifdef CPP_MPI
@@ -1272,5 +1272,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1281,9 +1281,32 @@
   
   SUBROUTINE bcast_mpi_rgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
     REAL,DIMENSION(nb),INTENT(INOUT) :: Var
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+    
+  END SUBROUTINE bcast_mpi_rgen
+  
+
+
+
+  SUBROUTINE bcast_mpi_lgen(var,nb)
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
     INTEGER,INTENT(IN) :: nb
+    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
     
 #ifdef CPP_MPI
@@ -1295,32 +1318,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-    
-  END SUBROUTINE bcast_mpi_rgen
-  
-
-
-
-  SUBROUTINE bcast_mpi_lgen(var,nb)
-    USE mod_phys_lmdz_mpi_data ,  mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
-    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) RETURN
-
-#ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_root_x,COMM_LMDZ_PHY,ierr)
-    if (ierr.ne.MPI_SUCCESS) then
-      write(*,*) "bcast_mpi error: ierr=",ierr
-      stop
-    endif
+    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1330,5 +1326,5 @@
 
   SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1369,5 +1365,5 @@
 #ifdef CPP_MPI 
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_INTEGER,VarOut,klon_mpi*dimsize,   &
-                      MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1375,5 +1371,5 @@
 
   SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1413,5 +1409,5 @@
 #ifdef CPP_MPI 
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_REAL_LMDZ,VarOut,klon_mpi*dimsize,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
 
 #endif
@@ -1421,5 +1417,5 @@
   
   SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1459,5 +1455,5 @@
 #ifdef CPP_MPI
     CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_LOGICAL,VarOut,klon_mpi*dimsize,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
 #endif
 
@@ -1468,5 +1464,5 @@
 
   SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1497,5 +1493,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
      
@@ -1504,8 +1500,8 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs,   &
-                     MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-
-		          
+                     MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1514,5 +1510,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1522,5 +1518,5 @@
 
   SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1546,5 +1542,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
     ENDIF
@@ -1557,7 +1553,7 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-		          
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1566,5 +1562,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1574,5 +1570,5 @@
 
   SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1603,5 +1599,5 @@
         displs(rank)=Index-1
         counts(rank)=nb*dimsize
-	Index=Index+nb*dimsize
+        Index=Index+nb*dimsize
       ENDDO
     ENDIF
@@ -1610,7 +1606,7 @@
 #ifdef CPP_MPI
     CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-		          
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
     IF (is_mpi_root) THEN
       Index=1
@@ -1619,5 +1615,5 @@
         DO i=1,dimsize
           VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-	  Index=Index+nb
+          Index=Index+nb
         ENDDO
       ENDDO
@@ -1629,5 +1625,5 @@
 
   SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
     IMPLICIT NONE
@@ -1637,7 +1633,7 @@
 #endif
    
+    INTEGER,INTENT(IN) :: nb
     INTEGER,DIMENSION(nb),INTENT(IN) :: VarIn
     INTEGER,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER,INTENT(IN) :: nb
     INTEGER :: ierr
    
@@ -1649,5 +1645,5 @@
 
 #ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
             
@@ -1655,5 +1651,5 @@
   
   SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
+    USE mod_phys_lmdz_mpi_data 
     USE mod_grid_phy_lmdz
 
@@ -1664,7 +1660,7 @@
 #endif
     
+    INTEGER,INTENT(IN) :: nb
     REAL,DIMENSION(nb),INTENT(IN) :: VarIn
     REAL,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER,INTENT(IN) :: nb
     INTEGER :: ierr
  
@@ -1675,5 +1671,5 @@
    
 #ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
         
@@ -1711,5 +1707,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1719,5 +1715,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1755,5 +1751,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1763,5 +1759,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1800,5 +1796,5 @@
         DO ij=1,nbp_lon
          VarOut(ij,i)=VarIn(1,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1808,5 +1804,5 @@
         DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
          VarOut(ij,i)=VarIn(klon_mpi,i)
-	ENDDO
+        ENDDO
       ENDDO
     ENDIF
@@ -1905,2 +1901,3 @@
 
 END MODULE mod_phys_lmdz_mpi_transfert
+
Index: trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_omp_data.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_omp_data.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_omp_data.F90	(revision 1543)
@@ -1,4 +1,4 @@
 !
-!$Id: mod_phys_lmdz_omp_data.F90 1575 2011-09-21 13:57:48Z jghattas $
+!$Id: mod_phys_lmdz_omp_data.F90 2326 2015-07-10 12:24:29Z emillour $
 !
 MODULE mod_phys_lmdz_omp_data
@@ -91,17 +91,17 @@
   SUBROUTINE Print_module_data
   IMPLICIT NONE
-!  INCLUDE "iniprint.h"
+  INCLUDE "iniprint.h"
 
 !$OMP CRITICAL  
-  WRITE(*,*)'--------> TASK ',omp_rank
-  WRITE(*,*)'omp_size =',omp_size
-  WRITE(*,*)'omp_rank =',omp_rank
-  WRITE(*,*)'is_omp_root =',is_omp_root
-  WRITE(*,*)'klon_omp_para_nb =',klon_omp_para_nb
-  WRITE(*,*)'klon_omp_para_begin =',klon_omp_para_begin
-  WRITE(*,*)'klon_omp_para_end =',klon_omp_para_end    
-  WRITE(*,*)'klon_omp =',klon_omp
-  WRITE(*,*)'klon_omp_begin =',klon_omp_begin
-  WRITE(*,*)'klon_omp_end =',klon_omp_end    
+  WRITE(lunout,*)'--------> TASK ',omp_rank
+  WRITE(lunout,*)'omp_size =',omp_size
+  WRITE(lunout,*)'omp_rank =',omp_rank
+  WRITE(lunout,*)'is_omp_root =',is_omp_root
+  WRITE(lunout,*)'klon_omp_para_nb =',klon_omp_para_nb
+  WRITE(lunout,*)'klon_omp_para_begin =',klon_omp_para_begin
+  WRITE(lunout,*)'klon_omp_para_end =',klon_omp_para_end    
+  WRITE(lunout,*)'klon_omp =',klon_omp
+  WRITE(lunout,*)'klon_omp_begin =',klon_omp_begin
+  WRITE(lunout,*)'klon_omp_end =',klon_omp_end    
 !$OMP END CRITICAL
 
Index: trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_omp_transfert.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_omp_transfert.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_omp_transfert.F90	(revision 1543)
@@ -25,5 +25,5 @@
                      bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, &
                      bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, &
-		     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
+                     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
   END INTERFACE
 
@@ -31,5 +31,5 @@
     MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, &
                      scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, &
-		     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
+                     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
   END INTERFACE
 
@@ -38,5 +38,5 @@
     MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, &
                      gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, &
-		     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
+                     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
   END INTERFACE
   
@@ -48,8 +48,15 @@
 
 
-  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp
+  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, omp_barrier
 
 CONTAINS
 
+  SUBROUTINE omp_barrier
+  IMPLICIT NONE
+
+!$OMP BARRIER
+
+  END SUBROUTINE omp_barrier
+  
   SUBROUTINE check_buffer_i(buff_size)
   IMPLICIT NONE
@@ -733,7 +740,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
     INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
 
     INTEGER :: i
@@ -757,7 +764,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
     REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
 
     INTEGER :: i
@@ -780,7 +787,7 @@
   IMPLICIT NONE
     
+    INTEGER,INTENT(IN) :: Nb
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
   
     INTEGER :: i
@@ -802,5 +809,5 @@
 
   SUBROUTINE scatter_omp_igen(VarIn,VarOut,dimsize,Buff)
-    USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+    USE mod_phys_lmdz_omp_data
     USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
     IMPLICIT NONE
@@ -833,5 +840,5 @@
 
   SUBROUTINE scatter_omp_rgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -864,5 +871,5 @@
 
   SUBROUTINE scatter_omp_lgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -898,5 +905,5 @@
 
   SUBROUTINE gather_omp_igen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -930,5 +937,5 @@
 
   SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
@@ -962,5 +969,5 @@
 
   SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data, only: klon_omp, klon_omp_begin
+  USE mod_phys_lmdz_omp_data
   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
   IMPLICIT NONE
Index: trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_para.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_para.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_para.F90	(revision 1543)
@@ -16,12 +16,12 @@
 CONTAINS
 
-  SUBROUTINE Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator)
   IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+    INTEGER,INTENT(in) :: nbp
+    INTEGER,INTENT(in) :: nbp_lon
+    INTEGER,INTENT(in) :: nbp_lat
+    INTEGER,INTENT(in) :: communicator
 
-    CALL Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
+    CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,communicator)
 !$OMP PARALLEL
     CALL Init_phys_lmdz_omp_data(klon_mpi)
@@ -45,8 +45,7 @@
 
   SUBROUTINE Test_transfert
-  USE mod_grid_phy_lmdz, only: klon_glo, nbp_lev, nbp_lon, nbp_lat, &
-                               grid1dTo2d_glo, grid2dTo1d_glo
+  USE mod_grid_phy_lmdz
   IMPLICIT NONE
-!    INCLUDE "iniprint.h"
+    INCLUDE "iniprint.h"
  
     REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
@@ -82,5 +81,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      WRITE(*,*) "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
@@ -94,5 +93,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      WRITE(*,*) "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
@@ -104,5 +103,5 @@
 !$OMP MASTER  
       Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
-      WRITE(*,*) "------> Checksum =",Checksum," MUST BE 0"
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
 !$OMP END MASTER
     ENDIF
Index: trunk/LMDZ.MARS/libf/phy_common/physics_distribution_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phy_common/physics_distribution_mod.F90	(revision 1543)
+++ trunk/LMDZ.MARS/libf/phy_common/physics_distribution_mod.F90	(revision 1543)
@@ -0,0 +1,71 @@
+!
+!$Id: physics_distribution_mod.F90 2351 2015-08-25 15:14:59Z emillour $
+!
+MODULE physics_distribution_mod
+
+
+CONTAINS
+
+  SUBROUTINE init_physics_distribution(grid_type, nvertex, &
+                                       nbp, nbp_lon, nbp_lat, nbp_lev, &
+                                       communicator)
+  USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para
+  USE mod_grid_phy_lmdz, ONLY: init_grid_phy_lmdz
+  IMPLICIT NONE
+    INTEGER,INTENT(IN) :: grid_type 
+    INTEGER,INTENT(IN) :: nvertex 
+    INTEGER,INTENT(IN) :: nbp           
+    INTEGER,INTENT(IN) :: nbp_lon
+    INTEGER,INTENT(IN) :: nbp_lat
+    INTEGER,INTENT(IN) :: nbp_lev
+    INTEGER,INTENT(IN) :: communicator
+
+
+    CALL init_grid_phy_lmdz(grid_type,nvertex, nbp_lon,nbp_lat,nbp_lev)
+    CALL init_phys_lmdz_para(nbp,nbp_lon, nbp_lat, communicator)
+
+  END SUBROUTINE init_physics_distribution  
+
+!SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
+!  USE mod_phys_lmdz_para, ONLY: Init_phys_lmdz_para!, klon_omp
+!  USE mod_grid_phy_lmdz, ONLY: Init_grid_phy_lmdz!, nbp_lev
+!  USE dimphy, ONLY : Init_dimphy
+!  USE infotrac_phy, ONLY : type_trac
+!#ifdef REPROBUS
+!  USE CHEM_REP, ONLY : Init_chem_rep_phys
+!#endif
+
+!  IMPLICIT NONE
+  
+!    INTEGER,INTENT(in) :: iim
+!    INTEGER,INTENT(in) :: jjp1
+!    INTEGER,INTENT(in) :: llm
+!    INTEGER,INTENT(in) :: nb_proc
+!    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+
+
+!    CALL Init_grid_phy_lmdz(iim,jjp1,llm)
+!    CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+!!$OMP PARALLEL
+!    CALL Init_dimphy(klon_omp,nbp_lev)
+!
+!! Initialization of Reprobus
+!    IF (type_trac == 'repr') THEN
+!#ifdef REPROBUS
+!       CALL Init_chem_rep_phys(klon_omp,nbp_lev)
+!#endif
+!    END IF
+!
+!!$OMP END PARALLEL
+ 
+!END SUBROUTINE Init_Phys_lmdz  
+
+
+
+
+
+
+
+
+END MODULE physics_distribution_mod
+
Index: trunk/LMDZ.MARS/libf/phymars/aeropacity.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/aeropacity.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/aeropacity.F	(revision 1543)
@@ -8,8 +8,8 @@
      &                      igcm_dust_submicron, rho_dust, rho_ice,
      &                      nqdust
-      use comgeomphy, only: latitude ! grid point latitudes (rad)
+      use geometry_mod, only: latitude ! grid point latitudes (rad)
       use comgeomfi_h, only: sinlat ! sines of grid point latitudes
 #ifdef DUSTSTORM
-      use comgeomphy, only: longitude
+      use geometry_mod, only: longitude
       use tracer_mod, only: r3n_q, ref_r0, igcm_dust_number
 #endif
Index: trunk/LMDZ.MARS/libf/phymars/albedocaps.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/albedocaps.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/albedocaps.F90	(revision 1543)
@@ -6,5 +6,5 @@
 ! to use the 'getin' routine 
 use ioipsl_getincom, only: getin
-use comgeomphy, only: latitude ! grid point latitudes (rad)
+use geometry_mod, only: latitude ! grid point latitudes (rad)
 use surfdat_h, only: TESicealbedo, TESice_Ncoef, TESice_Scoef, &
                      emisice, albedice, watercaptag, albedo_h2o_ice, &
@@ -87,5 +87,5 @@
 subroutine TES_icecap_albedo(zls,ig,alb,icap)
 
-use comgeomphy, only: latitude, longitude ! in radians
+use geometry_mod, only: latitude, longitude ! in radians
 use surfdat_h, only: albedice, TESice_Ncoef, TESice_Scoef
 use netcdf, only: nf90_open, NF90_NOWRITE, NF90_NOERR, &
Index: trunk/LMDZ.MARS/libf/phymars/co2snow.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/co2snow.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/co2snow.F	(revision 1543)
@@ -3,5 +3,5 @@
 
       use surfdat_h, only: iceradius, dtemisice
-      use comgeomphy, only: latitude ! grid point latitudes (rad)
+      use geometry_mod, only: latitude ! grid point latitudes (rad)
       use time_phylmdz_mod, only: daysec
       IMPLICIT NONE
Index: trunk/LMDZ.MARS/libf/phymars/comgeomphy.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/comgeomphy.F90	(revision 1542)
+++ 	(revision )
@@ -1,23 +1,0 @@
-module comgeomphy
-   real,save,allocatable :: cell_area(:) ! airephy(:)
-   real,save,allocatable :: dx(:) !cuphy(:)
-   real,save,allocatable :: dy(:) !cvphy(:)
-   real,save,allocatable :: latitude(:) !rlatd(:)
-   real,save,allocatable :: longitude(:) !rlond(:)
-!$OMP THREADPRIVATE(cell_area,dx,dy,latitude,longitude)
-contains
-  
-  subroutine initcomgeomphy
-  USE mod_phys_lmdz_para, only: klon_omp
-  implicit none
-    
- 
-    allocate(cell_area(klon_omp))
-    allocate(dx(klon_omp))
-    allocate(dy(klon_omp))
-    allocate(latitude(klon_omp))
-    allocate(longitude(klon_omp))
-
-  end subroutine initcomgeomphy
-  
-end module comgeomphy
Index: trunk/LMDZ.MARS/libf/phymars/dyn1d/mod_interface_dyn_phys.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/dyn1d/mod_interface_dyn_phys.F90	(revision 1543)
+++ trunk/LMDZ.MARS/libf/phymars/dyn1d/mod_interface_dyn_phys.F90	(revision 1543)
@@ -0,0 +1,1 @@
+link ../../dynphy_lonlat/mod_interface_dyn_phys.F90
Index: trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F	(revision 1543)
@@ -3,4 +3,6 @@
 ! to use  'getin'
       USE ioipsl_getincom, only: getin
+      use dimphy, only : init_dimphy
+      use mod_grid_phy_lmdz, only : regular_lonlat
       use infotrac, only: nqtot, tname
       use comsoil_h, only: volcapa, layer, mlayer, inertiedat, nsoilmx
@@ -12,5 +14,5 @@
       use slope_mod, only: theta_sl, psi_sl
       use phyredem, only: physdem0,physdem1
-      use comgeomphy, only: initcomgeomphy, cell_area
+      use geometry_mod, only: init_geometry
       use planete_h, only: year_day, periheli, aphelie, peri_day,
      &                     obliquit, emin_turb, lmixmin
@@ -21,5 +23,7 @@
       USE comvert_mod, ONLY: ap,bp,aps,bps,pa,preff,sig
       USE logic_mod, ONLY: hybrid
+      use physics_distribution_mod, only: init_physics_distribution
       use regular_lonlat_mod, only: init_regular_lonlat
+      use mod_interface_dyn_phys, only: init_interface_dyn_phys
       USE phys_state_var_init_mod, ONLY: phys_state_var_init
       IMPLICIT NONE
@@ -106,5 +110,5 @@
       Logical  tracerdyn
       integer :: nq=1 ! number of tracers
-      real :: latitude(1), longitude(1)
+      real :: latitude(1), longitude(1), cell_area(1)
 
       character*2 str2
@@ -119,6 +123,6 @@
 ! initialize "serial/parallel" related stuff
 !      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
-      CALL init_phys_lmdz(1,1,llm,1,(/1/))
-      call initcomgeomphy
+!      CALL init_phys_lmdz(1,1,llm,1,(/1/))
+!      call initcomgeomphy
 
 c ------------------------------------------------------
@@ -483,6 +487,13 @@
 !Mars possible matter with dtphys in input and include!!!
 ! Initializations below should mimick what is done in iniphysiq for 3D GCM
+      call init_physics_distribution(regular_lonlat,4,
+     &                               1,1,1,nlayer,1)
+      call init_interface_dyn_phys
       call init_regular_lonlat(1,1,longitude,latitude,
      &                   (/0.,0./),(/0.,0./))
+      call init_geometry(1,longitude,latitude,
+     &                   (/0.,0.,0.,0./),(/0.,0.,0.,0./),
+     &                   cell_area)
+      call init_dimphy(1,nlayer) ! Initialize dimphy module
       call phys_state_var_init(1,llm,nq,
      .          day0,time,daysec,dtphys,rad,g,r,cpp)
Index: trunk/LMDZ.MARS/libf/phymars/eofdump_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/eofdump_mod.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/eofdump_mod.F90	(revision 1543)
@@ -80,5 +80,5 @@
       subroutine ineofdump(ngrid,nlayer)
 
-      use comgeomphy, only: longitude, latitude
+      use geometry_mod, only: longitude, latitude
       use comcstfi_h, only: pi
       use time_phylmdz_mod, only: daysec, dtphys
Index: trunk/LMDZ.MARS/libf/phymars/getslopes.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/getslopes.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/getslopes.F90	(revision 1543)
@@ -1,5 +1,5 @@
 subroutine getslopes(ngrid,geopot)
     
-use comgeomphy, only: longitude, latitude ! in radians
+use geometry_mod, only: longitude, latitude ! in radians
 use slope_mod, only: theta_sl, psi_sl
 use comcstfi_h, only: g, rad, pi
Index: trunk/LMDZ.MARS/libf/phymars/init_phys_lmdz.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/init_phys_lmdz.F90	(revision 1542)
+++ 	(revision )
@@ -1,27 +1,0 @@
-!
-! $Id$
-!
-SUBROUTINE init_phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
-  USE mod_phys_lmdz_omp_data, only: klon_omp
-  USE mod_grid_phy_lmdz, only: nbp_lev
-  USE mod_phys_lmdz_para, only: init_phys_lmdz_para
-  USE mod_grid_phy_lmdz, only: init_grid_phy_lmdz
-  USE dimphy, ONLY : init_dimphy
-
-  IMPLICIT NONE
-  
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: llm
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-
-
-    CALL init_grid_phy_lmdz(iim,jjp1,llm)
-    CALL init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
-!$OMP PARALLEL
-    CALL init_dimphy(klon_omp,nbp_lev)
-
-!$OMP END PARALLEL
- 
-END SUBROUTINE init_phys_lmdz  
Index: trunk/LMDZ.MARS/libf/phymars/newcondens.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/newcondens.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/newcondens.F	(revision 1543)
@@ -8,5 +8,5 @@
        use tracer_mod, only: noms
        use surfdat_h, only: emissiv, phisfi
-       use comgeomphy, only: latitude ! grid point latitudes (rad)
+       use geometry_mod, only: latitude ! grid point latitudes (rad)
        use planete_h
        USE comcstfi_h
Index: trunk/LMDZ.MARS/libf/phymars/phyredem.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 1543)
@@ -14,5 +14,5 @@
   use infotrac, only: nqtot, tname
   use comsoil_h, only: inertiedat, volcapa, mlayer
-  use comgeomphy, only: cell_area
+  use geometry_mod, only: cell_area
   use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
                        z0_default, albedice, emisice, emissiv, &
Index: trunk/LMDZ.MARS/libf/phymars/physiq.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/physiq.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/physiq.F	(revision 1543)
@@ -15,5 +15,5 @@
       use comsoil_h, only: inertiedat, ! soil thermal inertia
      &                     tsoil, nsoilmx ! number of subsurface layers
-      use comgeomphy, only: longitude, latitude, cell_area
+      use geometry_mod, only: longitude, latitude, cell_area
       use comgeomfi_h, only: sinlon, coslon, sinlat, coslat
       use surfdat_h, only: phisfi, albedodat, zmea, zstd, zsig, zgam,
Index: trunk/LMDZ.MARS/libf/phymars/read_dust_scenario.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/read_dust_scenario.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/read_dust_scenario.F90	(revision 1543)
@@ -4,5 +4,5 @@
 
 use netcdf
-use comgeomphy, only: latitude, longitude ! in radians
+use geometry_mod, only: latitude, longitude ! in radians
 implicit none
 
Index: trunk/LMDZ.MARS/libf/phymars/surfini.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/surfini.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/surfini.F	(revision 1543)
@@ -4,5 +4,5 @@
       use netcdf
       use tracer_mod, only: nqmx, noms
-      use comgeomphy, only: longitude, latitude ! in radians
+      use geometry_mod, only: longitude, latitude ! in radians
       use surfdat_h, only: watercaptag, frost_albedo_threshold,
      &                     albedo_h2o_ice, inert_h2o_ice, albedodat,
Index: trunk/LMDZ.MARS/libf/phymars/tabfi.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/tabfi.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/tabfi.F	(revision 1543)
@@ -56,5 +56,5 @@
       implicit none
  
-#include "netcdf.inc"
+      include "netcdf.inc"
 
 c-----------------------------------------------------------------------
@@ -148,19 +148,4 @@
 c Read 'controle' array
 c
-!      ierr = NF_INQ_VARID (nid, "controle", nvarid)
-!      IF (ierr .NE. NF_NOERR) THEN
-!         PRINT*, "Tabfi: Could not find <controle> data"
-!         CALL abort
-!      ENDIF
-!#ifdef NC_DOUBLE
-!      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl)
-!#else
-!      ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl)
-!#endif
-!      IF (ierr .NE. NF_NOERR) THEN
-!         PRINT*, "Tabfi: Failed reading <controle> array"
-!         CALL abort
-!      ENDIF
-
        call get_var("controle",tab_cntrl,found)
        if (.not.found) then
@@ -173,8 +158,4 @@
 c  Initialization of some physical constants
 c informations on physics grid
-!      if(ngridmx.ne.tab_cntrl(tab0+1)) then
-!         print*,'tabfi: WARNING !!! tab_cntrl(tab0+1).ne.ngridmx'
-!         print*,tab_cntrl(tab0+1),ngridmx
-!      endif
       lmax = nint(tab_cntrl(tab0+2))
       day_ini = tab_cntrl(tab0+3)
Index: trunk/LMDZ.MARS/libf/phymars/writediagfi.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/writediagfi.F	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/writediagfi.F	(revision 1543)
@@ -40,5 +40,5 @@
 !=================================================================
       use surfdat_h, only: phisfi
-      use comgeomphy, only: cell_area
+      use geometry_mod, only: cell_area
       use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini
       USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root,
Index: trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90	(revision 1542)
+++ trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90	(revision 1543)
@@ -13,5 +13,5 @@
 
 use comsoil_h, only: nsoilmx, inertiedat
-use comgeomphy, only: cell_area
+use geometry_mod, only: cell_area
 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq
 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
Index: trunk/LMDZ.TITAN/libf/phytitan/calchim.F
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/calchim.F	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/calchim.F	(revision 1543)
@@ -17,5 +17,4 @@
       use common_mod, only:utilaer,maer,prodaer,csn,csh,psurfhaze,
      .                     NLEV,NLRT,NC,ND,NR
-      USE comgeomphy,  only: rlatd
       USE moyzon_mod, only: tmoy,playmoy,zlaymoy,zlevmoy,klat
       use mod_grid_phy_lmdz, only: nbp_lat
Index: trunk/LMDZ.TITAN/libf/phytitan/comgeomphy.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/comgeomphy.F90	(revision 1542)
+++ 	(revision )
@@ -1,23 +1,0 @@
-module comgeomphy
-   real,save,allocatable :: airephy(:)
-   real,save,allocatable :: cuphy(:)
-   real,save,allocatable :: cvphy(:)
-   real,save,allocatable :: rlatd(:)
-   real,save,allocatable :: rlond(:)
-!$OMP THREADPRIVATE(airephy,cuphy,cvphy,rlatd,rlond)
-contains
-  
-  subroutine initcomgeomphy
-  USE mod_phys_lmdz_para
-  implicit none
-    
- 
-    allocate(airephy(klon_omp))
-    allocate(cuphy(klon_omp))
-    allocate(cvphy(klon_omp))
-    allocate(rlatd(klon_omp))
-    allocate(rlond(klon_omp))
-
-  end subroutine initcomgeomphy
-  
-end module comgeomphy
Index: trunk/LMDZ.TITAN/libf/phytitan/init_phys_lmdz.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/init_phys_lmdz.F90	(revision 1542)
+++ 	(revision )
@@ -1,25 +1,0 @@
-!
-!$Header$
-!
-SUBROUTINE init_phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
-  USE mod_phys_lmdz_para
-  USE mod_grid_phy_lmdz
-  USE dimphy, ONLY : init_dimphy
-  USE infotrac, ONLY : type_trac
-
-  IMPLICIT NONE
-  
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: llm
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-
-
-    CALL init_grid_phy_lmdz(iim,jjp1,llm)
-    CALL init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
-!$OMP PARALLEL
-    CALL init_dimphy(klon_omp,nbp_lev)
-!$OMP END PARALLEL
- 
-END SUBROUTINE init_phys_lmdz  
Index: trunk/LMDZ.TITAN/libf/phytitan/muphys3D.F
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/muphys3D.F	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/muphys3D.F	(revision 1543)
@@ -65,5 +65,5 @@
          use dimphy
 c         use radcommon_h, only : volume,rayon,vrat,drayon,dvolume
-         USE comgeomphy,  only: rlatd
+         USE geometry_mod,  only: latitude
 
          IMPLICIT NONE
@@ -235,5 +235,5 @@
 c***************************************************************
         if((IHOR.eq.1)    
-     & .or.(rlatd(IHOR).ne.rlatd(im1))
+     & .or.(latitude(IHOR).ne.latitude(im1))
      & .or.(microfi.eq.2)) then
 c***************************************************************
Index: trunk/LMDZ.TITAN/libf/phytitan/pg2.old
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/pg2.old	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/pg2.old	(revision 1543)
@@ -42,5 +42,5 @@
 
       use dimphy
-      USE comgeomphy
+      USE geometry_mod, ONLY: latitude
 #include "dimensions.h"
 #include "microtab.h"
@@ -180,5 +180,5 @@
       lati(1)     = 0.5*RPI
       DO ig=2,ngrid-1
-        lati(ig)  = rlatd(2+(ig-2)*iim)*RPI/180.
+        lati(ig)  = latitude(2+(ig-2)*iim)*RPI/180.
       ENDDO
       lati(ngrid) = -0.5*RPI
@@ -197,9 +197,9 @@
 c     print*,"ENTREE PG2 PREMIER APPEL"
 c     print*,airetot,' airetot?= ',4.*RPI*RA*RA
-c     print*,1,rlatd(1),aire(1),aire(1)/airetot,' aires'
+c     print*,1,latitude(1),aire(1),aire(1)/airetot,' aires'
 c     DO ig=2,ngrid-1
-c     print*,ig,rlatd(2+(ig-2)*iim),aire(ig),aire(ig)/airetot,' aires'
+c     print*,ig,latitude(2+(ig-2)*iim),aire(ig),aire(ig)/airetot,' aires'
 c     ENDDO
-c     print*,ngrid,rlatd(klon),aire(ngrid),aire(ngrid)/airetot,' aires'
+c     print*,ngrid,latitude(klon),aire(ngrid),aire(ngrid)/airetot,' aires'
 c     stop
       
Index: trunk/LMDZ.TITAN/libf/phytitan/phyetat0.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/phyetat0.F90	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/phyetat0.F90	(revision 1543)
@@ -13,5 +13,5 @@
       USE iostart
       USE infotrac
-      USE comgeomphy,  only: rlatd,rlond
+      USE geometry_mod,  only: latitude,longitude
       USE time_phylmdz_mod, only: itau_phy, raz_date
 
@@ -76,5 +76,5 @@
 
 ! read latitudes
-call get_field("latitude",rlatd,found)
+call get_field("latitude",latitude,found)
       IF (.not.found) THEN
          PRINT*, 'phyetat0: Le champ <latitude> est absent'
@@ -83,5 +83,5 @@
 
 ! read longitudes
-call get_field("longitude",rlond,found)
+call get_field("longitude",longitude,found)
       IF (.not.found) THEN
          PRINT*, 'phyetat0: Le champ <longitude> est absent'
@@ -319,6 +319,6 @@
       resch4(1) = 0.    ! pole nord = 1 point
       DO i=2,klon
-          if ((rlatd(i).ge.75..and.rlatd(i).le.85.).or.  &
-              (rlatd(i).ge.-85.and.rlatd(i).le.-75.)) then
+          if ((latitude(i).ge.75..and.latitude(i).le.85.).or.  &
+              (latitude(i).ge.-85.and.latitude(i).le.-75.)) then
             resch4(i) = 2.
           else
@@ -352,5 +352,5 @@
 
 ! do some more initializations
-call init_iophy_new(rlatd,rlond)
+call init_iophy_new(latitude,longitude)
 
 end subroutine phyetat0
Index: trunk/LMDZ.TITAN/libf/phytitan/phyredem.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/phyredem.F90	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/phyredem.F90	(revision 1543)
@@ -12,5 +12,5 @@
                           put_var,put_field
       USE infotrac
-      USE comgeomphy,  only: rlatd,rlond
+      USE geometry_mod,  only: longitude, latitude
       USE time_phylmdz_mod, only: day_end, annee_ref, itau_phy, raz_date
 
@@ -64,7 +64,8 @@
 
       CALL put_field("longitude", &
-                     "Longitudes de la grille physique",rlond)
+                     "Longitudes de la grille physique",longitude)
      
-      CALL put_field("latitude","Latitudes de la grille physique",rlatd)
+      CALL put_field("latitude", &
+                     "Latitudes de la grille physique",latitude)
 
 ! variables
Index: trunk/LMDZ.TITAN/libf/phytitan/physiq.F
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/physiq.F	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/physiq.F	(revision 1543)
@@ -58,5 +58,5 @@
       USE infotrac
       use dimphy
-      USE comgeomphy
+      USE geometry_mod, ONLY: longitude, latitude, cell_area, dx, dy
       use cpdet_mod, only: cpdet, t2tpot
       USE mod_phys_lmdz_para, only : is_parallel,jj_nb
@@ -678,5 +678,5 @@
       IF (if_ebil.ge.1) THEN 
         ztit='after dynamic'
-        CALL diagetpq(airephy,ztit,ip_ebil,1,1,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,1,1,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
@@ -685,5 +685,5 @@
 C     est egale a la variation de la physique au pas de temps precedent.
 C     Donc la somme de ces 2 variations devrait etre nulle.
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , zero_v, zero_v, zero_v, zero_v, zero_v
      e      , zero_v, zero_v, zero_v, ztsol
@@ -726,5 +726,5 @@
       DO k = 1, klev
        DO i = 1, klon
-        omega(i,k) = RG*flxmw(i,k) / airephy(i)
+        omega(i,k) = RG*flxmw(i,k) / cell_area(i)
        END DO
       END DO
@@ -786,5 +786,5 @@
 
        DO i=2,klon
-        if (rlatd(i).ne.rlatd(i-1)) then
+        if (latitude(i).ne.latitude(i-1)) then
          DO l=1,klev
 c         zzlaybar(i,l)=(zphibar(i,l)+zphisbar(i))/RG
@@ -861,8 +861,8 @@
 
 c dans zenang, Ls en degres ; dans mucorr, Ls en radians
-      call mucorr(klon,zls,rlatd,rmu0bar,fractbar)
+      call mucorr(klon,zls,latitude,rmu0bar,fractbar)
       IF (cycle_diurne) THEN
         zdtime=dtime*REAL(radpas) ! pas de temps du rayonnement (s)
-        CALL zenang(zlsdeg,gmtime,zdtime,rlatd,rlond,rmu0,fract)
+        CALL zenang(zlsdeg,gmtime,zdtime,latitude,longitude,rmu0,fract)
       ELSE
         rmu0  = rmu0bar
@@ -917,5 +917,5 @@
      $            paprs,pplay,ppk,radsol,falbe,
      e            solsw, sollw, sollwdown, fder,
-     e            rlond, rlatd, cuphy, cvphy,   
+     e            longitude, latitude, dx, dy,   
      e            debut, lafin,
      s            d_t_vdf,d_u_vdf,d_v_vdf,d_ts,
@@ -966,8 +966,8 @@
       IF (if_ebil.ge.2) THEN 
         ztit='after clmain'
-        CALL diagetpq(airephy,ztit,ip_ebil,2,1,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,2,1,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
-         call diagphy(airephy,ztit,ip_ebil
+         call diagphy(cell_area,ztit,ip_ebil
      e      , zero_v, zero_v, zero_v, zero_v, sens
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1055,8 +1055,8 @@
       IF (if_ebil.ge.2) THEN 
         ztit='after dry_adjust'
-        CALL diagetpq(airephy,ztit,ip_ebil,2,2,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,2,2,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , zero_v, zero_v, zero_v, zero_v, sens
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1270,8 +1270,8 @@
       IF (if_ebil.ge.2) THEN 
         ztit='after rad'
-        CALL diagetpq(airephy,ztit,ip_ebil,2,2,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,2,2,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , topsw, toplw, solsw, sollw, zero_v
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1368,5 +1368,5 @@
 c A ADAPTER POUR VENUS ET TITAN!!!
 c            CALL lift_noro(klon,klev,dtime,paprs,pplay,
-c     e                   rlatd,zmea,zstd,zpic,zgam,zthe,zpic,zval,
+c     e                   latitude,zmea,zstd,zpic,zgam,zthe,zpic,zval,
 c     e                   igwd,idx,itest,
 c     e                   t_seri, u_seri, v_seri,
@@ -1425,5 +1425,5 @@
 c====================================================================
       if (ballons.eq.1) then
-         CALL ballon(30,pdtphys,rjourvrai,gmtime,rlatd,rlond,
+         CALL ballon(30,pdtphys,rjourvrai,gmtime,latitude,longitude,
 c    C               t,pplay,u,v,pphi)   ! alt above surface (smoothed for GCM)
      C               t,pplay,u,v,zphi)   ! alt above planet average radius
@@ -1459,5 +1459,5 @@
       CALL aaam_bud (27,klon,klev,rjourvrai,gmtime,
      C               ra,rg,romega,
-     C               rlatd,rlond,pphis,
+     C               latitude,longitude,pphis,
      C               zustrdr,zustrli,zustrcl,
      C               zvstrdr,zvstrli,zvstrcl,
@@ -1499,5 +1499,5 @@
       IF (if_ebil.ge.1) THEN 
         ztit='after physic'
-        CALL diagetpq(airephy,ztit,ip_ebil,1,1,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,1,1,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
@@ -1506,5 +1506,5 @@
 C     est egale a la variation de la physique au pas de temps precedent.
 C     Donc la somme de ces 2 variations devrait etre nulle.
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , topsw, toplw, solsw, sollw, sens
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1545,7 +1545,7 @@
 c     DO k = 1, klev
 c     DO i = 1, klon
-c       mang(i,k) = RA*cos(rlatd(i)*RPI/180.)
-c    .     *(u_seri(i,k)+RA*cos(rlatd(i)*RPI/180.)*ROMEGA)
-c    .     *airephy(i)*(paprs(i,k)-paprs(i,k+1))/RG
+c       mang(i,k) = RA*cos(latitude(i)*RPI/180.)
+c    .     *(u_seri(i,k)+RA*cos(latitude(i)*RPI/180.)*ROMEGA)
+c    .     *cell_area(i)*(paprs(i,k)-paprs(i,k+1))/RG
 c       mangtot=mangtot+mang(i,k)
 c     ENDDO
Index: trunk/LMDZ.TITAN/libf/phytitan/radlwsw.F
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/radlwsw.F	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/radlwsw.F	(revision 1543)
@@ -35,5 +35,4 @@
 c======================================================================
       use dimphy
-      USE comgeomphy
       USE phys_state_var_mod, only: falbe,heat,cool,radsol,
      .      topsw,toplw,solsw,sollw,sollwdown,lwnet,swnet,
Index: trunk/LMDZ.TITAN/libf/phytitan/radtitan.F
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/radtitan.F	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/radtitan.F	(revision 1543)
@@ -33,5 +33,5 @@
       USE infotrac
       use dimphy
-      USE comgeomphy
+      USE geometry_mod, ONLY: latitude
       USE optcld, only : iniqcld
       use moyzon_mod, only:plevmoy
@@ -214,5 +214,5 @@
           somcoslat=0.
           do j=1,klon
-	    coslat(j) = cos(rlatd(j)*RPI/180.)
+	    coslat(j) = cos(latitude(j)*RPI/180.)
             somcoslat=somcoslat+coslat(j)
           enddo
Index: trunk/LMDZ.TITAN/libf/phytitan/write_histday.h
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/write_histday.h	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/write_histday.h	(revision 1543)
@@ -14,5 +14,5 @@
 
       call histwrite_phy(nid_day,.false.,"phis",itau_w,pphis)
-      call histwrite_phy(nid_day,.false.,"aire",itau_w,airephy)
+      call histwrite_phy(nid_day,.false.,"aire",itau_w,cell_area)
 
 ccccccc axe Ls ... Faudrait le reduire a axe temporel seulement...
Index: trunk/LMDZ.TITAN/libf/phytitan/write_histins.h
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/write_histins.h	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/write_histins.h	(revision 1543)
@@ -14,5 +14,5 @@
 
       call histwrite_phy(nid_ins,.false.,"phis",itau_w,pphis)
-      call histwrite_phy(nid_ins,.false.,"aire",itau_w,airephy)
+      call histwrite_phy(nid_ins,.false.,"aire",itau_w,cell_area)
 
 ccccccc axe Ls ... Faudrait le reduire a axe temporel seulement...
Index: trunk/LMDZ.TITAN/libf/phytitan/write_histmth.h
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/write_histmth.h	(revision 1542)
+++ trunk/LMDZ.TITAN/libf/phytitan/write_histmth.h	(revision 1543)
@@ -11,5 +11,5 @@
 
       call histwrite_phy(nid_mth,.false.,"phis",itau_w,pphis)
-      call histwrite_phy(nid_mth,.false.,"aire",itau_w,airephy)
+      call histwrite_phy(nid_mth,.false.,"aire",itau_w,cell_area)
 
 ccccccc axe Ls ... Faudrait le reduire a axe temporel seulement...
Index: trunk/LMDZ.VENUS/libf/phyvenus/clmain.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/clmain.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/clmain.F	(revision 1543)
@@ -11,5 +11,5 @@
      .                  paprs,pplay,ppk,radsol,albe,
      .                  solsw, sollw, sollwdown, fder,
-     .                  rlon, rlat, cufi, cvfi, 
+     .                  rlon, rlat, dx, dy, 
      .                  debut, lafin, 
      .                  d_t,d_u,d_v,d_ts,
@@ -52,6 +52,6 @@
 c radsol---input-R- flux radiatif net (positif vers le sol) en W/m**2
 c rlat-----input-R- latitude en degree
-c cufi-----input-R- resolution des mailles en x (m)
-c cvfi-----input-R- resolution des mailles en y (m)
+c dx-----input-R- resolution des mailles en x (m)
+c dy-----input-R- resolution des mailles en y (m)
 c
 c d_t------output-R- le changement pour "t"
@@ -80,5 +80,5 @@
 ! ADAPTATION GCM POUR CP(T)
       real ppk(klon,klev)
-      REAL rlon(klon), rlat(klon), cufi(klon), cvfi(klon)
+      REAL rlon(klon), rlat(klon), dx(klon), dy(klon)
       REAL d_t(klon, klev)
       REAL d_u(klon, klev), d_v(klon, klev)
@@ -398,5 +398,5 @@
 ! ADAPTATION GCM POUR CP(T)
       CALL clqh(dtime, itap, debut,lafin,
-     e          rlon, rlat, cufi, cvfi,
+     e          rlon, rlat, dx, dy,
      e          knon, 
      e          soil_model, ytsoil,
@@ -465,5 +465,5 @@
 
       SUBROUTINE clqh(dtime,itime, debut,lafin,
-     e                rlon, rlat, cufi, cvfi, 
+     e                rlon, rlat, dx, dy, 
      e                knon, 
      $                soil_model,tsoil,
@@ -510,5 +510,5 @@
       REAL albedo(klon)       ! albedo de la surface
       real rmu0(klon)         ! cosinus de l'angle solaire zenithal
-      real rlon(klon), rlat(klon), cufi(klon), cvfi(klon)
+      real rlon(klon), rlat(klon), dx(klon), dy(klon)
 c
       REAL d_t(klon,klev)     ! incrementation de "t"
@@ -686,5 +686,5 @@
       CALL interfsurf_hq(itime, dtime, rmu0,
      e klon, nbp_lon, nbp_lat-1, knon, 
-     e rlon, rlat, cufi, cvfi, 
+     e rlon, rlat, dx, dy, 
      e debut, lafin, soil_model, nsoilmx,tsoil, 
      e zlev1,  u1lay, v1lay, temp_air, epot_air,  
Index: trunk/LMDZ.VENUS/libf/phyvenus/comgeomphy.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/comgeomphy.F90	(revision 1542)
+++ 	(revision )
@@ -1,23 +1,0 @@
-module comgeomphy
-   real,save,allocatable :: airephy(:)
-   real,save,allocatable :: cuphy(:)
-   real,save,allocatable :: cvphy(:)
-   real,save,allocatable :: rlatd(:)
-   real,save,allocatable :: rlond(:)
-!$OMP THREADPRIVATE(airephy,cuphy,cvphy,rlatd,rlond)
-contains
-  
-  subroutine initcomgeomphy
-  USE mod_phys_lmdz_para
-  implicit none
-    
- 
-    allocate(airephy(klon_omp))
-    allocate(cuphy(klon_omp))
-    allocate(cvphy(klon_omp))
-    allocate(rlatd(klon_omp))
-    allocate(rlond(klon_omp))
-
-  end subroutine initcomgeomphy
-  
-end module comgeomphy
Index: trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/gr_dyn_fi.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/gr_dyn_fi.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/gr_dyn_fi.F	(revision 1543)
@@ -1,1 +1,1 @@
-link ../../dynlonlat_phylonlat/gr_dyn_fi.F
+link ../../dynphy_lonlat/gr_dyn_fi.F
Index: trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/iniphysiq_mod.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/iniphysiq_mod.F90	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/iniphysiq_mod.F90	(revision 1543)
@@ -1,1 +1,1 @@
-link ../../dynlonlat_phylonlat/phyvenus/iniphysiq_mod.F90
+link ../../dynphy_lonlat/phyvenus/iniphysiq_mod.F90
Index: trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/iniprint.h
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/iniprint.h	(revision 1542)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../dyn3d_common/iniprint.h
Index: trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/mod_interface_dyn_phys.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/mod_interface_dyn_phys.F90	(revision 1543)
+++ trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/mod_interface_dyn_phys.F90	(revision 1543)
@@ -0,0 +1,1 @@
+link ../../dynphy_lonlat/mod_interface_dyn_phys.F90
Index: trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/rcm1d.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/rcm1d.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/dyn1d/rcm1d.F	(revision 1543)
@@ -3,5 +3,4 @@
       USE infotrac
       use control_mod, only: planet_type, day_step
-      use comgeomphy
       USE phys_state_var_mod
       use chemparam_mod
@@ -14,5 +13,5 @@
       use conc, only: rho
       USE iniphysiq_mod, ONLY: iniphysiq
-
+      USE mod_const_mpi, ONLY: comm_lmdz
       IMPLICIT NONE
 
@@ -199,5 +198,5 @@
 c   ---------------------------------
 
-      CALL init_phys_lmdz(iim,jjm,llm,1,(/1/))
+!      CALL init_phys_lmdz(iim,jjm,llm,1,(/1/))
 
 c   la surface de chaque maille est inutile en 1D --->
@@ -210,5 +209,7 @@
 c e.g. for cell boundaries, which are meaningless in 1D; so pad these 
 c with '0.' when necessary
-      CALL iniphysiq(1,1,llm,daysec,day0,dtphys,
+      CALL iniphysiq(1,1,llm,
+     &            1,comm_lmdz,
+     &            daysec,day0,dtphys,
      &            (/lati(1),0./),(/0./),
      &            (/0.,0./),(/long(1),0./),
Index: trunk/LMDZ.VENUS/libf/phyvenus/init_phys_lmdz.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/init_phys_lmdz.F90	(revision 1542)
+++ 	(revision )
@@ -1,25 +1,0 @@
-!
-!$Header$
-!
-SUBROUTINE init_phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
-  USE mod_phys_lmdz_para
-  USE mod_grid_phy_lmdz
-  USE dimphy, ONLY : init_dimphy
-  USE infotrac, ONLY : type_trac
-
-  IMPLICIT NONE
-  
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: llm
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-
-
-    CALL init_grid_phy_lmdz(iim,jjp1,llm)
-    CALL init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
-!$OMP PARALLEL
-    CALL init_dimphy(klon_omp,nbp_lev)
-!$OMP END PARALLEL
- 
-END SUBROUTINE init_phys_lmdz  
Index: trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_sedim.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_sedim.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_sedim.F	(revision 1543)
@@ -7,5 +7,4 @@
       USE infotrac
       USE dimphy
-      USE comgeomphy
       USE chemparam_mod
       IMPLICIT NONE
Index: trunk/LMDZ.VENUS/libf/phyvenus/nirco2abs.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/nirco2abs.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/nirco2abs.F	(revision 1543)
@@ -3,5 +3,5 @@
 
        use dimphy
-       use comgeomphy, only: rlatd, rlond      
+       use geometry_mod, only: longitude, latitude
        use chemparam_mod, only: i_co2, i_o
 c       use compo_hedin83_mod2 
@@ -236,5 +236,5 @@
             zday_int = (n-1)/float(nstep)
 
-            CALL zenang(0.,zday_int,RDAY/nstep,rlatd,rlond,
+            CALL zenang(0.,zday_int,RDAY/nstep,latitude,longitude,
      s             mu0_int,fract_int)
 
Index: trunk/LMDZ.VENUS/libf/phyvenus/phyetat0.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/phyetat0.F90	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/phyetat0.F90	(revision 1543)
@@ -13,5 +13,5 @@
       USE iostart
       USE infotrac
-      USE comgeomphy,  only: rlatd,rlond
+      use geometry_mod, only: longitude, latitude
       USE time_phylmdz_mod, only: itau_phy, raz_date
 
@@ -65,5 +65,5 @@
 
 ! read latitudes
-call get_field("latitude",rlatd,found)
+call get_field("latitude",latitude,found)
       IF (.not.found) THEN
          PRINT*, 'phyetat0: Le champ <latitude> est absent'
@@ -72,5 +72,5 @@
 
 ! read longitudes
-call get_field("longitude",rlond,found)
+call get_field("longitude",longitude,found)
       IF (.not.found) THEN
          PRINT*, 'phyetat0: Le champ <longitude> est absent'
@@ -344,5 +344,5 @@
 
 ! do some more initializations
-call init_iophy_new(rlatd,rlond)
+call init_iophy_new(latitude,longitude)
 
 end subroutine phyetat0
Index: trunk/LMDZ.VENUS/libf/phyvenus/phyredem.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/phyredem.F90	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/phyredem.F90	(revision 1543)
@@ -12,5 +12,5 @@
                           put_var,put_field
       USE infotrac
-      USE comgeomphy,  only: rlatd,rlond
+      use geometry_mod, only: longitude, latitude
       USE time_phylmdz_mod, only: day_end, annee_ref, itau_phy, raz_date
 
@@ -62,7 +62,8 @@
 
       CALL put_field("longitude", &
-                     "Longitudes de la grille physique",rlond)
+                     "Longitudes de la grille physique",longitude)
      
-      CALL put_field("latitude","Latitudes de la grille physique",rlatd)
+      CALL put_field("latitude", &
+                     "Latitudes de la grille physique",latitude)
 
 ! variables
Index: trunk/LMDZ.VENUS/libf/phyvenus/physiq.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/physiq.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/physiq.F	(revision 1543)
@@ -58,5 +58,5 @@
       USE infotrac
       use dimphy
-      USE comgeomphy
+      USE geometry_mod, only: longitude, latitude, cell_area, dx, dy
       USE mod_phys_lmdz_para, only : is_parallel,jj_nb
       USE phys_state_var_mod ! Variables sauvegardees de la physique
@@ -665,5 +665,5 @@
       DO k = 1, klev
       DO i = 1, klon      
-         ilat=(rlatd(i)/5.625) + 17.
+         ilat=(latitude(i)/5.625) + 17.
          delta_temp(i,k)=mat_dtemp(INT(ilat),k)
       ENDDO
@@ -719,5 +719,5 @@
       IF (if_ebil.ge.1) THEN 
         ztit='after dynamic'
-        CALL diagetpq(airephy,ztit,ip_ebil,1,1,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,1,1,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
@@ -726,5 +726,5 @@
 C     est egale a la variation de la physique au pas de temps precedent.
 C     Donc la somme de ces 2 variations devrait etre nulle.
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , zero_v, zero_v, zero_v, zero_v, zero_v
      e      , zero_v, zero_v, zero_v, ztsol
@@ -767,5 +767,5 @@
       DO k = 1, klev
        DO i = 1, klon
-        omega(i,k) = RG*flxmw(i,k) / airephy(i)
+        omega(i,k) = RG*flxmw(i,k) / cell_area(i)
        END DO
       END DO
@@ -832,7 +832,7 @@
       IF (cycle_diurne) THEN
         zdtime=dtime*REAL(radpas) ! pas de temps du rayonnement (s)
-        CALL zenang(zlongi,gmtime,zdtime,rlatd,rlond,rmu0,fract)
+        CALL zenang(zlongi,gmtime,zdtime,latitude,longitude,rmu0,fract)
       ELSE
-        call mucorr(klon,zlongi,rlatd,rmu0,fract)
+        call mucorr(klon,zlongi,latitude,rmu0,fract)
       ENDIF
       
@@ -859,5 +859,5 @@
      I                   debut,lafin,nqmax,
      I                   nlon,nlev,dtime,paprs,
-     I                   rlatd,rlond,
+     I                   latitude,longitude,
      O                   tr_seri)
 
@@ -869,6 +869,6 @@
            DO k = 1, klev
            DO i = 1, klon      
-             ilat=(rlatd(i)/5.625) + 17.
-!             PRINT*,INT(ilat),rlatd(i),mat_dtemp(INT(ilat),k)
+             ilat=(latitude(i)/5.625) + 17.
+!             PRINT*,INT(ilat),latitude(i),mat_dtemp(INT(ilat),k)
              delta_temp(i,k)=mat_dtemp(INT(ilat),k)
            ENDDO
@@ -888,6 +888,6 @@
      I             nqmax,
      I             klon,
-     I             rlatd,
-     I             rlond,
+     I             latitude,
+     I             longitude,
      I             nlev,
      I             dtime,
@@ -902,6 +902,6 @@
      I             nqmax,
      I             klon,
-     I             rlatd,
-     I             rlond,
+     I             latitude,
+     I             longitude,
      I             nlev,
      I             dtime,
@@ -926,13 +926,13 @@
            CALL new_cloud_sedim(
      I                 klon,
-     I		     nlev,
-     I		     dtime,
+     I                     nlev,
+     I                     dtime,
      I                 pplay,
-     I		     paprs,
-     I		     t_seri+delta_temp,
+     I                     paprs,
+     I                     t_seri+delta_temp,
      I                 tr_seri,
-     O		     d_tr_sed,
-     O		     d_tr_ssed,
-     I		     nqmax,
+     O                     d_tr_sed,
+     O                     d_tr_ssed,
+     I                     nqmax,
      O                 Fsedim)
          else
@@ -940,13 +940,13 @@
            CALL new_cloud_sedim(
      I                 klon,
-     I		     nlev,
-     I		     dtime,
+     I                     nlev,
+     I                     dtime,
      I                 pplay,
-     I		     paprs,
-     I		     t_seri,
+     I                     paprs,
+     I                     t_seri,
      I                 tr_seri,
-     O		     d_tr_sed,
-     O		     d_tr_ssed,
-     I		     nqmax,
+     O                     d_tr_sed,
+     O                     d_tr_ssed,
+     I                     nqmax,
      O                 Fsedim)
 
@@ -1032,5 +1032,5 @@
      $            paprs,pplay,ppk,radsol,falbe,
      e            solsw, sollw, sollwdown, fder,
-     e            rlond, rlatd, cuphy, cvphy,   
+     e            longitude, latitude, dx, dy,   
      e            debut, lafin,
      s            d_t_vdf,d_u_vdf,d_v_vdf,d_ts,
@@ -1082,8 +1082,8 @@
       IF (if_ebil.ge.2) THEN 
         ztit='after clmain'
-        CALL diagetpq(airephy,ztit,ip_ebil,2,1,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,2,1,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
-         call diagphy(airephy,ztit,ip_ebil
+         call diagphy(cell_area,ztit,ip_ebil
      e      , zero_v, zero_v, zero_v, zero_v, sens
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1175,8 +1175,8 @@
       IF (if_ebil.ge.2) THEN 
         ztit='after dry_adjust'
-        CALL diagetpq(airephy,ztit,ip_ebil,2,2,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,2,2,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , zero_v, zero_v, zero_v, zero_v, sens
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1215,5 +1215,5 @@
       IF(callnlte.or.callthermos) THEN                                 
          call compo_hedin83_mod(pplay,rmu0,   
-     &	         co2vmr_gcm,covmr_gcm,ovmr_gcm,n2vmr_gcm,nvmr_gcm)
+     &                 co2vmr_gcm,covmr_gcm,ovmr_gcm,n2vmr_gcm,nvmr_gcm)
 
          IF(ok_chem) then
@@ -1234,5 +1234,5 @@
          ENDIF
 
-       ENDIF	
+       ENDIF        
 
 c
@@ -1261,5 +1261,5 @@
           d_t_nlte(:,:)=0.
 
-        ENDIF	
+        ENDIF        
 
 c      Find number of layers for LTE radiation calculations
@@ -1293,7 +1293,7 @@
      &          cool, d_t_nirco2,d_t_nlte, dtsw, dtlw)
         ELSE
-	   dtsw(:,:)=heat(:,:)
-	   dtlw(:,:)=-1*cool(:,:)
-	ENDIF
+           dtsw(:,:)=heat(:,:)
+           dtlw(:,:)=-1*cool(:,:)
+        ENDIF
 
          DO k=1,klev
@@ -1319,5 +1319,5 @@
      $         rmu0,pdtphys,gmtime,rjourvrai,
      $         tr_seri, d_tr, d_t_euv )
- 		
+                 
            DO k=1,klev
               DO ig=1,klon
@@ -1405,8 +1405,8 @@
       IF (if_ebil.ge.2) THEN 
         ztit='after rad'
-        CALL diagetpq(airephy,ztit,ip_ebil,2,2,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,2,2,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , topsw, toplw, solsw, sollw, zero_v
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1424,7 +1424,7 @@
        do i=1,klon
         do k=2,klev
-	  ztlev(i,k)  = (t_seri(i,k)+t_seri(i,k-1))/2.
-	  zpklev(i,k) = sqrt(ppk(i,k)*ppk(i,k-1))
-	enddo
+          ztlev(i,k)  = (t_seri(i,k)+t_seri(i,k-1))/2.
+          zpklev(i,k) = sqrt(ppk(i,k)*ppk(i,k-1))
+        enddo
        enddo
        call t2tpot(klon*klev,ztlev, ztetalev,zpklev)
@@ -1432,9 +1432,9 @@
        do i=1,klon
         do k=2,klev
-	  zdtetalev(i,k) = ztetalay(i,k)-ztetalay(i,k-1)
-	  zdzlev(i,k)    = (zphi(i,k)-zphi(i,k-1))/RG
+          zdtetalev(i,k) = ztetalay(i,k)-ztetalay(i,k-1)
+          zdzlev(i,k)    = (zphi(i,k)-zphi(i,k-1))/RG
           zn2(i,k) = RG*zdtetalev(i,k)/(ztetalev(i,k)*zdzlev(i,k))
           zn2(i,k) = max(zn2(i,k),1.e-12)  ! securite
-	enddo
+        enddo
         zn2(i,1) = 1.e-12  ! securite
        enddo
@@ -1479,6 +1479,6 @@
          d_u_oro = 0.
          d_v_oro = 0.
-	 zustrdr = 0.
-	 zvstrdr = 0.
+         zustrdr = 0.
+         zvstrdr = 0.
 c
       ENDIF ! fin de test sur ok_orodr
@@ -1508,5 +1508,5 @@
 c A ADAPTER POUR VENUS!!!
 c            CALL lift_noro(klon,klev,dtime,paprs,pplay,
-c     e                   rlatd,zmea,zstd,zpic,zgam,zthe,zpic,zval,
+c     e                   latitude,zmea,zstd,zpic,zgam,zthe,zpic,zval,
 c     e                   igwd,idx,itest,
 c     e                   t_seri, u_seri, v_seri,
@@ -1567,7 +1567,7 @@
 c====================================================================
       if (ballons.eq.1) then
-         CALL ballon(30,pdtphys,rjourvrai,gmtime*RDAY,rlatd,rlond,
-c    C               t,pplay,u,v,pphi)   ! alt above surface (smoothed for GCM)
-     C               t,pplay,u,v,zphi)   ! alt above planet average radius
+        CALL ballon(30,pdtphys,rjourvrai,gmtime*RDAY,latitude,longitude,
+c    C              t,pplay,u,v,pphi)   ! alt above surface (smoothed for GCM)
+     C              t,pplay,u,v,zphi)   ! alt above planet average radius
       endif !ballons
 
@@ -1601,5 +1601,5 @@
       CALL aaam_bud (27,klon,klev,rjourvrai,gmtime*RDAY,
      C               ra,rg,romega,
-     C               rlatd,rlond,pphis,
+     C               latitude,longitude,pphis,
      C               zustrdr,zustrli,zustrcl,
      C               zvstrdr,zvstrli,zvstrcl,
@@ -1641,5 +1641,5 @@
       IF (if_ebil.ge.1) THEN 
         ztit='after physic'
-        CALL diagetpq(airephy,ztit,ip_ebil,1,1,dtime
+        CALL diagetpq(cell_area,ztit,ip_ebil,1,1,dtime
      e      , t_seri,zero_v2,zero_v2,zero_v2,u_seri,v_seri,paprs,pplay
      s      , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
@@ -1648,5 +1648,5 @@
 C     est egale a la variation de la physique au pas de temps precedent.
 C     Donc la somme de ces 2 variations devrait etre nulle.
-        call diagphy(airephy,ztit,ip_ebil
+        call diagphy(cell_area,ztit,ip_ebil
      e      , topsw, toplw, solsw, sollw, sens
      e      , zero_v, zero_v, zero_v, ztsol
@@ -1687,7 +1687,7 @@
 c     DO k = 1, klev
 c     DO i = 1, klon
-c       mang(i,k) = RA*cos(rlatd(i)*RPI/180.)
-c    .     *(u_seri(i,k)+RA*cos(rlatd(i)*RPI/180.)*ROMEGA)
-c    .     *airephy(i)*(paprs(i,k)-paprs(i,k+1))/RG
+c       mang(i,k) = RA*cos(latitude(i)*RPI/180.)
+c    .     *(u_seri(i,k)+RA*cos(latitude(i)*RPI/180.)*ROMEGA)
+c    .     *cell_area(i)*(paprs(i,k)-paprs(i,k+1))/RG
 c       mangtot=mangtot+mang(i,k)
 c     ENDDO
Index: trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F	(revision 1543)
@@ -30,5 +30,5 @@
       USE infotrac
       use dimphy
-      USE comgeomphy
+      USE geometry_mod, only: cell_area
       USE chemparam_mod,only:M_tr
       USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
@@ -139,5 +139,5 @@
      &     .and.((xlon(i)+deltalon).gt.lon_volcan(ilon)) ) then
              ig_volcan(ilat,ilon)= i
-             area_emiss(ilat,ilon) = airephy(i)
+             area_emiss(ilat,ilon) = cell_area(i)
 	     print*,"Lat,lon=",ilat,ilon," OK"
             end if
Index: trunk/LMDZ.VENUS/libf/phyvenus/phytrac_relax.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/phytrac_relax.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/phytrac_relax.F	(revision 1543)
@@ -27,5 +27,4 @@
       USE infotrac
       use dimphy
-      USE comgeomphy
       USE chemparam_mod,only:M_tr
       IMPLICIT none
Index: trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.F	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.F	(revision 1543)
@@ -27,5 +27,5 @@
 c======================================================================
       use dimphy
-      USE comgeomphy
+      USE geometry_mod, ONLY: latitude
       USE phys_state_var_mod, only: heat,cool,radsol,
      .      topsw,toplw,solsw,sollw,sollwdown,lwnet,swnet
@@ -164,11 +164,11 @@
          lat=1
        else
-         if (abs(rlatd(j)).le.50.) then
+         if (abs(latitude(j)).le.50.) then
 	   lat=1
-	 elseif (abs(rlatd(j)).le.60.) then
+	 elseif (abs(latitude(j)).le.60.) then
 	   lat=2
-	 elseif (abs(rlatd(j)).le.70.) then
+	 elseif (abs(latitude(j)).le.70.) then
 	   lat=3
-	 elseif (abs(rlatd(j)).le.80.) then
+	 elseif (abs(latitude(j)).le.80.) then
 	   lat=4
 	 else
Index: trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.NewtonCool
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.NewtonCool	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/radlwsw.NewtonCool	(revision 1543)
@@ -24,5 +24,5 @@
 c======================================================================
       use dimphy
-      USE comgeomphy
+      USE geometry_mod, ONLY: latitude
       USE phys_state_var_mod, only: heat,cool,radsol,
      .      topsw,toplw,solsw,sollw,sollwdown,lwnet,swnet
@@ -98,6 +98,6 @@
 	    ztemp = tempCLee(level)*(1-fact)+tempCLee(level+1)*fact
 	    zdt   = dt_epCLee(level)*(1-fact)+dt_epCLee(level+1)*fact
-c           zt_eq(i,k) = ztemp + zdt*(cos(rlatd(i)*RPI/180.)-2./RPI)
-	    zt_eq(i,k) = ztemp + zdt*(cos(rlatd(i)*RPI/180.)-RPI/4.)
+c           zt_eq(i,k) = ztemp + zdt*(cos(latitude(i)*RPI/180.)-2./RPI)
+	    zt_eq(i,k) = ztemp + zdt*(cos(latitude(i)*RPI/180.)-RPI/4.)
 	    
 	  enddo
Index: trunk/LMDZ.VENUS/libf/phyvenus/write_histday.h
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/write_histday.h	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/write_histday.h	(revision 1543)
@@ -12,5 +12,5 @@
 
       call histwrite_phy(nid_day,.false.,"phis",itau_w,pphis)
-      call histwrite_phy(nid_day,.false.,"aire",itau_w,airephy)
+      call histwrite_phy(nid_day,.false.,"aire",itau_w,cell_area)
       call histwrite_phy(nid_day,.false.,"tsol",itau_w,ftsol)
       call histwrite_phy(nid_day,.false.,"psol",itau_w,paprs(:,1))
Index: trunk/LMDZ.VENUS/libf/phyvenus/write_histins.h
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/write_histins.h	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/write_histins.h	(revision 1543)
@@ -12,5 +12,5 @@
 
       call histwrite_phy(nid_ins,.false.,"phis",itau_w,pphis)
-      call histwrite_phy(nid_ins,.false.,"aire",itau_w,airephy)
+      call histwrite_phy(nid_ins,.false.,"aire",itau_w,cell_area)
       call histwrite_phy(nid_ins,.false.,"tsol",itau_w,ftsol)
       call histwrite_phy(nid_ins,.false.,"psol",itau_w,paprs(:,1))
Index: trunk/LMDZ.VENUS/libf/phyvenus/write_histmth.h
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/write_histmth.h	(revision 1542)
+++ trunk/LMDZ.VENUS/libf/phyvenus/write_histmth.h	(revision 1543)
@@ -12,5 +12,5 @@
 
       call histwrite_phy(nid_mth,.false.,"phis",itau_w,pphis)
-      call histwrite_phy(nid_mth,.false.,"aire",itau_w,airephy)
+      call histwrite_phy(nid_mth,.false.,"aire",itau_w,cell_area)
       call histwrite_phy(nid_mth,.false.,"tsol",itau_w,ftsol)
       call histwrite_phy(nid_mth,.false.,"psol",itau_w,paprs(:,1))
