PageRenderTime 363ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 1ms

/wrfv2_fire/phys/module_sf_bep.F

http://github.com/jbeezley/wrf-fire
FORTRAN Legacy | 3239 lines | 1873 code | 634 blank | 732 comment | 38 complexity | 0c3989f4b2ba6aaa590bea8e69427a24 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. MODULE module_sf_bep
  2. !USE module_model_constants
  3. USE module_sf_urban
  4. ! SGClarke 09/11/2008
  5. ! Access urban_param.tbl values through calling urban_param_init in module_physics_init
  6. ! for CASE (BEPSCHEME) select sf_urban_physics
  7. !
  8. ! -----------------------------------------------------------------------
  9. ! Dimension for the array used in the BEP module
  10. ! -----------------------------------------------------------------------
  11. integer nurbm ! Maximum number of urban classes
  12. parameter (nurbm=3)
  13. integer ndm ! Maximum number of street directions
  14. parameter (ndm=2)
  15. integer nz_um ! Maximum number of vertical levels in the urban grid
  16. parameter(nz_um=13)
  17. integer ng_u ! Number of grid levels in the ground
  18. parameter (ng_u=10)
  19. integer nwr_u ! Number of grid levels in the walls or roofs
  20. parameter (nwr_u=10)
  21. real dz_u ! Urban grid resolution
  22. parameter (dz_u=5.)
  23. ! The change of ng_u, nwr_u should be done in agreement with the block data
  24. ! in the routine "surf_temp"
  25. ! -----------------------------------------------------------------------
  26. ! Constant used in the BEP module
  27. ! -----------------------------------------------------------------------
  28. real vk ! von Karman constant
  29. real g_u ! Gravity acceleration
  30. real pi !
  31. real r ! Perfect gas constant
  32. real cp_u ! Specific heat at constant pressure
  33. real rcp_u !
  34. real sigma !
  35. real p0 ! Reference pressure at the sea level
  36. real cdrag ! Drag force constant
  37. parameter(vk=0.40,g_u=9.81,pi=3.141592653,r=287.,cp_u=1004.)
  38. parameter(rcp_u=r/cp_u,sigma=5.67e-08,p0=1.e+5,cdrag=0.4)
  39. ! -----------------------------------------------------------------------
  40. CONTAINS
  41. subroutine BEP(FRC_URB2D,UTYPE_URB2D,itimestep,dz8w,dt,u_phy,v_phy, &
  42. th_phy,rho,p_phy,swdown,glw, &
  43. gmt,julday,xlong,xlat, &
  44. declin_urb,cosz_urb2d,omg_urb2d, &
  45. num_urban_layers, &
  46. trb_urb4d,tw1_urb4d,tw2_urb4d,tgb_urb4d, &
  47. sfw1_urb3d,sfw2_urb3d,sfr_urb3d,sfg_urb3d, &
  48. a_u,a_v,a_t,a_e,b_u,b_v, &
  49. b_t,b_e,dlg,dl_u,sf,vl, &
  50. rl_up,rs_abs,emiss,grdflx_urb, &
  51. ids,ide, jds,jde, kds,kde, &
  52. ims,ime, jms,jme, kms,kme, &
  53. its,ite, jts,jte, kts,kte)
  54. implicit none
  55. !------------------------------------------------------------------------
  56. ! Input
  57. !------------------------------------------------------------------------
  58. INTEGER :: ids,ide, jds,jde, kds,kde, &
  59. ims,ime, jms,jme, kms,kme, &
  60. its,ite, jts,jte, kts,kte, &
  61. itimestep
  62. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: DZ8W
  63. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: P_PHY
  64. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: RHO
  65. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: TH_PHY
  66. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: T_PHY
  67. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: U_PHY
  68. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: V_PHY
  69. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: U
  70. REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: V
  71. REAL, DIMENSION( ims:ime , jms:jme ) :: GLW
  72. REAL, DIMENSION( ims:ime , jms:jme ) :: swdown
  73. REAL, DIMENSION( ims:ime, jms:jme ) :: UST
  74. INTEGER, DIMENSION( ims:ime , jms:jme ), INTENT(IN ):: UTYPE_URB2D
  75. REAL, DIMENSION( ims:ime , jms:jme ), INTENT(IN ):: FRC_URB2D
  76. REAL, INTENT(IN ) :: GMT
  77. INTEGER, INTENT(IN ) :: JULDAY
  78. REAL, DIMENSION( ims:ime, jms:jme ), &
  79. INTENT(IN ) :: XLAT, XLONG
  80. REAL, INTENT(IN) :: DECLIN_URB
  81. REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: COSZ_URB2D
  82. REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: OMG_URB2D
  83. INTEGER, INTENT(IN ) :: num_urban_layers
  84. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: trb_urb4d
  85. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: tw1_urb4d
  86. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: tw2_urb4d
  87. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: tgb_urb4d
  88. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: sfw1_urb3d
  89. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: sfw2_urb3d
  90. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: sfr_urb3d
  91. REAL, DIMENSION( ims:ime, 1:num_urban_layers, jms:jme ), INTENT(INOUT) :: sfg_urb3d
  92. ! integer nx,ny,nz ! Number of points in the mesocsale grid
  93. real z(ims:ime,kms:kme,jms:jme) ! Vertical coordinates
  94. REAL, INTENT(IN ):: DT ! Time step
  95. ! real zr(ims:ime,jms:jme) ! Solar zenith angle
  96. ! real deltar(ims:ime,jms:jme) ! Declination of the sun
  97. ! real ah(ims:ime,jms:jme) ! Hour angle
  98. ! real rs(ims:ime,jms:jme) ! Solar radiation
  99. !------------------------------------------------------------------------
  100. ! Output
  101. !------------------------------------------------------------------------
  102. ! real tsk(ims:ime,jms:jme) ! Average of surface temperatures (roads and roofs)
  103. !
  104. ! Implicit and explicit components of the source and sink terms at each levels,
  105. ! the fluxes can be computed as follow: FX = A*X + B example: t_fluxes = a_t * pt + b_t
  106. real a_u(ims:ime,kms:kme,jms:jme) ! Implicit component for the momemtum in X-direction (center)
  107. real a_v(ims:ime,kms:kme,jms:jme) ! Implicit component for the momemtum in Y-direction (center)
  108. real a_t(ims:ime,kms:kme,jms:jme) ! Implicit component for the temperature
  109. real a_e(ims:ime,kms:kme,jms:jme) ! Implicit component for the TKE
  110. real b_u(ims:ime,kms:kme,jms:jme) ! Explicit component for the momemtum in X-direction (center)
  111. real b_v(ims:ime,kms:kme,jms:jme) ! Explicit component for the momemtum in Y-direction (center)
  112. real b_t(ims:ime,kms:kme,jms:jme) ! Explicit component for the temperature
  113. real b_e(ims:ime,kms:kme,jms:jme) ! Explicit component for the TKE
  114. real dlg(ims:ime,kms:kme,jms:jme) ! Height above ground (L_ground in formula (24) of the BLM paper).
  115. real dl_u(ims:ime,kms:kme,jms:jme) ! Length scale (lb in formula (22) ofthe BLM paper).
  116. ! urban surface and volumes
  117. real sf(ims:ime,kms:kme,jms:jme) ! surface of the urban grid cells
  118. real vl(ims:ime,kms:kme,jms:jme) ! volume of the urban grid cells
  119. ! urban fluxes
  120. real rl_up(ims:ime,jms:jme) ! upward long wave radiation
  121. real rs_abs(ims:ime,jms:jme) ! absorbed short wave radiation
  122. real emiss(ims:ime,jms:jme) ! emissivity averaged for urban surfaces
  123. real grdflx_urb(ims:ime,jms:jme) ! ground heat flux for urban areas
  124. !------------------------------------------------------------------------
  125. ! Local
  126. !------------------------------------------------------------------------
  127. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  128. ! Building parameters
  129. real alag_u(nurbm) ! Ground thermal diffusivity [m^2 s^-1]
  130. real alaw_u(nurbm) ! Wall thermal diffusivity [m^2 s^-1]
  131. real alar_u(nurbm) ! Roof thermal diffusivity [m^2 s^-1]
  132. real csg_u(nurbm) ! Specific heat of the ground material [J m^3 K^-1]
  133. real csw_u(nurbm) ! Specific heat of the wall material [J m^3 K^-1]
  134. real csr_u(nurbm) ! Specific heat of the roof material [J m^3 K^-1]
  135. real twini_u(nurbm) ! Initial temperature inside the building's wall [K]
  136. real trini_u(nurbm) ! Initial temperature inside the building's roof [K]
  137. real tgini_u(nurbm) ! Initial road temperature
  138. !
  139. ! for twini_u, and trini_u the initial value at the deepest level is kept constant during the simulation
  140. !
  141. ! Radiation paramters
  142. real albg_u(nurbm) ! Albedo of the ground
  143. real albw_u(nurbm) ! Albedo of the wall
  144. real albr_u(nurbm) ! Albedo of the roof
  145. real emg_u(nurbm) ! Emissivity of ground
  146. real emw_u(nurbm) ! Emissivity of wall
  147. real emr_u(nurbm) ! Emissivity of roof
  148. ! fww,fwg,fgw,fsw,fsg are the view factors used to compute the long wave
  149. ! and the short wave radation.
  150. real fww(nz_um,nz_um,ndm,nurbm) ! from wall to wall
  151. real fwg(nz_um,ndm,nurbm) ! from wall to ground
  152. real fgw(nz_um,ndm,nurbm) ! from ground to wall
  153. real fsw(nz_um,ndm,nurbm) ! from sky to wall
  154. real fws(nz_um,ndm,nurbm) ! from sky to wall
  155. real fsg(ndm,nurbm) ! from sky to ground
  156. ! Roughness parameters
  157. real z0g_u(nurbm) ! The ground's roughness length
  158. real z0r_u(nurbm) ! The roof's roughness length
  159. ! Street parameters
  160. integer nd_u(nurbm) ! Number of street direction for each urban class
  161. real strd_u(ndm,nurbm) ! Street length (fix to greater value to the horizontal length of the cells)
  162. real drst_u(ndm,nurbm) ! Street direction
  163. real ws_u(ndm,nurbm) ! Street width
  164. real bs_u(ndm,nurbm) ! Building width
  165. real h_b(nz_um,nurbm) ! Bulding's heights
  166. real d_b(nz_um,nurbm) ! Probability that a building has an height h_b
  167. real ss_u(nz_um,nurbm) ! Probability that a building has an height equal to z
  168. real pb_u(nz_um,nurbm) ! Probability that a building has an height greater or equal to z
  169. ! Grid parameters
  170. integer nz_u(nurbm) ! Number of layer in the urban grid
  171. real z_u(nz_um) ! Height of the urban grid levels
  172. ! 1D array used for the input and output of the routine "urban"
  173. real z1D(kms:kme) ! vertical coordinates
  174. real ua1D(kms:kme) ! wind speed in the x directions
  175. real va1D(kms:kme) ! wind speed in the y directions
  176. real pt1D(kms:kme) ! potential temperature
  177. real da1D(kms:kme) ! air density
  178. real pr1D(kms:kme) ! air pressure
  179. real pt01D(kms:kme) ! reference potential temperature
  180. real zr1D ! zenith angle
  181. real deltar1D ! declination of the sun
  182. real ah1D ! hour angle (it should come from the radiation routine)
  183. real rs1D ! solar radiation
  184. real rld1D ! downward flux of the longwave radiation
  185. real tw1D(2*ndm,nz_um,nwr_u) ! temperature in each layer of the wall
  186. real tg1D(ndm,ng_u) ! temperature in each layer of the ground
  187. real tr1D(ndm,nz_um,nwr_u) ! temperature in each layer of the roof
  188. real sfw1D(2*ndm,nz_um) ! sensible heat flux from walls
  189. real sfg1D(ndm) ! sensible heat flux from ground (road)
  190. real sfr1D(ndm,nz_um) ! sensible heat flux from roofs
  191. real sf1D(kms:kme) ! surface of the urban grid cells
  192. real vl1D(kms:kme) ! volume of the urban grid cells
  193. real a_u1D(kms:kme) ! Implicit component of the momentum sources or sinks in the X-direction
  194. real a_v1D(kms:kme) ! Implicit component of the momentum sources or sinks in the Y-direction
  195. real a_t1D(kms:kme) ! Implicit component of the heat sources or sinks
  196. real a_e1D(kms:kme) ! Implicit component of the TKE sources or sinks
  197. real b_u1D(kms:kme) ! Explicit component of the momentum sources or sinks in the X-direction
  198. real b_v1D(kms:kme) ! Explicit component of the momentum sources or sinks in the Y-direction
  199. real b_t1D(kms:kme) ! Explicit component of the heat sources or sinks
  200. real b_e1D(kms:kme) ! Explicit component of the TKE sources or sinks
  201. real dlg1D(kms:kme) ! Height above ground (L_ground in formula (24) of the BLM paper).
  202. real dl_u1D(kms:kme) ! Length scale (lb in formula (22) ofthe BLM paper)
  203. real tsk1D ! Average of the road surface temperatures
  204. real time_bep
  205. ! arrays used to collapse indexes
  206. integer ind_zwd(nz_um,nwr_u,ndm)
  207. integer ind_gd(ng_u,ndm)
  208. integer ind_zd(nz_um,ndm)
  209. !
  210. integer ix,iy,iz,iurb,id,iz_u,iw,ig,ir,ix1,iy1,k
  211. integer it, nint
  212. integer iii
  213. real time_h,tempo,shtot
  214. logical first
  215. character(len=80) :: text
  216. data first/.true./
  217. save first,time_bep
  218. save alag_u,alaw_u,alar_u,csg_u,csw_u,csr_u, &
  219. albg_u,albw_u,albr_u,emg_u,emw_u,emr_u,fww,fwg,fgw,fsw,fws,fsg, &
  220. z0g_u,z0r_u, nd_u,strd_u,drst_u,ws_u,bs_u,h_b,d_b,ss_u,pb_u, &
  221. nz_u,z_u
  222. !------------------------------------------------------------------------
  223. ! Calculation of the momentum, heat and turbulent kinetic fluxes
  224. ! produced by buildings
  225. !
  226. ! Reference:
  227. ! Martilli, A., Clappier, A., Rotach, M.W.:2002, 'AN URBAN SURFACE EXCHANGE
  228. ! PARAMETERISATION FOR MESOSCALE MODELS', Boundary-Layer Meteorolgy 104:
  229. ! 261-304
  230. !------------------------------------------------------------------------
  231. !prepare the arrays to collapse indexes
  232. if(num_urban_layers.lt.nz_um*ndm*nwr_u)then
  233. write(*,*)'num_urban_layers too small, please increase to at least ', nz_um*ndm*nwr_u
  234. stop
  235. endif
  236. iii=0
  237. do iz_u=1,nz_um
  238. do iw=1,nwr_u
  239. do id=1,ndm
  240. iii=iii+1
  241. ind_zwd(iz_u,iw,id)=iii
  242. enddo
  243. enddo
  244. enddo
  245. iii=0
  246. do ig=1,ng_u
  247. do id=1,ndm
  248. iii=iii+1
  249. ind_gd(ig,id)=iii
  250. enddo
  251. enddo
  252. iii=0
  253. do iz_u=1,nz_um
  254. do id=1,ndm
  255. iii=iii+1
  256. ind_zd(iz_u,id)=iii
  257. enddo
  258. enddo
  259. do ix=its,ite
  260. do iy=jts,jte
  261. z(ix,kts,iy)=0.
  262. do iz=kts+1,kte+1
  263. z(ix,iz,iy)=z(ix,iz-1,iy)+dz8w(ix,iz-1,iy)
  264. enddo
  265. enddo
  266. enddo
  267. if (first) then ! True only on first call
  268. call init_para(alag_u,alaw_u,alar_u,csg_u,csw_u,csr_u,&
  269. twini_u,trini_u,tgini_u,albg_u,albw_u,albr_u,emg_u,emw_u,&
  270. emr_u,z0g_u,z0r_u,nd_u,strd_u,drst_u,ws_u,bs_u,h_b,d_b)
  271. ! Initialisation of the urban parameters and calculation of the view factors
  272. call icBEP(alag_u,alaw_u,alar_u,csg_u,csw_u,csr_u, &
  273. albg_u,albw_u,albr_u,emg_u,emw_u,emr_u, &
  274. fww,fwg,fgw,fsw,fws,fsg, &
  275. z0g_u,z0r_u, &
  276. nd_u,strd_u,drst_u,ws_u,bs_u,h_b,d_b,ss_u,pb_u, &
  277. nz_u,z_u, &
  278. twini_u,trini_u)
  279. first=.false.
  280. endif ! first
  281. do ix=its,ite
  282. do iy=jts,jte
  283. if (FRC_URB2D(ix,iy).gt.0.) then ! Calling BEP only for existing urban classes.
  284. iurb=UTYPE_URB2D(ix,iy)
  285. do iz= kts,kte
  286. ua1D(iz)=u_phy(ix,iz,iy)
  287. va1D(iz)=v_phy(ix,iz,iy)
  288. pt1D(iz)=th_phy(ix,iz,iy)
  289. da1D(iz)=rho(ix,iz,iy)
  290. pr1D(iz)=p_phy(ix,iz,iy)
  291. ! pt01D(iz)=th_phy(ix,iz,iy)
  292. pt01D(iz)=300.
  293. z1D(iz)=z(ix,iz,iy)
  294. a_u1D(iz)=0.
  295. a_v1D(iz)=0.
  296. a_t1D(iz)=0.
  297. a_e1D(iz)=0.
  298. b_u1D(iz)=0.
  299. b_v1D(iz)=0.
  300. b_t1D(iz)=0.
  301. b_e1D(iz)=0.
  302. enddo
  303. z1D(kte+1)=z(ix,kte+1,iy)
  304. do id=1,ndm
  305. do iz_u=1,nz_um
  306. do iw=1,nwr_u
  307. ! tw1D(2*id-1,iz_u,iw)=tw1_u(ix,iy,ind_zwd(iz_u,iw,id))
  308. ! tw1D(2*id,iz_u,iw)=tw2_u(ix,iy,ind_zwd(iz_u,iw,id))
  309. if(ind_zwd(iz_u,iw,id).gt.num_urban_layers)write(*,*)'ind_zwd too big w',ind_zwd(iz_u,iw,id)
  310. tw1D(2*id-1,iz_u,iw)=tw1_urb4d(ix,ind_zwd(iz_u,iw,id),iy)
  311. tw1D(2*id,iz_u,iw)=tw2_urb4d(ix,ind_zwd(iz_u,iw,id),iy)
  312. enddo
  313. enddo
  314. enddo
  315. do id=1,ndm
  316. do ig=1,ng_u
  317. ! tg1D(id,ig)=tg_u(ix,iy,ind_gd(ig,id))
  318. tg1D(id,ig)=tgb_urb4d(ix,ind_gd(ig,id),iy)
  319. enddo
  320. do iz_u=1,nz_um
  321. do ir=1,nwr_u
  322. ! tr1D(id,iz_u,ir)=tr_u(ix,iy,ind_zwd(iz_u,ir,id))
  323. if(ind_zwd(iz_u,ir,id).gt.num_urban_layers)write(*,*)'ind_zwd too big r',ind_zwd(iz_u,ir,id)
  324. tr1D(id,iz_u,ir)=trb_urb4d(ix,ind_zwd(iz_u,ir,id),iy)
  325. enddo
  326. enddo
  327. enddo
  328. do id=1,ndm
  329. do iz=1,nz_um
  330. ! sfw1D(2*id-1,iz)=sfw1(ix,iy,ind_zd(iz,id))
  331. ! sfw1D(2*id,iz)=sfw2(ix,iy,ind_zd(iz,id))
  332. sfw1D(2*id-1,iz)=sfw1_urb3d(ix,ind_zd(iz,id),iy)
  333. sfw1D(2*id,iz)=sfw2_urb3d(ix,ind_zd(iz,id),iy)
  334. enddo
  335. enddo
  336. do id=1,ndm
  337. ! sfg1D(id)=sfg(ix,iy,id)
  338. sfg1D(id)=sfg_urb3d(ix,id,iy)
  339. enddo
  340. do id=1,ndm
  341. do iz=1,nz_um
  342. ! sfr1D(id,iz)=sfr(ix,iy,ind_zd(iz,id))
  343. sfr1D(id,iz)=sfr_urb3d(ix,ind_zd(iz,id),iy)
  344. enddo
  345. enddo
  346. rs1D=swdown(ix,iy)
  347. rld1D=glw(ix,iy)
  348. time_h=(itimestep*dt)/3600.+gmt
  349. zr1D=acos(COSZ_URB2D(ix,iy))
  350. deltar1D=DECLIN_URB
  351. ah1D=OMG_URB2D(ix,iy)
  352. ! call angle(xlong(ix,iy),xlat(ix,iy),julday,time_h,zr1D,deltar1D,ah1D)
  353. call BEP1D(iurb,kms,kme,kts,kte,z1D,dt,ua1D,va1D,pt1D,da1D,pr1D,pt01D, &
  354. zr1D,deltar1D,ah1D,rs1D,rld1D, &
  355. alag_u,alaw_u,alar_u,csg_u,csw_u,csr_u, &
  356. albg_u,albw_u,albr_u,emg_u,emw_u,emr_u, &
  357. fww,fwg,fgw,fsw,fws,fsg, &
  358. z0g_u,z0r_u, &
  359. nd_u,strd_u,drst_u,ws_u,bs_u,h_b,d_b,ss_u,pb_u, &
  360. nz_u,z_u, &
  361. tw1D,tg1D,tr1D,sfw1D,sfg1D,sfr1D, &
  362. a_u1D,a_v1D,a_t1D,a_e1D, &
  363. b_u1D,b_v1D,b_t1D,b_e1D, &
  364. dlg1D,dl_u1D,tsk1D,sf1D,vl1D,rl_up(ix,iy), &
  365. rs_abs(ix,iy),emiss(ix,iy),grdflx_urb(ix,iy))
  366. do id=1,ndm
  367. do iz=1,nz_um
  368. sfw1_urb3d(ix,ind_zd(iz,id),iy)=sfw1D(2*id-1,iz)
  369. sfw2_urb3d(ix,ind_zd(iz,id),iy)=sfw1D(2*id,iz)
  370. enddo
  371. enddo
  372. do id=1,ndm
  373. sfg_urb3d(ix,id,iy)=sfg1D(id)
  374. enddo
  375. do id=1,ndm
  376. do iz=1,nz_um
  377. sfr_urb3d(ix,ind_zd(iz,id),iy)=sfr1D(id,iz)
  378. enddo
  379. enddo
  380. !
  381. do id=1,ndm
  382. do iz_u=1,nz_um
  383. do iw=1,nwr_u
  384. tw1_urb4d(ix,ind_zwd(iz_u,iw,id),iy)=tw1D(2*id-1,iz_u,iw)
  385. tw2_urb4d(ix,ind_zwd(iz_u,iw,id),iy)=tw1D(2*id,iz_u,iw)
  386. enddo
  387. enddo
  388. enddo
  389. do id=1,ndm
  390. do ig=1,ng_u
  391. tgb_urb4d(ix,ind_gd(ig,id),iy)=tg1D(id,ig)
  392. enddo
  393. do iz_u=1,nz_um
  394. do ir=1,nwr_u
  395. trb_urb4d(ix,ind_zwd(iz_u,ir,id),iy)=tr1D(id,iz_u,ir)
  396. enddo
  397. enddo
  398. enddo
  399. do iz= kts,kte
  400. sf(ix,iz,iy)=sf1D(iz)
  401. vl(ix,iz,iy)=vl1D(iz)
  402. a_u(ix,iz,iy)=a_u1D(iz)
  403. a_v(ix,iz,iy)=a_v1D(iz)
  404. a_t(ix,iz,iy)=a_t1D(iz)
  405. a_e(ix,iz,iy)=a_e1D(iz)
  406. b_u(ix,iz,iy)=b_u1D(iz)
  407. b_v(ix,iz,iy)=b_v1D(iz)
  408. b_t(ix,iz,iy)=b_t1D(iz)
  409. b_e(ix,iz,iy)=b_e1D(iz)
  410. dlg(ix,iz,iy)=dlg1D(iz)
  411. dl_u(ix,iz,iy)=dl_u1D(iz)
  412. enddo
  413. sf(ix,kte+1,iy)=sf1D(kte+1)
  414. ! tsk(ix,iy)=tsk1D
  415. !
  416. endif ! FRC_URB2D
  417. enddo ! iy
  418. enddo ! ix
  419. time_bep=time_bep+dt
  420. return
  421. end subroutine BEP
  422. ! ===6=8===============================================================72
  423. subroutine BEP1D(iurb,kms,kme,kts,kte,z,dt,ua,va,pt,da,pr,pt0, &
  424. zr,deltar,ah,rs,rld, &
  425. alag_u,alaw_u,alar_u,csg_u,csw_u,csr_u, &
  426. albg_u,albw_u,albr_u,emg_u,emw_u,emr_u, &
  427. fww,fwg,fgw,fsw,fws,fsg, &
  428. z0g_u,z0r_u, &
  429. nd_u,strd_u,drst_u,ws_u,bs_u,h_b,d_b,ss_u,pb_u, &
  430. nz_u,z_u, &
  431. tw,tg,tr,sfw,sfg,sfr, &
  432. a_u,a_v,a_t,a_e, &
  433. b_u,b_v,b_t,b_e, &
  434. dlg,dl_u,tsk,sf,vl,rl_up,rs_abs,emiss,grdflx_urb)
  435. ! ----------------------------------------------------------------------
  436. ! This routine computes the effects of buildings on momentum, heat and
  437. ! TKE (turbulent kinetic energy) sources or sinks and on the mixing length.
  438. ! It provides momentum, heat and TKE sources or sinks at different levels of a
  439. ! mesoscale grid defined by the altitude of its cell interfaces "z" and
  440. ! its number of levels "nz".
  441. ! The meteorological input parameters (wind, temperature, solar radiation)
  442. ! are specified on the "mesoscale grid".
  443. ! The inputs concerning the building and street charateristics are defined
  444. ! on a "urban grid". The "urban grid" is defined with its number of levels
  445. ! "nz_u" and its space step "dz_u".
  446. ! The input parameters are interpolated on the "urban grid". The sources or sinks
  447. ! are calculated on the "urban grid". Finally the sources or sinks are
  448. ! interpolated on the "mesoscale grid".
  449. ! Mesoscale grid Urban grid Mesoscale grid
  450. !
  451. ! z(4) --- ---
  452. ! | |
  453. ! | |
  454. ! | Interpolation Interpolation |
  455. ! | Sources or sinks calculation |
  456. ! z(3) --- ---
  457. ! | ua ua_u --- uv_a a_u |
  458. ! | va va_u | uv_b b_u |
  459. ! | pt pt_u --- uh_b a_v |
  460. ! z(2) --- | etc... etc...---
  461. ! | z_u(1) --- |
  462. ! | | |
  463. ! z(1) ------------------------------------------------------------
  464. !
  465. ! Reference:
  466. ! Martilli, A., Clappier, A., Rotach, M.W.:2002, 'AN URBAN SURFACE EXCHANGE
  467. ! PARAMETERISATION FOR MESOSCALE MODELS', Boundary-Layer Meteorolgy 104:
  468. ! 261-304
  469. ! ----------------------------------------------------------------------
  470. implicit none
  471. ! ----------------------------------------------------------------------
  472. ! INPUT:
  473. ! ----------------------------------------------------------------------
  474. ! Data relative to the "mesoscale grid"
  475. ! integer nz ! Number of vertical levels
  476. integer kms,kme,kts,kte
  477. real z(kms:kme) ! Altitude above the ground of the cell interfaces.
  478. real ua(kms:kme) ! Wind speed in the x direction
  479. real va(kms:kme) ! Wind speed in the y direction
  480. real pt(kms:kme) ! Potential temperature
  481. real da(kms:kme) ! Air density
  482. real pr(kms:kme) ! Air pressure
  483. real pt0(kms:kme) ! Reference potential temperature (could be equal to "pt")
  484. real dt ! Time step
  485. real zr ! Zenith angle
  486. real deltar ! Declination of the sun
  487. real ah ! Hour angle
  488. real rs ! Solar radiation
  489. real rld ! Downward flux of the longwave radiation
  490. ! Data relative to the "urban grid"
  491. integer iurb ! Current urban class
  492. ! Building parameters
  493. real alag_u(nurbm) ! Ground thermal diffusivity [m^2 s^-1]
  494. real alaw_u(nurbm) ! Wall thermal diffusivity [m^2 s^-1]
  495. real alar_u(nurbm) ! Roof thermal diffusivity [m^2 s^-1]
  496. real csg_u(nurbm) ! Specific heat of the ground material [J m^3 K^-1]
  497. real csw_u(nurbm) ! Specific heat of the wall material [J m^3 K^-1]
  498. real csr_u(nurbm) ! Specific heat of the roof material [J m^3 K^-1]
  499. ! Radiation parameters
  500. real albg_u(nurbm) ! Albedo of the ground
  501. real albw_u(nurbm) ! Albedo of the wall
  502. real albr_u(nurbm) ! Albedo of the roof
  503. real emg_u(nurbm) ! Emissivity of ground
  504. real emw_u(nurbm) ! Emissivity of wall
  505. real emr_u(nurbm) ! Emissivity of roof
  506. ! fww,fwg,fgw,fsw,fsg are the view factors used to compute the long and
  507. ! short wave radation.
  508. ! The calculation of these factor is explained in the Appendix A of the BLM paper
  509. real fww(nz_um,nz_um,ndm,nurbm) ! from wall to wall
  510. real fwg(nz_um,ndm,nurbm) ! from wall to ground
  511. real fgw(nz_um,ndm,nurbm) ! from ground to wall
  512. real fsw(nz_um,ndm,nurbm) ! from sky to wall
  513. real fws(nz_um,ndm,nurbm) ! from wall to sky
  514. real fsg(ndm,nurbm) ! from sky to ground
  515. ! Roughness parameters
  516. real z0g_u(nurbm) ! The ground's roughness length
  517. real z0r_u(nurbm) ! The roof's roughness length
  518. ! Street parameters
  519. integer nd_u(nurbm) ! Number of street direction for each urban class
  520. real strd_u(ndm,nurbm) ! Street length (set to a greater value then the horizontal length of the cells)
  521. real drst_u(ndm,nurbm) ! Street direction
  522. real ws_u(ndm,nurbm) ! Street width
  523. real bs_u(ndm,nurbm) ! Building width
  524. real h_b(nz_um,nurbm) ! Bulding's heights
  525. real d_b(nz_um,nurbm) ! The probability that a building has an height "h_b"
  526. real ss_u(nz_um,nurbm) ! The probability that a building has an height equal to "z"
  527. real pb_u(nz_um,nurbm) ! The probability that a building has an height greater or equal to "z"
  528. ! Grid parameters
  529. integer nz_u(nurbm) ! Number of layer in the urban grid
  530. ! real dz_u ! Urban grid resolution
  531. real z_u(nz_um) ! Height of the urban grid levels
  532. ! ----------------------------------------------------------------------
  533. ! INPUT-OUTPUT
  534. ! ----------------------------------------------------------------------
  535. ! Data relative to the "urban grid" which should be stored from the current time step to the next one
  536. real tw(2*ndm,nz_um,nwr_u) ! Temperature in each layer of the wall [K]
  537. real tr(ndm,nz_um,nwr_u) ! Temperature in each layer of the roof [K]
  538. real tg(ndm,ng_u) ! Temperature in each layer of the ground [K]
  539. real sfw(2*ndm,nz_um) ! Sensible heat flux from walls
  540. real sfg(ndm) ! Sensible heat flux from ground (road)
  541. real sfr(ndm,nz_um) ! Sensible heat flux from roofs
  542. real gfg(ndm) ! Heat flux transferred from the surface of the ground (road) towards the interior
  543. real gfr(ndm,nz_um) ! Heat flux transferred from the surface of the roof towards the interior
  544. real gfw(2*ndm,nz_um) ! Heat flux transfered from the surface of the walls towards the interior
  545. ! ----------------------------------------------------------------------
  546. ! OUTPUT:
  547. ! ----------------------------------------------------------------------
  548. ! Data relative to the "mesoscale grid"
  549. real sf(kms:kme) ! Surface of the "mesoscale grid" cells taking into account the buildings
  550. real vl(kms:kme) ! Volume of the "mesoscale grid" cells taking into account the buildings
  551. ! Implicit and explicit components of the source and sink terms at each levels,
  552. ! the fluxes can be computed as follow: FX = A*X + B example: Heat fluxes = a_t * pt + b_t
  553. real a_u(kms:kme) ! Implicit component of the momentum sources or sinks in the X-direction
  554. real a_v(kms:kme) ! Implicit component of the momentum sources or sinks in the Y-direction
  555. real a_t(kms:kme) ! Implicit component of the heat sources or sinks
  556. real a_e(kms:kme) ! Implicit component of the TKE sources or sinks
  557. real b_u(kms:kme) ! Explicit component of the momentum sources or sinks in the X-direction
  558. real b_v(kms:kme) ! Explicit component of the momentum sources or sinks in the Y-direction
  559. real b_t(kms:kme) ! Explicit component of the heat sources or sinks
  560. real b_e(kms:kme) ! Explicit component of the TKE sources or sinks
  561. real dlg(kms:kme) ! Height above ground (L_ground in formula (24) of the BLM paper).
  562. real dl_u(kms:kme) ! Length scale (lb in formula (22) ofthe BLM paper).
  563. real tsk ! Average of the road surface temperatures
  564. ! ----------------------------------------------------------------------
  565. ! LOCAL:
  566. ! ----------------------------------------------------------------------
  567. real dz(kms:kme) ! vertical space steps of the "mesoscale grid"
  568. ! Data interpolated from the "mesoscale grid" to the "urban grid"
  569. real ua_u(nz_um) ! Wind speed in the x direction
  570. real va_u(nz_um) ! Wind speed in the y direction
  571. real pt_u(nz_um) ! Potential temperature
  572. real da_u(nz_um) ! Air density
  573. real pt0_u(nz_um) ! Reference potential temperature
  574. real pr_u(nz_um) ! Air pressure
  575. ! Data defining the building and street charateristics
  576. integer nd ! Number of street direction for the current urban class
  577. real alag(ng_u) ! Ground thermal diffusivity for the current urban class [m^2 s^-1]
  578. real alar(nwr_u) ! Roof thermal diffusivity for the current urban class [m^2 s^-1]
  579. real alaw(nwr_u) ! Walls thermal diffusivity for the current urban class [m^2 s^-1]
  580. real csg(ng_u) ! Specific heat of the ground material of the current urban class [J m^3 K^-1]
  581. real csr(nwr_u) ! Specific heat of the roof material for the current urban class [J m^3 K^-1]
  582. real csw(nwr_u) ! Specific heat of the wall material for the current urban class [J m^3 K^-1]
  583. real z0(ndm,nz_um) ! Roughness lengths "profiles"
  584. real ws(ndm) ! Street widths of the current urban class
  585. real bs(ndm) ! Building widths of the current urban class
  586. real strd(ndm) ! Street lengths for the current urban class
  587. real drst(ndm) ! Street directions for the current urban class
  588. real ss(nz_um) ! Probability to have a building with height h
  589. real pb(nz_um) ! Probability to have a building with an height equal
  590. ! Solar radiation at each level of the "urban grid"
  591. real rsg(ndm) ! Short wave radiation from the ground
  592. real rsw(2*ndm,nz_um) ! Short wave radiation from the walls
  593. real rlg(ndm) ! Long wave radiation from the ground
  594. real rlw(2*ndm,nz_um) ! Long wave radiation from the walls
  595. ! Potential temperature of the surfaces at each level of the "urban grid"
  596. real ptg(ndm) ! Ground potential temperatures
  597. real ptr(ndm,nz_um) ! Roof potential temperatures
  598. real ptw(2*ndm,nz_um) ! Walls potential temperatures
  599. ! Explicit and implicit component of the momentum, temperature and TKE sources or sinks on
  600. ! vertical surfaces (walls) ans horizontal surfaces (roofs and street)
  601. ! The fluxes can be computed as follow: Fluxes of X = A*X + B
  602. ! Example: Momentum fluxes on vertical surfaces = uva_u * ua_u + uvb_u
  603. real uhb_u(ndm,nz_um) ! U (wind component) Horizontal surfaces, B (explicit) term
  604. real uva_u(2*ndm,nz_um) ! U (wind component) Vertical surfaces, A (implicit) term
  605. real uvb_u(2*ndm,nz_um) ! U (wind component) Vertical surfaces, B (explicit) term
  606. real vhb_u(ndm,nz_um) ! V (wind component) Horizontal surfaces, B (explicit) term
  607. real vva_u(2*ndm,nz_um) ! V (wind component) Vertical surfaces, A (implicit) term
  608. real vvb_u(2*ndm,nz_um) ! V (wind component) Vertical surfaces, B (explicit) term
  609. real thb_u(ndm,nz_um) ! Temperature Horizontal surfaces, B (explicit) term
  610. real tva_u(2*ndm,nz_um) ! Temperature Vertical surfaces, A (implicit) term
  611. real tvb_u(2*ndm,nz_um) ! Temperature Vertical surfaces, B (explicit) term
  612. real ehb_u(ndm,nz_um) ! Energy (TKE) Horizontal surfaces, B (explicit) term
  613. real evb_u(2*ndm,nz_um) ! Energy (TKE) Vertical surfaces, B (explicit) term
  614. !
  615. real rs_abs ! solar radiation absorbed by urban surfaces
  616. real rl_up ! longwave radiation emitted by urban surface to the atmosphere
  617. real emiss ! mean emissivity of the urban surface
  618. real grdflx_urb ! ground heat flux
  619. real shtot,aaa
  620. real dt_int ! internal time step
  621. integer nt_int ! number of internal time step
  622. integer iz,id, it_int
  623. integer iwrong,iw,ix,iy
  624. ! ----------------------------------------------------------------------
  625. ! END VARIABLES DEFINITIONS
  626. ! ----------------------------------------------------------------------
  627. ! Fix some usefull parameters for the computation of the sources or sinks
  628. do iz=kts,kte
  629. dz(iz)=z(iz+1)-z(iz)
  630. end do
  631. call param(iurb,nz_u(iurb),nd_u(iurb), &
  632. csg_u,csg,alag_u,alag,csr_u,csr, &
  633. alar_u,alar,csw_u,csw,alaw_u,alaw, &
  634. ws_u,ws,bs_u,bs,z0g_u,z0r_u,z0, &
  635. strd_u,strd,drst_u,drst,ss_u,ss,pb_u,pb)
  636. ! Interpolation on the "urban grid"
  637. call interpol(kms,kme,kts,kte,nz_u(iurb),z,z_u,ua,ua_u)
  638. call interpol(kms,kme,kts,kte,nz_u(iurb),z,z_u,va,va_u)
  639. call interpol(kms,kme,kts,kte,nz_u(iurb),z,z_u,pt,pt_u)
  640. call interpol(kms,kme,kts,kte,nz_u(iurb),z,z_u,pt0,pt0_u)
  641. call interpol(kms,kme,kts,kte,nz_u(iurb),z,z_u,pr,pr_u)
  642. call interpol(kms,kme,kts,kte,nz_u(iurb),z,z_u,da,da_u)
  643. ! Compute the modification of the radiation due to the buildings
  644. call modif_rad(iurb,nd_u(iurb),nz_u(iurb),z_u,ws, &
  645. drst,strd,ss,pb, &
  646. tw,tg,albg_u(iurb),albw_u(iurb), &
  647. emw_u(iurb),emg_u(iurb), &
  648. fww,fwg,fgw,fsw,fsg, &
  649. zr,deltar,ah, &
  650. rs,rld,rsw,rsg,rlw,rlg)
  651. ! calculation of the urban albedo and the upward long wave radiation
  652. call upward_rad(nd_u(iurb),iurb,nz_u(iurb),ws,bs,sigma,fsw,fsg,pb,ss, &
  653. tg,emg_u(iurb),albg_u(iurb),rlg,rsg,sfg, &
  654. tw,emw_u(iurb),albw_u(iurb),rlw,rsw,sfw, &
  655. tr,emr_u(iurb),albr_u(iurb),rld,rs,sfr, &
  656. rs_abs,rl_up,emiss,grdflx_urb)
  657. ! Compute the surface temperatures
  658. call surf_temp(nz_u(iurb),nd_u(iurb),pr_u,dt,ss, &
  659. rs,rld,rsg,rlg,rsw,rlw, &
  660. tg,alag,csg,emg_u(iurb),albg_u(iurb),ptg,sfg,gfg, &
  661. tr,alar,csr,emr_u(iurb),albr_u(iurb),ptr,sfr,gfr, &
  662. tw,alaw,csw,emw_u(iurb),albw_u(iurb),ptw,sfw,gfw)
  663. ! Compute the implicit and explicit components of the sources or sinks on the "urban grid"
  664. call buildings(nd_u(iurb),nz_u(iurb),z0,ua_u,va_u, &
  665. pt_u,pt0_u,ptg,ptr,da_u,ptw,drst, &
  666. uva_u,vva_u,uvb_u,vvb_u,tva_u,tvb_u,evb_u, &
  667. uhb_u,vhb_u,thb_u,ehb_u,ss,dt)
  668. ! Calculation of the sensible heat fluxes for the ground, the wall and roof
  669. ! Sensible Heat Flux = density * Cp_U * ( A* potential temperature + B )
  670. ! where A and B are the implicit and explicit components of the heat sources or sinks.
  671. !
  672. !
  673. do id=1,nd_u(iurb)
  674. sfg(id)=-da_u(1)*cp_u*thb_u(id,1)
  675. do iz=2,nz_u(iurb)
  676. sfr(id,iz)=-da_u(iz)*cp_u*thb_u(id,iz)
  677. enddo
  678. do iz=1,nz_u(iurb)
  679. sfw(2*id-1,iz)=-da_u(iz)*cp_u*(tvb_u(2*id-1,iz)+ &
  680. tva_u(2*id-1,iz)*pt_u(iz))
  681. sfw(2*id,iz)=-da_u(iz)*cp_u*(tvb_u(2*id,iz)+ &
  682. tva_u(2*id,iz)*pt_u(iz))
  683. enddo
  684. enddo
  685. ! calculation of the urban albedo and the upward long wave radiation
  686. ! call upward_rad(nd_u(iurb),iurb,nz_u(iurb),ws,bs,sigma,fsw,fsg,pb,ss, &
  687. ! tg,emg_u(iurb),albg_u(iurb),rlg,rsg, &
  688. ! tw,emw_u(iurb),albw_u(iurb),rlw,rsw, &
  689. ! tr,emr_u(iurb),albr_u(iurb),rld,rs, &
  690. ! rs_abs,rl_up,emiss)
  691. ! Interpolation on the "mesoscale grid"
  692. call urban_meso(nd_u(iurb),kms,kme,kts,kte,nz_u(iurb),z,dz,z_u,pb,ss,bs,ws,sf, &
  693. vl,uva_u,vva_u,uvb_u,vvb_u,tva_u,tvb_u,evb_u, &
  694. uhb_u,vhb_u,thb_u,ehb_u, &
  695. a_u,a_v,a_t,a_e,b_u,b_v,b_t,b_e)
  696. ! computation of the mean road temperature tsk (this value could be used
  697. ! to replace the surface temperature in the radiation routines, if needed).
  698. ! tsk=0.
  699. ! do id=1,nd_u(iurb)
  700. ! tsk=tsk+tg(id,ng_u)/nd_u(iurb)
  701. ! enddo
  702. ! Calculation of the length scale taking into account the buildings effects
  703. call interp_length(nd_u(iurb),kms,kme,kts,kte,nz_u(iurb),z_u,z,ss,ws,bs,dlg,dl_u)
  704. return
  705. end subroutine BEP1D
  706. ! ===6=8===============================================================72
  707. ! ===6=8===============================================================72
  708. subroutine param(iurb,nz,nd, &
  709. csg_u,csg,alag_u,alag,csr_u,csr, &
  710. alar_u,alar,csw_u,csw,alaw_u,alaw, &
  711. ws_u,ws,bs_u,bs,z0g_u,z0r_u,z0, &
  712. strd_u,strd,drst_u,drst,ss_u,ss,pb_u,pb)
  713. ! ----------------------------------------------------------------------
  714. ! This routine prepare some usefull parameters
  715. ! ----------------------------------------------------------------------
  716. implicit none
  717. ! ----------------------------------------------------------------------
  718. ! INPUT:
  719. ! ----------------------------------------------------------------------
  720. integer iurb ! Current urban class
  721. integer nz ! Number of vertical urban levels in the current class
  722. integer nd ! Number of street direction for the current urban class
  723. real alag_u(nurbm) ! Ground thermal diffusivity [m^2 s^-1]
  724. real alar_u(nurbm) ! Roof thermal diffusivity [m^2 s^-1]
  725. real alaw_u(nurbm) ! Wall thermal diffusivity [m^2 s^-1]
  726. real bs_u(ndm,nurbm) ! Building width
  727. real csg_u(nurbm) ! Specific heat of the ground material [J m^3 K^-1]
  728. real csr_u(nurbm) ! Specific heat of the roof material [J m^3 K^-1]
  729. real csw_u(nurbm) ! Specific heat of the wall material [J m^3 K^-1]
  730. real drst_u(ndm,nurbm) ! Street direction
  731. real strd_u(ndm,nurbm) ! Street length
  732. real ws_u(ndm,nurbm) ! Street width
  733. real z0g_u(nurbm) ! The ground's roughness length
  734. real z0r_u(nurbm) ! The roof's roughness length
  735. real ss_u(nz_um,nurbm) ! The probability that a building has an height equal to "z"
  736. real pb_u(nz_um,nurbm) ! The probability that a building has an height greater or equal to "z"
  737. ! ----------------------------------------------------------------------
  738. ! OUTPUT:
  739. ! ----------------------------------------------------------------------
  740. real alag(ng_u) ! Ground thermal diffusivity at each ground levels
  741. real alar(nwr_u) ! Roof thermal diffusivity at each roof levels
  742. real alaw(nwr_u) ! Wall thermal diffusivity at each wall levels
  743. real csg(ng_u) ! Specific heat of the ground material at each ground levels
  744. real csr(nwr_u) ! Specific heat of the roof material at each roof levels
  745. real csw(nwr_u) ! Specific heat of the wall material at each wall levels
  746. real bs(ndm) ! Building width for the current urban class
  747. real drst(ndm) ! street directions for the current urban class
  748. real strd(ndm) ! Street lengths for the current urban class
  749. real ws(ndm) ! Street widths of the current urban class
  750. real z0(ndm,nz_um) ! Roughness lengths "profiles"
  751. real ss(nz_um) ! Probability to have a building with height h
  752. real pb(nz_um) ! Probability to have a building with an height equal
  753. ! ----------------------------------------------------------------------
  754. ! LOCAL:
  755. ! ----------------------------------------------------------------------
  756. integer id,ig,ir,iw,iz
  757. ! ----------------------------------------------------------------------
  758. ! END VARIABLES DEFINITIONS
  759. ! ----------------------------------------------------------------------
  760. !
  761. !Initialize the variables
  762. !
  763. ss=0.
  764. pb=0.
  765. csg=0.
  766. alag=0.
  767. csr=0.
  768. alar=0.
  769. csw=0.
  770. alaw=0.
  771. z0=0.
  772. ws=0.
  773. bs=0.
  774. strd=0.
  775. drst=0.
  776. do iz=1,nz+1
  777. ss(iz)=ss_u(iz,iurb)
  778. pb(iz)=pb_u(iz,iurb)
  779. end do
  780. do ig=1,ng_u
  781. csg(ig)=csg_u(iurb)
  782. alag(ig)=alag_u(iurb)
  783. enddo
  784. do ir=1,nwr_u
  785. csr(ir)=csr_u(iurb)
  786. alar(ir)=alar_u(iurb)
  787. enddo
  788. do iw=1,nwr_u
  789. csw(iw)=csw_u(iurb)
  790. alaw(iw)=alaw_u(iurb)
  791. enddo
  792. do id=1,nd
  793. z0(id,1)=z0g_u(iurb)
  794. do iz=2,nz+1
  795. z0(id,iz)=z0r_u(iurb)
  796. enddo
  797. enddo
  798. do id=1,nd
  799. ws(id)=ws_u(id,iurb)
  800. bs(id)=bs_u(id,iurb)
  801. strd(id)=strd_u(id,iurb)
  802. drst(id)=drst_u(id,iurb)
  803. enddo
  804. return
  805. end subroutine param
  806. ! ===6=8===============================================================72
  807. ! ===6=8===============================================================72
  808. subroutine interpol(kms,kme,kts,kte,nz_u,z,z_u,c,c_u)
  809. ! ----------------------------------------------------------------------
  810. ! This routine interpolate para
  811. ! meters from the "mesoscale grid" to
  812. ! the "urban grid".
  813. ! See p300 Appendix B.1 of the BLM paper.
  814. ! ----------------------------------------------------------------------
  815. implicit none
  816. ! ----------------------------------------------------------------------
  817. ! INPUT:
  818. ! ----------------------------------------------------------------------
  819. ! Data relative to the "mesoscale grid"
  820. integer kts,kte,kms,kme
  821. real z(kms:kme) ! Altitude of the cell interface
  822. real c(kms:kme) ! Parameter which has to be interpolated
  823. ! Data relative to the "urban grid"
  824. integer nz_u ! Number of levels
  825. !! real z_u(nz_u+1) ! Altitude of the cell interface
  826. real z_u(nz_um) ! Altitude of the cell interface
  827. ! ----------------------------------------------------------------------
  828. ! OUTPUT:
  829. ! ----------------------------------------------------------------------
  830. !! real c_u(nz_u) ! Interpolated paramters in the "urban grid"
  831. real c_u(nz_um) ! Interpolated paramters in the "urban grid"
  832. ! LOCAL:
  833. ! ----------------------------------------------------------------------
  834. integer iz_u,iz
  835. real ctot,dz
  836. ! ----------------------------------------------------------------------
  837. ! END VARIABLES DEFINITIONS
  838. ! ----------------------------------------------------------------------
  839. do iz_u=1,nz_u
  840. ctot=0.
  841. do iz=kts,kte
  842. dz=max(min(z(iz+1),z_u(iz_u+1))-max(z(iz),z_u(iz_u)),0.)
  843. ctot=ctot+c(iz)*dz
  844. enddo
  845. c_u(iz_u)=ctot/(z_u(iz_u+1)-z_u(iz_u))
  846. enddo
  847. return
  848. end subroutine interpol
  849. ! ===6=8===============================================================72
  850. ! ===6=8===============================================================72
  851. subroutine modif_rad(iurb,nd,nz_u,z,ws,drst,strd,ss,pb, &
  852. tw,tg,albg,albw,emw,emg, &
  853. fww,fwg,fgw,fsw,fsg, &
  854. zr,deltar,ah, &
  855. rs,rl,rsw,rsg,rlw,rlg)
  856. ! ----------------------------------------------------------------------
  857. ! This routine computes the modification of the short wave and
  858. ! long wave radiation due to the buildings.
  859. ! ----------------------------------------------------------------------
  860. implicit none
  861. ! ----------------------------------------------------------------------
  862. ! INPUT:
  863. ! ----------------------------------------------------------------------
  864. integer iurb ! current urban class
  865. integer nd ! Number of street direction for the current urban class
  866. integer nz_u ! Number of layer in the urban grid
  867. real z(nz_um) ! Height of the urban grid levels
  868. real ws(ndm) ! Street widths of the current urban class
  869. real drst(ndm) ! street directions for the current urban class
  870. real strd(ndm) ! Street lengths for the current urban class
  871. real ss(nz_um) ! probability to have a building with height h
  872. real pb(nz_um) ! probability to have a building with an height equal
  873. real tw(2*ndm,nz_um,nwr_u) ! Temperature in each layer of the wall [K]
  874. real tg(ndm,ng_u) ! Temperature in each layer of the ground [K]
  875. real albg ! Albedo of the ground for the current urban class
  876. real albw ! Albedo of the wall for the current urban class
  877. real emg ! Emissivity of ground for the current urban class
  878. real emw ! Emissivity of wall for the current urban class
  879. real fgw(nz_um,ndm,nurbm) ! View factors from ground to wall
  880. real fsg(ndm,nurbm) ! View factors from sky to ground
  881. real fsw(nz_um,ndm,nurbm) ! View factors from sky to wall
  882. real fws(nz_um,ndm,nurbm) ! View factors from wall to sky
  883. real fwg(nz_um,ndm,nurbm) ! View factors from wall to ground
  884. real fww(nz_um,nz_um,ndm,nurbm) ! View factors from wall to wall
  885. real ah ! Hour angle (it should come from the radiation routine)
  886. real zr ! zenith angle
  887. real deltar ! Declination of the sun
  888. real rs ! solar radiation
  889. real rl ! downward flux of the longwave radiation
  890. ! ----------------------------------------------------------------------
  891. ! OUTPUT:
  892. ! ----------------------------------------------------------------------
  893. real rlg(ndm) ! Long wave radiation at the ground
  894. real rlw(2*ndm,nz_um) ! Long wave radiation at the walls
  895. real rsg(ndm) ! Short wave radiation at the ground
  896. real rsw(2*ndm,nz_um) ! Short wave radiation at the walls
  897. ! ----------------------------------------------------------------------
  898. ! LOCAL:
  899. ! ----------------------------------------------------------------------
  900. integer id,iz
  901. ! Calculation of the shadow effects
  902. call shadow_mas(nd,nz_u,zr,deltar,ah,drst,ws,ss,pb,z, &
  903. rs,rsw,rsg)
  904. ! Calculation of the reflection effects

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