Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 1540)
+++ trunk/LMDZ.GENERIC/README	(revision 1542)
@@ -1190,3 +1190,16 @@
 - "iniprint.h" moved from "dyn3d" to "misc".
 
-
+== 18/04/2016 == EM
+- fix for 1D in writediagfi to enable writing at 
+  "ecritphy" rate.
+- move iniprint.h to "misc"
+- Some code cleanup in anticipation of future updates:
+ - changed variable names in comgeomphy.F90: give them more
+   explicit names: rlond => longitude , 
+   rlatd => latitude, airephy => cell_area,
+   cuphy => dx , cvphy => dy
+ - removed long(), lati() and area() from comgeomfi_h.F90,
+   use longitude(), latitude() and cell_are() from
+   comgeomphy.F90 instead
+
+
Index: trunk/LMDZ.GENERIC/libf/dyn3d/iniprint.h
===================================================================
--- trunk/LMDZ.GENERIC/libf/dyn3d/iniprint.h	(revision 1540)
+++ 	(revision )
@@ -1,11 +1,0 @@
-!
-! $Id: $
-!
-!
-! handle debug and output levels
-! lunout:    unit of file where outputs will be sent
-!                           (default is 6, standard output)
-! prt_level: level of informative output messages (0 = minimum)
-!
-      INTEGER lunout, prt_level
-      COMMON /comprint/ lunout, prt_level
Index: trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90	(revision 1542)
@@ -16,9 +16,9 @@
 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
+                       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
@@ -170,9 +170,9 @@
 
 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)
+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)
 
 ! copy over preff , ap() and bp() 
@@ -191,5 +191,5 @@
 ! and do some initializations 
 call inifis(klon_omp,nlayer,nqtot,pdayref,punjours,nday,ptimestep, &
-            rlatd,rlond,airephy,prad,pg,pr,pcpp)
+            latitude,longitude,cell_area,prad,pg,pr,pcpp)
 
 !$OMP END PARALLEL
Index: trunk/LMDZ.GENERIC/libf/misc/iniprint.h
===================================================================
--- trunk/LMDZ.GENERIC/libf/misc/iniprint.h	(revision 1542)
+++ trunk/LMDZ.GENERIC/libf/misc/iniprint.h	(revision 1542)
@@ -0,0 +1,11 @@
+!
+! $Id: $
+!
+!
+! handle debug and output levels
+! lunout:    unit of file where outputs will be sent
+!                           (default is 6, standard output)
+! prt_level: level of informative output messages (0 = minimum)
+!
+      INTEGER lunout, prt_level
+      COMMON /comprint/ lunout, prt_level
Index: trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90	(revision 1542)
@@ -4,5 +4,4 @@
        use radinc_h, only : L_TAUMAX,naerkind
        use aerosol_mod
-       USE comgeomfi_h
        USE tracer_h, only: noms,rho_co2,rho_ice
        use comcstfi_mod, only: g
Index: trunk/LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90	(revision 1542)
@@ -4,7 +4,7 @@
        implicit none
 
-       REAL,ALLOCATABLE,DIMENSION(:),SAVE :: long,lati,area
-       REAL,SAVE :: totarea, totarea_planet
-!$OMP THREADPRIVATE(long,lati,area,totarea,totarea_planet)
+       REAL,SAVE :: totarea ! total surface (m2) for this local (MPI/OpenMP) domain
+       REAL,SAVE :: totarea_planet ! total planetary surface (m2)
+!$OMP THREADPRIVATE(totarea,totarea_planet)
 
        end module comgeomfi_h
Index: trunk/LMDZ.GENERIC/libf/phystd/comgeomphy.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/comgeomphy.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/comgeomphy.F90	(revision 1542)
@@ -1,9 +1,9 @@
 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)
+   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
   
@@ -13,9 +13,9 @@
     
  
-    allocate(airephy(klon_omp))
-    allocate(cuphy(klon_omp))
-    allocate(cvphy(klon_omp))
-    allocate(rlatd(klon_omp))
-    allocate(rlond(klon_omp))
+    allocate(cell_area(klon_omp))
+    allocate(dx(klon_omp))
+    allocate(dy(klon_omp))
+    allocate(latitude(klon_omp))
+    allocate(longitude(klon_omp))
 
   end subroutine initcomgeomphy
Index: trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90	(revision 1542)
@@ -11,5 +11,5 @@
       use aerosol_mod, only : iaero_co2
       USE surfdat_h, only: emisice, emissiv
-      USE comgeomfi_h, only: lati
+      USE comgeomphy, only: latitude ! in radians
       USE tracer_h, only: noms, rho_co2
       use comcstfi_mod, only: g, r, cpp
@@ -430,5 +430,5 @@
       DO ig=1,ngrid
       
-         IF(lati(ig).LT.0.) THEN
+         IF(latitude(ig).LT.0.) THEN
             icap=2 ! Southern Hemisphere
          ELSE
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/iniprint.h
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/iniprint.h	(revision 1540)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../dyn3d/iniprint.h
Index: trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F	(revision 1542)
@@ -11,7 +11,6 @@
 !      use comsaison_h
       use comsoil_h, only: nsoilmx, layer, mlayer, inertiedat, volcapa
-      USE comgeomfi_h, only: lati, long, area
       use phyredem, only: physdem0,physdem1
-      use comgeomphy, only: initcomgeomphy, airephy
+      use comgeomphy, only: initcomgeomphy, cell_area
       use slab_ice_h, only: noceanmx
       use planete_mod, only: apoastr,periastr,year_day,peri_day,
@@ -159,9 +158,4 @@
       IF (.not.ALLOCATED(sinlon)) ALLOCATE(sinlon(1))
       IF (.not.ALLOCATED(coslon)) ALLOCATE(coslon(1))
-      !! those are defined in comgeomfi_h
-      IF (.not. ALLOCATED(lati)) ALLOCATE(lati(1))
-      IF (.not. ALLOCATED(long)) ALLOCATE(long(1))
-      IF (.not. ALLOCATED(area)) ALLOCATE(area(1))
-
 
       saveprofile=.false.
@@ -326,6 +320,5 @@
 !!! GEOGRAPHICAL INITIALIZATIONS
      !!! AREA. useless in 1D
-      area(1)=1.E+0
-      airephy(1)=area(1) !JL+EM to have access to the area in the diagfi.nc files. area in comgeomfi.h and aire in comgeom.h
+      cell_area(1)=1.E+0 !JL+EM to have access to the area in the diagfi.nc files.
      !!! GEOPOTENTIAL. useless in 1D because control by surface pressure
       phisfi(1)=0.E+0
@@ -511,5 +504,5 @@
       cpp=1.d-7 !JL because we divide by cpp in inifis, there may be a more elegant solution
       CALL inifis(1,llm,nq,day0,daysec,nday,dtphys,
-     .            latitude,longitude,area,rad,g,r,cpp)
+     .            latitude,longitude,cell_area,rad,g,r,cpp)
 
       nsoil=nsoilmx
@@ -673,5 +666,5 @@
          IF (qsurf(i_co2_ice).ge.1.E+0) THEN
             ! if we have some CO2 ice on the surface, change emissivity
-            if (lati(1).ge.0) then ! northern hemisphere
+            if (latitude(1).ge.0) then ! northern hemisphere
               emis(1)=emisice(1)
             else ! southern hemisphere
@@ -834,6 +827,6 @@
 c  It is needed to transfert physics variables to "physiq"...
 
-      call physdem0("startfi.nc",long,lati,nsoilmx,1,llm,nq,
-     &              dtphys,real(day0),time,area,
+      call physdem0("startfi.nc",longitude,latitude,nsoilmx,1,llm,nq,
+     &              dtphys,real(day0),time,cell_area,
      &              albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe)
       call physdem1("startfi.nc",nsoilmx,1,llm,nq,
@@ -843,10 +836,4 @@
      &                rnat,pctsrf_sic,tslab,tsea_ice,sea_ice)
 
-!      call physdem1(1,"startfi.nc",long,lati,nsoilmx,nq,
-!     &              dtphys,float(day0),
-!     &              time,tsurf,tsoil,emis,q2,qsurf,
-!     &              area,albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe,
-!     &              cloudfrac,totcloudfrac,hice,nametrac)
-
 c=======================================================================
 c  BOUCLE TEMPORELLE DU MODELE 1D 
@@ -861,9 +848,9 @@
          call stellarlong(day*1.0,zls)
 !         write(103,*) 'Ls=',zls*180./pi
-!         write(103,*) 'Lat=', lati(1)*180./pi
+!         write(103,*) 'Lat=', latitude(1)*180./pi
 !         write(103,*) 'RunEnd - Atmos. Temp. File'
 !         write(103,*) 'RunEnd - Atmos. Temp. File'
 !         write(104,*) 'Ls=',zls*180./pi
-!         write(104,*) 'Lat=', lati(1)
+!         write(104,*) 'Lat=', latitude(1)
 !         write(104,*) 'RunEnd - Atmos. Temp. File'
         ENDIF
@@ -923,5 +910,5 @@
 
 c       Pour certain test : pas de coriolis a l'equateur
-c       if(lati(1).eq.0.) then
+c       if(latitude(1).eq.0.) then
           DO ilayer=1,nlayer
              du(ilayer)=du(ilayer)+ (gru-u(ilayer))/1.e4
Index: trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90	(revision 1542)
@@ -10,5 +10,5 @@
   USE surfdat_h
   use comdiurn_h
-  USE comgeomfi_h
+  USE comgeomphy, only: cell_area
   USE tracer_h
   use slab_ice_h
@@ -141,5 +141,5 @@
          do ig=1,ngrid
             if(nint(rnat(ig)).eq.0)then
-               oceanarea=oceanarea+area(ig)
+               oceanarea=oceanarea+cell_area(ig)
             endif
          enddo
@@ -338,5 +338,5 @@
          DO ig=1,ngrid
             if((nint(rnat(ig)).eq.0).and.(hice(ig).eq.0.))then
-               oceanarea2=oceanarea2+area(ig)*pcapcal(ig)
+               oceanarea2=oceanarea2+cell_area(ig)*pcapcal(ig)
             end if
          END DO
@@ -345,5 +345,5 @@
          DO ig=1,ngrid
             if((nint(rnat(ig)).eq.0).and.(hice(ig).eq.0.))then       
-               tsea=tsea+ztsurf(ig)*area(ig)*pcapcal(ig)/oceanarea2
+               tsea=tsea+ztsurf(ig)*cell_area(ig)*pcapcal(ig)/oceanarea2
             end if
          END DO
@@ -366,5 +366,5 @@
          do ig=1,ngrid
             if (nint(rnat(ig)).eq.1) then
-               totalrunoff = totalrunoff + area(ig)*runoff(ig)
+               totalrunoff = totalrunoff + cell_area(ig)*runoff(ig)
             endif
          enddo
Index: trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90	(revision 1542)
@@ -13,5 +13,5 @@
   use datafile_mod, only: datadir
   use comdiurn_h, only: sinlat, coslat, sinlon, coslon
-  use comgeomfi_h, only: long, lati, area, totarea, totarea_planet
+  use comgeomfi_h, only: totarea, totarea_planet
   use comsoil_h, only: ini_comsoil_h, nsoilmx, lay1_soil, alpha_soil
   use time_phylmdz_mod, only: ecritphy,day_step,iphysiq, &
@@ -710,14 +710,7 @@
 !     ------------------------
 
-  ! ALLOCATE ARRAYS IN comgeomfi_h
-  IF (.not. ALLOCATED(lati)) ALLOCATE(lati(ngrid))
-  IF (.not. ALLOCATED(long)) ALLOCATE(long(ngrid))
-  IF (.not. ALLOCATED(area)) ALLOCATE(area(ngrid))
-
-  CALL SCOPY(ngrid,plon,1,long,1)
-  CALL SCOPY(ngrid,plat,1,lati,1)
-  CALL SCOPY(ngrid,parea,1,area,1)
-  totarea=SSUM(ngrid,area,1)
-  call planetwide_sumval(area,totarea_planet)
+  ! Initializations for comgeomfi_h
+  totarea=SSUM(ngrid,parea,1)
+  call planetwide_sumval(parea,totarea_planet)
 
   !! those are defined in comdiurn_h.F90
Index: trunk/LMDZ.GENERIC/libf/phystd/initracer.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/initracer.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/initracer.F	(revision 1542)
@@ -2,5 +2,4 @@
 
       use surfdat_h
-      USE comgeomfi_h
       USE tracer_h
       USE callkeys_mod, only: water
Index: trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90	(revision 1542)
@@ -7,5 +7,4 @@
        use surfdat_h
        use radcommon_h, only: glat
-       USE comgeomfi_h
        USE tracer_h
        USE planete_mod, only: bp
Index: trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90	(revision 1542)
@@ -10,5 +10,5 @@
 ! create physics restart file and write time-independent variables
   use comsoil_h, only: volcapa, mlayer
-  use comgeomfi_h, only: area
+  use comgeomphy, only: cell_area
   use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
                        emisice, emissiv,             &
@@ -111,5 +111,5 @@
   
   ! Write mesh areas
-  call put_field("area","Mesh area",area)
+  call put_field("area","Mesh area",cell_area)
   
   ! Write surface geopotential
Index: trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1542)
@@ -19,5 +19,6 @@
       use comsaison_h, only: mu0, fract, dist_star, declin, right_ascen
       use comsoil_h, only: nsoilmx, layer, mlayer, inertiedat
-      USE comgeomfi_h, only: long, lati, area, totarea, totarea_planet
+      use comgeomphy, only: latitude, longitude, cell_area
+      USE comgeomfi_h, only: totarea, totarea_planet
       USE tracer_h, only: noms, mmol, radius, rho_q, qext, &
                           alpha_lift, alpha_devil, qextrhor, &
@@ -697,6 +698,6 @@
 
          if (ngrid.ne.1) then ! Note : no need to create a restart file in 1d.
-            call physdem0("restartfi.nc",long,lati,nsoilmx,ngrid,nlayer,nq, &
-                          ptimestep,pday+nday,time_phys,area,               &
+            call physdem0("restartfi.nc",longitude,latitude,nsoilmx,ngrid,nlayer,nq, &
+                          ptimestep,pday+nday,time_phys,cell_area,          &
                           albedo_bareground,inertiedat,zmea,zstd,zsig,zgam,zthe)
          endif
@@ -757,5 +758,5 @@
          gmplanet = MassPlanet*grav*1e24
          do ig=1,ngrid
-            glat(ig)= gmplanet/(Rmean**2) * (1.D0 + 0.75 *J2 - 2.0*flatten/3. + (2.*flatten - 15./4.* J2) * cos(2. * (pi/2. - lati(ig)))) 
+            glat(ig)= gmplanet/(Rmean**2) * (1.D0 + 0.75 *J2 - 2.0*flatten/3. + (2.*flatten - 15./4.* J2) * cos(2. * (pi/2. - latitude(ig)))) 
          end do
       endif
@@ -787,5 +788,5 @@
             zh(ig,l)=pt(ig,l)/zpopsk(ig,l)
             mass(ig,l)  = (pplev(ig,l) - pplev(ig,l+1))/glat(ig)
-            massarea(ig,l)=mass(ig,l)*area(ig)
+            massarea(ig,l)=mass(ig,l)*cell_area(ig)
          enddo
       enddo
@@ -800,5 +801,5 @@
       do l=1,nlayer
          pw(1:ngrid,l)=(pw(1:ngrid,l)*r*pt(1:ngrid,l)) /  &
-                       (pplay(1:ngrid,l)*area(1:ngrid))
+                       (pplay(1:ngrid,l)*cell_area(1:ngrid))
       enddo
 
@@ -830,5 +831,5 @@
             else if(diurnal .eqv. .false.) then
 
-               call mucorr(ngrid,declin,lati,mu0,fract,10000.,rad,flatten)
+               call mucorr(ngrid,declin,latitude,mu0,fract,10000.,rad,flatten)
                ! WARNING: this function appears not to work in 1D
 
@@ -925,5 +926,5 @@
 
                             !if(noradsurf)then ! no lower surface; SW flux just disappears
-                            !   GSR = SUM(fluxsurf_sw(1:ngrid)*area(1:ngrid))/totarea
+                            !   GSR = SUM(fluxsurf_sw(1:ngrid)*cell_area(1:ngrid))/totarea
                             !   fluxrad_sky(1:ngrid)=emis(1:ngrid)*fluxsurf_lw(1:ngrid)
                             !   print*,'SW lost in deep atmosphere = ',GSR,' W m^-2'
@@ -985,7 +986,7 @@
             call planetwide_sumval(cpp*massarea(:,:)*zdtsw(:,:)/totarea_planet,dEtotSW)
             call planetwide_sumval(cpp*massarea(:,:)*zdtlw(:,:)/totarea_planet,dEtotLW)
-            !call planetwide_sumval(fluxsurf_sw(:)*(1.-albedo_equivalent(:))*area(:)/totarea_planet,dEtotsSW) !JL13 carefull, albedo can have changed since the last time we called corrk
-            call planetwide_sumval(fluxsurfabs_sw(:)*area(:)/totarea_planet,dEtotsSW) !JL13 carefull, albedo can have changed since the last time we called corrk
-            call planetwide_sumval((fluxsurf_lw(:)*emis(:)-zplanck(:))*area(:)/totarea_planet,dEtotsLW)
+            !call planetwide_sumval(fluxsurf_sw(:)*(1.-albedo_equivalent(:))*cell_area(:)/totarea_planet,dEtotsSW) !JL13 carefull, albedo can have changed since the last time we called corrk
+            call planetwide_sumval(fluxsurfabs_sw(:)*cell_area(:)/totarea_planet,dEtotsSW) !JL13 carefull, albedo can have changed since the last time we called corrk
+            call planetwide_sumval((fluxsurf_lw(:)*emis(:)-zplanck(:))*cell_area(:)/totarea_planet,dEtotsLW)
             dEzRadsw(:,:)=cpp*mass(:,:)*zdtsw(:,:)
             dEzRadlw(:,:)=cpp*mass(:,:)*zdtlw(:,:)
@@ -1071,8 +1072,8 @@
             enddo
             
-            call planetwide_sumval(dEdiff(:)*area(:)/totarea_planet,dEtot)
+            call planetwide_sumval(dEdiff(:)*cell_area(:)/totarea_planet,dEtot)
             dEdiffs(:)=capcal(:)*zdtsdif(:)-zflubid(:)-sensibFlux(:)
-            call planetwide_sumval(dEdiffs(:)*area(:)/totarea_planet,dEtots)
-            call planetwide_sumval(sensibFlux(:)*area(:)/totarea_planet,AtmToSurf_TurbFlux)
+            call planetwide_sumval(dEdiffs(:)*cell_area(:)/totarea_planet,dEtots)
+            call planetwide_sumval(sensibFlux(:)*cell_area(:)/totarea_planet,AtmToSurf_TurbFlux)
             
             if (is_master) then
@@ -1097,10 +1098,10 @@
          
             call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dWtot_tmp)
-            call planetwide_sumval(zdqsdif(:,igcm_h2o_vap)*area(:)*ptimestep/totarea_planet,dWtots_tmp)
+            call planetwide_sumval(zdqsdif(:,igcm_h2o_vap)*cell_area(:)*ptimestep/totarea_planet,dWtots_tmp)
             do ig = 1, ngrid
                vdifcncons(ig)=SUM(mass(ig,:)*zdqdif(ig,:,igcm_h2o_vap))
             enddo
             call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot)
-            call planetwide_sumval(zdqsdif(:,igcm_h2o_ice)*area(:)*ptimestep/totarea_planet,dWtots)
+            call planetwide_sumval(zdqsdif(:,igcm_h2o_ice)*cell_area(:)*ptimestep/totarea_planet,dWtots)
             dWtot = dWtot + dWtot_tmp
             dWtots = dWtots + dWtots_tmp
@@ -1214,5 +1215,5 @@
          if(enertest)then
             call planetwide_sumval(cpp*massarea(:,:)*zdtc(:,:)/totarea_planet,dEtot)
-            call planetwide_sumval(capcal(:)*zdtsurfc(:)*area(:)/totarea_planet,dEtots)
+            call planetwide_sumval(capcal(:)*zdtsurfc(:)*cell_area(:)/totarea_planet,dEtots)
             if (is_master) then
                print*,'In co2cloud atmospheric energy change   =',dEtot,' W m-2'
@@ -1335,8 +1336,8 @@
                   if (is_master) print*,'In rain atmospheric T energy change       =',dEtot,' W m-2'
                   call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)/totarea_planet*RLVTT/cpp,dItot_tmp)
-                  call planetwide_sumval(area(:)*zdqssnow(:)/totarea_planet*RLVTT/cpp,dItot)
+                  call planetwide_sumval(cell_area(:)*zdqssnow(:)/totarea_planet*RLVTT/cpp,dItot)
                   dItot = dItot + dItot_tmp
                   call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dVtot_tmp)
-                  call planetwide_sumval(area(:)*zdqsrain(:)/totarea_planet*RLVTT/cpp,dVtot)
+                  call planetwide_sumval(cell_area(:)*zdqsrain(:)/totarea_planet*RLVTT/cpp,dVtot)
                   dVtot = dVtot + dVtot_tmp
                   dEtot = dItot + dVtot
@@ -1351,5 +1352,5 @@
                   call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet+        &
                           massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot)
-                  call planetwide_sumval((zdqsrain(:)+zdqssnow(:))*area(:)*ptimestep/totarea_planet,dWtots)
+                  call planetwide_sumval((zdqsrain(:)+zdqssnow(:))*cell_area(:)*ptimestep/totarea_planet,dWtots)
                   
                   if (is_master) then
@@ -1407,5 +1408,5 @@
             if(watertest)then
                call planetwide_sumval(massarea(:,:)*(zdqsed(:,:,igcm_h2o_vap)+zdqsed(:,:,igcm_h2o_ice))*ptimestep/totarea_planet,dWtot)
-               call planetwide_sumval((zdqssed(:,igcm_h2o_vap)+zdqssed(:,igcm_h2o_ice))*area(:)*ptimestep/totarea_planet,dWtots)
+               call planetwide_sumval((zdqssed(:,igcm_h2o_vap)+zdqssed(:,igcm_h2o_ice))*cell_area(:)*ptimestep/totarea_planet,dWtots)
                if (is_master) then
                         print*,'In sedim atmospheric ice change         =',dWtot,' kg m-2'
@@ -1509,5 +1510,5 @@
             ! Test energy conservation
             if(enertest)then
-               call planetwide_sumval(area(:)*capcal(:)*zdtsurf_hyd(:)/totarea_planet,dEtots)
+               call planetwide_sumval(cell_area(:)*capcal(:)*zdtsurf_hyd(:)/totarea_planet,dEtots)
                if (is_master) print*,'In hydrol surface energy change     =',dEtots,' W m-2'
             endif
@@ -1515,7 +1516,7 @@
             ! test water conservation
             if(watertest)then
-               call planetwide_sumval(dqs_hyd(:,igcm_h2o_ice)*area(:)*ptimestep/totarea_planet,dWtots)
+               call planetwide_sumval(dqs_hyd(:,igcm_h2o_ice)*cell_area(:)*ptimestep/totarea_planet,dWtots)
                if (is_master) print*,'In hydrol surface ice change            =',dWtots,' kg m-2'
-                  call planetwide_sumval(dqs_hyd(:,igcm_h2o_vap)*area(:)*ptimestep/totarea_planet,dWtots)
+                  call planetwide_sumval(dqs_hyd(:,igcm_h2o_vap)*cell_area(:)*ptimestep/totarea_planet,dWtots)
                if (is_master) then
                   print*,'In hydrol surface water change          =',dWtots,' kg m-2'
@@ -1595,5 +1596,5 @@
       ! Test energy conservation
       if(enertest)then
-         call planetwide_sumval(area(:)*capcal(:)*zdtsurf(:)/totarea_planet,dEtots)         
+         call planetwide_sumval(cell_area(:)*capcal(:)*zdtsurf(:)/totarea_planet,dEtots)         
          if (is_master) print*,'Surface energy change                 =',dEtots,' W m-2'
       endif
@@ -1635,9 +1636,9 @@
 
       ! Surface and soil temperature information
-      call planetwide_sumval(area(:)*tsurf(:)/totarea_planet,Ts1)
+      call planetwide_sumval(cell_area(:)*tsurf(:)/totarea_planet,Ts1)
       call planetwide_minval(tsurf(:),Ts2)
       call planetwide_maxval(tsurf(:),Ts3)
       if(callsoil)then
-         TsS = SUM(area(:)*tsoil(:,nsoilmx))/totarea        ! mean temperature at bottom soil layer
+         TsS = SUM(cell_area(:)*tsoil(:,nsoilmx))/totarea        ! mean temperature at bottom soil layer
          print*,'  ave[Tsurf]     min[Tsurf]     max[Tsurf]     ave[Tdeep]'
          print*,Ts1,Ts2,Ts3,TsS
@@ -1653,9 +1654,9 @@
       if(corrk)then
 
-         call planetwide_sumval(area(:)*fluxtop_dn(:)/totarea_planet,ISR)
-         call planetwide_sumval(area(:)*fluxabs_sw(:)/totarea_planet,ASR)
-         call planetwide_sumval(area(:)*fluxtop_lw(:)/totarea_planet,OLR)
-         call planetwide_sumval(area(:)*fluxgrd(:)/totarea_planet,GND)
-         call planetwide_sumval(area(:)*fluxdyn(:)/totarea_planet,DYN)
+         call planetwide_sumval(cell_area(:)*fluxtop_dn(:)/totarea_planet,ISR)
+         call planetwide_sumval(cell_area(:)*fluxabs_sw(:)/totarea_planet,ASR)
+         call planetwide_sumval(cell_area(:)*fluxtop_lw(:)/totarea_planet,OLR)
+         call planetwide_sumval(cell_area(:)*fluxgrd(:)/totarea_planet,GND)
+         call planetwide_sumval(cell_area(:)*fluxdyn(:)/totarea_planet,DYN)
          do ig=1,ngrid
             if(fluxtop_dn(ig).lt.0.0)then
@@ -1749,8 +1750,8 @@
       if(water)then
 
-         call planetwide_sumval(area(:)*qsurf_hist(:,igcm_h2o_ice)/totarea_planet,icesrf)
-         call planetwide_sumval(area(:)*qsurf_hist(:,igcm_h2o_vap)/totarea_planet,liqsrf)
-         call planetwide_sumval(area(:)*qcol(:,igcm_h2o_ice)/totarea_planet,icecol)
-         call planetwide_sumval(area(:)*qcol(:,igcm_h2o_vap)/totarea_planet,vapcol)
+         call planetwide_sumval(cell_area(:)*qsurf_hist(:,igcm_h2o_ice)/totarea_planet,icesrf)
+         call planetwide_sumval(cell_area(:)*qsurf_hist(:,igcm_h2o_vap)/totarea_planet,liqsrf)
+         call planetwide_sumval(cell_area(:)*qcol(:,igcm_h2o_ice)/totarea_planet,icecol)
+         call planetwide_sumval(cell_area(:)*qcol(:,igcm_h2o_vap)/totarea_planet,vapcol)
 
          h2otot = icesrf + liqsrf + icecol + vapcol
@@ -1833,5 +1834,5 @@
 
             ! enforce ice conservation
-            ice_tot= SUM(qsurf_hist(:,igcm_h2o_ice)*area(:) )/SUM(area(:))
+            ice_tot= SUM(qsurf_hist(:,igcm_h2o_ice)*cell_area(:) )/SUM(cell_area(:))
             qsurf_hist(:,igcm_h2o_ice) = qsurf_hist(:,igcm_h2o_ice)*(icesrf/ice_tot)
 
Index: trunk/LMDZ.GENERIC/libf/phystd/rings.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/rings.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/rings.F90	(revision 1542)
@@ -4,6 +4,6 @@
 ! Authors: M. Sylvestre, M. Capderou, S. Guerlet, A. Spiga
 
-    use comdiurn_h
-    use comgeomfi_h
+    use comdiurn_h, only: sinlat, sinlon, coslat, coslon
+    use comgeomphy, only: latitude ! (rad)
  
     implicit none   
@@ -148,5 +148,5 @@
 
     ! Summer hemisphere is not under the shadow of the rings
-    where(lati(:)*declin .gt. 0.)
+    where(latitude(:)*declin .gt. 0.)
        eclipse(:) = 1000.
     end where
Index: trunk/LMDZ.GENERIC/libf/phystd/soil.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/soil.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/soil.F	(revision 1542)
@@ -8,5 +8,5 @@
       use time_phylmdz_mod, only: daysec
       use planete_mod, only: year_day
-      use comgeomfi_h, only: long, lati
+      use comgeomphy, only: longitude, latitude ! in radians
 
       implicit none
@@ -133,6 +133,6 @@
         ! one should have the fist layer be at least half of diurnal skin depth
           write(*,*) "soil Error: grid point ig=",ig
-          write(*,*) "            longitude=",long(ig)*(180./pi)
-          write(*,*) "             latitude=",lati(ig)*(180./pi)
+          write(*,*) "            longitude=",longitude(ig)*(180./pi)
+          write(*,*) "             latitude=",latitude(ig)*(180./pi)
           write(*,*) "  first soil layer depth ",layer(1)
           write(*,*) "  not small enough for a diurnal skin depth of ",
@@ -144,6 +144,6 @@
         ! one should have the full soil be at least twice the diurnal skin depth
           write(*,*) "soil Error: grid point ig=",ig
-          write(*,*) "            longitude=",long(ig)*(180./pi)
-          write(*,*) "             latitude=",lati(ig)*(180./pi)
+          write(*,*) "            longitude=",longitude(ig)*(180./pi)
+          write(*,*) "             latitude=",latitude(ig)*(180./pi)
           write(*,*) "  total soil layer depth ",layer(nsoil)
           write(*,*) "  not large enough for an annual skin depth of ",
Index: trunk/LMDZ.GENERIC/libf/phystd/surface_nature.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/surface_nature.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/surface_nature.F	(revision 1542)
@@ -4,5 +4,5 @@
       USE surfdat_h
       USE comsoil_h
-      USE comgeomfi_h
+      USE comgeomphy, ONLY: cell_area
       USE tracer_h
 
@@ -56,5 +56,5 @@
 	do ig=1,ngrid
            if (rnat(ig).eq.0)then
-              oceanarea=oceanarea+area(ig)
+              oceanarea=oceanarea+cell_area(ig)
            end if
 	enddo
Index: trunk/LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90	(revision 1542)
@@ -3,5 +3,4 @@
       use watercommon_h
       use comdiurn_h
-      USE comgeomfi_h
       USE tracer_h, only: igcm_h2o_ice
       USE callkeys_mod, ONLY: CLFfixval
Index: trunk/LMDZ.GENERIC/libf/phystd/vdifc.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/vdifc.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/vdifc.F	(revision 1542)
@@ -10,5 +10,4 @@
       use radcommon_h, only : sigma
       USE surfdat_h
-      USE comgeomfi_h
       USE tracer_h
       use comcstfi_mod, only: g, r, cpp, rcp
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1542)
@@ -40,5 +40,5 @@
 !=================================================================
       use surfdat_h, only: phisfi
-      use comgeomphy, only: airephy
+      use comgeomphy, 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,
@@ -120,9 +120,5 @@
 !Sortie des variables au rythme voulu
 
-      irythme = int(ecritphy) ! sortie au rythme de ecritphy
-!     irythme = iconser  ! sortie au rythme des variables de controle
-!     irythme = iphysiq  ! sortie a tous les pas physique
-!     irythme = iecri*day_step ! sortie au rythme des fichiers histoires
-!     irythme = periodav*day_step ! sortie au rythme des fichiers histmoy
+      irythme = int(ecritphy) ! output rate set by ecritphy
 
 !***************************************************************
@@ -191,9 +187,9 @@
           ! Gather phisfi() geopotential on physics grid
           call Gather(phisfi,phisfi_glo)
-          ! Gather airephy() mesh area on physics grid
-          call Gather(airephy,areafi_glo)
+          ! Gather cell_area() mesh area on physics grid
+          call Gather(cell_area,areafi_glo)
 #else
          phisfi_glo(:)=phisfi(:)
-         areafi_glo(:)=airephy(:)
+         areafi_glo(:)=cell_area(:)
 #endif
 
@@ -262,11 +258,4 @@
 
       endif ! if (firstnom.eq.'1234567890')
-
-      if (klon_glo.eq.1) then
-        ! in testphys1d, for the 1d version of the GCM, iphysiq and irythme
-        ! are undefined; so set them to 1
-        iphysiq=1 
-        irythme=1
-      endif
 
 ! Increment time index 'zitau' if it is the "fist call" (at given time level)
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1542)
@@ -13,5 +13,5 @@
 
 use comsoil_h, only: nsoilmx, inertiedat
-use comgeomphy, only: airephy
+use comgeomphy, only: cell_area
 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq
 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
@@ -102,9 +102,9 @@
    ! Gather inertiedat() soil thermal inertia on physics grid
    call Gather(inertiedat,inertiafi_glo)
-   ! Gather airephy() mesh area on physics grid
-   call Gather(airephy,areafi_glo)
+   ! Gather cell_area() mesh area on physics grid
+   call Gather(cell_area,areafi_glo)
 #else
          inertiafi_glo(:,:)=inertiedat(:,:)
-         areafi_glo(:)=airephy(:)
+         areafi_glo(:)=cell_area(:)
 #endif
 
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1542)
@@ -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: airephy
+      use comgeomphy, 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,
@@ -127,8 +127,8 @@
 
 #ifdef CPP_PARA
-          ! Gather airephy() mesh area on physics grid
-          call Gather(airephy,areafi_glo)
-#else
-         areafi_glo(:)=airephy(:)
+          ! Gather cell_area() mesh area on physics grid
+          call Gather(cell_area,areafi_glo)
+#else
+         areafi_glo(:)=cell_area(:)
 #endif
          ! Create the NetCDF file
Index: trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1540)
+++ trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1542)
@@ -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: airephy
+      use comgeomphy, 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,
@@ -126,8 +126,8 @@
 
 #ifdef CPP_PARA
-          ! Gather airephy() mesh area on physics grid
-          call Gather(airephy,areafi_glo)
-#else
-         areafi_glo(:)=airephy(:)
+          ! Gather cell_area() mesh area on physics grid
+          call Gather(cell_area,areafi_glo)
+#else
+         areafi_glo(:)=cell_area(:)
 #endif
          ! Create the NetCDF file
