Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histday.h
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histday.h	(revision 418)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histday.h	(revision 433)
@@ -53,21 +53,4 @@
      .                "ave(X)", zsto,zout)
 c
-         CALL histdef(nid_day, "tter", "Surface Temperature", "K",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "tlic", "Surface Temperature", "K",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "toce", "Surface Temperature", "K",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "tsic", "Surface Temperature", "K",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-cccIM
 c
          CALL histdef(nid_day, "t2m", "Temperature 2m", "K",
@@ -75,20 +58,161 @@
      .                "ave(X)", zsto,zout)
 c
-         CALL histdef(nid_day, "t2mter", "Temp.terre 2m", "K",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "t2mlic", "Temp.lic 2m", "K",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "t2moce", "Temp.oce 2m", "K",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "t2msic", "Temp.sic 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",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "snow", "Snow fall", "kg/s",
+     .                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",
+     .                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
+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)
+
+
+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
+
          CALL histdef(nid_day, "t2m_min", "Temp. 2m min.",
      .                "K",
@@ -101,4 +225,44 @@
      .                t2maxcels, zsto,zout)
 c
+c=================================================================
+c=================================================================
+c=================================================================
+c   INITIALISATION DES CHAMPS SUR LES SOUS SURFACES
+c=================================================================
+
+         CALL histdef(nid_day, "tter", "Surface Temperature", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "tlic", "Surface Temperature", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "toce", "Surface Temperature", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "tsic", "Surface Temperature", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+cccIM
+c
+         CALL histdef(nid_day, "t2mter", "Temp.terre 2m", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "t2mlic", "Temp.lic 2m", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "t2moce", "Temp.oce 2m", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_day, "t2msic", "Temp.sic 2m", "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
          CALL histdef(nid_day, "t2mter_min", "Temp.terre 2m min.",
      .                "K",
@@ -111,12 +275,4 @@
      .                t2maxcels, 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, "u10mter", "Vent zonal ter 10m", "m/s",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32,
@@ -135,8 +291,4 @@
      .                "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, "v10mter", "Vent meridien ter 10m", 
      .                "m/s", iim,jjmp1,nhori, 1,1,1, -99, 32,
@@ -155,65 +307,4 @@
      .                "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",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "snow", "Snow fall", "kg/s",
-     .                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",
-     .                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
-         CALL histdef(nid_day, "frtu", "Zonal wind stress", "Pa",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_day, "frtv", "Meridional wind stress", "Pa",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
 c
 CXXX PB flux pour chaque sous surface
@@ -264,28 +355,11 @@
          END DO 
            
-         CALL histdef(nid_day, "sicf", "Sea-ice fraction", "-",
-     .                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", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
+c=================================================================
+c   FIN DES CHAMPS SUR LES SOUS SURFACES
+c=================================================================
+c=================================================================
+c   FIN INITIALISATION DES CHAMPS 3D
+c=================================================================
+
 c Champs 3D:
 c
@@ -337,6 +411,19 @@
          CALL histend(nid_day)
 c
+c=================================================================
+c   FIN INITIALISATION DES CHAMPS 3D
+c=================================================================
+
+
+c=================================================================
+c=================================================================
+      endif !  lev_histday.gt.1
+c=================================================================
+
+         CALL histend(nid_day)
+c
          ndex2d = 0
          ndex3d = 0
 c
+c=================================================================
       ENDIF ! fin de test sur ok_journe
