CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
mfscuq.f
1
3
6 module mfscuq_mod
7 contains
8
14 subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
15 & cnvflg,zl,zm,q1,t1,u1,v1,plyr,pix,
16 & thlx,thvx,thlvx,gdx,thetae,
17 & krad,mrad,radmin,buo,wush,tkemean,vez0fun,xmfd,
18 & tcdo,qcdo,ucdo,vcdo,xlamdeq,a1)
19!
20 use machine , only : kind_phys
21 use funcphys , only : fpvs
22 use physcons, grav => con_g, cp => con_cp
23 &, rv => con_rv, hvap => con_hvap
24 &, fv => con_fvirt
25 &, eps => con_eps, epsm1 => con_epsm1
26!
27 implicit none
28!
29 integer im, ix, km, kmscu, ntcw, ntrac1
30! &, me
31 integer krad(im), mrad(im)
32!
33 logical cnvflg(im)
34 real(kind=kind_phys) delt
35 real(kind=kind_phys) q1(ix,km,ntrac1),t1(ix,km),
36 & u1(ix,km), v1(ix,km),
37 & plyr(im,km), pix(im,km),
38 & thlx(im,km),
39 & thvx(im,km), thlvx(im,km),
40 & gdx(im),
41 & zl(im,km), zm(im,km),
42 & thetae(im,km), radmin(im),
43 & buo(im,km), wush(im,km),
44 & tkemean(im),vez0fun(im),xmfd(im,km),
45 & tcdo(im,km),qcdo(im,km,ntrac1),
46 & ucdo(im,km),vcdo(im,km),
47 & xlamdeq(im,km-1)
48!
49! local variables and arrays
50!
51!
52 integer i,j,indx, k, n, kk, ndc
53 integer krad1(im)
54!
55 real(kind=kind_phys) dt2, dz, ce0,
56 & cm, cq,
57 & tkcrt, cmxfac,
58 & gocp, factor, g, tau,
59 & b1, f1, bb1, bb2,
60 & a1, a2,
61 & cteit, pgcon,
62 & qmin, qlmin,
63 & xmmx, tem, tem1, tem2,
64 & ptem, ptem1, ptem2
65!
66 real(kind=kind_phys) elocp, el2orc, qs, es,
67 & tld, gamma, qld, thdn,
68 & thvd, dq
69!
70 real(kind=kind_phys) wd2(im,km), thld(im,km),
71 & qtx(im,km), qtd(im,km),
72 & thlvd(im), hrad(im), xlamde(im,km-1),
73 & xlamdem(im,km-1), ra1(im)
74 real(kind=kind_phys) delz(im), xlamax(im), ce0t(im)
75!
76 real(kind=kind_phys) xlamavg(im), sigma(im),
77 & scaldfunc(im), sumx(im)
78!
79 logical totflg, flg(im)
80!
81 real(kind=kind_phys) actei, cldtime
82!
83c physical parameters
84 parameter(g=grav)
85 parameter(gocp=g/cp)
86 parameter(elocp=hvap/cp,el2orc=hvap*hvap/(rv*cp))
87 parameter(ce0=0.4,cm=1.0,cq=1.0,pgcon=0.55)
88 parameter(tkcrt=2.,cmxfac=5.)
89 parameter(qmin=1.e-8,qlmin=1.e-12)
90 parameter(b1=0.45,f1=0.15)
91 parameter(a2=0.5)
92 parameter(cldtime=500.)
93 parameter(actei = 0.7)
94! parameter(actei = 0.23)
95!
96!************************************************************************
97!!
98 totflg = .true.
99 do i=1,im
100 totflg = totflg .and. (.not. cnvflg(i))
101 enddo
102 if(totflg) return
103!!
104 dt2 = delt
105!
106 do k = 1, km
107 do i=1,im
108 if(cnvflg(i)) then
109 buo(i,k) = 0.
110 wd2(i,k) = 0.
111 qtx(i,k) = q1(i,k,1) + q1(i,k,ntcw)
112 endif
113 enddo
114 enddo
115!
116 do i = 1, im
117 if(cnvflg(i)) then
118 hrad(i) = zm(i,krad(i))
119 krad1(i) = krad(i)-1
120 endif
121 enddo
122!
123 do i = 1, im
124 if(cnvflg(i)) then
125 k = krad(i)
126 tem = zm(i,k+1)-zm(i,k)
127 tem1 = cldtime*radmin(i)/tem
128 tem1 = max(tem1, -3.0)
129 thld(i,k)= thlx(i,k) + tem1
130 qtd(i,k) = qtx(i,k)
131 thlvd(i) = thlvx(i,k) + tem1
132 buo(i,k) = - g * tem1 / thvx(i,k)
133 endif
134 enddo
135!
137!
138 do i=1,im
139 if(cnvflg(i)) then
140 ra1(i) = a1
141 endif
142 enddo
143!
146!
147 do i = 1, im
148 if(cnvflg(i)) then
149 k = krad(i)
150 tem = thetae(i,k) - thetae(i,k+1)
151 tem1 = qtx(i,k) - qtx(i,k+1)
152 if (tem > 0. .and. tem1 > 0.) then
153 cteit= cp*tem/(hvap*tem1)
154 if(cteit > actei) then
155 ra1(i) = a2
156 endif
157 endif
158 endif
159 enddo
160!
162!
163 do i = 1, im
164 flg(i) = cnvflg(i)
165 mrad(i) = krad(i)
166 enddo
167 do k = kmscu,1,-1
168 do i = 1, im
169 if(flg(i) .and. k < krad(i)) then
170 if(thlvd(i) <= thlvx(i,k)) then
171 mrad(i) = k
172 else
173 flg(i)=.false.
174 endif
175 endif
176 enddo
177 enddo
178 do i=1,im
179 if (cnvflg(i)) then
180 kk = krad(i)-mrad(i)
181 if(kk < 1) cnvflg(i)=.false.
182 endif
183 enddo
184!!
185 totflg = .true.
186 do i=1,im
187 totflg = totflg .and. (.not. cnvflg(i))
188 enddo
189 if(totflg) return
190!!
191!
193!
194! if tkemean>tkcrt, ce0t=sqrt(tkemean/tkcrt)*ce0
195!
196 do i=1,im
197 if(cnvflg(i)) then
198 ce0t(i) = ce0 * vez0fun(i)
199 if(tkemean(i) > tkcrt) then
200 tem = sqrt(tkemean(i)/tkcrt)
201 tem1 = min(tem, cmxfac)
202 tem2 = tem1 * ce0
203 ce0t(i) = max(ce0t(i), tem2)
204 endif
205 endif
206 enddo
207!
208 do i=1,im
209 if(cnvflg(i)) then
210 k = mrad(i) + (krad(i)-mrad(i)) / 2
211 k = max(k, mrad(i))
212 delz(i) = zl(i,k+1) - zl(i,k)
213 xlamax(i) = ce0t(i) / delz(i)
214 endif
215 enddo
216!
217 do k = 1, kmscu
218 do i=1,im
219 if(cnvflg(i)) then
220 if(k >= mrad(i) .and. k < krad(i)) then
221 if(mrad(i) == 1) then
222 ptem = 1./(zm(i,k)+delz(i))
223 else
224 ptem = 1./(zm(i,k)-zm(i,mrad(i)-1)+delz(i))
225 endif
226 tem = max((hrad(i)-zm(i,k)+delz(i)) ,delz(i))
227 ptem1 = 1./tem
228 xlamde(i,k) = ce0t(i) * (ptem+ptem1)
229 else
230 xlamde(i,k) = xlamax(i)
231 endif
232!
233 xlamdeq(i,k) = cq * xlamde(i,k)
234 xlamdem(i,k) = cm * xlamde(i,k)
235 endif
236 enddo
237 enddo
238!
240!
241 do k = kmscu,1,-1
242 do i=1,im
243 if(cnvflg(i) .and. k < krad(i)) then
244 dz = zl(i,k+1) - zl(i,k)
245 tem = 0.5 * xlamde(i,k) * dz
246 factor = 1. + tem
247!
248 thld(i,k) = ((1.-tem)*thld(i,k+1)+tem*
249 & (thlx(i,k)+thlx(i,k+1)))/factor
250!
251 tem = 0.5 * xlamdeq(i,k) * dz
252 factor = 1. + tem
253 qtd(i,k) = ((1.-tem)*qtd(i,k+1)+tem*
254 & (qtx(i,k)+qtx(i,k+1)))/factor
255!
256 tld = thld(i,k) / pix(i,k)
257 es = 0.01 * fpvs(tld) ! fpvs in pa
258 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
259 dq = qtd(i,k) - qs
260!
261 if (dq > 0.) then
262 gamma = el2orc * qs / (tld**2)
263 qld = dq / (1. + gamma)
264 qtd(i,k) = qs + qld
265 tem1 = 1. + fv * qs - qld
266 thdn = thld(i,k) + pix(i,k) * elocp * qld
267 thvd = thdn * tem1
268 else
269 tem1 = 1. + fv * qtd(i,k)
270 thvd = thld(i,k) * tem1
271 endif
272 buo(i,k) = g * (1. - thvd / thvx(i,k))
273!
274 endif
275 enddo
276 enddo
277!
279!
280! tem = 1.-2.*f1
281! bb1 = 2. * b1 / tem
282! bb2 = 2. / tem
283! from Soares et al. (2004,QJRMS)
284! bb1 = 2.
285! bb2 = 4.
286!
287! from Bretherton et al. (2004, MWR)
288! bb1 = 4.
289! bb2 = 2.
290!
291! from our tuning
292 bb1 = 2.0
293 bb2 = 4.0
294!
295 do i = 1, im
296 if(cnvflg(i)) then
297 k = krad1(i)
298 dz = zm(i,k+1) - zm(i,k)
299! tem = 0.25*bb1*(xlamde(i,k)+xlamde(i,k+1))*dz
300 tem = 0.5*bb1*xlamde(i,k)*dz
301 tem1 = bb2 * buo(i,k+1) * dz
302 ptem1 = 1. + tem
303 wd2(i,k) = tem1 / ptem1
304 endif
305 enddo
306 do k = kmscu,1,-1
307 do i = 1, im
308 if(cnvflg(i) .and. k < krad1(i)) then
309 dz = zm(i,k+1) - zm(i,k)
310 tem = 0.25*bb1*(xlamde(i,k)+xlamde(i,k+1))*dz
311 tem1 = max(wd2(i,k+1), 0.)
312 tem1 = bb2*buo(i,k+1) - wush(i,k+1)*sqrt(tem1)
313 tem2 = tem1 * dz
314 ptem = (1. - tem) * wd2(i,k+1)
315 ptem1 = 1. + tem
316 wd2(i,k) = (ptem + tem2) / ptem1
317 endif
318 enddo
319 enddo
320c
321 do i = 1, im
322 flg(i) = cnvflg(i)
323 if(flg(i)) mrad(i) = krad(i)
324 enddo
325 do k = kmscu,1,-1
326 do i = 1, im
327 if(flg(i) .and. k < krad(i)) then
328 if(wd2(i,k) > 0.) then
329 mrad(i) = k
330 else
331 flg(i)=.false.
332 endif
333 endif
334 enddo
335 enddo
336!
337 do i=1,im
338 if (cnvflg(i)) then
339 kk = krad(i)-mrad(i)
340 if(kk < 1) cnvflg(i)=.false.
341 endif
342 enddo
343!!
344 totflg = .true.
345 do i=1,im
346 totflg = totflg .and. (.not. cnvflg(i))
347 enddo
348 if(totflg) return
349!!
350!
352!
353 do i=1,im
354 if(cnvflg(i)) then
355 k = mrad(i) + (krad(i)-mrad(i)) / 2
356 k = max(k, mrad(i))
357 delz(i) = zl(i,k+1) - zl(i,k)
358 xlamax(i) = ce0t(i) / delz(i)
359 endif
360 enddo
361!
362 do k = 1, kmscu
363 do i=1,im
364 if(cnvflg(i)) then
365 if(k >= mrad(i) .and. k < krad(i)) then
366 if(mrad(i) == 1) then
367 ptem = 1./(zm(i,k)+delz(i))
368 else
369 ptem = 1./(zm(i,k)-zm(i,mrad(i)-1)+delz(i))
370 endif
371 tem = max((hrad(i)-zm(i,k)+delz(i)) ,delz(i))
372 ptem1 = 1./tem
373 xlamde(i,k) = ce0t(i) * (ptem+ptem1)
374 else
375 xlamde(i,k) = xlamax(i)
376 endif
377!
378 xlamdeq(i,k) = cq * xlamde(i,k)
379 xlamdem(i,k) = cm * xlamde(i,k)
380 endif
381 enddo
382 enddo
383!
385!
386 do i = 1, im
387 xlamavg(i) = 0.
388 sumx(i) = 0.
389 enddo
390 do k = kmscu, 1, -1
391 do i = 1, im
392 if(cnvflg(i) .and.
393 & (k >= mrad(i) .and. k < krad(i))) then
394 dz = zl(i,k+1) - zl(i,k)
395 xlamavg(i) = xlamavg(i) + xlamde(i,k) * dz
396 sumx(i) = sumx(i) + dz
397 endif
398 enddo
399 enddo
400 do i = 1, im
401 if(cnvflg(i)) then
402 xlamavg(i) = xlamavg(i) / sumx(i)
403 endif
404 enddo
405!
407!
408 do k = kmscu, 1, -1
409 do i = 1, im
410 if(cnvflg(i) .and.
411 & (k >= mrad(i) .and. k < krad(i))) then
412 xmfd(i,k) = ra1(i) * sqrt(wd2(i,k))
413 endif
414 enddo
415 enddo
416!
419!
420 do i = 1, im
421 if(cnvflg(i)) then
422 tem = 0.2 / xlamavg(i)
423 tem1 = 3.14 * tem * tem
424 sigma(i) = tem1 / (gdx(i) * gdx(i))
425 sigma(i) = max(sigma(i), 0.001)
426 sigma(i) = min(sigma(i), 0.999)
427 endif
428 enddo
429!
432!
433 do i = 1, im
434 if(cnvflg(i)) then
435 if (sigma(i) > ra1(i)) then
436 scaldfunc(i) = (1.-sigma(i)) * (1.-sigma(i))
437 scaldfunc(i) = max(min(scaldfunc(i), 1.0), 0.)
438 else
439 scaldfunc(i) = 1.0
440 endif
441 endif
442 enddo
443!
445!
446 do k = kmscu, 1, -1
447 do i = 1, im
448 if(cnvflg(i) .and.
449 & (k >= mrad(i) .and. k < krad(i))) then
450 xmfd(i,k) = scaldfunc(i) * xmfd(i,k)
451 dz = zl(i,k+1) - zl(i,k)
452 xmmx = dz / dt2
453 xmfd(i,k) = min(xmfd(i,k),xmmx)
454 endif
455 enddo
456 enddo
457!
458!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
460!
461 do i = 1, im
462 if(cnvflg(i)) then
463 k = krad(i)
464 thld(i,k)= thlx(i,k)
465 endif
466 enddo
467!
468! do i = 1, im
469! if(cnvflg(i)) then
470! k = krad(i)
471! ptem1 = max(qcdo(i,k,ntcw), 0.)
472! tld = thld(i,k) / pix(i,k)
473! tcdo(i,k) = tld + elocp * ptem1
474! qcdo(i,k,1) = qcdo(i,k,1)+0.2*qcdo(i,k,1)
475! qcdo(i,k,ntcw) = qcdo(i,k,ntcw)+0.2*qcdo(i,k,ntcw)
476! endif
477! enddo
478!
479 do k = kmscu,1,-1
480 do i=1,im
481 if(cnvflg(i) .and.
482 & (k >= mrad(i) .and. k < krad(i))) then
483 dz = zl(i,k+1) - zl(i,k)
484 tem = 0.5 * xlamde(i,k) * dz
485 factor = 1. + tem
486!
487 thld(i,k) = ((1.-tem)*thld(i,k+1)+tem*
488 & (thlx(i,k)+thlx(i,k+1)))/factor
489!
490 tem = 0.5 * xlamdeq(i,k) * dz
491 factor = 1. + tem
492 qtd(i,k) = ((1.-tem)*qtd(i,k+1)+tem*
493 & (qtx(i,k)+qtx(i,k+1)))/factor
494!
495 tld = thld(i,k) / pix(i,k)
496 es = 0.01 * fpvs(tld) ! fpvs in pa
497 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
498 dq = qtd(i,k) - qs
499!
500 if (dq > 0.) then
501 gamma = el2orc * qs / (tld**2)
502 qld = dq / (1. + gamma)
503 qtd(i,k) = qs + qld
504 qcdo(i,k,1) = qs
505 qcdo(i,k,ntcw) = qld
506 tcdo(i,k) = tld + elocp * qld
507 else
508 qcdo(i,k,1) = qtd(i,k)
509 qcdo(i,k,ntcw) = 0.
510 tcdo(i,k) = tld
511 endif
512!
513 endif
514 enddo
515 enddo
516!
517 do k = kmscu, 1, -1
518 do i = 1, im
519 if (cnvflg(i) .and. k < krad(i)) then
520 if(k >= mrad(i)) then
521 dz = zl(i,k+1) - zl(i,k)
522 tem = 0.5 * xlamdem(i,k) * dz
523 factor = 1. + tem
524 ptem = tem - pgcon
525 ptem1= tem + pgcon
526!
527 ucdo(i,k) = ((1.-tem)*ucdo(i,k+1)+ptem*u1(i,k+1)
528 & +ptem1*u1(i,k))/factor
529 vcdo(i,k) = ((1.-tem)*vcdo(i,k+1)+ptem*v1(i,k+1)
530 & +ptem1*v1(i,k))/factor
531 endif
532 endif
533 enddo
534 enddo
535!
536 if(ntcw > 2) then
537!
538 do n = 2, ntcw-1
539 do k = kmscu, 1, -1
540 do i = 1, im
541 if (cnvflg(i) .and. k < krad(i)) then
542 if(k >= mrad(i)) then
543 dz = zl(i,k+1) - zl(i,k)
544 tem = 0.5 * xlamdeq(i,k) * dz
545 factor = 1. + tem
546!
547 qcdo(i,k,n) = ((1.-tem)*qcdo(i,k+1,n)+tem*
548 & (q1(i,k,n)+q1(i,k+1,n)))/factor
549 endif
550 endif
551 enddo
552 enddo
553 enddo
554!
555 endif
556!
557 ndc = ntrac1 - ntcw
558!
559 if(ndc > 0) then
560!
561 do n = ntcw+1, ntrac1
562 do k = kmscu, 1, -1
563 do i = 1, im
564 if (cnvflg(i) .and. k < krad(i)) then
565 if(k >= mrad(i)) then
566 dz = zl(i,k+1) - zl(i,k)
567 tem = 0.5 * xlamdeq(i,k) * dz
568 factor = 1. + tem
569!
570 qcdo(i,k,n) = ((1.-tem)*qcdo(i,k+1,n)+tem*
571 & (q1(i,k,n)+q1(i,k+1,n)))/factor
572 endif
573 endif
574 enddo
575 enddo
576 enddo
577!
578 endif
579!
580 return
581 end
582
583 end module mfscuq_mod
subroutine mfscuq(im, ix, km, kmscu, ntcw, ntrac1, delt,
This subroutine computes mass flux and downdraft parcel properties for stratocumulus-top-driven turbu...
Definition mfscuq.f:15
This module contains the mass flux and downdraft parcel properties parameterization for stratocumulus...
Definition mfscuq.f:6