Index: LMDZ5/trunk/libf/phylmd/cpl_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/cpl_mod.F90	(revision 2311)
+++ LMDZ5/trunk/libf/phylmd/cpl_mod.F90	(revision 2344)
@@ -24,6 +24,6 @@
   USE oasis
   USE write_field_phy
-  USE control_mod
-
+!  USE control_mod
+  USE time_phylmdz_mod, ONLY: day_step_phy
   
 ! Global attributes
@@ -102,8 +102,7 @@
     USE surface_data
     USE indice_sol_mod
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
+    USE time_phylmdz_mod, ONLY: annee_ref, day_ini, itau_phy, itaufin_phy
     USE print_control_mod, ONLY: lunout
-
-    INCLUDE "dimensions.h"
-    INCLUDE "temps.h"
 
 ! Input arguments
@@ -121,5 +120,5 @@
     INTEGER                           :: npas ! only for OASIS2
     REAL                              :: zjulian
-    REAL, DIMENSION(iim,jjm+1)        :: zx_lon, zx_lat
+    REAL, DIMENSION(nbp_lon,nbp_lat)  :: zx_lon, zx_lat
     CHARACTER(len = 20)               :: modname = 'cpl_init'
     CHARACTER(len = 80)               :: abort_message
@@ -131,5 +130,5 @@
 !*************************************************************************************
      
-    npas = itaufin/ iphysiq
+    npas = itaufin_phy
 !    nexca = 86400 / dtime
     nexca = t_coupl / dtime
@@ -172,25 +171,25 @@
     ALLOCATE(cpl_taumod(klon,2), stat = error)
     sum_error = sum_error + error
-    ALLOCATE(cpl_rriv2D(iim,jj_nb), stat=error)
-    sum_error = sum_error + error
-    ALLOCATE(cpl_rcoa2D(iim,jj_nb), stat=error)
-    sum_error = sum_error + error
-    ALLOCATE(cpl_rlic2D(iim,jj_nb), stat=error)
-    sum_error = sum_error + error
-    ALLOCATE(read_sst(iim, jj_nb), stat = error)
-    sum_error = sum_error + error
-    ALLOCATE(read_sic(iim, jj_nb), stat = error)
-    sum_error = sum_error + error
-    ALLOCATE(read_sit(iim, jj_nb), stat = error)
-    sum_error = sum_error + error
-    ALLOCATE(read_alb_sic(iim, jj_nb), stat = error)
-    sum_error = sum_error + error
-    ALLOCATE(read_u0(iim, jj_nb), stat = error)
-    sum_error = sum_error + error
-    ALLOCATE(read_v0(iim, jj_nb), stat = error)
+    ALLOCATE(cpl_rriv2D(nbp_lon,jj_nb), stat=error)
+    sum_error = sum_error + error
+    ALLOCATE(cpl_rcoa2D(nbp_lon,jj_nb), stat=error)
+    sum_error = sum_error + error
+    ALLOCATE(cpl_rlic2D(nbp_lon,jj_nb), stat=error)
+    sum_error = sum_error + error
+    ALLOCATE(read_sst(nbp_lon, jj_nb), stat = error)
+    sum_error = sum_error + error
+    ALLOCATE(read_sic(nbp_lon, jj_nb), stat = error)
+    sum_error = sum_error + error
+    ALLOCATE(read_sit(nbp_lon, jj_nb), stat = error)
+    sum_error = sum_error + error
+    ALLOCATE(read_alb_sic(nbp_lon, jj_nb), stat = error)
+    sum_error = sum_error + error
+    ALLOCATE(read_u0(nbp_lon, jj_nb), stat = error)
+    sum_error = sum_error + error
+    ALLOCATE(read_v0(nbp_lon, jj_nb), stat = error)
     sum_error = sum_error + error
 
     IF (carbon_cycle_cpl) THEN
-       ALLOCATE(read_co2(iim, jj_nb), stat = error)
+       ALLOCATE(read_co2(nbp_lon, jj_nb), stat = error)
        sum_error = sum_error + error
        ALLOCATE(cpl_atm_co2(klon,2), stat = error)
@@ -230,26 +229,26 @@
        idayref = day_ini
        CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
-       CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,zx_lon)
-       DO i = 1, iim
+       CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlon,zx_lon)
+       DO i = 1, nbp_lon
           zx_lon(i,1) = rlon(i+1)
-          zx_lon(i,jjm+1) = rlon(i+1)
+          zx_lon(i,nbp_lat) = rlon(i+1)
        ENDDO
-       CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,zx_lat)
+       CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlat,zx_lat)
        clintocplnam="cpl_atm_tauflx"
-       CALL histbeg(clintocplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),&
-            1,iim,1,jjm+1, itau_phy,zjulian,dtime,nhoridct,nidct) 
+       CALL histbeg(clintocplnam,nbp_lon,zx_lon(:,1),nbp_lat,zx_lat(1,:),&
+            1,nbp_lon,1,nbp_lat, itau_phy,zjulian,dtime,nhoridct,nidct) 
 ! no vertical axis
        CALL histdef(nidct, 'tauxe','tauxe', &
-            "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+            "-",nbp_lon,nbp_lat, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
        CALL histdef(nidct, 'tauyn','tauyn', &
-            "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+            "-",nbp_lon,nbp_lat, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
        CALL histdef(nidct, 'tmp_lon','tmp_lon', &
-            "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+            "-",nbp_lon,nbp_lat, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
        CALL histdef(nidct, 'tmp_lat','tmp_lat', &
-            "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+            "-",nbp_lon,nbp_lat, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
        DO jf=1,maxsend
          IF (infosend(i)%action) THEN
              CALL histdef(nidct, infosend(i)%name ,infosend(i)%name , &
-                "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+                "-",nbp_lon,nbp_lat,nhoridct,1,1,1,-99,32,"inst",dtime,dtime)
          ENDIF
        END DO
@@ -258,5 +257,5 @@
        
        clfromcplnam="cpl_atm_sst"
-       CALL histbeg(clfromcplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),1,iim,1,jjm+1, &
+       CALL histbeg(clfromcplnam,nbp_lon,zx_lon(:,1),nbp_lat,zx_lat(1,:),1,nbp_lon,1,nbp_lat, &
             0,zjulian,dtime,nhoridcs,nidcs) 
 ! no vertical axis
@@ -264,5 +263,5 @@
          IF (inforecv(i)%action) THEN
              CALL histdef(nidcs,inforecv(i)%name ,inforecv(i)%name , &
-                "-",iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32, "inst", dtime,dtime)
+                "-",nbp_lon,nbp_lat,nhoridcs,1,1,1,-99,32,"inst",dtime,dtime)
          ENDIF
        END DO
@@ -297,8 +296,8 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
     USE indice_sol_mod
-
-    INCLUDE "temps.h"
+    USE time_phylmdz_mod, ONLY: start_time, itau_phy
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
+
     INCLUDE "YOMCST.h"
-    INCLUDE "dimensions.h"
 
 ! Arguments
@@ -313,13 +312,13 @@
     INTEGER                                 :: j, i, time_sec
     INTEGER                                 :: itau_w
-    INTEGER, DIMENSION(iim*(jjm+1))         :: ndexcs
+    INTEGER, DIMENSION(nbp_lon*nbp_lat)     :: ndexcs
     CHARACTER(len = 20)                     :: modname = 'cpl_receive_frac'
     CHARACTER(len = 80)                     :: abort_message
     REAL, DIMENSION(klon)                   :: read_sic1D
-    REAL, DIMENSION(iim,jj_nb,maxrecv)      :: tab_read_flds
+    REAL, DIMENSION(nbp_lon,jj_nb,maxrecv)      :: tab_read_flds
     REAL, DIMENSION(klon,nbsrf)             :: pctsrf_old
     REAL, DIMENSION(klon_mpi)               :: rlon_mpi, rlat_mpi
-    REAL, DIMENSION(iim, jj_nb)             :: tmp_lon, tmp_lat
-    REAL, DIMENSION(iim, jj_nb)             :: tmp_r0
+    REAL, DIMENSION(nbp_lon,jj_nb)             :: tmp_lon, tmp_lat
+    REAL, DIMENSION(nbp_lon,jj_nb)             :: tmp_r0
 
 !*************************************************************************************
@@ -345,8 +344,8 @@
        IF (is_sequential) THEN
           ndexcs(:) = 0
-          itau_w = itau_phy + itime + start_time * day_step / iphysiq
+          itau_w = itau_phy + itime + start_time * day_step_phy
           DO i = 1, maxrecv
             IF (inforecv(i)%action) THEN
-                CALL histwrite(nidcs,inforecv(i)%name,itau_w,tab_read_flds(:,:,i),iim*(jjm+1),ndexcs)
+                CALL histwrite(nidcs,inforecv(i)%name,itau_w,tab_read_flds(:,:,i),nbp_lon*(nbp_lat),ndexcs)
             ENDIF
           END DO
@@ -373,5 +372,5 @@
 ! Transform the currents from cartesian to spheric coordinates
 ! tmp_r0 should be zero
-          CALL geo2atm(iim, jj_nb, tab_read_flds(:,:,idr_curenx), &
+          CALL geo2atm(nbp_lon, jj_nb, tab_read_flds(:,:,idr_curenx), &
              tab_read_flds(:,:,idr_cureny), tab_read_flds(:,:,idr_curenz), &
                tmp_lon, tmp_lat, &
@@ -542,5 +541,5 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
     USE indice_sol_mod
-    INCLUDE "dimensions.h"
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
 
 ! Input arguments
@@ -635,31 +634,31 @@
        IF (.NOT. ALLOCATED(cpl_sols2D)) THEN
           sum_error = 0
-          ALLOCATE(cpl_sols2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_nsol2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_rain2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_snow2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_evap2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_tsol2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_fder2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_albe2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_taux2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_tauy2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_windsp2D(iim,jj_nb), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_taumod2D(iim,jj_nb,2), stat=error)
+          ALLOCATE(cpl_sols2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_nsol2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_rain2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_snow2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_evap2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_tsol2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_fder2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_albe2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_taux2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_tauy2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_windsp2D(nbp_lon,jj_nb), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_taumod2D(nbp_lon,jj_nb,2), stat=error)
           sum_error = sum_error + error
           
           IF (carbon_cycle_cpl) THEN
-             ALLOCATE(cpl_atm_co22D(iim,jj_nb), stat=error)
+             ALLOCATE(cpl_atm_co22D(nbp_lon,jj_nb), stat=error)
              sum_error = sum_error + error
           END IF
@@ -733,5 +732,5 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
     USE indice_sol_mod
-    INCLUDE "dimensions.h"
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
 
 ! Input arguments
@@ -820,31 +819,31 @@
        IF (.NOT. ALLOCATED(cpl_sols2D)) THEN
           sum_error = 0
-          ALLOCATE(cpl_sols2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_nsol2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_rain2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_snow2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_evap2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_tsol2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_fder2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_albe2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_taux2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_tauy2D(iim,jj_nb,2), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_windsp2D(iim,jj_nb), stat=error)
-          sum_error = sum_error + error
-          ALLOCATE(cpl_taumod2D(iim,jj_nb,2), stat=error)
+          ALLOCATE(cpl_sols2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_nsol2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_rain2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_snow2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_evap2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_tsol2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_fder2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_albe2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_taux2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_tauy2D(nbp_lon,jj_nb,2), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_windsp2D(nbp_lon,jj_nb), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_taumod2D(nbp_lon,jj_nb,2), stat=error)
           sum_error = sum_error + error
 
           IF (carbon_cycle_cpl) THEN
-             ALLOCATE(cpl_atm_co22D(iim,jj_nb), stat=error)
+             ALLOCATE(cpl_atm_co22D(nbp_lon,jj_nb), stat=error)
              sum_error = sum_error + error
           END IF
@@ -913,5 +912,5 @@
 ! (it is done in cpl_send_seaice_fields).
 !
-    INCLUDE "dimensions.h"
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
 
 ! Input arguments
@@ -925,6 +924,6 @@
 ! Local variables
 !*************************************************************************************
-    REAL, DIMENSION(iim,jj_nb)             :: rriv2D
-    REAL, DIMENSION(iim,jj_nb)             :: rcoa2D
+    REAL, DIMENSION(nbp_lon,jj_nb)             :: rriv2D
+    REAL, DIMENSION(nbp_lon,jj_nb)             :: rcoa2D
 
 !*************************************************************************************
@@ -972,5 +971,5 @@
 !
 
-    INCLUDE "dimensions.h"
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
 
 ! Input varibales
@@ -983,5 +982,5 @@
 ! Local varibales
 !*************************************************************************************
-    REAL, DIMENSION(iim,jj_nb)             :: rlic2D
+    REAL, DIMENSION(nbp_lon,jj_nb)             :: rlic2D
 
 !*************************************************************************************
@@ -1027,9 +1026,8 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
     USE indice_sol_mod
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
+    USE time_phylmdz_mod, ONLY: start_time, itau_phy
 ! Some includes
-!*************************************************************************************
-    INCLUDE "temps.h"
-    INCLUDE "dimensions.h"
-    
+!    
 ! Input arguments
 !*************************************************************************************
@@ -1045,18 +1043,18 @@
     INTEGER                                              :: itau_w
     INTEGER                                              :: time_sec
-    INTEGER, DIMENSION(iim*(jjm+1))                      :: ndexct
+    INTEGER, DIMENSION(nbp_lon*(nbp_lat))                      :: ndexct
     REAL                                                 :: Up, Down
-    REAL, DIMENSION(iim, jj_nb)                          :: tmp_lon, tmp_lat
-    REAL, DIMENSION(iim, jj_nb, 4)                       :: pctsrf2D
-    REAL, DIMENSION(iim, jj_nb)                          :: deno
+    REAL, DIMENSION(nbp_lon, jj_nb)                          :: tmp_lon, tmp_lat
+    REAL, DIMENSION(nbp_lon, jj_nb, 4)                       :: pctsrf2D
+    REAL, DIMENSION(nbp_lon, jj_nb)                          :: deno
     CHARACTER(len = 20)                                  :: modname = 'cpl_send_all'
     CHARACTER(len = 80)                                  :: abort_message
    
 ! Variables with fields to coupler
-    REAL, DIMENSION(iim, jj_nb)                          :: tmp_taux
-    REAL, DIMENSION(iim, jj_nb)                          :: tmp_tauy
-    REAL, DIMENSION(iim, jj_nb)                          :: tmp_calv
+    REAL, DIMENSION(nbp_lon, jj_nb)                          :: tmp_taux
+    REAL, DIMENSION(nbp_lon, jj_nb)                          :: tmp_tauy
+    REAL, DIMENSION(nbp_lon, jj_nb)                          :: tmp_calv
 ! Table with all fields to send to coupler
-    REAL, DIMENSION(iim, jj_nb, maxsend)                 :: tab_flds
+    REAL, DIMENSION(nbp_lon, jj_nb, maxsend)                 :: tab_flds
     REAL, DIMENSION(klon_mpi)                            :: rlon_mpi, rlat_mpi
 
@@ -1112,6 +1110,6 @@
 
       DO j = 1, jj_nb
-         tmp_calv(:,j) = DOT_PRODUCT (cpl_rlic2D(1:iim,j), &
-              pctsrf2D(1:iim,j,is_lic)) / REAL(iim)
+         tmp_calv(:,j) = DOT_PRODUCT (cpl_rlic2D(1:nbp_lon,j), &
+              pctsrf2D(1:nbp_lon,j,is_lic)) / REAL(nbp_lon)
       ENDDO
     
@@ -1133,9 +1131,9 @@
          
          IF (.NOT. is_north_pole .AND. ii_begin /=1) THEN
-            Up=Up+tmp_calv(iim,1)
+            Up=Up+tmp_calv(nbp_lon,1)
             tmp_calv(:,1)=Up
          ENDIF
          
-         IF (.NOT. is_south_pole .AND. ii_end /= iim) THEN
+         IF (.NOT. is_south_pole .AND. ii_end /= nbp_lon) THEN
             Down=Down+tmp_calv(1,jj_nb)
             tmp_calv(:,jj_nb)=Down	 
@@ -1226,5 +1224,5 @@
     IF (is_sequential) THEN
        IF (is_north_pole) tmp_lon(:,1)     = tmp_lon(:,2)
-       IF (is_south_pole) tmp_lon(:,jjm+1) = tmp_lon(:,jjm)
+       IF (is_south_pole) tmp_lon(:,nbp_lat) = tmp_lon(:,nbp_lat-1)
     ENDIF
       
@@ -1232,9 +1230,9 @@
     IF (is_sequential) THEN
        ndexct(:) = 0
-       itau_w = itau_phy + itime + start_time * day_step / iphysiq
-       CALL histwrite(nidct,'tauxe',itau_w,tmp_taux,iim*(jjm+1),ndexct)
-       CALL histwrite(nidct,'tauyn',itau_w,tmp_tauy,iim*(jjm+1),ndexct)
-       CALL histwrite(nidct,'tmp_lon',itau_w,tmp_lon,iim*(jjm+1),ndexct)
-       CALL histwrite(nidct,'tmp_lat',itau_w,tmp_lat,iim*(jjm+1),ndexct)
+       itau_w = itau_phy + itime + start_time * day_step_phy
+       CALL histwrite(nidct,'tauxe',itau_w,tmp_taux,nbp_lon*(nbp_lat),ndexct)
+       CALL histwrite(nidct,'tauyn',itau_w,tmp_tauy,nbp_lon*(nbp_lat),ndexct)
+       CALL histwrite(nidct,'tmp_lon',itau_w,tmp_lon,nbp_lon*(nbp_lat),ndexct)
+       CALL histwrite(nidct,'tmp_lat',itau_w,tmp_lat,nbp_lon*(nbp_lat),ndexct)
     ENDIF
 
@@ -1242,5 +1240,5 @@
 ! cartesian 3D coordinates 
 !$OMP MASTER
-    CALL atm2geo (iim, jj_nb, tmp_taux, tmp_tauy, tmp_lon, tmp_lat, &
+    CALL atm2geo (nbp_lon, jj_nb, tmp_taux, tmp_tauy, tmp_lon, tmp_lat, &
          tab_flds(:,:,ids_tauxxu), tab_flds(:,:,ids_tauyyu), tab_flds(:,:,ids_tauzzu) )
     
@@ -1257,5 +1255,5 @@
         DO j=1,maxsend
           IF (infosend(j)%action) CALL histwrite(nidct,infosend(j)%name, itau_w, &
-             tab_flds(:,:,j),iim*(jjm+1),ndexct)
+             tab_flds(:,:,j),nbp_lon*(nbp_lat),ndexct)
         ENDDO
     ENDIF
@@ -1311,9 +1309,9 @@
 !   champ_out    champ sur la grille 'gatherd'
 !
-    INCLUDE "dimensions.h"
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
 
 ! Input
     INTEGER, INTENT(IN)                       :: knon
-    REAL, DIMENSION(iim,jj_nb), INTENT(IN)    :: champ_in
+    REAL, DIMENSION(nbp_lon,jj_nb), INTENT(IN)    :: champ_in
     INTEGER, DIMENSION(klon), INTENT(IN)      :: knindex
 
@@ -1330,5 +1328,5 @@
     
 
-! Transform from 2 dimensions (iim,jj_nb) to 1 dimension (klon)
+! Transform from 2 dimensions (nbp_lon,jj_nb) to 1 dimension (klon)
 !$OMP MASTER 
     CALL Grid2Dto1D_mpi(champ_in,temp_mpi)
@@ -1360,5 +1358,5 @@
 !   champ_out    champ sur la grille 2D
 !
-    INCLUDE "dimensions.h"
+    USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
     
 ! Input arguments
@@ -1370,5 +1368,5 @@
 ! Output arguments
 !*************************************************************************************
-    REAL, DIMENSION(iim,jj_nb), INTENT(OUT) :: champ_out
+    REAL, DIMENSION(nbp_lon,jj_nb), INTENT(OUT) :: champ_out
 
 ! Local variables
@@ -1386,5 +1384,5 @@
     ENDDO
 
-! Transform from 1 dimension (klon) to 2 dimensions (iim,jj_nb)
+! Transform from 1 dimension (klon) to 2 dimensions (nbp_lon,jj_nb)
     CALL gather_omp(temp_omp,temp_mpi)
 
