Index: LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/ce0l.F90
===================================================================
--- LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/ce0l.F90	(revision 2349)
+++ LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/ce0l.F90	(revision 2351)
@@ -26,4 +26,5 @@
   USE filtreg_mod,    ONLY: inifilr
   USE iniphysiq_mod,  ONLY: iniphysiq
+  USE mod_const_mpi,  ONLY: comm_lmdz
 #ifdef inca
   USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic
@@ -106,8 +107,4 @@
   CALL read_distrib()
   CALL init_mod_hallo()
-  CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
-  CALL init_interface_dyn_phys()
-#else
-  CALL Init_Phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
 #endif
   WRITE(lunout,*)'---> klon=',klon
@@ -126,5 +123,7 @@
 
   CALL inifilr()
-  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)
   IF(pressure_exner) CALL test_disvert
Index: LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/iniphysiq_mod.F90
===================================================================
--- LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/iniphysiq_mod.F90	(revision 2349)
+++ LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/iniphysiq_mod.F90	(revision 2351)
@@ -6,14 +6,17 @@
 CONTAINS
 
-SUBROUTINE iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep, &
+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 geometry_mod, ONLY : init_geometry
   USE vertical_layers_mod, ONLY : init_vertical_layers
   USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,&
@@ -26,11 +29,8 @@
                       indnum_fn_num,index_trac,&
                       niso,ntraceurs_zone,ntraciso
+#ifdef REPROBUS
+  USE CHEM_REP, ONLY : Init_chem_rep_phys
+#endif
   USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline
-  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 inifis_mod, ONLY: inifis
   USE time_phylmdz_mod, ONLY: init_time
@@ -38,8 +38,10 @@
   USE phystokenc_mod, ONLY: init_phystokenc
   USE phyaqua_mod, ONLY: iniaqua
+  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
 
@@ -64,4 +66,6 @@
   INTEGER, INTENT (IN) :: ii ! number of atmospheric columns 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
@@ -76,5 +80,5 @@
 
   INTEGER :: ibegin, iend, offset
-  INTEGER :: i,j
+  INTEGER :: i,j,k
   CHARACTER (LEN=20) :: modname = 'iniphysiq'
   CHARACTER (LEN=80) :: abort_message
@@ -86,17 +90,26 @@
 
   ! 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, *) 'nlayer     = ', nlayer
-    WRITE (lunout, *) 'klev   = ', klev
-    CALL abort_gcm(modname, 'Problem with dimensions', 1)
-  END IF
-
-  !call init_phys_lmdz(ii,jj+1,llm,1,(/(jj-1)*ii+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
+  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
@@ -123,36 +136,65 @@
 
   ! 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,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(k)= rlatu(j)
+        lonfi_glo(k)= rlonv(i)
+        cufi_glo(k) = cu((j-1)*ii+1+i)
+        cvfi_glo(k) = 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
     ! South pole
-    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)
-
-    ! build airefi(), mesh area on physics grid
-    CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi)
+    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_glo(), mesh area on physics grid
+    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 !!!'
@@ -167,22 +209,54 @@
   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 DEFAULT(SHARED) COPYIN(/temps/)
-  ! Initialize physical constants in physics:
-  CALL inifis(punjours,prad,pg,pr,pcpp)
-  CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep)
-
-  ! Copy over "offline" settings
-  CALL init_phystokenc(offline,istphy)
+  ! 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))
+
+
+  offset = klon_mpi_begin - 1
+  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 over preff , ap(), bp(), etc 
   CALL init_vertical_layers(nlayer,preff,scaleheight, &
                             ap,bp,presnivs,pseudoalt)
+
+  ! Initialize physical constants in physics:
+  CALL inifis(punjours,prad,pg,pr,pcpp)
+
+  CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep)
+
+  ! Initialize dimphy module
+  CALL Init_dimphy(klon_omp,nlayer)
+
+  ! Copy over "offline" settings
+  CALL init_phystokenc(offline,istphy)
 
   ! Initialize tracer names, numbers, etc. for physics
@@ -197,17 +271,14 @@
                          niso,ntraceurs_zone,ntraciso)
 
-  ! Now generate local lon/lat/cu/cv/area arrays
-  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)
+  ! Initializations for Reprobus
+  IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+    CALL Init_chem_rep_phys(klon_omp,nlayer)
+#endif
+  ENDIF
 
   ! Additional initializations for aquaplanets 
   IF (iflag_phys>=100) THEN
-    CALL iniaqua(klon_omp, rlatd, rlond, iflag_phys)
+    CALL iniaqua(klon_omp,iflag_phys)
   END IF
 !$OMP END PARALLEL
