Index: branches/LMDZ_WRFmeas/WRFV3/lmdz/thermcell_main.F90
===================================================================
--- branches/LMDZ_WRFmeas/WRFV3/lmdz/thermcell_main.F90	(revision 138)
+++ branches/LMDZ_WRFmeas/WRFV3/lmdz/thermcell_main.F90	(revision 139)
@@ -251,13 +251,4 @@
 !
 
-! Lluis
-      INTEGER                                            :: llp
-      CHARACTER(LEN=50)                                  :: lvarname, lfname
-      REAL                                               :: largest
-
-      llp = 734
-      lfname = 'physiq'
-      largest = 10.e5
-
 ! L. Fita, LMD July 2014. Initializing variables. 
 !   Some not initializated according to values: iflag_trig_bl, iflag_clos_bl
@@ -355,23 +346,7 @@
 !   --------------------------------------------------------------------
 !
-      lfname='thermcell_main before thermcell_env'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pplev'
-      CALL check_var3D(lfname, lvarname, pplev, ngrid, nlay, largest, .FALSE.)
-
       CALL thermcell_env(ngrid,nlay,po,pt,pu,pv,pplay,  &
      &           pplev,zo,zh,zl,ztv,zthl,zu,zv,zpspsk,zqsat,lev_out)
 
-      lfname='thermcell_main after thermcell_env'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pplev'
-      CALL check_var3D(lfname, lvarname, pplev, ngrid, nlay, largest, .FALSE.)
-       
       if (prt_level.ge.1) print*,'thermcell_main apres thermcell_env'
 
@@ -430,16 +405,4 @@
          masse(:,l)=(pplev(:,l)-pplev(:,l+1))/RG
       enddo
-
-      lfname='thermcell_main after initialization'
-      lvarname = 'rhobarz'
-      CALL check_var3D(lfname, lvarname, rhobarz, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'rho'
-      CALL check_var3D(lfname, lvarname, rho, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zpspsk'
-      CALL check_var3D(lfname, lvarname, zpspsk, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pplay'
-      CALL check_var3D(lfname, lvarname, pplay, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay+1, largest, .FALSE.)
 
       if (prt_level.ge.1) print*,'thermcell_main apres initialisation'
@@ -521,7 +484,4 @@
 ! Gestion temporaire de plusieurs appels à thermcell_plume au travers
 ! de la variable iflag_thermals
-      lfname='thermcell_main before plume'
-      lvarname = 'alim_star'
-      CALL check_var3D(lfname, lvarname, alim_star, ngrid, nlay, largest, .FALSE.)
 
 !      print*,'THERM thermcell_main iflag_thermals_ed=',iflag_thermals_ed
@@ -543,13 +503,4 @@
 
       endif
-      lfname='thermcell_main after thermcell_plume'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay+1, largest, .FALSE.)
-      lvarname = 'alim_star'
-      CALL check_var3D(lfname, lvarname, alim_star, ngrid, nlay, largest, .FALSE.)
 
       if (prt_level.ge.1) print*,'apres thermcell_plume ',lev_out
@@ -582,8 +533,4 @@
 !     print*,"ZMAX ",lalim,lmin,linter,lmix,lmax,zmax,zmax0,zmix,wmax
 
-      lfname='thermcell_main after thermcell_height'
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay+1, largest, .FALSE.)
-
       call test_ltherm(ngrid,nlay,pplev,pplay,lalim,seuil,ztv,po,ztva,zqla,f_star,zw2,'thermcell_heig lalim ')
       call test_ltherm(ngrid,nlay,pplev,pplay,lmin ,seuil,ztv,po,ztva,zqla,f_star,zw2,'thermcell_heig lmin  ')
@@ -615,10 +562,4 @@
       endif
 
-      lfname='thermcell_main after thermcell_dry'
-      lvarname = 'alim_star'
-      CALL check_var3D(lfname, lvarname, alim_star, ngrid, nlay, largest, .FALSE.)
-
-
-
 ! Choix de la fonction d'alimentation utilisee pour la fermeture.
 ! Apparemment sans importance
@@ -655,18 +596,4 @@
 !deduction des flux
 !-------------------------------------------------------------------------------
-      lfname='thermcell_main before flux'
-      lvarname = 'fm'
-      CALL check_var3D(lfname, lvarname, fm, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'entr'
-      CALL check_var3D(lfname, lvarname, entr, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'detr'
-      CALL check_var3D(lfname, lvarname, detr, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zqla'
-      CALL check_var3D(lfname, lvarname, zqla, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay+1, largest, .FALSE.)
-      lvarname = 'alim_star'
-      CALL check_var3D(lfname, lvarname, alim_star, ngrid, nlay, largest, .FALSE.)
-
       CALL thermcell_flux2(ngrid,nlay,ptimestep,masse, &
      &       lalim,lmax,alim_star,  &
@@ -674,11 +601,4 @@
      &       detr,zqla,lev_out,lunout1,igout)
 !IM 060508    &       detr,zqla,zmax,lev_out,lunout,igout)
-      lfname='thermcell_main after flux'
-      lvarname = 'fm'
-      CALL check_var3D(lfname, lvarname, fm, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay+1, largest, .FALSE.)
-      lvarname = 'alim_star'
-      CALL check_var3D(lfname, lvarname, alim_star, ngrid, nlay, largest, .FALSE.)
 
       if (prt_level.ge.1) print*,'thermcell_main apres thermcell_flux'
@@ -707,24 +627,8 @@
 !------------------------------------------------------------------
 
-      lfname='thermcell_main before transport_vertical'
-      lvarname = 'zdthladj'
-      CALL check_var3D(lfname, lvarname, zdthladj, ngrid, nlay, largest, .FALSE.)
-
       call thermcell_dq(ngrid,nlay,dqimpl,ptimestep,fm0,entr0,masse,  &
      &                    zthl,zdthladj,zta,lev_out)
       call thermcell_dq(ngrid,nlay,dqimpl,ptimestep,fm0,entr0,masse,  &
      &                   po,pdoadj,zoa,lev_out)
-      lfname='thermcell_main after transport_vertical'
-      lvarname = 'zdthladj'
-      CALL check_var3D(lfname, lvarname, zdthladj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'masse'
-      CALL check_var3D(lfname, lvarname, masse, ngrid, nlay, largest, .FALSE.)
-
-      lfname='thermcell_main before fraction ascendance'
-      lvarname = 'fm'
-      CALL check_var3D(lfname, lvarname, fm, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay+1, largest, .FALSE.)
-
 !------------------------------------------------------------------
 ! Calcul de la fraction de l'ascendance
@@ -747,15 +651,4 @@
 !  calcul du transport vertical du moment horizontal
 !------------------------------------------------------------------
-      lfname='before thermcell_dv2'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay+1, largest, .FALSE.)
-      lvarname = 'rhobarz'
-      CALL check_var3D(lfname, lvarname, rhobarz, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'fraca'
-      CALL check_var3D(lfname, lvarname, fraca, ngrid, nlay+1, largest, .FALSE.)
 
 !IM 090508  
@@ -786,17 +679,4 @@
          enddo
       enddo
-      lfname='after thermcell_dv2'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zdthladj'
-      CALL check_var3D(lfname, lvarname, zdthladj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zpspsk'
-      CALL check_var3D(lfname, lvarname, zpspsk, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pduadj'
-      CALL check_var3D(lfname, lvarname, pduadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdvadj'
-      CALL check_var3D(lfname, lvarname, pdvadj, ngrid, nlay, largest, .FALSE.)
 
       if (prt_level.ge.1) print*,'14 OK convect8'
@@ -883,13 +763,5 @@
          enddo
       enddo
-      lfname='thermcell_main calculation of wth3'
-      lvarname = 'wth3'
-      CALL check_var3D(lfname, lvarname, wth3, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'fraca'
-      CALL check_var3D(lfname, lvarname, fraca, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'zw2'
-      CALL check_var3D(lfname, lvarname, zw2, ngrid, nlay, largest, .FALSE.)
-      lvarname = '1-fraca'
-      CALL check_var3D(lfname, lvarname, 1./(1.-fraca), ngrid, nlay, largest, .FALSE.)
+
 !calcul des flux: q, thetal et thetav
       do l=1,nlay
@@ -918,27 +790,10 @@
           if ((pplay(ig,l).ge.pcon(ig)) .and. (pplay(ig,l+1).le.pcon(ig)) .and.      &
             (klcl(ig).gt.0).and.(klcl(ig)+1.le.nlay-1) .and. (klcl(ig)+1.gt.0) ) then
-!            (pplay(ig,klcl(ig)+1)-pplay(ig,klcl(ig)).ne.0.) ) then
             klcl(ig)=l
             interp(ig)=(pcon(ig)-pplay(ig,klcl(ig)))/(pplay(ig,klcl(ig)+1)-pplay(ig,klcl(ig)))
-            IF (interp(ig) /= interp(ig)) THEN
-              PRINT *,'  Lluis wrong interp= ',interp(ig),' at ', ig,' klcl(ig): ',  &
-                klcl(ig),' klcl(ig)+1: ', klcl(ig)+1
-            END IF
           endif
         endif
       enddo
     enddo
-      lfname='thermcell_main calculation of LCL'
-      lvarname = 'interp'
-      CALL check_var3D(lfname, lvarname, interp, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'klcl'
-      CALL check_var(lfname, lvarname, REAL(klcl), ngrid, largest, .FALSE.)
-      lvarname = 'pcon'
-      CALL check_var(lfname, lvarname, pcon, ngrid, largest, .FALSE.)
-      lvarname = 'pplay'
-      CALL check_var3D(lfname, lvarname, pplay, ngrid, nlay, largest, .FALSE.)
-      lvarname = '1/pplay'
-      CALL check_var3D(lfname, lvarname, 1./pplay, ngrid, nlay, largest, .FALSE.)
-
 
 !------------Hauteur des thermiques
@@ -967,19 +822,4 @@
     enddo
 !!jyg fin
-      lfname='thermcell_main before LCL'
-      lvarname = 'rhobarz0'
-      CALL check_var(lfname, lvarname, rhobarz0, ngrid, largest, .FALSE.)
-      lvarname = 'pcon'
-      CALL check_var(lfname, lvarname, pcon, ngrid, largest, .FALSE.)
-      lvarname = 'fraca'
-      CALL check_var3D(lfname, lvarname, fraca, ngrid, nlay+1, largest, .FALSE.)
-      lvarname = 'fraca0'
-      CALL check_var(lfname, lvarname, fraca0, ngrid, largest, .FALSE.)
-      lvarname = 'w_conv'
-      CALL check_var(lfname, lvarname, w_conv, ngrid, largest, .FALSE.)
-      lvarname = 'interp'
-      CALL check_var(lfname, lvarname, interp, ngrid, largest, .FALSE.)
-      lvarname = 'zlcl'
-      CALL check_var(lfname, lvarname, zlcl, ngrid, largest, .FALSE.)
 
 !------------Calcul des propriétés du thermique au LCL 
@@ -1029,21 +869,8 @@
      fraca0(ig)=fraca(ig,klcl(ig))+(fraca(ig,klcl(ig)+1) &
  &             -fraca(ig,klcl(ig)))*interp(ig)
-     IF (fraca0(ig) /= fraca0(ig) .OR. ABS(fraca0(ig)) > largest*10.e5) THEN
-       PRINT *,'  Lluis wrong fraca0(ig): ',fraca0(ig),' at : ',ig
-       PRINT *,'    klcl(ig): ', klcl(ig),' klcl(ig)+1: ',klcl(ig)+1,                &
-         ' fraca(ig,klcl(ig)): ',fraca(ig,klcl(ig)),' fraca(ig,klcl(ig)+1): ',       &
-         fraca(ig,klcl(ig)+1), ' interp(ig): ',interp(ig)
-     END IF
-
      w0(ig)=zw2(ig,klcl(ig))+(zw2(ig,klcl(ig)+1) &
  &         -zw2(ig,klcl(ig)))*interp(ig)
      w_conv(ig)=w_ls(ig,klcl(ig))+(w_ls(ig,klcl(ig)+1) &
  &             -w_ls(ig,klcl(ig)))*interp(ig)
-     IF (w_conv(ig) /= w_conv(ig) .OR. ABS(w_conv(ig)) > largest*10.e5) THEN
-       PRINT *,'  Lluis wrong w_conv(ig): ',w_conv(ig),' at : ',ig
-       PRINT *,'    klcl(ig): ', klcl(ig),' klcl(ig)+1: ',klcl(ig)+1,                &
-         ' w_ls(ig,klcl(ig)): ',w_ls(ig,klcl(ig)),' w_ls(ig,klcl(ig)+1): ',          &
-         w_ls(ig,klcl(ig)+1), ' interp(ig): ',interp(ig)
-     END IF
      therm_tke_max0(ig)=therm_tke_max(ig,klcl(ig)) &
  &                     +(therm_tke_max(ig,klcl(ig)+1)-therm_tke_max(ig,klcl(ig)))*interp(ig)
@@ -1056,16 +883,4 @@
      if (pbl_tke_max0(ig).ge.20.) pbl_tke_max0(ig)=20.
    else 
-     IF (fraca0(ig) /= fraca0(ig) .OR. ABS(fraca0(ig)) > largest*10.e5) THEN
-       PRINT *,'  Lluis wrong fraca0(ig): ',fraca0(ig),' at : ',ig
-       PRINT *,'    klcl(ig): ', klcl(ig),' klcl(ig)+1: ',klcl(ig)+1,                &
-         ' fraca(ig,klcl(ig)): ',fraca(ig,klcl(ig)),' fraca(ig,klcl(ig)+1): ',       &
-         fraca(ig,klcl(ig)+1), ' interp(ig): ',interp(ig)
-     END IF
-     IF (w_conv(ig) /= w_conv(ig) .OR. ABS(w_conv(ig)) > largest*10.e5) THEN
-       PRINT *,'  Lluis wrong w_conv(ig): ',w_conv(ig),' at : ',ig
-       PRINT *,'    klcl(ig): ', klcl(ig),' klcl(ig)+1: ',klcl(ig)+1,                &
-         ' w_ls(ig,klcl(ig)): ',w_ls(ig,klcl(ig)),' w_ls(ig,klcl(ig)+1): ',          &
-         w_ls(ig,klcl(ig)+1), ' interp(ig): ',interp(ig)
-     END IF
      fraca0(ig)=0.
      w0(ig)=0.
@@ -1137,25 +952,4 @@
   ENDIF ! iflag_trig_bl
 !  print *,'ENDIF  iflag_trig_bl'    !!jyg
-      lfname='thermcell_main before closure'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'rhobarz0'
-      CALL check_var(lfname, lvarname, rhobarz0,ngrid, largest, .FALSE.)
-      lvarname = 'fraca0'
-      CALL check_var(lfname, lvarname, fraca0,ngrid, largest, .FALSE.)
-      lvarname = 'w_conv'
-      CALL check_var(lfname, lvarname, w_conv,ngrid, largest, .FALSE.)
-      lvarname = 'interp'
-      CALL check_var(lfname, lvarname, interp,ngrid, largest, .FALSE.)
-      lvarname = 'w0'
-      CALL check_var(lfname, lvarname, w0,ngrid, largest, .FALSE.)
-      lvarname = 'therm_tke_max0'
-      CALL check_var(lfname, lvarname, therm_tke_max0,ngrid, largest, .FALSE.)
-      lvarname = 'env_tke_max0'
-      CALL check_var(lfname, lvarname, env_tke_max0,ngrid, largest, .FALSE.)
-      lvarname = 'pbl_tke_max0'
-      CALL check_var(lfname, lvarname, pbl_tke_max0,ngrid, largest, .FALSE.)
 !------------Closure------------------
 
@@ -1184,33 +978,4 @@
 
   ENDIF ! (iflag_clos_bl.ge.1)
-      lfname='thermcell main after closure'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'alp_bl_det'
-      CALL check_var(lfname, lvarname, alp_bl_det,ngrid, largest, .FALSE.)
-      lvarname = 'rhobarz0'
-      CALL check_var(lfname, lvarname, rhobarz0,ngrid, largest, .FALSE.)
-      lvarname = 'fraca0'
-      CALL check_var(lfname, lvarname, fraca0,ngrid, largest, .FALSE.)
-      lvarname = 'w_conv'
-      CALL check_var(lfname, lvarname, w_conv,ngrid, largest, .FALSE.)
-      lvarname = 'w0'
-      CALL check_var(lfname, lvarname, w0,ngrid, largest, .FALSE.)
-      lvarname = 'alp_bl_fluct_m'
-      CALL check_var(lfname, lvarname, alp_bl_fluct_m,ngrid, largest, .FALSE.)
-      lvarname = 'alp_bl_fluct_tke'
-      CALL check_var(lfname, lvarname, alp_bl_fluct_tke,ngrid, largest, .FALSE.)
-      lvarname = 'therm_tke_max0'
-      CALL check_var(lfname, lvarname, therm_tke_max0,ngrid, largest, .FALSE.)
-      lvarname = 'env_tke_max0'
-      CALL check_var(lfname, lvarname, env_tke_max0,ngrid, largest, .FALSE.)
-      lvarname = 'pbl_tke_max0'
-      CALL check_var(lfname, lvarname, pbl_tke_max0,ngrid, largest, .FALSE.)
-      lvarname = 'alp_bl_conv'
-      CALL check_var(lfname, lvarname, alp_bl_conv,ngrid, largest, .FALSE.)
-      lvarname = 'alp_bl_stat'
-      CALL check_var(lfname, lvarname, alp_bl_stat,ngrid, largest, .FALSE.)
 
 !!! fin nrlmd le 10/04/2012
@@ -1249,15 +1014,4 @@
          enddo
       enddo
-      lfname='after calculation of Al[p/e]_bl'
-      lvarname = 'fm'
-      CALL check_var3D(lfname, lvarname, fm, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'rhobarz'
-      CALL check_var3D(lfname, lvarname, rhobarz, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'wth3'
-      CALL check_var3D(lfname, lvarname, wth3, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'Alp_bl'
-      CALL check_var(lfname, lvarname, Alp_bl, ngrid, largest, .FALSE.)
-      lvarname = 'Ale_bl'
-      CALL check_var(lfname, lvarname, Ale_bl, ngrid, largest, .FALSE.)
 
 ! assez bizarre car, si on est dans la couche d'alim et que alim_star et
@@ -1314,14 +1068,4 @@
       Alp_bl(:)=alp_bl_k*Alp_bl(:)
 
-      lfname='thermcell_main last computations on Alp_bl'
-      lvarname = 'pplay'
-      CALL check_var3D(lfname, lvarname, pplay, ngrid, nlay, largest*10.e4, .FALSE.)
-      lvarname = 'alp_int'
-      CALL check_var(lfname, lvarname, alp_int, ngrid, largest*10.e4, .FALSE.)
-      lvarname = 'dp_int'
-      CALL check_var(lfname, lvarname, dp_int, ngrid, largest, .FALSE.)
-      lvarname = 'Alp_bl'
-      CALL check_var(lfname, lvarname, Alp_bl, ngrid, largest, .FALSE.)
-
 !------------------------------------------------------------------------
 
@@ -1373,15 +1117,4 @@
 
       if (prt_level.ge.1) print*,'thermcell_main FIN  OK'
-
-      lfname='before leaving thermcell_main'
-      lvarname = 'pt'
-      CALL check_var3D(lfname, lvarname, pt, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'pdtadj'
-      CALL check_var3D(lfname, lvarname, pdtadj, ngrid, nlay, largest, .FALSE.)
-      lvarname = 'Alp_bl'
-      CALL check_var(lfname, lvarname, Alp_bl, ngrid, largest, .FALSE.)
-      lvarname = 'Ale_bl'
-      CALL check_var(lfname, lvarname, Ale_bl, ngrid, largest, .FALSE.)
-
 
       return
