Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/clmain.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/clmain.F	(revision 170)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/clmain.F	(revision 171)
@@ -5,9 +5,9 @@
      .                  paprs,pplay,radsol,snow,qsol,evap,albe,
      .                  rain_f, snow_f, solsw, sollw, fder,
-     .                  rlon, rlat, rugos,
-     .                  debut, lafin, agesno,
+     .                  rlon, rlat, cufi, cvfi, rugos,
+     .                  debut, lafin, agesno,rugoro,
      .                  d_t,d_q,d_u,d_v,d_ts,
      .                  flux_t,flux_q,flux_u,flux_v,cdragh,cdragm,
-     .                  rugmer, dflux_t,dflux_q,
+     .                  dflux_t,dflux_q,
      .                  zcoefh,zu1,zv1)
 cAA .                  itr, tr, flux_surf, d_tr)
@@ -77,5 +77,5 @@
       REAL u(klon,klev), v(klon,klev)
       REAL paprs(klon,klev+1), pplay(klon,klev), radsol(klon)
-      REAL rlon(klon), rlat(klon)
+      REAL rlon(klon), rlat(klon), cufi(klon), cvfi(klon)
       REAL d_t(klon, klev), d_q(klon, klev)
       REAL d_u(klon, klev), d_v(klon, klev)
@@ -83,5 +83,5 @@
       REAL dflux_t(klon), dflux_q(klon)
       REAL flux_u(klon,klev, nbsrf), flux_v(klon,klev, nbsrf)
-      REAL rugmer(klon), agesno(klon)
+      REAL rugmer(klon), agesno(klon),rugoro(klon)
       REAL cdragh(klon), cdragm(klon)
       integer jour            ! jour de l'annee en cours
@@ -123,5 +123,5 @@
       real ysollw(klon), ysolsw(klon)
       real yfder(klon), ytaux(klon), ytauy(klon)
-      REAL yrugm(klon), yrads(klon)
+      REAL yrugm(klon), yrads(klon),yrugoro(klon)
       REAL y_d_ts(klon)
       REAL y_d_t(klon, klev), y_d_q(klon, klev)
@@ -291,4 +291,5 @@
         ysollw(j) = sollw(i)
         yrugos(j) = rugos(i,nsrf)
+        yrugoro(j) = rugoro(i)
         yu1(j) = u1lay(i)
         yv1(j) = v1lay(i)
@@ -336,8 +337,8 @@
 c calculer la diffusion de "q" et de "h"
       CALL clqh(dtime, itap, jour, debut,lafin,
-     e          rlon, rlat,
+     e          rlon, rlat, cufi, cvfi,
      e          knon, nsrf, ni, pctsrf,
      e          ok_veget, ocean, npas, nexca,
-     e          rmu0, yrugos,
+     e          rmu0, yrugos, yrugoro,
      e          yu1, yv1, ycoefh,
      e          yt,yq,yts,ypaprs,ypplay,
@@ -429,4 +430,5 @@
 C A rajouter: conservation de l'albedo
 C
+      rugos(:,is_oce) = rugmer
       pctsrf = pctsrf_new
 
@@ -434,8 +436,8 @@
       END
       SUBROUTINE clqh(dtime,itime, jour,debut,lafin,
-     e                rlon, rlat,
+     e                rlon, rlat, cufi, cvfi, 
      e                knon, nisurf, knindex, pctsrf,
      e                ok_veget, ocean, npas, nexca,
-     e                rmu0, rugos,
+     e                rmu0, rugos, rugoro,
      e                u1lay,v1lay,coef,
      e                t,q,ts,paprs,pplay,
@@ -482,4 +484,5 @@
       real precip_rain(klon), precip_snow(klon)
       REAL agesno(klon)
+      REAL rugoro(klon)
       integer jour            ! jour de l'annee en cours
       real rmu0(klon)         ! cosinus de l'angle solaire zenithal
@@ -487,5 +490,5 @@
       integer knindex(klon)
       real pctsrf(klon,nbsrf)
-      real rlon(klon), rlat(klon)
+      real rlon(klon), rlat(klon), cufi(klon), cvfi(klon)
       logical ok_veget 
       character*6 ocean
@@ -659,16 +662,16 @@
 C Appel a interfsurf (appel generique) routine d'interface avec la surface
 
-      do i = 1, knon
-        petAcoef=zx_ch(i,1)
-        peqAcoef=zx_cq(i,1)
-        petBcoef=zx_dh(i,1)
-        peqBcoef=zx_dq(i,1)
-        tq_cdrag=coef(i,1)
-        temp_air=t(i,1)
-        spechum=q(i,1)
-        p1lay = pplay(i,1)
-        zlev1 = delp(i,1)
-        swnet(i) = swdown(i) * (1. - albedo(i))
-      enddo
+c      do i = 1, knon
+        petAcoef=zx_ch(:,1)
+        peqAcoef=zx_cq(:,1)
+        petBcoef=zx_dh(:,1)
+        peqBcoef=zx_dq(:,1)
+        tq_cdrag=coef(:,1)
+        temp_air=t(:,1)
+        spechum=q(:,1)
+        p1lay = pplay(:,1)
+        zlev1 = delp(:,1)
+        swnet = swdown * (1. - albedo)
+c      enddo
 c En attendant mieux
       hum_air = 0.
@@ -681,5 +684,5 @@
      e tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef,
      e precip_rain, precip_snow, lwdown, swnet, swdown,
-     e fder, taux, tauy, rugos,
+     e fder, taux, tauy, rugos, rugoro,
      e albedo, snow, qsol,
      e ts, p1lay, psref, radsol,
@@ -690,8 +693,8 @@
 
       do i = 1, knon
-      flux_t(i,1) = fluxsens(i)
-      flux_q(i,1) = - evap(i)
-      d_ts(i) = tsurf_new(i) - ts(i)
-      albedo(i) = alb_new(i)
+        flux_t(i,1) = fluxsens(i)
+        flux_q(i,1) = - evap(i)
+        d_ts(i) = tsurf_new(i) - ts(i)
+        albedo(i) = alb_new(i)
       enddo
 
Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 170)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 171)
@@ -54,5 +54,5 @@
       & tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, &
       & precip_rain, precip_snow, lwdown, swnet, swdown, &
-      & fder, taux, tauy, rugos, &
+      & fder, taux, tauy, rugos, rugoro, &
       & albedo, snow, qsol, &
       & tsurf, p1lay, ps, radsol, &
@@ -115,4 +115,5 @@
 !   rugos        rugosite
 !   zmasq        masque terre/ocean
+!   rugoro       rugosite orographique
 !
 ! output:
@@ -152,5 +153,5 @@
   real, dimension(klon), intent(IN) :: radsol
   real, dimension(klon), intent(IN) :: zmasq
-  real, dimension(klon), intent(IN) :: fder, taux, tauy, rugos
+  real, dimension(klon), intent(IN) :: fder, taux, tauy, rugos, rugoro
   character (len = 6)  :: ocean
   integer              :: npas, nexca ! nombre et pas de temps couplage
@@ -281,4 +282,5 @@
        zfra = MAX(0.0,MIN(1.0,snow/(snow+10.0)))
        alb_new = alb_neig*zfra + alb_new*(1.0-zfra)
+       z0_new = SQRT(z0_new**2+rugoro**2)
     else
 !
@@ -445,5 +447,5 @@
 ! Rugosite
 !
-    z0_new = rugos
+    z0_new = rugoro
 !
 ! Remplissage des pourcentages de surface
@@ -943,5 +945,5 @@
         pctsrf_sav(:,is_oce) = pctsrf(:,is_oce) + pctsrf(:,is_sic)
       endwhere
-      where (abs(pctsrf_sav(:,is_oce)) .le. epsilon(pctsrf_sav(1,is_sic)))
+      where (abs(pctsrf_sav(:,is_oce)) .le. epsilon(pctsrf_sav(1,is_oce)))
         pctsrf_sav(:,is_sic) = pctsrf(:,is_oce) + pctsrf(:,is_sic)
         pctsrf_sav(:,is_oce) = 0.
@@ -1182,5 +1184,5 @@
   if ((jour - jour_lu) /= 0) deja_lu = .false.
   
-  if (check) write(*,*)modname,' :: jour_lu, deja_lu', jour_lu, deja_lu 
+  if (check) write(*,*)modname,' :: jour, jour_lu, deja_lu', jour, jour_lu, deja_lu 
   if (check) write(*,*)modname,' :: itime, lmt_pas ', itime, lmt_pas,dtime
 
@@ -1338,7 +1340,7 @@
     lmt_sst(ii) = sst_lu(knindex(ii))
   enddo
-! je peux pas utiliser la ligne suivante a cause du compilo Sun
-!  lmt_sst = sst_lu(knindex)
-  pctsrf_new = pct_tmp
+
+  pctsrf_new(:,is_oce) = pct_tmp(:,is_oce)
+  pctsrf_new(:,is_sic) = pct_tmp(:,is_sic)
 
   END SUBROUTINE interfoce_lim
@@ -1592,5 +1594,7 @@
       qsol = max_eau_sol
     else
-      snow = max(0.0, snow + (precip_snow - evap) * dtime)
+      snow = snow + (precip_snow * dtime)
+      where (snow > epsilon(snow)) snow = max(0.0, snow - (evap * dtime))
+!      snow = max(0.0, snow + (precip_snow - evap) * dtime)
       qsol = qsol + (precip_rain - evap) * dtime
     endif 
Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F	(revision 170)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F	(revision 171)
@@ -42,4 +42,6 @@
 c d_q_dyn-input-R-tendance dynamique pour "q" (kg/kg/s)
 c omega---input-R-vitesse verticale en Pa/s
+c cufi----input-R-resolution des mailles en x (m)
+c cvfi----input-R-resolution des mailles en y (m)
 c
 c d_u-----output-R-tendance physique de "u" (m/s/s)
@@ -75,6 +77,6 @@
 c      ocean = type de modele ocean a utiliser: force, slab, couple
       character *6 ocean
-      parameter (ocean = 'force ')
-c     parameter (ocean = 'couple')
+c     parameter (ocean = 'force ')
+      parameter (ocean = 'couple')
       logical ok_ocean
 c======================================================================
@@ -144,4 +146,6 @@
       REAL presnivs(klev)
       REAL znivsig(klev)
+      REAL zsurf(nbsrf)
+      real cufi(klon), cvfi(klon)
 
       REAL u(klon,klev)
@@ -226,6 +230,4 @@
       SAVE falbe                  ! albedo par type de surface
 c
-      REAL rugmer(klon)
-      SAVE rugmer                 ! longeur de rugosite sur mer (m)
 c
 c  Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
@@ -692,4 +694,8 @@
      .                "ave(X)", zsto,zout)
 c
+         CALL histdef(nid_day, "snow_cov", "Snow cover", "mm",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
          CALL histdef(nid_day, "evap", "Evaporation", "mm/day",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
@@ -887,4 +893,8 @@
      .                "ave(X)", zsto,zout)
 c
+         CALL histdef(nid_mth, "snow_cov", "Snow cover", "mm",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
          CALL histdef(nid_mth, "ages", "Snow age", "day",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
@@ -1307,6 +1317,28 @@
      $         iim,jjmp1,nhori, 1,1,1, -99, 32,
      $         "inst(X)", zsto,zout)
+c
+           call histdef(nid_ins, "albe_"//clnsurf(nsrf), 
+     $         "Albedo "//clnsurf(nsrf), "-",  
+     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
+     $         "inst(X)", zsto,zout)
+c
+           call histdef(nid_ins, "rugs_"//clnsurf(nsrf), 
+     $         "rugosite "//clnsurf(nsrf), "-",  
+     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
+     $         "inst(X)", zsto,zout)
 C§§§
          END DO 
+         CALL histdef(nid_ins, "rugs", "rugosity", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "inst(X)", zsto,zout)
+
+c
+         CALL histdef(nid_ins, "albs", "Surface albedo", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "inst(X)", zsto,zout)
+c
+         CALL histdef(nid_ins, "snow_cov", "Snow cover", "mm",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "inst(X)", zsto,zout)
 c
 c Champs 3D:
@@ -1516,8 +1548,8 @@
      e            paprs,pplay,radsol, fsnow,fqsol,fevap,falbe,
      e            rain_fall, snow_fall, solsw, sollw, fder,
-     e            rlon, rlat, frugs,
-     e            debut, lafin, agesno,
+     e            rlon, rlat, cufi, cvfi, frugs,
+     e            debut, lafin, agesno,rugoro ,
      s            d_t_vdf,d_q_vdf,d_u_vdf,d_v_vdf,d_ts,
-     s            fluxt,fluxq,fluxu,fluxv,cdragh,cdragm,rugmer,
+     s            fluxt,fluxq,fluxu,fluxv,cdragh,cdragm,
      s            dsens, devap,
      s            ycoefh,yu1,yv1) 
@@ -2042,4 +2074,7 @@
       CALL histwrite(nid_day,"snow",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
+      CALL histwrite(nid_day,"snow_cov",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, evap,zx_tmp_2d)
       CALL histwrite(nid_day,"evap",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
@@ -2202,4 +2237,7 @@
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, snow_fall,zx_tmp_2d)
       CALL histwrite(nid_mth,"snow",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
+      CALL histwrite(nid_mth,"snow_cov",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, agesno,zx_tmp_2d)
@@ -2574,7 +2612,24 @@
         CALL histwrite(nid_ins,"tauy_"//clnsurf(nsrf),itap,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
+C
+        zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_ins,"rugs_"//clnsurf(nsrf),itap,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+C
+        zx_tmp_fi2d(1 : klon) = falbe( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_ins,"albe_"//clnsurf(nsrf),itap,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C 
       END DO  
-
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsol,zx_tmp_2d)
+      CALL histwrite(nid_ins,"albs",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
+      CALL histwrite(nid_ins,"snow_cov",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxrugs,zx_tmp_2d)
+      CALL histwrite(nid_ins,"rugs",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
 c Champs 3D:
