PageRenderTime 73ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 1ms

/wrfv2_fire/phys/module_ra_gsfcsw.F

http://github.com/jbeezley/wrf-fire
FORTRAN Legacy | 3138 lines | 1778 code | 504 blank | 856 comment | 46 complexity | 1aade0c232781669363b83e248af8e59 MD5 | raw file
Possible License(s): AGPL-1.0

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

  1. !Comment the following out to turn off aerosol-radiation
  2. !feedback between MOSAIC and GSFCSW. wig, 21-Feb-2005
  3. MODULE module_ra_gsfcsw
  4. REAL, PARAMETER, PRIVATE :: thresh=1.e-9
  5. REAL, SAVE :: center_lat
  6. ! Assign co2 and trace gases amount (units are parts/part by volumn)
  7. REAL, PARAMETER, PRIVATE :: co2 = 300.e-6
  8. CONTAINS
  9. SUBROUTINE GSFCSWRAD(rthraten,gsw,xlat,xlong &
  10. ,dz8w,rho_phy &
  11. ,alb,t3d,qv3d,qc3d,qr3d &
  12. ,qi3d,qs3d,qg3d,qndrop3d &
  13. ,p3d,p8w3d,pi3d,cldfra3d,rswtoa &
  14. ,gmt,cp,g,julday,xtime,declin,solcon &
  15. ,radfrq,degrad,taucldi,taucldc,warm_rain &
  16. ,tauaer300,tauaer400,tauaer600,tauaer999 & ! jcb
  17. ,gaer300,gaer400,gaer600,gaer999 & ! jcb
  18. ,waer300,waer400,waer600,waer999 & ! jcb
  19. ,aer_ra_feedback &
  20. ,f_qv,f_qc,f_qr,f_qi,f_qs,f_qg,f_qndrop &
  21. ,ids,ide, jds,jde, kds,kde &
  22. ,ims,ime, jms,jme, kms,kme &
  23. ,its,ite, jts,jte, kts,kte )
  24. !------------------------------------------------------------------
  25. IMPLICIT NONE
  26. !------------------------------------------------------------------
  27. INTEGER, PARAMETER :: np = 75
  28. INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde, &
  29. ims,ime, jms,jme, kms,kme, &
  30. its,ite, jts,jte, kts,kte
  31. LOGICAL, INTENT(IN ) :: warm_rain
  32. INTEGER, INTENT(IN ) :: JULDAY
  33. REAL, INTENT(IN ) :: RADFRQ,DEGRAD, &
  34. XTIME,DECLIN,SOLCON
  35. !
  36. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
  37. INTENT(IN ) :: P3D, &
  38. P8W3D, &
  39. pi3D, &
  40. T3D, &
  41. dz8w, &
  42. rho_phy, &
  43. CLDFRA3D
  44. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
  45. INTENT(INOUT) :: RTHRATEN
  46. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
  47. OPTIONAL, &
  48. INTENT(INOUT) :: taucldi, &
  49. taucldc
  50. !
  51. REAL, DIMENSION( ims:ime, jms:jme ), &
  52. INTENT(IN ) :: XLAT, &
  53. XLONG, &
  54. ALB
  55. !
  56. REAL, DIMENSION( ims:ime, jms:jme ), &
  57. INTENT(INOUT) :: GSW, &
  58. RSWTOA
  59. !
  60. REAL, INTENT(IN ) :: GMT,CP,G
  61. !
  62. !
  63. ! Optional
  64. !
  65. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), OPTIONAL , &
  66. INTENT(IN ) :: tauaer300,tauaer400,tauaer600,tauaer999, & ! jcb
  67. gaer300,gaer400,gaer600,gaer999, & ! jcb
  68. waer300,waer400,waer600,waer999 ! jcb
  69. INTEGER, INTENT(IN ), OPTIONAL :: aer_ra_feedback
  70. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
  71. OPTIONAL, &
  72. INTENT(IN ) :: &
  73. QV3D, &
  74. QC3D, &
  75. QR3D, &
  76. QI3D, &
  77. QS3D, &
  78. QG3D, &
  79. QNDROP3D
  80. LOGICAL, OPTIONAL, INTENT(IN ) :: &
  81. F_QV,F_QC,F_QR,F_QI,F_QS,F_QG, &
  82. F_QNDROP
  83. ! LOCAL VARS
  84. REAL, DIMENSION( its:ite ) :: &
  85. ts, &
  86. cosz, &
  87. fp, &
  88. rsuvbm, &
  89. rsuvdf, &
  90. rsirbm, &
  91. rsirdf, &
  92. p400, &
  93. p700
  94. INTEGER, DIMENSION( its:ite ) :: &
  95. ict, &
  96. icb
  97. REAL, DIMENSION( its:ite, kts-1:kte, 2 ) :: taucld
  98. REAL, DIMENSION( its:ite, kts-1:kte+1 ) :: flx, &
  99. flxd
  100. !
  101. REAL, DIMENSION( its:ite, kts-1:kte ) :: O3
  102. !
  103. REAL, DIMENSION( its:ite, kts-1:kte, 11 ) :: &
  104. taual, &
  105. ssaal, &
  106. asyal
  107. REAL, DIMENSION( its:ite, kts-1:kte, 2 ) :: &
  108. reff, &
  109. cwc
  110. REAL, DIMENSION( its: ite, kts-1:kte+1 ) :: &
  111. P8W2D
  112. REAL, DIMENSION( its: ite, kts-1:kte ) :: &
  113. TTEN2D, &
  114. qndrop2d, &
  115. SH2D, &
  116. P2D, &
  117. T2D, &
  118. fcld2D
  119. REAL, DIMENSION( np, 5 ) :: pres, &
  120. ozone
  121. REAL, DIMENSION( np ) :: p
  122. LOGICAL :: cldwater,overcast, predicate
  123. !
  124. INTEGER :: i,j,K,NK,ib,kk,mix,mkx
  125. ! iprof = 1 : mid-latitude summer profile
  126. ! = 2 : mid-latitude winter profile
  127. ! = 3 : sub-arctic summer profile
  128. ! = 4 : sub-arctic winter profile
  129. ! = 5 : tropical profile
  130. !
  131. INTEGER :: iprof, &
  132. is_summer, &
  133. ie_summer, &
  134. lattmp
  135. !
  136. REAL :: XLAT0,XLONG0
  137. REAL :: fac,latrmp
  138. REAL :: xt24,tloctm,hrang,xxlat
  139. real, dimension(11) :: midbands ! jcb
  140. data midbands/.2,.235,.27,.2875,.3025,.305,.3625,.55,1.92,1.745,6.135/ ! jcb
  141. real :: ang,slope ! jcb
  142. character(len=200) :: msg !wig
  143. real pi, third, relconst, lwpmin, rhoh2o
  144. !
  145. !--------------------------------------------------------------------------------
  146. ! data set 1
  147. ! mid-latitude summer (75 levels) : p(mb) o3(g/g)
  148. ! surface temp = 294.0
  149. !
  150. data (pres(i,1),i=1,np)/ &
  151. 0.0006244, 0.0008759, 0.0012286, 0.0017234, 0.0024174, &
  152. 0.0033909, 0.0047565, 0.0066720, 0.0093589, 0.0131278, &
  153. 0.0184145, 0.0258302, 0.0362323, 0.0508234, 0.0712906, &
  154. 0.1000000, 0.1402710, 0.1967600, 0.2759970, 0.3871430, &
  155. 0.5430, 0.7617, 1.0685, 1.4988, 2.1024, 2.9490, &
  156. 4.1366, 5.8025, 8.1392, 11.4170, 16.0147, 22.4640, &
  157. 31.5105, 44.2001, 62.0000, 85.7750, 109.5500, 133.3250, &
  158. 157.1000, 180.8750, 204.6500, 228.4250, 252.2000, 275.9750, &
  159. 299.7500, 323.5250, 347.3000, 371.0750, 394.8500, 418.6250, &
  160. 442.4000, 466.1750, 489.9500, 513.7250, 537.5000, 561.2750, &
  161. 585.0500, 608.8250, 632.6000, 656.3750, 680.1500, 703.9250, &
  162. 727.7000, 751.4750, 775.2500, 799.0250, 822.8000, 846.5750, &
  163. 870.3500, 894.1250, 917.9000, 941.6750, 965.4500, 989.2250, &
  164. 1013.0000/
  165. !
  166. data (ozone(i,1),i=1,np)/ &
  167. 0.1793E-06, 0.2228E-06, 0.2665E-06, 0.3104E-06, 0.3545E-06, &
  168. 0.3989E-06, 0.4435E-06, 0.4883E-06, 0.5333E-06, 0.5786E-06, &
  169. 0.6241E-06, 0.6698E-06, 0.7157E-06, 0.7622E-06, 0.8557E-06, &
  170. 0.1150E-05, 0.1462E-05, 0.1793E-05, 0.2143E-05, 0.2512E-05, &
  171. 0.2902E-05, 0.3313E-05, 0.4016E-05, 0.5193E-05, 0.6698E-05, &
  172. 0.8483E-05, 0.9378E-05, 0.9792E-05, 0.1002E-04, 0.1014E-04, &
  173. 0.9312E-05, 0.7834E-05, 0.6448E-05, 0.5159E-05, 0.3390E-05, &
  174. 0.1937E-05, 0.1205E-05, 0.8778E-06, 0.6935E-06, 0.5112E-06, &
  175. 0.3877E-06, 0.3262E-06, 0.2770E-06, 0.2266E-06, 0.2020E-06, &
  176. 0.1845E-06, 0.1679E-06, 0.1519E-06, 0.1415E-06, 0.1317E-06, &
  177. 0.1225E-06, 0.1137E-06, 0.1055E-06, 0.1001E-06, 0.9487E-07, &
  178. 0.9016E-07, 0.8641E-07, 0.8276E-07, 0.7930E-07, 0.7635E-07, &
  179. 0.7347E-07, 0.7065E-07, 0.6821E-07, 0.6593E-07, 0.6368E-07, &
  180. 0.6148E-07, 0.5998E-07, 0.5859E-07, 0.5720E-07, 0.5582E-07, &
  181. 0.5457E-07, 0.5339E-07, 0.5224E-07, 0.5110E-07, 0.4999E-07/
  182. !--------------------------------------------------------------------------------
  183. ! data set 2
  184. ! mid-latitude winter (75 levels) : p(mb) o3(g/g)
  185. ! surface temp = 272.2
  186. !
  187. data (pres(i,2),i=1,np)/ &
  188. 0.0006244, 0.0008759, 0.0012286, 0.0017234, 0.0024174, &
  189. 0.0033909, 0.0047565, 0.0066720, 0.0093589, 0.0131278, &
  190. 0.0184145, 0.0258302, 0.0362323, 0.0508234, 0.0712906, &
  191. 0.1000000, 0.1402710, 0.1967600, 0.2759970, 0.3871430, &
  192. 0.5430, 0.7617, 1.0685, 1.4988, 2.1024, 2.9490, &
  193. 4.1366, 5.8025, 8.1392, 11.4170, 16.0147, 22.4640, &
  194. 31.5105, 44.2001, 62.0000, 85.9000, 109.8000, 133.7000, &
  195. 157.6000, 181.5000, 205.4000, 229.3000, 253.2000, 277.1000, &
  196. 301.0000, 324.9000, 348.8000, 372.7000, 396.6000, 420.5000, &
  197. 444.4000, 468.3000, 492.2000, 516.1000, 540.0000, 563.9000, &
  198. 587.8000, 611.7000, 635.6000, 659.5000, 683.4000, 707.3000, &
  199. 731.2000, 755.1000, 779.0000, 802.9000, 826.8000, 850.7000, &
  200. 874.6000, 898.5000, 922.4000, 946.3000, 970.2000, 994.1000, &
  201. 1018.0000/
  202. !
  203. data (ozone(i,2),i=1,np)/ &
  204. 0.2353E-06, 0.3054E-06, 0.3771E-06, 0.4498E-06, 0.5236E-06, &
  205. 0.5984E-06, 0.6742E-06, 0.7511E-06, 0.8290E-06, 0.9080E-06, &
  206. 0.9881E-06, 0.1069E-05, 0.1152E-05, 0.1319E-05, 0.1725E-05, &
  207. 0.2145E-05, 0.2581E-05, 0.3031E-05, 0.3497E-05, 0.3980E-05, &
  208. 0.4478E-05, 0.5300E-05, 0.6725E-05, 0.8415E-05, 0.1035E-04, &
  209. 0.1141E-04, 0.1155E-04, 0.1143E-04, 0.1093E-04, 0.1060E-04, &
  210. 0.9720E-05, 0.8849E-05, 0.7424E-05, 0.6023E-05, 0.4310E-05, &
  211. 0.2820E-05, 0.1990E-05, 0.1518E-05, 0.1206E-05, 0.9370E-06, &
  212. 0.7177E-06, 0.5450E-06, 0.4131E-06, 0.3277E-06, 0.2563E-06, &
  213. 0.2120E-06, 0.1711E-06, 0.1524E-06, 0.1344E-06, 0.1199E-06, &
  214. 0.1066E-06, 0.9516E-07, 0.8858E-07, 0.8219E-07, 0.7598E-07, &
  215. 0.6992E-07, 0.6403E-07, 0.5887E-07, 0.5712E-07, 0.5540E-07, &
  216. 0.5370E-07, 0.5214E-07, 0.5069E-07, 0.4926E-07, 0.4785E-07, &
  217. 0.4713E-07, 0.4694E-07, 0.4676E-07, 0.4658E-07, 0.4641E-07, &
  218. 0.4634E-07, 0.4627E-07, 0.4619E-07, 0.4612E-07, 0.4605E-07/
  219. !--------------------------------------------------------------------------------
  220. ! data set 3
  221. ! sub-arctic summer (75 levels) : p(mb) o3(g/g)
  222. ! surface temp = 287.0
  223. !
  224. data (pres(i,3),i=1,np)/ &
  225. 0.0006244, 0.0008759, 0.0012286, 0.0017234, 0.0024174, &
  226. 0.0033909, 0.0047565, 0.0066720, 0.0093589, 0.0131278, &
  227. 0.0184145, 0.0258302, 0.0362323, 0.0508234, 0.0712906, &
  228. 0.1000000, 0.1402710, 0.1967600, 0.2759970, 0.3871430, &
  229. 0.5430, 0.7617, 1.0685, 1.4988, 2.1024, 2.9490, &
  230. 4.1366, 5.8025, 8.1392, 11.4170, 16.0147, 22.4640, &
  231. 31.5105, 44.2001, 62.0000, 85.7000, 109.4000, 133.1000, &
  232. 156.8000, 180.5000, 204.2000, 227.9000, 251.6000, 275.3000, &
  233. 299.0000, 322.7000, 346.4000, 370.1000, 393.8000, 417.5000, &
  234. 441.2000, 464.9000, 488.6000, 512.3000, 536.0000, 559.7000, &
  235. 583.4000, 607.1000, 630.8000, 654.5000, 678.2000, 701.9000, &
  236. 725.6000, 749.3000, 773.0000, 796.7000, 820.4000, 844.1000, &
  237. 867.8000, 891.5000, 915.2000, 938.9000, 962.6000, 986.3000, &
  238. 1010.0000/
  239. !
  240. data (ozone(i,3),i=1,np)/ &
  241. 0.1728E-06, 0.2131E-06, 0.2537E-06, 0.2944E-06, 0.3353E-06, &
  242. 0.3764E-06, 0.4176E-06, 0.4590E-06, 0.5006E-06, 0.5423E-06, &
  243. 0.5842E-06, 0.6263E-06, 0.6685E-06, 0.7112E-06, 0.7631E-06, &
  244. 0.1040E-05, 0.1340E-05, 0.1660E-05, 0.2001E-05, 0.2362E-05, &
  245. 0.2746E-05, 0.3153E-05, 0.3762E-05, 0.4988E-05, 0.6518E-05, &
  246. 0.8352E-05, 0.9328E-05, 0.9731E-05, 0.8985E-05, 0.7632E-05, &
  247. 0.6814E-05, 0.6384E-05, 0.5718E-05, 0.4728E-05, 0.4136E-05, &
  248. 0.3033E-05, 0.2000E-05, 0.1486E-05, 0.1121E-05, 0.8680E-06, &
  249. 0.6474E-06, 0.5164E-06, 0.3921E-06, 0.2996E-06, 0.2562E-06, &
  250. 0.2139E-06, 0.1723E-06, 0.1460E-06, 0.1360E-06, 0.1267E-06, &
  251. 0.1189E-06, 0.1114E-06, 0.1040E-06, 0.9678E-07, 0.8969E-07, &
  252. 0.8468E-07, 0.8025E-07, 0.7590E-07, 0.7250E-07, 0.6969E-07, &
  253. 0.6694E-07, 0.6429E-07, 0.6208E-07, 0.5991E-07, 0.5778E-07, &
  254. 0.5575E-07, 0.5403E-07, 0.5233E-07, 0.5067E-07, 0.4904E-07, &
  255. 0.4721E-07, 0.4535E-07, 0.4353E-07, 0.4173E-07, 0.3997E-07/
  256. !--------------------------------------------------------------------------------
  257. ! data set 3
  258. ! sub-arctic winter (75 levels) : p(mb) o3(g/g)
  259. ! surface temp = 257.1
  260. !
  261. data (pres(i,4),i=1,np)/ &
  262. 0.0006244, 0.0008759, 0.0012286, 0.0017234, 0.0024174, &
  263. 0.0033909, 0.0047565, 0.0066720, 0.0093589, 0.0131278, &
  264. 0.0184145, 0.0258302, 0.0362323, 0.0508234, 0.0712906, &
  265. 0.1000000, 0.1402710, 0.1967600, 0.2759970, 0.3871430, &
  266. 0.5430, 0.7617, 1.0685, 1.4988, 2.1024, 2.9490, &
  267. 4.1366, 5.8025, 8.1392, 11.4170, 16.0147, 22.4640, &
  268. 31.5105, 44.2001, 62.0000, 85.7750, 109.5500, 133.3250, &
  269. 157.1000, 180.8750, 204.6500, 228.4250, 252.2000, 275.9750, &
  270. 299.7500, 323.5250, 347.3000, 371.0750, 394.8500, 418.6250, &
  271. 442.4000, 466.1750, 489.9500, 513.7250, 537.5000, 561.2750, &
  272. 585.0500, 608.8250, 632.6000, 656.3750, 680.1500, 703.9250, &
  273. 727.7000, 751.4750, 775.2500, 799.0250, 822.8000, 846.5750, &
  274. 870.3500, 894.1250, 917.9000, 941.6750, 965.4500, 989.2250, &
  275. 1013.0000/
  276. !
  277. data (ozone(i,4),i=1,np)/ &
  278. 0.2683E-06, 0.3562E-06, 0.4464E-06, 0.5387E-06, 0.6333E-06, &
  279. 0.7301E-06, 0.8291E-06, 0.9306E-06, 0.1034E-05, 0.1140E-05, &
  280. 0.1249E-05, 0.1360E-05, 0.1474E-05, 0.1855E-05, 0.2357E-05, &
  281. 0.2866E-05, 0.3383E-05, 0.3906E-05, 0.4437E-05, 0.4975E-05, &
  282. 0.5513E-05, 0.6815E-05, 0.8157E-05, 0.1008E-04, 0.1200E-04, &
  283. 0.1242E-04, 0.1250E-04, 0.1157E-04, 0.1010E-04, 0.9063E-05, &
  284. 0.8836E-05, 0.8632E-05, 0.8391E-05, 0.7224E-05, 0.6054E-05, &
  285. 0.4503E-05, 0.3204E-05, 0.2278E-05, 0.1833E-05, 0.1433E-05, &
  286. 0.9996E-06, 0.7440E-06, 0.5471E-06, 0.3944E-06, 0.2852E-06, &
  287. 0.1977E-06, 0.1559E-06, 0.1333E-06, 0.1126E-06, 0.9441E-07, &
  288. 0.7678E-07, 0.7054E-07, 0.6684E-07, 0.6323E-07, 0.6028E-07, &
  289. 0.5746E-07, 0.5468E-07, 0.5227E-07, 0.5006E-07, 0.4789E-07, &
  290. 0.4576E-07, 0.4402E-07, 0.4230E-07, 0.4062E-07, 0.3897E-07, &
  291. 0.3793E-07, 0.3697E-07, 0.3602E-07, 0.3506E-07, 0.3413E-07, &
  292. 0.3326E-07, 0.3239E-07, 0.3153E-07, 0.3069E-07, 0.2987E-07/
  293. !--------------------------------------------------------------------------------
  294. ! data set 4
  295. ! tropical (75 levels) : p(mb) o3(g/g)
  296. ! surface temp = 300.0
  297. !
  298. data (pres(i,5),i=1,np)/ &
  299. 0.0006244, 0.0008759, 0.0012286, 0.0017234, 0.0024174, &
  300. 0.0033909, 0.0047565, 0.0066720, 0.0093589, 0.0131278, &
  301. 0.0184145, 0.0258302, 0.0362323, 0.0508234, 0.0712906, &
  302. 0.1000000, 0.1402710, 0.1967600, 0.2759970, 0.3871430, &
  303. 0.5430, 0.7617, 1.0685, 1.4988, 2.1024, 2.9490, &
  304. 4.1366, 5.8025, 8.1392, 11.4170, 16.0147, 22.4640, &
  305. 31.5105, 44.2001, 62.0000, 85.7750, 109.5500, 133.3250, &
  306. 157.1000, 180.8750, 204.6500, 228.4250, 252.2000, 275.9750, &
  307. 299.7500, 323.5250, 347.3000, 371.0750, 394.8500, 418.6250, &
  308. 442.4000, 466.1750, 489.9500, 513.7250, 537.5000, 561.2750, &
  309. 585.0500, 608.8250, 632.6000, 656.3750, 680.1500, 703.9250, &
  310. 727.7000, 751.4750, 775.2500, 799.0250, 822.8000, 846.5750, &
  311. 870.3500, 894.1250, 917.9000, 941.6750, 965.4500, 989.2250, &
  312. 1013.0000/
  313. !
  314. data (ozone(i,5),i=1,np)/ &
  315. 0.1993E-06, 0.2521E-06, 0.3051E-06, 0.3585E-06, 0.4121E-06, &
  316. 0.4661E-06, 0.5203E-06, 0.5748E-06, 0.6296E-06, 0.6847E-06, &
  317. 0.7402E-06, 0.7959E-06, 0.8519E-06, 0.9096E-06, 0.1125E-05, &
  318. 0.1450E-05, 0.1794E-05, 0.2156E-05, 0.2538E-05, 0.2939E-05, &
  319. 0.3362E-05, 0.3785E-05, 0.4753E-05, 0.6005E-05, 0.7804E-05, &
  320. 0.9635E-05, 0.1023E-04, 0.1067E-04, 0.1177E-04, 0.1290E-04, &
  321. 0.1134E-04, 0.9223E-05, 0.6667E-05, 0.3644E-05, 0.1545E-05, &
  322. 0.5355E-06, 0.2523E-06, 0.2062E-06, 0.1734E-06, 0.1548E-06, &
  323. 0.1360E-06, 0.1204E-06, 0.1074E-06, 0.9707E-07, 0.8960E-07, &
  324. 0.8419E-07, 0.7962E-07, 0.7542E-07, 0.7290E-07, 0.7109E-07, &
  325. 0.6940E-07, 0.6786E-07, 0.6635E-07, 0.6500E-07, 0.6370E-07, &
  326. 0.6244E-07, 0.6132E-07, 0.6022E-07, 0.5914E-07, 0.5884E-07, &
  327. 0.5855E-07, 0.5823E-07, 0.5772E-07, 0.5703E-07, 0.5635E-07, &
  328. 0.5570E-07, 0.5492E-07, 0.5412E-07, 0.5335E-07, 0.5260E-07, &
  329. 0.5167E-07, 0.5063E-07, 0.4961E-07, 0.4860E-07, 0.4761E-07/
  330. !--------------------------------------------------------------------------------
  331. #ifdef WRF_CHEM
  332. IF ( aer_ra_feedback == 1) then
  333. IF ( .NOT. &
  334. ( PRESENT(tauaer300) .AND. &
  335. PRESENT(tauaer400) .AND. &
  336. PRESENT(tauaer600) .AND. &
  337. PRESENT(tauaer999) .AND. &
  338. PRESENT(gaer300) .AND. &
  339. PRESENT(gaer400) .AND. &
  340. PRESENT(gaer600) .AND. &
  341. PRESENT(gaer999) .AND. &
  342. PRESENT(waer300) .AND. &
  343. PRESENT(waer400) .AND. &
  344. PRESENT(waer600) .AND. &
  345. PRESENT(waer999) ) ) THEN
  346. CALL wrf_error_fatal ( 'Warning: missing fields required for aerosol radiation' )
  347. ENDIF
  348. ENDIF
  349. #endif
  350. cldwater = .true.
  351. overcast = .false.
  352. mix=ite-its+1
  353. mkx=kte-kts+1
  354. is_summer=80
  355. ie_summer=265
  356. ! testing, need to change iprof, which is function of lat and julian day
  357. ! iprof = 1 : mid-latitude summer profile
  358. ! = 2 : mid-latitude winter profile
  359. ! = 3 : sub-arctic summer profile
  360. ! = 4 : sub-arctic winter profile
  361. ! = 5 : tropical profile
  362. IF (abs(center_lat) .le. 30. ) THEN ! tropic
  363. iprof = 5
  364. ELSE
  365. IF (center_lat .gt. 0.) THEN
  366. IF (center_lat .gt. 60. ) THEN ! arctic
  367. IF (JULDAY .gt. is_summer .and. JULDAY .lt. ie_summer ) THEN
  368. ! arctic summer
  369. iprof = 3
  370. ELSE
  371. ! arctic winter
  372. iprof = 4
  373. ENDIF
  374. ELSE ! midlatitude
  375. IF (JULDAY .gt. is_summer .and. JULDAY .lt. ie_summer ) THEN
  376. ! north midlatitude summer
  377. iprof = 1
  378. ELSE
  379. ! north midlatitude winter
  380. iprof = 2
  381. ENDIF
  382. ENDIF
  383. ELSE
  384. IF (center_lat .lt. -60. ) THEN ! antarctic
  385. IF (JULDAY .lt. is_summer .or. JULDAY .gt. ie_summer ) THEN
  386. ! antarctic summer
  387. iprof = 3
  388. ELSE
  389. ! antarctic winter
  390. iprof = 4
  391. ENDIF
  392. ELSE ! midlatitude
  393. IF (JULDAY .lt. is_summer .or. JULDAY .gt. ie_summer ) THEN
  394. ! south midlatitude summer
  395. iprof = 1
  396. ELSE
  397. ! south midlatitude winter
  398. iprof = 2
  399. ENDIF
  400. ENDIF
  401. ENDIF
  402. ENDIF
  403. j_loop: DO J=jts,jte
  404. DO K=kts,kte
  405. DO I=its,ite
  406. cwc(i,k,1) = 0.
  407. cwc(i,k,2) = 0.
  408. ENDDO
  409. ENDDO
  410. DO K=1,np
  411. p(k)=pres(k,iprof)
  412. ENDDO
  413. ! reverse vars
  414. !
  415. DO K=kts,kte+1
  416. DO I=its,ite
  417. NK=kme-K+kms
  418. P8W2D(I,K)=p8w3d(i,nk,j)*0.01 ! P8w2D is in mb
  419. ENDDO
  420. ENDDO
  421. DO I=its,ite
  422. P8W2D(I,0)=.0
  423. ENDDO
  424. !
  425. DO K=kts,kte
  426. DO I=its,ite
  427. NK=kme-1-K+kms
  428. TTEN2D(I,K)=0.
  429. T2D(I,K)=T3D(I,NK,J)
  430. ! SH2D specific humidity
  431. SH2D(I,K)=QV3D(I,NK,J)/(1.+QV3D(I,NK,J))
  432. SH2D(I,K)=max(0.,SH2D(I,K))
  433. cwc(I,K,2)=QC3D(I,NK,J)
  434. cwc(I,K,2)=max(0.,cwc(I,K,2))
  435. P2D(I,K)=p3d(i,nk,j)*0.01 ! P2D is in mb
  436. fcld2D(I,K)=CLDFRA3D(I,NK,J)
  437. ENDDO
  438. ENDDO
  439. ! This logic is tortured because cannot test F_QI unless
  440. ! it is present, and order of evaluation of expressions
  441. ! is not specified in Fortran
  442. IF ( PRESENT ( F_QI ) ) THEN
  443. predicate = F_QI
  444. ELSE
  445. predicate = .FALSE.
  446. ENDIF
  447. IF (.NOT. warm_rain .AND. .NOT. predicate ) THEN
  448. DO K=kts,kte
  449. DO I=its,ite
  450. IF (T2D(I,K) .lt. 273.15) THEN
  451. cwc(I,K,1)=cwc(I,K,2)
  452. cwc(I,K,2)=0.
  453. ENDIF
  454. ENDDO
  455. ENDDO
  456. ENDIF
  457. IF ( PRESENT( F_QNDROP ) ) THEN
  458. IF ( F_QNDROP ) THEN
  459. DO K=kts,kte
  460. DO I=its,ite
  461. NK=kme-1-K+kms
  462. qndrop2d(I,K)=qndrop3d(I,NK,j)
  463. ENDDO
  464. ENDDO
  465. qndrop2d(:,kts-1)=0.
  466. END IF
  467. END IF
  468. DO I=its,ite
  469. TTEN2D(I,0)=0.
  470. T2D(I,0)=T2D(I,1)
  471. ! SH2D specific humidity
  472. SH2D(I,0)=0.5*SH2D(i,1)
  473. cwc(I,0,2)=0.
  474. cwc(I,0,1)=0.
  475. P2D(I,0)=0.5*(P8W2D(I,0)+P8W2D(I,1))
  476. fcld2D(I,0)=0.
  477. ENDDO
  478. !
  479. IF ( PRESENT( F_QI ) .AND. PRESENT( qi3d) ) THEN
  480. IF ( (F_QI) ) THEN
  481. DO K=kts,kte
  482. DO I=its,ite
  483. NK=kme-1-K+kms
  484. cwc(I,K,1)=QI3D(I,NK,J)
  485. cwc(I,K,1)=max(0.,cwc(I,K,1))
  486. ENDDO
  487. ENDDO
  488. ENDIF
  489. ENDIF
  490. !
  491. ! ... Vertical profiles for ozone
  492. !
  493. call o3prof (np, p, ozone(1,iprof), its, ite, kts-1, kte, P2D, O3)
  494. ! ... Vertical profiles for effective particle size
  495. !
  496. pi = 4.*atan(1.0)
  497. third=1./3.
  498. rhoh2o=1.e3
  499. relconst=3/(4.*pi*rhoh2o)
  500. ! minimun liquid water path to calculate rel
  501. ! corresponds to optical depth of 1.e-3 for radius 4 microns.
  502. lwpmin=3.e-5
  503. do k = kts-1, kte
  504. do i = its, ite
  505. reff(i,k,2) = 10.
  506. if( PRESENT( F_QNDROP ) ) then
  507. if( F_QNDROP ) then
  508. if ( cwc(i,k,2)*(P8W2D(I,K+1)-P8W2D(I,K)).gt.lwpmin.and. &
  509. qndrop2d(i,k).gt.1000. ) then
  510. reff(i,k,2)=(relconst*cwc(i,k,2)/qndrop2d(i,k))**third ! effective radius in m
  511. ! apply scaling from Martin et al., JAS 51, 1830.
  512. reff(i,k,2)=1.1*reff(i,k,2)
  513. reff(i,k,2)=reff(i,k,2)*1.e6 ! convert from m to microns
  514. reff(i,k,2)=max(reff(i,k,2),4.)
  515. reff(i,k,2)=min(reff(i,k,2),20.)
  516. end if
  517. end if
  518. end if
  519. reff(i,k,1) = 80.
  520. end do
  521. end do
  522. !
  523. ! ... Level indices separating high, middle and low clouds
  524. !
  525. do i = its, ite
  526. p400(i) = 1.e5
  527. p700(i) = 1.e5
  528. enddo
  529. do k = kts-1,kte+1
  530. do i = its, ite
  531. if (abs(P8W2D(i,k) - 400.) .lt. p400(i)) then
  532. p400(i) = abs(P8W2D(i,k) - 400.)
  533. ict(i) = k
  534. endif
  535. if (abs(P8W2D(i,k) - 700.) .lt. p700(i)) then
  536. p700(i) = abs(P8W2D(i,k) - 700.)
  537. icb(i) = k
  538. endif
  539. end do
  540. end do
  541. !wig beg
  542. ! ... Aerosol effects. Added aerosol feedbacks with MOSAIC, Dec. 2005.
  543. !
  544. do ib = 1, 11
  545. do k = kts-1,kte
  546. do i = its,ite
  547. taual(i,k,ib) = 0.
  548. ssaal(i,k,ib) = 0.
  549. asyal(i,k,ib) = 0.
  550. end do
  551. end do
  552. end do
  553. #ifdef WRF_CHEM
  554. IF ( AER_RA_FEEDBACK == 1) then
  555. !wig end
  556. do ib = 1, 11
  557. do k = kts-1,kte-1 !wig
  558. do i = its,ite
  559. ! taual(i,kte-k,ib) = 0.
  560. ! ssaal(i,kte-k,ib) = 0.
  561. ! asyal(i,kte-k,ib) = 0.
  562. !jcb beg
  563. ! convert optical properties at 300,400,600, and 999 to conform to the band wavelengths
  564. ! these are: 200,235,270,287.5,302.5,305,362.5,550,1920,1745,6135; why the emphasis on the UV?
  565. ! taual - use angstrom exponent
  566. if(tauaer300(i,k+1,j).gt.thresh .and. tauaer999(i,k+1,j).gt.thresh) then
  567. ang=log(tauaer300(i,k+1,j)/tauaer999(i,k+1,j))/log(999./300.)
  568. ! write(6,*)i,k,ang,tauaer300(i,k+1,j),tauaer999(i,k+1,j)
  569. taual(i,kte-k,ib)=tauaer400(i,k+1,j)*(0.4/midbands(ib))**ang ! notice reserved variable
  570. ! write(6,10001)i,k,ang,tauaer300(i,k+1,j),tauaer999(i,k+1,j),midbands(ib),taual(i,k,ib)
  571. !10001 format(i3,i3,5f12.6)
  572. ! ssa - linear interpolation; extrapolation
  573. slope=(waer600(i,k+1,j)-waer400(i,k+1,j))/.2
  574. ssaal(i,kte-k,ib) = slope*(midbands(ib)-.6)+waer600(i,k+1,j) ! notice reversed variables
  575. if(ssaal(i,kte-k,ib).lt.0.4) ssaal(i,kte-k,ib)=0.4
  576. if(ssaal(i,kte-k,ib).ge.1.0) ssaal(i,kte-k,ib)=1.0
  577. ! g - linear interpolation;extrapolation
  578. slope=(gaer600(i,k+1,j)-gaer400(i,k+1,j))/.2
  579. asyal(i,kte-k,ib) = slope*(midbands(ib)-.6)+gaer600(i,k+1,j) ! notice reversed varaibles
  580. if(asyal(i,kte-k,ib).lt.0.5) asyal(i,kte-k,ib)=0.5
  581. if(asyal(i,kte-k,ib).ge.1.0) asyal(i,kte-k,ib)=1.0
  582. endif
  583. !jcb end
  584. end do
  585. end do
  586. end do
  587. !wig beg
  588. do ib = 1, 11
  589. do i = its,ite
  590. slope = 0. !use slope as a sum holder
  591. do k = kts-1,kte
  592. slope = slope + taual(i,k,ib)
  593. end do
  594. if( slope < 0. ) then
  595. write(msg,'("ERROR: Negative total optical depth of ",f8.2," at point i,j,ib=",3i5)') slope,i,j,ib
  596. call wrf_error_fatal(msg)
  597. else if( slope > 5. ) then
  598. call wrf_message("-------------------------")
  599. write(msg,'("WARNING: Large total optical depth of ",f8.2," at point i,j,ib=",3i5)') slope,i,j,ib
  600. call wrf_message(msg)
  601. call wrf_message("Diagnostics 1: k, tauaer300, tauaer400, tauaer600, tauaer999")
  602. do k=kts,kte
  603. write(msg,'(i4,4f8.2)') k, tauaer300(i,k,j), tauaer400(i,k,j), &
  604. tauaer600(i,k,j), tauaer999(i,k,j)
  605. call wrf_message(msg)
  606. end do
  607. call wrf_message("Diagnostics 2: k, gaer300, gaer400, gaer600, gaer999")
  608. do k=kts,kte
  609. write(msg,'(i4,4f8.2)') k, gaer300(i,k,j), gaer400(i,k,j), &
  610. gaer600(i,k,j), gaer999(i,k,j)
  611. call wrf_message(msg)
  612. end do
  613. call wrf_message("Diagnostics 3: k, waer300, waer400, waer600, waer999")
  614. do k=kts,kte
  615. write(msg,'(i4,4f8.2)') k, waer300(i,k,j), waer400(i,k,j), &
  616. waer600(i,k,j), waer999(i,k,j)
  617. call wrf_message(msg)
  618. end do
  619. call wrf_message("Diagnostics 4: k, ssaal, asyal, taual")
  620. do k=kts-1,kte
  621. write(msg,'(i4,3f8.2)') k, ssaal(i,k,ib), asyal(i,k,ib), taual(i,k,ib)
  622. call wrf_message(msg)
  623. end do
  624. call wrf_message("-------------------------")
  625. end if
  626. end do
  627. end do
  628. !wig end
  629. endif
  630. #endif
  631. !
  632. ! ... Initialize output arrays
  633. !
  634. do ib = 1, 2
  635. do k = kts-1, kte
  636. do i = its, ite
  637. taucld(i,k,ib) = 0.
  638. end do
  639. end do
  640. end do
  641. !
  642. do k = kts-1,kte+1
  643. do i = its,ite
  644. flx(i,k) = 0.
  645. flxd(i,k) = 0.
  646. end do
  647. end do
  648. !
  649. ! ... Solar zenith angle
  650. !
  651. do i = its,ite
  652. xt24 = mod(xtime + radfrq * 0.5, 1440.)
  653. tloctm = GMT + xt24 / 60. + XLONG(i,j) / 15.
  654. hrang = 15. * (tloctm - 12.) * degrad
  655. xxlat = XLAT(i,j) * degrad
  656. cosz(i) = sin(xxlat) * sin(declin) + &
  657. cos(xxlat) * cos(declin) * cos(hrang)
  658. rsuvbm(i) = ALB(i,j)
  659. rsuvdf(i) = ALB(i,j)
  660. rsirbm(i) = ALB(i,j)
  661. rsirdf(i) = ALB(i,j)
  662. end do
  663. call sorad (mix,1,1,mkx+1,p8w2D,t2D,sh2D,o3, &
  664. overcast,cldwater,cwc,taucld,reff,fcld2D,ict,icb,&
  665. taual,ssaal,asyal, &
  666. cosz,rsuvbm,rsuvdf,rsirbm,rsirdf, &
  667. flx,flxd)
  668. !
  669. ! ... Convert the units of flx and flc from fraction to w/m^2
  670. !
  671. do k = kts, kte
  672. do i = its, ite
  673. nk=kme-1-k+kms
  674. if(present(taucldc)) taucldc(i,nk,j)=taucld(i,k,2)
  675. if(present(taucldi)) taucldi(i,nk,j)=taucld(i,k,1)
  676. enddo
  677. enddo
  678. do k = kts, kte+1
  679. do i = its, ite
  680. if (cosz(i) .lt. thresh) then
  681. flx(i,k) = 0.
  682. else
  683. flx(i,k) = flx(i,k) * SOLCON * cosz(i)
  684. endif
  685. end do
  686. end do
  687. !
  688. ! ... Calculate heating rate (deg/sec)
  689. !
  690. fac = .01 * g / Cp
  691. do k = kts, kte
  692. do i = its, ite
  693. if (cosz(i) .gt. thresh) then
  694. TTEN2D(i,k) = - fac * (flx(i,k) - flx(i,k+1))/ &
  695. (p8w2d(i,k)-p8w2d(i,k+1))
  696. endif
  697. end do
  698. end do
  699. ! upward top of atmosphere
  700. do i = its, ite
  701. if (cosz(i) .le. thresh) then
  702. RSWTOA(i,j) = 0.
  703. else
  704. RSWTOA(i,j) = flx(i,kts) - flxd(i,kts) * SOLCON * cosz(i)
  705. endif
  706. end do
  707. !
  708. ! ... Absorbed part in surface energy budget
  709. !
  710. do i = its, ite
  711. if (cosz(i) .le. thresh) then
  712. GSW(i,j) = 0.
  713. else
  714. GSW(i,j) = (1. - rsuvbm(i)) * flxd(i,kte+1) * SOLCON * cosz(i)
  715. endif
  716. end do
  717. DO K=kts,kte
  718. NK=kme-1-K+kms
  719. DO I=its,ite
  720. ! FIX FROM GODDARD FOR NEGATIVE VALUES
  721. TTEN2D(I,NK)=MAX(TTEN2D(I,NK),0.)
  722. RTHRATEN(I,K,J)=RTHRATEN(I,K,J)+TTEN2D(I,NK)/pi3D(I,K,J)
  723. ENDDO
  724. ENDDO
  725. !
  726. ENDDO j_loop
  727. END SUBROUTINE GSFCSWRAD
  728. !********************* Version Solar-6 (May 8, 1997) *****************
  729. subroutine sorad (m,n,ndim,np,pl,ta,wa,oa, &
  730. overcast,cldwater,cwc,taucld,reff,fcld,ict,icb, &
  731. taual,ssaal,asyal, &
  732. cosz,rsuvbm,rsuvdf,rsirbm,rsirdf, &
  733. flx,flxd)
  734. !************************************************************************
  735. !
  736. ! Version Solar-6 (May 8, 1997)
  737. !
  738. ! New feature of this version is:
  739. ! (1) An option is added for scaling the cloud optical thickness. If
  740. ! the fractional cloud cover, fcld, in an atmospheric model is alway
  741. ! either 1 or 0 (i.e. partly cloudy sky is not allowed), it does
  742. ! not require the scaling of cloud optical thickness, and the
  743. ! option "overcast" can be set to .true. Computation is faster
  744. ! with this option than with overcast=.false.
  745. !
  746. !**********************************************************************
  747. !
  748. ! Version Solar-5 (April 1997)
  749. !
  750. ! New features of this version are:
  751. ! (1) Cloud optical properties can be computed from cloud water/ice
  752. ! amount and the effective particle size.
  753. ! (2) Aerosol optical properties are functions of height and band.
  754. ! (3) A maximum-random cloud overlapping approximation is applied.
  755. !
  756. !*********************************************************************
  757. !
  758. ! This routine computes solar fluxes due to the absoption by water
  759. ! vapor, ozone, co2, o2, clouds, and aerosols and due to the
  760. ! scattering by clouds, aerosols, and gases.
  761. !
  762. ! The solar spectrum is divided into one UV+visible band and three IR
  763. ! bands separated by the wavelength 0.7 micron. The UV+visible band
  764. ! is further divided into eight sub-bands.
  765. !
  766. ! This is a vectorized code. It computes fluxes simultaneously for
  767. ! (m x n) soundings, which is a subset of (m x ndim) soundings.
  768. ! In a global climate model, m and ndim correspond to the numbers of
  769. ! grid boxes in the zonal and meridional directions, respectively.
  770. !
  771. ! Ice and liquid cloud particles are allowed to co-exist in a layer.
  772. !
  773. ! There is an option of providing either cloud ice/water mixing ratio
  774. ! (cwc) or thickness (taucld). If the former is provided, set
  775. ! cldwater=.true., and taucld will be computed from cwc and reff as a
  776. ! function of spectra band. Otherwise, set cldwater=.false., and
  777. ! specify taucld, independent of spectral band.
  778. !
  779. ! If no information is available for reff, a default value of
  780. ! 10 micron for liquid water and 75 micron for ice can be used.
  781. ! For a clear layer, reff can be set to any values except zero.
  782. !
  783. ! The maximum-random assumption is applied for treating cloud
  784. ! overlapping.
  785. ! Clouds are grouped into high, middle, and low clouds separated by
  786. ! the level indices ict and icb. For detail, see subroutine cldscale.
  787. !
  788. ! In a high spatial-resolution atmospheric model, fractional cloud cover
  789. ! might be computed to be either 0 or 1. In such a case, scaling of the
  790. ! cloud optical thickness is not necessary, and the computation can be
  791. ! made faster by setting overcast=.true. The option overcast=.false.
  792. ! can be applied to any values of the fractional cloud cover, but the
  793. ! computation is slower.
  794. !
  795. ! Aerosol optical thickness, single-scattering albaedo, and asymmtry
  796. ! factor can be specified as functions of height and spectral band.
  797. !
  798. !----- Input parameters:
  799. ! units size
  800. ! number of soundings in zonal direction (m) n/d 1
  801. ! number of soundings in meridional direction (n) n/d 1
  802. ! maximum number of soundings in n/d 1
  803. ! meridional direction (ndim>=n)
  804. ! number of atmospheric layers (np) n/d 1
  805. ! level pressure (pl) mb m*ndim*(np+1)
  806. ! layer temperature (ta) k m*ndim*np
  807. ! layer specific humidity (wa) gm/gm m*ndim*np
  808. ! layer ozone concentration (oa) gm/gm m*ndim*np
  809. ! co2 mixing ratio by volumn (co2) pppv 1
  810. ! option for scaling cloud optical thickness n/d 1
  811. ! overcast="true" if scaling is NOT required
  812. ! overcast="fasle" if scaling is required
  813. ! option for cloud optical thickness n/d 1
  814. ! cldwater="true" if cwc is provided
  815. ! cldwater="false" if taucld is provided
  816. ! cloud water mixing ratio (cwc) gm/gm m*ndim*np*2
  817. ! index 1 for ice particles
  818. ! index 2 for liquid drops
  819. ! cloud optical thickness (taucld) n/d m*ndim*np*2
  820. ! index 1 for ice particles
  821. ! index 2 for liquid drops
  822. ! effective cloud-particle size (reff) micrometer m*ndim*np*2
  823. ! index 1 for ice particles
  824. ! index 2 for liquid drops
  825. ! cloud amount (fcld) fraction m*ndim*np
  826. ! level index separating high and middle n/d 1
  827. ! clouds (ict)
  828. ! level index separating middle and low n/d 1
  829. ! clouds (icb)
  830. ! aerosol optical thickness (taual) n/d m*ndim*np*11
  831. ! aerosol single-scattering albedo (ssaal) n/d m*ndim*np*11
  832. ! aerosol asymmetry factor (asyal) n/d m*ndim*np*11
  833. ! in the uv region :
  834. ! index 1 for the 0.175-0.225 micron band
  835. ! index 2 for the 0.225-0.245; 0.260-0.280 micron band
  836. ! index 3 for the 0.245-0.260 micron band
  837. ! index 4 for the 0.280-0.295 micron band
  838. ! index 5 for the 0.295-0.310 micron band
  839. ! index 6 for the 0.310-0.320 micron band
  840. ! index 7 for the 0.325-0.400 micron band
  841. ! in the par region :
  842. ! index 8 for the 0.400-0.700 micron band
  843. ! in the infrared region :
  844. ! index 9 for the 0.700-1.220 micron band
  845. ! index 10 for the 1.220-2.270 micron band
  846. ! index 11 for the 2.270-10.00 micron band
  847. ! cosine of solar zenith angle (cosz) n/d m*ndim
  848. ! uv+visible sfc albedo for beam radiation
  849. ! for wavelengths<0.7 micron (rsuvbm) fraction m*ndim
  850. ! uv+visible sfc albedo for diffuse radiation
  851. ! for wavelengths<0.7 micron (rsuvdf) fraction m*ndim
  852. ! ir sfc albedo for beam radiation
  853. ! for wavelengths>0.7 micron (rsirbm) fraction m*ndim
  854. ! ir sfc albedo for diffuse radiation (rsirdf) fraction m*ndim
  855. !
  856. !----- Output parameters
  857. !
  858. ! all-sky flux (downward minus upward) (flx) fraction m*ndim*(np+1)
  859. ! clear-sky flux (downward minus upward) (flc) fraction m*ndim*(np+1)
  860. ! all-sky direct downward uv (0.175-0.4 micron)
  861. ! flux at the surface (fdiruv) fraction m*ndim
  862. ! all-sky diffuse downward uv flux at
  863. ! the surface (fdifuv) fraction m*ndim
  864. ! all-sky direct downward par (0.4-0.7 micron)
  865. ! flux at the surface (fdirpar) fraction m*ndim
  866. ! all-sky diffuse downward par flux at
  867. ! the surface (fdifpar) fraction m*ndim
  868. ! all-sky direct downward ir (0.7-10 micron)
  869. ! flux at the surface (fdirir) fraction m*ndim
  870. ! all-sky diffuse downward ir flux at
  871. ! the surface (fdifir) fraction m*ndim
  872. !
  873. !----- Notes:
  874. !
  875. ! (1) The unit of "flux" is fraction of the incoming solar radiation
  876. ! at the top of the atmosphere. Therefore, fluxes should
  877. ! be equal to "flux" multiplied by the extra-terrestrial solar
  878. ! flux and the cosine of solar zenith angle.
  879. ! (2) pl(i,j,1) is the pressure at the top of the model, and
  880. ! pl(i,j,np+1) is the surface pressure.
  881. ! (3) the pressure levels ict and icb correspond approximately
  882. ! to 400 and 700 mb.
  883. ! (4) if overcast='true', the clear-sky flux, flc, is not computed.
  884. !
  885. !**************************************************************************
  886. implicit none
  887. !**************************************************************************
  888. !-----input parameters
  889. integer m,n,ndim,np
  890. integer ict(m,ndim),icb(m,ndim)
  891. real pl(m,ndim,np+1),ta(m,ndim,np),wa(m,ndim,np),oa(m,ndim,np)
  892. real cwc(m,ndim,np,2),taucld(m,ndim,np,2),reff(m,ndim,np,2), &
  893. fcld(m,ndim,np)
  894. real taual(m,ndim,np,11),ssaal(m,ndim,np,11),asyal(m,ndim,np,11)
  895. real cosz(m,ndim),rsuvbm(m,ndim),rsuvdf(m,ndim), &
  896. rsirbm(m,ndim),rsirdf(m,ndim)
  897. logical overcast,cldwater
  898. !-----output parameters
  899. real flx(m,ndim,np+1),flc(m,ndim,np+1)
  900. real flxu(m,ndim,np+1),flxd(m,ndim,np+1)
  901. real fdiruv (m,ndim),fdifuv (m,ndim)
  902. real fdirpar(m,ndim),fdifpar(m,ndim)
  903. real fdirir (m,ndim),fdifir (m,ndim)
  904. !-----temporary array
  905. integer i,j,k
  906. real cwp(m,n,np,2)
  907. real dp(m,n,np),wh(m,n,np),oh(m,n,np),scal(m,n,np)
  908. real swh(m,n,np+1),so2(m,n,np+1),df(m,n,np+1)
  909. real sdf(m,n),sclr(m,n),csm(m,n),x
  910. do j= 1, n
  911. do i= 1, m
  912. if (pl(i,j,1) .eq. 0.0) then
  913. pl(i,j,1)=1.0e-4
  914. endif
  915. enddo
  916. enddo
  917. do j= 1, n
  918. do i= 1, m
  919. swh(i,j,1)=0.
  920. so2(i,j,1)=0.
  921. !-----csm is the effective secant of the solar zenith angle
  922. ! see equation (12) of Lacis and Hansen (1974, JAS)
  923. csm(i,j)=35./sqrt(1224.*cosz(i,j)*cosz(i,j)+1.)
  924. enddo
  925. enddo
  926. do k= 1, np
  927. do j= 1, n
  928. do i= 1, m
  929. !-----compute layer thickness and pressure-scaling function.
  930. ! indices for the surface level and surface layer
  931. ! are np+1 and np, respectively.
  932. dp(i,j,k)=pl(i,j,k+1)-pl(i,j,k)
  933. scal(i,j,k)=dp(i,j,k)*(.5*(pl(i,j,k)+pl(i,j,k+1))/300.)**.8
  934. !-----compute scaled water vapor amount, unit is g/cm**2
  935. ! note: the sign prior to the constant 0.00135 was incorrectly
  936. ! set to negative in the previous version
  937. wh(i,j,k)=1.02*wa(i,j,k)*scal(i,j,k)* &
  938. (1.+0.00135*(ta(i,j,k)-240.)) +1.e-11
  939. swh(i,j,k+1)=swh(i,j,k)+wh(i,j,k)
  940. !-----compute ozone amount, unit is (cm-atm)stp
  941. ! the number 466.7 is a conversion factor from g/cm**2 to (cm-atm)stp
  942. oh(i,j,k)=1.02*oa(i,j,k)*dp(i,j,k)*466.7 +1.e-11
  943. !-----compute layer cloud water amount (gm/m**2)
  944. ! the index is 1 for ice crystals and 2 for liquid drops
  945. cwp(i,j,k,1)=1.02*10000.*cwc(i,j,k,1)*dp(i,j,k)
  946. cwp(i,j,k,2)=1.02*10000.*cwc(i,j,k,2)*dp(i,j,k)
  947. enddo
  948. enddo
  949. enddo
  950. !-----initialize fluxes for all-sky (flx), clear-sky (flc), and
  951. ! flux reduction (df)
  952. do k=1, np+1
  953. do j=1, n
  954. do i=1, m
  955. flx(i,j,k)=0.
  956. flc(i,j,k)=0.
  957. flxu(i,j,k)=0.
  958. flxd(i,j,k)=0.
  959. df(i,j,k)=0.
  960. enddo
  961. enddo
  962. enddo
  963. !-----compute solar uv and par fluxes
  964. call soluv (m,n,ndim,np,oh,dp,overcast,cldwater, &
  965. cwp,taucld,reff,ict,icb,fcld,cosz, &
  966. taual,ssaal,asyal,csm,rsuvbm,rsuvdf, &
  967. flx,flc,flxu,flxd,fdiruv,fdifuv,fdirpar,fdifpar)
  968. !-----compute and update solar ir fluxes
  969. call solir (m,n,ndim,np,wh,overcast,cldwater, &
  970. cwp,taucld,reff,ict,icb,fcld,cosz, &
  971. taual,ssaal,asyal,csm,rsirbm,rsirdf, &
  972. flx,flc,flxu,flxd,fdirir,fdifir)
  973. !-----compute scaled o2 amount, unit is (cm-atm)stp.
  974. do k= 1, np
  975. do j= 1, n
  976. do i= 1, m
  977. so2(i,j,k+1)=so2(i,j,k)+165.22*scal(i,j,k)
  978. enddo
  979. enddo
  980. enddo
  981. !-----compute flux reduction due to oxygen following
  982. ! chou (J. climate, 1990). The fraction 0.0287 is the
  983. ! extraterrestrial solar flux in the o2 bands.
  984. do k= 2, np+1
  985. do j= 1, n
  986. do i= 1, m
  987. x=so2(i,j,k)*csm(i,j)
  988. df(i,j,k)=df(i,j,k)+0.0287*(1.-exp(-0.00027*sqrt(x)))
  989. enddo
  990. enddo
  991. enddo
  992. !-----compute scaled co2 amounts. unit is (cm-atm)stp.
  993. do k= 1, np
  994. do j= 1, n
  995. do i= 1, m
  996. so2(i,j,k+1)=so2(i,j,k)+co2*789.*scal(i,j,k)+1.e-11
  997. enddo
  998. enddo
  999. enddo
  1000. !-----compute and update flux reduction due to co2 following
  1001. ! chou (J. Climate, 1990)
  1002. call flxco2(m,n,np,so2,swh,csm,df)
  1003. !-----adjust for the effect of o2 cnd co2 on clear-sky fluxes.
  1004. do k= 2, np+1
  1005. do j= 1, n
  1006. do i= 1, m
  1007. flc(i,j,k)=flc(i,j,k)-df(i,j,k)
  1008. enddo
  1009. enddo
  1010. enddo
  1011. !-----adjust for the all-sky fluxes due to o2 and co2. It is
  1012. ! assumed that o2 and co2 have no effects on solar radiation
  1013. ! below clouds.
  1014. do j=1,n
  1015. do i=1,m
  1016. sdf(i,j)=0.0
  1017. sclr(i,j)=1.0
  1018. enddo
  1019. enddo
  1020. do k=1,np
  1021. do j=1,n
  1022. do i=1,m
  1023. !-----sclr is the fraction of clear sky.
  1024. ! sdf is the flux reduction below clouds.
  1025. if(fcld(i,j,k).gt.0.01) then
  1026. sdf(i,j)=sdf(i,j)+df(i,j,k)*sclr(i,j)*fcld(i,j,k)
  1027. sclr(i,j)=sclr(i,j)*(1.-fcld(i,j,k))
  1028. endif
  1029. flx(i,j,k+1)=flx(i,j,k+1)-sdf(i,j)-df(i,j,k+1)*sclr(i,j)
  1030. flxu(i,j,k+1)=flxu(i,j,k+1)-sdf(i,j)-df(i,j,k+1)*sclr(i,j)
  1031. flxd(i,j,k+1)=flxd(i,j,k+1)-sdf(i,j)-df(i,j,k+1)*sclr(i,j) ! SG: same as flux????
  1032. enddo
  1033. enddo
  1034. enddo
  1035. !-----adjustment for the direct downward ir flux.
  1036. do j= 1, n
  1037. do i= 1, m
  1038. flc(i,j,np+1)=flc(i,j,np+1)+df(i,j,np+1)*rsirbm(i,j)
  1039. flx(i,j,np+1)=flx(i,j,np+1)+(sdf(i,j)+ &
  1040. df(i,j,np+1)*sclr(i,j))*rsirbm(i,j)
  1041. flxu(i,j,np+1)=flxu(i,j,np+1)+(sdf(i,j)+ &
  1042. df(i,j,np+1)*sclr(i,j))*rsirbm(i,j)
  1043. flxd(i,j,np+1)=flxd(i,j,np+1)+(sdf(i,j)+ &
  1044. df(i,j,np+1)*sclr(i,j))*rsirbm(i,j)
  1045. fdirir(i,j)=fdirir(i,j)-(sdf(i,j)+df(i,j,np+1)*sclr(i,j))
  1046. enddo
  1047. enddo
  1048. end subroutine sorad
  1049. !************************************************************************
  1050. subroutine soluv (m,n,ndim,np,oh,dp,overcast,cldwater, &
  1051. cwp,taucld,reff,ict,icb,fcld,cosz, &
  1052. taual,ssaal,asyal,csm,rsuvbm,rsuvdf, &
  1053. flx,flc,flxu,flxd,fdiruv,fdifuv,fdirpar,fdifpar)
  1054. !************************************************************************
  1055. ! compute solar fluxes in the uv+par region. the spectrum is
  1056. ! grouped into 8 bands:
  1057. !
  1058. ! Band Micrometer
  1059. !
  1060. ! UV-C 1. .175 - .225
  1061. ! 2. .225 - .245
  1062. ! .260 - .280
  1063. ! 3. .245 - .260
  1064. !
  1065. ! UV-B 4. .280 - .295
  1066. ! 5. .295 - .310
  1067. ! 6. .310 - .320
  1068. !
  1069. ! UV-A 7. .320 - .400
  1070. !
  1071. ! PAR 8. .400 - .700
  1072. !
  1073. !----- Input parameters: units size
  1074. !
  1075. ! number of soundings in zonal direction (m) n/d 1
  1076. ! number of soundings in meridional direction (n) n/d 1
  1077. ! maximum number of soundings in n/d 1
  1078. ! meridional direction (ndim)
  1079. ! number of atmospheric layers (np) n/d 1
  1080. ! layer ozone content (oh) (cm-atm)stp m*n*np
  1081. ! layer pressure thickness (dp) mb m*n*np
  1082. ! option for scaling cloud optical thickness n/d 1
  1083. ! overcast="true" if scaling is NOT required
  1084. ! overcast="fasle" if scaling is required
  1085. ! input option for cloud optical thickness n/d 1
  1086. ! cldwater="true" if taucld is provided
  1087. ! cldwater="false" if cwp is provided
  1088. ! cloud water amount (cwp) gm/m**2 m*n*np*2
  1089. ! index 1 for ice particles
  1090. ! index 2 for liquid drops
  1091. ! cloud optical thickness (taucld) n/d m*ndim*np*2
  1092. ! index 1 for ice paticles
  1093. ! index 2 for liquid particles
  1094. ! effective cloud-particle size (reff) micrometer m*ndim*np*2
  1095. ! index 1 for ice paticles
  1096. ! index 2 for liquid particles
  1097. ! level indiex separating high and n/d m*n
  1098. ! middle clouds (ict)
  1099. ! level indiex separating middle and n/d m*n
  1100. ! low clouds (icb)
  1101. ! cloud amount (fcld) fraction m*ndim*np
  1102. ! cosine of solar zenith angle (cosz) n/d m*ndim
  1103. ! aerosol optical thickness (taual) n/d m*ndim*np*11
  1104. ! aerosol single-scattering albedo (ssaal) n/d m*ndim*np*11
  1105. ! aerosol asymmetry factor (asyal) n/d m*ndim*np*11
  1106. ! cosecant of the solar zenith angle (csm) n/d m*n
  1107. ! uv+par surface albedo for beam fraction m*ndim
  1108. ! radiation (rsuvbm)
  1109. ! uv+par surface albedo for diffuse fraction m*ndim
  1110. ! radiation (rsuvdf)
  1111. !
  1112. !---- temporary array
  1113. !
  1114. ! scaled cloud optical thickness n/d m*n*np
  1115. ! for beam radiation (tauclb)
  1116. ! scaled cloud optical thickness n/d m*n*np
  1117. ! for diffuse radiation (tauclf)
  1118. !
  1119. !----- output (updated) parameters:
  1120. !
  1121. ! all-sky net downward flux (flx) fraction m*ndim*(np+1)
  1122. ! cl

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