MODULE lmdz_thermcell_dry ! $Id: lmdz_thermcell_dry.F90 5158 2024-08-02 12:12:03Z fairhead $ CONTAINS SUBROUTINE thermcell_dry(ngrid,nlay,zlev,pphi,ztv,alim_star, & lalim,lmin,zmax,wmax) !-------------------------------------------------------------------------- !thermcell_dry: calcul de zmax et wmax du thermique sec ! Calcul de la vitesse maximum et de la hauteur maximum pour un panache ! ascendant avec une fonction d'alimentation alim_star et sans changement ! de phase. ! Le calcul pourrait etre sans doute simplifier. ! La temperature potentielle virtuelle dans la panache ascendant est ! la temperature potentielle virtuelle pondérée par alim_star. !-------------------------------------------------------------------------- USE lmdz_thermcell_ini, ONLY: prt_level, RG IMPLICIT NONE INTEGER, INTENT(IN) :: ngrid,nlay REAL, INTENT(IN), DIMENSION(ngrid,nlay+1) :: zlev,pphi,ztv,alim_star INTEGER, INTENT(IN), DIMENSION(ngrid) :: lalim REAL, INTENT(OUT), DIMENSION(ngrid) :: zmax,wmax !variables locales REAL zw2(ngrid,nlay+1) REAL f_star(ngrid,nlay+1) REAL ztva(ngrid,nlay+1) REAL wmaxa(ngrid) REAL wa_moy(ngrid,nlay+1) REAL linter(ngrid),zlevinter(ngrid) INTEGER lmix(ngrid),lmax(ngrid),lmin(ngrid) CHARACTER (LEN=20) :: modname='thermcell_dry' CHARACTER (LEN=80) :: abort_message INTEGER l,ig !initialisations DO ig=1,ngrid DO l=1,nlay+1 zw2(ig,l)=0. wa_moy(ig,l)=0. enddo enddo DO ig=1,ngrid DO l=1,nlay ztva(ig,l)=ztv(ig,l) enddo enddo DO ig=1,ngrid wmax(ig)=0. wmaxa(ig)=0. enddo !calcul de la vitesse a partir de la CAPE en melangeant thetav ! Calcul des F^*, integrale verticale de E^* f_star(:,1)=0. DO l=1,nlay f_star(:,l+1)=f_star(:,l)+alim_star(:,l) enddo ! niveau (reel) auquel zw2 s'annule FH :n'etait pas initialise linter(:)=0. ! couche la plus haute concernee par le thermique. lmax(:)=1 ! Le niveau linter est une variable continue qui se trouve dans la couche ! lmax DO l=1,nlay-2 DO ig=1,ngrid IF (l==lmin(ig).AND.lalim(ig)>1) THEN !------------------------------------------------------------------------ ! Calcul de la vitesse en haut de la premiere couche instable. ! Premiere couche du panache thermique !------------------------------------------------------------------------ zw2(ig,l+1)=2.*RG*(ztv(ig,l)-ztv(ig,l+1))/ztv(ig,l+1) & *(zlev(ig,l+1)-zlev(ig,l)) & *0.4*pphi(ig,l)/(pphi(ig,l+1)-pphi(ig,l)) !------------------------------------------------------------------------ ! Tant que la vitesse en bas de la couche et la somme du flux de masse ! et de l'entrainement (c'est a dire le flux de masse en haut) sont ! positifs, on calcul ! 1. le flux de masse en haut f_star(ig,l+1) ! 2. la temperature potentielle virtuelle dans la couche ztva(ig,l) ! 3. la vitesse au carré en haut zw2(ig,l+1) !------------------------------------------------------------------------ ELSE IF (zw2(ig,l)>=1e-10) THEN ztva(ig,l)=(f_star(ig,l)*ztva(ig,l-1)+alim_star(ig,l) & *ztv(ig,l))/f_star(ig,l+1) zw2(ig,l+1)=zw2(ig,l)*(f_star(ig,l)/f_star(ig,l+1))**2+ & 2.*RG*(ztva(ig,l)-ztv(ig,l))/ztv(ig,l) & *(zlev(ig,l+1)-zlev(ig,l)) endif ! determination de zmax continu par interpolation lineaire !------------------------------------------------------------------------ IF (zw2(ig,l+1)>0. .AND. zw2(ig,l+1)<1.e-10) THEN ! stop 'On tombe sur le cas particulier de thermcell_dry' ! PRINT*,'On tombe sur le cas particulier de thermcell_dry' zw2(ig,l+1)=0. linter(ig)=l+1 lmax(ig)=l endif IF (zw2(ig,l+1)<0.) THEN linter(ig)=(l*(zw2(ig,l+1)-zw2(ig,l)) & -zw2(ig,l))/(zw2(ig,l+1)-zw2(ig,l)) zw2(ig,l+1)=0. lmax(ig)=l ! endif !CR:zmax continu 06/05/12: calcul de linter quand le thermique est stoppe par le detrainement elseif (f_star(ig,l+1)<0.) THEN linter(ig)=(l*(f_star(ig,l+1)-f_star(ig,l)) & -f_star(ig,l))/(f_star(ig,l+1)-f_star(ig,l)) zw2(ig,l+1)=0. lmax(ig)=l endif !CRfin wa_moy(ig,l+1)=sqrt(zw2(ig,l+1)) IF (wa_moy(ig,l+1)>wmaxa(ig)) THEN ! lmix est le niveau de la couche ou w (wa_moy) est maximum lmix(ig)=l+1 wmaxa(ig)=wa_moy(ig,l+1) endif enddo enddo IF (prt_level>=1) PRINT*,'fin calcul zw2' ! Determination de zw2 max DO ig=1,ngrid wmax(ig)=0. enddo DO l=1,nlay DO ig=1,ngrid IF (l<=lmax(ig)) THEN zw2(ig,l)=sqrt(zw2(ig,l)) wmax(ig)=max(wmax(ig),zw2(ig,l)) else zw2(ig,l)=0. endif enddo enddo ! Longueur caracteristique correspondant a la hauteur des thermiques. DO ig=1,ngrid zmax(ig)=0. zlevinter(ig)=zlev(ig,1) enddo DO ig=1,ngrid ! calcul de zlevinter zlevinter(ig)=zlev(ig,lmax(ig)) + & (linter(ig)-lmax(ig))*(zlev(ig,lmax(ig)+1)-zlev(ig,lmax(ig))) zmax(ig)=max(zmax(ig),zlevinter(ig)-zlev(ig,lmin(ig))) enddo RETURN END END MODULE lmdz_thermcell_dry