lmdz_thermcell_qsat.f90 Source File


This file depends on

sourcefile~~lmdz_thermcell_qsat.f90~~EfferentGraph sourcefile~lmdz_thermcell_qsat.f90 lmdz_thermcell_qsat.f90 sourcefile~yoethf_mod_h.f90 yoethf_mod_h.f90 sourcefile~lmdz_thermcell_qsat.f90->sourcefile~yoethf_mod_h.f90 sourcefile~yomcst_mod_h.f90 yomcst_mod_h.f90 sourcefile~lmdz_thermcell_qsat.f90->sourcefile~yomcst_mod_h.f90

Files dependent on this one

sourcefile~~lmdz_thermcell_qsat.f90~~AfferentGraph sourcefile~lmdz_thermcell_qsat.f90 lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_plume.f90 lmdz_thermcell_plume.f90 sourcefile~lmdz_thermcell_plume.f90->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_env.f90~2 lmdz_thermcell_env.f90 sourcefile~lmdz_thermcell_env.f90~2->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_plume.f90~2 lmdz_thermcell_plume.f90 sourcefile~lmdz_thermcell_plume.f90~2->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_env.f90 lmdz_thermcell_env.f90 sourcefile~lmdz_thermcell_env.f90->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_plume_6a.f90 lmdz_thermcell_plume_6A.f90 sourcefile~lmdz_thermcell_plume_6a.f90->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_main.f90 lmdz_thermcell_main.F90 sourcefile~lmdz_thermcell_main.f90->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_main.f90->sourcefile~lmdz_thermcell_plume.f90 sourcefile~lmdz_thermcell_main.f90->sourcefile~lmdz_thermcell_env.f90 sourcefile~lmdz_thermcell_main.f90->sourcefile~lmdz_thermcell_plume_6a.f90 sourcefile~lmdz_thermcell_main.f90~2 lmdz_thermcell_main.F90 sourcefile~lmdz_thermcell_main.f90~2->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_main.f90~2->sourcefile~lmdz_thermcell_plume.f90 sourcefile~lmdz_thermcell_main.f90~2->sourcefile~lmdz_thermcell_env.f90 sourcefile~lmdz_thermcell_main.f90~2->sourcefile~lmdz_thermcell_plume_6a.f90 sourcefile~lmdz_thermcell_plume_6a.f90~2 lmdz_thermcell_plume_6A.f90 sourcefile~lmdz_thermcell_plume_6a.f90~2->sourcefile~lmdz_thermcell_qsat.f90 sourcefile~lmdz_thermcell_alp.f90 lmdz_thermcell_alp.f90 sourcefile~lmdz_thermcell_alp.f90->sourcefile~lmdz_thermcell_main.f90 sourcefile~calltherm_mod.f90 calltherm_mod.F90 sourcefile~calltherm_mod.f90->sourcefile~lmdz_thermcell_main.f90 sourcefile~calltherm_mod.f90->sourcefile~lmdz_thermcell_alp.f90 sourcefile~calltherm_mod.f90~2 calltherm_mod.F90 sourcefile~calltherm_mod.f90~2->sourcefile~lmdz_thermcell_main.f90 sourcefile~calltherm_mod.f90~2->sourcefile~lmdz_thermcell_alp.f90 sourcefile~lmdz_thermcell_alp.f90~2 lmdz_thermcell_alp.f90 sourcefile~lmdz_thermcell_alp.f90~2->sourcefile~lmdz_thermcell_main.f90 sourcefile~physiq_mod.f90 physiq_mod.F90 sourcefile~physiq_mod.f90->sourcefile~calltherm_mod.f90 sourcefile~physiq_mod.f90~2 physiq_mod.F90 sourcefile~physiq_mod.f90~2->sourcefile~calltherm_mod.f90 sourcefile~old_lmdz1d.f90 old_lmdz1d.f90 sourcefile~old_lmdz1d.f90->sourcefile~physiq_mod.f90 sourcefile~scm.f90 scm.f90 sourcefile~scm.f90->sourcefile~physiq_mod.f90 sourcefile~callphysiq_mod.f90 callphysiq_mod.f90 sourcefile~callphysiq_mod.f90->sourcefile~physiq_mod.f90 sourcefile~callphysiq_mod.f90~2 callphysiq_mod.f90 sourcefile~callphysiq_mod.f90~2->sourcefile~physiq_mod.f90 sourcefile~calfis.f90 calfis.f90 sourcefile~calfis.f90->sourcefile~callphysiq_mod.f90

Contents


Source Code

MODULE lmdz_thermcell_qsat

  REAL, PARAMETER :: DDT0=.01

CONTAINS

subroutine thermcell_qsat(klon, nlev, active,pplev,ztemp,zqta,zqsat)
USE yoethf_mod_h
  USE yomcst_mod_h


implicit none


  INCLUDE "FCTTRE.h"


!====================================================================
! DECLARATIONS
!====================================================================

! Arguments
INTEGER, INTENT(IN) :: klon
INTEGER, INTENT(IN) :: nlev  ! number of vertical to apply qsat
REAL zpspsk(klon, nlev),pplev(klon, nlev)
REAL ztemp(klon, nlev),zqta(klon,nlev),zqsat(klon,nlev)
LOGICAL active(klon, nlev)

! Variables locales
INTEGER ig,iter
REAL Tbef(klon,nlev),DT(klon,nlev)
REAL tdelta,qsatbef,zcor,qlbef,zdelta,zcvm5,dqsat,num,denom,dqsat_dT
logical Zsat
REAL RLvCp

LOGICAL afaire(klon, nlev),tout_converge
INTEGER :: l
!====================================================================
! INITIALISATIONS
!====================================================================

RLvCp = RLVTT/RCPD
tout_converge=.false.
afaire(:,:)=.false.
DT(:,:)=0.


!====================================================================
! Routine a vectoriser en copiant active dans converge et en mettant
! la boucle sur les iterations a l'exterieur est en mettant
! converge= false des que la convergence est atteinte.
!====================================================================
do l=1,nlev
  do ig=1,klon
     if (active(ig,l)) then
               Tbef(ig,l)=ztemp(ig,l)
               zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig,l)))
               qsatbef= R2ES * FOEEW(Tbef(ig,l),zdelta)/pplev(ig,l)
               qsatbef=MIN(0.5,qsatbef)
               zcor=1./(1.-retv*qsatbef)
               qsatbef=qsatbef*zcor
               qlbef=max(0.,zqta(ig,l)-qsatbef)
               DT(ig,l) = 0.5*RLvCp*qlbef
               zqsat(ig,l)=qsatbef
     endif
  enddo
enddo
! Traitement du cas ou il y a condensation mais faible
! On ne condense pas mais on dit que le qsat est le qta
do l=1,nlev
  do ig=1,klon
     if (active(ig,l)) then
       if (0.<abs(DT(ig,l)).and.abs(DT(ig,l))<=DDT0) then
           zqsat(ig,l)=zqta(ig,l)
        endif
     endif
  enddo
enddo

do iter=1,10
    do l=1,nlev
      afaire(:,l)=abs(DT(:,l)).gt.DDT0
      do ig=1,klon
               if (afaire(ig,l)) then
                 Tbef(ig,l)=Tbef(ig,l)+DT(ig,l)
                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig,l)))
                 qsatbef= R2ES * FOEEW(Tbef(ig,l),zdelta)/pplev(ig,l)
                 qsatbef=MIN(0.5,qsatbef)
                 zcor=1./(1.-retv*qsatbef)
                 qsatbef=qsatbef*zcor
                 qlbef=zqta(ig,l)-qsatbef
                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig,l)))
                 zcvm5=R5LES*(1.-zdelta) + R5IES*zdelta
                 zcor=1./(1.-retv*qsatbef)
                 dqsat_dT=FOEDE(Tbef(ig,l),zdelta,zcvm5,qsatbef,zcor)
                 num=-Tbef(ig,l)+ztemp(ig,l)+RLvCp*qlbef
                 denom=1.+RLvCp*dqsat_dT
                 zqsat(ig,l) = qsatbef
                 DT(ig,l)=num/denom
               endif
      enddo
    enddo
enddo

return
end subroutine thermcell_qsat
END MODULE lmdz_thermcell_qsat