source: CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/LMDZ/libf/phylmd/thermcell_condens.F90 @ 5477

Last change on this file since 5477 was 5477, checked in by aclsce, 4 years ago
  • Created CONFIG_DEVT directory
  • First import of LMDZOR_V6.2_work_ENSEMBLES working configuration
File size: 2.5 KB
Line 
1subroutine thermcell_condens(klon,active,zpspsk,pplev,ztla,zqta,zqla)
2implicit none
3
4#include "YOMCST.h"
5#include "YOETHF.h"
6#include "FCTTRE.h"
7
8
9!====================================================================
10! DECLARATIONS
11!====================================================================
12
13! Arguments
14INTEGER klon
15REAL zpspsk(klon),pplev(klon)
16REAL ztla(klon),zqta(klon),zqla(klon)
17LOGICAL active(klon)
18
19! Variables locales
20INTEGER ig,iter
21REAL Tbef(klon),DT(klon)
22REAL tdelta,qsatbef,zcor,qlbef,zdelta,zcvm5,dqsat,num,denom,dqsat_dT
23logical Zsat
24REAL RLvCp
25REAL, SAVE :: DDT0=.01
26  !$OMP THREADPRIVATE(DDT0)
27
28LOGICAL afaire(klon),tout_converge
29
30!====================================================================
31! INITIALISATIONS
32!====================================================================
33
34RLvCp = RLVTT/RCPD
35tout_converge=.false.
36afaire(:)=.false.
37DT(:)=0.
38
39
40!====================================================================
41! Routine a vectoriser en copiant active dans converge et en mettant
42! la boucle sur les iterations a l'exterieur est en mettant
43! converge= false des que la convergence est atteinte.
44!====================================================================
45
46do ig=1,klon
47   if (active(ig)) then
48               Tbef(ig)=ztla(ig)*zpspsk(ig)
49               zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
50               qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig)
51               qsatbef=MIN(0.5,qsatbef)
52               zcor=1./(1.-retv*qsatbef)
53               qsatbef=qsatbef*zcor
54               qlbef=max(0.,zqta(ig)-qsatbef)
55               DT(ig) = 0.5*RLvCp*qlbef
56     endif
57enddo
58
59do iter=1,10
60    afaire(:)=abs(DT(:)).gt.DDT0
61    do ig=1,klon
62               if (afaire(ig)) then
63                 Tbef(ig)=Tbef(ig)+DT(ig)
64                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
65                 qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig)
66                 qsatbef=MIN(0.5,qsatbef)
67                 zcor=1./(1.-retv*qsatbef)
68                 qsatbef=qsatbef*zcor
69                 qlbef=zqta(ig)-qsatbef
70                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
71                 zcvm5=R5LES*(1.-zdelta) + R5IES*zdelta
72                 zcor=1./(1.-retv*qsatbef)
73                 dqsat_dT=FOEDE(Tbef(ig),zdelta,zcvm5,qsatbef,zcor)
74                 num=-Tbef(ig)+ztla(ig)*zpspsk(ig)+RLvCp*qlbef
75                 denom=1.+RLvCp*dqsat_dT
76                 zqla(ig) = max(0.,zqta(ig)-qsatbef) 
77                 DT(ig)=num/denom
78               endif
79    enddo
80enddo
81
82return
83end
Note: See TracBrowser for help on using the repository browser.