Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 273)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 274)
@@ -312,12 +312,5 @@
            cal(1:knon) = RCPD / soilcap(1:knon)
            radsol(1:knon) = radsol(1:knon)  + soilflux(1:knon)
-!!$           WRITE(*,*) 'radsol'
-!!$           WRITE(*,*) radsol(1 : knon)
-!!$           WRITE(*,*) 'soilflux'
-!!$           WRITE(*,*) soilflux(1 : knon)
        ELSE 
-!      if (check) write(*,*)'Sortie calbeta'
-!      if (check) write(*,*)'RCPD = ',RCPD,' capsol = '
-!      if (check) write(*,*)capsol
            cal = RCPD * capsol
 !!$      cal = capsol
@@ -337,12 +330,4 @@
      &   tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l)
 
-!!$       DO ii = 1, knon
-!!$         index = knindex(ii)
-!!$         alb_neig(ii) = alb_neig_grid(index)
-!!$         agesno(index)  = (agesno(index) + (1.-agesno(index)/50.)*dtime/86400.)&
-!!$            &             * EXP(-1.*MAX(0.0,precip_snow(ii))*dtime/0.3)
-!!$         agesno(index) = MAX(agesno(index),0.0)
-!!$         IF(snow(ii) .LT. 0.0001) agesno(index) = 0.
-!!$       ENDDO
 
      call albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:))  
@@ -399,5 +384,5 @@
       & swdown, sollw, precip_rain, precip_snow, evap, tsurf, &
       & fluxlat, fluxsens, fder, albedo, taux, tauy, zmasq, &
-      & tsurf_new, alb_new, alb_ice, pctsrf_new)
+      & tsurf_new, alb_new, pctsrf_new)
 
 !    else if (ocean == 'slab  ') then
@@ -440,5 +425,5 @@
       & swdown, sollw, precip_rain, precip_snow, evap, tsurf, &
       & fluxlat, fluxsens, fder, albedo, taux, tauy, zmasq, &
-      & tsurf_new, alb_new, alb_ice, pctsrf_new)
+      & tsurf_new, alb_new, pctsrf_new)
 
 !    else if (ocean == 'slab  ') then
@@ -460,5 +445,5 @@
     enddo
 
-    z0_new = rugos
+    z0_new = sqrt(rugos**2 + rugoro**2)
 !
   else if (nisurf == is_sic) then
@@ -479,5 +464,5 @@
       & swdown, sollw, precip_rain, precip_snow, evap, tsurf, &
       & fluxlat, fluxsens, fder, albedo, taux, tauy, zmasq, &
-      & tsurf_new, alb_new, alb_ice, pctsrf_new)
+      & tsurf_new, alb_new, pctsrf_new)
 
       tsurf_temp = tsurf_new
@@ -488,35 +473,28 @@
 !    else if (ocean == 'slab  ') then
 !      call interfoce(nisurf)
-      ELSE
+    ELSE
 !                              ! lecture conditions limites
-          CALL interfoce(itime, dtime, jour, & 
+      CALL interfoce(itime, dtime, jour, & 
              &  klon, nisurf, knon, knindex, &
              &  debut, &
              &  tsurf_new, pctsrf_new)
 
-          CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd)
+      CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd)
       
-          IF (soil_model) THEN 
-              CALL soil(dtime, nisurf, knon,snow, tsurf, tsoil,soilcap, soilflux)
-              cal(1:knon) = RCPD / soilcap(1:knon)
-              radsol(1:knon) = radsol(1:knon)  + soilflux(1:knon)
-              dif_grnd = 0.
-!!$           WRITE(*,*) 'radsol'
-!!$           WRITE(*,*) radsol(1 : knon)
-!!$           WRITE(*,*) 'soilflux'
-!!$           WRITE(*,*) soilflux(1 : knon)
-          ELSE 
-!      if (check) write(*,*)'Sortie calbeta'
-!      if (check) write(*,*)'RCPD = ',RCPD,' capsol = '
-!      if (check) write(*,*)capsol
-              dif_grnd = 1.0 / tau_gl
-              cal = RCPD * calice
-              WHERE (snow > 0.0) cal = RCPD * calsno 
-          ENDIF
-          tsurf_temp = tsurf
-          beta = 1.0
+      IF (soil_model) THEN 
+         CALL soil(dtime, nisurf, knon,snow, tsurf, tsoil,soilcap, soilflux)
+         cal(1:knon) = RCPD / soilcap(1:knon)
+         radsol(1:knon) = radsol(1:knon)  + soilflux(1:knon)
+         dif_grnd = 0.
+      ELSE 
+         dif_grnd = 1.0 / tau_gl
+         cal = RCPD * calice
+         WHERE (snow > 0.0) cal = RCPD * calsno 
       ENDIF
-
-      CALL calcul_fluxs( klon, knon, nisurf, dtime, &
+      tsurf_temp = tsurf
+      beta = 1.0
+    ENDIF
+
+    CALL calcul_fluxs( klon, knon, nisurf, dtime, &
          &   tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, &
          &   precip_rain, precip_snow, snow, qsol,  &
@@ -525,8 +503,6 @@
          &   tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l)
 
-    fder = fder + dflux_s + dflux_l
-
-      IF (ocean /= 'couple') THEN
-          CALL fonte_neige( klon, knon, nisurf, dtime, &
+    IF (ocean /= 'couple') THEN
+      CALL fonte_neige( klon, knon, nisurf, dtime, &
              &   tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, &
              &   precip_rain, precip_snow, snow, qsol,  &
@@ -534,5 +510,16 @@
              &   petAcoef, peqAcoef, petBcoef, peqBcoef, &
              &   tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l)
-      ENDIF
+
+!     calcul albedo
+
+      CALL albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:))  
+      WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.
+      zfra = MAX(0.0,MIN(1.0,snow/(snow+10.0)))
+      alb_new(1 : knon) = alb_neig(1 : knon) *zfra + 0.6 * (1.0-zfra)
+!!      alb_new(1 : knon) = 0.6
+    ENDIF
+
+    fder = fder + dflux_s + dflux_l
+
 !
 ! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean
@@ -547,5 +534,5 @@
       & swdown, sollw, precip_rain, precip_snow, evap, tsurf, &
       & fluxlat, fluxsens, fder, albedo, taux, tauy, zmasq, &
-      & tsurf_new, alb_new, alb_ice, pctsrf_new)
+      & tsurf_new, alb_new, pctsrf_new)
 
 !    else if (ocean == 'slab  ') then
@@ -554,13 +541,4 @@
     endif
 
-!
-! calcul albedo
-!
-!
-     CALL albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:))  
-     WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.
-     zfra = MAX(0.0,MIN(1.0,snow/(snow+10.0)))
-!!$     alb_new(1 : knon) = alb_neig(1 : knon) *zfra + 0.6 * (1.0-zfra)
-     alb_new(1 : knon) = 0.6
      
      z0_new = 0.001
@@ -579,8 +557,4 @@
         cal(1:knon) = RCPD / soilcap(1:knon)
         radsol(1:knon)  = radsol(1:knon) + soilflux(1:knon)
-!!$           WRITE(*,*) 'radsol'
-!!$           WRITE(*,'(16f17.4)') radsol(1 : knon)
-!!$           WRITE(*,*) 'soilflux'
-!!$           WRITE(*,'(16f17.4)')soilflux(1:knon)
     ELSE 
         cal = RCPD * calice
@@ -610,6 +584,6 @@
      WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.
      zfra = MAX(0.0,MIN(1.0,snow/(snow+10.0)))
-!!$     alb_new(1 : knon)  = alb_neig(1 : knon)*zfra + 0.6 * (1.0-zfra)
-     alb_new(1 : knon)  = 0.6
+     alb_new(1 : knon)  = alb_neig(1 : knon)*zfra + 0.6 * (1.0-zfra)
+!!     alb_new(1 : knon)  = 0.6
 !
 ! Rugosite
@@ -901,5 +875,5 @@
       endif
     endif
-    neighbours = 0.
+    neighbours = -1.
     if (( .not. allocated(contfrac))) then
       allocate(contfrac(knon), stat = error)
@@ -1011,5 +985,5 @@
       & swdown, lwdown, precip_rain, precip_snow, evap, tsurf, &
       & fluxlat, fluxsens, fder, albsol, taux, tauy, zmasq, &
-      & tsurf_new, alb_new, alb_ice, pctsrf_new)
+      & tsurf_new, alb_new, pctsrf_new)
 
 ! Cette routine sert d'interface entre le modele atmospherique et un 
@@ -1088,5 +1062,5 @@
 
 ! Parametres de sortie
-  real, dimension(klon), intent(OUT):: tsurf_new, alb_new, alb_ice
+  real, dimension(klon), intent(OUT):: tsurf_new, alb_new
   real, dimension(klon,nbsrf), intent(OUT) :: pctsrf_new
 
@@ -1249,5 +1223,4 @@
 
 ! Initialisations
-  alb_ice= 0.0
 
 ! calcul des fluxs a passer
