PageRenderTime 72ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/wrfv2_fire/phys/module_mp_gsfcgce.F

http://github.com/jbeezley/wrf-fire
FORTRAN Legacy | 2838 lines | 1694 code | 322 blank | 822 comment | 147 complexity | 4686bc158b95f5e42c5d6615ed17ee47 MD5 | raw file
Possible License(s): AGPL-1.0
  1. !WRF:MODEL_LAYER:PHYSICS
  2. !
  3. MODULE module_mp_gsfcgce
  4. USE module_wrf_error
  5. !JJS 1/3/2008 vvvvv
  6. ! common /bt/
  7. REAL, PRIVATE :: rd1, rd2, al, cp
  8. ! common /cont/
  9. REAL, PRIVATE :: c38, c358, c610, c149, &
  10. c879, c172, c409, c76, &
  11. c218, c580, c141
  12. ! common /b3cs/
  13. REAL, PRIVATE :: ag, bg, as, bs, &
  14. aw, bw, bgh, bgq, &
  15. bsh, bsq, bwh, bwq
  16. ! common /size/
  17. REAL, PRIVATE :: tnw, tns, tng, &
  18. roqs, roqg, roqr
  19. ! common /bterv/
  20. REAL, PRIVATE :: zrc, zgc, zsc, &
  21. vrc, vgc, vsc
  22. ! common /bsnw/
  23. REAL, PRIVATE :: alv, alf, als, t0, t00, &
  24. avc, afc, asc, rn1, bnd1, &
  25. rn2, bnd2, rn3, rn4, rn5, &
  26. rn6, rn7, rn8, rn9, rn10, &
  27. rn101,rn10a, rn11,rn11a, rn12
  28. REAL, PRIVATE :: rn14, rn15,rn15a, rn16, rn17, &
  29. rn17a,rn17b,rn17c, rn18, rn18a, &
  30. rn19,rn19a,rn19b, rn20, rn20a, &
  31. rn20b, bnd3, rn21, rn22, rn23, &
  32. rn23a,rn23b, rn25,rn30a, rn30b, &
  33. rn30c, rn31, beta, rn32
  34. REAL, PRIVATE, DIMENSION( 31 ) :: rn12a, rn12b, rn13, rn25a
  35. ! common /rsnw1/
  36. REAL, PRIVATE :: rn10b, rn10c, rnn191, rnn192, rn30, &
  37. rnn30a, rn33, rn331, rn332
  38. !
  39. REAL, PRIVATE, DIMENSION( 31 ) :: aa1, aa2
  40. DATA aa1/.7939e-7, .7841e-6, .3369e-5, .4336e-5, .5285e-5, &
  41. .3728e-5, .1852e-5, .2991e-6, .4248e-6, .7434e-6, &
  42. .1812e-5, .4394e-5, .9145e-5, .1725e-4, .3348e-4, &
  43. .1725e-4, .9175e-5, .4412e-5, .2252e-5, .9115e-6, &
  44. .4876e-6, .3473e-6, .4758e-6, .6306e-6, .8573e-6, &
  45. .7868e-6, .7192e-6, .6513e-6, .5956e-6, .5333e-6, &
  46. .4834e-6/
  47. DATA aa2/.4006, .4831, .5320, .5307, .5319, &
  48. .5249, .4888, .3894, .4047, .4318, &
  49. .4771, .5183, .5463, .5651, .5813, &
  50. .5655, .5478, .5203, .4906, .4447, &
  51. .4126, .3960, .4149, .4320, .4506, &
  52. .4483, .4460, .4433, .4413, .4382, &
  53. .4361/
  54. !JJS 1/3/2008 ^^^^^
  55. CONTAINS
  56. !-------------------------------------------------------------------
  57. ! NASA/GSFC GCE
  58. ! Tao et al, 2001, Meteo. & Atmos. Phy., 97-137
  59. !-------------------------------------------------------------------
  60. ! SUBROUTINE gsfcgce( th, th_old, &
  61. SUBROUTINE gsfcgce( th, &
  62. qv, ql, &
  63. qr, qi, &
  64. qs, &
  65. ! qvold, qlold, &
  66. ! qrold, qiold, &
  67. ! qsold, &
  68. rho, pii, p, dt_in, z, &
  69. ht, dz8w, grav, &
  70. rhowater, rhosnow, &
  71. itimestep, &
  72. ids,ide, jds,jde, kds,kde, & ! domain dims
  73. ims,ime, jms,jme, kms,kme, & ! memory dims
  74. its,ite, jts,jte, kts,kte, & ! tile dims
  75. rainnc, rainncv, &
  76. snownc, snowncv, sr, &
  77. graupelnc, graupelncv, &
  78. ! f_qg, qg, pgold, &
  79. f_qg, qg, &
  80. ihail, ice2 &
  81. )
  82. !-------------------------------------------------------------------
  83. IMPLICIT NONE
  84. !-------------------------------------------------------------------
  85. !
  86. ! JJS 2/15/2005
  87. !
  88. INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
  89. ims,ime, jms,jme, kms,kme , &
  90. its,ite, jts,jte, kts,kte
  91. INTEGER, INTENT(IN ) :: itimestep, ihail, ice2
  92. REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
  93. INTENT(INOUT) :: &
  94. th, &
  95. qv, &
  96. ql, &
  97. qr, &
  98. qi, &
  99. qs, &
  100. qg
  101. !
  102. REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
  103. INTENT(IN ) :: &
  104. ! th_old, &
  105. ! qvold, &
  106. ! qlold, &
  107. ! qrold, &
  108. ! qiold, &
  109. ! qsold, &
  110. ! qgold, &
  111. rho, &
  112. pii, &
  113. p, &
  114. dz8w, &
  115. z
  116. REAL, DIMENSION( ims:ime , jms:jme ), &
  117. INTENT(INOUT) :: rainnc, &
  118. rainncv, &
  119. snownc, &
  120. snowncv, &
  121. sr, &
  122. graupelnc, &
  123. graupelncv
  124. REAL , DIMENSION( ims:ime , jms:jme ) , INTENT(IN) :: ht
  125. REAL, INTENT(IN ) :: dt_in, &
  126. grav, &
  127. rhowater, &
  128. rhosnow
  129. LOGICAL, INTENT(IN), OPTIONAL :: F_QG
  130. ! LOCAL VAR
  131. !jjs INTEGER :: min_q, max_q
  132. !jjs REAL, DIMENSION( its:ite , jts:jte ) &
  133. !jjs :: rain, snow, graupel,ice
  134. !
  135. ! INTEGER :: IHAIL, itaobraun, ice2, istatmin, new_ice_sat, id
  136. INTEGER :: itaobraun, istatmin, new_ice_sat, id
  137. INTEGER :: i, j, k
  138. INTEGER :: iskip, ih, icount, ibud, i24h
  139. REAL :: hour
  140. REAL , PARAMETER :: cmin=1.e-20
  141. REAL :: dth, dqv, dqrest, dqall, dqall1, rhotot, a1, a2
  142. ! REAL, DIMENSION( its:ite , kts:kte , jts:jte ) :: &
  143. ! th1, qv1, ql1, qr1, qi1, qs1, qg1
  144. LOGICAL :: flag_qg
  145. !
  146. !c ihail = 0 for graupel, for tropical region
  147. !c ihail = 1 for hail, for mid-lat region
  148. ! itaobraun: 0 for Tao's constantis, 1 for Braun's constants
  149. !c if ( itaobraun.eq.1 ) --> betah=0.5*beta=-.46*0.5=-0.23; cn0=1.e-6
  150. !c if ( itaobraun.eq.0 ) --> betah=0.5*beta=-.6*0.5=-0.30; cn0=1.e-8
  151. itaobraun = 1
  152. !c ice2 = 0 for 3 ice --- ice, snow and graupel/hail
  153. !c ice2 = 1 for 2 ice --- ice and snow only
  154. !c ice2 = 2 for 2 ice --- ice and graupel only, use ihail = 0 only
  155. !c ice2 = 3 for 0 ice --- no ice, warm only
  156. ! if (ice2 .eq. 2) ihail = 0
  157. i24h=nint(86400./dt_in)
  158. if (mod(itimestep,i24h).eq.1) then
  159. write(6,*) 'ihail=',ihail,' ice2=',ice2
  160. if (ice2.eq.0) then
  161. write(6,*) 'Running 3-ice scheme in GSFCGCE with'
  162. if (ihail.eq.0) then
  163. write(6,*) ' ice, snow and graupel'
  164. else if (ihail.eq.1) then
  165. write(6,*) ' ice, snow and hail'
  166. else
  167. write(6,*) 'ihail has to be either 1 or 0'
  168. stop
  169. endif !ihail
  170. else if (ice2.eq.1) then
  171. write(6,*) 'Running 2-ice scheme in GSFCGCE with'
  172. write(6,*) ' ice and snow'
  173. else if (ice2.eq.2) then
  174. write(6,*) 'Running 2-ice scheme in GSFCGCE with'
  175. write(6,*) ' ice and graupel'
  176. else if (ice2.eq.3) then
  177. write(6,*) 'Running warm rain only scheme in GSFCGCE without any ice'
  178. else
  179. write(6,*) 'gsfcgce_2ice in namelist.input has to be 0, 1, 2, or 3'
  180. stop
  181. endif !ice2
  182. endif !itimestep
  183. !c new_ice_sat = 0, 1 or 2
  184. new_ice_sat = 2
  185. !c istatmin
  186. istatmin = 180
  187. !c id = 0 without in-line staticstics
  188. !c id = 1 with in-line staticstics
  189. id = 0
  190. !c ibud = 0 no calculation of dth, dqv, dqrest and dqall
  191. !c ibud = 1 yes
  192. ibud = 0
  193. !jjs dt=dt_in
  194. !jjs rhoe_s=1.29
  195. !
  196. ! IF (P_QI .lt. P_FIRST_SCALAR .or. P_QS .lt. P_FIRST_SCALAR) THEN
  197. ! CALL wrf_error_fatal3 ( "module_mp_lin.b" , 130 , 'module_mp_lin: Improper use of Lin et al scheme; no ice phase. Please chose another one.')
  198. ! ENDIF
  199. ! calculte fallflux and precipiation in MKS system
  200. call fall_flux(dt_in, qr, qi, qs, qg, p, &
  201. rho, z, dz8w, ht, rainnc, &
  202. rainncv, grav,itimestep, &
  203. rhowater, rhosnow, &
  204. snownc, snowncv, sr, &
  205. graupelnc, graupelncv, &
  206. ihail, ice2, &
  207. ims,ime, jms,jme, kms,kme, & ! memory dims
  208. its,ite, jts,jte, kts,kte ) ! tile dims
  209. !-----------------------------------------------------------------------
  210. !c set up constants used internally in GCE
  211. call consat_s (ihail, itaobraun)
  212. !c Negative values correction
  213. iskip = 1
  214. if (iskip.eq.0) then
  215. call negcor(qv,rho,dz8w,ims,ime,jms,jme,kms,kme, &
  216. itimestep,1, &
  217. its,ite,jts,jte,kts,kte)
  218. call negcor(ql,rho,dz8w,ims,ime,jms,jme,kms,kme, &
  219. itimestep,2, &
  220. its,ite,jts,jte,kts,kte)
  221. call negcor(qr,rho,dz8w,ims,ime,jms,jme,kms,kme, &
  222. itimestep,3, &
  223. its,ite,jts,jte,kts,kte)
  224. call negcor(qi,rho,dz8w,ims,ime,jms,jme,kms,kme, &
  225. itimestep,4, &
  226. its,ite,jts,jte,kts,kte)
  227. call negcor(qs,rho,dz8w,ims,ime,jms,jme,kms,kme, &
  228. itimestep,5, &
  229. its,ite,jts,jte,kts,kte)
  230. call negcor(qg,rho,dz8w,ims,ime,jms,jme,kms,kme, &
  231. itimestep,6, &
  232. its,ite,jts,jte,kts,kte)
  233. ! else if (mod(itimestep,i24h).eq.1) then
  234. ! print *,'no neg correction in mp at timestep=',itimestep
  235. endif ! iskip
  236. !c microphysics in GCE
  237. call SATICEL_S( dt_in, IHAIL, itaobraun, ICE2, istatmin, &
  238. new_ice_sat, id, &
  239. ! th, th_old, qv, ql, qr, &
  240. th, qv, ql, qr, &
  241. qi, qs, qg, &
  242. ! qvold, qlold, qrold, &
  243. ! qiold, qsold, qgold, &
  244. rho, pii, p, itimestep, &
  245. ids,ide, jds,jde, kds,kde, & ! domain dims
  246. ims,ime, jms,jme, kms,kme, & ! memory dims
  247. its,ite, jts,jte, kts,kte & ! tile dims
  248. )
  249. END SUBROUTINE gsfcgce
  250. !-----------------------------------------------------------------------
  251. SUBROUTINE fall_flux ( dt, qr, qi, qs, qg, p, &
  252. rho, z, dz8w, topo, rainnc, &
  253. rainncv, grav, itimestep, &
  254. rhowater, rhosnow, &
  255. snownc, snowncv, sr, &
  256. graupelnc, graupelncv, &
  257. ihail, ice2, &
  258. ims,ime, jms,jme, kms,kme, & ! memory dims
  259. its,ite, jts,jte, kts,kte ) ! tile dims
  260. !-----------------------------------------------------------------------
  261. ! adopted from Jiun-Dar Chern's codes for Purdue Regional Model
  262. ! adopted by Jainn J. Shi, 6/10/2005
  263. !-----------------------------------------------------------------------
  264. IMPLICIT NONE
  265. INTEGER, INTENT(IN ) :: ihail, ice2, &
  266. ims,ime, jms,jme, kms,kme, &
  267. its,ite, jts,jte, kts,kte
  268. INTEGER, INTENT(IN ) :: itimestep
  269. REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
  270. INTENT(INOUT) :: qr, qi, qs, qg
  271. REAL, DIMENSION( ims:ime , jms:jme ), &
  272. INTENT(INOUT) :: rainnc, rainncv, &
  273. snownc, snowncv, sr, &
  274. graupelnc, graupelncv
  275. REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
  276. INTENT(IN ) :: rho, z, dz8w, p
  277. REAL, INTENT(IN ) :: dt, grav, rhowater, rhosnow
  278. REAL, DIMENSION( ims:ime , jms:jme ), &
  279. INTENT(IN ) :: topo
  280. ! temperary vars
  281. REAL, DIMENSION( kts:kte ) :: sqrhoz
  282. REAL :: tmp1, term0
  283. REAL :: pptrain, pptsnow, &
  284. pptgraul, pptice
  285. REAL, DIMENSION( kts:kte ) :: qrz, qiz, qsz, qgz, &
  286. zz, dzw, prez, rhoz, &
  287. orhoz
  288. INTEGER :: k, i, j
  289. !
  290. REAL, DIMENSION( kts:kte ) :: vtr, vts, vtg, vti
  291. REAL :: dtb, pi, consta, constc, gambp4, &
  292. gamdp4, gam4pt5, gam4bbar
  293. ! Lin
  294. REAL , PARAMETER :: xnor = 8.0e6
  295. ! REAL , PARAMETER :: xnos = 3.0e6
  296. REAL , PARAMETER :: xnos = 1.6e7 ! Tao's value
  297. REAL , PARAMETER :: &
  298. ! constb = 0.8, constd = 0.25, o6 = 1./6., &
  299. constb = 0.8, constd = 0.11, o6 = 1./6., &
  300. cdrag = 0.6
  301. ! Lin
  302. ! REAL , PARAMETER :: xnoh = 4.0e4
  303. REAL , PARAMETER :: xnoh = 2.0e5 ! Tao's value
  304. REAL , PARAMETER :: rhohail = 917.
  305. ! Hobbs
  306. REAL , PARAMETER :: xnog = 4.0e6
  307. REAL , PARAMETER :: rhograul = 400.
  308. REAL , PARAMETER :: abar = 19.3, bbar = 0.37, &
  309. p0 = 1.0e5
  310. REAL , PARAMETER :: rhoe_s = 1.29
  311. ! for terminal velocity flux
  312. INTEGER :: min_q, max_q
  313. REAL :: t_del_tv, del_tv, flux, fluxin, fluxout ,tmpqrz
  314. LOGICAL :: notlast
  315. ! if (itimestep.eq.1) then
  316. ! write(6, *) 'in fall_flux'
  317. ! write(6, *) 'ims=', ims, ' ime=', ime
  318. ! write(6, *) 'jms=', jms, ' jme=', jme
  319. ! write(6, *) 'kms=', kms, ' kme=', kme
  320. ! write(6, *) 'its=', its, ' ite=', ite
  321. ! write(6, *) 'jts=', jts, ' jte=', jte
  322. ! write(6, *) 'kts=', kts, ' kte=', kte
  323. ! write(6, *) 'dt=', dt
  324. ! write(6, *) 'ihail=', ihail
  325. ! write(6, *) 'ICE2=', ICE2
  326. ! write(6, *) 'dt=', dt
  327. ! endif
  328. !-----------------------------------------------------------------------
  329. ! This program calculates precipitation fluxes due to terminal velocities.
  330. !-----------------------------------------------------------------------
  331. dtb=dt
  332. pi=acos(-1.)
  333. consta=2115.0*0.01**(1-constb)
  334. ! constc=152.93*0.01**(1-constd)
  335. constc=78.63*0.01**(1-constd)
  336. ! Gamma function
  337. gambp4=ggamma(constb+4.)
  338. gamdp4=ggamma(constd+4.)
  339. gam4pt5=ggamma(4.5)
  340. gam4bbar=ggamma(4.+bbar)
  341. !***********************************************************************
  342. ! Calculate precipitation fluxes due to terminal velocities.
  343. !***********************************************************************
  344. !
  345. !- Calculate termianl velocity (vt?) of precipitation q?z
  346. !- Find maximum vt? to determine the small delta t
  347. j_loop: do j = jts, jte
  348. i_loop: do i = its, ite
  349. pptrain = 0.
  350. pptsnow = 0.
  351. pptgraul = 0.
  352. pptice = 0.
  353. do k = kts, kte
  354. qrz(k)=qr(i,k,j)
  355. rhoz(k)=rho(i,k,j)
  356. orhoz(k)=1./rhoz(k)
  357. prez(k)=p(i,k,j)
  358. sqrhoz(k)=sqrt(rhoe_s/rhoz(k))
  359. zz(k)=z(i,k,j)
  360. dzw(k)=dz8w(i,k,j)
  361. enddo !k
  362. DO k = kts, kte
  363. qiz(k)=qi(i,k,j)
  364. ENDDO
  365. DO k = kts, kte
  366. qsz(k)=qs(i,k,j)
  367. ENDDO
  368. IF (ice2 .eq. 0) THEN
  369. DO k = kts, kte
  370. qgz(k)=qg(i,k,j)
  371. ENDDO
  372. ELSE
  373. DO k = kts, kte
  374. qgz(k)=0.
  375. ENDDO
  376. ENDIF
  377. !
  378. !-- rain
  379. !
  380. t_del_tv=0.
  381. del_tv=dtb
  382. notlast=.true.
  383. DO while (notlast)
  384. !
  385. min_q=kte
  386. max_q=kts-1
  387. !
  388. do k=kts,kte-1
  389. if (qrz(k) .gt. 1.0e-8) then
  390. min_q=min0(min_q,k)
  391. max_q=max0(max_q,k)
  392. tmp1=sqrt(pi*rhowater*xnor/rhoz(k)/qrz(k))
  393. tmp1=sqrt(tmp1)
  394. vtr(k)=consta*gambp4*sqrhoz(k)/tmp1**constb
  395. vtr(k)=vtr(k)/6.
  396. if (k .eq. 1) then
  397. del_tv=amin1(del_tv,0.9*(zz(k)-topo(i,j))/vtr(k))
  398. else
  399. del_tv=amin1(del_tv,0.9*(zz(k)-zz(k-1))/vtr(k))
  400. endif
  401. else
  402. vtr(k)=0.
  403. endif
  404. enddo
  405. if (max_q .ge. min_q) then
  406. !
  407. !- Check if the summation of the small delta t >= big delta t
  408. ! (t_del_tv) (del_tv) (dtb)
  409. t_del_tv=t_del_tv+del_tv
  410. !
  411. if ( t_del_tv .ge. dtb ) then
  412. notlast=.false.
  413. del_tv=dtb+del_tv-t_del_tv
  414. endif
  415. ! use small delta t to calculate the qrz flux
  416. ! termi is the qrz flux pass in the grid box through the upper boundary
  417. ! termo is the qrz flux pass out the grid box through the lower boundary
  418. !
  419. fluxin=0.
  420. do k=max_q,min_q,-1
  421. fluxout=rhoz(k)*vtr(k)*qrz(k)
  422. flux=(fluxin-fluxout)/rhoz(k)/dzw(k)
  423. ! tmpqrz=qrz(k)
  424. qrz(k)=qrz(k)+del_tv*flux
  425. qrz(k)=amax1(0.,qrz(k))
  426. qr(i,k,j)=qrz(k)
  427. fluxin=fluxout
  428. enddo
  429. if (min_q .eq. 1) then
  430. pptrain=pptrain+fluxin*del_tv
  431. else
  432. qrz(min_q-1)=qrz(min_q-1)+del_tv* &
  433. fluxin/rhoz(min_q-1)/dzw(min_q-1)
  434. qr(i,min_q-1,j)=qrz(min_q-1)
  435. endif
  436. !
  437. else
  438. notlast=.false.
  439. endif
  440. ENDDO
  441. !
  442. !-- snow
  443. !
  444. t_del_tv=0.
  445. del_tv=dtb
  446. notlast=.true.
  447. DO while (notlast)
  448. !
  449. min_q=kte
  450. max_q=kts-1
  451. !
  452. do k=kts,kte-1
  453. if (qsz(k) .gt. 1.0e-8) then
  454. min_q=min0(min_q,k)
  455. max_q=max0(max_q,k)
  456. tmp1=sqrt(pi*rhosnow*xnos/rhoz(k)/qsz(k))
  457. tmp1=sqrt(tmp1)
  458. vts(k)=constc*gamdp4*sqrhoz(k)/tmp1**constd
  459. vts(k)=vts(k)/6.
  460. if (k .eq. 1) then
  461. del_tv=amin1(del_tv,0.9*(zz(k)-topo(i,j))/vts(k))
  462. else
  463. del_tv=amin1(del_tv,0.9*(zz(k)-zz(k-1))/vts(k))
  464. endif
  465. else
  466. vts(k)=0.
  467. endif
  468. enddo
  469. if (max_q .ge. min_q) then
  470. !
  471. !
  472. !- Check if the summation of the small delta t >= big delta t
  473. ! (t_del_tv) (del_tv) (dtb)
  474. t_del_tv=t_del_tv+del_tv
  475. if ( t_del_tv .ge. dtb ) then
  476. notlast=.false.
  477. del_tv=dtb+del_tv-t_del_tv
  478. endif
  479. ! use small delta t to calculate the qsz flux
  480. ! termi is the qsz flux pass in the grid box through the upper boundary
  481. ! termo is the qsz flux pass out the grid box through the lower boundary
  482. !
  483. fluxin=0.
  484. do k=max_q,min_q,-1
  485. fluxout=rhoz(k)*vts(k)*qsz(k)
  486. flux=(fluxin-fluxout)/rhoz(k)/dzw(k)
  487. qsz(k)=qsz(k)+del_tv*flux
  488. qsz(k)=amax1(0.,qsz(k))
  489. qs(i,k,j)=qsz(k)
  490. fluxin=fluxout
  491. enddo
  492. if (min_q .eq. 1) then
  493. pptsnow=pptsnow+fluxin*del_tv
  494. else
  495. qsz(min_q-1)=qsz(min_q-1)+del_tv* &
  496. fluxin/rhoz(min_q-1)/dzw(min_q-1)
  497. qs(i,min_q-1,j)=qsz(min_q-1)
  498. endif
  499. !
  500. else
  501. notlast=.false.
  502. endif
  503. ENDDO
  504. !
  505. ! ice2=0 --- with hail/graupel
  506. ! ice2=1 --- without hail/graupel
  507. !
  508. if (ice2.eq.0) then
  509. !
  510. !-- If IHAIL=1, use hail.
  511. !-- If IHAIL=0, use graupel.
  512. !
  513. ! if (ihail .eq. 1) then
  514. ! xnog = xnoh
  515. ! rhograul = rhohail
  516. ! endif
  517. t_del_tv=0.
  518. del_tv=dtb
  519. notlast=.true.
  520. !
  521. DO while (notlast)
  522. !
  523. min_q=kte
  524. max_q=kts-1
  525. !
  526. do k=kts,kte-1
  527. if (qgz(k) .gt. 1.0e-8) then
  528. if (ihail .eq. 1) then
  529. ! for hail, based on Lin et al (1983)
  530. min_q=min0(min_q,k)
  531. max_q=max0(max_q,k)
  532. tmp1=sqrt(pi*rhohail*xnoh/rhoz(k)/qgz(k))
  533. tmp1=sqrt(tmp1)
  534. term0=sqrt(4.*grav*rhohail/3./rhoz(k)/cdrag)
  535. vtg(k)=gam4pt5*term0*sqrt(1./tmp1)
  536. vtg(k)=vtg(k)/6.
  537. if (k .eq. 1) then
  538. del_tv=amin1(del_tv,0.9*(zz(k)-topo(i,j))/vtg(k))
  539. else
  540. del_tv=amin1(del_tv,0.9*(zz(k)-zz(k-1))/vtg(k))
  541. endif !k
  542. else
  543. ! added by JJS
  544. ! for graupel, based on RH (1984)
  545. min_q=min0(min_q,k)
  546. max_q=max0(max_q,k)
  547. tmp1=sqrt(pi*rhograul*xnog/rhoz(k)/qgz(k))
  548. tmp1=sqrt(tmp1)
  549. tmp1=tmp1**bbar
  550. tmp1=1./tmp1
  551. term0=abar*gam4bbar/6.
  552. vtg(k)=term0*tmp1*(p0/prez(k))**0.4
  553. if (k .eq. 1) then
  554. del_tv=amin1(del_tv,0.9*(zz(k)-topo(i,j))/vtg(k))
  555. else
  556. del_tv=amin1(del_tv,0.9*(zz(k)-zz(k-1))/vtg(k))
  557. endif !k
  558. endif !ihail
  559. else
  560. vtg(k)=0.
  561. endif !qgz
  562. enddo !k
  563. if (max_q .ge. min_q) then
  564. !
  565. !
  566. !- Check if the summation of the small delta t >= big delta t
  567. ! (t_del_tv) (del_tv) (dtb)
  568. t_del_tv=t_del_tv+del_tv
  569. if ( t_del_tv .ge. dtb ) then
  570. notlast=.false.
  571. del_tv=dtb+del_tv-t_del_tv
  572. endif
  573. ! use small delta t to calculate the qgz flux
  574. ! termi is the qgz flux pass in the grid box through the upper boundary
  575. ! termo is the qgz flux pass out the grid box through the lower boundary
  576. !
  577. fluxin=0.
  578. do k=max_q,min_q,-1
  579. fluxout=rhoz(k)*vtg(k)*qgz(k)
  580. flux=(fluxin-fluxout)/rhoz(k)/dzw(k)
  581. qgz(k)=qgz(k)+del_tv*flux
  582. qgz(k)=amax1(0.,qgz(k))
  583. qg(i,k,j)=qgz(k)
  584. fluxin=fluxout
  585. enddo
  586. if (min_q .eq. 1) then
  587. pptgraul=pptgraul+fluxin*del_tv
  588. else
  589. qgz(min_q-1)=qgz(min_q-1)+del_tv* &
  590. fluxin/rhoz(min_q-1)/dzw(min_q-1)
  591. qg(i,min_q-1,j)=qgz(min_q-1)
  592. endif
  593. !
  594. else
  595. notlast=.false.
  596. endif
  597. !
  598. ENDDO
  599. ENDIF !ice2
  600. !
  601. !-- cloud ice (03/21/02) follow Vaughan T.J. Phillips at GFDL
  602. !
  603. t_del_tv=0.
  604. del_tv=dtb
  605. notlast=.true.
  606. !
  607. DO while (notlast)
  608. !
  609. min_q=kte
  610. max_q=kts-1
  611. !
  612. do k=kts,kte-1
  613. if (qiz(k) .gt. 1.0e-8) then
  614. min_q=min0(min_q,k)
  615. max_q=max0(max_q,k)
  616. vti(k)= 3.29 * (rhoz(k)* qiz(k))** 0.16 ! Heymsfield and Donner
  617. if (k .eq. 1) then
  618. del_tv=amin1(del_tv,0.9*(zz(k)-topo(i,j))/vti(k))
  619. else
  620. del_tv=amin1(del_tv,0.9*(zz(k)-zz(k-1))/vti(k))
  621. endif
  622. else
  623. vti(k)=0.
  624. endif
  625. enddo
  626. if (max_q .ge. min_q) then
  627. !
  628. !
  629. !- Check if the summation of the small delta t >= big delta t
  630. ! (t_del_tv) (del_tv) (dtb)
  631. t_del_tv=t_del_tv+del_tv
  632. if ( t_del_tv .ge. dtb ) then
  633. notlast=.false.
  634. del_tv=dtb+del_tv-t_del_tv
  635. endif
  636. ! use small delta t to calculate the qiz flux
  637. ! termi is the qiz flux pass in the grid box through the upper boundary
  638. ! termo is the qiz flux pass out the grid box through the lower boundary
  639. !
  640. fluxin=0.
  641. do k=max_q,min_q,-1
  642. fluxout=rhoz(k)*vti(k)*qiz(k)
  643. flux=(fluxin-fluxout)/rhoz(k)/dzw(k)
  644. qiz(k)=qiz(k)+del_tv*flux
  645. qiz(k)=amax1(0.,qiz(k))
  646. qi(i,k,j)=qiz(k)
  647. fluxin=fluxout
  648. enddo
  649. if (min_q .eq. 1) then
  650. pptice=pptice+fluxin*del_tv
  651. else
  652. qiz(min_q-1)=qiz(min_q-1)+del_tv* &
  653. fluxin/rhoz(min_q-1)/dzw(min_q-1)
  654. qi(i,min_q-1,j)=qiz(min_q-1)
  655. endif
  656. !
  657. else
  658. notlast=.false.
  659. endif
  660. !
  661. ENDDO !notlast
  662. ! prnc(i,j)=prnc(i,j)+pptrain
  663. ! psnowc(i,j)=psnowc(i,j)+pptsnow
  664. ! pgrauc(i,j)=pgrauc(i,j)+pptgraul
  665. ! picec(i,j)=picec(i,j)+pptice
  666. !
  667. ! write(6,*) 'i=',i,' j=',j,' ', pptrain, pptsnow, pptgraul, pptice
  668. ! call flush(6)
  669. snowncv(i,j) = pptsnow
  670. snownc(i,j) = snownc(i,j) + pptsnow
  671. graupelncv(i,j) = pptgraul
  672. graupelnc(i,j) = graupelnc(i,j) + pptgraul
  673. RAINNCV(i,j) = pptrain + pptsnow + pptgraul + pptice
  674. RAINNC(i,j) = RAINNC(i,j) + pptrain + pptsnow + pptgraul + pptice
  675. sr(i,j) = 0.
  676. if (RAINNCV(i,j) .gt. 0.) sr(i,j) = (pptsnow + pptgraul + pptice) / RAINNCV(i,j)
  677. ENDDO i_loop
  678. ENDDO j_loop
  679. ! if (itimestep.eq.6480) then
  680. ! write(51,*) 'in the end of fallflux, itimestep=',itimestep
  681. ! do j=jts,jte
  682. ! do i=its,ite
  683. ! if (rainnc(i,j).gt.400.) then
  684. ! write(50,*) 'i=',i,' j=',j,' rainnc=',rainnc
  685. ! endif
  686. ! enddo
  687. ! enddo
  688. ! endif
  689. END SUBROUTINE fall_flux
  690. !----------------------------------------------------------------
  691. REAL FUNCTION ggamma(X)
  692. !----------------------------------------------------------------
  693. IMPLICIT NONE
  694. !----------------------------------------------------------------
  695. REAL, INTENT(IN ) :: x
  696. REAL, DIMENSION(8) :: B
  697. INTEGER ::j, K1
  698. REAL ::PF, G1TO2 ,TEMP
  699. DATA B/-.577191652,.988205891,-.897056937,.918206857, &
  700. -.756704078,.482199394,-.193527818,.035868343/
  701. PF=1.
  702. TEMP=X
  703. DO 10 J=1,200
  704. IF (TEMP .LE. 2) GO TO 20
  705. TEMP=TEMP-1.
  706. 10 PF=PF*TEMP
  707. 100 FORMAT(//,5X,'module_gsfcgce: INPUT TO GAMMA FUNCTION TOO LARGE, X=',E12.5)
  708. WRITE(wrf_err_message,100)X
  709. CALL wrf_error_fatal(wrf_err_message)
  710. 20 G1TO2=1.
  711. TEMP=TEMP - 1.
  712. DO 30 K1=1,8
  713. 30 G1TO2=G1TO2 + B(K1)*TEMP**K1
  714. ggamma=PF*G1TO2
  715. END FUNCTION ggamma
  716. !-----------------------------------------------------------------------
  717. !c Correction of negative values
  718. SUBROUTINE negcor ( X, rho, dz8w, &
  719. ims,ime, jms,jme, kms,kme, & ! memory dims
  720. itimestep, ics, &
  721. its,ite, jts,jte, kts,kte ) ! tile dims
  722. !-----------------------------------------------------------------------
  723. REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
  724. INTENT(INOUT) :: X
  725. REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
  726. INTENT(IN ) :: rho, dz8w
  727. integer, INTENT(IN ) :: itimestep, ics
  728. !c Local variables
  729. ! REAL, DIMENSION( kts:kte ) :: Y1, Y2
  730. REAL :: A0, A1, A2
  731. A1=0.
  732. A2=0.
  733. do k=kts,kte
  734. do j=jts,jte
  735. do i=its,ite
  736. A1=A1+max(X(i,k,j), 0.)*rho(i,k,j)*dz8w(i,k,j)
  737. A2=A2+max(-X(i,k,j), 0.)*rho(i,k,j)*dz8w(i,k,j)
  738. enddo
  739. enddo
  740. enddo
  741. ! A1=0.0
  742. ! A2=0.0
  743. ! do k=kts,kte
  744. ! A1=A1+Y1(k)
  745. ! A2=A2+Y2(k)
  746. ! enddo
  747. A0=0.0
  748. if (A1.NE.0.0.and.A1.GT.A2) then
  749. A0=(A1-A2)/A1
  750. if (mod(itimestep,540).eq.0) then
  751. if (ics.eq.1) then
  752. write(61,*) 'kms=',kms,' kme=',kme,' kts=',kts,' kte=',kte
  753. write(61,*) 'jms=',jms,' jme=',jme,' jts=',jts,' jte=',jte
  754. write(61,*) 'ims=',ims,' ime=',ime,' its=',its,' ite=',ite
  755. endif
  756. if (ics.eq.1) then
  757. write(61,*) 'qv timestep=',itimestep
  758. write(61,*) ' A1=',A1,' A2=',A2,' A0=',A0
  759. else if (ics.eq.2) then
  760. write(61,*) 'ql timestep=',itimestep
  761. write(61,*) ' A1=',A1,' A2=',A2,' A0=',A0
  762. else if (ics.eq.3) then
  763. write(61,*) 'qr timestep=',itimestep
  764. write(61,*) ' A1=',A1,' A2=',A2,' A0=',A0
  765. else if (ics.eq.4) then
  766. write(61,*) 'qi timestep=',itimestep
  767. write(61,*) ' A1=',A1,' A2=',A2,' A0=',A0
  768. else if (ics.eq.5) then
  769. write(61,*) 'qs timestep=',itimestep
  770. write(61,*) ' A1=',A1,' A2=',A2,' A0=',A0
  771. else if (ics.eq.6) then
  772. write(61,*) 'qg timestep=',itimestep
  773. write(61,*) ' A1=',A1,' A2=',A2,' A0=',A0
  774. else
  775. write(61,*) 'wrong cloud specieis number'
  776. endif
  777. endif
  778. do k=kts,kte
  779. do j=jts,jte
  780. do i=its,ite
  781. X(i,k,j)=A0*AMAX1(X(i,k,j), 0.0)
  782. enddo
  783. enddo
  784. enddo
  785. endif
  786. END SUBROUTINE negcor
  787. SUBROUTINE consat_s (ihail,itaobraun)
  788. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  789. ! c
  790. ! Tao, W.-K., and J. Simpson, 1989: Modeling study of a tropical c
  791. ! squall-type convective line. J. Atmos. Sci., 46, 177-202. c
  792. ! c
  793. ! Tao, W.-K., J. Simpson and M. McCumber, 1989: An ice-water c
  794. ! saturation adjustment. Mon. Wea. Rev., 117, 231-235. c
  795. ! c
  796. ! Tao, W.-K., and J. Simpson, 1993: The Goddard Cumulus Ensemble c
  797. ! Model. Part I: Model description. Terrestrial, Atmospheric and c
  798. ! Oceanic Sciences, 4, 35-72. c
  799. ! c
  800. ! Tao, W.-K., J. Simpson, D. Baker, S. Braun, M.-D. Chou, B. c
  801. ! Ferrier,D. Johnson, A. Khain, S. Lang, B. Lynn, C.-L. Shie, c
  802. ! D. Starr, C.-H. Sui, Y. Wang and P. Wetzel, 2003: Microphysics, c
  803. ! radiation and surface processes in the Goddard Cumulus Ensemble c
  804. ! (GCE) model, A Special Issue on Non-hydrostatic Mesoscale c
  805. ! Modeling, Meteorology and Atmospheric Physics, 82, 97-137. c
  806. ! c
  807. ! Lang, S., W.-K. Tao, R. Cifelli, W. Olson, J. Halverson, S. c
  808. ! Rutledge, and J. Simpson, 2007: Improving simulations of c
  809. ! convective system from TRMM LBA: Easterly and Westerly regimes. c
  810. ! J. Atmos. Sci., 64, 1141-1164. c
  811. ! c
  812. ! Coded by Tao (1989-2003), modified by S. Lang (2006/07) c
  813. ! c
  814. ! Implemented into WRF by Roger Shi 2006/2007 c
  815. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  816. ! itaobraun=0 ! see Tao and Simpson (1993)
  817. ! itaobraun=1 ! see Tao et al. (2003)
  818. integer :: itaobraun
  819. real :: cn0
  820. !JJS 1/3/2008 vvvvv
  821. !JJS the following common blocks have been moved to the top of
  822. !JJS module_mp_gsfcgce_driver_instat.F
  823. !
  824. ! real, dimension (1:31) :: a1, a2
  825. ! data a1/.7939e-7,.7841e-6,.3369e-5,.4336e-5,.5285e-5,.3728e-5, &
  826. ! .1852e-5,.2991e-6,.4248e-6,.7434e-6,.1812e-5,.4394e-5,.9145e-5, &
  827. ! .1725e-4,.3348e-4,.1725e-4,.9175e-5,.4412e-5,.2252e-5,.9115e-6, &
  828. ! .4876e-6,.3473e-6,.4758e-6,.6306e-6,.8573e-6,.7868e-6,.7192e-6, &
  829. ! .6513e-6,.5956e-6,.5333e-6,.4834e-6/
  830. ! data a2/.4006,.4831,.5320,.5307,.5319,.5249,.4888,.3894,.4047, &
  831. ! .4318,.4771,.5183,.5463,.5651,.5813,.5655,.5478,.5203,.4906, &
  832. ! .4447,.4126,.3960,.4149,.4320,.4506,.4483,.4460,.4433,.4413, &
  833. ! .4382,.4361/
  834. !JJS 1/3/2008 ^^^^^
  835. ! ******************************************************************
  836. !JJS
  837. al = 2.5e10
  838. cp = 1.004e7
  839. rd1 = 1.e-3
  840. rd2 = 2.2
  841. !JJS
  842. cpi=4.*atan(1.)
  843. cpi2=cpi*cpi
  844. grvt=980.
  845. cd1=6.e-1
  846. cd2=4.*grvt/(3.*cd1)
  847. tca=2.43e3
  848. dwv=.226
  849. dva=1.718e-4
  850. amw=18.016
  851. ars=8.314e7
  852. scv=2.2904487
  853. t0=273.16
  854. t00=238.16
  855. alv=2.5e10
  856. alf=3.336e9
  857. als=2.8336e10
  858. avc=alv/cp
  859. afc=alf/cp
  860. asc=als/cp
  861. rw=4.615e6
  862. cw=4.187e7
  863. ci=2.093e7
  864. c76=7.66
  865. c358=35.86
  866. c172=17.26939
  867. c409=4098.026
  868. c218=21.87456
  869. c580=5807.695
  870. c610=6.1078e3
  871. c149=1.496286e-5
  872. c879=8.794142
  873. c141=1.4144354e7
  874. !*** DEFINE THE COEFFICIENTS USED IN TERMINAL VELOCITY
  875. !*** DEFINE THE DENSITY AND SIZE DISTRIBUTION OF PRECIPITATION
  876. !********** HAIL OR GRAUPEL PARAMETERS **********
  877. if(ihail .eq. 1) then
  878. roqg=.9
  879. ag=sqrt(cd2*roqg)
  880. bg=.5
  881. tng=.002
  882. else
  883. roqg=.4
  884. ag=351.2
  885. ! AG=372.3 ! if ice913=1 6/15/02 tao's
  886. bg=.37
  887. tng=.04
  888. endif
  889. !********** SNOW PARAMETERS **********
  890. !ccshie 6/15/02 tao's
  891. ! TNS=1.
  892. ! TNS=.08 ! if ice913=1, tao's
  893. tns=.16 ! if ice913=0, tao's
  894. roqs=.1
  895. ! AS=152.93
  896. as=78.63
  897. ! BS=.25
  898. bs=.11
  899. !********** RAIN PARAMETERS **********
  900. aw=2115.
  901. bw=.8
  902. roqr=1.
  903. tnw=.08
  904. !*****************************************************************
  905. bgh=.5*bg
  906. bsh=.5*bs
  907. bwh=.5*bw
  908. bgq=.25*bg
  909. bsq=.25*bs
  910. bwq=.25*bw
  911. !**********GAMMA FUNCTION CALCULATIONS*************
  912. ga3b = gammagce(3.+bw)
  913. ga4b = gammagce(4.+bw)
  914. ga6b = gammagce(6.+bw)
  915. ga5bh = gammagce((5.+bw)/2.)
  916. ga3g = gammagce(3.+bg)
  917. ga4g = gammagce(4.+bg)
  918. ga5gh = gammagce((5.+bg)/2.)
  919. ga3d = gammagce(3.+bs)
  920. ga4d = gammagce(4.+bs)
  921. ga5dh = gammagce((5.+bs)/2.)
  922. !CCCCC LIN ET AL., 1983 OR LORD ET AL., 1984 CCCCCCCCCCCCCCCCC
  923. ac1=aw
  924. !JJS
  925. ac2=ag
  926. ac3=as
  927. !JJS
  928. bc1=bw
  929. cc1=as
  930. dc1=bs
  931. zrc=(cpi*roqr*tnw)**0.25
  932. zsc=(cpi*roqs*tns)**0.25
  933. zgc=(cpi*roqg*tng)**0.25
  934. vrc=aw*ga4b/(6.*zrc**bw)
  935. vsc=as*ga4d/(6.*zsc**bs)
  936. vgc=ag*ga4g/(6.*zgc**bg)
  937. ! ****************************
  938. ! RN1=1.E-3
  939. rn1=9.4e-15 ! 6/15/02 tao's
  940. bnd1=6.e-4
  941. rn2=1.e-3
  942. ! BND2=1.25E-3
  943. ! BND2=1.5E-3 ! if ice913=1 6/15/02 tao's
  944. bnd2=2.0e-3 ! if ice913=0 6/15/02 tao's
  945. rn3=.25*cpi*tns*cc1*ga3d
  946. esw=1.
  947. rn4=.25*cpi*esw*tns*cc1*ga3d
  948. ! ERI=1.
  949. eri=.1 ! 6/17/02 tao's ice913=0 (not 1)
  950. rn5=.25*cpi*eri*tnw*ac1*ga3b
  951. ! AMI=1./(24.*4.19E-10)
  952. ami=1./(24.*6.e-9) ! 6/15/02 tao's
  953. rn6=cpi2*eri*tnw*ac1*roqr*ga6b*ami
  954. ! ESR=1. ! also if ice913=1 for tao's
  955. esr=.5 ! 6/15/02 for ice913=0 tao's
  956. rn7=cpi2*esr*tnw*tns*roqs
  957. esr=1.
  958. rn8=cpi2*esr*tnw*tns*roqr
  959. rn9=cpi2*tns*tng*roqs
  960. rn10=2.*cpi*tns
  961. rn101=.31*ga5dh*sqrt(cc1)
  962. rn10a=als*als/rw
  963. !JJS
  964. rn10b=alv/tca
  965. rn10c=ars/(dwv*amw)
  966. !JJS
  967. rn11=2.*cpi*tns/alf
  968. rn11a=cw/alf
  969. ! AMI50=1.51e-7
  970. ami50=3.84e-6 ! 6/15/02 tao's
  971. ! AMI40=2.41e-8
  972. ami40=3.08e-8 ! 6/15/02 tao's
  973. eiw=1.
  974. ! UI50=20.
  975. ui50=100. ! 6/15/02 tao's
  976. ri50=2.*5.e-3
  977. cmn=1.05e-15
  978. rn12=cpi*eiw*ui50*ri50**2
  979. do 10 k=1,31
  980. y1=1.-aa2(k)
  981. rn13(k)=aa1(k)*y1/(ami50**y1-ami40**y1)
  982. rn12a(k)=rn13(k)/ami50
  983. rn12b(k)=aa1(k)*ami50**aa2(k)
  984. rn25a(k)=aa1(k)*cmn**aa2(k)
  985. 10 continue
  986. egw=1.
  987. rn14=.25*cpi*egw*tng*ga3g*ag
  988. egi=.1
  989. rn15=.25*cpi*egi*tng*ga3g*ag
  990. egi=1.
  991. rn15a=.25*cpi*egi*tng*ga3g*ag
  992. egr=1.
  993. rn16=cpi2*egr*tng*tnw*roqr
  994. rn17=2.*cpi*tng
  995. rn17a=.31*ga5gh*sqrt(ag)
  996. rn17b=cw-ci
  997. rn17c=cw
  998. apri=.66
  999. bpri=1.e-4
  1000. bpri=0.5*bpri ! 6/17/02 tao's
  1001. rn18=20.*cpi2*bpri*tnw*roqr
  1002. rn18a=apri
  1003. rn19=2.*cpi*tng/alf
  1004. rn19a=.31*ga5gh*sqrt(ag)
  1005. rn19b=cw/alf
  1006. !
  1007. rnn191=.78
  1008. rnn192=.31*ga5gh*sqrt(ac2/dva)
  1009. !
  1010. rn20=2.*cpi*tng
  1011. rn20a=als*als/rw
  1012. rn20b=.31*ga5gh*sqrt(ag)
  1013. bnd3=2.e-3
  1014. rn21=1.e3*1.569e-12/0.15
  1015. erw=1.
  1016. rn22=.25*cpi*erw*ac1*tnw*ga3b
  1017. rn23=2.*cpi*tnw
  1018. rn23a=.31*ga5bh*sqrt(ac1)
  1019. rn23b=alv*alv/rw
  1020. !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1021. !cc
  1022. !cc "c0" in routine "consat" (2d), "consatrh" (3d)
  1023. !cc if ( itaobraun.eq.1 ) --> betah=0.5*beta=-.46*0.5=-0.23; cn0=1.e-6
  1024. !cc if ( itaobraun.eq.0 ) --> betah=0.5*beta=-.6*0.5=-0.30; cn0=1.e-8
  1025. if (itaobraun .eq. 0) then
  1026. cn0=1.e-8
  1027. beta=-.6
  1028. elseif (itaobraun .eq. 1) then
  1029. cn0=1.e-6
  1030. beta=-.46
  1031. endif
  1032. !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1033. ! CN0=1.E-6
  1034. ! CN0=1.E-8 ! 6/15/02 tao's
  1035. ! BETA=-.46
  1036. ! BETA=-.6 ! 6/15/02 tao's
  1037. rn25=cn0
  1038. rn30a=alv*als*amw/(tca*ars)
  1039. rn30b=alv/tca
  1040. rn30c=ars/(dwv*amw)
  1041. rn31=1.e-17
  1042. rn32=4.*51.545e-4
  1043. !
  1044. rn30=2.*cpi*tng
  1045. rnn30a=alv*alv*amw/(tca*ars)
  1046. !
  1047. rn33=4.*tns
  1048. rn331=.65
  1049. rn332=.44*sqrt(ac3/dva)*ga5dh
  1050. !
  1051. return
  1052. END SUBROUTINE consat_s
  1053. SUBROUTINE saticel_s (dt, ihail, itaobraun, ice2, istatmin, &
  1054. new_ice_sat, id, &
  1055. ptwrf, qvwrf, qlwrf, qrwrf, &
  1056. qiwrf, qswrf, qgwrf, &
  1057. rho_mks, pi_mks, p0_mks,itimestep, &
  1058. ids,ide, jds,jde, kds,kde, &
  1059. ims,ime, jms,jme, kms,kme, &
  1060. its,ite, jts,jte, kts,kte &
  1061. )
  1062. IMPLICIT NONE
  1063. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1064. ! c
  1065. ! Tao, W.-K., and J. Simpson, 1989: Modeling study of a tropical c
  1066. ! squall-type convective line. J. Atmos. Sci., 46, 177-202. c
  1067. ! c
  1068. ! Tao, W.-K., J. Simpson and M. McCumber, 1989: An ice-water c
  1069. ! saturation adjustment. Mon. Wea. Rev., 117, 231-235. c
  1070. ! c
  1071. ! Tao, W.-K., and J. Simpson, 1993: The Goddard Cumulus Ensemble c
  1072. ! Model. Part I: Model description. Terrestrial, Atmospheric and c
  1073. ! Oceanic Sciences, 4, 35-72. c
  1074. ! c
  1075. ! Tao, W.-K., J. Simpson, D. Baker, S. Braun, M.-D. Chou, B. c
  1076. ! Ferrier,D. Johnson, A. Khain, S. Lang, B. Lynn, C.-L. Shie, c
  1077. ! D. Starr, C.-H. Sui, Y. Wang and P. Wetzel, 2003: Microphysics, c
  1078. ! radiation and surface processes in the Goddard Cumulus Ensemble c
  1079. ! (GCE) model, A Special Issue on Non-hydrostatic Mesoscale c
  1080. ! Modeling, Meteorology and Atmospheric Physics, 82, 97-137. c
  1081. ! c
  1082. ! Lang, S., W.-K. Tao, R. Cifelli, W. Olson, J. Halverson, S. c
  1083. ! Rutledge, and J. Simpson, 2007: Improving simulations of c
  1084. ! convective system from TRMM LBA: Easterly and Westerly regimes. c
  1085. ! J. Atmos. Sci., 64, 1141-1164. c
  1086. ! c
  1087. ! Tao, W.-K., J. J. Shi, S. Lang, C. Peters-Lidard, A. Hou, S. c
  1088. ! Braun, and J. Simpson, 2007: New, improved bulk-microphysical c
  1089. ! schemes for studying precipitation processes in WRF. Part I: c
  1090. ! Comparisons with other schemes. to appear on Mon. Wea. Rev. C
  1091. ! c
  1092. ! Coded by Tao (1989-2003), modified by S. Lang (2006/07) c
  1093. ! c
  1094. ! Implemented into WRF by Roger Shi 2006/2007 c
  1095. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1096. !
  1097. ! COMPUTE ICE PHASE MICROPHYSICS AND SATURATION PROCESSES
  1098. !
  1099. integer, parameter :: nt=2880, nt2=2*nt
  1100. !cc using scott braun's way for pint, pidep computations
  1101. integer :: itaobraun,ice2,ihail,new_ice_sat,id,istatmin
  1102. integer :: itimestep
  1103. real :: tairccri, cn0, dt
  1104. !cc
  1105. !JJS common/bxyz/ n,isec,nran,kt1,kt2
  1106. !JJS common/option/ lipps,ijkadv,istatmin,iwater,itoga,imlifting,lin,
  1107. !JJS 1 irf,iadvh,irfg,ismg,id
  1108. !JJS common/timestat/ ndt_stat,idq
  1109. !JJS common/iice/ new_ice_sat
  1110. !JJS common/bt/ dt,d2t,rijl2,dts,f5,rd1,rd2,bound,al,cp,ra,ck,ce,eps,
  1111. !JJS 1 psfc,fcor,sec,aminut,rdt
  1112. !JJS the following common blocks have been moved to the top of
  1113. !JJS module_mp_gsfcgce_driver_instat.F
  1114. ! common/bt/ rd1,rd2,al,cp
  1115. !
  1116. !
  1117. ! common/bterv/ zrc,zgc,zsc,vrc,vgc,vsc
  1118. ! common/size/ tnw,tns,tng,roqs,roqg,roqr
  1119. ! common/cont/ c38,c358,c610,c149,c879,c172,c409,c76,c218,c580,c141
  1120. ! common/b3cs/ ag,bg,as,bs,aw,bw,bgh,bgq,bsh,bsq,bwh,bwq
  1121. ! common/bsnw/ alv,alf,als,t0,t00,avc,afc,asc,rn1,bnd1,rn2,bnd2, &
  1122. ! rn3,rn4,rn5,rn6,rn7,rn8,rn9,rn10,rn101,rn10a,rn11,rn11a, &
  1123. ! rn12,rn12a(31),rn12b(31),rn13(31),rn14,rn15,rn15a,rn16,rn17, &
  1124. ! rn17a,rn17b,rn17c,rn18,rn18a,rn19,rn19a,rn19b,rn20,rn20a,rn20b, &
  1125. ! bnd3,rn21,rn22,rn23,rn23a,rn23b,rn25,rn25a(31),rn30a,rn30b, &
  1126. ! rn30c,rn31,beta,rn32
  1127. ! common/rsnw1/ rn10b,rn10c,rnn191,rnn192,rn30,rnn30a,rn33,rn331, &
  1128. ! rn332
  1129. !JJS
  1130. integer ids,ide,jds,jde,kds,kde
  1131. integer ims,ime,jms,jme,kms,kme
  1132. integer its,ite,jts,jte,kts,kte
  1133. integer i,j,k, kp
  1134. real :: a0 ,a1 ,a2 ,afcp ,alvr ,ami100 ,ami40 ,ami50 ,ascp ,avcp ,betah &
  1135. ,bg3 ,bgh5 ,bs3 ,bs6 ,bsh5 ,bw3 ,bw6 ,bwh5 ,cmin ,cmin1 ,cmin2 ,cp409 &
  1136. ,cp580 ,cs580 ,cv409 ,d2t ,del ,dwvp ,ee1 ,ee2 ,f00 ,f2 ,f3 ,ft ,fv0 ,fvs &
  1137. ,pi0 ,pir ,pr0 ,qb0 ,r00 ,r0s ,r101f ,r10ar ,r10t ,r11at ,r11rt ,r12r ,r14f &
  1138. ,r14r ,r15af ,r15ar ,r15f ,r15r ,r16r ,r17aq ,r17as ,r17r ,r18r ,r19aq ,r19as &
  1139. ,r19bt ,r19rt ,r20bq ,r20bs ,r20t ,r22f ,r23af ,r23br ,r23t ,r25a ,r25rt ,r2ice &
  1140. ,r31r ,r32rt ,r3f ,r4f ,r5f ,r6f ,r7r ,r8r ,r9r ,r_nci ,rft ,rijl2 ,rp0 ,rr0 &
  1141. ,rrq ,rrs ,rt0 ,scc ,sccc ,sddd ,see ,seee ,sfff ,smmm ,ssss ,tb0 ,temp ,ucog &
  1142. ,ucor ,ucos ,uwet ,vgcf ,vgcr ,vrcf ,vscf ,zgr ,zrr ,zsr
  1143. real, dimension (its:ite,jts:jte,kts:kte) :: fv
  1144. real, dimension (its:ite,jts:jte,kts:kte) :: dpt, dqv
  1145. real, dimension (its:ite,jts:jte,kts:kte) :: qcl, qrn, &
  1146. qci, qcs, qcg
  1147. !JJS 10/16/06 vvvv
  1148. ! real dpt1(ims:ime,jms:jme,kms:kme)
  1149. ! real dqv1(ims:ime,jms:jme,kms:kme),
  1150. ! 1 qcl1(ims:ime,jms:jme,kms:kme)
  1151. ! real qrn1(ims:ime,jms:jme,kms:kme),
  1152. ! 1 qci1(ims:ime,jms:jme,kms:kme)
  1153. ! real qcs1(ims:ime,jms:jme,kms:kme),
  1154. ! 1 qcg1(ims:ime,jms:jme,kms:kme)
  1155. !JJS 10/16/06 ^^^^
  1156. !JJS
  1157. real, dimension (ims:ime, kms:kme, jms:jme) :: ptwrf, qvwrf
  1158. real, dimension (ims:ime, kms:kme, jms:jme) :: qlwrf, qrwrf, &
  1159. qiwrf, qswrf, qgwrf
  1160. !JJS 10/16/06 vvvv
  1161. ! real ptwrfold(ims:ime, kms:kme, jms:jme)
  1162. ! real qvwrfold(ims:ime, kms:kme, jms:jme),
  1163. ! 1 qlwrfold(ims:ime, kms:kme, jms:jme)
  1164. ! real qrwrfold(ims:ime, kms:kme, jms:jme),
  1165. ! 1 qiwrfold(ims:ime, kms:kme, jms:jme)
  1166. ! real qswrfold(ims:ime, kms:kme, jms:jme),
  1167. ! 1 qgwrfold(ims:ime, kms:kme, jms:jme)
  1168. !JJS 10/16/06 ^^^^
  1169. !JJS in MKS
  1170. real, dimension (ims:ime, kms:kme, jms:jme) :: rho_mks
  1171. real, dimension (ims:ime, kms:kme, jms:jme) :: pi_mks
  1172. real, dimension (ims:ime, kms:kme, jms:jme) :: p0_mks
  1173. !JJS
  1174. ! real, dimension (its:ite,jts:jte,kts:kte) :: ww1
  1175. ! real, dimension (its:ite,jts:jte,kts:kte) :: rsw
  1176. ! real, dimension (its:ite,jts:jte,kts:kte) :: rlw
  1177. !JJS COMMON /BADV/
  1178. real, dimension (its:ite,jts:jte) :: &
  1179. vg, zg, &
  1180. ps, pg, &
  1181. prn, psn, &
  1182. pwacs, wgacr, &
  1183. pidep, pint, &
  1184. qsi, ssi, &
  1185. esi, esw, &
  1186. qsw, pr, &
  1187. ssw, pihom, &
  1188. pidw, pimlt, &
  1189. psaut, qracs, &
  1190. psaci, psacw, &
  1191. qsacw, praci, &
  1192. pmlts, pmltg, &
  1193. asss, y1, y2
  1194. !JJS Y2(its:ite,jts:jte), DDE(NB)
  1195. !JJS COMMON/BSAT/
  1196. real, dimension (its:ite,jts:jte) :: &
  1197. praut, pracw, &
  1198. psfw, psfi, &
  1199. dgacs, dgacw, &
  1200. dgaci, dgacr, &
  1201. pgacs, wgacs, &
  1202. qgacw, wgaci, &
  1203. qgacr, pgwet, &
  1204. pgaut, pracs, &
  1205. psacr, qsacr, &
  1206. pgfr, psmlt, &
  1207. pgmlt, psdep, &
  1208. pgdep, piacr, &
  1209. y5, scv, &
  1210. tca, dwv, &
  1211. egs, y3, &
  1212. y4, ddb
  1213. !JJS COMMON/BSAT1/
  1214. real, dimension (its:ite,jts:jte) :: &
  1215. pt, qv, &
  1216. qc, qr, &
  1217. qi, qs, &
  1218. qg, tair, &
  1219. tairc, rtair, &
  1220. dep, dd, &
  1221. dd1, qvs, &
  1222. dm, rq, &
  1223. rsub1, col, &
  1224. cnd, ern, &
  1225. dlt1, dlt2, &
  1226. dlt3, dlt4, &
  1227. zr, vr, &
  1228. zs, vs, &
  1229. pssub, &
  1230. pgsub, dda
  1231. !JJS COMMON/B5/
  1232. real, dimension (its:ite,jts:jte,kts:kte) :: rho
  1233. real, dimension (kts:kte) :: &
  1234. tb, qb, rho1, &
  1235. ta, qa, ta1, qa1, &
  1236. coef, z1, z2, z3, &
  1237. am, am1, ub, vb, &
  1238. wb, ub1, vb1, rrho, &
  1239. rrho1, wbx
  1240. !JJS COMMON/B6/
  1241. real, dimension (its:ite,jts:jte,kts:kte) :: p0, pi, f0
  1242. real, dimension (kts:kte) :: &
  1243. fd, fe, &
  1244. st, sv, &
  1245. sq, sc, &
  1246. se, sqa
  1247. !JJS COMMON/BRH1/
  1248. real, dimension (kts:kte) :: &
  1249. srro, qrro, sqc, sqr, &
  1250. sqi, sqs, sqg, stqc, &
  1251. stqr, stqi, stqs, stqg
  1252. real, dimension (nt) :: &
  1253. tqc, tqr, tqi, tqs, tqg
  1254. !JJS common/bls/ y0(nx,ny),ts0new(nx,ny),qss0new(nx,ny)
  1255. !JJS COMMON/BLS/
  1256. real, dimension (ims:ime,jms:jme) :: &
  1257. y0, ts0, qss0
  1258. !JJS COMMON/BI/ IT(its:ite,jts:jte), ICS(its:ite,jts:jte,4)
  1259. integer, dimension (its:ite,jts:jte) :: it
  1260. integer, dimension (its:ite,jts:jte, 4) :: ics
  1261. integer :: i24h
  1262. integer :: iwarm
  1263. real :: r2is, r2ig
  1264. !JJS COMMON/MICRO/
  1265. ! real, dimension (ims:ime,kms:kme,jms:jme) :: dbz
  1266. !23456789012345678901234567890123456789012345678901234567890123456789012
  1267. !
  1268. !JJS 1/3/2008 vvvvv
  1269. !JJS the following common blocks have been moved to the top of
  1270. !JJS module_mp_gsfcgce_driver.F
  1271. ! real, dimension (31) :: aa1, aa2
  1272. ! data aa1/.7939e-7, .7841e-6, .3369e-5, .4336e-5, .5285e-5, &
  1273. ! .3728e-5, .1852e-5, .2991e-6, .4248e-6, .7434e-6, &
  1274. ! .1812e-5, .4394e-5, .9145e-5, .1725e-4, .3348e-4, &
  1275. ! .1725e-4, .9175e-5, .4412e-5, .2252e-5, .9115e-6, &
  1276. ! .4876e-6, .3473e-6, .4758e-6, .6306e-6, .8573e-6, &
  1277. ! .7868e-6, .7192e-6, .6513e-6, .5956e-6, .5333e-6, &
  1278. ! .4834e-6/
  1279. ! data aa2/.4006, .4831, .5320, .5307, .5319, &
  1280. ! .5249, .4888, .3894, .4047, .4318, &
  1281. ! .4771, .5183, .5463, .5651, .5813, &
  1282. ! .5655, .5478, .5203, .4906, .4447, &
  1283. ! .4126, .3960, .4149, .4320, .4506, &
  1284. ! .4483, .4460, .4433, .4413, .4382, &
  1285. ! .4361/
  1286. !JJS 1/3/2008 ^^^^^
  1287. !
  1288. !jm 20090220 save
  1289. ! i24h=nint(86400./dt)
  1290. ! if (mod(itimestep,i24h).eq.1) then
  1291. ! write(6, *) 'ims=', ims, ' ime=', ime
  1292. ! write(6, *) 'jms=', jms, ' jme=', jme
  1293. ! write(6, *) 'kms=', kms, ' kme=', kme
  1294. ! write(6, *) 'its=', its, ' ite=', ite
  1295. ! write(6, *) 'jts=', jts, ' jte=', jte
  1296. ! write(6, *) 'kts=', kts, ' kte=', kte
  1297. ! write(6, *) ' ihail=', ihail
  1298. ! write(6, *) 'itaobraun=',itaobraun
  1299. ! write(6, *) ' ice2=', ICE2
  1300. ! write(6, *) 'istatmin=',istatmin
  1301. ! write(6, *) 'new_ice_sat=', new_ice_sat
  1302. ! write(6, *) 'id=', id
  1303. ! write(6, *) 'dt=', dt
  1304. ! endif
  1305. !JJS convert from mks to cgs, and move from WRF grid to GCE grid
  1306. do k=kts,kte
  1307. do j=jts,jte
  1308. do i=its,ite
  1309. rho(i,j,k)=rho_mks(i,k,j)*0.001
  1310. p0(i,j,k)=p0_mks(i,k,j)*10.0
  1311. pi(i,j,k)=pi_mks(i,k,j)
  1312. dpt(i,j,k)=ptwrf(i,k,j)
  1313. dqv(i,j,k)=qvwrf(i,k,j)
  1314. qcl(i,j,k)=qlwrf(i,k,j)
  1315. qrn(i,j,k)=qrwrf(i,k,j)
  1316. qci(i,j,k)=qiwrf(i,k,j)
  1317. qcs(i,j,k)=qswrf(i,k,j)
  1318. qcg(i,j,k)=qgwrf(i,k,j)
  1319. !JJS 10/16/06 vvvv
  1320. ! dpt1(i,j,k)=ptwrfold(i,k,j)
  1321. ! dqv1(i,j,k)=qvwrfold(i,k,j)
  1322. ! qcl1(i,j,k)=qlwrfold(i,k,j)
  1323. ! qrn1(i,j,k)=qrwrfold(i,k,j)
  1324. ! qci1(i,j,k)=qiwrfold(i,k,j)
  1325. ! qcs1(i,j,k)=qswrfold(i,k,j)
  1326. ! qcg1(i,j,k)=qgwrfold(i,k,j)
  1327. !JJS 10/16/06 ^^^^
  1328. enddo !i
  1329. enddo !j
  1330. enddo !k
  1331. do k=kts,kte
  1332. do j=jts,jte
  1333. do i=its,ite
  1334. fv(i,j,k)=sqrt(rho(i,j,2)/rho(i,j,k))
  1335. enddo !i
  1336. enddo !j
  1337. enddo !k
  1338. !JJS
  1339. !
  1340. ! ****** THREE CLASSES OF ICE-PHASE (LIN ET AL, 1983) *********
  1341. !JJS D22T=D2T
  1342. !JJS IF(IJKADV .EQ. 0) THEN
  1343. !JJS D2T=D2T
  1344. !JJS ELSE
  1345. d2t=dt
  1346. !JJS ENDIF
  1347. !
  1348. ! itaobraun=0 ! original pint and pidep & see Tao and Simpson 1993
  1349. itaobraun=1 ! see Tao et al. (2003)
  1350. !
  1351. if ( itaobraun.eq.0 ) then
  1352. cn0=1.e-8
  1353. !c beta=-.6
  1354. elseif ( itaobraun.eq.1 ) then
  1355. cn0=1.e-6
  1356. ! cn0=1.e-8 ! special
  1357. !c beta=-.46
  1358. endif
  1359. !C TAO 2007 START
  1360. ! ICE2=0 ! default, 3ice with loud ice, snow and graupel
  1361. ! r2is=1., r2ig=1.
  1362. ! ICE2=1 ! 2ice with cloud ice and snow (no graupel) - r2iceg=1, r2ice=0.
  1363. ! r2is=1., r2ig=0.
  1364. ! ICE2=2 ! 2ice with cloud ice and graupel (no snow) - r2ice=1, r2iceg=0.
  1365. ! r2is=0., r2ig=1.
  1366. !c
  1367. ! r2ice=1.
  1368. ! r2iceg=1.
  1369. r2ig=1.
  1370. r2is=1.
  1371. if (ice2 .eq. 1) then
  1372. ! r2ice=0.
  1373. ! r2iceg=1.
  1374. r2ig=0.
  1375. r2is=1.
  1376. endif
  1377. if (ice2 .eq. 2) then
  1378. ! r2ice=1.
  1379. ! r2iceg=0.
  1380. r2ig=1.
  1381. r2is=0.
  1382. endif
  1383. !C TAO 2007 END
  1384. !JJS 10/7/2008
  1385. ! ICE2=3 ! no ice, warm rain only
  1386. iwarm = 0
  1387. if (ice2 .eq. 3 ) iwarm = 1
  1388. cmin=1.e-19
  1389. cmin1=1.e-20
  1390. cmin2=1.e-12
  1391. ucor=3071.29/tnw**0.75
  1392. ucos=687.97*roqs**0.25/tns**0.75
  1393. ucog=687.97*roqg**0.25/tng**0.75
  1394. uwet=4.464**0.95
  1395. rijl2 = 1. / (ide-ids) / (jde-jds)
  1396. !JJScap $doacross local(j,i)
  1397. !JJS DO 1 J=1,JMAX
  1398. !JJS DO 1 I=1,IMAX
  1399. do j=jts,jte
  1400. do i=its,ite
  1401. it(i,j)=1
  1402. enddo
  1403. enddo
  1404. f2=rd1*d2t
  1405. f3=rd2*d2t
  1406. ft=dt/d2t
  1407. rft=rijl2*ft
  1408. a0=.5*istatmin*rijl2
  1409. rt0=1./(t0-t00)
  1410. bw3=bw+3.
  1411. bs3=bs+3.
  1412. bg3=bg+3.
  1413. bsh5=2.5+bsh
  1414. bgh5=2.5+bgh
  1415. bwh5=2.5+bwh
  1416. bw6=bw+6.
  1417. bs6=bs+6.
  1418. betah=.5*beta
  1419. r10t=rn10*d2t
  1420. r11at=rn11a*d2t
  1421. r19bt=rn19b*d2t
  1422. r20t=-rn20*d2t
  1423. r23t=-rn23*d2t
  1424. r25a=rn25
  1425. ! ami50 for use in PINT
  1426. ami50=3.76e-8
  1427. ami100=1.51e-7
  1428. ami40=2.41e-8
  1429. !C ******************************************************************
  1430. !JJS DO 1000 K=2,kles
  1431. do 1000 k=kts,kte
  1432. kp=k+1
  1433. !JJS tb0=ta1(k)
  1434. !JJS qb0=qa1(k)
  1435. tb0=0.
  1436. qb0=0.
  1437. do 2000 j=jts,jte
  1438. do 2000 i=its,ite
  1439. rp0=3.799052e3/p0(i,j,k)
  1440. pi0=pi(i,j,k)
  1441. pir=1./(pi(i,j,k))
  1442. pr0=1./p0(i,j,k)
  1443. r00=rho(i,j,k)
  1444. r0s=sqrt(rho(i,j,k))
  1445. !JJS RR0=RRHO(K)
  1446. rr0=1./rho(i,j,k)
  1447. !JJS RRS=SRRO(K)
  1448. rrs=sqrt(rr0)
  1449. !JJS RRQ=QRRO(K)
  1450. rrq=sqrt(rrs)
  1451. f0(i,j,k)=al/cp/pi(i,j,k)
  1452. f00=f0(i,j,k)
  1453. fv0=fv(i,j,k)
  1454. fvs=sqrt(fv(i,j,k))
  1455. zrr=1.e5*zrc*rrq
  1456. zsr=1.e5*zsc*rrq
  1457. zgr=1.e5*zgc*rrq
  1458. cp409=c409*pi0
  1459. cv409=c409*avc
  1460. cp580=c580*pi0
  1461. cs580=c580*asc
  1462. alvr=r00*alv
  1463. afcp=afc*pir
  1464. avcp=avc*pir
  1465. ascp=asc*pir
  1466. vrcf=vrc*fv0
  1467. vscf=vsc*fv0
  1468. vgcf=vgc*fv0
  1469. vgcr=vgc*rrs
  1470. dwvp=c879*pr0
  1471. r3f=rn3*fv0
  1472. r4f=rn4*fv0
  1473. r5f=rn5*fv0
  1474. r6f=rn6*fv0
  1475. r7r=rn7*rr0
  1476. r8r=rn8*rr0
  1477. r9r=rn9*rr0
  1478. r101f=rn101*fvs
  1479. r10ar=rn10a*r00
  1480. r11rt=rn11*rr0*d2t
  1481. r12r=rn12*r00
  1482. r14r=rn14*rrs
  1483. r14f=rn14*fv0
  1484. r15r=rn15*rrs
  1485. r15ar=rn15a*rrs
  1486. r15f=rn15*fv0
  1487. r15af=rn15a*fv0
  1488. r16r=rn16*rr0
  1489. r17r=rn17*rr0
  1490. r17aq=rn17a*rrq
  1491. r17as=rn17a*fvs
  1492. r18r=rn18*rr0
  1493. r19rt=rn19*rr0*d2t
  1494. r19aq=rn19a*rrq
  1495. r19as=rn19a*fvs
  1496. r20bq=rn20b*rrq
  1497. r20bs=rn20b*fvs
  1498. r22f=rn22*fv0
  1499. r23af=rn23a*fvs
  1500. r23br=rn23b*r00
  1501. r25rt=rn25*rr0*d2t
  1502. r31r=rn31*rr0
  1503. r32rt=rn32*d2t*rrs
  1504. !JJS DO 100 J=3,JLES
  1505. !JJS DO 100 I=3,ILES
  1506. pt(i,j)=dpt(i,j,k)
  1507. qv(i,j)=dqv(i,j,k)
  1508. qc(i,j)=qcl(i,j,k)
  1509. qr(i,j)=qrn(i,j,k)
  1510. qi(i,j)=qci(i,j,k)
  1511. qs(i,j)=qcs(i,j,k)
  1512. qg(i,j)=qcg(i,j,k)
  1513. ! IF (QV(I,J)+QB0 .LE. 0.) QV(I,J)=-QB0
  1514. if (qc(i,j) .le. cmin1) qc(i,j)=0.0
  1515. if (qr(i,j) .le. cmin1) qr(i,j)=0.0
  1516. if (qi(i,j) .le. cmin1) qi(i,j)=0.0
  1517. if (qs(i,j) .le. cmin1) qs(i,j)=0.0
  1518. if (qg(i,j) .le. cmin1) qg(i,j)=0.0
  1519. tair(i,j)=(pt(i,j)+tb0)*pi0
  1520. tairc(i,j)=tair(i,j)-t0
  1521. zr(i,j)=zrr
  1522. zs(i,j)=zsr
  1523. zg(i,j)=zgr
  1524. vr(i,j)=0.0
  1525. vs(i,j)=0.0
  1526. vg(i,j)=0.0
  1527. !JJS 10/7/2008 vvvvv
  1528. IF (IWARM .EQ. 1) THEN
  1529. !JJS for calculating processes related to warm rain only
  1530. qi(i,j)=0.0
  1531. qs(i,j)=0.0
  1532. qg(i,j)=0.0
  1533. dep(i,j)=0.
  1534. pint(i,j)=0.
  1535. psdep(i,j)=0.
  1536. pgdep(i,j)=0.
  1537. dd1(i,j)=0.
  1538. pgsub(i,j)=0.
  1539. psmlt(i,j)=0.
  1540. pgmlt(i,j)=0.
  1541. pimlt(i,j)=0.
  1542. psacw(i,j)=0.
  1543. piacr(i,j)=0.
  1544. psfw(i,j)=0.
  1545. pgfr(i,j)=0.
  1546. dgacw(i,j)=0.
  1547. dgacr(i,j)=0.
  1548. psacr(i,j)=0.
  1549. wgacr(i,j)=0.
  1550. pihom(i,j)=0.
  1551. pidw(i,j)=0.
  1552. if (qr(i,j) .gt. cmin1) then
  1553. dd(i,j)=r00*qr(i,j)
  1554. y1(i,j)=dd(i,j)**.25
  1555. zr(i,j)=zrc/y1(i,j)
  1556. vr(i,j)=max(vrcf*dd(i,j)**bwq, 0.)
  1557. endif
  1558. !* 21 * PRAUT AUTOCONVERSION OF QC TO QR **21**
  1559. !* 22 * PRACW : ACCRETION OF QC BY QR **22**
  1560. pracw(i,j)=0.
  1561. praut(i,j)=0.0
  1562. pracw(i,j)=r22f*qc(i,j)/zr(i,j)**bw3
  1563. y1(i,j)=qc(i,j)-bnd3
  1564. if (y1(i,j).gt.0.0) then
  1565. praut(i,j)=r00*y1(i,j)*y1(i,j)/(1.2e-4+rn21/y1(i,j))
  1566. endif
  1567. !C******** HANDLING THE NEGATIVE CLOUD WATER (QC) ******************
  1568. Y1(I,J)=QC(I,J)/D2T
  1569. PRAUT(I,J)=MIN(Y1(I,J), PRAUT(I,J))
  1570. PRACW(I,J)=MIN(Y1(I,J), PRACW(I,J))
  1571. Y1(I,J)=(PRAUT(I,J)+PRACW(I,J))*D2T
  1572. if (qc(i,j) .lt. y1(i,j) .and. y1(i,j) .ge. cmin2) then
  1573. y2(i,j)=qc(i,j)/(y1(i,j)+cmin2)
  1574. praut(i,j)=praut(i,j)*y2(i,j)
  1575. pracw(i,j)=pracw(i,j)*y2(i,j)
  1576. qc(i,j)=0.0
  1577. else
  1578. qc(i,j)=qc(i,j)-y1(i,j)
  1579. endif
  1580. PR(I,J)=(PRAUT(I,J)+PRACW(I,J))*D2T
  1581. QR(I,J)=QR(I,J)+PR(I,J)
  1582. !***** TAO ET AL (1989) SATURATION TECHNIQUE ***********************
  1583. cnd(i,j)=0.0
  1584. tair(i,j)=(pt(i,j)+tb0)*pi0
  1585. y1(i,j)=1./(tair(i,j)-c358)
  1586. qsw(i,j)=rp0*exp(c172-c409*y1(i,j))
  1587. dd(i,j)=cp409*y1(i,j)*y1(i,j)
  1588. dm(i,j)=qv(i,j)+qb0-qsw(i,j)
  1589. cnd(i,j)=dm(i,j)/(1.+avcp*dd(i,j)*qsw(i,j))
  1590. !c ****** condensation or evaporation of qc ******
  1591. cnd(i,j)=max(-qc(i,j), cnd(i,j))
  1592. pt(i,j)=pt(i,j)+avcp*cnd(i,j)
  1593. qv(i,j)=qv(i,j)-cnd(i,j)
  1594. qc(i,j)=qc(i,j)+cnd(i,j)
  1595. !C ****** EVAPORATION ******
  1596. !* 23 * ERN : EVAPORATION OF QR (SUBSATURATION) **23**
  1597. ern(i,j)=0.0
  1598. if(qr(i,j).gt.0.0) then
  1599. tair(i,j)=(pt(i,j)+tb0)*pi0
  1600. rtair(i,j)=1./(tair(i,j)-c358)
  1601. qsw(i,j)=rp0*exp(c172-c409*rtair(i,j))
  1602. ssw(i,j)=(qv(i,j)+qb0)/qsw(i,j)-1.0
  1603. dm(i,j)=qv(i,j)+qb0-qsw(i,j)
  1604. rsub1(i,j)=cv409*qsw(i,j)*rtair(i,j)*rtair(i,j)
  1605. dd1(i,j)=max(-dm(i,j)/(1.+rsub1(i,j)), 0.0)
  1606. y1(i,j)=.78/zr(i,j)**2+r23af*scv(i,j)/zr(i,j)**bwh5
  1607. y2(i,j)=r23br/(tca(i,j)*tair(i,j)**2)+1./(dwv(i,j) &
  1608. *qsw(i,j))
  1609. !cccc
  1610. ern(i,j)=r23t*ssw(i,j)*y1(i,j)/y2(i,j)
  1611. ern(i,j)=min(dd1(i,j),qr(i,j),max(ern(i,j),0.))
  1612. pt(i,j)=pt(i,j)-avcp*ern(i,j)
  1613. qv(i,j)=qv(i,j)+ern(i,j)
  1614. qr(i,j)=qr(i,j)-ern(i,j)
  1615. endif
  1616. ELSE ! part of if (iwarm.eq.1) then
  1617. !JJS 10/7/2008 ^^^^^
  1618. !JJS for calculating processes related to both ice and warm rain
  1619. ! *** COMPUTE ZR,ZS,ZG,VR,VS,VG *****************************
  1620. if (qr(i,j) .gt. cmin1) then
  1621. dd(i,j)=r00*qr(i,j)
  1622. y1(i,j)=dd(i,j)**.25
  1623. zr(i,j)=zrc/y1(i,j)
  1624. vr(i,j)=max(vrcf*dd(i,j)**bwq, 0.)
  1625. endif
  1626. if (qs(i,j) .gt. cmin1) then
  1627. dd(i,j)=r00*qs(i,j)
  1628. y1(i,j)=dd(i,j)**.25
  1629. zs(i,j)=zsc/y1(i,j)
  1630. vs(i,j)=max(vscf*dd(i,j)**bsq, 0.)
  1631. endif
  1632. if (qg(i,j) .gt. cmin1) then
  1633. dd(i,j)=r00*qg(i,j)
  1634. y1(i,j)=dd(i,j)**.25
  1635. zg(i,j)=zgc/y1(i,j)
  1636. if(ihail .eq. 1) then
  1637. vg(i,j)=max(vgcr*dd(i,j)**bgq, 0.)
  1638. else
  1639. vg(i,j)=max(vgcf*dd(i,j)**bgq, 0.)
  1640. endif
  1641. endif
  1642. if (qr(i,j) .le. cmin2) vr(i,j)=0.0
  1643. if (qs(i,j) .le. cmin2) vs(i,j)=0.0
  1644. if (qg(i,j) .le. cmin2) vg(i,j)=0.0
  1645. ! ******************************************************************
  1646. ! *** Y1 : DYNAMIC VISCOSITY OF AIR (U)
  1647. ! *** DWV : DIFFUSIVITY OF WATER VAPOR IN AIR (PI)
  1648. ! *** TCA : THERMAL CONDUCTIVITY OF AIR (KA)
  1649. ! *** Y2 : KINETIC VISCOSITY (V)
  1650. y1(i,j)=c149*tair(i,j)**1.5/(tair(i,j)+120.)
  1651. dwv(i,j)=dwvp*tair(i,j)**1.81
  1652. tca(i,j)=c141*y1(i,j)
  1653. scv(i,j)=1./((rr0*y1(i,j))**.1666667*dwv(i,j)**.3333333)
  1654. !JJS 100 CONTINUE
  1655. !* 1 * PSAUT : AUTOCONVERSION OF QI TO QS ***1**
  1656. !* 3 * PSACI : ACCRETION OF QI TO QS ***3**
  1657. !* 4 * PSACW : ACCRETION OF QC BY QS (RIMING) (QSACW FOR PSMLT) ***4**
  1658. !* 5 * PRACI : ACCRETION OF QI BY QR ***5**
  1659. !* 6 * PIACR : ACCRETION OF QR OR QG BY QI ***6**
  1660. !JJS DO 125 J=3,JLES
  1661. !JJS DO 125 I=3,ILES
  1662. psaut(i,j)=0.0
  1663. psaci(i,j)=0.0
  1664. praci(i,j)=0.0
  1665. piacr(i,j)=0.0
  1666. psacw(i,j)=0.0
  1667. qsacw(i,j)=0.0
  1668. dd(i,j)=1./zs(i,j)**bs3
  1669. if (tair(i,j).lt.t0) then
  1670. esi(i,j)=exp(.025*tairc(i,j))
  1671. psaut(i,j)=r2is*max(rn1*esi(i,j)*(qi(i,j)-bnd1) ,0.0)
  1672. psaci(i,j)=r2is*r3f*esi(i,j)*qi(i,j)*dd(i,j)
  1673. !JJS 3/30/06
  1674. ! to cut water to snow accretion by half
  1675. ! PSACW(I,J)=R4F*QC(I,J)*DD(I,J)
  1676. psacw(i,j)=r2is*0.5*r4f*qc(i,j)*dd(i,j)
  1677. !JJS 3/30/06
  1678. praci(i,j)=r2is*r5f*qi(i,j)/zr(i,j)**bw3
  1679. piacr(i,j)=r2is*r6f*qi(i,j)*(zr(i,j)**(-bw6))
  1680. !JJS PIACR(I,J)=R6F*QI(I,J)/ZR(I,J)**BW6
  1681. else
  1682. qsacw(i,j)=r2is*r4f*qc(i,j)*dd(i,j)
  1683. endif
  1684. !* 21 * PRAUT AUTOCONVERSION OF QC TO QR **21**
  1685. !* 22 * PRACW : ACCRETION OF QC BY QR **22**
  1686. pracw(i,j)=r22f*qc(i,j)/zr(i,j)**bw3
  1687. praut(i,j)=0.0
  1688. y1(i,j)=qc(i,j)-bnd3
  1689. if (y1(i,j).gt.0.0) then
  1690. praut(i,j)=r00*y1(i,j)*y1(i,j)/(1.2e-4+rn21/y1(i,j))
  1691. endif
  1692. !* 12 * PSFW : BERGERON PROCESSES FOR QS (KOENING, 1971) **12**
  1693. !* 13 * PSFI : BERGERON PROCESSES FOR QS **13**
  1694. psfw(i,j)=0.0
  1695. psfi(i,j)=0.0
  1696. pidep(i,j)=0.0
  1697. if(tair(i,j).lt.t0.and.qi(i,j).gt.cmin) then
  1698. y1(i,j)=max( min(tairc(i,j), -1.), -31.)
  1699. it(i,j)=int(abs(y1(i,j)))
  1700. y1(i,j)=rn12a(it(i,j))
  1701. y2(i,j)=rn12b(it(i,j))
  1702. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1703. psfw(i,j)=r2is* &
  1704. max(d2t*y1(i,j)*(y2(i,j)+r12r*qc(i,j))*qi(i,j),0.0)
  1705. rtair(i,j)=1./(tair(i,j)-c76)
  1706. y2(i,j)=exp(c218-c580*rtair(i,j))
  1707. qsi(i,j)=rp0*y2(i,j)
  1708. esi(i,j)=c610*y2(i,j)
  1709. ssi(i,j)=(qv(i,j)+qb0)/qsi(i,j)-1.
  1710. r_nci=min(1.e-6*exp(-.46*tairc(i,j)),1.)
  1711. ! R_NCI=min(1.e-8*EXP(-.6*TAIRC(I,J)),1.) ! use Tao's
  1712. dm(i,j)=max( (qv(i,j)+qb0-qsi(i,j)), 0.)
  1713. rsub1(i,j)=cs580*qsi(i,j)*rtair(i,j)*rtair(i,j)
  1714. y3(i,j)=1./tair(i,j)
  1715. dd(i,j)=y3(i,j)*(rn30a*y3(i,j)-rn30b)+rn30c*tair(i,j)/esi(i,j)
  1716. y1(i,j)=206.18*ssi(i,j)/dd(i,j)
  1717. pidep(i,j)=y1(i,j)*sqrt(r_nci*qi(i,j)/r00)
  1718. dep(i,j)=dm(i,j)/(1.+rsub1(i,j))/d2t
  1719. if(dm(i,j).gt.cmin2) then
  1720. a2=1.
  1721. if(pidep(i,j).gt.dep(i,j).and.pidep(i,j).gt.cmin2) then
  1722. a2=dep(i,j)/pidep(i,j)
  1723. pidep(i,j)=dep(i,j)
  1724. endif
  1725. psfi(i,j)=r2is*a2*.5*qi(i,j)*y1(i,j)/(sqrt(ami100) &
  1726. -sqrt(ami40))
  1727. elseif(dm(i,j).lt.-cmin2) then
  1728. !
  1729. ! SUBLIMATION TERMS USED ONLY WHEN SATURATION ADJUSTMENT FOR ICE
  1730. ! IS TURNED OFF
  1731. !
  1732. pidep(i,j)=0.
  1733. psfi(i,j)=0.
  1734. else
  1735. pidep(i,j)=0.
  1736. psfi(i,j)=0.
  1737. endif
  1738. endif
  1739. !TTT***** QG=QG+MIN(PGDRY,PGWET)
  1740. !* 9 * PGACS : ACCRETION OF QS BY QG (DGACS,WGACS: DRY AND WET) ***9**
  1741. !* 14 * DGACW : ACCRETION OF QC BY QG (QGACW FOR PGMLT) **14**
  1742. !* 16 * DGACR : ACCRETION OF QR TO QG (QGACR FOR PGMLT) **16**
  1743. if(qc(i,j)+qr(i,j).lt.1.e-4) then
  1744. ee1=.01
  1745. else
  1746. ee1=1.
  1747. endif
  1748. ee2=0.09
  1749. egs(i,j)=ee1*exp(ee2*tairc(i,j))
  1750. ! EGS(I,J)=0.1 ! 6/15/02 tao's
  1751. if (tair(i,j).ge.t0) egs(i,j)=1.0
  1752. y1(i,j)=abs(vg(i,j)-vs(i,j))
  1753. y2(i,j)=zs(i,j)*zg(i,j)
  1754. y3(i,j)=5./y2(i,j)
  1755. y4(i,j)=.08*y3(i,j)*y3(i,j)
  1756. y5(i,j)=.05*y3(i,j)*y4(i,j)
  1757. dd(i,j)=y1(i,j)*(y3(i,j)/zs(i,j)**5+y4(i,j)/zs(i,j)**3 &
  1758. +y5(i,j)/zs(i,j))
  1759. pgacs(i,j)=r2ig*r2is*r9r*egs(i,j)*dd(i,j)
  1760. !JJS 1/3/06 from Steve and Chunglin
  1761. if (ihail.eq.1) then
  1762. dgacs(i,j)=pgacs(i,j)
  1763. else
  1764. dgacs(i,j)=0.
  1765. endif
  1766. !JJS 1/3/06 from Steve and Chunglin
  1767. wgacs(i,j)=r2ig*r2is*r9r*dd(i,j)
  1768. ! WGACS(I,J)=0. ! 6/15/02 tao's
  1769. y1(i,j)=1./zg(i,j)**bg3
  1770. if(ihail .eq. 1) then
  1771. dgacw(i,j)=r2ig*max(r14r*qc(i,j)*y1(i,j), 0.0)
  1772. else
  1773. dgacw(i,j)=r2ig*max(r14f*qc(i,j)*y1(i,j), 0.0)
  1774. endif
  1775. qgacw(i,j)=dgacw(i,j)
  1776. y1(i,j)=abs(vg(i,j)-vr(i,j))
  1777. y2(i,j)=zr(i,j)*zg(i,j)
  1778. y3(i,j)=5./y2(i,j)
  1779. y4(i,j)=.08*y3(i,j)*y3(i,j)
  1780. y5(i,j)=.05*y3(i,j)*y4(i,j)
  1781. dd(i,j)=r16r*y1(i,j)*(y3(i,j)/zr(i,j)**5+y4(i,j)/zr(i,j)**3 &
  1782. +y5(i,j)/zr(i,j))
  1783. dgacr(i,j)=r2ig*max(dd(i,j), 0.0)
  1784. qgacr(i,j)=dgacr(i,j)
  1785. if (tair(i,j).ge.t0) then
  1786. dgacs(i,j)=0.0
  1787. wgacs(i,j)=0.0
  1788. dgacw(i,j)=0.0
  1789. dgacr(i,j)=0.0
  1790. else
  1791. pgacs(i,j)=0.0
  1792. qgacw(i,j)=0.0
  1793. qgacr(i,j)=0.0
  1794. endif
  1795. !*******PGDRY : DGACW+DGACI+DGACR+DGACS ******
  1796. !* 15 * DGACI : ACCRETION OF QI BY QG (WGACI FOR WET GROWTH) **15**
  1797. !* 17 * PGWET : WET GROWTH OF QG **17**
  1798. dgaci(i,j)=0.0
  1799. wgaci(i,j)=0.0
  1800. pgwet(i,j)=0.0
  1801. if (tair(i,j).lt.t0) then
  1802. y1(i,j)=qi(i,j)/zg(i,j)**bg3
  1803. if (ihail.eq.1) then
  1804. dgaci(i,j)=r2ig*r15r*y1(i,j)
  1805. wgaci(i,j)=r2ig*r15ar*y1(i,j)
  1806. ! WGACI(I,J)=0. ! 6/15/02 tao's
  1807. else
  1808. !JJS DGACI(I,J)=r2ig*R15F*Y1(I,J)
  1809. dgaci(i,j)=0.
  1810. wgaci(i,j)=r2ig*r15af*y1(i,j)
  1811. ! WGACI(I,J)=0. ! 6/15/02 tao's
  1812. endif
  1813. !
  1814. if (tairc(i,j).ge.-50.) then
  1815. if (alf+rn17c*tairc(i,j) .eq. 0.) then
  1816. write(91,*) itimestep, i,j,k, alf, rn17c, tairc(i,j)
  1817. endif
  1818. y1(i,j)=1./(alf+rn17c*tairc(i,j))
  1819. if (ihail.eq.1) then
  1820. y3(i,j)=.78/zg(i,j)**2+r17aq*scv(i,j)/zg(i,j)**bgh5
  1821. else
  1822. y3(i,j)=.78/zg(i,j)**2+r17as*scv(i,j)/zg(i,j)**bgh5
  1823. endif
  1824. y4(i,j)=alvr*dwv(i,j)*(rp0-(qv(i,j)+qb0)) &
  1825. -tca(i,j)*tairc(i,j)
  1826. dd(i,j)=y1(i,j)*(r17r*y4(i,j)*y3(i,j) &
  1827. +(wgaci(i,j)+wgacs(i,j))*(alf+rn17b*tairc(i,j)))
  1828. pgwet(i,j)=r2ig*max(dd(i,j), 0.0)
  1829. endif
  1830. endif
  1831. !JJS 125 CONTINUE
  1832. !******** HANDLING THE NEGATIVE CLOUD WATER (QC) ******************
  1833. !******** HANDLING THE NEGATIVE CLOUD ICE (QI) ******************
  1834. !JJS DO 150 J=3,JLES
  1835. !JJS DO 150 I=3,ILES
  1836. y1(i,j)=qc(i,j)/d2t
  1837. psacw(i,j)=min(y1(i,j), psacw(i,j))
  1838. praut(i,j)=min(y1(i,j), praut(i,j))
  1839. pracw(i,j)=min(y1(i,j), pracw(i,j))
  1840. psfw(i,j)= min(y1(i,j), psfw(i,j))
  1841. dgacw(i,j)=min(y1(i,j), dgacw(i,j))
  1842. qsacw(i,j)=min(y1(i,j), qsacw(i,j))
  1843. qgacw(i,j)=min(y1(i,j), qgacw(i,j))
  1844. y1(i,j)=(psacw(i,j)+praut(i,j)+pracw(i,j)+psfw(i,j) &
  1845. +dgacw(i,j)+qsacw(i,j)+qgacw(i,j))*d2t
  1846. qc(i,j)=qc(i,j)-y1(i,j)
  1847. if (qc(i,j) .lt. 0.0) then
  1848. a1=1.
  1849. if (y1(i,j) .ne. 0.0) a1=qc(i,j)/y1(i,j)+1.
  1850. psacw(i,j)=psacw(i,j)*a1
  1851. praut(i,j)=praut(i,j)*a1
  1852. pracw(i,j)=pracw(i,j)*a1
  1853. psfw(i,j)=psfw(i,j)*a1
  1854. dgacw(i,j)=dgacw(i,j)*a1
  1855. qsacw(i,j)=qsacw(i,j)*a1
  1856. qgacw(i,j)=qgacw(i,j)*a1
  1857. qc(i,j)=0.0
  1858. endif
  1859. !c
  1860. !
  1861. !******** SHED PROCESS (WGACR=PGWET-DGACW-WGACI-WGACS)
  1862. !c
  1863. wgacr(i,j)=pgwet(i,j)-dgacw(i,j)-wgaci(i,j)-wgacs(i,j)
  1864. y2(i,j)=dgacw(i,j)+dgaci(i,j)+dgacr(i,j)+dgacs(i,j)
  1865. if (pgwet(i,j).ge.y2(i,j)) then
  1866. wgacr(i,j)=0.0
  1867. wgaci(i,j)=0.0
  1868. wgacs(i,j)=0.0
  1869. else
  1870. dgacr(i,j)=0.0
  1871. dgaci(i,j)=0.0
  1872. dgacs(i,j)=0.0
  1873. endif
  1874. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1875. !c
  1876. y1(i,j)=qi(i,j)/d2t
  1877. psaut(i,j)=min(y1(i,j), psaut(i,j))
  1878. psaci(i,j)=min(y1(i,j), psaci(i,j))
  1879. praci(i,j)=min(y1(i,j), praci(i,j))
  1880. psfi(i,j)= min(y1(i,j), psfi(i,j))
  1881. dgaci(i,j)=min(y1(i,j), dgaci(i,j))
  1882. wgaci(i,j)=min(y1(i,j), wgaci(i,j))
  1883. !
  1884. y2(i,j)=(psaut(i,j)+psaci(i,j)+praci(i,j)+psfi(i,j) &
  1885. +dgaci(i,j)+wgaci(i,j))*d2t
  1886. qi(i,j)=qi(i,j)-y2(i,j)+pidep(i,j)*d2t
  1887. if (qi(i,j).lt.0.0) then
  1888. a2=1.
  1889. if (y2(i,j) .ne. 0.0) a2=qi(i,j)/y2(i,j)+1.
  1890. psaut(i,j)=psaut(i,j)*a2
  1891. psaci(i,j)=psaci(i,j)*a2
  1892. praci(i,j)=praci(i,j)*a2
  1893. psfi(i,j)=psfi(i,j)*a2
  1894. dgaci(i,j)=dgaci(i,j)*a2
  1895. wgaci(i,j)=wgaci(i,j)*a2
  1896. qi(i,j)=0.0
  1897. endif
  1898. !
  1899. dlt3(i,j)=0.0
  1900. dlt2(i,j)=0.0
  1901. !
  1902. ! DLT4(I,J)=1.0
  1903. ! if(qc(i,j) .gt. 5.e-4) dlt4(i,j)=0.0
  1904. ! if(qs(i,j) .le. 1.e-4) dlt4(i,j)=1.0
  1905. !
  1906. ! IF (TAIR(I,J).ge.T0) THEN
  1907. ! DLT4(I,J)=0.0
  1908. ! ENDIF
  1909. if (tair(i,j).lt.t0) then
  1910. if (qr(i,j).lt.1.e-4) then
  1911. dlt3(i,j)=1.0
  1912. dlt2(i,j)=1.0
  1913. endif
  1914. if (qs(i,j).ge.1.e-4) then
  1915. dlt2(i,j)=0.0
  1916. endif
  1917. endif
  1918. if (ice2 .eq. 1) then
  1919. dlt3(i,j)=1.0
  1920. dlt2(i,j)=1.0
  1921. endif
  1922. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1923. pr(i,j)=(qsacw(i,j)+praut(i,j)+pracw(i,j)+qgacw(i,j))*d2t
  1924. ps(i,j)=(psaut(i,j)+psaci(i,j)+psacw(i,j)+psfw(i,j) &
  1925. +psfi(i,j)+dlt3(i,j)*praci(i,j))*d2t
  1926. ! PS(I,J)=(PSAUT(I,J)+PSACI(I,J)+dlt4(i,j)*PSACW(I,J)
  1927. ! 1 +PSFW(I,J)+PSFI(I,J)+DLT3(I,J)*PRACI(I,J))*D2T
  1928. pg(i,j)=((1.-dlt3(i,j))*praci(i,j)+dgaci(i,j)+wgaci(i,j) &
  1929. +dgacw(i,j))*d2t
  1930. ! PG(I,J)=((1.-DLT3(I,J))*PRACI(I,J)+DGACI(I,J)+WGACI(I,J)
  1931. ! 1 +DGACW(I,J)+(1.-dlt4(i,j))*PSACW(I,J))*D2T
  1932. !JJS 150 CONTINUE
  1933. !* 7 * PRACS : ACCRETION OF QS BY QR ***7**
  1934. !* 8 * PSACR : ACCRETION OF QR BY QS (QSACR FOR PSMLT) ***8**
  1935. !JJS DO 175 J=3,JLES
  1936. !JJS DO 175 I=3,ILES
  1937. y1(i,j)=abs(vr(i,j)-vs(i,j))
  1938. y2(i,j)=zr(i,j)*zs(i,j)
  1939. y3(i,j)=5./y2(i,j)
  1940. y4(i,j)=.08*y3(i,j)*y3(i,j)
  1941. y5(i,j)=.05*y3(i,j)*y4(i,j)
  1942. pracs(i,j)=r2ig*r2is*r7r*y1(i,j)*(y3(i,j)/zs(i,j)**5 &
  1943. +y4(i,j)/zs(i,j)**3+y5(i,j)/zs(i,j))
  1944. psacr(i,j)=r2is*r8r*y1(i,j)*(y3(i,j)/zr(i,j)**5 &
  1945. +y4(i,j)/zr(i,j)**3+y5(i,j)/zr(i,j))
  1946. qsacr(i,j)=psacr(i,j)
  1947. if (tair(i,j).ge.t0) then
  1948. pracs(i,j)=0.0
  1949. psacr(i,j)=0.0
  1950. else
  1951. qsacr(i,j)=0.0
  1952. endif
  1953. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  1954. !* 2 * PGAUT : AUTOCONVERSION OF QS TO QG ***2**
  1955. !* 18 * PGFR : FREEZING OF QR TO QG **18**
  1956. pgaut(i,j)=0.0
  1957. pgfr(i,j)=0.0
  1958. if (tair(i,j) .lt. t0) then
  1959. ! Y1(I,J)=EXP(.09*TAIRC(I,J))
  1960. ! PGAUT(I,J)=r2is*max(RN2*Y1(I,J)*(QS(I,J)-BND2), 0.0)
  1961. ! IF(IHAIL.EQ.1) PGAUT(I,J)=max(RN2*Y1(I,J)*(QS(I,J)-BND2),0.0)
  1962. y2(i,j)=exp(rn18a*(t0-tair(i,j)))
  1963. !JJS PGFR(I,J)=r2ig*max(R18R*(Y2(I,J)-1.)/ZR(I,J)**7., 0.0)
  1964. ! pgfr(i,j)=r2ice*max(r18r*(y2(i,j)-1.)* &
  1965. ! (zr(i,j)**(-7.)), 0.0)
  1966. ! modify to prevent underflow on some computers (JD)
  1967. temp = 1./zr(i,j)
  1968. temp = temp*temp*temp*temp*temp*temp*temp
  1969. pgfr(i,j)=r2ig*max(r18r*(y2(i,j)-1.)* &
  1970. temp, 0.0)
  1971. endif
  1972. !JJS 175 CONTINUE
  1973. !******** HANDLING THE NEGATIVE RAIN WATER (QR) *******************
  1974. !******** HANDLING THE NEGATIVE SNOW (QS) *******************
  1975. !JJS DO 200 J=3,JLES
  1976. !JJS DO 200 I=3,ILES
  1977. y1(i,j)=qr(i,j)/d2t
  1978. y2(i,j)=-qg(i,j)/d2t
  1979. piacr(i,j)=min(y1(i,j), piacr(i,j))
  1980. dgacr(i,j)=min(y1(i,j), dgacr(i,j))
  1981. wgacr(i,j)=min(y1(i,j), wgacr(i,j))
  1982. wgacr(i,j)=max(y2(i,j), wgacr(i,j))
  1983. psacr(i,j)=min(y1(i,j), psacr(i,j))
  1984. pgfr(i,j)= min(y1(i,j), pgfr(i,j))
  1985. del=0.
  1986. if(wgacr(i,j) .lt. 0.) del=1.
  1987. y1(i,j)=(piacr(i,j)+dgacr(i,j)+(1.-del)*wgacr(i,j) &
  1988. +psacr(i,j)+pgfr(i,j))*d2t
  1989. qr(i,j)=qr(i,j)+pr(i,j)-y1(i,j)-del*wgacr(i,j)*d2t
  1990. if (qr(i,j) .lt. 0.0) then
  1991. a1=1.
  1992. if(y1(i,j) .ne. 0.) a1=qr(i,j)/y1(i,j)+1.
  1993. piacr(i,j)=piacr(i,j)*a1
  1994. dgacr(i,j)=dgacr(i,j)*a1
  1995. if (wgacr(i,j).gt.0.) wgacr(i,j)=wgacr(i,j)*a1
  1996. pgfr(i,j)=pgfr(i,j)*a1
  1997. psacr(i,j)=psacr(i,j)*a1
  1998. qr(i,j)=0.0
  1999. endif
  2000. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2001. prn(i,j)=d2t*((1.-dlt3(i,j))*piacr(i,j)+dgacr(i,j) &
  2002. +wgacr(i,j)+(1.-dlt2(i,j))*psacr(i,j)+pgfr(i,j))
  2003. ps(i,j)=ps(i,j)+d2t*(dlt3(i,j)*piacr(i,j) &
  2004. +dlt2(i,j)*psacr(i,j))
  2005. pracs(i,j)=(1.-dlt2(i,j))*pracs(i,j)
  2006. y1(i,j)=qs(i,j)/d2t
  2007. pgacs(i,j)=min(y1(i,j), pgacs(i,j))
  2008. dgacs(i,j)=min(y1(i,j), dgacs(i,j))
  2009. wgacs(i,j)=min(y1(i,j), wgacs(i,j))
  2010. pgaut(i,j)=min(y1(i,j), pgaut(i,j))
  2011. pracs(i,j)=min(y1(i,j), pracs(i,j))
  2012. psn(i,j)=d2t*(pgacs(i,j)+dgacs(i,j)+wgacs(i,j) &
  2013. +pgaut(i,j)+pracs(i,j))
  2014. qs(i,j)=qs(i,j)+ps(i,j)-psn(i,j)
  2015. if (qs(i,j).lt.0.0) then
  2016. a2=1.
  2017. if (psn(i,j) .ne. 0.0) a2=qs(i,j)/psn(i,j)+1.
  2018. pgacs(i,j)=pgacs(i,j)*a2
  2019. dgacs(i,j)=dgacs(i,j)*a2
  2020. wgacs(i,j)=wgacs(i,j)*a2
  2021. pgaut(i,j)=pgaut(i,j)*a2
  2022. pracs(i,j)=pracs(i,j)*a2
  2023. psn(i,j)=psn(i,j)*a2
  2024. qs(i,j)=0.0
  2025. endif
  2026. !
  2027. !C PSN(I,J)=D2T*(PGACS(I,J)+DGACS(I,J)+WGACS(I,J)
  2028. !c +PGAUT(I,J)+PRACS(I,J))
  2029. y2(i,j)=d2t*(psacw(i,j)+psfw(i,j)+dgacw(i,j)+piacr(i,j) &
  2030. +dgacr(i,j)+wgacr(i,j)+psacr(i,j)+pgfr(i,j))
  2031. pt(i,j)=pt(i,j)+afcp*y2(i,j)
  2032. qg(i,j)=qg(i,j)+pg(i,j)+prn(i,j)+psn(i,j)
  2033. !JJS 200 CONTINUE
  2034. !* 11 * PSMLT : MELTING OF QS **11**
  2035. !* 19 * PGMLT : MELTING OF QG TO QR **19**
  2036. !JJS DO 225 J=3,JLES
  2037. !JJS DO 225 I=3,ILES
  2038. psmlt(i,j)=0.0
  2039. pgmlt(i,j)=0.0
  2040. tair(i,j)=(pt(i,j)+tb0)*pi0
  2041. if (tair(i,j).ge.t0) then
  2042. tairc(i,j)=tair(i,j)-t0
  2043. y1(i,j)=tca(i,j)*tairc(i,j)-alvr*dwv(i,j) &
  2044. *(rp0-(qv(i,j)+qb0))
  2045. y2(i,j)=.78/zs(i,j)**2+r101f*scv(i,j)/zs(i,j)**bsh5
  2046. dd(i,j)=r11rt*y1(i,j)*y2(i,j)+r11at*tairc(i,j) &
  2047. *(qsacw(i,j)+qsacr(i,j))
  2048. psmlt(i,j)=r2is*max(0.0, min(dd(i,j), qs(i,j)))
  2049. if(ihail.eq.1) then
  2050. y3(i,j)=.78/zg(i,j)**2+r19aq*scv(i,j)/zg(i,j)**bgh5
  2051. else
  2052. y3(i,j)=.78/zg(i,j)**2+r19as*scv(i,j)/zg(i,j)**bgh5
  2053. endif
  2054. dd1(i,j)=r19rt*y1(i,j)*y3(i,j)+r19bt*tairc(i,j) &
  2055. *(qgacw(i,j)+qgacr(i,j))
  2056. pgmlt(i,j)=r2ig*max(0.0, min(dd1(i,j), qg(i,j)))
  2057. pt(i,j)=pt(i,j)-afcp*(psmlt(i,j)+pgmlt(i,j))
  2058. qr(i,j)=qr(i,j)+psmlt(i,j)+pgmlt(i,j)
  2059. qs(i,j)=qs(i,j)-psmlt(i,j)
  2060. qg(i,j)=qg(i,j)-pgmlt(i,j)
  2061. endif
  2062. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2063. !* 24 * PIHOM : HOMOGENEOUS FREEZING OF QC TO QI (T < T00) **24**
  2064. !* 25 * PIDW : DEPOSITION GROWTH OF QC TO QI ( T0 < T <= T00) **25**
  2065. !* 26 * PIMLT : MELTING OF QI TO QC (T >= T0) **26**
  2066. if (qc(i,j).le.cmin1) qc(i,j)=0.0
  2067. if (qi(i,j).le.cmin1) qi(i,j)=0.0
  2068. tair(i,j)=(pt(i,j)+tb0)*pi0
  2069. if(tair(i,j).le.t00) then
  2070. pihom(i,j)=qc(i,j)
  2071. else
  2072. pihom(i,j)=0.0
  2073. endif
  2074. if(tair(i,j).ge.t0) then
  2075. pimlt(i,j)=qi(i,j)
  2076. else
  2077. pimlt(i,j)=0.0
  2078. endif
  2079. pidw(i,j)=0.0
  2080. if (tair(i,j).lt.t0 .and. tair(i,j).gt.t00) then
  2081. tairc(i,j)=tair(i,j)-t0
  2082. y1(i,j)=max( min(tairc(i,j), -1.), -31.)
  2083. it(i,j)=int(abs(y1(i,j)))
  2084. y2(i,j)=aa1(it(i,j))
  2085. y3(i,j)=aa2(it(i,j))
  2086. y4(i,j)=exp(abs(beta*tairc(i,j)))
  2087. y5(i,j)=(r00*qi(i,j)/(r25a*y4(i,j)))**y3(i,j)
  2088. pidw(i,j)=min(r25rt*y2(i,j)*y4(i,j)*y5(i,j), qc(i,j))
  2089. endif
  2090. y1(i,j)=pihom(i,j)-pimlt(i,j)+pidw(i,j)
  2091. pt(i,j)=pt(i,j)+afcp*y1(i,j)+ascp*(pidep(i,j))*d2t
  2092. qv(i,j)=qv(i,j)-(pidep(i,j))*d2t
  2093. qc(i,j)=qc(i,j)-y1(i,j)
  2094. qi(i,j)=qi(i,j)+y1(i,j)
  2095. !* 31 * PINT : INITIATION OF QI **31**
  2096. !* 32 * PIDEP : DEPOSITION OF QI **32**
  2097. !
  2098. ! CALCULATION OF PINT USES DIFFERENT VALUES OF THE INTERCEPT AND SLOPE FOR
  2099. ! THE FLETCHER EQUATION. ALSO, ONLY INITIATE MORE ICE IF THE NEW NUMBER
  2100. ! CONCENTRATION EXCEEDS THAT ALREADY PRESENT.
  2101. !* 31 * pint : initiation of qi **31**
  2102. !* 32 * pidep : deposition of qi **32**
  2103. pint(i,j)=0.0
  2104. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2105. if ( itaobraun.eq.1 ) then
  2106. tair(i,j)=(pt(i,j)+tb0)*pi0
  2107. if (tair(i,j) .lt. t0) then
  2108. ! if (qi(i,j) .le. cmin) qi(i,j)=0.
  2109. if (qi(i,j) .le. cmin2) qi(i,j)=0.
  2110. tairc(i,j)=tair(i,j)-t0
  2111. rtair(i,j)=1./(tair(i,j)-c76)
  2112. y2(i,j)=exp(c218-c580*rtair(i,j))
  2113. qsi(i,j)=rp0*y2(i,j)
  2114. esi(i,j)=c610*y2(i,j)
  2115. ssi(i,j)=(qv(i,j)+qb0)/qsi(i,j)-1.
  2116. ami50=3.76e-8
  2117. !ccif ( itaobraun.eq.1 ) --> betah=0.5*beta=-.46*0.5=-0.23; cn0=1.e-6
  2118. !ccif ( itaobraun.eq.0 ) --> betah=0.5*beta=-.6*0.5=-0.30; cn0=1.e-8
  2119. y1(i,j)=1./tair(i,j)
  2120. !cc insert a restriction on ice collection that ice collection
  2121. !cc should be stopped at -30 c (with cn0=1.e-6, beta=-.46)
  2122. tairccri=tairc(i,j) ! in degree c
  2123. if(tairccri.le.-30.) tairccri=-30.
  2124. ! y2(i,j)=exp(betah*tairc(i,j))
  2125. y2(i,j)=exp(betah*tairccri)
  2126. y3(i,j)=sqrt(qi(i,j))
  2127. dd(i,j)=y1(i,j)*(rn10a*y1(i,j)-rn10b)+rn10c*tair(i,j) &
  2128. /esi(i,j)
  2129. pidep(i,j)=max(r32rt*ssi(i,j)*y2(i,j)*y3(i,j)/dd(i,j), 0.e0)
  2130. r_nci=min(cn0*exp(beta*tairc(i,j)),1.)
  2131. ! r_nci=min(1.e-6*exp(-.46*tairc(i,j)),1.)
  2132. dd(i,j)=max(1.e-9*r_nci/r00-qi(i,j)*1.e-9/ami50, 0.)
  2133. dm(i,j)=max( (qv(i,j)+qb0-qsi(i,j)), 0.0)
  2134. rsub1(i,j)=cs580*qsi(i,j)*rtair(i,j)*rtair(i,j)
  2135. dep(i,j)=dm(i,j)/(1.+rsub1(i,j))
  2136. pint(i,j)=max(min(dd(i,j), dm(i,j)), 0.)
  2137. ! pint(i,j)=min(pint(i,j), dep(i,j))
  2138. pint(i,j)=min(pint(i,j)+pidep(i,j), dep(i,j))
  2139. ! if (pint(i,j) .le. cmin) pint(i,j)=0.
  2140. if (pint(i,j) .le. cmin2) pint(i,j)=0.
  2141. pt(i,j)=pt(i,j)+ascp*pint(i,j)
  2142. qv(i,j)=qv(i,j)-pint(i,j)
  2143. qi(i,j)=qi(i,j)+pint(i,j)
  2144. endif
  2145. endif ! if ( itaobraun.eq.1 )
  2146. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2147. !
  2148. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2149. if ( itaobraun.eq.0 ) then
  2150. tair(i,j)=(pt(i,j)+tb0)*pi0
  2151. if (tair(i,j) .lt. t0) then
  2152. if (qi(i,j) .le. cmin1) qi(i,j)=0.
  2153. tairc(i,j)=tair(i,j)-t0
  2154. dd(i,j)=r31r*exp(beta*tairc(i,j))
  2155. rtair(i,j)=1./(tair(i,j)-c76)
  2156. y2(i,j)=exp(c218-c580*rtair(i,j))
  2157. qsi(i,j)=rp0*y2(i,j)
  2158. esi(i,j)=c610*y2(i,j)
  2159. ssi(i,j)=(qv(i,j)+qb0)/qsi(i,j)-1.
  2160. dm(i,j)=max( (qv(i,j)+qb0-qsi(i,j)), 0.)
  2161. rsub1(i,j)=cs580*qsi(i,j)*rtair(i,j)*rtair(i,j)
  2162. dep(i,j)=dm(i,j)/(1.+rsub1(i,j))
  2163. pint(i,j)=max(min(dd(i,j), dm(i,j)), 0.)
  2164. y1(i,j)=1./tair(i,j)
  2165. y2(i,j)=exp(betah*tairc(i,j))
  2166. y3(i,j)=sqrt(qi(i,j))
  2167. dd(i,j)=y1(i,j)*(rn10a*y1(i,j)-rn10b) &
  2168. +rn10c*tair(i,j)/esi(i,j)
  2169. pidep(i,j)=max(r32rt*ssi(i,j)*y2(i,j)*y3(i,j)/dd(i,j), 0.)
  2170. pint(i,j)=pint(i,j)+pidep(i,j)
  2171. pint(i,j)=min(pint(i,j),dep(i,j))
  2172. !c if (pint(i,j) .le. cmin2) pint(i,j)=0.
  2173. pt(i,j)=pt(i,j)+ascp*pint(i,j)
  2174. qv(i,j)=qv(i,j)-pint(i,j)
  2175. qi(i,j)=qi(i,j)+pint(i,j)
  2176. endif
  2177. endif ! if ( itaobraun.eq.0 )
  2178. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2179. !JJS 225 CONTINUE
  2180. !***** TAO ET AL (1989) SATURATION TECHNIQUE ***********************
  2181. if (new_ice_sat .eq. 0) then
  2182. !JJS DO 250 J=3,JLES
  2183. !JJS DO 250 I=3,ILES
  2184. tair(i,j)=(pt(i,j)+tb0)*pi0
  2185. cnd(i,j)=rt0*(tair(i,j)-t00)
  2186. dep(i,j)=rt0*(t0-tair(i,j))
  2187. y1(i,j)=1./(tair(i,j)-c358)
  2188. y2(i,j)=1./(tair(i,j)-c76)
  2189. qsw(i,j)=rp0*exp(c172-c409*y1(i,j))
  2190. qsi(i,j)=rp0*exp(c218-c580*y2(i,j))
  2191. dd(i,j)=cp409*y1(i,j)*y1(i,j)
  2192. dd1(i,j)=cp580*y2(i,j)*y2(i,j)
  2193. if (qc(i,j).le.cmin) qc(i,j)=cmin
  2194. if (qi(i,j).le.cmin) qi(i,j)=cmin
  2195. if (tair(i,j).ge.t0) then
  2196. dep(i,j)=0.0
  2197. cnd(i,j)=1.
  2198. qi(i,j)=0.0
  2199. endif
  2200. if (tair(i,j).lt.t00) then
  2201. cnd(i,j)=0.0
  2202. dep(i,j)=1.
  2203. qc(i,j)=0.0
  2204. endif
  2205. y5(i,j)=avcp*cnd(i,j)+ascp*dep(i,j)
  2206. ! if (qc(i,j) .ge. cmin .or. qi(i,j) .ge. cmin) then
  2207. y1(i,j)=qc(i,j)*qsw(i,j)/(qc(i,j)+qi(i,j))
  2208. y2(i,j)=qi(i,j)*qsi(i,j)/(qc(i,j)+qi(i,j))
  2209. y4(i,j)=dd(i,j)*y1(i,j)+dd1(i,j)*y2(i,j)
  2210. qvs(i,j)=y1(i,j)+y2(i,j)
  2211. rsub1(i,j)=(qv(i,j)+qb0-qvs(i,j))/(1.+y4(i,j)*y5(i,j))
  2212. cnd(i,j)=cnd(i,j)*rsub1(i,j)
  2213. dep(i,j)=dep(i,j)*rsub1(i,j)
  2214. if (qc(i,j).le.cmin) qc(i,j)=0.
  2215. if (qi(i,j).le.cmin) qi(i,j)=0.
  2216. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2217. !c ****** condensation or evaporation of qc ******
  2218. cnd(i,j)=max(-qc(i,j),cnd(i,j))
  2219. !c ****** deposition or sublimation of qi ******
  2220. dep(i,j)=max(-qi(i,j),dep(i,j))
  2221. pt(i,j)=pt(i,j)+avcp*cnd(i,j)+ascp*dep(i,j)
  2222. qv(i,j)=qv(i,j)-cnd(i,j)-dep(i,j)
  2223. qc(i,j)=qc(i,j)+cnd(i,j)
  2224. qi(i,j)=qi(i,j)+dep(i,j)
  2225. !JJS 250 continue
  2226. endif
  2227. if (new_ice_sat .eq. 1) then
  2228. !JJS DO J=3,JLES
  2229. !JJS DO I=3,ILES
  2230. tair(i,j)=(pt(i,j)+tb0)*pi0
  2231. cnd(i,j)=rt0*(tair(i,j)-t00)
  2232. dep(i,j)=rt0*(t0-tair(i,j))
  2233. y1(i,j)=1./(tair(i,j)-c358)
  2234. y2(i,j)=1./(tair(i,j)-c76)
  2235. qsw(i,j)=rp0*exp(c172-c409*y1(i,j))
  2236. qsi(i,j)=rp0*exp(c218-c580*y2(i,j))
  2237. dd(i,j)=cp409*y1(i,j)*y1(i,j)
  2238. dd1(i,j)=cp580*y2(i,j)*y2(i,j)
  2239. y5(i,j)=avcp*cnd(i,j)+ascp*dep(i,j)
  2240. y1(i,j)=rt0*(tair(i,j)-t00)*qsw(i,j)
  2241. y2(i,j)=rt0*(t0-tair(i,j))*qsi(i,j)
  2242. ! IF (QC(I,J).LE.CMIN) QC(I,J)=CMIN
  2243. ! IF (QI(I,J).LE.CMIN) QI(I,J)=CMIN
  2244. if (tair(i,j).ge.t0) then
  2245. ! QI(I,J)=0.0
  2246. dep(i,j)=0.0
  2247. cnd(i,j)=1.
  2248. y2(i,j)=0.
  2249. y1(i,j)=qsw(i,j)
  2250. endif
  2251. if (tair(i,j).lt.t00) then
  2252. cnd(i,j)=0.0
  2253. dep(i,j)=1.
  2254. y2(i,j)=qsi(i,j)
  2255. y1(i,j)=0.
  2256. ! QC(I,J)=0.0
  2257. endif
  2258. ! Y1(I,J)=QC(I,J)*QSW(I,J)/(QC(I,J)+QI(I,J))
  2259. ! Y2(I,J)=QI(I,J)*QSI(I,J)/(QC(I,J)+QI(I,J))
  2260. y4(i,j)=dd(i,j)*y1(i,j)+dd1(i,j)*y2(i,j)
  2261. qvs(i,j)=y1(i,j)+y2(i,j)
  2262. rsub1(i,j)=(qv(i,j)+qb0-qvs(i,j))/(1.+y4(i,j)*y5(i,j))
  2263. cnd(i,j)=cnd(i,j)*rsub1(i,j)
  2264. dep(i,j)=dep(i,j)*rsub1(i,j)
  2265. ! IF (QC(I,J).LE.CMIN) QC(I,J)=0.
  2266. ! IF (QI(I,J).LE.CMIN) QI(I,J)=0.
  2267. !C ****** CONDENSATION OR EVAPORATION OF QC ******
  2268. cnd(i,j)=max(-qc(i,j),cnd(i,j))
  2269. !C ****** DEPOSITION OR SUBLIMATION OF QI ******
  2270. dep(i,j)=max(-qi(i,j),dep(i,j))
  2271. pt(i,j)=pt(i,j)+avcp*cnd(i,j)+ascp*dep(i,j)
  2272. qv(i,j)=qv(i,j)-cnd(i,j)-dep(i,j)
  2273. qc(i,j)=qc(i,j)+cnd(i,j)
  2274. qi(i,j)=qi(i,j)+dep(i,j)
  2275. !JJS ENDDO
  2276. !JJS ENDDO
  2277. endif
  2278. !c
  2279. !
  2280. if (new_ice_sat .eq. 2) then
  2281. !JJS do j=3,jles
  2282. !JJS do i=3,iles
  2283. dep(i,j)=0.0
  2284. cnd(i,j)=0.0
  2285. tair(i,j)=(pt(i,j)+tb0)*pi0
  2286. if (tair(i,j) .ge. 253.16) then
  2287. y1(i,j)=1./(tair(i,j)-c358)
  2288. qsw(i,j)=rp0*exp(c172-c409*y1(i,j))
  2289. dd(i,j)=cp409*y1(i,j)*y1(i,j)
  2290. dm(i,j)=qv(i,j)+qb0-qsw(i,j)
  2291. cnd(i,j)=dm(i,j)/(1.+avcp*dd(i,j)*qsw(i,j))
  2292. !c ****** condensation or evaporation of qc ******
  2293. cnd(i,j)=max(-qc(i,j), cnd(i,j))
  2294. pt(i,j)=pt(i,j)+avcp*cnd(i,j)
  2295. qv(i,j)=qv(i,j)-cnd(i,j)
  2296. qc(i,j)=qc(i,j)+cnd(i,j)
  2297. endif
  2298. if (tair(i,j) .le. 258.16) then
  2299. !c cnd(i,j)=0.0
  2300. y2(i,j)=1./(tair(i,j)-c76)
  2301. qsi(i,j)=rp0*exp(c218-c580*y2(i,j))
  2302. dd1(i,j)=cp580*y2(i,j)*y2(i,j)
  2303. dep(i,j)=(qv(i,j)+qb0-qsi(i,j))/(1.+ascp*dd1(i,j)*qsi(i,j))
  2304. !c ****** deposition or sublimation of qi ******
  2305. dep(i,j)=max(-qi(i,j),dep(i,j))
  2306. pt(i,j)=pt(i,j)+ascp*dep(i,j)
  2307. qv(i,j)=qv(i,j)-dep(i,j)
  2308. qi(i,j)=qi(i,j)+dep(i,j)
  2309. endif
  2310. !JJS enddo
  2311. !JJS enddo
  2312. endif
  2313. !c
  2314. !
  2315. !* 10 * PSDEP : DEPOSITION OR SUBLIMATION OF QS **10**
  2316. !* 20 * PGSUB : SUBLIMATION OF QG **20**
  2317. !JJS DO 275 J=3,JLES
  2318. !JJS DO 275 I=3,ILES
  2319. psdep(i,j)=0.0
  2320. pgdep(i,j)=0.0
  2321. pssub(i,j)=0.0
  2322. pgsub(i,j)=0.0
  2323. tair(i,j)=(pt(i,j)+tb0)*pi0
  2324. if(tair(i,j).lt.t0) then
  2325. if(qs(i,j).lt.cmin1) qs(i,j)=0.0
  2326. if(qg(i,j).lt.cmin1) qg(i,j)=0.0
  2327. rtair(i,j)=1./(tair(i,j)-c76)
  2328. qsi(i,j)=rp0*exp(c218-c580*rtair(i,j))
  2329. ssi(i,j)=(qv(i,j)+qb0)/qsi(i,j)-1.
  2330. !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2331. y1(i,j)=r10ar/(tca(i,j)*tair(i,j)**2)+1./(dwv(i,j) &
  2332. *qsi(i,j))
  2333. y2(i,j)=.78/zs(i,j)**2+r101f*scv(i,j)/zs(i,j)**bsh5
  2334. psdep(i,j)=r10t*ssi(i,j)*y2(i,j)/y1(i,j)
  2335. pssub(i,j)=psdep(i,j)
  2336. psdep(i,j)=r2is*max(psdep(i,j), 0.)
  2337. pssub(i,j)=r2is*max(-qs(i,j), min(pssub(i,j), 0.))
  2338. if(ihail.eq.1) then
  2339. y2(i,j)=.78/zg(i,j)**2+r20bq*scv(i,j)/zg(i,j)**bgh5
  2340. else
  2341. y2(i,j)=.78/zg(i,j)**2+r20bs*scv(i,j)/zg(i,j)**bgh5
  2342. endif
  2343. pgsub(i,j)=r2ig*r20t*ssi(i,j)*y2(i,j)/y1(i,j)
  2344. dm(i,j)=qv(i,j)+qb0-qsi(i,j)
  2345. rsub1(i,j)=cs580*qsi(i,j)*rtair(i,j)*rtair(i,j)
  2346. ! ******** DEPOSITION OR SUBLIMATION OF QS **********************
  2347. y1(i,j)=dm(i,j)/(1.+rsub1(i,j))
  2348. psdep(i,j)=r2is*min(psdep(i,j),max(y1(i,j),0.))
  2349. y2(i,j)=min(y1(i,j),0.)
  2350. pssub(i,j)=r2is*max(pssub(i,j),y2(i,j))
  2351. ! ******** SUBLIMATION OF QG ***********************************
  2352. dd(i,j)=max((-y2(i,j)-qs(i,j)), 0.)
  2353. pgsub(i,j)=r2ig*min(dd(i,j), qg(i,j), max(pgsub(i,j),0.))
  2354. if(qc(i,j)+qi(i,j).gt.1.e-5) then
  2355. dlt1(i,j)=1.
  2356. else
  2357. dlt1(i,j)=0.
  2358. endif
  2359. psdep(i,j)=dlt1(i,j)*psdep(i,j)
  2360. pssub(i,j)=(1.-dlt1(i,j))*pssub(i,j)
  2361. pgsub(i,j)=(1.-dlt1(i,j))*pgsub(i,j)
  2362. pt(i,j)=pt(i,j)+ascp*(psdep(i,j)+pssub(i,j)-pgsub(i,j))
  2363. qv(i,j)=qv(i,j)+pgsub(i,j)-pssub(i,j)-psdep(i,j)
  2364. qs(i,j)=qs(i,j)+psdep(i,j)+pssub(i,j)
  2365. qg(i,j)=qg(i,j)-pgsub(i,j)
  2366. endif
  2367. !* 23 * ERN : EVAPORATION OF QR (SUBSATURATION) **23**
  2368. ern(i,j)=0.0
  2369. if(qr(i,j).gt.0.0) then
  2370. tair(i,j)=(pt(i,j)+tb0)*pi0
  2371. rtair(i,j)=1./(tair(i,j)-c358)
  2372. qsw(i,j)=rp0*exp(c172-c409*rtair(i,j))
  2373. ssw(i,j)=(qv(i,j)+qb0)/qsw(i,j)-1.0
  2374. dm(i,j)=qv(i,j)+qb0-qsw(i,j)
  2375. rsub1(i,j)=cv409*qsw(i,j)*rtair(i,j)*rtair(i,j)
  2376. dd1(i,j)=max(-dm(i,j)/(1.+rsub1(i,j)), 0.0)
  2377. y1(i,j)=.78/zr(i,j)**2+r23af*scv(i,j)/zr(i,j)**bwh5
  2378. y2(i,j)=r23br/(tca(i,j)*tair(i,j)**2)+1./(dwv(i,j) &
  2379. *qsw(i,j))
  2380. !cccc
  2381. ern(i,j)=r23t*ssw(i,j)*y1(i,j)/y2(i,j)
  2382. ern(i,j)=min(dd1(i,j),qr(i,j),max(ern(i,j),0.))
  2383. pt(i,j)=pt(i,j)-avcp*ern(i,j)
  2384. qv(i,j)=qv(i,j)+ern(i,j)
  2385. qr(i,j)=qr(i,j)-ern(i,j)
  2386. endif
  2387. !JJS 10/7/2008 vvvvv
  2388. ENDIF ! part of if (iwarm.eq.1) then
  2389. !JJS 10/7/2008 ^^^^^
  2390. ! IF (QV(I,J)+QB0 .LE. 0.) QV(I,J)=-QB0
  2391. if (qc(i,j) .le. cmin1) qc(i,j)=0.
  2392. if (qr(i,j) .le. cmin1) qr(i,j)=0.
  2393. if (qi(i,j) .le. cmin1) qi(i,j)=0.
  2394. if (qs(i,j) .le. cmin1) qs(i,j)=0.
  2395. if (qg(i,j) .le. cmin1) qg(i,j)=0.
  2396. dpt(i,j,k)=pt(i,j)
  2397. dqv(i,j,k)=qv(i,j)
  2398. qcl(i,j,k)=qc(i,j)
  2399. qrn(i,j,k)=qr(i,j)
  2400. qci(i,j,k)=qi(i,j)
  2401. qcs(i,j,k)=qs(i,j)
  2402. qcg(i,j,k)=qg(i,j)
  2403. !JJS 275 CONTINUE
  2404. scc=0.
  2405. see=0.
  2406. ! DO 110 J=3,JLES
  2407. ! DO 110 I=3,ILES
  2408. ! DD(I,J)=MAX(-CND(I,J), 0.)
  2409. ! CND(I,J)=MAX(CND(I,J), 0.)
  2410. ! DD1(I,J)=MAX(-DEP(I,J), 0.)
  2411. !ccshie 2/21/02 shie follow tao
  2412. !CC for reference QI(I,J)=QI(I,J)-Y2(I,J)+PIDEP(I,J)*D2T
  2413. !CC for reference QV(I,J)=QV(I,J)-(PIDEP(I,J))*D2T
  2414. !c DEP(I,J)=MAX(DEP(I,J), 0.)
  2415. ! DEP(I,J)=MAX(DEP(I,J), 0.)+PIDEP(I,J)*D2T
  2416. ! SCC=SCC+CND(I,J)
  2417. ! SEE=SEE+DD(I,J)+ERN(I,J)
  2418. ! 110 CONTINUE
  2419. ! SC(K)=SCC+SC(K)
  2420. ! SE(K)=SEE+SE(K)
  2421. !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2422. !c henry: please take a look (start)
  2423. !JJS modified by JJS on 5/1/2007 vvvvv
  2424. !JJS do 305 j=3,jles
  2425. !JJS do 305 i=3,iles
  2426. dd(i,j)=max(-cnd(i,j), 0.)
  2427. cnd(i,j)=max(cnd(i,j), 0.)
  2428. dd1(i,j)=max(-dep(i,j), 0.)+pidep(i,j)*d2t
  2429. dep(i,j)=max(dep(i,j), 0.)
  2430. !JJS 305 continue
  2431. !JJS do 306 j=3,jles
  2432. !JJS do 306 i=3,iles
  2433. !JJS scc=scc+cnd(i,j)
  2434. !JJS see=see+(dd(i,j)+ern(i,j))
  2435. !
  2436. !JJS sddd=sddd+(dep(i,j)+pint(i,j)+psdep(i,j)+pgdep(i,j))
  2437. !JJS ssss=ssss+dd1(i,j)
  2438. !JJS
  2439. ! shhh=shhh+rsw(i,j,k)*d2t
  2440. ! sccc=sccc+rlw(i,j,k)*d2t
  2441. !jjs
  2442. !JJS smmm=smmm+(psmlt(i,j)+pgmlt(i,j)+pimlt(i,j))
  2443. !JJS sfff=sfff+d2t*(psacw(i,j)+piacr(i,j)+psfw(i,j)
  2444. !JJS 1 +pgfr(i,j)+dgacw(i,j)+dgacr(i,j)+psacr(i,j))
  2445. !JJS 2 -qracs(i,j)+pihom(i,j)+pidw(i,j)
  2446. sccc=cnd(i,j)
  2447. seee=dd(i,j)+ern(i,j)
  2448. sddd=dep(i,j)+pint(i,j)+psdep(i,j)+pgdep(i,j)
  2449. ssss=dd1(i,j) + pgsub(i,j)
  2450. smmm=psmlt(i,j)+pgmlt(i,j)+pimlt(i,j)
  2451. sfff=d2t*(psacw(i,j)+piacr(i,j)+psfw(i,j) &
  2452. +pgfr(i,j)+dgacw(i,j)+dgacr(i,j)+psacr(i,j) &
  2453. +wgacr(i,j))+pihom(i,j)+pidw(i,j)
  2454. ! physc(i,k,j) = avcp * sccc / d2t
  2455. ! physe(i,k,j) = avcp * seee / d2t
  2456. ! physd(i,k,j) = ascp * sddd / d2t
  2457. ! physs(i,k,j) = ascp * ssss / d2t
  2458. ! physf(i,k,j) = afcp * sfff / d2t
  2459. ! physm(i,k,j) = afcp * smmm / d2t
  2460. ! physc(i,k,j) = physc(i,k,j) + avcp * sccc
  2461. ! physe(i,k,j) = physc(i,k,j) + avcp * seee
  2462. ! physd(i,k,j) = physd(i,k,j) + ascp * sddd
  2463. ! physs(i,k,j) = physs(i,k,j) + ascp * ssss
  2464. ! physf(i,k,j) = physf(i,k,j) + afcp * sfff
  2465. ! physm(i,k,j) = physm(i,k,j) + afcp * smmm
  2466. !JJS modified by JJS on 5/1/2007 ^^^^^
  2467. 2000 continue
  2468. 1000 continue
  2469. !JJS ****************************************************************
  2470. !JJS convert from GCE grid back to WRF grid
  2471. do k=kts,kte
  2472. do j=jts,jte
  2473. do i=its,ite
  2474. ptwrf(i,k,j) = dpt(i,j,k)
  2475. qvwrf(i,k,j) = dqv(i,j,k)
  2476. qlwrf(i,k,j) = qcl(i,j,k)
  2477. qrwrf(i,k,j) = qrn(i,j,k)
  2478. qiwrf(i,k,j) = qci(i,j,k)
  2479. qswrf(i,k,j) = qcs(i,j,k)
  2480. qgwrf(i,k,j) = qcg(i,j,k)
  2481. enddo !i
  2482. enddo !j
  2483. enddo !k
  2484. ! ****************************************************************
  2485. return
  2486. END SUBROUTINE saticel_s
  2487. !JJS
  2488. !JJS REAL FUNCTION GAMMA(X)
  2489. !JJS Y=GAMMLN(X)
  2490. !JJS GAMMA=EXP(Y)
  2491. !JJS RETURN
  2492. !JJS END
  2493. !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  2494. !JJS real function GAMMLN (xx)
  2495. real function gammagce (xx)
  2496. !**********************************************************************
  2497. real*8 cof(6),stp,half,one,fpf,x,tmp,ser
  2498. data cof,stp / 76.18009173,-86.50532033,24.01409822, &
  2499. -1.231739516,.120858003e-2,-.536382e-5, 2.50662827465 /
  2500. data half,one,fpf / .5, 1., 5.5 /
  2501. !
  2502. x=xx-one
  2503. tmp=x+fpf
  2504. tmp=(x+half)*log(tmp)-tmp
  2505. ser=one
  2506. do j=1,6
  2507. x=x+one
  2508. ser=ser+cof(j)/x
  2509. enddo !j
  2510. gammln=tmp+log(stp*ser)
  2511. !JJS
  2512. gammagce=exp(gammln)
  2513. !JJS
  2514. return
  2515. END FUNCTION gammagce
  2516. END MODULE module_mp_gsfcgce