Index: LMDZ6/trunk/libf/phylmd/thermcell_dq.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/thermcell_dq.F90	(revision 4132)
+++ LMDZ6/trunk/libf/phylmd/thermcell_dq.F90	(revision 4133)
@@ -17,21 +17,20 @@
 !=======================================================================
 
-      integer ngrid,nlay,impl
-
-      real ptimestep
-      real masse(ngrid,nlay),fm(ngrid,nlay+1)
-      real entr(ngrid,nlay)
-      real q(ngrid,nlay)
-      real dq(ngrid,nlay)
-      integer lev_out                           ! niveau pour les print
-
-      real qa(ngrid,nlay),detr(ngrid,nlay),wqd(ngrid,nlay+1)
-
+! arguments
+      integer, intent(in) :: ngrid,nlay,impl
+      real, intent(in) :: ptimestep
+      real, intent(in), dimension(ngrid,nlay) :: masse
+      real, intent(inout), dimension(ngrid,nlay) :: entr,q
+      real, intent(in), dimension(ngrid,nlay+1) :: fm
+      real, intent(out), dimension(ngrid,nlay) :: dq,qa
+      integer, intent(in) :: lev_out                           ! niveau pour les print
+
+! Local
+      real, dimension(ngrid,nlay) :: detr,qold
+      real, dimension(ngrid,nlay+1) :: wqd,fqa
       real zzm
-
       integer ig,k
       real cfl
 
-      real qold(ngrid,nlay),fqa(ngrid,nlay+1)
       integer niter,iter
       CHARACTER (LEN=20) :: modname='thermcell_dq'
@@ -43,5 +42,5 @@
          call thermcell_dq_o(ngrid,nlay,impl,ptimestep,fm,entr,  &
      &           masse,q,dq,qa,lev_out)
-         return
+         goto 1000
       endif
 
@@ -143,5 +142,6 @@
       enddo
 
-return
+1000 continue
+ RETURN
 end
 
Index: LMDZ6/trunk/libf/phylmd/thermcell_flux2.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/thermcell_flux2.F90	(revision 4132)
+++ LMDZ6/trunk/libf/phylmd/thermcell_flux2.F90	(revision 4133)
@@ -2,5 +2,5 @@
 ! $Id$
 !
-      SUBROUTINE thermcell_flux2(ngrid,klev,ptimestep,masse, &
+      SUBROUTINE thermcell_flux2(ngrid,nlay,ptimestep,masse, &
      &       lalim,lmax,alim_star,  &
      &       entr_star,detr_star,f,rhobarz,zlev,zw2,fm,entr,  &
@@ -16,31 +16,30 @@
       IMPLICIT NONE
       
+! arguments
+      INTEGER, intent(in) :: ngrid,nlay
+      REAL, intent(in) :: ptimestep
+      REAL, intent(in), dimension(ngrid,nlay) :: masse
+      INTEGER, intent(in), dimension(ngrid) :: lalim,lmax
+      REAL, intent(in), dimension(ngrid,nlay) :: alim_star,entr_star,detr_star
+      REAL, intent(in), dimension(ngrid) :: f
+      REAL, intent(in), dimension(ngrid,nlay) :: rhobarz
+      REAL, intent(in), dimension(ngrid,nlay+1) :: zw2,zlev
+! FH : laisser ca le temps de verifier qu'on a bien fait de commenter les
+!      lignes faisant apparaitre zqla, zmax ...
+!     REAL, intent(in), dimension(ngrid) :: zmax(ngrid)
+!     enlever aussi zqla
+      REAL, intent(in), dimension(ngrid,nlay) :: zqla  ! not used
+      integer, intent(in) :: lev_out, lunout1
+
+      REAL,intent(out), dimension(ngrid,nlay) :: entr,detr
+      REAL,intent(out), dimension(ngrid,nlay+1) :: fm
+
+! local
       INTEGER ig,l
-      INTEGER ngrid,klev
-      
-      REAL alim_star(ngrid,klev),entr_star(ngrid,klev)
-      REAL detr_star(ngrid,klev)
-      REAL zw2(ngrid,klev+1)
-      REAL zlev(ngrid,klev+1)
-      REAL masse(ngrid,klev)
-      REAL ptimestep
-      REAL rhobarz(ngrid,klev)
-      REAL f(ngrid)
-      INTEGER lmax(ngrid)
-      INTEGER lalim(ngrid)
-      REAL zqla(ngrid,klev)
-      REAL zmax(ngrid)
-
+      integer igout,lout
+      REAL zfm
       integer ncorecfm1,ncorecfm2,ncorecfm3,ncorecalpha
       integer ncorecfm4,ncorecfm5,ncorecfm6,ncorecfm7,ncorecfm8
       
-
-      REAL entr(ngrid,klev),detr(ngrid,klev)
-      REAL fm(ngrid,klev+1)
-      REAL zfm
-
-      integer igout,lout
-      integer lev_out
-      integer lunout1
 
       REAL f_old,ddd0,eee0,ddd,eee,zzz
@@ -90,5 +89,5 @@
 
       if (check_debug) then
-      do l=1,klev
+      do l=1,nlay
          do ig=1,ngrid
             if (l.le.lmax(ig)) then
@@ -118,5 +117,5 @@
 !-------------------------------------------------------------------------
 
-      do l=1,klev
+      do l=1,nlay
          entr(:,l)=f(:)*(entr_star(:,l)+alim_star(:,l))
          detr(:,l)=f(:)*detr_star(:,l)
@@ -135,5 +134,5 @@
 
       fm(:,1)=0.
-      do l=1,klev
+      do l=1,nlay
          do ig=1,ngrid
             if (l.lt.lmax(ig)) then
@@ -154,5 +153,5 @@
 ! autres corrections.
 
-      do l=1,klev
+      do l=1,nlay
          do ig=1,ngrid
             if (detr(ig,l).gt.fm(ig,l)) then
@@ -164,5 +163,5 @@
 
 !      if (prt_level.ge.10) &
-!    &    call printflux(ngrid,klev,lunout1,igout,f,lmax,lalim, &
+!    &    call printflux(ngrid,nlay,lunout1,igout,f,lmax,lalim, &
 !    &    ptimestep,masse,entr,detr,fm,'2  ')
 
@@ -178,5 +177,5 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-      do l=1,klev
+      do l=1,nlay
 
          do ig=1,ngrid
@@ -196,5 +195,5 @@
 !-------------------------------------------------------------------------
 
-!     do l=1,klev
+!     do l=1,nlay
          do ig=1,ngrid
             if (fm(ig,l+1).lt.0.) then
@@ -215,5 +214,5 @@
 !-------------------------------------------------------------------------
       if (iflag_thermals_optflux==0) then 
-!     do l=1,klev
+!     do l=1,nlay
          do ig=1,ngrid
           if (l.ge.lalim(ig).and.l.le.lmax(ig) &
@@ -241,5 +240,5 @@
 !-------------------------------------------------------------------------
       if (iflag_thermals_optflux==0) then
-!     do l=1,klev
+!     do l=1,nlay
          do ig=1,ngrid
             if ((fm(ig,l+1).gt.fm(ig,l)).and.(l.gt.lalim(ig))) then
@@ -264,5 +263,5 @@
       if(1.eq.1) then
 
-!     do l=1,klev
+!     do l=1,nlay
 
 
@@ -337,5 +336,5 @@
 !-------------------------------------------------------------------------
 
-!     do l=1,klev
+!     do l=1,nlay
          do ig=1,ngrid
             if (fm(ig,l+1).lt.0.) then
@@ -386,5 +385,5 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-!    do l=1,klev
+!    do l=1,nlay
         do ig=1,ngrid
            if (zw2(ig,l+1).gt.1.e-10) then
@@ -393,6 +392,4 @@
               f_old=fm(ig,l+1)
               fm(ig,l+1)=zfm
-!             zw2(ig,l+1)=0.
-!             zqla(ig,l+1)=0.
               detr(ig,l)=detr(ig,l)+f_old-fm(ig,l+1)
 !             lmax(ig)=l+1
@@ -415,5 +412,5 @@
 
 !      if (prt_level.ge.10) &
-!    &    call printflux(ngrid,klev,lunout1,igout,f,lmax,lalim, &
+!    &    call printflux(ngrid,nlay,lunout1,igout,f,lmax,lalim, &
 !    &    ptimestep,masse,entr,detr,fm,'8  ')
 
@@ -426,5 +423,5 @@
       if (1.eq.1) then
       labort_physic=.false.
-      do l=1,klev-1
+      do l=1,nlay-1
          do ig=1,ngrid
             eee0=entr(ig,l)
@@ -507,8 +504,8 @@
 
 !      if (prt_level.ge.10) &
-!    &    call printflux(ngrid,klev,lunout1,igout,f,lmax,lalim, &
+!    &    call printflux(ngrid,nlay,lunout1,igout,f,lmax,lalim, &
 !    &    ptimestep,masse,entr,detr,fm,'fin')
 
 
-      return
+ RETURN
       end
Index: LMDZ6/trunk/libf/phylmd/thermcell_main.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/thermcell_main.F90	(revision 4132)
+++ LMDZ6/trunk/libf/phylmd/thermcell_main.F90	(revision 4133)
@@ -61,4 +61,20 @@
 !    15 and 17 correspond to the activation of the stratocumulus "bidouille"
 !
+! Using
+!    abort_physic 
+!    iso_verif_aberrant_encadre
+!    iso_verif_egalite
+!    test_ltherm
+!    thermcell_closure
+!    thermcell_dq
+!    thermcell_dry
+!    thermcell_dv2
+!    thermcell_env
+!    thermcell_flux2
+!    thermcell_height
+!    thermcell_plume
+!    thermcell_plume_5B
+!    thermcell_plume_6A
+!
 !=======================================================================
 
@@ -75,10 +91,12 @@
       real, intent(in), dimension(ngrid,nlay)    :: pt,pu,pv,po,pplay,pphi,zpspsk
       real, intent(in), dimension(ngrid,nlay+1)  :: pplev
+      integer, intent(out), dimension(ngrid) :: lmax
       real, intent(out), dimension(ngrid,nlay)   :: pdtadj,pduadj,pdvadj,pdoadj,entr0,detr0
       real, intent(out), dimension(ngrid,nlay)   :: ztla,zqla,zqta,zqsatth,zthl
       real, intent(out), dimension(ngrid,nlay+1) :: fm0,zw2,fraca
-      real, intent(out), dimension(ngrid) :: zmax0,f0
+      real, intent(inout), dimension(ngrid) :: zmax0,f0
       real, intent(out), dimension(ngrid,nlay) :: ztva,ztv
       logical, intent(in) :: debut
+      real,intent(out), dimension(ngrid,nlay) :: ratqscth,ratqsdiff
 
       real, intent(out), dimension(ngrid) :: pcon
@@ -105,9 +123,9 @@
       logical sorties
       real, dimension(ngrid) :: linter,zmix, zmax_sec
-      integer,dimension(ngrid) :: lmax,lmin,lmix,lmix_bis,nivcon
+      integer,dimension(ngrid) :: lmin,lmix,lmix_bis,nivcon
       real, dimension(ngrid,nlay) :: ztva_est
       real, dimension(ngrid,nlay) :: deltaz,zlay,zh,zdthladj,zu,zv,zo,zl,zva,zua,zoa
       real, dimension(ngrid,nlay) :: zta,zha,q2,wq,wthl,wthv,thetath2,wth2
-      real, dimension(ngrid,nlay) :: ratqscth,ratqsdiff,rho,masse
+      real, dimension(ngrid,nlay) :: rho,masse
       real, dimension(ngrid,nlay+1) :: zw_est,zlev
       real, dimension(ngrid) :: wmax,wmax_tmp
@@ -136,5 +154,4 @@
 !   ---------------
 !
-
    fm=0. ; entr=0. ; detr=0.
 
@@ -706,4 +723,5 @@
       real seuil
       character*21 comment
+
       seuil=0.25
 
