Index: dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/geometry_mod.f90
===================================================================
--- dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/geometry_mod.f90	(revision 3940)
+++ dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/geometry_mod.f90	(revision 3942)
@@ -56,6 +56,6 @@
     ALLOCATE(cell_area(klon))
     ALLOCATE(ind_cell_glo(klon))
-    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
-    IF (PRESENT(dy_))ALLOCATE(dy(klon))
+    ALLOCATE(dx(klon))
+    ALLOCATE(dy(klon))
     
     longitude(:) = longitude_(:)
@@ -67,4 +67,6 @@
     cell_area(:) = cell_area_(:)
     ind_cell_glo(:) = ind_cell_glo_(:)
+    dx(:)=0
+    dy(:)=0
     IF (PRESENT(dx_)) dx(:) = dx_(:)
     IF (PRESENT(dy_)) dy(:) = dy_(:)
Index: dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_mod.F90
===================================================================
--- dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_mod.F90	(revision 3940)
+++ dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_mod.F90	(revision 3942)
@@ -16,7 +16,8 @@
   USE cpl_mod,      ONLY : cpl_send_land_fields
   USE surface_data, ONLY : type_ocean
-  USE geometry_mod, ONLY : dx, dy
+  USE geometry_mod, ONLY : dx, dy, lon_degrees, lat_degrees, boundslon, boundslat,longitude, latitude, cell_area,  ind_cell_glo
   USE mod_grid_phy_lmdz
   USE mod_phys_lmdz_para
+  USE nrtype, ONLY : PI
 
   IMPLICIT NONE
@@ -47,5 +48,5 @@
     USE print_control_mod, ONLY: lunout
     USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
-
+    USE time_phylmdz_mod, ONLY : itau_phy
 !    
 ! Cette routine sert d'interface entre le modele atmospherique et le 
@@ -151,4 +152,7 @@
     REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: lalo
     !$OMP THREADPRIVATE(lalo)
+! boundaries of cells
+    REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE   :: bounds_lalo
+    !$OMP THREADPRIVATE(bounds_lalo)
 ! pts voisins
     INTEGER,ALLOCATABLE, DIMENSION(:,:), SAVE :: neighbours
@@ -164,4 +168,7 @@
     !$OMP THREADPRIVATE(lon_scat,lat_scat)
 
+    REAL, ALLOCATABLE, DIMENSION (:), SAVE  :: area  
+    !$OMP THREADPRIVATE(area)
+
     LOGICAL, SAVE                             :: lrestart_read = .TRUE.
     !$OMP THREADPRIVATE(lrestart_read)
@@ -194,7 +201,20 @@
     REAL, ALLOCATABLE, DIMENSION(:), SAVE     :: riverflow
     !$OMP THREADPRIVATE(riverflow)
+
+    INTEGER :: orch_mpi_rank
+    INTEGER :: orch_mpi_size
     
     INTEGER :: orch_omp_rank
     INTEGER :: orch_omp_size
+
+    REAL, ALLOCATABLE, DIMENSION(:)         :: longitude_glo
+    REAL, ALLOCATABLE, DIMENSION(:)         :: latitude_glo
+    REAL, ALLOCATABLE, DIMENSION(:,:)       :: boundslon_glo
+    REAL, ALLOCATABLE, DIMENSION(:,:)       :: boundslat_glo
+    INTEGER, ALLOCATABLE, DIMENSION(:)      :: ind_cell_glo_glo
+    INTEGER, ALLOCATABLE, SAVE,DIMENSION(:) :: ind_cell
+    !$OMP THREADPRIVATE(ind_cell)
+    INTEGER :: begin, end
+    
 !
 ! Fin definition
@@ -216,5 +236,5 @@
        IF ( .NOT. ALLOCATED(albedo_keep)) THEN
 !ym          ALLOCATE(albedo_keep(klon))
-!ym bizarre que non alloué en knon precedement
+!ym bizarre que non allou� en knon precedement
           ALLOCATE(albedo_keep(knon))
           ALLOCATE(zlev(knon))
@@ -239,5 +259,56 @@
        jg(klon) = nbp_lat
 
-       IF ((.NOT. ALLOCATED(lalo))) THEN
+       IF ((.NOT. ALLOCATED(area))) THEN
+          ALLOCATE(area(knon), stat = error)
+          IF (error /= 0) THEN
+             abort_message='Pb allocation area'
+             CALL abort_physic(modname,abort_message,1)
+          ENDIF
+       ENDIF
+       DO igrid = 1, knon
+          area(igrid) = cell_area(knindex(igrid))
+       ENDDO
+       
+       IF (grid_type==unstructured) THEN
+
+
+         IF ((.NOT. ALLOCATED(lon_scat))) THEN
+            ALLOCATE(lon_scat(nbp_lon,nbp_lat), stat = error)
+            IF (error /= 0) THEN
+               abort_message='Pb allocation lon_scat'
+               CALL abort_physic(modname,abort_message,1)
+            ENDIF
+         ENDIF
+ 
+         IF ((.NOT. ALLOCATED(lat_scat))) THEN
+            ALLOCATE(lat_scat(nbp_lon,nbp_lat), stat = error)
+            IF (error /= 0) THEN
+               abort_message='Pb allocation lat_scat'
+               CALL abort_physic(modname,abort_message,1)
+            ENDIF
+         ENDIF
+         CALL Gather(rlon,rlon_g)
+         CALL Gather(rlat,rlat_g)
+
+         IF (is_mpi_root) THEN
+            index = 1
+            DO jj = 2, nbp_lat-1
+               DO ij = 1, nbp_lon
+                  index = index + 1
+                  lon_scat(ij,jj) = rlon_g(index)
+                  lat_scat(ij,jj) = rlat_g(index)
+               ENDDO
+            ENDDO
+            lon_scat(:,1) = lon_scat(:,2)
+            lat_scat(:,1) = rlat_g(1)
+            lon_scat(:,nbp_lat) = lon_scat(:,2)
+            lat_scat(:,nbp_lat) = rlat_g(klon_glo)
+         ENDIF
+     
+         CALL bcast(lon_scat)
+         CALL bcast(lat_scat)
+                
+       ELSE IF (grid_type==regular_lonlat) THEN
+          IF ((.NOT. ALLOCATED(lalo))) THEN
           ALLOCATE(lalo(knon,2), stat = error)
           IF (error /= 0) THEN
@@ -245,49 +316,59 @@
              CALL abort_physic(modname,abort_message,1)
           ENDIF
-       ENDIF
-       IF ((.NOT. ALLOCATED(lon_scat))) THEN
-          ALLOCATE(lon_scat(nbp_lon,nbp_lat), stat = error)
+         ENDIF
+
+          IF ((.NOT. ALLOCATED(bounds_lalo))) THEN
+          ALLOCATE(bounds_lalo(knon,nvertex,2), stat = error)
           IF (error /= 0) THEN
-             abort_message='Pb allocation lon_scat'
+             abort_message='Pb allocation lalo'
              CALL abort_physic(modname,abort_message,1)
           ENDIF
-       ENDIF
-       IF ((.NOT. ALLOCATED(lat_scat))) THEN
-          ALLOCATE(lat_scat(nbp_lon,nbp_lat), stat = error)
-          IF (error /= 0) THEN
-             abort_message='Pb allocation lat_scat'
-             CALL abort_physic(modname,abort_message,1)
-          ENDIF
-       ENDIF
-       lon_scat = 0.
-       lat_scat = 0.
-       DO igrid = 1, knon
-          index = knindex(igrid)
-          lalo(igrid,2) = rlon(index)
-          lalo(igrid,1) = rlat(index)
-       ENDDO
-
+         ENDIF
        
-       
-       CALL Gather(rlon,rlon_g)
-       CALL Gather(rlat,rlat_g)
-
-       IF (is_mpi_root) THEN
-          index = 1
-          DO jj = 2, nbp_lat-1
-             DO ij = 1, nbp_lon
-                index = index + 1
-                lon_scat(ij,jj) = rlon_g(index)
-                lat_scat(ij,jj) = rlat_g(index)
-             ENDDO
-          ENDDO
-          lon_scat(:,1) = lon_scat(:,2)
-          lat_scat(:,1) = rlat_g(1)
-          lon_scat(:,nbp_lat) = lon_scat(:,2)
-          lat_scat(:,nbp_lat) = rlat_g(klon_glo)
-       ENDIF
-   
-       CALL bcast(lon_scat)
-       CALL bcast(lat_scat)
+         IF ((.NOT. ALLOCATED(lon_scat))) THEN
+            ALLOCATE(lon_scat(nbp_lon,nbp_lat), stat = error)
+            IF (error /= 0) THEN
+               abort_message='Pb allocation lon_scat'
+               CALL abort_physic(modname,abort_message,1)
+            ENDIF
+         ENDIF
+         IF ((.NOT. ALLOCATED(lat_scat))) THEN
+            ALLOCATE(lat_scat(nbp_lon,nbp_lat), stat = error)
+            IF (error /= 0) THEN
+               abort_message='Pb allocation lat_scat'
+               CALL abort_physic(modname,abort_message,1)
+            ENDIF
+         ENDIF
+         lon_scat = 0.
+         lat_scat = 0.
+         DO igrid = 1, knon
+            index = knindex(igrid)
+            lalo(igrid,2) = rlon(index)
+            lalo(igrid,1) = rlat(index)
+            bounds_lalo(igrid,:,2)=boundslon(index,:)*180./PI
+            bounds_lalo(igrid,:,1)=boundslat(index,:)*180./PI
+         ENDDO
+        
+         CALL Gather(rlon,rlon_g)
+         CALL Gather(rlat,rlat_g)
+
+         IF (is_mpi_root) THEN
+            index = 1
+            DO jj = 2, nbp_lat-1
+               DO ij = 1, nbp_lon
+                  index = index + 1
+                  lon_scat(ij,jj) = rlon_g(index)
+                  lat_scat(ij,jj) = rlat_g(index)
+               ENDDO
+            ENDDO
+            lon_scat(:,1) = lon_scat(:,2)
+            lat_scat(:,1) = rlat_g(1)
+            lon_scat(:,nbp_lat) = lon_scat(:,2)
+            lat_scat(:,nbp_lat) = rlat_g(klon_glo)
+         ENDIF
+     
+         CALL bcast(lon_scat)
+         CALL bcast(lat_scat)
+       ENDIF
 !
 ! Allouer et initialiser le tableau des voisins et des fraction de continents
@@ -315,5 +396,5 @@
 
 
-       CALL Init_neighbours(knon,neighbours,knindex,pctsrf(:,is_ter))
+       IF (grid_type==regular_lonlat) CALL Init_neighbours(knon,neighbours,knindex,pctsrf(:,is_ter))
 
 !
@@ -381,9 +462,48 @@
   
     IF (debut) THEN
+
        CALL Init_orchidee_index(knon,knindex,offset,ktindex)
-       CALL Get_orchidee_communicator(orch_comm,orch_omp_size,orch_omp_rank)
+       CALL Get_orchidee_communicator(orch_comm,orch_mpi_size,orch_mpi_rank, orch_omp_size,orch_omp_rank)
+
+        IF (grid_type==unstructured) THEN
+           begin=offset+1
+           end=offset+ktindex(knon)
+           IF (orch_mpi_rank==orch_mpi_size-1 .AND. orch_omp_rank==orch_omp_size-1) end=nbp_lon*nbp_lat 
+          
+           ALLOCATE(lalo(end-begin+1,2))
+           ALLOCATE(bounds_lalo(end-begin+1,nvertex,2))
+           ALLOCATE(ind_cell(end-begin+1))
+           
+           ALLOCATE(longitude_glo(klon_glo))
+           CALL gather(longitude,longitude_glo)
+           CALL bcast(longitude_glo)
+           lalo(:,2)=longitude_glo(begin:end)*180./PI
+ 
+           ALLOCATE(latitude_glo(klon_glo))
+           CALL gather(latitude,latitude_glo)
+           CALL bcast(latitude_glo)
+           lalo(:,1)=latitude_glo(begin:end)*180./PI
+
+           ALLOCATE(boundslon_glo(klon_glo,nvertex))
+           CALL gather(boundslon,boundslon_glo)
+           CALL bcast(boundslon_glo)
+           bounds_lalo(:,:,2)=boundslon_glo(begin:end,:)*180./PI
+ 
+           ALLOCATE(boundslat_glo(klon_glo,nvertex))
+           CALL gather(boundslat,boundslat_glo)
+           CALL bcast(boundslat_glo)
+           bounds_lalo(:,:,1)=boundslat_glo(begin:end,:)*180./PI
+         
+           ALLOCATE(ind_cell_glo_glo(klon_glo))
+           CALL gather(ind_cell_glo,ind_cell_glo_glo)
+           CALL bcast(ind_cell_glo_glo)
+           ind_cell(:)=ind_cell_glo_glo(begin:end)
+         
+         ENDIF
+
        CALL Init_synchro_omp
        
        IF (knon > 0) THEN
+ 
 #ifdef CPP_VEGET
          CALL Init_intersurf(nbp_lon,nbp_lat,knon,ktindex,offset,orch_omp_size,orch_omp_rank,orch_comm)
@@ -396,12 +516,12 @@
 #ifdef CPP_VEGET
           CALL intersurf_main (itime+itau_phy-1,nbp_lon,nbp_lat, knon, ktindex, dtime, &
-               lrestart_read, lrestart_write, lalo, &
+               lrestart_read, lrestart_write, grid_type, lalo, bounds_lalo, area, ind_cell, &
                contfrac, neighbours, resolution, date0, &
-               zlev,  u1_lay, v1_lay, spechum, temp_air, epot_air, ccanopy, &
-               cdrag, petA_orc, peqA_orc, petB_orc, peqB_orc, &
-               precip_rain, precip_snow, lwdown, swnet, swdown, ps, &
-               evap, fluxsens, fluxlat, coastalflow, riverflow, &
-               tsol_rad, tsurf_new, qsurf, albedo_out, emis_new, z0_new, &
-               lon_scat, lat_scat, q2m, t2m)
+               zlev,  u1_lay(1:knon), v1_lay(1:knon), spechum(1:knon), temp_air(1:knon), epot_air(1:knon), ccanopy(1:knon), &
+               cdrag(1:knon), petA_orc(1:knon), peqA_orc(1:knon), petB_orc(1:knon), peqB_orc(1:knon), &
+               precip_rain(1:knon), precip_snow(1:knon), lwdown(1:knon), swnet(1:knon), swdown_vrai(1:knon), ps(1:knon), &
+               evap(1:knon), fluxsens(1:knon), fluxlat(1:knon), coastalflow(1:knon), riverflow(1:knon), &
+               tsol_rad(1:knon), tsurf_new(1:knon), qsurf(1:knon), albedo_out(1:knon,:), emis_new(1:knon), z0_new(1:knon), &
+               lon_scat, lat_scat, q2m(1:knon), t2m(1:knon))
 #endif         
        ENDIF
@@ -420,5 +540,5 @@
 #ifdef CPP_VEGET    
        CALL intersurf_main (itime+itau_phy,nbp_lon,nbp_lat, knon, ktindex, dtime,  &
-            lrestart_read, lrestart_write, lalo, &
+            lrestart_read, lrestart_write, grid_type, lalo, bounds_lalo, area, ind_cell, &
             contfrac, neighbours, resolution, date0, &
             zlev,  u1_lay(1:knon), v1_lay(1:knon), spechum(1:knon), temp_air(1:knon), epot_air(1:knon), ccanopy(1:knon), &
@@ -427,5 +547,5 @@
             evap(1:knon), fluxsens(1:knon), fluxlat(1:knon), coastalflow(1:knon), riverflow(1:knon), &
             tsol_rad(1:knon), tsurf_new(1:knon), qsurf(1:knon), albedo_out(1:knon,:), emis_new(1:knon), z0_new(1:knon), &
-            lon_scat, lat_scat, q2m, t2m)
+            lon_scat, lat_scat, q2m(1:knon), t2m(1:knon))
 #endif       
     ENDIF
@@ -500,5 +620,5 @@
 ! 
 
-  SUBROUTINE Get_orchidee_communicator(orch_comm,orch_omp_size,orch_omp_rank)
+  SUBROUTINE Get_orchidee_communicator(orch_comm, orch_mpi_size, orch_mpi_rank, orch_omp_size,orch_omp_rank)
   USE  mod_surf_para
       
@@ -508,4 +628,6 @@
 
     INTEGER,INTENT(OUT) :: orch_comm
+    INTEGER,INTENT(OUT) :: orch_mpi_size
+    INTEGER,INTENT(OUT) :: orch_mpi_rank
     INTEGER,INTENT(OUT) :: orch_omp_size
     INTEGER,INTENT(OUT) :: orch_omp_rank
@@ -527,4 +649,6 @@
 #ifdef CPP_MPI    
       CALL MPI_COMM_SPLIT(COMM_LMDZ_PHY,color,mpi_rank,orch_comm,ierr)
+      CALL MPI_COMM_SIZE(orch_comm,orch_mpi_size,ierr)
+      CALL MPI_COMM_RANK(orch_comm,orch_mpi_rank,ierr)
 #endif
     
