1 |
|
|
MODULE lmdz_thermcell_qsat |
2 |
|
|
CONTAINS |
3 |
|
|
|
4 |
|
15319608 |
subroutine thermcell_qsat(klon,active,pplev,ztemp,zqta,zqsat) |
5 |
|
|
implicit none |
6 |
|
|
|
7 |
|
|
INCLUDE "YOMCST.h" |
8 |
|
|
INCLUDE "YOETHF.h" |
9 |
|
|
INCLUDE "FCTTRE.h" |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
!==================================================================== |
13 |
|
|
! DECLARATIONS |
14 |
|
|
!==================================================================== |
15 |
|
|
|
16 |
|
|
! Arguments |
17 |
|
|
INTEGER klon |
18 |
|
|
REAL zpspsk(klon),pplev(klon) |
19 |
|
|
REAL ztemp(klon),zqta(klon),zqsat(klon) |
20 |
|
|
LOGICAL active(klon) |
21 |
|
|
|
22 |
|
|
! Variables locales |
23 |
|
|
INTEGER ig,iter |
24 |
|
43200 |
REAL Tbef(klon),DT(klon) |
25 |
|
|
REAL tdelta,qsatbef,zcor,qlbef,zdelta,zcvm5,dqsat,num,denom,dqsat_dT |
26 |
|
|
logical Zsat |
27 |
|
|
REAL RLvCp |
28 |
|
|
|
29 |
|
|
REAL, SAVE :: DDT0=.01 |
30 |
|
|
!$OMP THREADPRIVATE(DDT0) |
31 |
|
|
|
32 |
|
43200 |
LOGICAL afaire(klon),tout_converge |
33 |
|
|
|
34 |
|
|
!==================================================================== |
35 |
|
|
! INITIALISATIONS |
36 |
|
|
!==================================================================== |
37 |
|
|
|
38 |
|
21600 |
RLvCp = RLVTT/RCPD |
39 |
|
|
tout_converge=.false. |
40 |
✓✓ |
32370336 |
afaire(:)=.false. |
41 |
✓✓ |
32370336 |
DT(:)=0. |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
!==================================================================== |
45 |
|
|
! Routine a vectoriser en copiant active dans converge et en mettant |
46 |
|
|
! la boucle sur les iterations a l'exterieur est en mettant |
47 |
|
|
! converge= false des que la convergence est atteinte. |
48 |
|
|
!==================================================================== |
49 |
|
|
|
50 |
✓✓ |
32370336 |
do ig=1,klon |
51 |
✓✓ |
32370336 |
if (active(ig)) then |
52 |
|
12509981 |
Tbef(ig)=ztemp(ig) |
53 |
|
12509981 |
zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig))) |
54 |
|
12509981 |
qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig) |
55 |
|
12509981 |
qsatbef=MIN(0.5,qsatbef) |
56 |
|
12509981 |
zcor=1./(1.-retv*qsatbef) |
57 |
|
12509981 |
qsatbef=qsatbef*zcor |
58 |
|
12509981 |
qlbef=max(0.,zqta(ig)-qsatbef) |
59 |
|
12509981 |
DT(ig) = 0.5*RLvCp*qlbef |
60 |
|
12509981 |
zqsat(ig)=qsatbef |
61 |
|
|
endif |
62 |
|
|
enddo |
63 |
|
|
|
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 |
66 |
✓✓ |
32370336 |
do ig=1,klon |
67 |
✓✓ |
32370336 |
if (active(ig)) then |
68 |
✓✓✓✓
|
12509981 |
if (0.<abs(DT(ig)).and.abs(DT(ig))<=DDT0) then |
69 |
|
126963 |
zqsat(ig)=zqta(ig) |
70 |
|
|
endif |
71 |
|
|
endif |
72 |
|
|
enddo |
73 |
|
|
|
74 |
✓✓ |
237600 |
do iter=1,10 |
75 |
✓✓ |
323703360 |
afaire(:)=abs(DT(:)).gt.DDT0 |
76 |
✓✓ |
323724960 |
do ig=1,klon |
77 |
✓✓ |
323703360 |
if (afaire(ig)) then |
78 |
|
2788027 |
Tbef(ig)=Tbef(ig)+DT(ig) |
79 |
|
2788027 |
zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig))) |
80 |
|
2788027 |
qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig) |
81 |
|
2788027 |
qsatbef=MIN(0.5,qsatbef) |
82 |
|
2788027 |
zcor=1./(1.-retv*qsatbef) |
83 |
|
2788027 |
qsatbef=qsatbef*zcor |
84 |
|
2788027 |
qlbef=zqta(ig)-qsatbef |
85 |
|
|
zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig))) |
86 |
|
2788027 |
zcvm5=R5LES*(1.-zdelta) + R5IES*zdelta |
87 |
|
2788027 |
zcor=1./(1.-retv*qsatbef) |
88 |
|
2788027 |
dqsat_dT=FOEDE(Tbef(ig),zdelta,zcvm5,qsatbef,zcor) |
89 |
|
2788027 |
num=-Tbef(ig)+ztemp(ig)+RLvCp*qlbef |
90 |
|
2788027 |
denom=1.+RLvCp*dqsat_dT |
91 |
|
2788027 |
zqsat(ig) = qsatbef |
92 |
|
2788027 |
DT(ig)=num/denom |
93 |
|
|
endif |
94 |
|
|
enddo |
95 |
|
|
enddo |
96 |
|
|
|
97 |
|
21600 |
return |
98 |
|
|
end |
99 |
|
|
END MODULE lmdz_thermcell_qsat |