Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histday.h
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histday.h	(revision 486)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histday.h	(revision 506)
@@ -1,3 +1,15 @@
       IF (ok_journe) THEN
+c
+       IF(region.EQ.'3d') THEN
+         zsto = dtime
+c        zout = dtime * FLOAT(ecrit_day)
+c        zsto1= dtime * FLOAT(ecrit_day)
+         zout = dtime * REAL(ecrit_day)
+         zsto1= dtime * REAL(ecrit_day)
+       ELSEIF(region.EQ.'1d') THEN
+         zsto = dtime
+c        zout = dtime
+         zout = dtime *4.
+       ENDIF
 c
          idayref = day_ref
@@ -13,27 +25,19 @@
          ENDDO
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat,zx_lat)
+         write(*,*)'zx_lon = ',zx_lon(:,1)
+         write(*,*)'zx_lat = ',zx_lat(1,:)
          CALL histbeg("histday", iim,zx_lon(:,1), jjmp1,zx_lat(1,:),
-     .                 1,iim,1,jjmp1, itau_phy, zjulian, dtime, 
+c071103
+c    .                 1,iim,1,jjmp1, 
+     .                 imin_debut,nbpti,
+     .                 jmin_debut,nbptj,
+c071103
+     .                 itau_phy, zjulian, dtime, 
      .                 nhori, nid_day)
          write(*,*)'Journee ', itau_phy, zjulian
          CALL histvert(nid_day, "presnivs", "Vertical levels", "mb",
      .                 klev, presnivs, nvert)
-c        call histvert(nid_day, 'sig_s', 'Niveaux sigma','-',
-c    .              klev, znivsig, nvert)
-c
-         zsto = dtime
-         zout = dtime * FLOAT(ecrit_day)
-C Essai writephys
-c        nom_fichier = 'histday1'
-c        call writephy_ini(fid_day,nom_fichier,klon,iim,jjmp1,klev,
-c    .                     rlon,rlat, presnivs,
-c    .                     zjulian, dtime)
-c        call writephy_def(prof2d_on, fid_day, "once", zsto, zout, 0)
-c        call writephy_def(prof3d_on, fid_day, "once", zsto, zout,
-c    .                                                         klev)
-c        call writephy_def(prof2d_av, fid_day, "ave(X)", zsto, zout, 0) 
-c        call writephy_def(prof3d_av, fid_day, "ave(X)", zsto, zout, 
-c    .                                                         klev)
- 
+c
+       IF(lev_histday.GE.1) THEN
 c
          CALL histdef(nid_day, "phis", "Surface geop. height", "-",
@@ -45,4 +49,12 @@
      .                "once", zsto,zout)
 c
+         CALL histdef(nid_day, "contfracATM","% sfce ter+lic ","-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "once", zsto,zout)
+c
+         CALL histdef(nid_day, "contfracOR","% sfce terre OR", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "once", zsto,zout)
+c
 c Champs 2D:
 c
@@ -51,192 +63,8 @@
      .                "ave(X)", zsto,zout)
 c
-c
          CALL histdef(nid_day, "t2m", "Temperature 2m", "K",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32,
      .                "ave(X)", zsto,zout)
 c
-         CALL histdef(nid_day, "q2m", "Specific humidity", "Kg/Kg",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "u10m", "Vent zonal 10m", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "v10m", "Vent meridien 10m", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "psol", "Surface Pressure", "Pa",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "precip","Precipitation Totale liq+sol"
-     .                , "kg/(s*m2)",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "snow", "Snow fall", "kg/(s*m2)",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "snow_mass", "Snow Mass", "kg/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "evap", "Evaporation", "kg/(s*m2)",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "tops", "Solar rad. at TOA", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "topl", "IR rad. at TOA", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "sols", "Net Solar rad. at surf.", 
-     .                "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "soll", "Net IR rad. at surface", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "solldown", "Down. IR rad. at surface", 
-     .                "W/m2", iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "bils", "Surf. total heat flux", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "sens", "Sensible heat flux", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "fder", "Heat flux derivation", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-c        CALL histdef(nid_day, "frtu", "Zonal wind stress", "Pa",
-c    .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-c    .                "ave(X)", zsto,zout)
-c
-c        CALL histdef(nid_day, "frtv", "Meridional wind stress", "Pa",
-c    .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-c    .                "ave(X)", zsto,zout)
-c
-c        CALL histdef(nid_day, "sicf", "Sea-ice fraction", "-",
-c    .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-c    .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "cldl", "Low-level cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "cldm", "Mid-level cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "cldh", "High-level cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "cldt", "Total cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "cldq", "Cloud liquid water path", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "SWupTOA", "SWup at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "SWupSFC", "SWup at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "SWdnTOA", "SWdn at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "SWdnSFC", "SWdn at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "SWupTOAclr",
-     .                "SWup clear sky at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "SWupSFCclr",
-     .                "SWup clear sky at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "SWdnTOAclr",
-     .                "SWdn clear sky at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "SWdnSFCclr",
-     .                "SWdn clear sky at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-cccIM   
-         CALL histdef(nid_day, "prw", "Precipitable water", "kg/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-c  Champs dynamiques sur niveaux de pression
-
-         CALL histdef(nid_day, "u850", "Zonal wind 850mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "v850", "Meridional wind 850mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "u500", "Zonal wind 500mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "v500", "Meridional wind 500mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "u200", "Zonal wind 200mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "v200", "Meridional wind 200mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day,"phi500", "Geopotentiel à 500mb", "m2/s2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "slp", "Sea Level Pressure", "Pa",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_day, "cape_max", "CAPE max.",
-     .                "J/Kg",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                capemaxcels, zsto,zout)
-
-
-c=================================================================
-c   CI DESSOUS, SORTIES A UTILISER EN DEBUG
-c=================================================================
-      if ( lev_histday.gt.1 ) then
-
 c Champs retires momentannéement en attendant un hypothetique
 c debugage
@@ -252,10 +80,262 @@
      .                t2maxcels, zsto,zout)
 c
-c=================================================================
-c=================================================================
-c=================================================================
+         CALL histdef(nid_day, "plul", "Large-scale Precip.",
+     .   "kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "pluc", "Convective Precip.",
+     .   "kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "snowl", "Solid Large-scale Precip.",
+     .   "kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         IF(1.EQ.0) THEN !snowc=0.
+         CALL histdef(nid_day, "snowc", "Solid Convective Precip.",
+     .   "kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+         ENDIF !snowc=0.
+c
+         CALL histdef(nid_day, "flat", "Latent heat flux", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "sicf", "Sea-ice fraction", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "inst(X)", zsto1,zout)
+c
+         CALL histdef(nid_day, "q2m", "Specific humidity", "kg/kg",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "u10m", "Vent zonal 10m", "m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "v10m", "Vent meridien 10m", "m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "wind10m","10-m wind speed","m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "wind10max", "10-m wind speed max.",
+     .                "m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                t2maxcels, zsto,zout)
+c
+         CALL histdef(nid_day, "psol", "Surface Pressure", "Pa",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "precip","Precipitation Totale liq+sol"
+     .                , "kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "snowf", "Snow fall", "kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "snow_mass", "Snow Mass", "kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "evap", "Evaporation", "kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "tops", "Solar rad. at TOA", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "topl", "IR rad. at TOA", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "sols", "Net Solar rad. at surf.", 
+     .                "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "soll", "Net IR rad. at surface", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "cldl", "Low-level cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "cldm", "Mid-level cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "cldh", "High-level cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "cldt", "Total cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "cldq", "Cloud liquid water path", 
+     .                "kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "prw", "Precipitable water", "kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+c  Champs dynamiques sur niveaux de pression
+         DO k=1, nlevENS
+c
+          CALL histdef(nid_day, "u"//clev(k),
+     .                 "Zonal wind"//clev(k)//"mb","m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+          CALL histdef(nid_day, "v"//clev(k),
+     .                 "Meridional wind"//clev(k)//"mb","m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         ENDDO !nlevENS
+c
+         CALL histdef(nid_day, "w500", "Verical wind 500mb", "m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day,"phi500", "Geopotentiel a 500mb","m2/s2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "slp", "Sea Level Pressure", "Pa",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "cape_max", "CAPE max.",
+     .                "J/kg",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                capemaxcels, zsto,zout)
+c
+         CALL histdef(nid_day, "solldown", "Down. IR rad. at surface", 
+     .                "W/m2", iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "sens", "Sensible heat flux", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "SWdnSFC", "SWdn at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
+c
+      ENDIF !lev_histday.GE.1
+c
+      IF (lev_histday.GE.2) THEN
+c
+         CALL histdef(nid_day, "bils", "Surf. total heat flux", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "fder", "Heat flux derivation", "W/m2/K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+      ENDIF !lev_histday.GE.2
+c=================================================================
+      IF(lev_histday.GE.3) THEN
+c=================================================================
+c   INITIALISATION DES CHAMPS 3D
+c=================================================================
+c=================================================================
+c=================================================================
+c Champs 3D:
+c
+         CALL histdef(nid_day, "temp", "Air temperature", "K",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "ovap", "Specific humidity", "kg/kg",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "geop", "Geopotential height", "m",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "vitu", "Zonal wind", "m/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "vitv", "Meridional wind", "m/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "vitw", "Vertical wind", "m/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "pres", "Air pressure", "Pa",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+c=================================================================
+c   FIN INITIALISATION DES CHAMPS 3D
+c=================================================================
+      ENDIF !  lev_histday.GE.3
+c
+      IF (lev_histday.GE.4) THEN
+c=================================================================
+c
 c   INITIALISATION DES CHAMPS SUR LES SOUS SURFACES
-c=================================================================
+c
+c=================================================================
+c
+         CALL histdef(nid_day, "SWupTOA", "SWup at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "SWupSFC", "SWup at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "SWdnTOA", "SWdn at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "SWupTOAclr",
+     .                "SWup clear sky at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
 
+         CALL histdef(nid_day, "SWupSFCclr",
+     .                "SWup clear sky at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
+
+         CALL histdef(nid_day, "SWdnTOAclr",
+     .                "SWdn clear sky at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
+
+         CALL histdef(nid_day, "SWdnSFCclr",
+     .                "SWdn clear sky at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto,zout)
+c
+c=================================================================
+c=================================================================
+c=================================================================
+c   INITIALISATION DES CHAMPS SUR LES SOUS SURFACES
+c=================================================================
+c
          CALL histdef(nid_day, "tter", "Surface Temperature", "K",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
@@ -273,6 +353,4 @@
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
-c
-cccIM
 c
          CALL histdef(nid_day, "t2mter", "Temp.terre 2m", "K",
@@ -334,7 +412,4 @@
      .                "ave(X)", zsto,zout)
 c
-c
-CXXX PB flux pour chaque sous surface
-C
          DO nsrf = 1, nbsrf
 C
@@ -378,56 +453,15 @@
      $         iim,jjmp1,nhori, 1,1,1, -99, 32,
      $         "ave(X)", zsto,zout)
-
-CXXX
+C
          END DO 
-           
-c=================================================================
-c   FIN DES CHAMPS SUR LES SOUS SURFACES
-c=================================================================
-c=================================================================
-c   FIN INITIALISATION DES CHAMPS 3D
-c=================================================================
-
-c Champs 3D:
-c
-         CALL histdef(nid_day, "temp", "Air temperature", "K",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "ovap", "Specific humidity", "Kg/Kg",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "geop", "Geopotential height", "m",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "vitu", "Zonal wind", "m/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "vitv", "Meridional wind", "m/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "vitw", "Vertical wind", "m/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "pres", "Air pressure", "Pa",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-c
-c=================================================================
-c   FIN INITIALISATION DES CHAMPS 3D
-c=================================================================
-
-
-c=================================================================
-c=================================================================
-      endif !  lev_histday.gt.1
-c=================================================================
-
+C           
+c=================================================================
+c
+c   FIN INITIALISATION DES CHAMPS SUR LES SOUS SURFACES
+c
+c=================================================================
+      ENDIF !lev_histday.GE.4
+c=================================================================
+c
          CALL histend(nid_day)
 c
