Index: LMDZ5/trunk/libf/dyn3d/etat0_netcdf.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3d/etat0_netcdf.F90	(revision 1495)
+++ LMDZ5/trunk/libf/dyn3d/etat0_netcdf.F90	(revision 1496)
@@ -138,7 +138,5 @@
                    flag_aerosol, new_aod,                               &
                    bl95_b0, bl95_b1,                                    &
-                   iflag_thermals,nsplit_thermals,tau_thermals,         &
-                   iflag_thermals_ed,iflag_thermals_optflux,            &
-                   iflag_coupl,iflag_clos,iflag_wake, read_climoz,      &
+                   read_climoz,                                         &
                    alp_offset)
 
Index: LMDZ5/trunk/libf/dyn3dpar/etat0_netcdf.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/etat0_netcdf.F90	(revision 1495)
+++ LMDZ5/trunk/libf/dyn3dpar/etat0_netcdf.F90	(revision 1496)
@@ -138,7 +138,5 @@
                    flag_aerosol, new_aod,                               &
                    bl95_b0, bl95_b1,                                    &
-                   iflag_thermals,nsplit_thermals,tau_thermals,         &
-                   iflag_thermals_ed,iflag_thermals_optflux,            &
-                   iflag_coupl,iflag_clos,iflag_wake, read_climoz,      &
+                   read_climoz,                                         &
                    alp_offset)
 
Index: LMDZ5/trunk/libf/phylmd/calltherm.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/calltherm.F90	(revision 1495)
+++ LMDZ5/trunk/libf/phylmd/calltherm.F90	(revision 1496)
@@ -216,6 +216,7 @@
      &      ,zfm_therm,zentr_therm,zdetr_therm,zqasc,zqla,lmax  &
      &      ,ratqscth,ratqsdiff,zqsatth  &
-     &      ,r_aspect_thermals,l_mix_thermals &
-     &      ,tau_thermals,iflag_thermals_ed,Ale,Alp,lalim_conv,wght_th &
+!    &      ,r_aspect_thermals,l_mix_thermals &
+!    &      ,tau_thermals,iflag_thermals_ed,iflag_coupl &
+     &      ,Ale,Alp,lalim_conv,wght_th &
      &      ,zmax0,f0,zw2,fraca,ztv,zpspsk &
      &      ,ztla,zthl)
Index: LMDZ5/trunk/libf/phylmd/conf_phys.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/conf_phys.F90	(revision 1495)
+++ LMDZ5/trunk/libf/phylmd/conf_phys.F90	(revision 1496)
@@ -21,7 +21,5 @@
                        flag_aerosol, new_aod, &
                        bl95_b0, bl95_b1,&
-                       iflag_thermals,nsplit_thermals,tau_thermals, &
-                       iflag_thermals_ed,iflag_thermals_optflux, &
-                       iflag_coupl,iflag_clos,iflag_wake, read_climoz, &
+                       read_climoz, &
                        alp_offset)
 
@@ -37,4 +35,7 @@
  include "YOMCST.h"
  include "YOMCST2.h"
+
+ include "thermcell.h"
+
 !IM : on inclut/initialise les taux de CH4, N2O, CFC11 et CFC12
 include "clesphys.h"
@@ -106,13 +107,7 @@
   real,save :: seuil_inversion_omp
 
-  integer :: iflag_thermals,nsplit_thermals
   integer,SAVE :: iflag_thermals_ed_omp,iflag_thermals_optflux_omp
-  integer :: iflag_thermals_ed,iflag_thermals_optflux
   integer,SAVE :: iflag_thermals_omp,nsplit_thermals_omp
-  real :: tau_thermals
-  real,save :: tau_thermals_omp
-  integer :: iflag_coupl
-  integer :: iflag_clos
-  integer :: iflag_wake
+  real,save :: tau_thermals_omp,alp_bl_k_omp
   real :: alp_offset
   REAL, SAVE :: alp_offset_omp
@@ -1002,4 +997,13 @@
   call getin('nsplit_thermals',nsplit_thermals_omp)
 
+!Config Key  = alp_bl_k
+!Config Desc =
+!Config Def  = 0.
+!Config Help =
+!
+  alp_bl_k_omp = 1.
+  call getin('alp_bl_k',alp_bl_k_omp)
+
+!
 !Config Key  = tau_thermals
 !Config Desc =
@@ -1554,4 +1558,5 @@
     nsplit_thermals = nsplit_thermals_omp
     tau_thermals = tau_thermals_omp
+    alp_bl_k = alp_bl_k_omp
     iflag_coupl = iflag_coupl_omp
     iflag_clos = iflag_clos_omp
Index: LMDZ5/trunk/libf/phylmd/physiq.F
===================================================================
--- LMDZ5/trunk/libf/phylmd/physiq.F	(revision 1495)
+++ LMDZ5/trunk/libf/phylmd/physiq.F	(revision 1496)
@@ -1234,8 +1234,6 @@
      .     flag_aerosol, new_aod,
      .     bl95_b0, bl95_b1,
-     .     iflag_thermals,nsplit_thermals,tau_thermals,
-     .     iflag_thermals_ed,iflag_thermals_optflux,
 c     nv flags pour la convection et les poches froides
-     .     iflag_coupl,iflag_clos,iflag_wake, read_climoz,
+     .     read_climoz,
      &     alp_offset)
       call phys_state_var_init(read_climoz)
@@ -2846,4 +2844,24 @@
       if (iflag_cldcon>=5) then
 
+         ptconvth(:,:)=fm_therm(:,:)>0.
+
+       if (iflag_coupl==4) then
+
+! Dans le cas iflag_coupl==4, on prend la somme des convertures
+! convectives et lsc dans la partie des thermiques
+! Le controle par iflag_coupl est peut etre provisoire.
+         do k=1,klev
+            do i=1,klon
+               if (ptconv(i,k).and.ptconvth(i,k)) then
+                   cldliq(i,k)=cldliq(i,k)+rnebcon(i,k)*clwcon(i,k)
+                   cldfra(i,k)=min(cldfra(i,k)+rnebcon(i,k),1.)
+               else if (ptconv(i,k)) then
+                   cldfra(i,k)=rnebcon(i,k)
+                   cldliq(i,k)=rnebcon(i,k)*clwcon(i,k)
+               endif
+            enddo
+         enddo
+
+         else
 ! Si on est sur un point touche par la convection profonde et pas
 ! par les thermiques, on prend la couverture nuageuse et l'eau nuageuse
@@ -2852,6 +2870,5 @@
 !IM/FH: 2011/02/23 
 ! definition des points sur lesquels ls thermiques sont actifs
-         if (prt_level>9)write(*,*)'TEST SCHEMA DE NUAGES '
-         ptconvth(:,:)=fm_therm(:,:)>0.
+
          do k=1,klev
             do i=1,klon
@@ -2862,5 +2879,9 @@
             enddo
          enddo
+
+        endif
+
       else
+
 ! Ancienne version
       cldfra(:,:)=min(max(cldfra(:,:),rnebcon(:,:)),1.)
Index: LMDZ5/trunk/libf/phylmd/thermcell.h
===================================================================
--- LMDZ5/trunk/libf/phylmd/thermcell.h	(revision 1495)
+++ LMDZ5/trunk/libf/phylmd/thermcell.h	(revision 1496)
@@ -1,4 +1,5 @@
       integer            :: iflag_thermals,nsplit_thermals
       real,parameter     :: r_aspect_thermals=2.,l_mix_thermals=30.
+      real               :: alp_bl_k
       real               :: tau_thermals
       integer,parameter  :: w2di_thermals=1
@@ -9,5 +10,5 @@
 
       common/ctherm1/iflag_thermals,nsplit_thermals
-      common/ctherm2/tau_thermals
+      common/ctherm2/tau_thermals,alp_bl_k
       common/ctherm4/iflag_coupl,iflag_clos,iflag_wake
       common/ctherm5/iflag_thermals_ed,iflag_thermals_optflux
Index: LMDZ5/trunk/libf/phylmd/thermcell_main.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/thermcell_main.F90	(revision 1495)
+++ LMDZ5/trunk/libf/phylmd/thermcell_main.F90	(revision 1496)
@@ -8,5 +8,4 @@
      &                  ,fm0,entr0,detr0,zqta,zqla,lmax  &
      &                  ,ratqscth,ratqsdiff,zqsatth  &
-     &                  ,r_aspect,l_mix,tau_thermals,iflag_thermals_ed &
      &                  ,Ale_bl,Alp_bl,lalim_conv,wght_th &
      &                  ,zmax0, f0,zw2,fraca,ztv &
@@ -47,4 +46,5 @@
 #include "FCTTRE.h"
 #include "iniprint.h"
+#include "thermcell.h"
 
 !   arguments:
@@ -54,8 +54,6 @@
       INTEGER itap
 
-      INTEGER ngrid,nlay,w2di
-      real tau_thermals
-      integer iflag_thermals_ed
-      real ptimestep,l_mix,r_aspect
+      INTEGER ngrid,nlay
+      real ptimestep
       REAL pt(ngrid,nlay),pdtadj(ngrid,nlay)
       REAL pu(ngrid,nlay),pduadj(ngrid,nlay)
@@ -162,5 +160,5 @@
       real Ale_bl(klon)
       real Alp_bl(klon)
-      real alp_int(klon)
+      real alp_int(klon),dp_int(klon),zdp
       real ale_int(klon)
       integer n_int(klon)
@@ -474,5 +472,5 @@
 
 ! Appel avec la version seche
-      CALL thermcell_closure(ngrid,nlay,r_aspect,ptimestep,rho,  &
+      CALL thermcell_closure(ngrid,nlay,r_aspect_thermals,ptimestep,rho,  &
      &   zlev,lalim,alim_star_clos,f_star,zmax_sec,wmax_sec,f,lev_out)
 
@@ -480,5 +478,5 @@
 ! Appel avec les zmax et wmax tenant compte de la condensation
 ! Semble moins bien marcher
-!     CALL thermcell_closure(ngrid,nlay,r_aspect,ptimestep,rho,  &
+!     CALL thermcell_closure(ngrid,nlay,r_aspect_thermals,ptimestep,rho,  &
 !    &   zlev,lalim,alim_star,f_star,zmax,wmax,f,lev_out)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -702,14 +700,6 @@
       enddo
 
-!     print*,'AAAAAAA ',Alp_bl,Ale_bl,lmix
-
-
-! TEST. IL FAUT REECRIRE LES ALE et ALP
-!     Ale_bl(:)=0.5*wmax(:)*wmax(:)
-!     Alp_bl(:)=0.1*wmax(:)*wmax(:)*wmax(:)
-
 !test:calcul de la ponderation des couches pour KE
 !initialisations
-!      print*,'ponderation'
 
       fm_tot(:)=0.
@@ -743,4 +733,38 @@
       endif
       enddo
+
+!------------------------------------------------------------------------
+! Modif CR/FH 20110310 : Alp integree sur la verticale.
+! Integrale verticale de ALP.
+! wth3 etant aux niveaux inter-couches, on utilise d play comme masse des
+! couches
+!------------------------------------------------------------------------
+
+      alp_int(:)=0.
+      dp_int(:)=0.
+      do l=2,nlay
+        do ig=1,ngrid
+           if(l.LE.lmax(ig)) THEN
+           zdp=pplay(ig,l-1)-pplay(ig,l)
+           alp_int(ig)=alp_int(ig)+0.5*rhobarz(ig,l)*wth3(ig,l)*zdp
+           dp_int(ig)=dp_int(ig)+zdp
+           endif
+        enddo
+      enddo
+
+      if (iflag_coupl==3 .or. iflag_coupl==4) then
+      do ig=1,ngrid
+!valeur integree de alp_bl * 0.5:
+        if (dp_int(ig)>0.) then
+        Alp_bl(ig)=alp_int(ig)/dp_int(ig)
+        endif
+      enddo!
+      endif
+
+
+! Facteur multiplicatif sur Alp_bl
+      Alp_bl(:)=alp_bl_k*Alp_bl(:)
+
+!------------------------------------------------------------------------
 
 
