source: LMDZ6/branches/Portage_acc/libf/phylmd/lmdz_thermcell_qsat.F90 @ 5004

Last change on this file since 5004 was 4743, checked in by Laurent Fairhead, 8 months ago

Merge of ACC branch with 4740 revision from trunk

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 2.8 KB
RevLine 
[4590]1MODULE lmdz_thermcell_qsat
2CONTAINS
3
[1338]4subroutine thermcell_qsat(klon,active,pplev,ztemp,zqta,zqsat)
[1336]5implicit none
6
[4593]7  INCLUDE "YOMCST.h"
8  INCLUDE "YOETHF.h"
9  INCLUDE "FCTTRE.h"
[1336]10
[1338]11
[1336]12!====================================================================
13! DECLARATIONS
14!====================================================================
15
16! Arguments
17INTEGER klon
[1338]18REAL zpspsk(klon),pplev(klon)
19REAL ztemp(klon),zqta(klon),zqsat(klon)
20LOGICAL active(klon)
[1336]21
22! Variables locales
23INTEGER ig,iter
24REAL Tbef(klon),DT(klon)
[1338]25REAL tdelta,qsatbef,zcor,qlbef,zdelta,zcvm5,dqsat,num,denom,dqsat_dT
[1336]26logical Zsat
27REAL RLvCp
[3035]28
[1336]29REAL, SAVE :: DDT0=.01
[3035]30!$OMP THREADPRIVATE(DDT0)
31
[1336]32LOGICAL afaire(klon),tout_converge
33
34!====================================================================
35! INITIALISATIONS
36!====================================================================
37
38RLvCp = RLVTT/RCPD
39tout_converge=.false.
[1338]40afaire(:)=.false.
[1336]41DT(:)=0.
42
43
44!====================================================================
[1338]45! Routine a vectoriser en copiant active dans converge et en mettant
[1336]46! la boucle sur les iterations a l'exterieur est en mettant
47! converge= false des que la convergence est atteinte.
48!====================================================================
49
50do ig=1,klon
[1338]51   if (active(ig)) then
52               Tbef(ig)=ztemp(ig)
[1336]53               zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
[1338]54               qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig)
55               qsatbef=MIN(0.5,qsatbef)
56               zcor=1./(1.-retv*qsatbef)
57               qsatbef=qsatbef*zcor
58               qlbef=max(0.,zqta(ig)-qsatbef)
[1336]59               DT(ig) = 0.5*RLvCp*qlbef
[1338]60               zqsat(ig)=qsatbef
[1336]61     endif
62enddo
63
[1338]64! Traitement du cas ou il y a condensation mais faible
65! On ne condense pas mais on dit que le qsat est le qta
66do ig=1,klon
67   if (active(ig)) then
68      if (0.<abs(DT(ig)).and.abs(DT(ig))<=DDT0) then
69         zqsat(ig)=zqta(ig)
70      endif
71   endif
72enddo
[1336]73
74do iter=1,10
[1338]75    afaire(:)=abs(DT(:)).gt.DDT0
[1336]76    do ig=1,klon
77               if (afaire(ig)) then
78                 Tbef(ig)=Tbef(ig)+DT(ig)
79                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
[1338]80                 qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig)
81                 qsatbef=MIN(0.5,qsatbef)
82                 zcor=1./(1.-retv*qsatbef)
83                 qsatbef=qsatbef*zcor
84                 qlbef=zqta(ig)-qsatbef
[1336]85                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
86                 zcvm5=R5LES*(1.-zdelta) + R5IES*zdelta
[1338]87                 zcor=1./(1.-retv*qsatbef)
88                 dqsat_dT=FOEDE(Tbef(ig),zdelta,zcvm5,qsatbef,zcor)
89                 num=-Tbef(ig)+ztemp(ig)+RLvCp*qlbef
[1336]90                 denom=1.+RLvCp*dqsat_dT
[1338]91                 zqsat(ig) = qsatbef
[1336]92                 DT(ig)=num/denom
93               endif
94    enddo
95enddo
96
97return
98end
[4590]99END MODULE lmdz_thermcell_qsat
Note: See TracBrowser for help on using the repository browser.