Index: /LMDZ4/branches/LMDZ4-dev/libf/phylmd/conf_phys.F90
===================================================================
--- /LMDZ4/branches/LMDZ4-dev/libf/phylmd/conf_phys.F90	(revision 1122)
+++ /LMDZ4/branches/LMDZ4-dev/libf/phylmd/conf_phys.F90	(revision 1123)
@@ -462,5 +462,5 @@
 !Config  Help = Connais pas !
        ok_orolf_omp = .TRUE.
-       CALL getin('ok_orolf_omp', ok_orolf_omp)
+       CALL getin('ok_orolf', ok_orolf_omp)
 
 !Config  Key  = ok_limitvrai
Index: /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_mod.F90
===================================================================
--- /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_mod.F90	(revision 1122)
+++ /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_mod.F90	(revision 1123)
@@ -276,12 +276,13 @@
   type(ctrl_out) :: o_dthmin       = ctrl_out((/ 10, 1, 10, 10, 10 /),'dthmin')
   type(ctrl_out),dimension(4) :: o_u10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_ter'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_lic'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_oce'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_sic') /)
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_sic') /)
 
   type(ctrl_out),dimension(4) :: o_v10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_ter'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_lic'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_oce'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_sic') /)
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_sic') /)
+
   type(ctrl_out) :: o_cldtau       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldtau')                     
   type(ctrl_out) :: o_cldemi       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldemi')
@@ -292,13 +293,14 @@
   type(ctrl_out) :: o_tke          = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke ')
   type(ctrl_out) :: o_tke_max      = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke_max')
+
   type(ctrl_out),dimension(4) :: o_tke_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_ter'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_lic'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_oce'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_sic') /)
-
-  type(ctrl_out),dimension(4) :: o_tke_max_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_ter'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_lic'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_oce'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_sic') /)
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_sic') /)
+
+  type(ctrl_out),dimension(4) :: o_tke_max_srf  = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_ter'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_sic') /)
 
   type(ctrl_out) :: o_kz           = ctrl_out((/ 4, 10, 10, 10, 10 /),'kz')
@@ -328,4 +330,5 @@
   type(ctrl_out) :: o_theta        = ctrl_out((/ 2, 3, 4, 1, 1 /),'theta')
   type(ctrl_out) :: o_ovap         = ctrl_out((/ 2, 3, 4, 1, 1 /),'ovap')
+  type(ctrl_out) :: o_ovapinit         = ctrl_out((/ 2, 3, 4, 1, 1 /),'ovapinit')
   type(ctrl_out) :: o_wvapp        = ctrl_out((/ 2, 10, 10, 10, 10 /),'wvapp')
   type(ctrl_out) :: o_geop         = ctrl_out((/ 2, 3, 10, 1, 1 /),'geop')
@@ -348,17 +351,17 @@
 
   type(ctrl_out),dimension(4) :: o_albe_srf     = (/ ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_ter'), &
-                                                 ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_lic'), &
-                                                 ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_oce'), &
-                                                 ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_sic') /) 
+                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_lic'), &
+                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_oce'), &
+                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_sic') /) 
 
   type(ctrl_out),dimension(4) :: o_ages_srf     = (/ ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_ter'), &
-                                                 ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_lic'), &
-                                                 ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_oce'), &
-                                                 ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_sic') /)
+                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_lic'), &
+                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_oce'), &
+                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_sic') /)
 
   type(ctrl_out),dimension(4) :: o_rugs_srf     = (/ ctrl_out((/ 3, 4, 10, 1, 10 /),'rugs_ter'), &
-                                                 ctrl_out((/ 3, 4, 10, 1, 10 /),'rugs_lic'), &
-                                                 ctrl_out((/ 3, 4, 10, 1, 10 /),'rugs_oce'), &
-                                                 ctrl_out((/ 3, 4, 10, 1, 10 /),'rugs_sic') /)
+                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'rugs_lic'), &
+                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'rugs_oce'), &
+                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'rugs_sic') /)
 
   type(ctrl_out) :: o_albs         = ctrl_out((/ 3, 10, 10, 1, 10 /),'albs')
@@ -432,5 +435,5 @@
   SUBROUTINE phys_output_open(jjmp1,nlevSTD,clevSTD,nbteta, &
                               ctetaSTD,dtime, presnivs, ok_veget, &
-                              ocean, iflag_pbl,ok_mensuel,ok_journe, &
+                              type_ocean, iflag_pbl,ok_mensuel,ok_journe, &
                               ok_hf,ok_instan,ok_LES,ok_ade,ok_aie)   
 
@@ -462,5 +465,5 @@
   CHARACTER(len=3)                      :: bb2
   CHARACTER(len=2)                      :: bb3
-  character(len=6)                      :: ocean
+  character(len=6)                      :: type_ocean
   CHARACTER(len=3)                      :: ctetaSTD(nbteta)
   real, dimension(nfiles)               :: ecrit_files
@@ -586,4 +589,5 @@
    type_ecri(3) = 'once'
    type_ecri(4) = 'once'
+   type_ecri(5) = 'once'
  CALL histdef2d(iff,o_aire%flag,o_aire%name,"Grid area", "-")
  CALL histdef2d(iff,o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
@@ -592,4 +596,5 @@
    type_ecri(3) = 'ave(X)'
    type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'ave(X)'
 
 !!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -600,6 +605,21 @@
  CALL histdef2d(iff,o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
  CALL histdef2d(iff,o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
+   type_ecri(1) = 't_min(X)'
+   type_ecri(2) = 't_min(X)'
+   type_ecri(3) = 't_min(X)'
+   type_ecri(4) = 't_min(X)'
+   type_ecri(5) = 't_min(X)' 
  CALL histdef2d(iff,o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
+   type_ecri(1) = 't_max(X)'
+   type_ecri(2) = 't_max(X)'
+   type_ecri(3) = 't_max(X)'
+   type_ecri(4) = 't_max(X)'
+   type_ecri(5) = 't_max(X)' 
  CALL histdef2d(iff,o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
+   type_ecri(1) = 'ave(X)'
+   type_ecri(2) = 'ave(X)'
+   type_ecri(3) = 'ave(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'ave(X)'
  CALL histdef2d(iff,o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
  CALL histdef2d(iff,o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
@@ -674,5 +694,15 @@
   if (iflag_pbl>1 .and. lev_files(iff).gt.10 ) then
  CALL histdef2d(iff,o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
+   type_ecri(1) = 't_max(X)'
+   type_ecri(2) = 't_max(X)'
+   type_ecri(3) = 't_max(X)'
+   type_ecri(4) = 't_max(X)'
+   type_ecri(5) = 't_max(X)'
  CALL histdef2d(iff,o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
+   type_ecri(1) = 'ave(X)'
+   type_ecri(2) = 'ave(X)'
+   type_ecri(3) = 'ave(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'ave(X)'
   endif
  CALL histdef2d(iff,o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo surf. "//clnsurf(nsrf),"-")
@@ -714,9 +744,19 @@
  CALL histdef2d(iff,o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
  CALL histdef2d(iff,o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
- CALL histdef2d(iff,o_cape_max%flag,o_cape_max%name,"CAPE max.", "J/kg")
- CALL histdef3d(iff,o_upwd%flag,o_upwd%name,"saturated updraft", "kg/m2/s")
- CALL histdef3d(iff,o_Ma%flag,o_Ma%name,"undilute adiab updraft","kg/m2/s")
- CALL histdef3d(iff,o_dnwd%flag,o_dnwd%name,"saturated downdraft","kg/m2/s")
- CALL histdef3d(iff,o_dnwd0%flag,o_dnwd0%name,"unsat. downdraft", "kg/m2/s")
+   type_ecri(1) = 't_max(X)'
+   type_ecri(2) = 't_max(X)'
+   type_ecri(3) = 't_max(X)'
+   type_ecri(4) = 't_max(X)'
+   type_ecri(5) = 't_max(X)'
+ CALL histdef2d(iff,o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
+   type_ecri(1) = 'ave(X)'
+   type_ecri(2) = 'ave(X)'
+   type_ecri(3) = 'ave(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'ave(X)'
+ CALL histdef3d(iff,o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
+ CALL histdef3d(iff,o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
+ CALL histdef3d(iff,o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
+ CALL histdef3d(iff,o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
      ENDIF !iflag_con .GE. 3
 
@@ -744,4 +784,5 @@
    type_ecri(3) = 'inst(X)'
    type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'inst(X)'
 
 ! Attention a reverifier
@@ -767,34 +808,18 @@
    type_ecri(3) = 'ave(X)'
    type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'ave(X)'
 
  CALL histdef2d(iff,o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
 
- IF (ocean=='slab') & 
+ IF (type_ocean=='slab') & 
      CALL histdef2d(iff,o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
 
- IF (iflag_con.EQ.3) THEN
- CALL histdef2d(iff,o_ale%flag,o_ale%name,"ALE","m2/s2")
- CALL histdef2d(iff,o_alp%flag,o_alp%name,"ALP","W/m2")
- CALL histdef2d(iff,o_cin%flag,o_cin%name,"Convective INhibition","m2/s2")
- IF (iflag_coupl.EQ.1) THEN
-  CALL histdef2d(iff,o_ale_bl%flag,o_ale_bl%name,"ALE BL","m2/s2") 
-  CALL histdef2d(iff,o_alp_bl%flag,o_alp_bl%name,"ALP BL","m2/s2") 
- ENDIF !iflag_coupl.EQ.1
- IF (iflag_wake.EQ.1) THEN
-  CALL histdef2d(iff,o_ale_wk%flag,o_ale_wk%name,"ALE WK","m2/s2") 
-  CALL histdef2d(iff,o_alp_wk%flag,o_alp_wk%name,"ALP WK","m2/s2") 
-  CALL histdef2d(iff,o_wape%flag,o_WAPE%name,"WAPE","m2/s2")
-  CALL histdef2d(iff,o_wake_h%flag,o_wake_h%name,"wake_h", "-")
-  CALL histdef2d(iff,o_wake_s%flag,o_wake_s%name,"wake_s", "-")
-  CALL histdef3d(iff,o_dtwak%flag,o_dtwak%name,"Wake dT","K/s")
-  CALL histdef3d(iff,o_dqwak%flag,o_dqwak%name,"Wake dQ","(kg/kg)/s")
-  CALL histdef3d(iff,o_wake_deltat%flag,o_wake_deltat%name,"wake_deltat", " ")
-  CALL histdef3d(iff,o_wake_deltaq%flag,o_wake_deltaq%name,"wake_deltaq", " ")
-  CALL histdef3d(iff,o_wake_omg%flag,o_wake_omg%name,"wake_omg", " ")
-  CALL histdef3d(iff,o_ftd%flag,o_ftd%name,"tend temp due aux descentes precip","-")
-  CALL histdef3d(iff,o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip","-")
- ENDIF !iflag_wake.EQ.1
-  CALL histdef3d(iff,o_Vprecip%flag,o_Vprecip%name,"precipitation vertical profile","-")
- ENDIF !(iflag_con.EQ.3)
+! Couplage conv-CL
+ IF (iflag_con.GE.3) THEN
+    IF (iflag_coupl.EQ.1) THEN
+ CALL histdef2d(iff,o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2") 
+ CALL histdef2d(iff,o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2") 
+    ENDIF
+ ENDIF !(iflag_con.GE.3)
 
  CALL histdef2d(iff,o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
@@ -808,4 +833,5 @@
  CALL histdef2d(iff,o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
  CALL histdef2d(iff,o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
+
  CALL histdef2d(iff,o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
  CALL histdef2d(iff,o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
@@ -820,5 +846,6 @@
  CALL histdef3d(iff,o_temp%flag,o_temp%name, "Air temperature", "K" )
  CALL histdef3d(iff,o_theta%flag,o_theta%name, "Potential air temperature", "K" )
- CALL histdef3d(iff,o_ovap%flag,o_ovap%name, "Specific humidity", "kg/kg" )
+ CALL histdef3d(iff,o_ovap%flag,o_ovap%name, "Specific humidity + dqphy", "kg/kg" )
+ CALL histdef3d(iff,o_ovapinit%flag,o_ovapinit%name, "Specific humidity", "kg/kg" )
  CALL histdef3d(iff,o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
  CALL histdef3d(iff,o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
@@ -843,10 +870,30 @@
      if (iflag_pbl>1) then
  CALL histdef3d(iff,o_tke%flag,o_tke%name, "TKE", "m2/s2")
+   type_ecri(1) = 't_max(X)'
+   type_ecri(2) = 't_max(X)'
+   type_ecri(3) = 't_max(X)'
+   type_ecri(4) = 't_max(X)'
+   type_ecri(5) = 't_max(X)'
  CALL histdef3d(iff,o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
+   type_ecri(1) = 'ave(X)'
+   type_ecri(2) = 'ave(X)'
+   type_ecri(3) = 'ave(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'ave(X)'
      endif
 
  CALL histdef3d(iff,o_kz%flag,o_kz%name, "Kz melange", "m2/s")
+   type_ecri(1) = 't_max(X)'
+   type_ecri(2) = 't_max(X)'
+   type_ecri(3) = 't_max(X)'
+   type_ecri(4) = 't_max(X)'
+   type_ecri(5) = 't_max(X)'
  CALL histdef3d(iff,o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
- CALL histdef3d(iff,o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg")  
+   type_ecri(1) = 'ave(X)'
+   type_ecri(2) = 'ave(X)'
+   type_ecri(3) = 'ave(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'ave(X)'
+ CALL histdef3d(iff,o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg") 
  CALL histdef3d(iff,o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
  CALL histdef3d(iff,o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
@@ -856,4 +903,27 @@
  CALL histdef3d(iff,o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
  CALL histdef3d(iff,o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
+
+! Wakes
+ IF(iflag_con.EQ.3) THEN
+ IF (iflag_wake == 1) THEN
+   CALL histdef2d(iff,o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
+   CALL histdef2d(iff,o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
+   CALL histdef2d(iff,o_ale%flag,o_ale%name, "ALE", "m2/s2")
+   CALL histdef2d(iff,o_alp%flag,o_alp%name, "ALP", "W/m2")
+   CALL histdef2d(iff,o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
+   CALL histdef2d(iff,o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
+   CALL histdef2d(iff,o_wake_h%flag,o_wake_h%name, "wake_h", "-")
+   CALL histdef2d(iff,o_wake_s%flag,o_wake_s%name, "wake_s", "-")
+   CALL histdef3d(iff,o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
+   CALL histdef3d(iff,o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
+   CALL histdef3d(iff,o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
+   CALL histdef3d(iff,o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
+   CALL histdef3d(iff,o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
+ ENDIF
+   CALL histdef3d(iff,o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
+   CALL histdef3d(iff,o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
+   CALL histdef3d(iff,o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
+ ENDIF !(iflag_con.EQ.3)
+
  CALL histdef3d(iff,o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
  CALL histdef3d(iff,o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
@@ -937,7 +1007,6 @@
        character(len=*)                 :: unitvar
 
-       if (iff.eq.1) then
-   call conf_physoutputs(nomvar,flag_var)
-       endif
+! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
+       call conf_physoutputs(nomvar,flag_var)
        
        if ( flag_var(iff)<=lev_files(iff) ) then
@@ -967,7 +1036,6 @@
        character(len=*)                 :: unitvar
 
-       if (iff.eq.1) then
-   call conf_physoutputs(nomvar,flag_var)
-       endif
+! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
+       call conf_physoutputs(nomvar,flag_var)
 
        if ( flag_var(iff)<=lev_files(iff) ) then
@@ -980,4 +1048,6 @@
 
       SUBROUTINE conf_physoutputs(nam_var,flag_var)
+!!! Lecture des noms et niveau de sortie des variables dans output.def
+!   en utilisant les routines getin de IOIPSL  
        use ioipsl
 
Index: /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_write.h
===================================================================
--- /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_write.h	(revision 1122)
+++ /LMDZ4/branches/LMDZ4-dev/libf/phylmd/phys_output_write.h	(revision 1123)
@@ -511,21 +511,25 @@
       CALL histwrite_phy(nid_files(iff),o_prw%name,itau_w,prw)
         ENDIF
+
       IF (o_cape_max%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_cape_max%name,itau_w,cape)
-      ENDIF
-      IF (o_upwd%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_upwd%name,itau_w,upwd)
-      ENDIF
-      IF (o_Ma%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_Ma%name,itau_w,Ma)
-      ENDIF
-
-      IF (o_dnwd%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_dnwd%name,itau_w,dnwd)
-      ENDIF
-
-      IF (o_dnwd0%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_dnwd0%name,itau_w,dnwd0)
-      ENDIF
+      CALL histwrite_phy(nid_files(iff),o_cape_max%name,itau_w,cape)
+      ENDIF
+
+       IF (o_upwd%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),o_upwd%name,itau_w,upwd)
+       ENDIF
+
+       IF (o_Ma%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),o_Ma%name,itau_w,Ma)
+       ENDIF
+
+       IF (o_dnwd%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),o_dnwd%name,itau_w,dnwd)
+       ENDIF
+
+       IF (o_dnwd0%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),o_dnwd0%name,itau_w,dnwd0)
+       ENDIF
+
       ENDIF !iflag_con .GE. 3
 
@@ -634,16 +638,6 @@
       ENDIF
 
-      IF (type_ocean=='force ') THEN
-
-      IF (iflag_con.EQ.3) THEN
-       IF (o_ale%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_ale%name,itau_w,ale)
-       ENDIF
-       IF (o_alp%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_alp%name,itau_w,alp)
-       ENDIF
-       IF (o_cin%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_cin%name,itau_w,cin)
-       ENDIF
+! Couplage convection-couche limite
+      IF (iflag_con.GE.3) THEN
       IF (iflag_coupl.EQ.1) THEN
        IF (o_ale_bl%flag(iff)<=lev_files(iff)) THEN
@@ -654,5 +648,8 @@
        ENDIF
       ENDIF !iflag_coupl.EQ.1
-
+      ENDIF !(iflag_con.GE.3)
+
+! Wakes
+      IF (iflag_con.EQ.3) THEN
       IF (iflag_wake.EQ.1) THEN
        IF (o_ale_wk%flag(iff)<=lev_files(iff)) THEN
@@ -663,4 +660,13 @@
        ENDIF
 
+       IF (o_ale%flag(iff)<=lev_files(iff)) THEN
+       CALL histwrite_phy(nid_files(iff),o_ale%name,itau_w,ale)
+       ENDIF
+       IF (o_alp%flag(iff)<=lev_files(iff)) THEN
+       CALL histwrite_phy(nid_files(iff),o_alp%name,itau_w,alp)
+       ENDIF
+       IF (o_cin%flag(iff)<=lev_files(iff)) THEN
+       CALL histwrite_phy(nid_files(iff),o_cin%name,itau_w,cin)
+       ENDIF
        IF (o_wape%flag(iff)<=lev_files(iff)) THEN
        CALL histwrite_phy(nid_files(iff),o_WAPE%name,itau_w,wake_pe)
@@ -685,18 +691,24 @@
 
         IF (o_wake_omg%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_wake_omg%name,itau_w,
-     .wake_omg)
-        ENDIF
-        IF (o_dtwak%flag(iff)<=lev_files(iff)) THEN
-          zx_tmp_fi3d(1:klon,1:klev)=d_t_wake(1:klon,1:klev)
+       CALL histwrite_phy(nid_files(iff),
+     s                    o_wake_omg%name,itau_w,wake_omg)
+        ENDIF
+
+         IF (o_dtwak%flag(iff)<=lev_files(iff)) THEN
+           zx_tmp_fi3d(1:klon,1:klev)=d_t_wake(1:klon,1:klev)
      &                                        /pdtphys
-          CALL histwrite_phy(nid_files(iff),o_dtwak%name,itau_w,
-     .zx_tmp_fi3d)
-        ENDIF
+           CALL histwrite_phy(nid_files(iff),
+     &                       o_dtwak%name,itau_w,zx_tmp_fi3d)
+         ENDIF
 
         IF (o_dqwak%flag(iff)<=lev_files(iff)) THEN
-         zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys
-         CALL histwrite_phy(nid_files(iff),o_dqwak%name,itau_w,
-     .zx_tmp_fi3d)
+        zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys
+        CALL histwrite_phy(nid_files(iff),
+     &                     o_dqwak%name,itau_w,zx_tmp_fi3d)
+        ENDIF
+      ENDIF ! iflag_wake.EQ.1
+
+        IF (o_Vprecip%flag(iff)<=lev_files(iff)) THEN
+       CALL histwrite_phy(nid_files(iff),o_Vprecip%name,itau_w,Vprecip)
         ENDIF
 
@@ -708,18 +720,11 @@
        CALL histwrite_phy(nid_files(iff),o_fqd%name,itau_w,fqd)
         ENDIF
-      ENDIF
-
-       IF (o_Vprecip%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_Vprecip%name,itau_w,Vprecip)
-       ENDIF
-
       ENDIF !(iflag_con.EQ.3) 
  
-      ELSE IF (type_ocean=='slab  ') THEN
-
-       IF ( o_slab_bils%flag(iff)<=lev_files(iff))
+      IF (type_ocean=='slab ') THEN
+      IF ( o_slab_bils%flag(iff)<=lev_files(iff)) 
      $     CALL histwrite_phy(
      $     nid_files(iff),o_slab_bils%name,itau_w,slab_wfbils)
-      
+
       ENDIF !type_ocean == force/slab
 
@@ -863,4 +868,9 @@
        IF (o_ovap%flag(iff)<=lev_files(iff)) THEN
       CALL histwrite_phy(nid_files(iff),o_ovap%name,itau_w,qx(:,:,ivap))
+       ENDIF
+
+       IF (o_ovapinit%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),
+     $                   o_ovapinit%name,itau_w,q_seri)
        ENDIF
 
