Index: /LMDZ4/trunk/libf/phylmd/cv3_routines.F
===================================================================
--- /LMDZ4/trunk/libf/phylmd/cv3_routines.F	(revision 1276)
+++ /LMDZ4/trunk/libf/phylmd/cv3_routines.F	(revision 1277)
@@ -72,4 +72,5 @@
 c      tau    = 3000.
 cc      tau = 1800.
+c     tau= 2800.
       tau=8000.
       beta   = 1.0 - delt/tau
@@ -2086,5 +2087,5 @@
 cc---end jyg---
 c
-c--------retour à la formulation originale d'Emanuel.
+c--------retour à la formulation originale d''Emanuel.
       b6=bfac*50.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac
       c6=water(il,i+1)+bfac*wdtrain(il)
@@ -2092,7 +2093,8 @@
       if(c6.gt.0.0)then
        revap=0.5*(-b6+sqrt(b6*b6+4.*c6))
-       evap(il,i)=sigt*afac*revap
-       water(il,i)=revap*revap
+       water(il,i)=revap*revap      !equation de conservation
       else
+       water(il,i) = 0.
+      endif
 cJYG/IM : ci-dessous formulation originale de KE
 c      evap(il,i)=-evap(il,i+1)
@@ -2104,7 +2106,13 @@
 c        lorsqu'il y a evaporation totale de la pluie
 c
-       evap(il,i)= +(wdtrain(il)+sigd(il)*wt(il,i)*water(il,i+1))
+c       evap(il,i)= +(wdtrain(il)+sigd(il)*wt(il,i)*water(il,i+1)) !itlmd(jyg)
+c     :                 /(sigd(il)*(ph(il,i)-ph(il,i+1))*100.)
+c      end if  !itlmd(jyg)
+cjyg---   Dans tous les cas, evaporation = [tt ce qui entre dans la couche i]
+c                                    moins [tt ce qui sort de la couche i]
+       evap(il,i)=
+     :       (wdtrain(il)+sigd(il)*wt(il,i)*(water(il,i+1)-water(il,i)))
      :                 /(sigd(il)*(ph(il,i)-ph(il,i+1))*100.)
-      end if
+c
 ccc
 c    ***  calculate precipitating downdraft mass flux under     ***
Index: /LMDZ4/trunk/libf/phylmd/wake.F
===================================================================
--- /LMDZ4/trunk/libf/phylmd/wake.F	(revision 1276)
+++ /LMDZ4/trunk/libf/phylmd/wake.F	(revision 1277)
@@ -221,5 +221,5 @@
       REAL, dimension(klon) :: RRe1, RRe2
       REAL :: RRd1, RRd2
-      REAL, DIMENSION(klon,klev) :: Th1, Th2, q1, q2
+      REAL, DIMENSION(klon,klev) :: Th1, Th2, q1, q2, T1 
       REAL, DIMENSION(klon,klev) :: D_Th1, D_Th2, D_dth
       REAL, DIMENSION(klon,klev) :: D_q1, D_q2, D_dq
@@ -269,5 +269,4 @@
       Crep_upper=0.9
       Crep_sol=1.0
-
 
 C Minimum value for |T_wake - T_undist|. Used for wake top definition
@@ -366,5 +365,5 @@
         tu(i,k) = te(i,k) - deltatw(i,k)*sigmaw(i)
         qu(i,k)  =  qe(i,k) - deltaqw(i,k)*sigmaw(i)
-        rhow(i,k) = p(i,k)/(rd*(te(i,k)+deltatw(i,k)))
+        rhow(i,k) = p(i,k)/(rd*(tu(i,k)+deltatw(i,k)))
         dth(i,k) = deltatw(i,k)/ppi(i,k)
        ENDDO
@@ -836,10 +835,11 @@
         q1(i,k) = qe(i,k) - sigmaw(i)     *deltaqw(i,k) ! undisturbed area
         q2(i,k) = qe(i,k) + (1.-sigmaw(i))*deltaqw(i,k) ! wake
-       ENDIF
-      ENDDO
-      ENDDO
-
-      DO i=1,klon
-       D_Th1(i,1) = 0.
+        T1(i,k) = te(i,k) - sigmaw(i)*deltatw(i,k)! undisturb itlmd
+       ENDIF
+      ENDDO
+      ENDDO
+
+      DO i=1,klon
+       D_Th1(i,1) = 0.   !!!itlmd : ne pas mettre if wk_adv cf nrlmd?
        D_Th2(i,1) = 0.
        D_dth(i,1) = 0.
@@ -912,5 +912,6 @@
      $         -RRe2(i)*omg(i,k+1)*(1.-sigmaw(i))*D_Th2(i,k+1) )
      $               /(Ph(i,k)-Ph(i,k+1))
-     $         -sigmaw(i)*(1.-sigmaw(i))*dth(i,k)*dp_deltomg(i,k)
+     $         -sigmaw(i)*(1.-sigmaw(i))*dth(i,k)*
+     $            (omg(i,k)-omg(i,k+1))/(Ph(i,k)-Ph(i,k+1)) !instead of dp_deltomg(i,k) 
      $                      )*ppi(i,k)
 c
@@ -919,5 +920,17 @@
      $         -RRe2(i)*omg(i,k+1)*(1.-sigmaw(i))*D_q2(i,k+1) )
      $               /(Ph(i,k)-Ph(i,k+1))
-     $         -sigmaw(i)*(1.-sigmaw(i))*deltaqw(i,k)*dp_deltomg(i,k)
+     $         -sigmaw(i)*(1.-sigmaw(i))*deltaqw(i,k)*
+     $           (omg(i,k)-omg(i,k+1))/(Ph(i,k)-Ph(i,k+1))!instead of dp_deltomg(i,k)
+     $                      )
+        ELSE IF(wk_adv(i) .AND. k .EQ. kupper(i)) THEN ! corr pour conserver l'eau
+
+         d_te(i,k) =  dtimesub*(
+     $        ( RRe1(i)*omg(i,k  )*sigmaw(i)     *D_Th1(i,k))
+     $               /(Ph(i,k)-Ph(i,k+1))
+     $                      )*ppi(i,k)
+
+         d_qe(i,k) =  dtimesub*(
+     $        ( RRe1(i)*omg(i,k  )*sigmaw(i)     *D_q1(i,k))
+     $               /(Ph(i,k)-Ph(i,k+1))
      $                      )
        ENDIF
@@ -1226,8 +1239,9 @@
         IF (dz(i) .GT. 0) THEN
          z(i) = z(i)+dz(i)
-         sum_thu(i) = sum_thu(i) + thu(i,k)*dz(i)
-         sum_tu(i) = sum_tu(i) + tu(i,k)*dz(i)
-         sum_qu(i) = sum_qu(i) + qu(i,k)*dz(i)
-         sum_thvu(i) = sum_thvu(i) + thu(i,k)*(1.+eps*qu(i,k))*dz(i)
+         sum_thu(i) = sum_thu(i) + th1(i,k)*dz(i)
+         sum_tu(i) = sum_tu(i) + t1(i,k)*dz(i)
+         sum_qu(i) = sum_qu(i) + q1(i,k)*dz(i)
+         sum_thvu(i) = sum_thvu(i) + th1(i,k)*(1.+eps*q1(i,k))*dz(i)!itlmd
+
          sum_dth(i) = sum_dth(i) + dth(i,k)*dz(i)
          sum_dq(i) = sum_dq(i) + deltaqw(i,k)*dz(i)
@@ -1300,5 +1314,5 @@
       DO k = 1,klev
       DO i=1,klon
-        IF ( wk_adv(i) .AND. k .LE. kupper(i)-1) THEN
+       IF ( wk_adv(i) .AND. k .LE. kupper(i)) THEN  !! corr conservation eau
          dtls(i,k) = dtls(i,k)/dtime
          dqls(i,k) = dqls(i,k)/dtime
@@ -1359,5 +1373,5 @@
         tu(i,k) = te(i,k) - deltatw(i,k)*sigmaw(i)
         qu(i,k)  =  qe(i,k) - deltaqw(i,k)*sigmaw(i)
-        rhow(i,k) = p(i,k)/(rd*(te(i,k)+deltatw(i,k)))
+        rhow(i,k) = p(i,k)/(rd*(tu(i,k)+deltatw(i,k)))
         dth(i,k) = deltatw(i,k)/ppi(i,k)
        ENDIF
@@ -1520,4 +1534,5 @@
 ccc      IF (sigmaw(i).GT.0.9) THEN
          wape(i) = 0.
+         cstar(i)= 0.  !!corr itlmd
          hw(i) = hwmin
          sigmaw(i) = sigmad
@@ -1525,4 +1540,5 @@
         ELSE
          wape(i) = wape2(i)
+         cstar(i)= cstar2(i) !!corr itlmd
         ENDIF
       ENDDO
