source: LMDZ5/trunk/libf/phylmd/thermcell_condens.F90 @ 1907

Last change on this file since 1907 was 1907, checked in by lguez, 10 years ago

Added a copyright property to every file of the distribution, except
for the fcm files (which have their own copyright). Use svn propget on
a file to see the copyright. For instance:

$ svn propget copyright libf/phylmd/physiq.F90
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

Also added the files defining the CeCILL version 2 license, in French
and English, at the top of the LMDZ tree.

  • 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.4 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
26LOGICAL afaire(klon),tout_converge
27
28!====================================================================
29! INITIALISATIONS
30!====================================================================
31
32RLvCp = RLVTT/RCPD
33tout_converge=.false.
34afaire(:)=.false.
35DT(:)=0.
36
37
38!====================================================================
39! Routine a vectoriser en copiant active dans converge et en mettant
40! la boucle sur les iterations a l'exterieur est en mettant
41! converge= false des que la convergence est atteinte.
42!====================================================================
43
44do ig=1,klon
45   if (active(ig)) then
46               Tbef(ig)=ztla(ig)*zpspsk(ig)
47               zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
48               qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig)
49               qsatbef=MIN(0.5,qsatbef)
50               zcor=1./(1.-retv*qsatbef)
51               qsatbef=qsatbef*zcor
52               qlbef=max(0.,zqta(ig)-qsatbef)
53               DT(ig) = 0.5*RLvCp*qlbef
54     endif
55enddo
56
57do iter=1,10
58    afaire(:)=abs(DT(:)).gt.DDT0
59    do ig=1,klon
60               if (afaire(ig)) then
61                 Tbef(ig)=Tbef(ig)+DT(ig)
62                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
63                 qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig)
64                 qsatbef=MIN(0.5,qsatbef)
65                 zcor=1./(1.-retv*qsatbef)
66                 qsatbef=qsatbef*zcor
67                 qlbef=zqta(ig)-qsatbef
68                 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig)))
69                 zcvm5=R5LES*(1.-zdelta) + R5IES*zdelta
70                 zcor=1./(1.-retv*qsatbef)
71                 dqsat_dT=FOEDE(Tbef(ig),zdelta,zcvm5,qsatbef,zcor)
72                 num=-Tbef(ig)+ztla(ig)*zpspsk(ig)+RLvCp*qlbef
73                 denom=1.+RLvCp*dqsat_dT
74                 zqla(ig) = max(0.,zqta(ig)-qsatbef)
75                 DT(ig)=num/denom
76               endif
77    enddo
78enddo
79
80return
81end
Note: See TracBrowser for help on using the repository browser.