Index: /LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 4736)
+++ /LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 4737)
@@ -184,8 +184,8 @@
        debut,     lafin,                              &
        rlon,      rlat,      rugoro,   rmu0,          &
-       lwdown_m,  cldt,          &
+       lwdown_m,  cldt,                               &
        rain_f,    snow_f,    bs_f, solsw_m,  solswfdiff_m, sollw_m,       &
        gustiness,                                     &
-       t,         q,        qbs,  u,        v,             &
+       t,         q,        qbs,  u,        v,        &
 !!! nrlmd+jyg le 02/05/2011 et le 20/02/2012
 !!       t_x,       q_x,       t_w,      q_w,           &
@@ -199,34 +199,34 @@
        beta, &
 !>jyg
-       alb_dir_m,    alb_dif_m,  zxsens,   zxevap,  zxsnowerosion,  &
+       alb_dir_m,    alb_dif_m,  zxsens,   zxevap,  zxsnowerosion,      &
        alb3_lic,  runoff,    snowhgt,   qsnow,     to_ice,    sissnow,  &
-       zxtsol,    zxfluxlat, zt2m,     qsat2m, zn2mout, &
-       d_t,       d_q,    d_qbs,    d_u,      d_v, d_t_diss, & 
+       zxtsol,    zxfluxlat, zt2m,     qsat2m, zn2mout,                 &
+       d_t,       d_q,    d_qbs,    d_u,      d_v, d_t_diss,            &
 !!! nrlmd+jyg le 02/05/2011 et le 20/02/2012
-       d_t_w,     d_q_w,                              &
-       d_t_x,     d_q_x,                              & 
+       d_t_w,     d_q_w,                             &
+       d_t_x,     d_q_x,                             & 
 !!       d_wake_dlt,d_wake_dlq,                         &
-       zxsens_x,  zxfluxlat_x,zxsens_w,zxfluxlat_w,   &
+       zxsens_x,  zxfluxlat_x,zxsens_w,zxfluxlat_w,  &
 !!!
 !!! nrlmd le 13/06/2011
-       delta_tsurf,wake_dens,cdragh_x,cdragh_w,       &
-       cdragm_x,cdragm_w,kh,kh_x,kh_w,                &
-!!!
-       zcoefh,    zcoefm,    slab_wfbils,             &
-       qsol,    zq2m,      s_pblh,   s_plcl,        &
+       delta_tsurf,wake_dens,cdragh_x,cdragh_w,      &
+       cdragm_x,cdragm_w,kh,kh_x,kh_w,               &
+!!!
+       zcoefh,    zcoefm,    slab_wfbils,            &
+       qsol,    zq2m,      s_pblh,   s_plcl,         &
 !!!
 !!! jyg le 08/02/2012
-       s_pblh_x, s_plcl_x,   s_pblh_w, s_plcl_w,      &
-!!!
-       s_capCL,   s_oliqCL,  s_cteiCL, s_pblT,        &
-       s_therm,   s_trmb1,   s_trmb2,  s_trmb3,       &
-       zustar,zu10m,  zv10m,    fder_print,    &
-       zxqsurf, delta_qsurf,                       &
-       rh2m,      zxfluxu,  zxfluxv,               &
+       s_pblh_x, s_plcl_x,   s_pblh_w, s_plcl_w,     &
+!!!
+       s_capCL,   s_oliqCL,  s_cteiCL, s_pblT,       &
+       s_therm,   s_trmb1,   s_trmb2,  s_trmb3,      &
+       zustar,zu10m,  zv10m,    fder_print,          &
+       zxqsurf, delta_qsurf,                         &
+       rh2m,      zxfluxu,  zxfluxv,                 &
        z0m, z0h,   agesno,  sollw,    solsw,         &
        d_ts,      evap,    fluxlat,   t2m,           &
-       wfbils,    wfbilo, wfevap, wfrain, wfsnow,   & 
-       flux_t,   flux_u, flux_v,                    &
-       dflux_t,   dflux_q,   zxsnow,                  &
+       wfbils,    wfevap,                            & 
+       flux_t,   flux_u, flux_v,                     &
+       dflux_t,   dflux_q,   zxsnow,                 &
 !jyg<
 !!       zxfluxt,   zxfluxq,   q2m,      flux_q, tke,   &
@@ -235,6 +235,6 @@
 !!! nrlmd+jyg le 02/05/2011 et le 20/02/2012
 !!        tke_x,     tke_w                              &
-       wake_dltke,                                     &
-        treedrg                                   &
+       wake_dltke,                                   &
+        treedrg                                      &
 !FC
 !!!
@@ -503,8 +503,5 @@
     REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: t2m        ! temperature at 2 meter height
     REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfbils     ! heat balance at surface
-    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfbilo     ! water balance at surface weighted by srf
     REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfevap     ! water balance (evap) at surface weighted by srf
-    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfrain     ! water balance (rain) at surface weighted by srf
-    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfsnow     ! water balance (snow) at surface weighted by srf
     REAL, DIMENSION(klon, klev, nbsrf), INTENT(OUT) :: flux_t     ! sensible heat flux (CpT) J/m**2/s (W/m**2)
                                                                   ! positve orientation downwards
@@ -1027,6 +1024,5 @@
  snowerosion(:,:)=0. 
  fluxlat(:,:)=0.
- wfbils(:,:)=0. ; wfbilo(:,:)=0.
- wfevap(:,:)=0. ; wfrain(:,:)=0. ; wfsnow(:,:)=0.
+ wfbils(:,:)=0. ; wfevap(:,:)=0. ;
  flux_t(:,:,:)=0. ; flux_q(:,:,:)=0. ; flux_u(:,:,:)=0. ; flux_v(:,:,:)=0.
  flux_qbs(:,:,:)=0.
@@ -3458,8 +3454,6 @@
           wfbils(i,nsrf) = ( solsw(i,nsrf) + sollw(i,nsrf) &
                + flux_t(i,1,nsrf) + fluxlat(i,nsrf) ) * pctsrf(i,nsrf)
-          wfbilo(i,nsrf) = (evap(i,nsrf)-(rain_f(i)+snow_f(i)))*pctsrf(i,nsrf)
+
           wfevap(i,nsrf) = evap(i,nsrf)*pctsrf(i,nsrf)
-          wfrain(i,nsrf) = rain_f(i)*pctsrf(i,nsrf)
-          wfsnow(i,nsrf) = snow_f(i)*pctsrf(i,nsrf)
 
           zxtsol(i)    = zxtsol(i)    + ts(i,nsrf)      * pctsrf(i,nsrf)
Index: /LMDZ6/trunk/libf/phylmd/phys_local_var_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/phys_local_var_mod.F90	(revision 4736)
+++ /LMDZ6/trunk/libf/phylmd/phys_local_var_mod.F90	(revision 4737)
@@ -313,5 +313,5 @@
 !$OMP THREADPRIVATE(cdragm, cdragh)
       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cldh, cldl, cldm, cldq, cldt, qsat2m
-!$OMP THREADPRIVATE(cldh, cldl, cldm, cldq, cldt, qsat2m )
+!$OMP THREADPRIVATE(cldh, cldl, cldm, cldq, cldt, qsat2m)
 !AS: cldhjn, cldljn, cldmjn,cldtjn pas utilisés en tant que variables, juste noms de diagnostics
       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: JrNt
@@ -406,8 +406,8 @@
       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: proba_notrig, random_notrig
 !$OMP THREADPRIVATE(proba_notrig, random_notrig)
-      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: fsolsw, wfbils, wfbilo
-!$OMP THREADPRIVATE(fsolsw, wfbils, wfbilo)
-      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wfevap, wfrain, wfsnow
-!$OMP THREADPRIVATE(wfevap,wfrain,wfsnow)
+      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: fsolsw, wfbils
+!$OMP THREADPRIVATE(fsolsw, wfbils)
+      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wfevap
+!$OMP THREADPRIVATE(wfevap)
       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: t2m, fluxlat, fsollw,evap_pot
 !$OMP THREADPRIVATE(t2m, fluxlat, fsollw,evap_pot)
@@ -862,6 +862,6 @@
       ALLOCATE(t2m(klon, nbsrf), fluxlat(klon, nbsrf))
       ALLOCATE(fsollw(klon, nbsrf))
-      ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf), wfbilo(klon, nbsrf))
-      ALLOCATE(wfevap(klon, nbsrf), wfrain(klon,nbsrf), wfsnow(klon, nbsrf))
+      ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf))
+      ALLOCATE(wfevap(klon, nbsrf))
       ALLOCATE(evap_pot(klon, nbsrf))
 ! FC 
@@ -871,17 +871,17 @@
       ALLOCATE(pmflxr(klon, klev+1), pmflxs(klon, klev+1))
       ALLOCATE(wdtrainA(klon,klev),wdtrainS(klon,klev),wdtrainM(klon,klev))
-      ALLOCATE(dnwd(klon, klev), upwd(klon, klev) )
+      ALLOCATE(dnwd(klon, klev), upwd(klon, klev))
       ALLOCATE(ep(klon,klev))                          ! epmax_cape
-      ALLOCATE(da(klon,klev), mp(klon,klev) )
-      ALLOCATE(phi(klon,klev,klev) )
-      ALLOCATE(wght_cvfd(klon,klev) )
-      ALLOCATE(phi2(klon,klev,klev) )
+      ALLOCATE(da(klon,klev), mp(klon,klev))
+      ALLOCATE(phi(klon,klev,klev))
+      ALLOCATE(wght_cvfd(klon,klev))
+      ALLOCATE(phi2(klon,klev,klev))
       ALLOCATE(d1a(klon,klev), dam(klon,klev))
-      ALLOCATE(ev(klon,klev) )
-      ALLOCATE(elij(klon,klev,klev) )
-      ALLOCATE(qtaa(klon,klev) )
-      ALLOCATE(clw(klon,klev) )
-      ALLOCATE(epmlmMm(klon,klev,klev), eplaMm(klon,klev) )
-      ALLOCATE(sij(klon,klev,klev) )
+      ALLOCATE(ev(klon,klev))
+      ALLOCATE(elij(klon,klev,klev))
+      ALLOCATE(qtaa(klon,klev))
+      ALLOCATE(clw(klon,klev))
+      ALLOCATE(epmlmMm(klon,klev,klev), eplaMm(klon,klev))
+      ALLOCATE(sij(klon,klev,klev))
 
       ALLOCATE(prfl(klon, klev+1))
@@ -1184,6 +1184,6 @@
       DEALLOCATE(t2m, fluxlat)
       DEALLOCATE(fsollw, evap_pot)
-      DEALLOCATE(fsolsw, wfbils, wfbilo)
-      DEALLOCATE(wfevap,wfrain,wfsnow)
+      DEALLOCATE(fsolsw, wfbils)
+      DEALLOCATE(wfevap)
 
       DEALLOCATE(pmflxr, pmflxs)
@@ -1191,15 +1191,15 @@
       DEALLOCATE(upwd, dnwd)
       DEALLOCATE(ep)
-      DEALLOCATE(da, mp )
-      DEALLOCATE(phi )
-      DEALLOCATE(wght_cvfd )
-      DEALLOCATE(phi2 )
+      DEALLOCATE(da, mp)
+      DEALLOCATE(phi)
+      DEALLOCATE(wght_cvfd)
+      DEALLOCATE(phi2)
       DEALLOCATE(d1a, dam)
-      DEALLOCATE(ev )
-      DEALLOCATE(elij )
-      DEALLOCATE(qtaa )
-      DEALLOCATE(clw )
-      DEALLOCATE(epmlmMm, eplaMm )
-      DEALLOCATE(sij )
+      DEALLOCATE(ev)
+      DEALLOCATE(elij)
+      DEALLOCATE(qtaa)
+      DEALLOCATE(clw)
+      DEALLOCATE(epmlmMm, eplaMm)
+      DEALLOCATE(sij)
 
 
Index: /LMDZ6/trunk/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 4736)
+++ /LMDZ6/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 4737)
@@ -282,5 +282,5 @@
          wTSTD, u2STD, v2STD, T2STD, missing_val_nf90, delta_sal, ds_ns, &
 #ifdef ISO
-        xtrain_con, xtsnow_con, xtrain_fall, xtsnow_fall, fxtevap, &
+         xtrain_con, xtsnow_con, xtrain_fall, xtsnow_fall, fxtevap, &
 #endif
          dt_ns, delta_sst, dter, dser
@@ -292,5 +292,4 @@
         toplw0_s2,toplw_s2,topsw0_s2,topsw_s2
 #endif
-
 
     USE phys_local_var_mod, ONLY: zxfluxlat, slp, ptstar, pt0, zxtsol, zt2m, &
@@ -304,5 +303,5 @@
          sissnow, runoff, albsol3_lic, evap_pot, &
          t2m, fluxt, fluxlat, fsollw, fsolsw, &
-         wfbils, wfbilo, wfevap, wfrain, wfsnow, &
+         wfbils, wfevap, &
          cdragm, cdragh, cldl, cldm, &
          cldh, cldt, JrNt,   & ! only output names: cldljn,cldmjn,cldhjn,cldtjn
@@ -380,5 +379,4 @@
          reffclwc, cldnvi, lcc3d, lcc3dcon, lcc3dstra, icc3dcon, icc3dstra
     
-
 #ifdef CPP_StratAer 
     USE phys_local_var_mod, ONLY:  &
@@ -444,5 +442,5 @@
 #endif
     USE tracinca_mod, ONLY: config_inca
-    use config_ocean_skin_m, only: activate_ocean_skin
+    USE config_ocean_skin_m, ONLY: activate_ocean_skin
 
     USE vertical_layers_mod, ONLY: presnivs
@@ -503,5 +501,4 @@
     REAL, DIMENSION(klon,klev) :: coefh_stok 
     
-    
 #ifdef CPP_StratAer 
     LOGICAL, PARAMETER :: debug_strataer=.FALSE.
@@ -541,4 +538,5 @@
     Bhyb_bounds(1,1) = 1.
     Bhyb_bounds(1,2) = bps(1)    
+
     DO ilev=2,klev
       Ahyb_bounds(ilev,1) = aps(ilev-1)
@@ -547,8 +545,9 @@
       Bhyb_bounds(ilev,2) = bps(ilev)
     ENDDO
-     Ahyb_bounds(klev+1,1) = aps(klev)
-     Ahyb_bounds(klev+1,2) = 0.
-     Bhyb_bounds(klev+1,1) = bps(klev)
-     Bhyb_bounds(klev+1,2) = 0.
+
+    Ahyb_bounds(klev+1,1) = aps(klev)
+    Ahyb_bounds(klev+1,2) = 0.
+    Bhyb_bounds(klev+1,1) = bps(klev)
+    Bhyb_bounds(klev+1,2) = 0.
 
     DO ilev=1, klev
@@ -557,5 +556,5 @@
       Bhyb_mid_bounds(ilev,1) = bp(ilev)
       Bhyb_mid_bounds(ilev,2) = bp(ilev+1)
-    END DO
+    ENDDO
 
 
@@ -616,60 +615,60 @@
 !
 #ifdef CPP_RRTM
-        IF (iflag_rrtm.EQ.1) THEN
-          DO ISW=1, NSW
-            WRITE(ch1,'(i1)') ISW
-  !         zx_tmp_0d=RSUN(ISW)
-  !         CALL histwrite_phy("rsun"//ch1,zx_tmp_0d)
-            CALL histwrite_phy("rsun"//ch1,RSUN(ISW))
-          ENDDO
-        ENDIF
+         IF (iflag_rrtm.EQ.1) THEN
+           DO ISW=1, NSW
+             WRITE(ch1,'(i1)') ISW
+  !          zx_tmp_0d=RSUN(ISW)
+  !          CALL histwrite_phy("rsun"//ch1,zx_tmp_0d)
+             CALL histwrite_phy("rsun"//ch1,RSUN(ISW))
+           ENDDO
+         ENDIF
 #endif
 !
-        CALL histwrite_phy("co2_ppm",co2_ppm)
-        CALL histwrite_phy("CH4_ppb",CH4_ppb)
-        CALL histwrite_phy("N2O_ppb",N2O_ppb)
-        CALL histwrite_phy("CFC11_ppt",CFC11_ppt)
-        CALL histwrite_phy("CFC12_ppt",CFC12_ppt)
+         CALL histwrite_phy("co2_ppm",co2_ppm)
+         CALL histwrite_phy("CH4_ppb",CH4_ppb)
+         CALL histwrite_phy("N2O_ppb",N2O_ppb)
+         CALL histwrite_phy("CFC11_ppt",CFC11_ppt)
+         CALL histwrite_phy("CFC12_ppt",CFC12_ppt)
 !
-      ENDIF !using_xios
+       ENDIF !using_xios
 
 !!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! Simulateur AIRS
-     IF (ok_airs) then
-      CALL histwrite_phy(o_alt_tropo,alt_tropo)
+       IF (ok_airs) then
+         CALL histwrite_phy(o_alt_tropo,alt_tropo)
  
-      CALL histwrite_phy(o_map_prop_hc,map_prop_hc)
-      CALL histwrite_phy(o_map_prop_hist,map_prop_hist)
-
-      CALL histwrite_phy(o_map_emis_hc,map_emis_hc)
-      CALL histwrite_phy(o_map_iwp_hc,map_iwp_hc)
-      CALL histwrite_phy(o_map_deltaz_hc,map_deltaz_hc)
-      CALL histwrite_phy(o_map_pcld_hc,map_pcld_hc)
-      CALL histwrite_phy(o_map_tcld_hc,map_tcld_hc)
-
-      CALL histwrite_phy(o_map_emis_hist,map_emis_hist)
-      CALL histwrite_phy(o_map_iwp_hist,map_iwp_hist)
-      CALL histwrite_phy(o_map_deltaz_hist,map_deltaz_hist)
-
-      CALL histwrite_phy(o_map_ntot,map_ntot)
-      CALL histwrite_phy(o_map_hc,map_hc)
-      CALL histwrite_phy(o_map_hist,map_hist)
-
-      CALL histwrite_phy(o_map_Cb,map_Cb)
-      CALL histwrite_phy(o_map_ThCi,map_ThCi)
-      CALL histwrite_phy(o_map_Anv,map_Anv)
-
-      CALL histwrite_phy(o_map_emis_Cb,map_emis_Cb)
-      CALL histwrite_phy(o_map_pcld_Cb,map_pcld_Cb)
-      CALL histwrite_phy(o_map_tcld_Cb,map_tcld_Cb)
-
-      CALL histwrite_phy(o_map_emis_ThCi,map_emis_ThCi)
-      CALL histwrite_phy(o_map_pcld_ThCi,map_pcld_ThCi)
-      CALL histwrite_phy(o_map_tcld_ThCi,map_tcld_ThCi)
-
-      CALL histwrite_phy(o_map_emis_Anv,map_emis_Anv)
-      CALL histwrite_phy(o_map_pcld_Anv,map_pcld_Anv)
-      CALL histwrite_phy(o_map_tcld_Anv,map_tcld_Anv)
-     ENDIF
+         CALL histwrite_phy(o_map_prop_hc,map_prop_hc)
+         CALL histwrite_phy(o_map_prop_hist,map_prop_hist)
+
+         CALL histwrite_phy(o_map_emis_hc,map_emis_hc)
+         CALL histwrite_phy(o_map_iwp_hc,map_iwp_hc)
+         CALL histwrite_phy(o_map_deltaz_hc,map_deltaz_hc)
+         CALL histwrite_phy(o_map_pcld_hc,map_pcld_hc)
+         CALL histwrite_phy(o_map_tcld_hc,map_tcld_hc)
+
+         CALL histwrite_phy(o_map_emis_hist,map_emis_hist)
+         CALL histwrite_phy(o_map_iwp_hist,map_iwp_hist)
+         CALL histwrite_phy(o_map_deltaz_hist,map_deltaz_hist)
+
+         CALL histwrite_phy(o_map_ntot,map_ntot)
+         CALL histwrite_phy(o_map_hc,map_hc)
+         CALL histwrite_phy(o_map_hist,map_hist)
+
+         CALL histwrite_phy(o_map_Cb,map_Cb)
+         CALL histwrite_phy(o_map_ThCi,map_ThCi)
+         CALL histwrite_phy(o_map_Anv,map_Anv)
+
+         CALL histwrite_phy(o_map_emis_Cb,map_emis_Cb)
+         CALL histwrite_phy(o_map_pcld_Cb,map_pcld_Cb)
+         CALL histwrite_phy(o_map_tcld_Cb,map_tcld_Cb)
+
+         CALL histwrite_phy(o_map_emis_ThCi,map_emis_ThCi)
+         CALL histwrite_phy(o_map_pcld_ThCi,map_pcld_ThCi)
+         CALL histwrite_phy(o_map_tcld_ThCi,map_tcld_ThCi)
+
+         CALL histwrite_phy(o_map_emis_Anv,map_emis_Anv)
+         CALL histwrite_phy(o_map_pcld_Anv,map_pcld_Anv)
+         CALL histwrite_phy(o_map_tcld_Anv,map_tcld_Anv)
+       ENDIF
 
        CALL histwrite_phy(o_sza, sza_o)
@@ -687,5 +686,5 @@
        IF (vars_defined) THEN
           DO i=1, klon
-             zx_tmp_fi2d(i)=real(zn2mout(i,1))
+             zx_tmp_fi2d(i)=REAL(zn2mout(i,1))
           ENDDO
        ENDIF
@@ -694,5 +693,5 @@
        IF (vars_defined) THEN
           DO i=1, klon
-             zx_tmp_fi2d(i)=real(zn2mout(i,2))
+             zx_tmp_fi2d(i)=REAL(zn2mout(i,2))
           ENDDO
        ENDIF
@@ -701,5 +700,5 @@
        IF (vars_defined) THEN
           DO i=1, klon
-             zx_tmp_fi2d(i)=real(zn2mout(i,3))
+             zx_tmp_fi2d(i)=REAL(zn2mout(i,3))
           ENDDO
        ENDIF
@@ -708,5 +707,5 @@
        IF (vars_defined) THEN
           DO i=1, klon
-             zx_tmp_fi2d(i)=real(zn2mout(i,4))
+             zx_tmp_fi2d(i)=REAL(zn2mout(i,4))
           ENDDO
        ENDIF
@@ -715,5 +714,5 @@
        IF (vars_defined) THEN
           DO i=1, klon
-             zx_tmp_fi2d(i)=real(zn2mout(i,5))
+             zx_tmp_fi2d(i)=REAL(zn2mout(i,5))
           ENDDO
        ENDIF
@@ -722,5 +721,5 @@
        IF (vars_defined) THEN
           DO i=1, klon
-             zx_tmp_fi2d(i)=real(zn2mout(i,6))
+             zx_tmp_fi2d(i)=REAL(zn2mout(i,6))
           ENDDO
        ENDIF
@@ -920,14 +919,11 @@
                ELSE
                   WRITE(nvar,'(i3)') k
-               END IF
+               ENDIF
                nvar='phi_lev'//trim(nvar)
                CALL histwrite_phy(nvar,phi(:,:,k))
-            END DO
+            ENDDO
           
          ENDIF
        ENDIF
-
-
-
        
        IF (vars_defined) THEN
@@ -994,5 +990,4 @@
        CALL histwrite_phy(o_sols, zx_tmp_fi2d)
        
-       
        IF (vars_defined) THEN
           zx_tmp_fi2d = solsw0*swradcorr
@@ -1068,5 +1063,5 @@
 !AI 08 2023 Ecrad 3Deffect
 #ifdef CPP_ECRAD
-     if (ok_3Deffect) then
+     IF (ok_3Deffect) THEN
         IF (vars_defined) THEN
           zx_tmp_fi2d = solsw_s2*swradcorr
@@ -1091,5 +1086,5 @@
        CALL histwrite_phy(o_topl_s2, toplw_s2)
        CALL histwrite_phy(o_topl0_s2, toplw0_s2)
-     endif
+     ENDIF
 #endif       
 
@@ -1134,15 +1129,15 @@
        DO nsrf = 1, nbsrf
 
-          IF (vars_defined)             zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)*100.
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)*100.
           CALL histwrite_phy(o_pourc_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)           zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
           CALL histwrite_phy(o_fract_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
           CALL histwrite_phy(o_taux_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
           CALL histwrite_phy(o_tauy_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
           CALL histwrite_phy(o_tsol_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = evap_pot( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = evap_pot( 1 : klon, nsrf)
           CALL histwrite_phy(o_evappot_srf(nsrf), zx_tmp_fi2d)
           IF (vars_defined)       zx_tmp_fi2d(1 : klon) = ustar(1 : klon, nsrf)
@@ -1156,21 +1151,21 @@
           IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fevap(1 : klon, nsrf)
           CALL histwrite_phy(o_evap_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)        zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
           CALL histwrite_phy(o_sens_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
           CALL histwrite_phy(o_lat_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
           CALL histwrite_phy(o_flw_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
           CALL histwrite_phy(o_fsw_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
           CALL histwrite_phy(o_wbils_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = wfbilo( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = (fevap(1:klon,nsrf)-(rain_fall(1:klon)+snow_fall(1:klon)))*pctsrf(1:klon,nsrf)
           CALL histwrite_phy(o_wbilo_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = wfevap( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = wfevap( 1 : klon, nsrf)
           CALL histwrite_phy(o_wevap_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = wfrain( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = rain_fall(1:klon)*pctsrf(1:klon,nsrf)
           CALL histwrite_phy(o_wrain_srf(nsrf), zx_tmp_fi2d)
-          IF (vars_defined)         zx_tmp_fi2d(1 : klon) = wfsnow( 1 : klon, nsrf)
+          IF (vars_defined)       zx_tmp_fi2d(1 : klon) = snow_fall(1:klon)*pctsrf(1:klon,nsrf)
           CALL histwrite_phy(o_wsnow_srf(nsrf), zx_tmp_fi2d)
 
@@ -1180,6 +1175,4 @@
              CALL histwrite_phy(o_l_mixmin(nsrf),  l_mixmin(:,1:klev,nsrf))
              CALL histwrite_phy(o_tke_max_srf(nsrf),  pbl_tke(:,1:klev,nsrf))
-
-                         
           ENDIF
 !jyg<
@@ -1624,5 +1617,5 @@
              DO naero = 1, naero_tot-1
                 CALL histwrite_phy(o_drytausumaero(naero),drytausum_aero(:,naero))
-             END DO
+             ENDDO
           ENDIF
        ENDIF
@@ -1631,5 +1624,5 @@
           DO naero = 1, naero_tot
              CALL histwrite_phy(o_tausumaero(naero),tausum_aero(:,2,naero))
-          END DO
+          ENDDO
        ENDIF
        IF (flag_aerosol_strat.GT.0) THEN
@@ -1646,5 +1639,5 @@
          DO k=1, klev
             zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + wo(:,k,1) * stratomask(:,k) * 1.e3
-         END DO
+         ENDDO
        ENDIF
        CALL histwrite_phy(o_col_O3_strato, zx_tmp_fi2d) ! Added ThL
@@ -1654,5 +1647,5 @@
          DO k=1, klev
             zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + wo(:,k,1) * (1.0-stratomask(:,k)) * 1.e3
-         END DO
+         ENDDO
        ENDIF
        CALL histwrite_phy(o_col_O3_tropo, zx_tmp_fi2d)   ! Added ThL
@@ -1987,5 +1980,4 @@
           CALL histwrite_phy(o_tke, zx_tmp_fi3d)
           CALL histwrite_phy(o_tke_max, zx_tmp_fi3d)  
-
        ENDIF
 
@@ -1995,4 +1987,5 @@
 
        CALL histwrite_phy(o_clwcon, clwcon0)
+
        CALL histwrite_phy(o_dtdyn, d_t_dyn)
 
@@ -2010,6 +2003,6 @@
 
        IF (ok_bs) THEN
-       CALL histwrite_phy(o_dqbsdyn, d_qbs_dyn)
-       CALL histwrite_phy(o_dqbsdyn2d, d_qbs_dyn2d)
+         CALL histwrite_phy(o_dqbsdyn, d_qbs_dyn)
+         CALL histwrite_phy(o_dqbsdyn2d, d_qbs_dyn2d)
        ENDIF
 
@@ -2058,6 +2051,5 @@
        IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_lsc(1:klon,1:klev)/pdtphys
        CALL histwrite_phy(o_dtlsc, zx_tmp_fi3d)
-       IF (vars_defined) zx_tmp_fi3d(1:klon, 1:klev)=(d_t_lsc(1:klon,1:klev)+ &
-            d_t_eva(1:klon,1:klev))/pdtphys
+       IF (vars_defined) zx_tmp_fi3d(1:klon, 1:klev)=(d_t_lsc(1:klon,1:klev)+d_t_eva(1:klon,1:klev))/pdtphys
        CALL histwrite_phy(o_dtlschr, zx_tmp_fi3d)
        IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys
@@ -2186,6 +2178,5 @@
           CALL histwrite_phy(o_zmax_th, zmax_th)
           IF (vars_defined) THEN
-             zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys - &
-                  d_q_ajsb(1:klon,1:klev)/pdtphys
+             zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys-d_q_ajsb(1:klon,1:klev)/pdtphys
           ENDIF
           CALL histwrite_phy(o_dqthe, zx_tmp_fi3d)
@@ -2280,5 +2271,4 @@
        
        CALL histwrite_phy(o_rsu, zx_tmp_fi3d1)
-
 
        IF (vars_defined) THEN
@@ -2712,5 +2702,5 @@
           IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_ch4(ixt,:,:)/pdtphys
           CALL histwrite_phy(o_dxtch4(ixt), zx_tmp_fi3d)
-        END IF
+        ENDIF
 
         IF (ixt == iso_HTO) THEN
@@ -2723,8 +2713,8 @@
           IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_decroiss(ixt,:,:)/pdtphys
           CALL histwrite_phy(o_dxtdecroiss(ixt), zx_tmp_fi3d)
-        END IF
+        ENDIF
 
     !write(*,*) 'phys_output_write_mod 2531'
-    enddo
+    ENDDO
 #endif
 
@@ -2759,5 +2749,5 @@
              CALL histsync(nid_files(iff))
           ENDIF
-       END DO
+       ENDDO
        !$OMP END MASTER
 #endif
Index: /LMDZ6/trunk/libf/phylmd/physiq_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/physiq_mod.F90	(revision 4736)
+++ /LMDZ6/trunk/libf/phylmd/physiq_mod.F90	(revision 4737)
@@ -341,6 +341,5 @@
        t2m, fluxlat,  &
        fsollw, evap_pot,  &
-       fsolsw, wfbils, wfbilo,  &
-       wfevap, wfrain, wfsnow,  &  
+       fsolsw, wfbils, wfevap, &  
        prfl, psfl,bsfl, fraca, Vprecip,  &
        zw2,  &
@@ -2758,5 +2757,5 @@
     !   frugs,     agesno,    fsollw,  fsolsw,
     !   d_ts,      fevap,     fluxlat, t2m,
-    !   wfbils,    wfbilo,    fluxt,   fluxu, fluxv,
+    !   wfbils,    fluxt,   fluxu, fluxv,
     !
     ! Certains ne sont pas utiliser du tout : 
@@ -2875,5 +2874,5 @@
             z0m, z0h,     agesno,    fsollw,  fsolsw, &
             d_ts,      fevap,     fluxlat, t2m, &
-            wfbils, wfbilo, wfevap, wfrain, wfsnow, & 
+            wfbils, wfevap, & 
             fluxt,   fluxu,  fluxv, &
             dsens,     devap,     zxsnow, &
Index: /LMDZ6/trunk/libf/phylmdiso/pbl_surface_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmdiso/pbl_surface_mod.F90	(revision 4736)
+++ /LMDZ6/trunk/libf/phylmdiso/pbl_surface_mod.F90	(revision 4737)
@@ -303,5 +303,5 @@
        z0m, z0h,   agesno,  sollw,    solsw,         &
        d_ts,      evap,    fluxlat,   t2m,           &
-       wfbils,    wfbilo, wfevap, wfrain, wfsnow,   & 
+       wfbils,    wfevap,                           & 
        flux_t,   flux_u, flux_v,                    &
        dflux_t,   dflux_q,   zxsnow,                  &
@@ -609,8 +609,5 @@
     REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: t2m        ! temperature at 2 meter height
     REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfbils     ! heat balance at surface
-    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfbilo     ! water balance at surface weighted by srf
     REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfevap     ! water balance (evap) at surface weighted by srf
-    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfrain     ! water balance (rain) at surface weighted by srf
-    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: wfsnow     ! water balance (snow) at surface weighted by srf
     REAL, DIMENSION(klon, klev, nbsrf), INTENT(OUT) :: flux_t     ! sensible heat flux (CpT) J/m**2/s (W/m**2)
                                                                   ! positve orientation downwards
@@ -1233,6 +1230,5 @@
  snowerosion(:,:)=0. 
  fluxlat(:,:)=0.
- wfbils(:,:)=0. ; wfbilo(:,:)=0.
- wfevap(:,:)=0. ; wfrain(:,:)=0. ; wfsnow(:,:)=0.
+ wfbils(:,:)=0. ; wfevap(:,:)=0.
  flux_t(:,:,:)=0. ; flux_q(:,:,:)=0. ; flux_u(:,:,:)=0. ; flux_v(:,:,:)=0.
  flux_qbs(:,:,:)=0.
@@ -4031,8 +4027,5 @@
           wfbils(i,nsrf) = ( solsw(i,nsrf) + sollw(i,nsrf) &
                + flux_t(i,1,nsrf) + fluxlat(i,nsrf) ) * pctsrf(i,nsrf)
-          wfbilo(i,nsrf) = (evap(i,nsrf)-(rain_f(i)+snow_f(i)))*pctsrf(i,nsrf)
           wfevap(i,nsrf) = evap(i,nsrf)*pctsrf(i,nsrf)
-          wfrain(i,nsrf) = rain_f(i)*pctsrf(i,nsrf)
-          wfsnow(i,nsrf) = snow_f(i)*pctsrf(i,nsrf)
 
           zxtsol(i)    = zxtsol(i)    + ts(i,nsrf)      * pctsrf(i,nsrf)
Index: /LMDZ6/trunk/libf/phylmdiso/phys_local_var_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmdiso/phys_local_var_mod.F90	(revision 4736)
+++ /LMDZ6/trunk/libf/phylmdiso/phys_local_var_mod.F90	(revision 4737)
@@ -455,8 +455,8 @@
       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: proba_notrig, random_notrig
 !$OMP THREADPRIVATE(proba_notrig, random_notrig)
-      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: fsolsw, wfbils, wfbilo
-!$OMP THREADPRIVATE(fsolsw, wfbils, wfbilo)
-      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wfevap, wfrain, wfsnow
-!$OMP THREADPRIVATE(wfevap,wfrain,wfsnow)
+      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: fsolsw, wfbils
+!$OMP THREADPRIVATE(fsolsw, wfbils)
+      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wfevap
+!$OMP THREADPRIVATE(wfevap)
       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: t2m, fluxlat, fsollw,evap_pot
 !$OMP THREADPRIVATE(t2m, fluxlat, fsollw,evap_pot)
@@ -990,6 +990,6 @@
       ALLOCATE(t2m(klon, nbsrf), fluxlat(klon, nbsrf))
       ALLOCATE(fsollw(klon, nbsrf))
-      ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf), wfbilo(klon, nbsrf))
-      ALLOCATE(wfevap(klon, nbsrf), wfrain(klon,nbsrf), wfsnow(klon, nbsrf))
+      ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf))
+      ALLOCATE(wfevap(klon, nbsrf))
       ALLOCATE(evap_pot(klon, nbsrf))
 ! FC
@@ -1361,6 +1361,6 @@
       DEALLOCATE(t2m, fluxlat)
       DEALLOCATE(fsollw, evap_pot)
-      DEALLOCATE(fsolsw, wfbils, wfbilo)
-      DEALLOCATE(wfevap,wfrain,wfsnow)
+      DEALLOCATE(fsolsw, wfbils)
+      DEALLOCATE(wfevap)
 
       DEALLOCATE(pmflxr, pmflxs)
Index: /LMDZ6/trunk/libf/phylmdiso/physiq_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmdiso/physiq_mod.F90	(revision 4736)
+++ /LMDZ6/trunk/libf/phylmdiso/physiq_mod.F90	(revision 4737)
@@ -354,6 +354,5 @@
        t2m, fluxlat,  &
        fsollw, evap_pot,  &
-       fsolsw, wfbils, wfbilo,  &
-       wfevap, wfrain, wfsnow,  &  
+       fsolsw, wfbils, wfevap,  &
        prfl, psfl,bsfl, fraca, Vprecip,  &
        zw2,  &
@@ -3076,5 +3075,5 @@
     !   frugs,     agesno,    fsollw,  fsolsw,
     !   d_ts,      fevap,     fluxlat, t2m,
-    !   wfbils,    wfbilo,    fluxt,   fluxu, fluxv,
+    !   wfbils,    fluxt,   fluxu, fluxv,
     !
     ! Certains ne sont pas utiliser du tout : 
@@ -3175,5 +3174,5 @@
             z0m, z0h,     agesno,    fsollw,  fsolsw, &
             d_ts,      fevap,     fluxlat, t2m, &
-            wfbils, wfbilo, wfevap, wfrain, wfsnow, & 
+            wfbils, wfevap, & 
             fluxt,   fluxu,  fluxv, &
             dsens,     devap,     zxsnow, &
