PageRenderTime 68ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 1ms

/phys/module_mp_thompson.F

http://github.com/anderbubble/wrf
FORTRAN Legacy | 3586 lines | 2500 code | 369 blank | 717 comment | 191 complexity | f7ad9a81f058ec3e9b0817faa447f6f8 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. !+---+-----------------------------------------------------------------+
  2. !.. This subroutine computes the moisture tendencies of water vapor,
  3. !.. cloud droplets, rain, cloud ice (pristine), snow, and graupel.
  4. !.. Prior to WRFv2.2 this code was based on Reisner et al (1998), but
  5. !.. few of those pieces remain. A complete description is now found in
  6. !.. Thompson, G., P. R. Field, R. M. Rasmussen, and W. D. Hall, 2008:
  7. !.. Explicit Forecasts of winter precipitation using an improved bulk
  8. !.. microphysics scheme. Part II: Implementation of a new snow
  9. !.. parameterization. Mon. Wea. Rev., 136, 5095-5115.
  10. !.. Prior to WRFv3.1, this code was single-moment rain prediction as
  11. !.. described in the reference above, but in v3.1 and higher, the
  12. !.. scheme is two-moment rain (predicted rain number concentration).
  13. !..
  14. !.. Most importantly, users may wish to modify the prescribed number of
  15. !.. cloud droplets (Nt_c; see guidelines mentioned below). Otherwise,
  16. !.. users may alter the rain and graupel size distribution parameters
  17. !.. to use exponential (Marshal-Palmer) or generalized gamma shape.
  18. !.. The snow field assumes a combination of two gamma functions (from
  19. !.. Field et al. 2005) and would require significant modifications
  20. !.. throughout the entire code to alter its shape as well as accretion
  21. !.. rates. Users may also alter the constants used for density of rain,
  22. !.. graupel, ice, and snow, but the latter is not constant when using
  23. !.. Paul Field's snow distribution and moments methods. Other values
  24. !.. users can modify include the constants for mass and/or velocity
  25. !.. power law relations and assumed capacitances used in deposition/
  26. !.. sublimation/evaporation/melting.
  27. !.. Remaining values should probably be left alone.
  28. !..
  29. !..Author: Greg Thompson, NCAR-RAL, gthompsn@ucar.edu, 303-497-2805
  30. !..Last modified: 21 Nov 2010
  31. !+---+-----------------------------------------------------------------+
  32. !wrft:model_layer:physics
  33. !+---+-----------------------------------------------------------------+
  34. !
  35. MODULE module_mp_thompson
  36. USE module_wrf_error
  37. ! USE module_utility, ONLY: WRFU_Clock, WRFU_Alarm
  38. ! USE module_domain, ONLY : HISTORY_ALARM, Is_alarm_tstep
  39. IMPLICIT NONE
  40. LOGICAL, PARAMETER, PRIVATE:: iiwarm = .false.
  41. INTEGER, PARAMETER, PRIVATE:: IFDRY = 0
  42. REAL, PARAMETER, PRIVATE:: T_0 = 273.15
  43. REAL, PARAMETER, PRIVATE:: PI = 3.1415926536
  44. !..Densities of rain, snow, graupel, and cloud ice.
  45. REAL, PARAMETER, PRIVATE:: rho_w = 1000.0
  46. REAL, PARAMETER, PRIVATE:: rho_s = 100.0
  47. REAL, PARAMETER, PRIVATE:: rho_g = 400.0
  48. REAL, PARAMETER, PRIVATE:: rho_i = 890.0
  49. !..Prescribed number of cloud droplets. Set according to known data or
  50. !.. roughly 100 per cc (100.E6 m^-3) for Maritime cases and
  51. !.. 300 per cc (300.E6 m^-3) for Continental. Gamma shape parameter,
  52. !.. mu_c, calculated based on Nt_c is important in autoconversion
  53. !.. scheme.
  54. REAL, PARAMETER, PRIVATE:: Nt_c = 100.E6
  55. !..Generalized gamma distributions for rain, graupel and cloud ice.
  56. !.. N(D) = N_0 * D**mu * exp(-lamda*D); mu=0 is exponential.
  57. REAL, PARAMETER, PRIVATE:: mu_r = 0.0
  58. REAL, PARAMETER, PRIVATE:: mu_g = 0.0
  59. REAL, PARAMETER, PRIVATE:: mu_i = 0.0
  60. REAL, PRIVATE:: mu_c
  61. !..Sum of two gamma distrib for snow (Field et al. 2005).
  62. !.. N(D) = M2**4/M3**3 * [Kap0*exp(-M2*Lam0*D/M3)
  63. !.. + Kap1*(M2/M3)**mu_s * D**mu_s * exp(-M2*Lam1*D/M3)]
  64. !.. M2 and M3 are the (bm_s)th and (bm_s+1)th moments respectively
  65. !.. calculated as function of ice water content and temperature.
  66. REAL, PARAMETER, PRIVATE:: mu_s = 0.6357
  67. REAL, PARAMETER, PRIVATE:: Kap0 = 490.6
  68. REAL, PARAMETER, PRIVATE:: Kap1 = 17.46
  69. REAL, PARAMETER, PRIVATE:: Lam0 = 20.78
  70. REAL, PARAMETER, PRIVATE:: Lam1 = 3.29
  71. !..Y-intercept parameter for graupel is not constant and depends on
  72. !.. mixing ratio. Also, when mu_g is non-zero, these become equiv
  73. !.. y-intercept for an exponential distrib and proper values are
  74. !.. computed based on same mixing ratio and total number concentration.
  75. REAL, PARAMETER, PRIVATE:: gonv_min = 1.E4
  76. REAL, PARAMETER, PRIVATE:: gonv_max = 1.E6
  77. !..Mass power law relations: mass = am*D**bm
  78. !.. Snow from Field et al. (2005), others assume spherical form.
  79. REAL, PARAMETER, PRIVATE:: am_r = PI*rho_w/6.0
  80. REAL, PARAMETER, PRIVATE:: bm_r = 3.0
  81. REAL, PARAMETER, PRIVATE:: am_s = 0.069
  82. REAL, PARAMETER, PRIVATE:: bm_s = 2.0
  83. REAL, PARAMETER, PRIVATE:: am_g = PI*rho_g/6.0
  84. REAL, PARAMETER, PRIVATE:: bm_g = 3.0
  85. REAL, PARAMETER, PRIVATE:: am_i = PI*rho_i/6.0
  86. REAL, PARAMETER, PRIVATE:: bm_i = 3.0
  87. !..Fallspeed power laws relations: v = (av*D**bv)*exp(-fv*D)
  88. !.. Rain from Ferrier (1994), ice, snow, and graupel from
  89. !.. Thompson et al (2008). Coefficient fv is zero for graupel/ice.
  90. REAL, PARAMETER, PRIVATE:: av_r = 4854.0
  91. REAL, PARAMETER, PRIVATE:: bv_r = 1.0
  92. REAL, PARAMETER, PRIVATE:: fv_r = 195.0
  93. REAL, PARAMETER, PRIVATE:: av_s = 40.0
  94. REAL, PARAMETER, PRIVATE:: bv_s = 0.55
  95. REAL, PARAMETER, PRIVATE:: fv_s = 125.0
  96. REAL, PARAMETER, PRIVATE:: av_g = 442.0
  97. REAL, PARAMETER, PRIVATE:: bv_g = 0.89
  98. REAL, PARAMETER, PRIVATE:: av_i = 1847.5
  99. REAL, PARAMETER, PRIVATE:: bv_i = 1.0
  100. !..Capacitance of sphere and plates/aggregates: D**3, D**2
  101. REAL, PARAMETER, PRIVATE:: C_cube = 0.5
  102. REAL, PARAMETER, PRIVATE:: C_sqrd = 0.3
  103. !..Collection efficiencies. Rain/snow/graupel collection of cloud
  104. !.. droplets use variables (Ef_rw, Ef_sw, Ef_gw respectively) and
  105. !.. get computed elsewhere because they are dependent on stokes
  106. !.. number.
  107. REAL, PARAMETER, PRIVATE:: Ef_si = 0.05
  108. REAL, PARAMETER, PRIVATE:: Ef_rs = 0.95
  109. REAL, PARAMETER, PRIVATE:: Ef_rg = 0.75
  110. REAL, PARAMETER, PRIVATE:: Ef_ri = 0.95
  111. !..Minimum microphys values
  112. !.. R1 value, 1.E-12, cannot be set lower because of numerical
  113. !.. problems with Paul Field's moments and should not be set larger
  114. !.. because of truncation problems in snow/ice growth.
  115. REAL, PARAMETER, PRIVATE:: R1 = 1.E-12
  116. REAL, PARAMETER, PRIVATE:: R2 = 1.E-8
  117. REAL, PARAMETER, PRIVATE:: eps = 1.E-29
  118. !..Constants in Cooper curve relation for cloud ice number.
  119. REAL, PARAMETER, PRIVATE:: TNO = 5.0
  120. REAL, PARAMETER, PRIVATE:: ATO = 0.304
  121. !..Rho_not used in fallspeed relations (rho_not/rho)**.5 adjustment.
  122. REAL, PARAMETER, PRIVATE:: rho_not = 101325.0/(287.05*298.0)
  123. !..Schmidt number
  124. REAL, PARAMETER, PRIVATE:: Sc = 0.632
  125. REAL, PRIVATE:: Sc3
  126. !..Homogeneous freezing temperature
  127. REAL, PARAMETER, PRIVATE:: HGFR = 235.16
  128. !..Water vapor and air gas constants at constant pressure
  129. REAL, PARAMETER, PRIVATE:: Rv = 461.5
  130. REAL, PARAMETER, PRIVATE:: oRv = 1./Rv
  131. REAL, PARAMETER, PRIVATE:: R = 287.04
  132. REAL, PARAMETER, PRIVATE:: Cp = 1004.0
  133. !..Enthalpy of sublimation, vaporization, and fusion at 0C.
  134. REAL, PARAMETER, PRIVATE:: lsub = 2.834E6
  135. REAL, PARAMETER, PRIVATE:: lvap0 = 2.5E6
  136. REAL, PARAMETER, PRIVATE:: lfus = lsub - lvap0
  137. REAL, PARAMETER, PRIVATE:: olfus = 1./lfus
  138. !..Ice initiates with this mass (kg), corresponding diameter calc.
  139. !..Min diameters and mass of cloud, rain, snow, and graupel (m, kg).
  140. REAL, PARAMETER, PRIVATE:: xm0i = 1.E-12
  141. REAL, PARAMETER, PRIVATE:: D0c = 1.E-6
  142. REAL, PARAMETER, PRIVATE:: D0r = 50.E-6
  143. REAL, PARAMETER, PRIVATE:: D0s = 200.E-6
  144. REAL, PARAMETER, PRIVATE:: D0g = 250.E-6
  145. REAL, PRIVATE:: D0i, xm0s, xm0g
  146. !..Lookup table dimensions
  147. INTEGER, PARAMETER, PRIVATE:: nbins = 100
  148. INTEGER, PARAMETER, PRIVATE:: nbc = nbins
  149. INTEGER, PARAMETER, PRIVATE:: nbi = nbins
  150. INTEGER, PARAMETER, PRIVATE:: nbr = nbins
  151. INTEGER, PARAMETER, PRIVATE:: nbs = nbins
  152. INTEGER, PARAMETER, PRIVATE:: nbg = nbins
  153. INTEGER, PARAMETER, PRIVATE:: ntb_c = 37
  154. INTEGER, PARAMETER, PRIVATE:: ntb_i = 64
  155. INTEGER, PARAMETER, PRIVATE:: ntb_r = 37
  156. INTEGER, PARAMETER, PRIVATE:: ntb_s = 28
  157. INTEGER, PARAMETER, PRIVATE:: ntb_g = 28
  158. INTEGER, PARAMETER, PRIVATE:: ntb_g1 = 28
  159. INTEGER, PARAMETER, PRIVATE:: ntb_r1 = 37
  160. INTEGER, PARAMETER, PRIVATE:: ntb_i1 = 55
  161. INTEGER, PARAMETER, PRIVATE:: ntb_t = 9
  162. INTEGER, PRIVATE:: nic2, nii2, nii3, nir2, nir3, nis2, nig2, nig3
  163. DOUBLE PRECISION, DIMENSION(nbins+1):: xDx
  164. DOUBLE PRECISION, DIMENSION(nbc):: Dc, dtc
  165. DOUBLE PRECISION, DIMENSION(nbi):: Di, dti
  166. DOUBLE PRECISION, DIMENSION(nbr):: Dr, dtr
  167. DOUBLE PRECISION, DIMENSION(nbs):: Ds, dts
  168. DOUBLE PRECISION, DIMENSION(nbg):: Dg, dtg
  169. !..Lookup tables for cloud water content (kg/m**3).
  170. REAL, DIMENSION(ntb_c), PARAMETER, PRIVATE:: &
  171. r_c = (/1.e-6,2.e-6,3.e-6,4.e-6,5.e-6,6.e-6,7.e-6,8.e-6,9.e-6, &
  172. 1.e-5,2.e-5,3.e-5,4.e-5,5.e-5,6.e-5,7.e-5,8.e-5,9.e-5, &
  173. 1.e-4,2.e-4,3.e-4,4.e-4,5.e-4,6.e-4,7.e-4,8.e-4,9.e-4, &
  174. 1.e-3,2.e-3,3.e-3,4.e-3,5.e-3,6.e-3,7.e-3,8.e-3,9.e-3, &
  175. 1.e-2/)
  176. !..Lookup tables for cloud ice content (kg/m**3).
  177. REAL, DIMENSION(ntb_i), PARAMETER, PRIVATE:: &
  178. r_i = (/1.e-10,2.e-10,3.e-10,4.e-10, &
  179. 5.e-10,6.e-10,7.e-10,8.e-10,9.e-10, &
  180. 1.e-9,2.e-9,3.e-9,4.e-9,5.e-9,6.e-9,7.e-9,8.e-9,9.e-9, &
  181. 1.e-8,2.e-8,3.e-8,4.e-8,5.e-8,6.e-8,7.e-8,8.e-8,9.e-8, &
  182. 1.e-7,2.e-7,3.e-7,4.e-7,5.e-7,6.e-7,7.e-7,8.e-7,9.e-7, &
  183. 1.e-6,2.e-6,3.e-6,4.e-6,5.e-6,6.e-6,7.e-6,8.e-6,9.e-6, &
  184. 1.e-5,2.e-5,3.e-5,4.e-5,5.e-5,6.e-5,7.e-5,8.e-5,9.e-5, &
  185. 1.e-4,2.e-4,3.e-4,4.e-4,5.e-4,6.e-4,7.e-4,8.e-4,9.e-4, &
  186. 1.e-3/)
  187. !..Lookup tables for rain content (kg/m**3).
  188. REAL, DIMENSION(ntb_r), PARAMETER, PRIVATE:: &
  189. r_r = (/1.e-6,2.e-6,3.e-6,4.e-6,5.e-6,6.e-6,7.e-6,8.e-6,9.e-6, &
  190. 1.e-5,2.e-5,3.e-5,4.e-5,5.e-5,6.e-5,7.e-5,8.e-5,9.e-5, &
  191. 1.e-4,2.e-4,3.e-4,4.e-4,5.e-4,6.e-4,7.e-4,8.e-4,9.e-4, &
  192. 1.e-3,2.e-3,3.e-3,4.e-3,5.e-3,6.e-3,7.e-3,8.e-3,9.e-3, &
  193. 1.e-2/)
  194. !..Lookup tables for graupel content (kg/m**3).
  195. REAL, DIMENSION(ntb_g), PARAMETER, PRIVATE:: &
  196. r_g = (/1.e-5,2.e-5,3.e-5,4.e-5,5.e-5,6.e-5,7.e-5,8.e-5,9.e-5, &
  197. 1.e-4,2.e-4,3.e-4,4.e-4,5.e-4,6.e-4,7.e-4,8.e-4,9.e-4, &
  198. 1.e-3,2.e-3,3.e-3,4.e-3,5.e-3,6.e-3,7.e-3,8.e-3,9.e-3, &
  199. 1.e-2/)
  200. !..Lookup tables for snow content (kg/m**3).
  201. REAL, DIMENSION(ntb_s), PARAMETER, PRIVATE:: &
  202. r_s = (/1.e-5,2.e-5,3.e-5,4.e-5,5.e-5,6.e-5,7.e-5,8.e-5,9.e-5, &
  203. 1.e-4,2.e-4,3.e-4,4.e-4,5.e-4,6.e-4,7.e-4,8.e-4,9.e-4, &
  204. 1.e-3,2.e-3,3.e-3,4.e-3,5.e-3,6.e-3,7.e-3,8.e-3,9.e-3, &
  205. 1.e-2/)
  206. !..Lookup tables for rain y-intercept parameter (/m**4).
  207. REAL, DIMENSION(ntb_r1), PARAMETER, PRIVATE:: &
  208. N0r_exp = (/1.e6,2.e6,3.e6,4.e6,5.e6,6.e6,7.e6,8.e6,9.e6, &
  209. 1.e7,2.e7,3.e7,4.e7,5.e7,6.e7,7.e7,8.e7,9.e7, &
  210. 1.e8,2.e8,3.e8,4.e8,5.e8,6.e8,7.e8,8.e8,9.e8, &
  211. 1.e9,2.e9,3.e9,4.e9,5.e9,6.e9,7.e9,8.e9,9.e9, &
  212. 1.e10/)
  213. !..Lookup tables for graupel y-intercept parameter (/m**4).
  214. REAL, DIMENSION(ntb_g1), PARAMETER, PRIVATE:: &
  215. N0g_exp = (/1.e4,2.e4,3.e4,4.e4,5.e4,6.e4,7.e4,8.e4,9.e4, &
  216. 1.e5,2.e5,3.e5,4.e5,5.e5,6.e5,7.e5,8.e5,9.e5, &
  217. 1.e6,2.e6,3.e6,4.e6,5.e6,6.e6,7.e6,8.e6,9.e6, &
  218. 1.e7/)
  219. !..Lookup tables for ice number concentration (/m**3).
  220. REAL, DIMENSION(ntb_i1), PARAMETER, PRIVATE:: &
  221. Nt_i = (/1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0, &
  222. 1.e1,2.e1,3.e1,4.e1,5.e1,6.e1,7.e1,8.e1,9.e1, &
  223. 1.e2,2.e2,3.e2,4.e2,5.e2,6.e2,7.e2,8.e2,9.e2, &
  224. 1.e3,2.e3,3.e3,4.e3,5.e3,6.e3,7.e3,8.e3,9.e3, &
  225. 1.e4,2.e4,3.e4,4.e4,5.e4,6.e4,7.e4,8.e4,9.e4, &
  226. 1.e5,2.e5,3.e5,4.e5,5.e5,6.e5,7.e5,8.e5,9.e5, &
  227. 1.e6/)
  228. !..For snow moments conversions (from Field et al. 2005)
  229. REAL, DIMENSION(10), PARAMETER, PRIVATE:: &
  230. sa = (/ 5.065339, -0.062659, -3.032362, 0.029469, -0.000285, &
  231. 0.31255, 0.000204, 0.003199, 0.0, -0.015952/)
  232. REAL, DIMENSION(10), PARAMETER, PRIVATE:: &
  233. sb = (/ 0.476221, -0.015896, 0.165977, 0.007468, -0.000141, &
  234. 0.060366, 0.000079, 0.000594, 0.0, -0.003577/)
  235. !..Temperatures (5 C interval 0 to -40) used in lookup tables.
  236. REAL, DIMENSION(ntb_t), PARAMETER, PRIVATE:: &
  237. Tc = (/-0.01, -5., -10., -15., -20., -25., -30., -35., -40./)
  238. !..Lookup tables for various accretion/collection terms.
  239. !.. ntb_x refers to the number of elements for rain, snow, graupel,
  240. !.. and temperature array indices. Variables beginning with t-p/c/m/n
  241. !.. represent lookup tables. Save compile-time memory by making
  242. !.. allocatable (2009Jun12, J. Michalakes).
  243. INTEGER, PARAMETER, PRIVATE:: R8SIZE = 8
  244. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:,:,:):: &
  245. tcg_racg, tmr_racg, tcr_gacr, tmg_gacr, &
  246. tnr_racg, tnr_gacr
  247. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:,:,:):: &
  248. tcs_racs1, tmr_racs1, tcs_racs2, tmr_racs2, &
  249. tcr_sacr1, tms_sacr1, tcr_sacr2, tms_sacr2, &
  250. tnr_racs1, tnr_racs2, tnr_sacr1, tnr_sacr2
  251. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:):: &
  252. tpi_qcfz, tni_qcfz
  253. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:,:):: &
  254. tpi_qrfz, tpg_qrfz, tni_qrfz, tnr_qrfz
  255. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:):: &
  256. tps_iaus, tni_iaus, tpi_ide
  257. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:):: t_Efrw
  258. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:):: t_Efsw
  259. REAL (KIND=R8SIZE), ALLOCATABLE, DIMENSION(:,:,:):: tnr_rev
  260. !..Variables holding a bunch of exponents and gamma values (cloud water,
  261. !.. cloud ice, rain, snow, then graupel).
  262. REAL, DIMENSION(3), PRIVATE:: cce, ccg
  263. REAL, PRIVATE:: ocg1, ocg2
  264. REAL, DIMENSION(7), PRIVATE:: cie, cig
  265. REAL, PRIVATE:: oig1, oig2, obmi
  266. REAL, DIMENSION(13), PRIVATE:: cre, crg
  267. REAL, PRIVATE:: ore1, org1, org2, org3, obmr
  268. REAL, DIMENSION(18), PRIVATE:: cse, csg
  269. REAL, PRIVATE:: oams, obms, ocms
  270. REAL, DIMENSION(12), PRIVATE:: cge, cgg
  271. REAL, PRIVATE:: oge1, ogg1, ogg2, ogg3, oamg, obmg, ocmg
  272. !..Declaration of precomputed constants in various rate eqns.
  273. REAL:: t1_qr_qc, t1_qr_qi, t2_qr_qi, t1_qg_qc, t1_qs_qc, t1_qs_qi
  274. REAL:: t1_qr_ev, t2_qr_ev
  275. REAL:: t1_qs_sd, t2_qs_sd, t1_qg_sd, t2_qg_sd
  276. REAL:: t1_qs_me, t2_qs_me, t1_qg_me, t2_qg_me
  277. CHARACTER*256:: mp_debug
  278. !+---+
  279. !+---+-----------------------------------------------------------------+
  280. !..END DECLARATIONS
  281. !+---+-----------------------------------------------------------------+
  282. !+---+
  283. !ctrlL
  284. CONTAINS
  285. SUBROUTINE thompson_init
  286. IMPLICIT NONE
  287. INTEGER:: i, j, k, m, n
  288. LOGICAL:: micro_init
  289. !..Allocate space for lookup tables (J. Michalakes 2009Jun08).
  290. micro_init = .FALSE.
  291. if (.NOT. ALLOCATED(tcg_racg) ) then
  292. ALLOCATE(tcg_racg(ntb_g1,ntb_g,ntb_r1,ntb_r))
  293. micro_init = .TRUE.
  294. endif
  295. if (.NOT. ALLOCATED(tmr_racg)) ALLOCATE(tmr_racg(ntb_g1,ntb_g,ntb_r1,ntb_r))
  296. if (.NOT. ALLOCATED(tcr_gacr)) ALLOCATE(tcr_gacr(ntb_g1,ntb_g,ntb_r1,ntb_r))
  297. if (.NOT. ALLOCATED(tmg_gacr)) ALLOCATE(tmg_gacr(ntb_g1,ntb_g,ntb_r1,ntb_r))
  298. if (.NOT. ALLOCATED(tnr_racg)) ALLOCATE(tnr_racg(ntb_g1,ntb_g,ntb_r1,ntb_r))
  299. if (.NOT. ALLOCATED(tnr_gacr)) ALLOCATE(tnr_gacr(ntb_g1,ntb_g,ntb_r1,ntb_r))
  300. if (.NOT. ALLOCATED(tcs_racs1)) ALLOCATE(tcs_racs1(ntb_s,ntb_t,ntb_r1,ntb_r))
  301. if (.NOT. ALLOCATED(tmr_racs1)) ALLOCATE(tmr_racs1(ntb_s,ntb_t,ntb_r1,ntb_r))
  302. if (.NOT. ALLOCATED(tcs_racs2)) ALLOCATE(tcs_racs2(ntb_s,ntb_t,ntb_r1,ntb_r))
  303. if (.NOT. ALLOCATED(tmr_racs2)) ALLOCATE(tmr_racs2(ntb_s,ntb_t,ntb_r1,ntb_r))
  304. if (.NOT. ALLOCATED(tcr_sacr1)) ALLOCATE(tcr_sacr1(ntb_s,ntb_t,ntb_r1,ntb_r))
  305. if (.NOT. ALLOCATED(tms_sacr1)) ALLOCATE(tms_sacr1(ntb_s,ntb_t,ntb_r1,ntb_r))
  306. if (.NOT. ALLOCATED(tcr_sacr2)) ALLOCATE(tcr_sacr2(ntb_s,ntb_t,ntb_r1,ntb_r))
  307. if (.NOT. ALLOCATED(tms_sacr2)) ALLOCATE(tms_sacr2(ntb_s,ntb_t,ntb_r1,ntb_r))
  308. if (.NOT. ALLOCATED(tnr_racs1)) ALLOCATE(tnr_racs1(ntb_s,ntb_t,ntb_r1,ntb_r))
  309. if (.NOT. ALLOCATED(tnr_racs2)) ALLOCATE(tnr_racs2(ntb_s,ntb_t,ntb_r1,ntb_r))
  310. if (.NOT. ALLOCATED(tnr_sacr1)) ALLOCATE(tnr_sacr1(ntb_s,ntb_t,ntb_r1,ntb_r))
  311. if (.NOT. ALLOCATED(tnr_sacr2)) ALLOCATE(tnr_sacr2(ntb_s,ntb_t,ntb_r1,ntb_r))
  312. if (.NOT. ALLOCATED(tpi_qcfz)) ALLOCATE(tpi_qcfz(ntb_c,45))
  313. if (.NOT. ALLOCATED(tni_qcfz)) ALLOCATE(tni_qcfz(ntb_c,45))
  314. if (.NOT. ALLOCATED(tpi_qrfz)) ALLOCATE(tpi_qrfz(ntb_r,ntb_r1,45))
  315. if (.NOT. ALLOCATED(tpg_qrfz)) ALLOCATE(tpg_qrfz(ntb_r,ntb_r1,45))
  316. if (.NOT. ALLOCATED(tni_qrfz)) ALLOCATE(tni_qrfz(ntb_r,ntb_r1,45))
  317. if (.NOT. ALLOCATED(tnr_qrfz)) ALLOCATE(tnr_qrfz(ntb_r,ntb_r1,45))
  318. if (.NOT. ALLOCATED(tps_iaus)) ALLOCATE(tps_iaus(ntb_i,ntb_i1))
  319. if (.NOT. ALLOCATED(tni_iaus)) ALLOCATE(tni_iaus(ntb_i,ntb_i1))
  320. if (.NOT. ALLOCATED(tpi_ide)) ALLOCATE(tpi_ide(ntb_i,ntb_i1))
  321. if (.NOT. ALLOCATED(t_Efrw)) ALLOCATE(t_Efrw(nbr,nbc))
  322. if (.NOT. ALLOCATED(t_Efsw)) ALLOCATE(t_Efsw(nbs,nbc))
  323. if (.NOT. ALLOCATED(tnr_rev)) ALLOCATE(tnr_rev(nbr, ntb_r1, ntb_r))
  324. if (micro_init) then
  325. !..From Martin et al. (1994), assign gamma shape parameter mu for cloud
  326. !.. drops according to general dispersion characteristics (disp=~0.25
  327. !.. for Maritime and 0.45 for Continental).
  328. !.. disp=SQRT((mu+2)/(mu+1) - 1) so mu varies from 15 for Maritime
  329. !.. to 2 for really dirty air.
  330. mu_c = MIN(15., (1000.E6/Nt_c + 2.))
  331. !..Schmidt number to one-third used numerous times.
  332. Sc3 = Sc**(1./3.)
  333. !..Compute min ice diam from mass, min snow/graupel mass from diam.
  334. D0i = (xm0i/am_i)**(1./bm_i)
  335. xm0s = am_s * D0s**bm_s
  336. xm0g = am_g * D0g**bm_g
  337. !..These constants various exponents and gamma() assoc with cloud,
  338. !.. rain, snow, and graupel.
  339. cce(1) = mu_c + 1.
  340. cce(2) = bm_r + mu_c + 1.
  341. cce(3) = bm_r + mu_c + 4.
  342. ccg(1) = WGAMMA(cce(1))
  343. ccg(2) = WGAMMA(cce(2))
  344. ccg(3) = WGAMMA(cce(3))
  345. ocg1 = 1./ccg(1)
  346. ocg2 = 1./ccg(2)
  347. cie(1) = mu_i + 1.
  348. cie(2) = bm_i + mu_i + 1.
  349. cie(3) = bm_i + mu_i + bv_i + 1.
  350. cie(4) = mu_i + bv_i + 1.
  351. cie(5) = mu_i + 2.
  352. cie(6) = bm_i*0.5 + mu_i + bv_i + 1.
  353. cie(7) = bm_i*0.5 + mu_i + 1.
  354. cig(1) = WGAMMA(cie(1))
  355. cig(2) = WGAMMA(cie(2))
  356. cig(3) = WGAMMA(cie(3))
  357. cig(4) = WGAMMA(cie(4))
  358. cig(5) = WGAMMA(cie(5))
  359. cig(6) = WGAMMA(cie(6))
  360. cig(7) = WGAMMA(cie(7))
  361. oig1 = 1./cig(1)
  362. oig2 = 1./cig(2)
  363. obmi = 1./bm_i
  364. cre(1) = bm_r + 1.
  365. cre(2) = mu_r + 1.
  366. cre(3) = bm_r + mu_r + 1.
  367. cre(4) = bm_r*2. + mu_r + 1.
  368. cre(5) = mu_r + bv_r + 1.
  369. cre(6) = bm_r + mu_r + bv_r + 1.
  370. cre(7) = bm_r*0.5 + mu_r + bv_r + 1.
  371. cre(8) = bm_r + mu_r + bv_r + 3.
  372. cre(9) = mu_r + bv_r + 3.
  373. cre(10) = mu_r + 2.
  374. cre(11) = 0.5*(bv_r + 5. + 2.*mu_r)
  375. cre(12) = bm_r*0.5 + mu_r + 1.
  376. cre(13) = bm_r*2. + mu_r + bv_r + 1.
  377. do n = 1, 13
  378. crg(n) = WGAMMA(cre(n))
  379. enddo
  380. obmr = 1./bm_r
  381. ore1 = 1./cre(1)
  382. org1 = 1./crg(1)
  383. org2 = 1./crg(2)
  384. org3 = 1./crg(3)
  385. cse(1) = bm_s + 1.
  386. cse(2) = bm_s + 2.
  387. cse(3) = bm_s*2.
  388. cse(4) = bm_s + bv_s + 1.
  389. cse(5) = bm_s*2. + bv_s + 1.
  390. cse(6) = bm_s*2. + 1.
  391. cse(7) = bm_s + mu_s + 1.
  392. cse(8) = bm_s + mu_s + 2.
  393. cse(9) = bm_s + mu_s + 3.
  394. cse(10) = bm_s + mu_s + bv_s + 1.
  395. cse(11) = bm_s*2. + mu_s + bv_s + 1.
  396. cse(12) = bm_s*2. + mu_s + 1.
  397. cse(13) = bv_s + 2.
  398. cse(14) = bm_s + bv_s
  399. cse(15) = mu_s + 1.
  400. cse(16) = 1.0 + (1.0 + bv_s)/2.
  401. cse(17) = cse(16) + mu_s + 1.
  402. cse(18) = bv_s + mu_s + 3.
  403. do n = 1, 18
  404. csg(n) = WGAMMA(cse(n))
  405. enddo
  406. oams = 1./am_s
  407. obms = 1./bm_s
  408. ocms = oams**obms
  409. cge(1) = bm_g + 1.
  410. cge(2) = mu_g + 1.
  411. cge(3) = bm_g + mu_g + 1.
  412. cge(4) = bm_g*2. + mu_g + 1.
  413. cge(5) = bm_g*2. + mu_g + bv_g + 1.
  414. cge(6) = bm_g + mu_g + bv_g + 1.
  415. cge(7) = bm_g + mu_g + bv_g + 2.
  416. cge(8) = bm_g + mu_g + bv_g + 3.
  417. cge(9) = mu_g + bv_g + 3.
  418. cge(10) = mu_g + 2.
  419. cge(11) = 0.5*(bv_g + 5. + 2.*mu_g)
  420. cge(12) = 0.5*(bv_g + 5.) + mu_g
  421. do n = 1, 12
  422. cgg(n) = WGAMMA(cge(n))
  423. enddo
  424. oamg = 1./am_g
  425. obmg = 1./bm_g
  426. ocmg = oamg**obmg
  427. oge1 = 1./cge(1)
  428. ogg1 = 1./cgg(1)
  429. ogg2 = 1./cgg(2)
  430. ogg3 = 1./cgg(3)
  431. !+---+-----------------------------------------------------------------+
  432. !..Simplify various rate eqns the best we can now.
  433. !+---+-----------------------------------------------------------------+
  434. !..Rain collecting cloud water and cloud ice
  435. t1_qr_qc = PI*.25*av_r * crg(9)
  436. t1_qr_qi = PI*.25*av_r * crg(9)
  437. t2_qr_qi = PI*.25*am_r*av_r * crg(8)
  438. !..Graupel collecting cloud water
  439. t1_qg_qc = PI*.25*av_g * cgg(9)
  440. !..Snow collecting cloud water
  441. t1_qs_qc = PI*.25*av_s
  442. !..Snow collecting cloud ice
  443. t1_qs_qi = PI*.25*av_s
  444. !..Evaporation of rain; ignore depositional growth of rain.
  445. t1_qr_ev = 0.78 * crg(10)
  446. t2_qr_ev = 0.308*Sc3*SQRT(av_r) * crg(11)
  447. !..Sublimation/depositional growth of snow
  448. t1_qs_sd = 0.86
  449. t2_qs_sd = 0.28*Sc3*SQRT(av_s)
  450. !..Melting of snow
  451. t1_qs_me = PI*4.*C_sqrd*olfus * 0.86
  452. t2_qs_me = PI*4.*C_sqrd*olfus * 0.28*Sc3*SQRT(av_s)
  453. !..Sublimation/depositional growth of graupel
  454. t1_qg_sd = 0.86 * cgg(10)
  455. t2_qg_sd = 0.28*Sc3*SQRT(av_g) * cgg(11)
  456. !..Melting of graupel
  457. t1_qg_me = PI*4.*C_cube*olfus * 0.86 * cgg(10)
  458. t2_qg_me = PI*4.*C_cube*olfus * 0.28*Sc3*SQRT(av_g) * cgg(11)
  459. !..Constants for helping find lookup table indexes.
  460. nic2 = NINT(ALOG10(r_c(1)))
  461. nii2 = NINT(ALOG10(r_i(1)))
  462. nii3 = NINT(ALOG10(Nt_i(1)))
  463. nir2 = NINT(ALOG10(r_r(1)))
  464. nir3 = NINT(ALOG10(N0r_exp(1)))
  465. nis2 = NINT(ALOG10(r_s(1)))
  466. nig2 = NINT(ALOG10(r_g(1)))
  467. nig3 = NINT(ALOG10(N0g_exp(1)))
  468. !..Create bins of cloud water (from min diameter up to 100 microns).
  469. Dc(1) = D0c*1.0d0
  470. dtc(1) = D0c*1.0d0
  471. do n = 2, nbc
  472. Dc(n) = Dc(n-1) + 1.0D-6
  473. dtc(n) = (Dc(n) - Dc(n-1))
  474. enddo
  475. !..Create bins of cloud ice (from min diameter up to 5x min snow size).
  476. xDx(1) = D0i*1.0d0
  477. xDx(nbi+1) = 5.0d0*D0s
  478. do n = 2, nbi
  479. xDx(n) = DEXP(DFLOAT(n-1)/DFLOAT(nbi) &
  480. *DLOG(xDx(nbi+1)/xDx(1)) +DLOG(xDx(1)))
  481. enddo
  482. do n = 1, nbi
  483. Di(n) = DSQRT(xDx(n)*xDx(n+1))
  484. dti(n) = xDx(n+1) - xDx(n)
  485. enddo
  486. !..Create bins of rain (from min diameter up to 5 mm).
  487. xDx(1) = D0r*1.0d0
  488. xDx(nbr+1) = 0.005d0
  489. do n = 2, nbr
  490. xDx(n) = DEXP(DFLOAT(n-1)/DFLOAT(nbr) &
  491. *DLOG(xDx(nbr+1)/xDx(1)) +DLOG(xDx(1)))
  492. enddo
  493. do n = 1, nbr
  494. Dr(n) = DSQRT(xDx(n)*xDx(n+1))
  495. dtr(n) = xDx(n+1) - xDx(n)
  496. enddo
  497. !..Create bins of snow (from min diameter up to 2 cm).
  498. xDx(1) = D0s*1.0d0
  499. xDx(nbs+1) = 0.02d0
  500. do n = 2, nbs
  501. xDx(n) = DEXP(DFLOAT(n-1)/DFLOAT(nbs) &
  502. *DLOG(xDx(nbs+1)/xDx(1)) +DLOG(xDx(1)))
  503. enddo
  504. do n = 1, nbs
  505. Ds(n) = DSQRT(xDx(n)*xDx(n+1))
  506. dts(n) = xDx(n+1) - xDx(n)
  507. enddo
  508. !..Create bins of graupel (from min diameter up to 5 cm).
  509. xDx(1) = D0g*1.0d0
  510. xDx(nbg+1) = 0.05d0
  511. do n = 2, nbg
  512. xDx(n) = DEXP(DFLOAT(n-1)/DFLOAT(nbg) &
  513. *DLOG(xDx(nbg+1)/xDx(1)) +DLOG(xDx(1)))
  514. enddo
  515. do n = 1, nbg
  516. Dg(n) = DSQRT(xDx(n)*xDx(n+1))
  517. dtg(n) = xDx(n+1) - xDx(n)
  518. enddo
  519. !+---+-----------------------------------------------------------------+
  520. !..Create lookup tables for most costly calculations.
  521. !+---+-----------------------------------------------------------------+
  522. do m = 1, ntb_r
  523. do k = 1, ntb_r1
  524. do j = 1, ntb_g
  525. do i = 1, ntb_g1
  526. tcg_racg(i,j,k,m) = 0.0d0
  527. tmr_racg(i,j,k,m) = 0.0d0
  528. tcr_gacr(i,j,k,m) = 0.0d0
  529. tmg_gacr(i,j,k,m) = 0.0d0
  530. tnr_racg(i,j,k,m) = 0.0d0
  531. tnr_gacr(i,j,k,m) = 0.0d0
  532. enddo
  533. enddo
  534. enddo
  535. enddo
  536. do m = 1, ntb_r
  537. do k = 1, ntb_r1
  538. do j = 1, ntb_t
  539. do i = 1, ntb_s
  540. tcs_racs1(i,j,k,m) = 0.0d0
  541. tmr_racs1(i,j,k,m) = 0.0d0
  542. tcs_racs2(i,j,k,m) = 0.0d0
  543. tmr_racs2(i,j,k,m) = 0.0d0
  544. tcr_sacr1(i,j,k,m) = 0.0d0
  545. tms_sacr1(i,j,k,m) = 0.0d0
  546. tcr_sacr2(i,j,k,m) = 0.0d0
  547. tms_sacr2(i,j,k,m) = 0.0d0
  548. tnr_racs1(i,j,k,m) = 0.0d0
  549. tnr_racs2(i,j,k,m) = 0.0d0
  550. tnr_sacr1(i,j,k,m) = 0.0d0
  551. tnr_sacr2(i,j,k,m) = 0.0d0
  552. enddo
  553. enddo
  554. enddo
  555. enddo
  556. do k = 1, 45
  557. do j = 1, ntb_r1
  558. do i = 1, ntb_r
  559. tpi_qrfz(i,j,k) = 0.0d0
  560. tni_qrfz(i,j,k) = 0.0d0
  561. tpg_qrfz(i,j,k) = 0.0d0
  562. tnr_qrfz(i,j,k) = 0.0d0
  563. enddo
  564. enddo
  565. do i = 1, ntb_c
  566. tpi_qcfz(i,k) = 0.0d0
  567. tni_qcfz(i,k) = 0.0d0
  568. enddo
  569. enddo
  570. do j = 1, ntb_i1
  571. do i = 1, ntb_i
  572. tps_iaus(i,j) = 0.0d0
  573. tni_iaus(i,j) = 0.0d0
  574. tpi_ide(i,j) = 0.0d0
  575. enddo
  576. enddo
  577. do j = 1, nbc
  578. do i = 1, nbr
  579. t_Efrw(i,j) = 0.0
  580. enddo
  581. do i = 1, nbs
  582. t_Efsw(i,j) = 0.0
  583. enddo
  584. enddo
  585. do k = 1, ntb_r
  586. do j = 1, ntb_r1
  587. do i = 1, nbr
  588. tnr_rev(i,j,k) = 0.0d0
  589. enddo
  590. enddo
  591. enddo
  592. CALL wrf_debug(150, 'CREATING MICROPHYSICS LOOKUP TABLES ... ')
  593. WRITE (wrf_err_message, '(a, f5.2, a, f5.2, a, f5.2, a, f5.2)') &
  594. ' using: mu_c=',mu_c,' mu_i=',mu_i,' mu_r=',mu_r,' mu_g=',mu_g
  595. CALL wrf_debug(150, wrf_err_message)
  596. !..Collision efficiency between rain/snow and cloud water.
  597. CALL wrf_debug(200, ' creating qc collision eff tables')
  598. call table_Efrw
  599. call table_Efsw
  600. !..Drop evaporation.
  601. ! CALL wrf_debug(200, ' creating rain evap table')
  602. ! call table_dropEvap
  603. !..Initialize various constants for computing radar reflectivity.
  604. ! call radar_init
  605. if (.not. iiwarm) then
  606. !..Rain collecting graupel & graupel collecting rain.
  607. CALL wrf_debug(200, ' creating rain collecting graupel table')
  608. call qr_acr_qg
  609. !..Rain collecting snow & snow collecting rain.
  610. CALL wrf_debug(200, ' creating rain collecting snow table')
  611. call qr_acr_qs
  612. !..Cloud water and rain freezing (Bigg, 1953).
  613. CALL wrf_debug(200, ' creating freezing of water drops table')
  614. call freezeH2O
  615. !..Conversion of some ice mass into snow category.
  616. CALL wrf_debug(200, ' creating ice converting to snow table')
  617. call qi_aut_qs
  618. endif
  619. CALL wrf_debug(150, ' ... DONE microphysical lookup tables')
  620. endif
  621. END SUBROUTINE thompson_init
  622. !+---+-----------------------------------------------------------------+
  623. !ctrlL
  624. !+---+-----------------------------------------------------------------+
  625. !..This is a wrapper routine designed to transfer values from 3D to 1D.
  626. !+---+-----------------------------------------------------------------+
  627. SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, &
  628. th, pii, p, dz, dt_in, itimestep, &
  629. RAINNC, RAINNCV, &
  630. SNOWNC, SNOWNCV, &
  631. GRAUPELNC, GRAUPELNCV, &
  632. SR, &
  633. ! refl_10cm, grid_clock, grid_alarms, &
  634. ids,ide, jds,jde, kds,kde, & ! domain dims
  635. ims,ime, jms,jme, kms,kme, & ! memory dims
  636. its,ite, jts,jte, kts,kte) ! tile dims
  637. implicit none
  638. !..Subroutine arguments
  639. INTEGER, INTENT(IN):: ids,ide, jds,jde, kds,kde, &
  640. ims,ime, jms,jme, kms,kme, &
  641. its,ite, jts,jte, kts,kte
  642. REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
  643. qv, qc, qr, qi, qs, qg, ni, nr, th
  644. REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN):: &
  645. pii, p, dz
  646. REAL, DIMENSION(ims:ime, jms:jme), INTENT(INOUT):: &
  647. RAINNC, RAINNCV, SR
  648. REAL, DIMENSION(ims:ime, jms:jme), OPTIONAL, INTENT(INOUT):: &
  649. SNOWNC, SNOWNCV, GRAUPELNC, GRAUPELNCV
  650. ! REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
  651. ! refl_10cm
  652. REAL, INTENT(IN):: dt_in
  653. INTEGER, INTENT(IN):: itimestep
  654. ! TYPE (WRFU_Clock):: grid_clock
  655. ! TYPE (WRFU_Alarm), POINTER:: grid_alarms(:)
  656. !..Local variables
  657. REAL, DIMENSION(kts:kte):: &
  658. qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
  659. nr1d, t1d, p1d, dz1d, dBZ
  660. REAL, DIMENSION(its:ite, jts:jte):: pcp_ra, pcp_sn, pcp_gr, pcp_ic
  661. REAL:: dt, pptrain, pptsnow, pptgraul, pptice
  662. REAL:: qc_max, qr_max, qs_max, qi_max, qg_max, ni_max, nr_max
  663. INTEGER:: i, j, k
  664. INTEGER:: imax_qc,imax_qr,imax_qi,imax_qs,imax_qg,imax_ni,imax_nr
  665. INTEGER:: jmax_qc,jmax_qr,jmax_qi,jmax_qs,jmax_qg,jmax_ni,jmax_nr
  666. INTEGER:: kmax_qc,kmax_qr,kmax_qi,kmax_qs,kmax_qg,kmax_ni,kmax_nr
  667. INTEGER:: i_start, j_start, i_end, j_end
  668. LOGICAL:: dBZ_tstep
  669. !+---+
  670. dBZ_tstep = .false.
  671. ! if ( Is_alarm_tstep(grid_clock, grid_alarms(HISTORY_ALARM)) ) then
  672. ! dBZ_tstep = .true.
  673. ! endif
  674. i_start = its
  675. j_start = jts
  676. i_end = ite
  677. j_end = jte
  678. !..For idealized testing by developer.
  679. if ( (ide-ids+1).gt.4 .and. (jde-jds+1).lt.4 .and. &
  680. ids.eq.its.and.ide.eq.ite.and.jds.eq.jts.and.jde.eq.jte) then
  681. i_start = its + 2
  682. i_end = ite - 1
  683. j_start = jts
  684. j_end = jte
  685. endif
  686. dt = dt_in
  687. qc_max = 0.
  688. qr_max = 0.
  689. qs_max = 0.
  690. qi_max = 0.
  691. qg_max = 0
  692. ni_max = 0.
  693. nr_max = 0.
  694. imax_qc = 0
  695. imax_qr = 0
  696. imax_qi = 0
  697. imax_qs = 0
  698. imax_qg = 0
  699. imax_ni = 0
  700. imax_nr = 0
  701. jmax_qc = 0
  702. jmax_qr = 0
  703. jmax_qi = 0
  704. jmax_qs = 0
  705. jmax_qg = 0
  706. jmax_ni = 0
  707. jmax_nr = 0
  708. kmax_qc = 0
  709. kmax_qr = 0
  710. kmax_qi = 0
  711. kmax_qs = 0
  712. kmax_qg = 0
  713. kmax_ni = 0
  714. kmax_nr = 0
  715. do i = 1, 256
  716. mp_debug(i:i) = char(0)
  717. enddo
  718. j_loop: do j = j_start, j_end
  719. i_loop: do i = i_start, i_end
  720. pptrain = 0.
  721. pptsnow = 0.
  722. pptgraul = 0.
  723. pptice = 0.
  724. RAINNCV(i,j) = 0.
  725. IF ( PRESENT (snowncv) ) THEN
  726. SNOWNCV(i,j) = 0.
  727. ENDIF
  728. IF ( PRESENT (graupelncv) ) THEN
  729. GRAUPELNCV(i,j) = 0.
  730. ENDIF
  731. SR(i,j) = 0.
  732. do k = kts, kte
  733. t1d(k) = th(i,k,j)*pii(i,k,j)
  734. p1d(k) = p(i,k,j)
  735. dz1d(k) = dz(i,k,j)
  736. qv1d(k) = qv(i,k,j)
  737. qc1d(k) = qc(i,k,j)
  738. qi1d(k) = qi(i,k,j)
  739. qr1d(k) = qr(i,k,j)
  740. qs1d(k) = qs(i,k,j)
  741. qg1d(k) = qg(i,k,j)
  742. ni1d(k) = ni(i,k,j)
  743. nr1d(k) = nr(i,k,j)
  744. enddo
  745. call mp_thompson(qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
  746. nr1d, t1d, p1d, dz1d, &
  747. pptrain, pptsnow, pptgraul, pptice, &
  748. kts, kte, dt, i, j)
  749. pcp_ra(i,j) = pptrain
  750. pcp_sn(i,j) = pptsnow
  751. pcp_gr(i,j) = pptgraul
  752. pcp_ic(i,j) = pptice
  753. RAINNCV(i,j) = pptrain + pptsnow + pptgraul + pptice
  754. RAINNC(i,j) = RAINNC(i,j) + pptrain + pptsnow + pptgraul + pptice
  755. IF ( PRESENT(snowncv) .AND. PRESENT(snownc) ) THEN
  756. SNOWNCV(i,j) = pptsnow + pptice
  757. SNOWNC(i,j) = SNOWNC(i,j) + pptsnow + pptice
  758. ENDIF
  759. IF ( PRESENT(graupelncv) .AND. PRESENT(graupelnc) ) THEN
  760. GRAUPELNCV(i,j) = pptgraul
  761. GRAUPELNC(i,j) = GRAUPELNC(i,j) + pptgraul
  762. ENDIF
  763. SR(i,j) = (pptsnow + pptgraul + pptice)/(RAINNCV(i,j)+1.e-12)
  764. do k = kts, kte
  765. qv(i,k,j) = qv1d(k)
  766. qc(i,k,j) = qc1d(k)
  767. qi(i,k,j) = qi1d(k)
  768. qr(i,k,j) = qr1d(k)
  769. qs(i,k,j) = qs1d(k)
  770. qg(i,k,j) = qg1d(k)
  771. ni(i,k,j) = ni1d(k)
  772. nr(i,k,j) = nr1d(k)
  773. th(i,k,j) = t1d(k)/pii(i,k,j)
  774. if (qc1d(k) .gt. qc_max) then
  775. imax_qc = i
  776. jmax_qc = j
  777. kmax_qc = k
  778. qc_max = qc1d(k)
  779. elseif (qc1d(k) .lt. 0.0) then
  780. write(mp_debug,*) 'WARNING, negative qc ', qc1d(k), &
  781. ' at i,j,k=', i,j,k
  782. CALL wrf_debug(150, mp_debug)
  783. endif
  784. if (qr1d(k) .gt. qr_max) then
  785. imax_qr = i
  786. jmax_qr = j
  787. kmax_qr = k
  788. qr_max = qr1d(k)
  789. elseif (qr1d(k) .lt. 0.0) then
  790. write(mp_debug,*) 'WARNING, negative qr ', qr1d(k), &
  791. ' at i,j,k=', i,j,k
  792. CALL wrf_debug(150, mp_debug)
  793. endif
  794. if (nr1d(k) .gt. nr_max) then
  795. imax_nr = i
  796. jmax_nr = j
  797. kmax_nr = k
  798. nr_max = nr1d(k)
  799. elseif (nr1d(k) .lt. 0.0) then
  800. write(mp_debug,*) 'WARNING, negative nr ', nr1d(k), &
  801. ' at i,j,k=', i,j,k
  802. CALL wrf_debug(150, mp_debug)
  803. endif
  804. if (qs1d(k) .gt. qs_max) then
  805. imax_qs = i
  806. jmax_qs = j
  807. kmax_qs = k
  808. qs_max = qs1d(k)
  809. elseif (qs1d(k) .lt. 0.0) then
  810. write(mp_debug,*) 'WARNING, negative qs ', qs1d(k), &
  811. ' at i,j,k=', i,j,k
  812. CALL wrf_debug(150, mp_debug)
  813. endif
  814. if (qi1d(k) .gt. qi_max) then
  815. imax_qi = i
  816. jmax_qi = j
  817. kmax_qi = k
  818. qi_max = qi1d(k)
  819. elseif (qi1d(k) .lt. 0.0) then
  820. write(mp_debug,*) 'WARNING, negative qi ', qi1d(k), &
  821. ' at i,j,k=', i,j,k
  822. CALL wrf_debug(150, mp_debug)
  823. endif
  824. if (qg1d(k) .gt. qg_max) then
  825. imax_qg = i
  826. jmax_qg = j
  827. kmax_qg = k
  828. qg_max = qg1d(k)
  829. elseif (qg1d(k) .lt. 0.0) then
  830. write(mp_debug,*) 'WARNING, negative qg ', qg1d(k), &
  831. ' at i,j,k=', i,j,k
  832. CALL wrf_debug(150, mp_debug)
  833. endif
  834. if (ni1d(k) .gt. ni_max) then
  835. imax_ni = i
  836. jmax_ni = j
  837. kmax_ni = k
  838. ni_max = ni1d(k)
  839. elseif (ni1d(k) .lt. 0.0) then
  840. write(mp_debug,*) 'WARNING, negative ni ', ni1d(k), &
  841. ' at i,j,k=', i,j,k
  842. CALL wrf_debug(150, mp_debug)
  843. endif
  844. if (qv1d(k) .lt. 0.0) then
  845. if (k.lt.kte-2 .and. k.gt.kts+1) then
  846. qv(i,k,j) = 0.5*(qv(i,k-1,j) + qv(i,k+1,j))
  847. else
  848. qv(i,k,j) = 1.E-7
  849. endif
  850. write(mp_debug,*) 'WARNING, negative qv ', qv1d(k), &
  851. ' at i,j,k=', i,j,k
  852. CALL wrf_debug(150, mp_debug)
  853. endif
  854. enddo
  855. ! if (dBZ_tstep) then
  856. ! call calc_refl10cm (qv1d, qc1d, qr1d, nr1d, qs1d, qg1d, &
  857. ! t1d, p1d, dBZ, kts, kte, i, j)
  858. ! do k = kts, kte
  859. ! refl_10cm(i,k,j) = MAX(-35., dBZ(k))
  860. ! enddo
  861. ! endif
  862. enddo i_loop
  863. enddo j_loop
  864. ! DEBUG - GT
  865. write(mp_debug,'(a,7(a,e13.6,1x,a,i3,a,i3,a,i3,a,1x))') 'MP-GT:', &
  866. 'qc: ', qc_max, '(', imax_qc, ',', jmax_qc, ',', kmax_qc, ')', &
  867. 'qr: ', qr_max, '(', imax_qr, ',', jmax_qr, ',', kmax_qr, ')', &
  868. 'qi: ', qi_max, '(', imax_qi, ',', jmax_qi, ',', kmax_qi, ')', &
  869. 'qs: ', qs_max, '(', imax_qs, ',', jmax_qs, ',', kmax_qs, ')', &
  870. 'qg: ', qg_max, '(', imax_qg, ',', jmax_qg, ',', kmax_qg, ')', &
  871. 'ni: ', ni_max, '(', imax_ni, ',', jmax_ni, ',', kmax_ni, ')', &
  872. 'nr: ', nr_max, '(', imax_nr, ',', jmax_nr, ',', kmax_nr, ')'
  873. CALL wrf_debug(150, mp_debug)
  874. ! END DEBUG - GT
  875. do i = 1, 256
  876. mp_debug(i:i) = char(0)
  877. enddo
  878. END SUBROUTINE mp_gt_driver
  879. !+---+-----------------------------------------------------------------+
  880. !ctrlL
  881. !+---+-----------------------------------------------------------------+
  882. !+---+-----------------------------------------------------------------+
  883. !.. This subroutine computes the moisture tendencies of water vapor,
  884. !.. cloud droplets, rain, cloud ice (pristine), snow, and graupel.
  885. !.. Previously this code was based on Reisner et al (1998), but few of
  886. !.. those pieces remain. A complete description is now found in
  887. !.. Thompson et al. (2004, 2008).
  888. !+---+-----------------------------------------------------------------+
  889. !
  890. subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
  891. nr1d, t1d, p1d, dzq, &
  892. pptrain, pptsnow, pptgraul, pptice, &
  893. kts, kte, dt, ii, jj)
  894. implicit none
  895. !..Sub arguments
  896. INTEGER, INTENT(IN):: kts, kte, ii, jj
  897. REAL, DIMENSION(kts:kte), INTENT(INOUT):: &
  898. qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
  899. nr1d, t1d, p1d
  900. REAL, DIMENSION(kts:kte), INTENT(IN):: dzq
  901. REAL, INTENT(INOUT):: pptrain, pptsnow, pptgraul, pptice
  902. REAL, INTENT(IN):: dt
  903. !..Local variables
  904. REAL, DIMENSION(kts:kte):: tten, qvten, qcten, qiten, &
  905. qrten, qsten, qgten, niten, nrten
  906. DOUBLE PRECISION, DIMENSION(kts:kte):: prw_vcd
  907. DOUBLE PRECISION, DIMENSION(kts:kte):: prr_wau, prr_rcw, prr_rcs, &
  908. prr_rcg, prr_sml, prr_gml, &
  909. prr_rci, prv_rev, &
  910. pnr_wau, pnr_rcs, pnr_rcg, &
  911. pnr_rci, pnr_sml, pnr_gml, &
  912. pnr_rev, pnr_rcr, pnr_rfz
  913. DOUBLE PRECISION, DIMENSION(kts:kte):: pri_inu, pni_inu, pri_ihm, &
  914. pni_ihm, pri_wfz, pni_wfz, &
  915. pri_rfz, pni_rfz, pri_ide, &
  916. pni_ide, pri_rci, pni_rci, &
  917. pni_sci, pni_iau
  918. DOUBLE PRECISION, DIMENSION(kts:kte):: prs_iau, prs_sci, prs_rcs, &
  919. prs_scw, prs_sde, prs_ihm, &
  920. prs_ide
  921. DOUBLE PRECISION, DIMENSION(kts:kte):: prg_scw, prg_rfz, prg_gde, &
  922. prg_gcw, prg_rci, prg_rcs, &
  923. prg_rcg, prg_ihm
  924. REAL, DIMENSION(kts:kte):: temp, pres, qv
  925. REAL, DIMENSION(kts:kte):: rc, ri, rr, rs, rg, ni, nr
  926. REAL, DIMENSION(kts:kte):: rho, rhof, rhof2
  927. REAL, DIMENSION(kts:kte):: qvs, qvsi
  928. REAL, DIMENSION(kts:kte):: satw, sati, ssatw, ssati
  929. REAL, DIMENSION(kts:kte):: diffu, visco, vsc2, &
  930. tcond, lvap, ocp, lvt2
  931. DOUBLE PRECISION, DIMENSION(kts:kte):: ilamr, ilamg, N0_r, N0_g
  932. REAL, DIMENSION(kts:kte):: mvd_r, mvd_c
  933. REAL, DIMENSION(kts:kte):: smob, smo2, smo1, smo0, &
  934. smoc, smod, smoe, smof
  935. REAL, DIMENSION(kts:kte):: sed_r, sed_s, sed_g, sed_i, sed_n
  936. REAL:: rgvm, delta_tp, orho, lfus2
  937. REAL, DIMENSION(4):: onstep
  938. DOUBLE PRECISION:: N0_exp, N0_min, lam_exp, lamc, lamr, lamg
  939. DOUBLE PRECISION:: lami, ilami
  940. REAL:: xDc, Dc_b, Dc_g, xDi, xDr, xDs, xDg, Ds_m, Dg_m
  941. DOUBLE PRECISION:: Dr_star
  942. REAL:: zeta1, zeta, taud, tau
  943. REAL:: stoke_r, stoke_s, stoke_g, stoke_i
  944. REAL:: vti, vtr, vts, vtg
  945. REAL, DIMENSION(kts:kte+1):: vtik, vtnik, vtrk, vtnrk, vtsk, vtgk
  946. REAL, DIMENSION(kts:kte):: vts_boost
  947. REAL:: Mrat, ils1, ils2, t1_vts, t2_vts, t3_vts, t4_vts, C_snow
  948. REAL:: a_, b_, loga_, A1, A2, tf
  949. REAL:: tempc, tc0, r_mvd1, r_mvd2, xkrat
  950. REAL:: xnc, xri, xni, xmi, oxmi, xrc, xrr, xnr
  951. REAL:: xsat, rate_max, sump, ratio
  952. REAL:: clap, fcd, dfcd
  953. REAL:: otemp, rvs, rvs_p, rvs_pp, gamsc, alphsc, t1_evap, t1_subl
  954. REAL:: r_frac, g_frac
  955. REAL:: Ef_rw, Ef_sw, Ef_gw, Ef_rr
  956. REAL:: dtsave, odts, odt, odzq
  957. REAL:: xslw1, ygra1, zans1
  958. INTEGER:: i, k, k2, n, nn, nstep, k_0, kbot, IT, iexfrq
  959. INTEGER, DIMENSION(4):: ksed1
  960. INTEGER:: nir, nis, nig, nii, nic
  961. INTEGER:: idx_tc, idx_t, idx_s, idx_g1, idx_g, idx_r1, idx_r, &
  962. idx_i1, idx_i, idx_c, idx, idx_d
  963. LOGICAL:: melti, no_micro
  964. LOGICAL, DIMENSION(kts:kte):: L_qc, L_qi, L_qr, L_qs, L_qg
  965. LOGICAL:: debug_flag
  966. !+---+
  967. debug_flag = .false.
  968. if (ii.eq.315 .and. jj.eq.2) debug_flag = .true.
  969. no_micro = .true.
  970. dtsave = dt
  971. odt = 1./dt
  972. odts = 1./dtsave
  973. iexfrq = 1
  974. !+---+-----------------------------------------------------------------+
  975. !.. Source/sink terms. First 2 chars: "pr" represents source/sink of
  976. !.. mass while "pn" represents source/sink of number. Next char is one
  977. !.. of "v" for water vapor, "r" for rain, "i" for cloud ice, "w" for
  978. !.. cloud water, "s" for snow, and "g" for graupel. Next chars
  979. !.. represent processes: "de" for sublimation/deposition, "ev" for
  980. !.. evaporation, "fz" for freezing, "ml" for melting, "au" for
  981. !.. autoconversion, "nu" for ice nucleation, "hm" for Hallet/Mossop
  982. !.. secondary ice production, and "c" for collection followed by the
  983. !.. character for the species being collected. ALL of these terms are
  984. !.. positive (except for deposition/sublimation terms which can switch
  985. !.. signs based on super/subsaturation) and are treated as negatives
  986. !.. where necessary in the tendency equations.
  987. !+---+-----------------------------------------------------------------+
  988. do k = kts, kte
  989. tten(k) = 0.
  990. qvten(k) = 0.
  991. qcten(k) = 0.
  992. qiten(k) = 0.
  993. qrten(k) = 0.
  994. qsten(k) = 0.
  995. qgten(k) = 0.
  996. niten(k) = 0.
  997. nrten(k) = 0.
  998. prw_vcd(k) = 0.
  999. prv_rev(k) = 0.
  1000. prr_wau(k) = 0.
  1001. prr_rcw(k) = 0.
  1002. prr_rcs(k) = 0.
  1003. prr_rcg(k) = 0.
  1004. prr_sml(k) = 0.
  1005. prr_gml(k) = 0.
  1006. prr_rci(k) = 0.
  1007. pnr_wau(k) = 0.
  1008. pnr_rcs(k) = 0.
  1009. pnr_rcg(k) = 0.
  1010. pnr_rci(k) = 0.
  1011. pnr_sml(k) = 0.
  1012. pnr_gml(k) = 0.
  1013. pnr_rev(k) = 0.
  1014. pnr_rcr(k) = 0.
  1015. pnr_rfz(k) = 0.
  1016. pri_inu(k) = 0.
  1017. pni_inu(k) = 0.
  1018. pri_ihm(k) = 0.
  1019. pni_ihm(k) = 0.
  1020. pri_wfz(k) = 0.
  1021. pni_wfz(k) = 0.
  1022. pri_rfz(k) = 0.
  1023. pni_rfz(k) = 0.
  1024. pri_ide(k) = 0.
  1025. pni_ide(k) = 0.
  1026. pri_rci(k) = 0.
  1027. pni_rci(k) = 0.
  1028. pni_sci(k) = 0.
  1029. pni_iau(k) = 0.
  1030. prs_iau(k) = 0.
  1031. prs_sci(k) = 0.
  1032. prs_rcs(k) = 0.
  1033. prs_scw(k) = 0.
  1034. prs_sde(k) = 0.
  1035. prs_ihm(k) = 0.
  1036. prs_ide(k) = 0.
  1037. prg_scw(k) = 0.
  1038. prg_rfz(k) = 0.
  1039. prg_gde(k) = 0.
  1040. prg_gcw(k) = 0.
  1041. prg_rci(k) = 0.
  1042. prg_rcs(k) = 0.
  1043. prg_rcg(k) = 0.
  1044. prg_ihm(k) = 0.
  1045. enddo
  1046. !+---+-----------------------------------------------------------------+
  1047. !..Put column of data into local arrays.
  1048. !+---+-----------------------------------------------------------------+
  1049. do k = kts, kte
  1050. temp(k) = t1d(k)
  1051. qv(k) = MAX(1.E-10, qv1d(k))
  1052. pres(k) = p1d(k)
  1053. rho(k) = 0.622*pres(k)/(R*temp(k)*(qv(k)+0.622))
  1054. if (qc1d(k) .gt. R1) then
  1055. no_micro = .false.
  1056. rc(k) = qc1d(k)*rho(k)
  1057. L_qc(k) = .true.
  1058. else
  1059. qc1d(k) = 0.0
  1060. rc(k) = R1
  1061. L_qc(k) = .false.
  1062. endif
  1063. if (qi1d(k) .gt. R1) then
  1064. no_micro = .false.
  1065. ri(k) = qi1d(k)*rho(k)
  1066. ni(k) = MAX(R2, ni1d(k)*rho(k))
  1067. L_qi(k) = .true.
  1068. lami = (am_i*cig(2)*oig1*ni(k)/ri(k))**obmi
  1069. ilami = 1./lami
  1070. xDi = (bm_i + mu_i + 1.) * ilami
  1071. if (xDi.lt. 20.E-6) then
  1072. lami = cie(2)/20.E-6
  1073. ni(k) = MIN(500.D3, cig(1)*oig2*ri(k)/am_i*lami**bm_i)
  1074. elseif (xDi.gt. 300.E-6) then
  1075. lami = cie(2)/300.E-6
  1076. ni(k) = cig(1)*oig2*ri(k)/am_i*lami**bm_i
  1077. endif
  1078. else
  1079. qi1d(k) = 0.0
  1080. ni1d(k) = 0.0
  1081. ri(k) = R1
  1082. ni(k) = R2
  1083. L_qi(k) = .false.
  1084. endif
  1085. if (qr1d(k) .gt. R1) then
  1086. no_micro = .false.
  1087. rr(k) = qr1d(k)*rho(k)
  1088. nr(k) = MAX(R2, nr1d(k)*rho(k))
  1089. L_qr(k) = .true.
  1090. if (nr(k) .gt. R2) then
  1091. lamr = (am_r*crg(3)*org2*nr(k)/rr(k))**obmr
  1092. mvd_r(k) = (3.0 + mu_r + 0.672) / lamr
  1093. if (mvd_r(k) .gt. 2.5E-3) then
  1094. mvd_r(k) = 2.5E-3
  1095. lamr = (3.0 + mu_r + 0.672) / mvd_r(k)
  1096. nr(k) = crg(2)*org3*rr(k)*lamr**bm_r / am_r
  1097. elseif (mvd_r(k) .lt. D0r*0.75) then
  1098. mvd_r(k) = D0r*0.75
  1099. lamr = (3.0 + mu_r + 0.672) / mvd_r(k)
  1100. nr(k) = crg(2)*org3*rr(k)*lamr**bm_r / am_r
  1101. endif
  1102. else
  1103. if (qr1d(k) .gt. R2) then
  1104. mvd_r(k) = 1.0E-3
  1105. else
  1106. mvd_r(k) = 2.5E-3 / 3.0**(ALOG10(R2)-ALOG10(qr1d(k)))
  1107. endif
  1108. lamr = (3.0 + mu_r + 0.672) / mvd_r(k)
  1109. nr(k) = crg(2)*org3*rr(k)*lamr**bm_r / am_r
  1110. endif
  1111. else
  1112. qr1d(k) = 0.0
  1113. nr1d(k) = 0.0
  1114. rr(k) = R1
  1115. nr(k) = R2
  1116. L_qr(k) = .false.
  1117. endif
  1118. if (qs1d(k) .gt. R1) then
  1119. no_micro = .false.
  1120. rs(k) = qs1d(k)*rho(k)
  1121. L_qs(k) = .true.
  1122. else
  1123. qs1d(k) = 0.0
  1124. rs(k) = R1
  1125. L_qs(k) = .false.
  1126. endif
  1127. if (qg1d(k) .gt. R1) then
  1128. no_micro = .false.
  1129. rg(k) = qg1d(k)*rho(k)
  1130. L_qg(k) = .true.
  1131. else
  1132. qg1d(k) = 0.0
  1133. rg(k) = R1
  1134. L_qg(k) = .false.
  1135. endif
  1136. enddo
  1137. !+---+-----------------------------------------------------------------+
  1138. !..Derive various thermodynamic variables frequently used.
  1139. !.. Saturation vapor pressure (mixing ratio) over liquid/ice comes from
  1140. !.. Flatau et al. 1992; enthalpy (latent heat) of vaporization from
  1141. !.. Bohren & Albrecht 1998; others from Pruppacher & Klett 1978.
  1142. !+---+-----------------------------------------------------------------+
  1143. do k = kts, kte
  1144. tempc = temp(k) - 273.15
  1145. rhof(k) = SQRT(RHO_NOT/rho(k))
  1146. rhof2(k) = SQRT(rhof(k))
  1147. qvs(k) = rslf(pres(k), temp(k))
  1148. if (tempc .le. 0.0) then
  1149. qvsi(k) = rsif(pres(k), temp(k))
  1150. else
  1151. qvsi(k) = qvs(k)
  1152. endif
  1153. satw(k) = qv(k)/qvs(k)
  1154. sati(k) = qv(k)/qvsi(k)
  1155. ssatw(k) = satw(k) - 1.
  1156. ssati(k) = sati(k) - 1.
  1157. if (abs(ssatw(k)).lt. eps) ssatw(k) = 0.0
  1158. if (abs(ssati(k)).lt. eps) ssati(k) = 0.0
  1159. if (no_micro .and. ssati(k).gt. 0.0) no_micro = .false.
  1160. diffu(k) = 2.11E-5*(temp(k)/273.15)**1.94 * (101325./pres(k))
  1161. if (tempc .ge. 0.0) then
  1162. visco(k) = (1.718+0.0049*tempc)*1.0E-5
  1163. else
  1164. visco(k) = (1.718+0.0049*tempc-1.2E-5*tempc*tempc)*1.0E-5
  1165. endif
  1166. ocp(k) = 1./(Cp*(1.+0.887*qv(k)))
  1167. vsc2(k) = SQRT(rho(k)/visco(k))
  1168. lvap(k) = lvap0 + (2106.0 - 4218.0)*tempc
  1169. tcond(k) = (5.69 + 0.0168*tempc)*1.0E-5 * 418.936
  1170. enddo
  1171. !+---+-----------------------------------------------------------------+
  1172. !..If no existing hydrometeor species and no chance to initiate ice or
  1173. !.. condense cloud water, just exit quickly!
  1174. !+---+-----------------------------------------------------------------+
  1175. if (no_micro) return
  1176. !+---+-----------------------------------------------------------------+
  1177. !..Calculate y-intercept, slope, and useful moments for snow.
  1178. !+---+-----------------------------------------------------------------+
  1179. if (.not. iiwarm) then
  1180. do k = kts, kte
  1181. if (.not. L_qs(k)) CYCLE
  1182. tc0 = MIN(-0.1, temp(k)-273.15)
  1183. smob(k) = rs(k)*oams
  1184. !..All other moments based on reference, 2nd moment. If bm_s.ne.2,
  1185. !.. then we must compute actual 2nd moment and use as reference.
  1186. if (bm_s.gt.(2.0-1.e-3) .and. bm_s.lt.(2.0+1.e-3)) then
  1187. smo2(k) = smob(k)
  1188. else
  1189. loga_ = sa(1) + sa(2)*tc0 + sa(3)*bm_s &
  1190. + sa(4)*tc0*bm_s + sa(5)*tc0*tc0 &
  1191. + sa(6)*bm_s*bm_s + sa(7)*tc0*tc0*bm_s &
  1192. + sa(8)

Large files files are truncated, but you can click here to view the full file