Index: /LMDZ5/trunk/libf/phylmd/cv3_buoy.F
===================================================================
--- /LMDZ5/trunk/libf/phylmd/cv3_buoy.F	(revision 1514)
+++ /LMDZ5/trunk/libf/phylmd/cv3_buoy.F	(revision 1515)
@@ -33,10 +33,10 @@
       real bll(nloc), bmx(nloc)
       real gamma(nloc)
+      logical ok(nloc)
+
       real dgamma
       real buoymin
-      logical ok(nloc)
-
-      data dgamma /2.e-03/ !dgamma gamma
-      data buoymin /2./
+      parameter (dgamma = 2.e-03) !dgamma gamma
+      parameter (buoymin = 2.)
 
       logical fixed_bll
Index: /LMDZ5/trunk/libf/phylmd/cv3_routines.F
===================================================================
--- /LMDZ5/trunk/libf/phylmd/cv3_routines.F	(revision 1514)
+++ /LMDZ5/trunk/libf/phylmd/cv3_routines.F	(revision 1515)
@@ -38,7 +38,7 @@
       CHARACTER (LEN=20) :: modname='cv3_param'
       CHARACTER (LEN=80) :: abort_message
-      LOGICAL, SAVE :: FIRST=.TRUE.
-!$OMP THREADPRIVATE(FIRST)
-
+
+      LOGICAL,SAVE :: first=.true.
+c$OMP THREADPRIVATE(first)
 
 c noff: integer limit for convection (nd-noff)
@@ -53,12 +53,15 @@
       nlm=nl-1
 
+      IF (first) THEN
+
 c -- "microphysical" parameters:
        sigdz=0.01
-c      sigd=0.003
-c     sigd   = 0.01
-cCR:test sur la fraction des descentes precipitantes
       spfac  = 0.15
       pbcrit = 150.0
       ptcrit = 500.0
+cIM beg: ajout fis. reglage ep
+      flag_epKEorig=0
+      elcrit=0.0011
+      tlcrit=-55.0
 cIM lu dans physiq.def via conf_phys.F90     epmax  = 0.993
 
@@ -71,4 +74,5 @@
 ccc      dttrig = 5.   ! (loose) condition for triggering
       dttrig = 10.   ! (loose) condition for triggering
+      wb = 1.   ! (m/s) adiab updraught speed at LFC (used in cv3p1_closure)
 
 c -- rate of approach to quasi-equilibrium:
@@ -85,5 +89,5 @@
       betad=10.0   ! original value (from convect 4.3)
 
-      OPEN(99,file='conv_param.data',status='old',
+       OPEN(99,file='conv_param.data',status='old',
      $          form='formatted',err=9999)
       READ(99,*,end=9998) dpbase
@@ -93,8 +97,8 @@
       READ(99,*,end=9998) spfac
       READ(99,*,end=9998) tau
+      READ(99,*,end=9998) wb
 9998  Continue
       CLOSE(99)
 9999  Continue
-      if (first) then
         WRITE(*,*)'dpbase=',dpbase
         WRITE(*,*)'pbcrit=',pbcrit
@@ -103,12 +107,31 @@
         WRITE(*,*)'spfac=',spfac
         WRITE(*,*)'tau=',tau
-        first = .false.
-      endif
+        WRITE(*,*)'wb =',wb
+
+cIM Lecture du fichier ep_param.data
+      OPEN(79,file='ep_param.data',status='old',
+     $          form='formatted',err=7999)
+      READ(79,*,end=7998) flag_epKEorig
+      READ(79,*,end=7998) elcrit
+      READ(79,*,end=7998) tlcrit
+7998  Continue
+      CLOSE(79)
+7999  Continue
+      WRITE(*,*)'flag_epKEorig',flag_epKEorig
+      WRITE(*,*)'elcrit=',elcrit
+      WRITE(*,*)'tlcrit=',tlcrit
+cIM end: ajout fis. reglage ep
+
+       first = .false.
+      ENDIF
 
       beta   = 1.0 - delt/tau
       alpha1 = 1.5e-3
+cjyg    Correction bug alpha
+      alpha1  = alpha1*1.5
       alpha  = alpha1 * delt/tau
-c increase alpha to compensate W decrease:
-      alpha  = alpha*1.5
+cjyg    Bug
+ccc increase alpha to compensate W decrease:
+cc      alpha  = alpha*1.5
 
       return
@@ -942,9 +965,4 @@
       logical lcape(nloc)
       integer iposit(nloc)
-      real elcrit, tlcrit, sigs
-      parameter(sigs=0.15)
-      integer flag_epKEorig
-      LOGICAL, SAVE :: FIRST=.TRUE.
-!$OMP THREADPRIVATE(FIRST)
 
 !=====================================================================
@@ -1055,24 +1073,4 @@
 ! --- THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I)
 !=====================================================================
-cIM beg: ajout fis. reglage ep
-      flag_epKEorig=0
-      elcrit=0.0011
-      tlcrit=-55.0
-cIM Lecture du fichier ep_param.data
-      OPEN(99,file='ep_param.data',status='old',
-     $          form='formatted',err=9999)
-      READ(99,*,end=9998) flag_epKEorig
-      READ(99,*,end=9998) elcrit
-      READ(99,*,end=9998) tlcrit
-9998  Continue
-      CLOSE(99)
-9999  Continue
-      if (first) then
-        WRITE(*,*)'flag_epKEorig',flag_epKEorig
-        WRITE(*,*)'elcrit=',elcrit
-        WRITE(*,*)'tlcrit=',tlcrit
-        first=.false.
-      endif
-cIM end: ajout fis. reglage ep
 
       if(flag_epKEorig.ne.1) THEN
@@ -1081,6 +1079,6 @@
            pden=ptcrit-pbcrit
            ep(i,k)=(plcl(i)-p(i,k)-pbcrit)/pden*epmax
-           ep(i,k)=amax1(ep(i,k),0.0)
-           ep(i,k)=amin1(ep(i,k),epmax)
+           ep(i,k)=max(ep(i,k),0.0)
+           ep(i,k)=min(ep(i,k),epmax)
            sigp(i,k)=spfac
  310    continue
@@ -1100,5 +1098,5 @@
               ep(i,k)=max(ep(i,k),0.0 )
               ep(i,k)=min(ep(i,k),epmax )
-              sigp(i,k)=sigs
+              sigp(i,k)=spfac
           endif
  315    continue
Index: /LMDZ5/trunk/libf/phylmd/cv3p1_closure.F
===================================================================
--- /LMDZ5/trunk/libf/phylmd/cv3p1_closure.F	(revision 1514)
+++ /LMDZ5/trunk/libf/phylmd/cv3p1_closure.F	(revision 1515)
@@ -75,6 +75,7 @@
       real term1,term2,term3
       real alp2(nloc) ! Alp with offset
-      real wb,sigmax
-      data wb /2./, sigmax /0.1/
+c
+      real sigmax
+      parameter (sigmax =  0.1)
 
       CHARACTER (LEN=20) :: modname='cv3p1_closure'
@@ -515,5 +516,7 @@
 c
       DO il = 1,ncum
-       cbmf1(il) = alp2(il)/(0.5*wb*wb-Cin(il))
+cjyg    Modification du coef de wb*wb pour conformite avec papier Wake
+cc       cbmf1(il) = alp2(il)/(0.5*wb*wb-Cin(il))
+       cbmf1(il) = alp2(il)/(2.*wb*wb-Cin(il))
        if(cbmf1(il).EQ.0.AND.alp2(il).NE.0.) THEN
         write(lunout,*)
Index: /LMDZ5/trunk/libf/phylmd/cv3p_mixing.F
===================================================================
--- /LMDZ5/trunk/libf/phylmd/cv3p_mixing.F	(revision 1514)
+++ /LMDZ5/trunk/libf/phylmd/cv3p_mixing.F	(revision 1515)
@@ -83,4 +83,5 @@
       INTEGER ifrst
       DATA ifrst/0/
+c$OMP THREADPRIVATE(ifirst)
 C
 
Index: /LMDZ5/trunk/libf/phylmd/cv3param.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/cv3param.h	(revision 1514)
+++ /LMDZ5/trunk/libf/phylmd/cv3param.h	(revision 1515)
@@ -9,8 +9,11 @@
       integer noff, minorig, nl, nlp, nlm
       real sigdz, spfac
+      integer flag_epKEorig
       real pbcrit, ptcrit
+      real elcrit, tlcrit
       real omtrain
       real dtovsh, dpbase, dttrig
       real dtcrit, tau, beta, alpha, alpha1
+      real wb
       real delta
       real betad
@@ -18,8 +21,12 @@
       COMMON /cv3param/  noff, minorig, nl, nlp, nlm
      :                ,  sigdz, spfac
+     :                ,flag_epKEorig
      :                ,pbcrit, ptcrit
+     :                ,elcrit, tlcrit
      :                ,omtrain
      :                ,dtovsh, dpbase, dttrig
-     :                ,dtcrit, tau, beta, alpha, alpha1, delta, betad
+     :                ,dtcrit, tau, beta, alpha, alpha1
+     :                ,wb
+     :                ,delta, betad
 !$OMP THREADPRIVATE(/cv3param/)
 
