1 | subroutine largescale(ngrid,nlayer,nq,ptimestep, pplev, pplay, & |
---|
2 | pt, pq, pdt, pdq, pdtlsc, pdqvaplsc, pdqliqlsc, rneb) |
---|
3 | |
---|
4 | |
---|
5 | ! to use 'getin' |
---|
6 | ! use ioipsl_getincom |
---|
7 | use ioipsl_getincom_p |
---|
8 | use watercommon_h, only : RLVTT, RCPD, RVTMP2, & |
---|
9 | T_h2O_ice_clouds,T_h2O_ice_liq,Psat_waterDP,Lcpdqsat_waterDP |
---|
10 | USE tracer_h |
---|
11 | IMPLICIT none |
---|
12 | |
---|
13 | !================================================================== |
---|
14 | ! |
---|
15 | ! Purpose |
---|
16 | ! ------- |
---|
17 | ! Calculates large-scale (stratiform) H2O condensation. |
---|
18 | ! |
---|
19 | ! Authors |
---|
20 | ! ------- |
---|
21 | ! Adapted from the LMDTERRE code by R. Wordsworth (2009) |
---|
22 | ! Original author Z. X. Li (1993) |
---|
23 | ! |
---|
24 | !================================================================== |
---|
25 | |
---|
26 | !#include "dimensions.h" |
---|
27 | !#include "dimphys.h" |
---|
28 | #include "comcstfi.h" |
---|
29 | |
---|
30 | #include "callkeys.h" |
---|
31 | |
---|
32 | INTEGER ngrid,nlayer,nq |
---|
33 | |
---|
34 | ! Arguments |
---|
35 | REAL ptimestep ! intervalle du temps (s) |
---|
36 | REAL pplev(ngrid,nlayer+1) ! pression a inter-couche |
---|
37 | REAL pplay(ngrid,nlayer) ! pression au milieu de couche |
---|
38 | REAL pt(ngrid,nlayer) ! temperature (K) |
---|
39 | REAL pq(ngrid,nlayer,nq) ! tracer mixing ratio (kg/kg) |
---|
40 | REAL pdt(ngrid,nlayer) ! physical temperature tenedency (K/s) |
---|
41 | REAL pdq(ngrid,nlayer,nq)! physical tracer tenedency (K/s) |
---|
42 | REAL pdtlsc(ngrid,nlayer) ! incrementation de la temperature (K) |
---|
43 | REAL pdqvaplsc(ngrid,nlayer) ! incrementation de la vapeur d'eau |
---|
44 | REAL pdqliqlsc(ngrid,nlayer) ! incrementation de l'eau liquide |
---|
45 | REAL rneb(ngrid,nlayer) ! fraction nuageuse |
---|
46 | |
---|
47 | |
---|
48 | ! Options du programme |
---|
49 | REAL, SAVE :: ratqs ! determine largeur de la distribution de vapeur |
---|
50 | !$OMP THREADPRIVATE(ratqs) |
---|
51 | |
---|
52 | ! Variables locales |
---|
53 | REAL CBRT |
---|
54 | EXTERNAL CBRT |
---|
55 | INTEGER i, k , nn |
---|
56 | INTEGER,PARAMETER :: nitermax=5000 |
---|
57 | DOUBLE PRECISION,PARAMETER :: alpha=.1,qthreshold=1.d-8 |
---|
58 | ! JL13: if "careful, T<Tmin in psat water" appears often, you may want to stabilise the model by |
---|
59 | ! decreasing alpha and increasing nitermax accordingly |
---|
60 | DOUBLE PRECISION zt(ngrid), zq(ngrid) |
---|
61 | DOUBLE PRECISION zcond(ngrid),zcond_iter |
---|
62 | DOUBLE PRECISION zdelq(ngrid) |
---|
63 | DOUBLE PRECISION zqs(ngrid), zdqs(ngrid) |
---|
64 | DOUBLE PRECISION local_p,psat_tmp,dlnpsat_tmp,Lcp |
---|
65 | |
---|
66 | ! evaporation calculations |
---|
67 | REAL dqevap(ngrid,nlayer),dtevap(ngrid,nlayer) |
---|
68 | REAL qevap(ngrid,nlayer,nq) |
---|
69 | REAL tevap(ngrid,nlayer) |
---|
70 | |
---|
71 | DOUBLE PRECISION zx_q(ngrid) |
---|
72 | LOGICAL,SAVE :: firstcall=.true. |
---|
73 | !$OMP THREADPRIVATE(firstcall) |
---|
74 | |
---|
75 | |
---|
76 | IF (firstcall) THEN |
---|
77 | |
---|
78 | write(*,*) "value for ratqs? " |
---|
79 | ratqs=0.2 ! default value |
---|
80 | call getin_p("ratqs",ratqs) |
---|
81 | write(*,*) " ratqs = ",ratqs |
---|
82 | |
---|
83 | firstcall = .false. |
---|
84 | ENDIF |
---|
85 | |
---|
86 | ! GCM -----> subroutine variables, initialisation of outputs |
---|
87 | |
---|
88 | pdtlsc(1:ngrid,1:nlayer) = 0.0 |
---|
89 | pdqvaplsc(1:ngrid,1:nlayer) = 0.0 |
---|
90 | pdqliqlsc(1:ngrid,1:nlayer) = 0.0 |
---|
91 | rneb(1:ngrid,1:nlayer) = 0.0 |
---|
92 | Lcp=RLVTT/RCPD |
---|
93 | |
---|
94 | |
---|
95 | ! Evaporate cloud water/ice |
---|
96 | call evap(ngrid,nlayer,nq,ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap) |
---|
97 | ! note: we use qevap but not tevap in largescale/moistadj |
---|
98 | ! otherwise is a big mess |
---|
99 | |
---|
100 | |
---|
101 | ! Boucle verticale (du haut vers le bas) |
---|
102 | DO k = nlayer, 1, -1 |
---|
103 | |
---|
104 | zt(1:ngrid)=pt(1:ngrid,k)+(pdt(1:ngrid,k)+dtevap(1:ngrid,k))*ptimestep |
---|
105 | zq(1:ngrid)=qevap(1:ngrid,k,igcm_h2o_vap) !liquid water is included in qevap |
---|
106 | |
---|
107 | ! Calculer la vapeur d'eau saturante et |
---|
108 | ! determiner la condensation partielle |
---|
109 | DO i = 1, ngrid |
---|
110 | |
---|
111 | local_p=pplay(i,k) |
---|
112 | if(zt(i).le.15.) then |
---|
113 | print*,'in lsc',i,k,zt(i) |
---|
114 | ! zt(i)=15. ! check too low temperatures |
---|
115 | endif |
---|
116 | call Psat_waterDP(zt(i),local_p,psat_tmp,zqs(i)) |
---|
117 | |
---|
118 | zdelq(i) = MAX(MIN(ratqs * zq(i),1.-zq(i)),1.d-12) |
---|
119 | rneb(i,k) = (zq(i)+zdelq(i)-zqs(i)) / (2.0*zdelq(i)) |
---|
120 | if (rneb(i,k).lt.0.) then !no clouds |
---|
121 | |
---|
122 | rneb(i,k)=0. |
---|
123 | zcond(i)=0. |
---|
124 | |
---|
125 | else if ((rneb(i,k).gt.0.99).or.(ratqs.lt.1.e-6)) then !complete cloud cover, we start without evaporating |
---|
126 | rneb(i,k)=1. |
---|
127 | zt(i)=pt(i,k)+pdt(i,k)*ptimestep |
---|
128 | zx_q(i) = pq(i,k,igcm_h2o_vap)+pdq(i,k,igcm_h2o_vap)*ptimestep |
---|
129 | dqevap(i,k)=0. |
---|
130 | ! iterative process to stabilize the scheme when large water amounts JL12 |
---|
131 | zcond(i) = 0.0d0 |
---|
132 | Do nn=1,nitermax |
---|
133 | call Psat_waterDP(zt(i),local_p,psat_tmp,zqs(i)) |
---|
134 | call Lcpdqsat_waterDP(zt(i),local_p,psat_tmp,zqs(i),zdqs(i),dlnpsat_tmp) |
---|
135 | zcond_iter = alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs(i)) |
---|
136 | !zcond can be negative here |
---|
137 | zx_q(i) = zx_q(i) - zcond_iter |
---|
138 | zcond(i) = zcond(i) + zcond_iter |
---|
139 | zt(i) = zt(i) + zcond_iter*Lcp |
---|
140 | if (ABS(zcond_iter/alpha/zqs(i)).lt.qthreshold) exit |
---|
141 | ! if (ABS(zcond_iter/alpha).lt.qthreshold) exit |
---|
142 | if (nn.eq.nitermax) print*,'itermax in largescale' |
---|
143 | End do ! niter |
---|
144 | zcond(i)=MAX(zcond(i),-(pq(i,k,igcm_h2o_ice)+pdq(i,k,igcm_h2o_ice)*ptimestep)) |
---|
145 | |
---|
146 | else !standard case |
---|
147 | |
---|
148 | zx_q(i) = (zq(i)+zdelq(i)+zqs(i))/2.0d0 !water vapor in cloudy sky |
---|
149 | ! iterative process to stabilize the scheme when large water amounts JL12 |
---|
150 | zcond(i) = 0.0d0 |
---|
151 | Do nn=1,nitermax |
---|
152 | call Lcpdqsat_waterDP(zt(i),local_p,psat_tmp,zqs(i),zdqs(i),dlnpsat_tmp) |
---|
153 | zcond_iter = MAX(0.0d0,alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs(i))) |
---|
154 | !zcond always postive! cannot evaporate clouds! |
---|
155 | !this is why we must reevaporate before largescale |
---|
156 | zx_q(i) = zx_q(i) - zcond_iter |
---|
157 | zcond(i) = zcond(i) + zcond_iter |
---|
158 | if (ABS(zcond_iter/alpha/zqs(i)).lt.qthreshold) exit |
---|
159 | ! if (ABS(zcond_iter/alpha).lt.qthreshold) exit |
---|
160 | zt(i) = zt(i) + zcond_iter*Lcp*rneb(i,k) |
---|
161 | call Psat_waterDP(zt(i),local_p,psat_tmp,zqs(i)) |
---|
162 | if (nn.eq.nitermax) print*,'itermax in largescale' |
---|
163 | End do ! niter |
---|
164 | |
---|
165 | Endif |
---|
166 | |
---|
167 | zcond(i) = zcond(i)*rneb(i,k)/ptimestep ! JL12 |
---|
168 | |
---|
169 | ENDDO |
---|
170 | |
---|
171 | ! Tendances de t et q |
---|
172 | pdqvaplsc(1:ngrid,k) = dqevap(1:ngrid,k) - zcond(1:ngrid) |
---|
173 | pdqliqlsc(1:ngrid,k) = - pdqvaplsc(1:ngrid,k) |
---|
174 | pdtlsc(1:ngrid,k) = pdqliqlsc(1:ngrid,k)*real(Lcp) |
---|
175 | |
---|
176 | Enddo ! k= nlayer, 1, -1 |
---|
177 | |
---|
178 | |
---|
179 | end |
---|