Ignore:
Timestamp:
Sep 17, 2023, 1:16:26 PM (10 months ago)
Author:
fhourdin
Message:

Preparation/test de convergence num en temps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/lmdz_thermcell_main.F90

    r4684 r4690  
    44! A REGARDER !!!!!!!!!!!!!!!!!
    55! ATTENTION : zpspsk est inout et out mais c'est pas forcement pour de bonnes raisons (FH, 2023)
     6! ATTENTION : dans thermcell_env, on condense potentiellement de l'eau. Mais comme on ne mélange pas l'eau liquide supposant qu'il n'y en n'a pas, c'est potentiellement un souci
    67CONTAINS
    78
    89      subroutine thermcell_main(itap,ngrid,nlay,ptimestep  &
    910     &                  ,pplay,pplev,pphi,debut  &
    10      &                  ,puwind,pvwind,ptemp,p_o  &
     11     &                  ,puwind,pvwind,ptemp,p_o,ptemp_env, po_env  &
    1112     &                  ,pduadj,pdvadj,pdtadj,pdoadj  &
    1213     &                  ,fm0,entr0,detr0,zqta,zqla,lmax  &
     
    2122
    2223
     24
     25! USE necessaires pour les lignes importees de thermcell_env
    2326      USE lmdz_thermcell_ini, ONLY: thermcell_ini,dqimpl,dvdq,prt_level,lunout,prt_level
    2427      USE lmdz_thermcell_ini, ONLY: iflag_thermals_closure,iflag_thermals_ed,tau_thermals,r_aspect_thermals
    2528      USE lmdz_thermcell_ini, ONLY: iflag_thermals_down,fact_thermals_down
     29      USE lmdz_thermcell_ini, ONLY: iflag_thermals_tenv
    2630      USE lmdz_thermcell_ini, ONLY: RD,RG
    2731
     
    3640      USE lmdz_thermcell_plume, ONLY: thermcell_plume
    3741      USE lmdz_thermcell_plume_6A, ONLY: thermcell_plume_6A,thermcell_plume_5B
     42
     43! USE necessaires pour les lignes importees de thermcell_env
     44   USE lmdz_thermcell_ini, ONLY : RLvCp,RKAPPA,RETV
     45   USE lmdz_thermcell_qsat, ONLY : thermcell_qsat
     46
    3847
    3948#ifdef ISO
     
    105114      integer, intent(in) :: itap,ngrid,nlay
    106115      real, intent(in) ::  ptimestep
    107       real, intent(in), dimension(ngrid,nlay)    :: ptemp,puwind,pvwind,pplay,pphi
     116      real, intent(in), dimension(ngrid,nlay)    :: ptemp,puwind,pvwind,pplay,pphi,ptemp_env,po_env
    108117! ATTENTION : zpspsk est inout et out mais c'est pas forcement pour de bonnes raisons (FH, 2023)
    109118      real, intent(in), dimension(ngrid,nlay)    :: p_o
     
    144153      integer,dimension(ngrid) :: lmin,lmix,lmix_bis,nivcon
    145154      real, dimension(ngrid,nlay) :: ztva_est
    146       real, dimension(ngrid,nlay) :: deltaz,zlay,zh,zdthladj,zu,zv,z_o,zl,zva,zua,z_oa
     155      real, dimension(ngrid,nlay) :: deltaz,zlay,zdthladj,zu,zv,z_o,zl,zva,zua,z_oa
     156      real, dimension(ngrid,nlay) :: ztemp_env ! temperarure liquide de l'environnement
    147157      real, dimension(ngrid,nlay) :: zta,zha,q2,wq,wthl,wthv,thetath2,wth2
    148158      real, dimension(ngrid,nlay) :: rho,masse
     
    154164      real, dimension(ngrid) :: zcon,zcon2,alim_star_tot,f
    155165      real, dimension(ngrid,nlay) :: entrdn,detrdn
     166      logical, dimension(ngrid,nlay) :: mask
    156167
    157168      character (len=20) :: modname='thermcell_main'
     
    199210       enddo
    200211      endif
     212
    201213!-----------------------------------------------------------------------
    202214! Calcul de T,q,ql a partir de Tl et qT dans l environnement
    203215!   --------------------------------------------------------------------
    204216!
    205       CALL thermcell_env(ngrid,nlay,p_o,ptemp,puwind,pvwind,pplay,  &
    206      &           pplev,z_o,zh,zl,ztv,zthl,zu,zv,zpspsk,zqsat,lev_out)
     217          ! On condense l'eau liquide si besoin.
     218          ! En fait on arrive ici d'habitude (jusque 6A) après réévaporation
     219          ! Dans une nouvelle mouture, on passe les profiles
     220          ! avant la couche limite : iflag_thermals_tenv=1
     221          !     dés le début de la physique : iflag_thermals_tenv=2
     222          ! Mais même pour 2) on ne veut sans doute pas réévaporer.
     223          ! On veut comparer thetav dans le thermique, après condensation,
     224          ! avec le theta_v effectif de l'environnement.
     225
     226      if (iflag_thermals_tenv - 10 * ( iflag_thermals_tenv / 10 ) == 0) then
     227
     228          CALL thermcell_env(ngrid,nlay,p_o,ptemp_env,puwind,pvwind,pplay,  &
     229         &           pplev,z_o,ztemp_env,zl,ztv,zthl,zu,zv,zpspsk,zqsat,lev_out)
     230
     231      else
     232
     233        ! Chantier en cours : ne pas effacer (Fredho). 15 septembre 2023
     234        ! Dans la version originale de thermcell_env, on condense l'eau de l'environnement
     235        ! pour calculer une temperature potentielle liquide.
     236        ! On en déduit un Theta v.
     237
     238 ! ...
     239        ! contenu de thermcell_env
     240        !    SUBROUTINE thermcell_env(ngrid,nlay,po,pt,pu,pv,pplay,  &
     241        ! &           pplev,zo,zh,zl,ztv,zthl,zu,zv,zpspsk,pqsat,lev_out)
     242        ! contenu thermcell_env : call thermcell_qsat(ngrid*nlay,mask,pplev,pt,po,pqsat)
     243        ! contenu thermcell_env : do ll=1,nlay
     244        ! contenu thermcell_env :    do ig=1,ngrid
     245        ! contenu thermcell_env :       zl(ig,ll) = max(0.,po(ig,ll)-pqsat(ig,ll))
     246        ! contenu thermcell_env :       zh(ig,ll) = pt(ig,ll)+RLvCp*zl(ig,ll)         !   T = Tl + Lv/Cp ql
     247        ! contenu thermcell_env :       zo(ig,ll) = po(ig,ll)-zl(ig,ll)
     248        ! contenu thermcell_env :    enddo
     249        ! contenu thermcell_env : enddo
     250        ! contenu thermcell_env : do ll=1,nlay
     251        ! contenu thermcell_env :    do ig=1,ngrid
     252        ! contenu thermcell_env :        zpspsk(ig,ll)=(pplay(ig,ll)/100000.)**RKAPPA
     253        ! contenu thermcell_env :        zu(ig,ll)=pu(ig,ll)
     254        ! contenu thermcell_env :        zv(ig,ll)=pv(ig,ll)
     255        ! contenu thermcell_env :          ztv(ig,ll)=zh(ig,ll)/zpspsk(ig,ll)
     256        ! contenu thermcell_env :          ztv(ig,ll)=ztv(ig,ll)*(1.+RETV*(zo(ig,ll))-zl(ig,ll))
     257        ! contenu thermcell_env :          zthl(ig,ll)=pt(ig,ll)/zpspsk(ig,ll)
     258        ! contenu thermcell_env :    enddo
     259        ! contenu thermcell_env : enddo
     260
     261        do l=1,nlay
     262            do ig=1,ngrid
     263                 zl(ig,l)=0.
     264                 zu(ig,l)=puwind(ig,l)
     265                 zv(ig,l)=pvwind(ig,l)
     266                 ztemp_env(ig,l)=ptemp_env(ig,l)
     267                 zpspsk(ig,l)=(pplay(ig,l)/100000.)**RKAPPA
     268                 ztv(ig,l)=ztemp_env(ig,l)/zpspsk(ig,l)
     269                 ztv(ig,l)=ztv(ig,l)*(1.+RETV*po_env(ig,l))
     270                 zthl(ig,l)=ptemp(ig,l)/zpspsk(ig,l)
     271                 mask(ig,l)=.true.
     272            enddo
     273        enddo
     274        call thermcell_qsat(ngrid*nlay,mask,pplev,ptemp_env,p_o,zqsat)
     275         
     276      endif
    207277       
    208278      if (prt_level.ge.1) print*,'thermcell_main apres thermcell_env'
     
    532602      !--------------------------------------------------------------
    533603
     604        ! Temperature potentielle liquide effectivement mélangée par les thermiques
     605        do ll=1,nlay
     606           do ig=1,ngrid
     607              zthl(ig,ll)=ptemp(ig,ll)/zpspsk(ig,ll)
     608           enddo
     609        enddo
    534610        call thermcell_dq(ngrid,nlay,dqimpl,ptimestep,fm0,entr0,masse,  &
    535611        &                    zthl,zdthladj,zta,lev_out)
     
    632708!nouveau calcul
    633709      do ig=1,ngrid
    634       CHI=zh(ig,1)/(1669.0-122.0*z_o(ig,1)/zqsat(ig,1)-zh(ig,1))
     710      ! WARNING !!! verifier que c'est bien ztemp_env qu'on veut là
     711      CHI=ztemp_env(ig,1)/(1669.0-122.0*z_o(ig,1)/zqsat(ig,1)-ztemp_env(ig,1))
    635712      pcon(ig)=pplay(ig,1)*(z_o(ig,1)/zqsat(ig,1))**CHI
    636713      enddo
Note: See TracChangeset for help on using the changeset viewer.