SUEWS API Site
Documentation of SUEWS source code
suews_ctrl_translate.f95
Go to the documentation of this file.
1!SUEWS_Translate
2!Translates - new input arrays (v2014b) to existing model variables
3! - between arrays for different grids and the model variables
4!Made by HW&LJ Oct 2014
5!-----------------------------------------------------------------------------------
6! MH 21 Jun 2017 : Added anthropogenic CO2 charasteristic
7! MH 16 Jun 2017 : Added biogenic CO2 characteristic
8! HCW 13 Dec 2016 : LAIPower and LAIType for all vegetation types now used (previously only DecTr were used)
9! HCW 12 Dec 2016 : Switched sign of lng so that input should be -ve for W, +ve for E, as is conventional
10!Last modified HCW 26 Aug 2016
11! NumCapita now uses average of day and night pop density, unless only one is specified
12!Last modified HCW 06 Jul 2016
13! Checks on ESTM fractions
14! - default setting to first ESTM Class code if surface not present and ESTM fractions do not sum to 1.
15!Last modified HCW 29 Jun 2016
16! Removed SoilMoistDay and StateDay
17!Last modified: HCW 16 Jun 2016
18! ESTM development for 7 surface types + snow, allowing 3x Paved classes and 5x Bldgs classes
19! Currently surface characteristics are averaged here; probably want to average QS instead.
20!Last modified: TS 13 Apr 2016
21! Added AnOHM required variables.
22!Last modified: LJ 06 Jul 2015
23! Changed to read SnowAlb from ModelDailyState instead of SurfaceChar. Location also moved.
24!Last modified: HCW 03 Jul 2015
25! Use PopDensNighttime by default (not PopDensDaytime)
26!Last modified: HCW 26 Jun 2015
27! Translation of DailyState variables from the corresponding '_grids' arrays moved
28! earlier in code in order to fix bug in DecidCap, AlbDec, Porosity.
29!Last modified: HCW 28 Nov 2014
30!
31! To Do:
32! - Add AnOHM and ESTM info to FileChoices
33! - Check observed soil moisture works correctly!!
34! - Adjust model to allow water to runoff and sub-surface soil store for each surface type
35! - Adjust model to calculate LAI per surface
36! - Adjust model for SM per surface (measured characteristics)
37!===================================================================================
38SUBROUTINE suews_translate(Gridiv, ir, iMB)
42 USE data_in
44 USE gis_data, ONLY: &
47 USE mod_z, ONLY: z, z0m, z0m_in, zdm, zdm_in, zzd
48 USE resist, ONLY: g1, g2, g3, g4, g5, g6, th, tl, s1, s2, kmax, gsmodel
49 USE snowmod, ONLY: &
54 USE sues_data, ONLY: &
61 h_maintain, &
65
66 USE time, ONLY: iy, id, it, imin, isec, dectime, dt_since_start
67 USE estm_data
68 USE wherewhen, ONLY: gridid, gridid_text
70
71 IMPLICIT NONE
72
73 INTEGER :: Gridiv, & !Index of the analysed grid (Gridcounter)
74 ir, & !Meteorological forcing file index (set to zero if SUEWS_Translate called from InitialState)
75 iMB, & !Chunk of met data
76 id_prev
77
78 INTEGER :: iv, j, i
79 !real (Kind(1d0)):: FCskip = -9 !NULL value used for output to FileChoices
80 REAL(KIND(1D0)) :: FCskip = -999 !NULL value used for output to FileChoices (changed by HCW 24 May 2016)
81
82 ! REAL(KIND(1d0)):: z0m_in, zdm_in !Values of z0m and zdm provided in SiteSelect input file (do not get updated unlike z0d and z0m)
83
84 CHARACTER(len=20) :: grid_txt
85 CHARACTER(len=4) :: year_txt
86 CHARACTER(len=12) :: SsG_YYYY !Site, grid, year string
87
88 CHARACTER(len=4) :: iy_text
89 CHARACTER(len=3) :: id_text
90 CHARACTER(len=2) :: it_text, imin_text
91
92 !write(*,*) '---- SUEWS_Translate ----'
93 !write(*,*) 'Year:', SurfaceChar(Gridiv,c_Year)
94 !write(*,*) 'Grid:', SurfaceChar(Gridiv,c_Grid)
95 !write(*,*) 'Gridiv:', Gridiv
96 !write(*,*) 'Met block (iMB or iv):',iMB
97 !write(*,*) 'Met line (ir):',ir
98 !write(*,*) '----'
99
100 ! =================================================================================
101 ! ======= Translate inputs from SurfaceChar to variable names used in model =======
102 ! =================================================================================
103 ! GridID = GridIDmatrix(Gridiv) ! also in SUEWS_Program so deleted here. TS 10 Jun 2018
104 ! ---- Latitude and longitude
105 lat = surfacechar(gridiv, c_lat)
106 lng = surfacechar(gridiv, c_lng)
107 ! ---- Timezone
108 timezone = surfacechar(gridiv, c_tz)
109 ! ---- Altitude [m]
110 alt = surfacechar(gridiv, c_alt)
111 ! ---- Measurement height [m]
112 z = surfacechar(gridiv, c_z)
113 ! ---- Surface area [ha]
115 ! Change from ha to m2 (was in RunControlByGridByYear)
116 surfacearea = surfacearea_ha*10000 !Change surface area from ha to m^2
117
118 ! ---- Surface fractions (previously in LUMPS_gis_read)
119 sfr_surf(pavsurf) = surfacechar(gridiv, c_frpaved) ! Paved
120 sfr_surf(bldgsurf) = surfacechar(gridiv, c_frbldgs) ! Bldgs
121 sfr_surf(conifsurf) = surfacechar(gridiv, c_frevetr) ! Everg
122 sfr_surf(decidsurf) = surfacechar(gridiv, c_frdectr) ! Decid
123 sfr_surf(grasssurf) = surfacechar(gridiv, c_frgrass) ! Grass
124 sfr_surf(bsoilsurf) = surfacechar(gridiv, c_frbsoil) ! BSoil
125 sfr_surf(watersurf) = surfacechar(gridiv, c_frwater) ! Water
126
127 ! Check the surface fractions add up to 1 (or close to 1)
128 IF (sum(sfr_surf) > 1.001 .OR. sum(sfr_surf) < 0.999) &
129 CALL errorhint(10, 'Surface fractions (Fr_) should add up to 1.', sum(sfr_surf), notused, notusedi)
130
131 ! ---- Irrigated fractions
132 irrfracpaved = surfacechar(gridiv, c_irrpavedfrac) ! Paved
133 irrfracbldgs = surfacechar(gridiv, c_irrbldgsfrac) ! Bldgs
134 irrfracevetr = surfacechar(gridiv, c_irrevetrfrac) ! Everg
135 irrfracdectr = surfacechar(gridiv, c_irrdectrfrac) ! Decid
136 irrfracgrass = surfacechar(gridiv, c_irrgrassfrac) ! Grass
137 irrfracbsoil = surfacechar(gridiv, c_irrbsoilfrac) ! BSoil
138 irrfracwater = surfacechar(gridiv, c_irrwaterfrac) ! Water
139
140 ! ---------------------------------------------------------------------------------
141 ! --------- Surface cover calculations (previously in LUMPS_gis_read) -------------
142
143 ! ---- Buildings and trees fraction ----
145
146 ! ---- Vegetated fraction ----
148 !VegFraction = (sfr_surf(ConifSurf) + sfr_surf(DecidSurf) + sfr_surf(GrassSurf))
149
150 ! ---- Vegetated fraction (for LUMPS) ----
151 ! For LUMPS, vegetated fraction includes Water and Bare soil surfaces
152 IF (veg_type == 1) THEN ! area vegetated
154 ELSEIF (veg_type == 2) THEN ! area irrigated
156 END IF
157
161 ! ---------------------------------------------------------------------------------
162
163 ! ---- Heights & frontal areas
164 bldgh = surfacechar(gridiv, c_hbldgs) ! Building height [m]
165 evetreeh = surfacechar(gridiv, c_hevetr) ! Evergreen tree height [m]
166 dectreeh = surfacechar(gridiv, c_hdectr) ! Deciduous tree height [m]
167 IF (sfr_surf(conifsurf) + sfr_surf(decidsurf) > 0.) THEN ! avoid arithmetic error
169 ELSE
170 treeh = 1.
171 END IF
172
173 faibldg = surfacechar(gridiv, c_faibldgs) ! Frontal area index for buildings
174 faievetree = surfacechar(gridiv, c_faievetr) ! Frontal area index for evergreen trees
175 faidectree = surfacechar(gridiv, c_faidectr) ! Frontal area index for deciduous trees
176 IF (sfr_surf(conifsurf) + sfr_surf(decidsurf) > 0.) THEN ! avoid arithmetic error
178 ELSE
179 faitree = 1.
180 END IF
181
182 z0m = surfacechar(gridiv, c_z0m) ! Roughness length [m]
183 zdm = surfacechar(gridiv, c_zdm) ! Displacement height [m]
184 ! z0m and zdm can vary in time depending on z0method selected. Save the input values here
185 z0m_in = z0m
186 zdm_in = zdm
187
188 ! ---- Population density [ha-1]
189 ! Weekend fraction added to daytime population density
190 popdensdaytime = surfacechar(gridiv, (/c_popdensday, c_popdensday/)) ! Daytime population density [ha-1]
191 popdensnighttime = surfacechar(gridiv, c_popdensnight) ! Night-time population density [ha-1]
192 IF (popdensdaytime(1) >= 0 .AND. popdensnighttime < 0) popdensnighttime = popdensdaytime(1) !If only daytime data provided, use them
193 IF (popdensdaytime(1) < 0 .AND. popdensnighttime >= 0) popdensdaytime(1) = popdensnighttime !If only night-time data provided, use them
194 popdensdaytime(2) = popdensnighttime + (popdensdaytime(1) - popdensnighttime)*surfacechar(gridiv, c_frpddwe) !Use weekend fraction to daytime population
195 ! the following part has been moved into as can be derived there
196 ! IF (PopDensDaytime(1) >= 0 .AND. PopDensNighttime >= 0) NumCapita(1) = (PopDensDaytime(1) + PopDensNighttime)/2 !If both, use average
197 ! IF (PopDensDaytime(2) >= 0 .AND. PopDensNighttime >= 0) NumCapita(2) = (PopDensDaytime(2) + PopDensNighttime)/2 !If both, use average
198
199 ! ! IF (PopDensDaytime >= 0 .AND. PopDensNighttime >= 0) NumCapita = (PopDensDaytime + PopDensNighttime)/2 !If both, use average ! moved to , TS 27 Dec 2018
200
201 ! ---- Traffic rate
202 trafficrate = surfacechar(gridiv, (/c_trafficrate_wd, c_trafficrate_we/)) ! Mean traffic rate within modelled area
203 ! ---- Building energy use
204 qf0_beu = surfacechar(gridiv, (/c_qf0_beu_wd, c_qf0_beu_we/)) ! Building energy use within modelled area
205
206 ! ---- Albedo [-]
207 alb(1:nsurf) = surfacechar(gridiv, c_albmax) !Use maximum albedos as default value (AlbMin for veg surfaces handled below)
208
209 ! ---- Set min & max albedo for vegetated surfaces (min albedo not currently used for NonVeg or Water surfaces)
216
217 ! ---- Emissivity [-]
218 emis(1:nsurf) = surfacechar(gridiv, c_emis)
220
221 ! ---- Storage capacities [mm]
222 storedrainprm(1, 1:nsurf) = surfacechar(gridiv, c_stormin) ! Minimum
223 storedrainprm(5, 1:nsurf) = surfacechar(gridiv, c_stormax) ! Maximum
224 storedrainprm(6, 1:nsurf) = storedrainprm(1, 1:nsurf) !Set storage capacities for all surface to minimum (DecTr changes with time in Calculations).
225
226 ! ---- Set min & max storage capacities for DecTr
229 ! ---- Set min & max porosity for DecTr
230 pormin_dec = surfacechar(gridiv, c_porositymin(ivdecid)) ! Minimum
231 pormax_dec = surfacechar(gridiv, c_porositymax(ivdecid)) ! Minimum
232
233 ! ---- Threshold for wet evaporation [mm]
235
236 ! ---- Limit for state [mm]
238
239 ! ---- Water depth [mm]
241
242 ! ---- Drainage
243 storedrainprm(2, 1:nsurf) = surfacechar(gridiv, c_dreq) ! Drainage equation
244 storedrainprm(3, 1:nsurf) = surfacechar(gridiv, c_drcoef1) ! Drainage coef 1
245 storedrainprm(4, 1:nsurf) = surfacechar(gridiv, c_drcoef2) ! Drainage coef 2
246
247 ! ---- Limit of SWE (each surface except Water)
248 snowpacklimit(1:(nsurf - 1)) = surfacechar(gridiv, c_snowlimpat(1:(nsurf - 1)))
249
250 ! ---- Snow limit for removal (only impervious surfaces)
253 !SnowLimBSoil = SurfaceChar(Gridiv,c_SnowLimRem(BSoilSurf)) !Snow clearing not applicable to bare soil surface
254
255 ! ---- Soil characteristics (each surface except Water)
256 soildepth(1:(nsurf - 1)) = surfacechar(gridiv, c_soildepth(1:(nsurf - 1))) ! Depth of sub-surface soil store [mm]
257 soilstorecap_surf(1:(nsurf - 1)) = surfacechar(gridiv, c_soilstcap(1:(nsurf - 1))) ! Soil store capacity [mm]
258 sathydraulicconduct(1:(nsurf - 1)) = surfacechar(gridiv, c_ksat(1:(nsurf - 1))) ! Hydraulic conductivity of saturated soil [mm s-1]
259 !SoilDensity(1:(nsurf-1)) = SurfaceChar(Gridiv,c_SoilDens(1:(nsurf-1))) ! Soil density [kg m-3]
260 ! Not yet implemented in model
261 !InfiltrationRate (1:(nsurf-1)) = SurfaceChar(Gridiv,c_SoilInfRate(1:(nsurf-1))) ! Infiltration rate [mm h-1]
262
263 !! Observed soil characteristics
264 !SoilDensity (1:(nsurf-1)) = SurfaceChar(Gridiv,c_SoilDens(1:(nsurf-1))) ! Soil density [kg m-3]
265 !SoilDepthMeas(1:(nsurf-1)) = SurfaceChar(Gridiv,c_ObsSMDepth(1:(nsurf-1)))
266 !SmCap (1:(nsurf-1)) = SurfaceChar(Gridiv,c_ObsSMMax(1:(nsurf-1)))
267 !SoilRocks (1:(nsurf-1)) = SurfaceChar(Gridiv,c_ObsSNRFrac(1:(nsurf-1)))
268 !!Obs soil characteristics now in SUEWS_Soil, i.e. per surface; single value was given previously in FunctionalTypes
269 !!Take first row here for testing !! Need to alter model later...
270 soildensity = surfacechar(gridiv, c_soildens(1)) !!Not sure this works correctly - need to check
272 smcap = surfacechar(gridiv, c_obssmmax(1))
274
275 ! ---- Vegetation characteristics (pervious surfaces)
276 baset(1:nvegsurf) = surfacechar(gridiv, c_baset)
277 basete(1:nvegsurf) = surfacechar(gridiv, c_basete)
280 laimin(1:nvegsurf) = surfacechar(gridiv, c_laimin)
281 laimax(1:nvegsurf) = surfacechar(gridiv, c_laimax)
283
289 resp_a(1:nvegsurf) = surfacechar(gridiv, c_resp_a)
290 resp_b(1:nvegsurf) = surfacechar(gridiv, c_resp_b)
292
293 ! ---- LAI characteristics (updated HCW 13 Dec 2016)
294 laitype(1:nvegsurf) = int(surfacechar(gridiv, c_laieq(1:nvegsurf)))
299
300 ! ---- LUMPS-related parameters
301 drainrt = surfacechar(gridiv, c_lumpsdr) ! LUMPS Drainage rate [mm h-1]
302 raincover = surfacechar(gridiv, c_lumpscover) ! LUMPS Limit when surface totally wet [mm]
303 rainmaxres = surfacechar(gridiv, c_lumpsmaxres) ! LUMPS Maximum water bucket reservoir [mm]
304
305 ! ---- NARP-related parameters
306 trans_site = surfacechar(gridiv, c_narptrans) ! NARP atmospheric transmissivity
307
308 ! ---- Snow-related characteristics
313 tau_a = surfacechar(gridiv, c_snowtau_a)
314 tau_f = surfacechar(gridiv, c_snowtau_f)
318 tau_r = surfacechar(gridiv, c_snowtau_r)
322
323 ! ---- Conductance parameters
324 g1 = surfacechar(gridiv, c_gsg1)
325 g2 = surfacechar(gridiv, c_gsg2)
326 g3 = surfacechar(gridiv, c_gsg3)
327 g4 = surfacechar(gridiv, c_gsg4)
328 g5 = surfacechar(gridiv, c_gsg5)
329 g6 = surfacechar(gridiv, c_gsg6)
330 th = surfacechar(gridiv, c_gsth)
331 tl = surfacechar(gridiv, c_gstl)
332 s1 = surfacechar(gridiv, c_gss1)
333 s2 = surfacechar(gridiv, c_gss2)
334 kmax = surfacechar(gridiv, c_gskmax)
335 gsmodel = int(surfacechar(gridiv, c_gsmodel))
336
337 ! ---- Pipe capacity (was from SiteSpecificParam.txt)
339
340 ! ---- Water flows (was from SiteSpecificParam.txt)
343
344 ! ---- Daylight saving (was from ModelledYears.txt)
345 startdls = int(surfacechar(gridiv, c_startdls))
346 enddls = int(surfacechar(gridiv, c_enddls))
347
348 ! ---- OHM coeffs (was in SUEWS_OHMnew.f95, subroutine OHMinitialize)
349 ohm_coef = 0 ! Initialise OHM_coef
350 ! Surface types in OHM_coef: Paved, Roof, Conif, Decid, Grass, BareSoil, Water, CANYON, Snow
351 ! No canyon in SurfaceChar, so
352 ! transfer coeffs for surface types 1-7,
353 ! then skip row in OHM_coef (canyon),
354 ! then transfer coeffs for snow surface (8th surface in SurfaceChar; 9th surface in OHM_Coefs)
355 ! Summer wet
356 ohm_coef(1:nsurf, 1, 1) = surfacechar(gridiv, c_a1_swet(1:nsurf)) !1:nsurf a1 Summer wet
357 ohm_coef(nsurf + 1, 1, 1) = surfacechar(gridiv, c_a1_swet(nsurf + 1)) !Snow a1 Summer wet
358 ohm_coef(1:nsurf, 1, 2) = surfacechar(gridiv, c_a2_swet(1:nsurf)) !1:nsurf a2 Summer wet
359 ohm_coef(nsurf + 1, 1, 2) = surfacechar(gridiv, c_a2_swet(nsurf + 1)) !Snow a2 Summer wet
360 ohm_coef(1:nsurf, 1, 3) = surfacechar(gridiv, c_a3_swet(1:nsurf)) !1:nsurf a3 Summer wet
361 ohm_coef(nsurf + 1, 1, 3) = surfacechar(gridiv, c_a3_swet(nsurf + 1)) !Snow a3 Summer wet
362 ! Summer dry
363 ohm_coef(1:nsurf, 2, 1) = surfacechar(gridiv, c_a1_sdry(1:nsurf)) !1:nsurf a1 Summer dry
364 ohm_coef(nsurf + 1, 2, 1) = surfacechar(gridiv, c_a1_sdry(nsurf + 1)) !Snow a1 Summer dry
365 ohm_coef(1:nsurf, 2, 2) = surfacechar(gridiv, c_a2_sdry(1:nsurf)) !1:nsurf a2 Summer dry
366 ohm_coef(nsurf + 1, 2, 2) = surfacechar(gridiv, c_a2_sdry(nsurf + 1)) !Snow a2 Summer dry
367 ohm_coef(1:nsurf, 2, 3) = surfacechar(gridiv, c_a3_sdry(1:nsurf)) !1:nsurf a3 Summer dry
368 ohm_coef(nsurf + 1, 2, 3) = surfacechar(gridiv, c_a3_sdry(nsurf + 1)) !Snow a3 Summer dry
369 ! Winter wet
370 ohm_coef(1:nsurf, 3, 1) = surfacechar(gridiv, c_a1_wwet(1:nsurf)) !1:nsurf a1 Winter wet
371 ohm_coef(nsurf + 1, 3, 1) = surfacechar(gridiv, c_a1_wwet(nsurf + 1)) !Snow a1 Winter wet
372 ohm_coef(1:nsurf, 3, 2) = surfacechar(gridiv, c_a2_wwet(1:nsurf)) !1:nsurf a2 Winter wet
373 ohm_coef(nsurf + 1, 3, 2) = surfacechar(gridiv, c_a2_wwet(nsurf + 1)) !Snow a2 Winter wet
374 ohm_coef(1:nsurf, 3, 3) = surfacechar(gridiv, c_a3_wwet(1:nsurf)) !1:nsurf a3 Winter wet
375 ohm_coef(nsurf + 1, 3, 3) = surfacechar(gridiv, c_a3_wwet(nsurf + 1)) !Snow a3 Winter wet
376 ! Winter dry
377 ohm_coef(1:nsurf, 4, 1) = surfacechar(gridiv, c_a1_wdry(1:nsurf)) !1:nsurf a1 Winter dry
378 ohm_coef(nsurf + 1, 4, 1) = surfacechar(gridiv, c_a1_wdry(nsurf + 1)) !Snow a1 Winter dry
379 ohm_coef(1:nsurf, 4, 2) = surfacechar(gridiv, c_a2_wdry(1:nsurf)) !1:nsurf a2 Winter dry
380 ohm_coef(nsurf + 1, 4, 2) = surfacechar(gridiv, c_a2_wdry(nsurf + 1)) !Snow a2 Winter dry
381 ohm_coef(1:nsurf, 4, 3) = surfacechar(gridiv, c_a3_wdry(1:nsurf)) !1:nsurf a3 Winter dry
382 ohm_coef(nsurf + 1, 4, 3) = surfacechar(gridiv, c_a3_wdry(nsurf + 1)) !Snow a3 Winter dry
383 ! OHM thresholds
384 ohm_threshsw(1:nsurf) = surfacechar(gridiv, c_ohmthresh_sw(1:nsurf)) !1:nsurf
385 ohm_threshsw(nsurf + 1) = surfacechar(gridiv, c_ohmthresh_sw(nsurf + 1)) !Snow
386 ohm_threshwd(1:nsurf) = surfacechar(gridiv, c_ohmthresh_wd(1:nsurf)) !1:nsurf
387 ohm_threshwd(nsurf + 1) = surfacechar(gridiv, c_ohmthresh_wd(nsurf + 1)) !Snow
388
389 ! ---- ESTM characteristics -------------------------
390 ! HCW 16 Jun 2016
391 ! Wall fraction for ESTM (in SiteSelect.txt)
392 IF (storageheatmethod == 4 .OR. storageheatmethod == 14) THEN
395
396 ! Get surface fractions for ESTM classes for Bldgs and Paved surfaces
399 !Check these sum to 1 and are consistent with sfr_surf of Paved and Bldgs surface types
400 IF (sfr_surf(pavsurf) > 0) THEN !If surface exists, ESTM fractions must be correct
401 IF (sum(estmsfr_paved) > 1.001 .OR. sum(estmsfr_paved) < 0.999) THEN
402 CALL errorhint(10, 'Surface fractions (Fr_ESTMClass_Paved) should sum to 1.', sum(estmsfr_paved), notused, notusedi)
403 END IF
404 ELSEIF (sfr_surf(pavsurf) == 0) THEN !If surface does not exist, ESTM fraction does not matter
405 IF (sum(estmsfr_paved) > 1.001 .OR. sum(estmsfr_paved) < 0.999) THEN !If ESTM fractions do not sum to 1, set here
406 estmsfr_paved(1) = 1.000
407 estmsfr_paved(2:3) = 0.000
408 CALL errorhint(67, 'ESTM Paved classes do not sum to 1 (but no Paved surface present).', &
410 END IF
411 END IF
412 IF (sfr_surf(bldgsurf) > 0) THEN
413 IF (sum(estmsfr_bldgs) > 1.001 .OR. sum(estmsfr_bldgs) < 0.999) THEN
414 CALL errorhint(10, 'Surface fractions (Fr_ESTMClass_Bldgs) should sum to 1.', sum(estmsfr_bldgs), notused, notusedi)
415 END IF
416 ELSEIF (sfr_surf(bldgsurf) == 0) THEN !If surface does not exist, ESTM fraction does not matter
417 IF (sum(estmsfr_bldgs) > 1.001 .OR. sum(estmsfr_bldgs) < 0.999) THEN !If ESTM fractions do not sum to 1, set here
418 estmsfr_bldgs(1) = 1.000
419 estmsfr_bldgs(2:5) = 0.000
420 CALL errorhint(67, 'ESTM Bldgs classes do not sum to 1 (but no Bldgs surface present).', &
422 END IF
423 END IF
424
425 ! ===== PAVED =====
426 ! First combine characteristics of the 3x Paved classes
427 IF (surfacechar(gridiv, c_estmcode(pavsurf)) == 0) THEN ! If Code = 0, use multiple classes
428 ! Get characteristics of each Paved class
429 DO i = 1, 3
436 END DO
437 ! Average characteristics of each Paved class according to surface fractions (these sum to 1)
439 + zsurf_paved(:, 2)*estmsfr_paved(2) &
440 + zsurf_paved(:, 3)*estmsfr_paved(3)
442 + ksurf_paved(:, 2)*estmsfr_paved(2) &
443 + ksurf_paved(:, 3)*estmsfr_paved(3)
445 + rsurf_paved(:, 2)*estmsfr_paved(2) &
446 + rsurf_paved(:, 3)*estmsfr_paved(3)
447 ELSEIF (surfacechar(gridiv, c_estmcode(pavsurf)) /= 0) THEN !Otherwise use single values
448 zsurf_suewssurfs(:, pavsurf) = surfacechar(gridiv, &
451 ksurf_suewssurfs(:, pavsurf) = surfacechar(gridiv, &
454 rsurf_suewssurfs(:, pavsurf) = surfacechar(gridiv, &
457 END IF
458
459 ! ===== BLDGS =====
460 ! Combine characteristics of 5x Bldgs classes into one
461 IF (surfacechar(gridiv, c_estmcode(bldgsurf)) == 0) THEN ! If Code = 0, use multiple classes
462 ! Get characteristics of each Bldgs class
463 DO i = 1, 5
484 nroom_bldgs(i) = surfacechar(gridiv, c_nroom_bldgs(i))
490 END DO
491 ! Average characteristics of each Bldgs class according to surface fractions (these sum to 1)
493 + zsurf_bldgs(:, 2)*estmsfr_bldgs(2) &
494 + zsurf_bldgs(:, 3)*estmsfr_bldgs(3) &
495 + zsurf_bldgs(:, 4)*estmsfr_bldgs(4) &
496 + zsurf_bldgs(:, 5)*estmsfr_bldgs(5)
498 + ksurf_bldgs(:, 2)*estmsfr_bldgs(2) &
499 + ksurf_bldgs(:, 3)*estmsfr_bldgs(3) &
500 + ksurf_bldgs(:, 4)*estmsfr_bldgs(4) &
501 + ksurf_bldgs(:, 5)*estmsfr_bldgs(5)
503 + rsurf_bldgs(:, 2)*estmsfr_bldgs(2) &
504 + rsurf_bldgs(:, 3)*estmsfr_bldgs(3) &
505 + rsurf_bldgs(:, 4)*estmsfr_bldgs(4) &
506 + rsurf_bldgs(:, 5)*estmsfr_bldgs(5)
507 !Wall
508 zwall = zwall_bldgs(:, 1)*estmsfr_bldgs(1) &
509 + zwall_bldgs(:, 2)*estmsfr_bldgs(2) &
510 + zwall_bldgs(:, 3)*estmsfr_bldgs(3) &
511 + zwall_bldgs(:, 4)*estmsfr_bldgs(4) &
512 + zwall_bldgs(:, 5)*estmsfr_bldgs(5)
513 kwall = kwall_bldgs(:, 1)*estmsfr_bldgs(1) &
514 + kwall_bldgs(:, 2)*estmsfr_bldgs(2) &
515 + kwall_bldgs(:, 3)*estmsfr_bldgs(3) &
516 + kwall_bldgs(:, 4)*estmsfr_bldgs(4) &
517 + kwall_bldgs(:, 5)*estmsfr_bldgs(5)
518 rwall = rwall_bldgs(:, 1)*estmsfr_bldgs(1) &
519 + rwall_bldgs(:, 2)*estmsfr_bldgs(2) &
520 + rwall_bldgs(:, 3)*estmsfr_bldgs(3) &
521 + rwall_bldgs(:, 4)*estmsfr_bldgs(4) &
522 + rwall_bldgs(:, 5)*estmsfr_bldgs(5)
523 !Internal
524 zibld = zibld_bldgs(:, 1)*estmsfr_bldgs(1) &
525 + zibld_bldgs(:, 2)*estmsfr_bldgs(2) &
526 + zibld_bldgs(:, 3)*estmsfr_bldgs(3) &
527 + zibld_bldgs(:, 4)*estmsfr_bldgs(4) &
528 + zibld_bldgs(:, 5)*estmsfr_bldgs(5)
529 kibld = kibld_bldgs(:, 1)*estmsfr_bldgs(1) &
530 + kibld_bldgs(:, 2)*estmsfr_bldgs(2) &
531 + kibld_bldgs(:, 3)*estmsfr_bldgs(3) &
532 + kibld_bldgs(:, 4)*estmsfr_bldgs(4) &
533 + kibld_bldgs(:, 5)*estmsfr_bldgs(5)
534 ribld = ribld_bldgs(:, 1)*estmsfr_bldgs(1) &
535 + ribld_bldgs(:, 2)*estmsfr_bldgs(2) &
536 + ribld_bldgs(:, 3)*estmsfr_bldgs(3) &
537 + ribld_bldgs(:, 4)*estmsfr_bldgs(4) &
538 + ribld_bldgs(:, 5)*estmsfr_bldgs(5)
539
541 + nroom_bldgs(2)*estmsfr_bldgs(2) &
542 + nroom_bldgs(3)*estmsfr_bldgs(3) &
543 + nroom_bldgs(4)*estmsfr_bldgs(4) &
570
571 ELSEIF (surfacechar(gridiv, c_estmcode(bldgsurf)) /= 0) THEN !Otherwise use single values
583 zibld = surfacechar(gridiv, &
586 ribld = surfacechar(gridiv, &
588
589 nroom = surfacechar(gridiv, c_nroom)
591 em_ibld = surfacechar(gridiv, c_em_ibld)
594 ch_ibld = surfacechar(gridiv, c_ch_ibld)
595 END IF
596
597 !For other surfaces, only one ESTM class
598 DO iv = conifsurf, nsurfincsnow
599 zsurf_suewssurfs(:, iv) = surfacechar(gridiv, (/c_surf_thick1(iv), c_surf_thick2(iv), c_surf_thick3(iv), &
600 c_surf_thick4(iv), c_surf_thick5(iv)/))
601 ksurf_suewssurfs(:, iv) = surfacechar(gridiv, (/c_surf_k1(iv), c_surf_k2(iv), c_surf_k3(iv), &
602 c_surf_k4(iv), c_surf_k5(iv)/))
603 rsurf_suewssurfs(:, iv) = surfacechar(gridiv, (/c_surf_rhocp1(iv), c_surf_rhocp2(iv), c_surf_rhocp3(iv), &
604 c_surf_rhocp4(iv), c_surf_rhocp5(iv)/))
605 END DO
606
607 ! Now combine SUEWS surfaces into ESTM facets
608 !Surface fractions for ESTM facets (moved from SUEWS_ESTM_initials HCW 16 Jun 2016)
609 !roof = Bldgs
611 !ground = all except Bldgs
612 ! TODO: surface heterogeneity in ESTM: all surfaces on ground are lumped into one;
613 ! when coupled with SUEWS framework #34, we may need to split them into individual ones in SUEWS
614
616 !veg = EveTr, DecTr, Grass
618
619 ! Ground = all except buildings (exclude snow at the moment)
620 zground = 0
621 kground = 0
622 rground = 0
623 DO iv = 1, nsurf
624 IF (iv /= bldgsurf .AND. fground /= 0) THEN !Bldgs surface excluded from ground facet
625 zground = zground + zsurf_suewssurfs(:, iv)*sfr_surf(iv)/fground !Normalised by ground fraction
626 kground = kground + ksurf_suewssurfs(:, iv)*sfr_surf(iv)/fground !Normalised by ground fraction
627 rground = rground + rsurf_suewssurfs(:, iv)*sfr_surf(iv)/fground !Normalised by ground fraction
628 ELSEIF (fground == 0.) THEN !check fground==0 (or HW==0) scenario to avoid division-by-zero error, TS 21 Jul 2016
629 zground = zground + 0.01
630 kground = kground + 0.01
631 rground = rground + 0.01
632 ! PRINT*, zground
633 ! PRINT*, kground
634 ! PRINT*, rground
635 END IF
636 END DO
637 ! Roof = buildings
641
642 ! the following initialisation is problematic: TS 01 Mar 2019
643 ! what would happen if zground(5)>0? Nground is initialised NOWHERE!
644 ! initialise these variables as 5 so if z_sfc(5)>0 happens, the numbers are still correct, TS 06 Aug 2019
645 ndepth_ground = 5
646 ndepth_roof = 5
647 ndepth_wall = 5
648 ndepth_ibld = 5
649 DO i = 1, 5
650 IF (zground(i) <= 0) THEN
651 ndepth_ground = i - 1
652 EXIT
653 END IF
654 END DO
655 DO i = 1, 5
656 IF (zroof(i) <= 0) THEN
657 ndepth_roof = i - 1
658 EXIT
659 END IF
660 END DO
661 DO i = 1, 5
662 IF (zwall(i) <= 0) THEN
663 ndepth_wall = i - 1
664 EXIT
665 END IF
666 END DO
667 DO i = 1, 5
668 IF (zibld(i) <= 0) THEN
669 ndepth_ibld = i - 1
670 EXIT
671 END IF
672 END DO
673 END IF ! ESTM related translation finished here.
674
675 ! ---- AnOHM related ------------------------------
676 IF (storageheatmethod == 3) THEN
677 cpanohm(1:nsurf) = surfacechar(gridiv, c_cpanohm) ! AnOHM TS
678 kkanohm(1:nsurf) = surfacechar(gridiv, c_kkanohm) ! AnOHM TS
679 chanohm(1:nsurf) = surfacechar(gridiv, c_chanohm) ! AnOHM TS
680
681 ! cp and k are estimated from ESTM coefficients:
682 ! cpAnOHM(1:nsurf)=rSurf_SUEWSsurfs(1,1:nsurf)
683 ! kkAnOHM(1:nsurf)=kSurf_SUEWSsurfs(1,1:nsurf)
684 ! IF ( ir ==1 .AND. iMb ==1) THEN
685 ! PRINT*, 'StoreDrainPrm',PavSurf,':'
686 ! PRINT'(a10,x,5f10.2)', 'Depth',zSurf_SUEWSsurfs(:,i)
687 ! PRINT'(a10,x,5es10.2)', 'RhoCp',rSurf_SUEWSsurfs(:,i)
688 ! PRINT'(a10,x,5es10.2)', 'avg_RhoCp',cpAnOHM(i)
689 ! PRINT'(a10,x,5es10.2)', 'k',kSurf_SUEWSsurfs(:,i)
690 ! PRINT'(a10,x,5es10.2)', 'avg_k',kkAnOHM(i)
691 ! PRINT'(a10,x,5es10.2)', 'avg_Ch',chAnOHM(i)
692 !
693 ! END IF
694 ! DO i = 1, nsurf, 1
695 ! ! filter out invalid z values
696 ! WHERE ( zSurf_SUEWSsurfs(:,i) == -999. ) zSurf_SUEWSsurfs(:,i)=0
697 !
698 ! ! cp: weight-averaged by depth
699 ! cpAnOHM(i)=DOT_PRODUCT(rSurf_SUEWSsurfs(:,i),zSurf_SUEWSsurfs(:,i))/SUM(zSurf_SUEWSsurfs(:,i))
700 ! ! IF ( i==PavSurf .AND. ir ==1 .AND. iMb ==1) THEN
701 ! ! PRINT*, 'StoreDrainPrm',i,':'
702 ! ! PRINT'(a10,x,5f10.2)', 'Depth',zSurf_SUEWSsurfs(:,i)
703 ! ! PRINT'(a10,x,5es10.2)', 'RhoCp',rSurf_SUEWSsurfs(:,i)
704 ! ! PRINT'(a10,x,5es10.2)', 'avg_RhoCp',cpAnOHM(i)
705 ! !
706 ! ! END IF
707 !
708 ! ! 1/k: weight-averaged by depth
709 ! kkAnOHM(i)=DOT_PRODUCT(1/kSurf_SUEWSsurfs(:,i),zSurf_SUEWSsurfs(:,i))/SUM(zSurf_SUEWSsurfs(:,i))
710 ! kkAnOHM(i)=1/kkAnOHM(i)
711 ! ! IF ( i==PavSurf .AND. ir ==1 .AND. iMb ==1) THEN
712 ! ! PRINT'(a10,x,5es10.2)', 'k',kSurf_SUEWSsurfs(:,i)
713 ! ! PRINT'(a10,x,5es10.2)', 'avg_k',kkAnOHM(i)
714 ! ! PRINT'(a10,x,5es10.2)', 'avg_Ch',chAnOHM(i)
715 ! !
716 ! ! PRINT'(a10,x,7f10.2)', 'fractions:',sfr_surf
717 ! !
718 ! ! END IF
719 !
720 !
721 ! ! restore invalid z values
722 ! WHERE ( zSurf_SUEWSsurfs(:,i) == 0 ) zSurf_SUEWSsurfs(:,i)=nan
723 ! ! IF ( i==PavSurf .AND. ir ==1 .AND. iMb ==1) THEN
724 ! ! PRINT'(a10,x,5f10.2)', 'Depth',zSurf_SUEWSsurfs(:,i)
725 ! ! PRINT*, '*****************'
726 ! ! END IF
727 !
728 ! END DO
729 END IF
730
731! ---- ESTM_ext related ------------------------------
732 IF (storageheatmethod == 5 .OR. netradiationmethod > 1000) THEN
733
734 nlayer = nlayer_grids(gridiv)
735
736 ALLOCATE (height(nlayer + 1)) ! why such dimension? why plus ncol?
737 ALLOCATE (building_frac(nlayer))
738 ALLOCATE (veg_frac(nlayer))
739 ALLOCATE (building_scale(nlayer))
740 ALLOCATE (veg_scale(nlayer))
741 ! ALLOCATE (veg_ext(nlayer))
742 ! ALLOCATE (veg_fsd(nlayer))
743 ! ALLOCATE (veg_contact_fraction(nlayer))
744 height = height_grids(gridiv, :)
746 veg_frac = veg_frac_grids(gridiv, :)
748 veg_scale = veg_scale_grids(gridiv, :)
749 ! veg_ext = veg_ext_grids(Gridiv, :)
750 ! veg_fsd = veg_fsd_grids(Gridiv, :)
751
752 ! roof
753 ALLOCATE (sfr_roof(nlayer))
754 ALLOCATE (tsfc_roof(nlayer))
755 ALLOCATE (alb_roof(nlayer))
756 ALLOCATE (emis_roof(nlayer))
757 ALLOCATE (state_roof(nlayer))
758 ALLOCATE (statelimit_roof(nlayer))
759 ALLOCATE (wetthresh_roof(nlayer))
760 ALLOCATE (soilstore_roof(nlayer))
761 ALLOCATE (soilstorecap_roof(nlayer))
763 ALLOCATE (k_roof(nlayer, ndepth))
764 ALLOCATE (cp_roof(nlayer, ndepth))
765 ALLOCATE (dz_roof(nlayer, ndepth))
766 ALLOCATE (tin_roof(nlayer))
767 ALLOCATE (temp_roof(nlayer, ndepth))
768
769 sfr_roof = sfr_roof_grids(gridiv, :)
770 tsfc_roof = tsfc_roof_grids(gridiv, :)
771 alb_roof = alb_roof_grids(gridiv, :)
772 emis_roof = emis_roof_grids(gridiv, :)
773 state_roof = state_roof_grids(gridiv, :)
779
780 dz_roof(1:nlayer, 1:ndepth) = dz_roof_grids(gridiv, 1:nlayer, 1:ndepth)
781 k_roof(1:nlayer, 1:ndepth) = k_roof_grids(gridiv, 1:nlayer, 1:ndepth)
782 ! PRINT *, 'dz_roof in translate:', dz_roof(1:nroof, 1:ndepth)
783 cp_roof(1:nlayer, 1:ndepth) = cp_roof_grids(gridiv, 1:nlayer, 1:ndepth)
784 tin_roof(1:nlayer) = tin_roof_grids(gridiv, 1:nlayer)
785 temp_roof(1:nlayer, 1:ndepth) = temp_roof_grids(gridiv, 1:nlayer, 1:ndepth)
786
787 ! wall
788 ALLOCATE (sfr_wall(nlayer))
789 ALLOCATE (tsfc_wall(nlayer))
790 ALLOCATE (k_wall(nlayer, ndepth))
791 ALLOCATE (cp_wall(nlayer, ndepth))
792 ALLOCATE (dz_wall(nlayer, ndepth))
793 ALLOCATE (tin_wall(nlayer))
794 ALLOCATE (temp_wall(nlayer, ndepth))
795 ALLOCATE (alb_wall(nlayer))
796 ALLOCATE (emis_wall(nlayer))
797 ALLOCATE (state_wall(nlayer))
798 ALLOCATE (statelimit_wall(nlayer))
799 ALLOCATE (wetthresh_wall(nlayer))
800 ALLOCATE (soilstore_wall(nlayer))
801 ALLOCATE (soilstorecap_wall(nlayer))
802 ALLOCATE (wall_specular_frac(nspec, nlayer))
803
804 ! veg_contact_fraction = veg_contact_fraction_grids(Gridiv, :)
805
806 sfr_wall = sfr_wall_grids(gridiv, :)
807 tsfc_wall = tsfc_wall_grids(gridiv, :)
808 alb_wall = alb_wall_grids(gridiv, :)
809 emis_wall = emis_wall_grids(gridiv, :)
810 state_wall = state_wall_grids(gridiv, :)
816
817 dz_wall(1:nlayer, 1:ndepth) = dz_wall_grids(gridiv, 1:nlayer, 1:ndepth)
818 k_wall(1:nlayer, 1:ndepth) = k_wall_grids(gridiv, 1:nlayer, 1:ndepth)
819 cp_wall(1:nlayer, 1:ndepth) = cp_wall_grids(gridiv, 1:nlayer, 1:ndepth)
820 tin_wall(1:nlayer) = tin_wall_grids(gridiv, 1:nlayer)
821 temp_wall(1:nlayer, 1:ndepth) = temp_wall_grids(gridiv, 1:nlayer, 1:ndepth)
822
823 ! TODO: these need to be updated; ESTM coupling work
824 ! standard suews surfaces
825 ALLOCATE (tin_surf(nsurf))
826 ALLOCATE (dz_surf(nsurf, ndepth))
827 ALLOCATE (k_surf(nsurf, ndepth))
828 ALLOCATE (cp_surf(nsurf, ndepth))
829 ALLOCATE (temp_surf(nsurf, ndepth))
830 tin_surf(1:nsurf) = tin_surf_grids(gridiv, 1:nsurf)
831 dz_surf(1:nsurf, 1:ndepth) = dz_surf_grids(gridiv, 1:nsurf, 1:ndepth)
832 k_surf(1:nsurf, 1:ndepth) = k_surf_grids(gridiv, 1:nsurf, 1:ndepth)
833 cp_surf(1:nsurf, 1:ndepth) = cp_surf_grids(gridiv, 1:nsurf, 1:ndepth)
834 temp_surf(1:nsurf, 1:ndepth) = temp_surf_grids(gridiv, 1:nsurf, 1:ndepth)
835 END IF
836 ALLOCATE (tsfc_surf(nsurf))
837 tsfc_surf(1:nsurf) = tsfc_surf_grids(gridiv, 1:nsurf)
838 ! ---- QF coeffs (was in SUEWS_SAHP.f95, subroutine SAHP_Coefs)
839 baset_hc = -999 ! Initialise QF coeffs
840 qf_a = 0
841 qf_b = 0
842 qf_c = 0
843 ah_min = 0
844 baset_heating = 0
845 baset_cooling = 0
848
850 qf_a = surfacechar(gridiv, (/c_qf_a1, c_qf_a2/))
851 qf_b = surfacechar(gridiv, (/c_qf_b1, c_qf_b2/))
852 qf_c = surfacechar(gridiv, (/c_qf_c1, c_qf_c2/))
860 co2mwd = surfacechar(gridiv, c_co2mwd)
861 co2mwe = surfacechar(gridiv, c_co2mwe)
877
878 ! ---- Irrigation
879 ie_start = int(surfacechar(gridiv, c_iestart))
880 ie_end = int(surfacechar(gridiv, c_ieend))
882 faut = surfacechar(gridiv, c_faut)
883 h_maintain = surfacechar(gridiv, c_h_maintain) !Automatic irrigation model coefficients [mm d-1]; [mm d-1 degC-1]; [mm d-2]
884 ie_a = surfacechar(gridiv, c_ie_a) !Automatic irrigation model coefficients [mm d-1]; [mm d-1 degC-1]; [mm d-2]
885 ie_m = surfacechar(gridiv, c_ie_m) !Manual irrigation model coefficients [mm d-1]; [mm d-1 degC-1]; [mm d-2]
886 daywat = surfacechar(gridiv, c_daywat)
888
889 ! ---- Hourly profiles
890 ahprof_24hr(0:23, 1) = surfacechar(gridiv, c_hrprofenusewd) ! Anthropogenic heat, weekdays
891 ahprof_24hr(0:23, 2) = surfacechar(gridiv, c_hrprofenusewe) ! Anthropogenic heat, weekends
892 wuprofm_24hr(0:23, 1) = surfacechar(gridiv, c_hrprofwumanuwd) ! Water use, manual, weekdays
893 wuprofm_24hr(0:23, 2) = surfacechar(gridiv, c_hrprofwumanuwe) ! Water use, manual, weekends
894 wuprofa_24hr(0:23, 1) = surfacechar(gridiv, c_hrprofwuautowd) ! Water use, automatic, weekdays
895 wuprofa_24hr(0:23, 2) = surfacechar(gridiv, c_hrprofwuautowe) ! Water use, automatic, weekends
896 snowprof_24hr(0:23, 1) = surfacechar(gridiv, c_hrprofsnowcwd) ! Snow clearing, weekdays
897 snowprof_24hr(0:23, 2) = surfacechar(gridiv, c_hrprofsnowcwe) ! Snow clearing, weekends
898 humactivity_24hr(0:23, 1) = surfacechar(gridiv, c_hrprofhumactivitywd) ! Human activity, weekdays
899 humactivity_24hr(0:23, 2) = surfacechar(gridiv, c_hrprofhumactivitywe) ! Human activity, weekends
900 traffprof_24hr(0:23, 1) = surfacechar(gridiv, c_hrproftraffwd) ! Traffic, weekdays
901 traffprof_24hr(0:23, 2) = surfacechar(gridiv, c_hrproftraffwe) ! Traffic, weekends
902 popprof_24hr(0:23, 1) = surfacechar(gridiv, c_hrprofpopwd) ! Population, weekdays
903 popprof_24hr(0:23, 2) = surfacechar(gridiv, c_hrprofpopwe) ! Population, weekends
904
905 ! ---- Profiles at the resolution of model time step
906 ! AHProf_tstep(:,1) = TstepProfiles(Gridiv,cTP_EnUseWD,:) ! Anthropogenic heat, weekdays
907 ! AHProf_tstep(:,2) = TstepProfiles(Gridiv,cTP_EnUseWE,:) ! Anthropogenic heat, weekends
908 ! WUProfM_tstep(:,1) = TstepProfiles(Gridiv,cTP_WUManuWD,:) ! Water use, manual, weekdays
909 ! WUProfM_tstep(:,2) = TstepProfiles(Gridiv,cTP_WUManuWE,:) ! Water use, manual, weekends
910 ! WUProfA_tstep(:,1) = TstepProfiles(Gridiv,cTP_WUAutoWD,:) ! Water use, automatic, weekdays
911 ! WUProfA_tstep(:,2) = TstepProfiles(Gridiv,cTP_WUAutoWE,:) ! Water use, automatic, weekends
912 ! HumActivity_tstep(:,1) = TstepProfiles(Gridiv,cTP_HumActivityWD,:) ! Human activity, weekdays
913 ! HumActivity_tstep(:,2) = TstepProfiles(Gridiv,cTP_HumActivityWE,:) ! Human activity, weekends
914 ! TraffProf_tstep(:,1) = TstepProfiles(Gridiv,cTP_TraffProfWD,:) !Traffic, weekdays
915 ! TraffProf_tstep(:,2) = TstepProfiles(Gridiv,cTP_TraffProfWE,:) !Traffic, weekends
916 ! PopProf_tstep(:,1) = TstepProfiles(Gridiv,cTP_PopProfWD,:) !Population, weekdays
917 ! PopProf_tstep(:,2) = TstepProfiles(Gridiv,cTP_PopProfWE,:) !Population, weekends
918
919 ! ---- Within-grid water distribution
920 ! N.B. Rows and columns of WaterDist are the other way round to the input info
921 !! Model currently does not include above-ground flow from the Water surface
922 !! - Probably should adjust WaterDist to have nsurf columns so that Water can behave like the other surfaces.
923 ! Model returns an error if both ToRunoff and ToSoilStore are non-zero (in CodeMatchDist)
924 ! For impervious surfaces, water goes to runoff; for pervious surfaces, water goes to soilstore
925 waterdist(pavsurf, 1:(nsurf - 1)) = surfacechar(gridiv, c_wgtopaved(1:(nsurf - 1)))
926 waterdist(bldgsurf, 1:(nsurf - 1)) = surfacechar(gridiv, c_wgtobldgs(1:(nsurf - 1)))
927 waterdist(conifsurf, 1:(nsurf - 1)) = surfacechar(gridiv, c_wgtoevetr(1:(nsurf - 1)))
928 waterdist(decidsurf, 1:(nsurf - 1)) = surfacechar(gridiv, c_wgtodectr(1:(nsurf - 1)))
929 waterdist(grasssurf, 1:(nsurf - 1)) = surfacechar(gridiv, c_wgtograss(1:(nsurf - 1)))
930 waterdist(bsoilsurf, 1:(nsurf - 1)) = surfacechar(gridiv, c_wgtobsoil(1:(nsurf - 1)))
931 waterdist(watersurf, 1:(nsurf - 1)) = surfacechar(gridiv, c_wgtowater(1:(nsurf - 1)))
932 ! Runoff or SoilStore row !!Change later to allow both Runoff and SoilStore
933 DO iv = 1, (nsurf - 1)
934 IF (surfacechar(gridiv, c_wgtorunoff(iv)) /= 0) THEN
935 waterdist((nsurf + 1), iv) = surfacechar(gridiv, c_wgtorunoff(iv))
936 ELSE
937 waterdist((nsurf + 1), iv) = surfacechar(gridiv, c_wgtosoilstore(iv))
938 END IF
939 END DO
940
941 ! Access required DailyState variables for the current grid (moved HCW 26 Jun 2015)
942 ! HDD(:,:) = HDD_grids(:,:,Gridiv)
943 ! GDD(:,:) = GDD_grids(:,:,Gridiv)
944 ! LAI(:,:) = LAI_grids(:,:,Gridiv)
945 ! WUDay(:,:) = WUDay_grids(:,:,Gridiv)
946 ! AlbDecTr(:) = AlbDecTr_grids(:,Gridiv)
947 ! DecidCap(:) = DecidCap_grids(:,Gridiv)
948 ! Porosity(:) = Porosity_grids(:,Gridiv)
949 ! AlbEveTr(:) = AlbEveTr_grids(:,Gridiv)
950 ! AlbGrass(:) = AlbGrass_grids(:,Gridiv)
951 ! SnowAlb = ModelDailyState(Gridiv, cMDS_SnowAlb)
952
953 !! ---- Between-grid water distribution
954!!! Need to make these larger than MaxNumberOfGrids (and recode), as each grid can have 8 connections
955 !!GridConnections(1,) = SurfaceChar(Gridiv,c_Grid)
956 !!GridConnectionsFrac() = SurfaceChar(Gridiv,55)
957 !!GridConnections(2,) = SurfaceChar(Gridiv,54)
958 !
959 !! Fraction of water from each grid
960!!! N.B. will need to check input files are correctly set up
961 !GridToFrac(1:NConns) = (SurfaceChar(Gridiv,55:69:2))
962 !! Grid where water goes to
963 !GridTo(1:NConns) = (SurfaceChar(Gridiv,54:68:2))
964 !! Come back to this later
965
966 ! =================================================================================
967
968 !-----------------------------------------------------
969 !-----------------------------------------------------
970 ! load snow related properties for NARP
971 IF (snowuse == 1) narp_emis_snow = surfacechar(gridiv, c_snowemis)
972 !NARP_CONFIGURATION if net radiation is to be modelled
973 IF (netradiationmethod > 0) THEN
974 narp_lat = surfacechar(gridiv, c_lat)
975 narp_long = surfacechar(gridiv, c_lng) ! New sun_position_v2 use degrees FL
976 narp_year = int(surfacechar(gridiv, c_year))
977 narp_tz = timezone !not every 5-min
979 !INTERVAL IS ONLY RELEVANT TO LUPCORR
980 !ALL OTHER CALCULATIONS ARE INTERVAL INDEPENDENT
981 !NB FOR INTERVALS LONGER THAN 15 MINUTES ERRORS IN KCLEAR WILL BE GREATER
982
983 ! Commented out HCW 04 Mar 2015
984 !NARP_NPERHOUR=MAX(3600/t_INTERVAL,1) !!Check this
985 !IF(ALLOCATED(NARP_KDOWN_HR)) DEALLOCATE(NARP_KDOWN_HR)
986 !ALLOCATE(NARP_KDOWN_HR(NARP_NPERHOUR))
987 !NARP_KDOWN_HR=0.
988
989 !IF (ldown_option==4.or.ldown_option==5) then !Added by LJ
990 ! INIITIALIZE SMITH DAY OF YEAR GRID G
991 ! NARP_G=SMITHLAMBDA(NINT(LAT))
992 !ENDIF
993 END IF
994
995 ! get qn memory for previous time steps: used in OHM calculations
996 dqndt = dqndt_grids(gridiv)
997 qn_av = qn_av_grids(gridiv)
998 tair_av = tair_av_grids(gridiv)
999
1000 IF (snowuse == 1) THEN
1001 dqnsdt = dqnsdt_grids(gridiv)
1002 qn_s_av = qn_s_av_grids(gridiv)
1003 END IF
1004
1005 !=================================================================================
1006 ! When SUEWS_Translate is called from InitialState (ir=0), inputs need translating
1007 IF (ir == 0) THEN
1008 !write(*,*) 'This should be seen only when called from InitialState and ir is 0. ir:',ir
1009
1010 ! =============================================================================
1011 ! === Translate inputs from ModelDailyState to variable names used in model ===
1012 ! =============================================================================
1013
1014 ! Get id_prev from ModelDailyState
1015 id_prev = int(modeldailystate(gridiv, cmds_id_prev))
1016
1019
1025
1031
1032 ! ---- Phenology
1033 ! ---- LAI
1034 lai_id = 0
1038
1039 ! GDD_id: GDD Values for one day
1041 ! SDD_id: SDD Values for one day
1043 ! Tmin, Tmax: daily minimum and maximum temperatures
1046 ! length of daylight
1047 lenday_id = 0
1048
1049 ! ---- Heating degree days, HDD
1050 ! HDD = 0
1051 ! HDD(id_prev,1) = ModelDailyState(Gridiv,cMDS_HDD1) ! 1 = Heating
1052 ! HDD(id_prev,2) = ModelDailyState(Gridiv,cMDS_HDD2) ! 2 = Cooling
1053 ! HDD(id_prev-3,3) = ModelDailyState(Gridiv,cMDS_TempCOld3) ! 3 will become average
1054 ! HDD(id_prev-2,3) = ModelDailyState(Gridiv,cMDS_TempCOld2)
1055 ! HDD(id_prev-1,3) = ModelDailyState(Gridiv,cMDS_TempCOld1)
1056 ! HDD(id_prev,3) = ModelDailyState(Gridiv,cMDS_TempC)
1057 ! 4 = 5 day running mean
1058 ! 5 = daily precip total
1059 ! HDD(id_prev,6) = ModelDailyState(Gridiv,cMDS_DaysSinceRain) ! 6 = days since rain
1060
1061 ! ---- Heating degree days, HDD_id: HDD Values for one day
1062 hdd_id(1:6) = 0
1063
1064 ! HDD_id(1)=ModelDailyState(Gridiv,cMDS_HDD1)
1065 ! HDD_id(2)=ModelDailyState(Gridiv,cMDS_HDD2)
1066 ! HDD_id(3)=ModelDailyState(Gridiv,cMDS_TempC)
1067 ! ! 4 = 5 day running mean
1068 ! ! 5 = daily precip total
1069 ! HDD_id(6) = ModelDailyState(Gridiv,cMDS_DaysSinceRain)
1070
1071 ! Save required DailyState variables for the current grid (HCW 27 Nov 2014)
1072 hdd_id_grids(:, gridiv) = hdd_id(:)
1073 gdd_id_grids(:, gridiv) = gdd_id(:)
1074 sdd_id_grids(:, gridiv) = sdd_id(:)
1075 tmin_id_grids(gridiv) = tmin_id
1076 tmax_id_grids(gridiv) = tmax_id
1077 lenday_id_grids(gridiv) = lenday_id
1078 lai_id_grids(:, gridiv) = lai_id(:)
1079
1080 ! daily water use
1081 wuday_id = 0
1082 wuday_id_grids(:, gridiv) = wuday_id(:)
1083
1084 ! AlbDecTr_grids(:,Gridiv) = AlbDecTr(:)
1085 ! AlbEveTr_grids(:,Gridiv) = AlbEveTr(:)
1086 ! AlbGrass_grids(:,Gridiv) = AlbGrass(:)
1087 ! DecidCap_grids(:,Gridiv) = DecidCap(:)
1088 ! Porosity_grids(:,Gridiv) = Porosity(:)
1089
1090 ! ---- Snow density of each surface
1092
1093 ! =============================================================================
1094 ! === Translate inputs from ModelOutputData to variable names used in model ===
1095 ! =============================================================================
1096 ! ---- Above-ground state
1097 state_surf(1:nsurf) = modeloutputdata(0, cmod_state(1:nsurf), gridiv)
1098 ! stateDay(0,Gridiv,1:nsurf) = ModelOutputData(0,cMOD_State(1:nsurf),Gridiv)
1099 ! ---- Below-ground
1101 ! soilmoistDay(0,Gridiv,1:nsurf) = ModelOutputData(0,cMOD_SoilState(1:nsurf),Gridiv)
1102 ! ---- Snow fraction
1104 ! ---- Snow water equivalent in SnowPack
1106 ! ---- Liquid (melted) water in SnowPack
1108
1109 END IF !ir = 0
1110 !=================================================================================
1111
1112 !=========================== Write FileChoices.txt ===============================
1113 !=================================================================================
1114 ! Do once per grid per year (was in SUEWS_Initial.f95)
1115 IF (ir == 1 .AND. imb == 1) THEN !For first row of first block only
1116 !write(*,*) 'Writing to FileChoices for first chunk of met data per year per grid'
1117 filechoices = trim(fileoutputpath)//trim(filecode)//'_FileChoices.txt'
1118 OPEN (12, file=filechoices, position='append')
1119
1120 WRITE (grid_txt, '(I5)') int(surfacechar(gridiv, c_grid))
1121 WRITE (year_txt, '(I4)') int(surfacechar(gridiv, c_year))
1122 WRITE (ssg_yyyy, '(A12)') trim(filecode)//trim(adjustl(grid_txt))//'_'//trim(adjustl(year_txt))
1123
1124 !write(12,*) '--------------------------------------------------------------------------------'
1125 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Surface characteristics'//' -----'
1126 ! Characteristics that apply to some or all surface types
1127 WRITE (12, '(8a10,a16)') 'Paved', 'Bldgs', 'EveTr', 'DecTr', 'Grass', 'BSoil', 'Water', 'Snow', ' SurfType'
1128 WRITE (12, 120) (sfr_surf(iv), iv=1, nsurf), fcskip, ' SurfFr'
1129 WRITE (12, 120) fcskip, fcskip, irrfracevetr, irrfracdectr, irrfracgrass, fcskip, fcskip, fcskip, ' IrrFr'
1130 WRITE (12, 120) fcskip, fcskip, wuareaevetr_m2, wuareadectr_m2, wuareagrass_m2, fcskip, fcskip, fcskip, ' WaterUseArea'
1131 WRITE (12, 120) fcskip, bldgh, evetreeh, dectreeh, fcskip, fcskip, fcskip, fcskip, ' H'
1132 WRITE (12, 120) fcskip, faibldg, faievetree, faidectree, fcskip, fcskip, fcskip, fcskip, ' FAI'
1133 WRITE (12, 120) fcskip, fcskip, albmin_evetr, albmin_dectr, albmin_grass, fcskip, fcskip, snowalbmin, ' AlbedoMin'
1134 WRITE (12, 120) fcskip, fcskip, albmax_evetr, albmax_dectr, albmax_grass, fcskip, fcskip, snowalbmax, ' AlbedoMax'
1135 !write(12,120) (alb(iv),iv=1,nsurf),SnowAlb, ' Albedo' ! This is instantaneous value (not provided as input)
1136 WRITE (12, 120) (emis(iv), iv=1, nsurf), emis_snow, ' Emissivity'
1137 WRITE (12, 120) fcskip, fcskip, (baset(iv), iv=1, nvegsurf), fcskip, fcskip, fcskip, ' BaseT'
1138 WRITE (12, 120) fcskip, fcskip, (basete(iv), iv=1, nvegsurf), fcskip, fcskip, fcskip, ' BaseTe'
1139 WRITE (12, 120) (storedrainprm(1, iv), iv=1, nsurf), fcskip, ' StorageMin'
1140 WRITE (12, 120) (storedrainprm(5, iv), iv=1, nsurf), fcskip, ' StorageMax'
1141 WRITE (12, 120) (wetthresh_surf(iv), iv=1, nsurf), fcskip, ' WetThreshold'
1142 WRITE (12, 120) (statelimit_surf(iv), iv=1, nsurf), fcskip, ' StateLimit'
1143 WRITE (12, 120) (storedrainprm(2, iv), iv=1, nsurf), fcskip, ' DrainageEq' !real
1144 WRITE (12, 120) (storedrainprm(3, iv), iv=1, nsurf), fcskip, ' DrainageCoef1'
1145 WRITE (12, 120) (storedrainprm(4, iv), iv=1, nsurf), fcskip, ' DrainageCoef2'
1146 WRITE (12, 120) fcskip, fcskip, (gddfull(iv), iv=1, nvegsurf), fcskip, fcskip, fcskip, ' GDDFull'
1147 WRITE (12, 120) fcskip, fcskip, (sddfull(iv), iv=1, nvegsurf), fcskip, fcskip, fcskip, ' SDDFull'
1148 WRITE (12, 120) fcskip, fcskip, (laimin(iv), iv=1, nvegsurf), fcskip, fcskip, fcskip, ' LAIMin'
1149 WRITE (12, 120) fcskip, fcskip, (laimax(iv), iv=1, nvegsurf), fcskip, fcskip, fcskip, ' LAIMax'
1150 WRITE (12, 120) fcskip, fcskip, fcskip, pormin_dec, fcskip, fcskip, fcskip, fcskip, ' PorosityMin'
1151 WRITE (12, 120) fcskip, fcskip, fcskip, pormax_dec, fcskip, fcskip, fcskip, fcskip, ' PorosityMax'
1152 WRITE (12, '(2f10.3,3i10, 3f10.3,a16)') fcskip, fcskip, laitype(1:nvegsurf), fcskip, fcskip, fcskip, ' LAIEq' !integer
1153 WRITE (12, '(2f10.3,3f10.5,3f10.3,a16)') fcskip, fcskip, laipower(1, 1:nvegsurf), fcskip, fcskip, fcskip, ' LAI_LeafGP1'
1154 WRITE (12, '(2f10.3,3f10.5,3f10.3,a16)') fcskip, fcskip, laipower(2, 1:nvegsurf), fcskip, fcskip, fcskip, ' LAI_LeafGP2'
1155 WRITE (12, '(2f10.3,3f10.5,3f10.3,a16)') fcskip, fcskip, laipower(3, 1:nvegsurf), fcskip, fcskip, fcskip, ' LAI_LeafOP1'
1156 WRITE (12, '(2f10.3,3f10.5,3f10.3,a16)') fcskip, fcskip, laipower(4, 1:nvegsurf), fcskip, fcskip, fcskip, ' LAI_LeafOP2'
1157 WRITE (12, 120) fcskip, fcskip, (maxconductance(iv), iv=1, nvegsurf), fcskip, fcskip, fcskip, ' MaxCond'
1158 WRITE (12, 120) (soildepth(iv), iv=1, (nsurf - 1)), fcskip, fcskip, ' SoilDepth'
1159 WRITE (12, 120) (soilstorecap_surf(iv), iv=1, (nsurf - 1)), fcskip, fcskip, ' SoilStoreCap'
1160 WRITE (12, '(6f10.5,2f10.3,a16)') (sathydraulicconduct(iv), iv=1, (nsurf - 1)), fcskip, fcskip, ' SatHydraulicConduct'
1161 ! Not currently coded, but add these later: SoilDensity, InfiltrationRate, OBS_SMDept, OBS_SMCap, OBS_SoilNotRocks
1162 WRITE (12, 120) (snowpacklimit(iv), iv=1, (nsurf - 1)), fcskip, fcskip, ' SnowLimPatch'
1163 WRITE (12, 120) snowlimpaved, snowlimbldg, fcskip, fcskip, fcskip, fcskip, fcskip, fcskip, ' SnowLimRemove'
1164 WRITE (12, 120) (ohm_coef(1:nsurf, 1, 1)), ohm_coef(nsurf + 1, 1, 1), ' OHM_a1_Sum_Wet'
1165 WRITE (12, 120) (ohm_coef(1:nsurf, 2, 1)), ohm_coef(nsurf + 1, 2, 1), ' OHM_a1_Sum_Dry'
1166 WRITE (12, 120) (ohm_coef(1:nsurf, 3, 1)), ohm_coef(nsurf + 1, 3, 1), ' OHM_a1_Win_Wet'
1167 WRITE (12, 120) (ohm_coef(1:nsurf, 4, 1)), ohm_coef(nsurf + 1, 4, 1), ' OHM_a1_Win_Dry'
1168 WRITE (12, 120) (ohm_coef(1:nsurf, 1, 2)), ohm_coef(nsurf + 1, 1, 2), ' OHM_a2_Sum_Wet'
1169 WRITE (12, 120) (ohm_coef(1:nsurf, 2, 2)), ohm_coef(nsurf + 1, 2, 2), ' OHM_a2_Sum_Dry'
1170 WRITE (12, 120) (ohm_coef(1:nsurf, 3, 2)), ohm_coef(nsurf + 1, 3, 2), ' OHM_a2_Win_Wet'
1171 WRITE (12, 120) (ohm_coef(1:nsurf, 4, 2)), ohm_coef(nsurf + 1, 4, 2), ' OHM_a2_Win_Dry'
1172 WRITE (12, 120) (ohm_coef(1:nsurf, 1, 3)), ohm_coef(nsurf + 1, 1, 3), ' OHM_a3_Sum_Wet'
1173 WRITE (12, 120) (ohm_coef(1:nsurf, 2, 3)), ohm_coef(nsurf + 1, 2, 3), ' OHM_a3_Sum_Dry'
1174 WRITE (12, 120) (ohm_coef(1:nsurf, 3, 3)), ohm_coef(nsurf + 1, 3, 3), ' OHM_a3_Win_Wet'
1175 WRITE (12, 120) (ohm_coef(1:nsurf, 4, 3)), ohm_coef(nsurf + 1, 4, 3), ' OHM_a3_Win_Dry'
1176 WRITE (12, 120) (ohm_threshsw(1:nsurf)), ohm_threshsw(nsurf + 1), ' OHMthreshold_SW'
1177 WRITE (12, 120) (ohm_threshwd(1:nsurf)), ohm_threshwd(nsurf + 1), ' OHMthreshold_WD'
1178
1179 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Snow parameters'//' -----'
1180 WRITE (12, '(a12,11a10)') 'Grid', 'RadMeltF', 'TempMeltF', 'tau_a', 'tau_f', 'PLimAlb', 'SDensMin', 'SDensMax', &
1181 'tau_r', 'CRWMin', 'CRWMax', 'PLimSnow'
1182 WRITE (12, '(a12,11f10.4)') ssg_yyyy, radmeltfact, tempmeltfact, tau_a, tau_f, preciplimitalb, snowdensmin, snowdensmax, &
1184
1185 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Conductance parameters'//' -----'
1186 WRITE (12, '(a12,12a10)') 'Grid', 'G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'TH', 'TL', 'S1', 'S2', 'Kmax', 'gsModel'
1187 WRITE (12, '(a12,11f10.3,i3)') ssg_yyyy, g1, g2, g3, g4, g5, g6, th, tl, s1, s2, kmax, gsmodel
1188
1189 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Energy-use parameters'//' -----'
1190 WRITE (12, '(a12,11a10)') 'Grid', 'PopDensDaytime', 'BaseT_HC', 'QF_A_WD', 'QF_A_WE', 'QF_B_WD', 'QF_B_WE', 'QF_C_WD', &
1191 'QF_C_WE', 'AH_Min', 'AH_Slope', 'BaseT_Heating'
1192 WRITE (12, '(a12,11f10.3)') ssg_yyyy, popdensdaytime, baset_hc, qf_a(1:2), qf_b(1:2), qf_c(1:2), &
1194
1195 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Water-use parameters'//' -----'
1196 WRITE (12, '(a12,10a10)') 'Grid', 'IeStart', 'IeEnd', 'IntWatUse', 'Faut', &
1197 'Ie_a1', 'Ie_a2', 'Ie_a3', 'Ie_m1', 'Ie_m2', 'Ie_m3'
1198 WRITE (12, '(a12,2i10,8f10.3)') ssg_yyyy, ie_start, ie_end, internalwateruse_h, faut, &
1199 ie_a(1:3), ie_m(1:3)
1200
1201 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Weekly profiles'//' -----'
1202 WRITE (12, '(a12,7a10, a16)') 'Grid', '1_Sun', '2_Mon', '3_Tue', '4_Wed', '5_Thu', '6_Fri', '7_Sat', ' DayOfWeek'
1203 WRITE (12, '(a12,7f10.3,a16)') ssg_yyyy, daywat(1:7), ' Irr allowed'
1204 WRITE (12, '(a12,7f10.3,a16)') ssg_yyyy, daywatper(1:7), ' Frac properties'
1205
1206 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Hourly profiles'//' -----'
1207 WRITE (12, '(a12,24i10,a20)') 'Grid', (iv, iv=0, 23), 'HourOfDay'
1208 WRITE (12, 121) ssg_yyyy, ahprof_24hr(0:23, 1), ' Anthrop heat WD'
1209 WRITE (12, 121) ssg_yyyy, ahprof_24hr(0:23, 2), ' Anthrop heat WE'
1210 WRITE (12, 121) ssg_yyyy, wuprofm_24hr(0:23, 1), ' Manual water use WD'
1211 WRITE (12, 121) ssg_yyyy, wuprofm_24hr(0:23, 2), ' Manual water use WE'
1212 WRITE (12, 121) ssg_yyyy, wuprofa_24hr(0:23, 1), ' Auto. water use WD'
1213 WRITE (12, 121) ssg_yyyy, wuprofa_24hr(0:23, 2), ' Auto. water use WE'
1214 WRITE (12, 121) ssg_yyyy, snowprof_24hr(0:23, 1), ' Snow clearing WD'
1215 WRITE (12, 121) ssg_yyyy, snowprof_24hr(0:23, 2), ' Snow clearing WE'
1216
1217 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Within-grid water distribution'//' -----'
1218 WRITE (12, '(9a10)') 'ToPaved', 'ToBldgs', 'ToEveTr', 'ToDecTr', 'ToGrass', 'ToBSoil', 'ToWater', 'ToROorSS'
1219
1220 DO iv = 1, (nsurf - 1)
1221 WRITE (12, '(8f10.4)') (waterdist(j, iv), j=1, nsurf + 1)
1222 END DO
1223
1224 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Other parameters'//' -----'
1225 WRITE (12, '(a12,7a10)') 'Grid', 'FlowChange', 'ROToWater', 'PipeCap', & ! Water-related
1226 'DrRate', 'Cover', 'MaxRes', & ! LUMPS-related
1227 'Trans' ! NARP-related
1228 WRITE (12, '(a12,7f10.3)') ssg_yyyy, flowchange, runofftowater, pipecapacity, &
1231
1232 WRITE (12, *) '----- '//trim(adjustl(ssg_yyyy))//' Site parameters'//' -----'
1233 WRITE (12, '(a12,9a10)') &
1234 'Grid', 'lat', 'lon', 'tz', 'alt', 'SurfA_ha', 'z', 'PopDensNighttime', 'z0_input', 'zd_input', 'StartDLS', 'EndDLS'
1235 WRITE (12, '(a12,4f10.4,f10.2,4f10.4,2i10)') &
1236 ssg_yyyy, lat, lng*(-1.0), timezone, alt, surfacearea_ha, z, popdensnighttime, z0m_in, zdm_in, &
1237 startdls, enddls ! DayLightSavingDay(1:2)
1238
1239 WRITE (12, *) ''
1240
1241 CLOSE (12)
1242
1243 !==============================================================================
1244 ! Check input values are reasonable ===========================================
1245
1246 ! Coefficients for anthropogenic heat models ----------------------------------
1247 IF (emissionsmethod == 1) THEN !Loridan et al. (2011) calculation
1248 IF (ah_min(1) == 0 .AND. ah_slope_heating(1) == 0 .AND. baset_heating(1) == 0) THEN
1249 CALL errorhint(53, 'Check QF calculation coefficients.', notused, notused, emissionsmethod)
1250 END IF
1251
1252 ELSEIF (emissionsmethod == 2) THEN !Jarvi et al. (2011) calculation
1253 IF (sum(qf_a) == 0 .AND. sum(qf_b) == 0 .AND. sum(qf_c) == 0) THEN
1254 CALL errorhint(54, 'Check QF calculation coefficients.', notused, notused, emissionsmethod)
1255 END IF
1256 END IF
1257
1258 ! Morphometric parameters -----------------------------------------------------
1259 IF (roughlenmommethod == 1) THEN !z0, zd values provided in input file
1260 ! Check z0m and zd are reasonable
1261 IF (z0m < 0.00001) CALL errorhint(1, 'z0 value provided is very small (RoughLenMomMethod=1).', z0m, notused, gridid)
1262 IF (zdm < 0.00001) CALL errorhint(1, 'zd value provided is very small (RoughLenMomMethod=1).', zdm, notused, gridid)
1263 zzd = z - zdm
1264 ELSEIF (roughlenmommethod == 3) THEN !z0, zd calculated using FAI provided in input file
1265 ! Check FAIs reasonable
1266 IF (faibldg < 0) CALL errorhint(1, &
1267 'FAI_Bldgs value provided is very small (RoughLenMomMethod=3)', &
1269 IF (faitree < 0) CALL errorhint(1, &
1270 'FAI_EveTr/DecTr value provided is very small (RoughLenMomMethod=3)', &
1272 END IF
1273
1274 END IF !End for first row of first block only ===================================
1275
1276 !=================================================================================
1277 !For each row of the met forcing file (ir), translate correct info for each grid
1278 ! into model variables
1279 IF (ir > 0) THEN
1280 ! =============================================================================
1281 ! === Translate met data from MetForcingData to variable names used in model ==
1282 ! =============================================================================
1283 iy = int(metforcingdata(ir, 1, gridiv)) !Integer variables
1284 id = int(metforcingdata(ir, 2, gridiv))
1285 it = int(metforcingdata(ir, 3, gridiv))
1286 imin = int(metforcingdata(ir, 4, gridiv))
1287 isec = 0 ! NOT used by SUEWS but by WRF-SUEWS via the cal_main interface
1288 qn1_obs = metforcingdata(ir, 5, gridiv) !Real values (kind(1d0))
1289 qh_obs = metforcingdata(ir, 6, gridiv)
1290 qe_obs = metforcingdata(ir, 7, gridiv)
1291 qs_obs = metforcingdata(ir, 8, gridiv)
1292 qf_obs = metforcingdata(ir, 9, gridiv)
1293 avu1 = metforcingdata(ir, 10, gridiv)
1294 avrh = metforcingdata(ir, 11, gridiv)
1295 temp_c = metforcingdata(ir, 12, gridiv)
1296 press_hpa = metforcingdata(ir, 13, gridiv)
1297 precip = metforcingdata(ir, 14, gridiv)
1298 avkdn = metforcingdata(ir, 15, gridiv)
1299 snowfrac_obs = metforcingdata(ir, 16, gridiv)
1300 ldown_obs = metforcingdata(ir, 17, gridiv)
1301 fcld_obs = metforcingdata(ir, 18, gridiv)
1302 wu_m3 = metforcingdata(ir, 19, gridiv)
1303 xsmd = metforcingdata(ir, 20, gridiv)
1304 lai_obs = metforcingdata(ir, 21, gridiv)
1305 kdiff = metforcingdata(ir, 22, gridiv)
1306 kdir = metforcingdata(ir, 23, gridiv)
1307 wdir = metforcingdata(ir, 24, gridiv)
1308
1309 ! ! get qn memory for previous time steps: used in OHM calculations
1310 ! dqndt = dqndt_grids(Gridiv)
1311 ! qn_av = qn_av_grids(Gridiv)
1312 ! tair_av = tair_av_grids(Gridiv)
1313
1314 ! IF (SnowUse == 1) THEN
1315 ! dqnsdt = dqnsdt_grids(Gridiv)
1316 ! qn_s_av = qn_s_av_grids(Gridiv)
1317 ! END IF
1318
1319 ! added by TS 29 Jun 2018 to remove annual loops in main calculation
1320 gdd_id = gdd_id_grids(:, gridiv)
1321 sdd_id = sdd_id_grids(:, gridiv)
1322 tmin_id = tmin_id_grids(gridiv)
1323 tmax_id = tmax_id_grids(gridiv)
1324 lenday_id = lenday_id_grids(gridiv)
1325 hdd_id = hdd_id_grids(:, gridiv)
1326 lai_id = lai_id_grids(:, gridiv)
1327 wuday_id = wuday_id_grids(:, gridiv)
1328
1334
1335 ! get met array for one grid used in AnOHM
1336 metforcingdata_grid = metforcingdata(:, :, gridiv)
1337
1338 ! Calculate dectime
1339 dectime = real(id - 1, kind(1d0)) + real(it, kind(1d0))/24 + real(imin, kind(1d0))/(60*24)
1340 ! Create datetime stamp for error/warnings file
1341 WRITE (iy_text, '(i4)') iy
1342 WRITE (id_text, '(i3)') id
1343 WRITE (it_text, '(i2)') it
1344 WRITE (imin_text, '(i2)') imin
1345 ! datetime = TRIM(ADJUSTL(iy_text))//' '//TRIM(ADJUSTL(id_text))//' '//TRIM(ADJUSTL(it_text))//' '//TRIM(ADJUSTL(imin_text))
1346 WRITE (gridid_text, '(i10)') gridid
1347
1348 ! =============================================================================
1349 ! === Translate values from ModelDailyState to variable names used in model ===
1350 ! =============================================================================
1351 ! porosity(id) = ModelDailyState(Gridiv,cMDS_porosity)
1352 ! albDecTr(id) = ModelDailyState(Gridiv,cMDS_albDecTr)
1353 ! albEveTr(id) = ModelDailyState(Gridiv,cMDS_albEveTr)
1354 ! albGrass(id) = ModelDailyState(Gridiv,cMDS_albGrass)
1355 ! DecidCap(id) = ModelDailyState(Gridiv,cMDS_DecidCap)
1356
1357 ! SnowfallCum is instantaneous values and should be translated at each tstep, TS 17 Sep 2019
1359 ! ---- Snow density of each surface
1361 ! ---- Snow albedo
1363
1364 ! =============================================================================
1365 ! === Translate values from ModelOutputData to variable names used in model ===
1366 ! =============================================================================
1367 ! ---- Above-ground state
1368 state_surf(1:nsurf) = modeloutputdata(ir - 1, cmod_state(1:nsurf), gridiv)
1369 ! ---- Below-ground state
1371 ! ---- Snow fraction
1372 snowfrac(1:nsurf) = modeloutputdata(ir - 1, cmod_snowfrac(1:nsurf), gridiv)
1373 ! ---- Snow water equivalent in SnowPack
1374 snowpack(1:nsurf) = modeloutputdata(ir - 1, cmod_snowpack(1:nsurf), gridiv)
1375 ! ---- Liquid (melted) water in SnowPack
1377
1378 ! ---- ice fraction
1379 icefrac = icefrac_grids(:, gridiv)
1380
1381 !Also translate ESTM forcing data
1382 IF (storageheatmethod == 4 .OR. storageheatmethod == 14) THEN
1383 ! write(*,*) 'Translating ESTM forcing data'
1386 CALL estm_translate(gridiv)
1387 END IF
1388
1389 END IF !ir>0 !===================================================================
1390
1391 ! --------------------------------------------------------------------------------
1392 ! Check Initial Conditions are reasonable ----------------------------------------
1393 IF (ir == 1 .AND. imb == 1) THEN !For first row of first block only
1394 CALL checkinitial
1395 END IF
1396 ! --------------------------------------------------------------------------------
1397
1398 ! ======================================================================
1399 ! write out initial conditions for debugging supy
1400 IF (ir == 1 .AND. imb == 1) THEN
1401 filestateinit = trim(fileoutputpath)//trim(filecode)//trim(adjustl(grid_txt))//'_'//trim(adjustl(year_txt))//'_state_init.txt'
1402 OPEN (12, file=filestateinit, position='rewind')
1403
1404 WRITE (12, *) '&state_init'
1405 WRITE (12, *) 'aerodynamicresistancemethod=', aerodynamicresistancemethod
1406 WRITE (12, *) 'ah_min=', ah_min
1407 WRITE (12, *) 'ahprof_24hr=', ahprof_24hr
1408 WRITE (12, *) 'ah_slope_cooling=', ah_slope_cooling
1409 WRITE (12, *) 'ah_slope_heating=', ah_slope_heating
1410 WRITE (12, *) 'alb=', alb
1411 WRITE (12, *) 'albmax_dectr=', albmax_dectr
1412 WRITE (12, *) 'albmax_evetr=', albmax_evetr
1413 WRITE (12, *) 'albmax_grass=', albmax_grass
1414 WRITE (12, *) 'albmin_dectr=', albmin_dectr
1415 WRITE (12, *) 'albmin_evetr=', albmin_evetr
1416 WRITE (12, *) 'albmin_grass=', albmin_grass
1417 WRITE (12, *) 'alpha_bioco2=', alpha_bioco2
1418 WRITE (12, *) 'alpha_enh_bioco2=', alpha_enh_bioco2
1419 WRITE (12, *) 'alt=', alt
1420 WRITE (12, *) 'avkdn=', avkdn
1421 WRITE (12, *) 'avrh=', avrh
1422 WRITE (12, *) 'avu1=', avu1
1423 WRITE (12, *) 'baset=', baset
1424 WRITE (12, *) 'basete=', basete
1425 WRITE (12, *) 'BaseT_HC=', baset_hc
1426 WRITE (12, *) 'beta_bioco2=', beta_bioco2
1427 WRITE (12, *) 'beta_enh_bioco2=', beta_enh_bioco2
1428 WRITE (12, *) 'bldgh=', bldgh
1429 WRITE (12, *) 'capmax_dec=', capmax_dec
1430 WRITE (12, *) 'capmin_dec=', capmin_dec
1431 WRITE (12, *) 'chanohm=', chanohm
1432 WRITE (12, *) 'co2pointsource=', co2pointsource
1433 WRITE (12, *) 'cpanohm=', cpanohm
1434 WRITE (12, *) 'crwmax=', crwmax
1435 WRITE (12, *) 'crwmin=', crwmin
1436 WRITE (12, *) 'daywat=', daywat
1437 WRITE (12, *) 'daywatper=', daywatper
1438 WRITE (12, *) 'dectreeh=', dectreeh
1439 WRITE (12, *) 'diagnose=', diagnose
1440 WRITE (12, *) 'diagqn=', diagqn
1441 WRITE (12, *) 'diagqs=', diagqs
1442 WRITE (12, *) 'drainrt=', drainrt
1443 WRITE (12, *) 'dt_since_start=', dt_since_start
1444 WRITE (12, *) 'dqndt=', dqndt
1445 WRITE (12, *) 'qn_av=', qn_av
1446 WRITE (12, *) 'dqnsdt=', dqnsdt
1447 WRITE (12, *) 'qn_s_av=', qn_s_av
1448 WRITE (12, *) 'ef_umolco2perj=', ef_umolco2perj
1449 WRITE (12, *) 'emis=', emis
1450 WRITE (12, *) 'emissionsmethod=', emissionsmethod
1451 WRITE (12, *) 'enef_v_jkm=', enef_v_jkm
1452 WRITE (12, *) 'enddls=', enddls
1453 WRITE (12, *) 'evetreeh=', evetreeh
1454 WRITE (12, *) 'faibldg=', faibldg
1455 WRITE (12, *) 'faidectree=', faidectree
1456 WRITE (12, *) 'faievetree=', faievetree
1457 WRITE (12, *) 'faut=', faut
1458 WRITE (12, *) 'fcef_v_kgkm=', fcef_v_kgkm
1459 WRITE (12, *) 'fcld_obs=', fcld_obs
1460 WRITE (12, *) 'flowchange=', flowchange
1461 WRITE (12, *) 'frfossilfuel_heat=', frfossilfuel_heat
1462 WRITE (12, *) 'frfossilfuel_nonheat=', frfossilfuel_nonheat
1463 WRITE (12, *) 'g1=', g1
1464 WRITE (12, *) 'g2=', g2
1465 WRITE (12, *) 'g3=', g3
1466 WRITE (12, *) 'g4=', g4
1467 WRITE (12, *) 'g5=', g5
1468 WRITE (12, *) 'g6=', g6
1469 WRITE (12, *) 'gdd_id=', gdd_id
1470 WRITE (12, *) 'gddfull=', gddfull
1471 WRITE (12, *) 'gridiv=', gridiv
1472 WRITE (12, *) 'gsmodel=', gsmodel
1473 WRITE (12, *) 'hdd_id=', hdd_id
1474 WRITE (12, *) 'humactivity_24hr=', humactivity_24hr
1475 WRITE (12, *) 'icefrac=', icefrac
1476 WRITE (12, *) 'id=', id
1477 WRITE (12, *) 'ie_a=', ie_a
1478 WRITE (12, *) 'ie_end=', ie_end
1479 WRITE (12, *) 'ie_m=', ie_m
1480 WRITE (12, *) 'ie_start=', ie_start
1481 WRITE (12, *) 'imin=', imin
1482 WRITE (12, *) 'internalwateruse_h=', internalwateruse_h
1483 WRITE (12, *) 'IrrFracEveTr=', irrfracevetr
1484 WRITE (12, *) 'IrrFracDecTr=', irrfracdectr
1485 WRITE (12, *) 'irrfracgrass=', irrfracgrass
1486 WRITE (12, *) 'isec=', isec
1487 WRITE (12, *) 'it=', it
1488 WRITE (12, *) 'evapmethod=', evapmethod
1489 WRITE (12, *) 'iy=', iy
1490 WRITE (12, *) 'kkanohm=', kkanohm
1491 WRITE (12, *) 'kmax=', kmax
1492 WRITE (12, *) 'lai_id=', lai_id
1493 WRITE (12, *) 'laicalcyes=', laicalcyes
1494 WRITE (12, *) 'laimax=', laimax
1495 WRITE (12, *) 'laimin=', laimin
1496 WRITE (12, *) 'lai_obs=', lai_obs
1497 WRITE (12, *) 'laipower=', laipower
1498 WRITE (12, *) 'laitype=', laitype
1499 WRITE (12, *) 'lat=', lat
1500 WRITE (12, *) 'lenday_id=', lenday_id
1501 WRITE (12, *) 'ldown_obs=', ldown_obs
1502 WRITE (12, *) 'lng=', lng
1503 WRITE (12, *) 'maxconductance=', maxconductance
1504 WRITE (12, *) 'maxfcmetab=', maxfcmetab
1505 WRITE (12, *) 'maxqfmetab=', maxqfmetab
1506 WRITE (12, *) 'snowwater=', snowwater
1507 ! write (12, *) 'metforcingdata_grid=', metforcingdata_grid
1508 WRITE (12, *) 'minfcmetab=', minfcmetab
1509 WRITE (12, *) 'minqfmetab=', minqfmetab
1510 WRITE (12, *) 'min_res_bioco2=', min_res_bioco2
1511 WRITE (12, *) 'narp_emis_snow=', narp_emis_snow
1512 WRITE (12, *) 'narp_trans_site=', narp_trans_site
1513 WRITE (12, *) 'netradiationmethod=', netradiationmethod
1514 WRITE (12, *) 'ohm_coef=', ohm_coef
1515 WRITE (12, *) 'ohmincqf=', ohmincqf
1516 WRITE (12, *) 'ohm_threshsw=', ohm_threshsw
1517 WRITE (12, *) 'ohm_threshwd=', ohm_threshwd
1518 WRITE (12, *) 'pipecapacity=', pipecapacity
1519 WRITE (12, *) 'popdensdaytime=', popdensdaytime
1520 WRITE (12, *) 'popdensnighttime=', popdensnighttime
1521 WRITE (12, *) 'popprof_24hr=', popprof_24hr
1522 WRITE (12, *) 'pormax_dec=', pormax_dec
1523 WRITE (12, *) 'pormin_dec=', pormin_dec
1524 WRITE (12, *) 'precip=', precip
1525 WRITE (12, *) 'preciplimit=', preciplimit
1526 WRITE (12, *) 'preciplimitalb=', preciplimitalb
1527 WRITE (12, *) 'press_hpa=', press_hpa
1528 WRITE (12, *) 'qf0_beu=', qf0_beu
1529 WRITE (12, *) 'qf_a=', qf_a
1530 WRITE (12, *) 'qf_b=', qf_b
1531 WRITE (12, *) 'qf_c=', qf_c
1532 WRITE (12, *) 'qn1_obs=', qn1_obs
1533 WRITE (12, *) 'qh_obs=', qh_obs
1534 WRITE (12, *) 'qs_obs=', qs_obs
1535 WRITE (12, *) 'qf_obs=', qf_obs
1536 WRITE (12, *) 'radmeltfact=', radmeltfact
1537 WRITE (12, *) 'raincover=', raincover
1538 WRITE (12, *) 'rainmaxres=', rainmaxres
1539 WRITE (12, *) 'resp_a=', resp_a
1540 WRITE (12, *) 'resp_b=', resp_b
1541 WRITE (12, *) 'roughlenheatmethod=', roughlenheatmethod
1542 WRITE (12, *) 'roughlenmommethod=', roughlenmommethod
1543 WRITE (12, *) 'runofftowater=', runofftowater
1544 WRITE (12, *) 's1=', s1
1545 WRITE (12, *) 's2=', s2
1546 WRITE (12, *) 'sathydraulicconduct=', sathydraulicconduct
1547 WRITE (12, *) 'sddfull=', sddfull
1548 WRITE (12, *) 'sdd_id=', sdd_id
1549 WRITE (12, *) 'sfr_surf=', sfr_surf
1550 WRITE (12, *) 'smdmethod=', smdmethod
1551 WRITE (12, *) 'snowalb=', snowalb
1552 WRITE (12, *) 'snowalbmax=', snowalbmax
1553 WRITE (12, *) 'snowalbmin=', snowalbmin
1554 WRITE (12, *) 'snowpacklimit=', snowpacklimit
1555 WRITE (12, *) 'snowdens=', snowdens
1556 WRITE (12, *) 'snowdensmax=', snowdensmax
1557 WRITE (12, *) 'snowdensmin=', snowdensmin
1558 WRITE (12, *) 'snowfallcum=', snowfallcum
1559 WRITE (12, *) 'snowfrac=', snowfrac
1560 WRITE (12, *) 'snowlimbldg=', snowlimbldg
1561 WRITE (12, *) 'snowlimpaved=', snowlimpaved
1562 WRITE (12, *) 'snowfrac_obs=', snowfrac_obs
1563 WRITE (12, *) 'snowpack=', snowpack
1564 WRITE (12, *) 'snowprof_24hr=', snowprof_24hr
1565 WRITE (12, *) 'SnowUse=', snowuse
1566 WRITE (12, *) 'soildepth=', soildepth
1567 WRITE (12, *) 'soilstore_id=', soilstore_surf
1568 WRITE (12, *) 'soilstorecap=', soilstorecap_surf
1569 WRITE (12, *) 'stabilitymethod=', stabilitymethod
1570 WRITE (12, *) 'startdls=', startdls
1571 WRITE (12, *) 'state_id=', state_surf
1572 WRITE (12, *) 'statelimit=', statelimit_surf
1573 WRITE (12, *) 'storageheatmethod=', storageheatmethod
1574 WRITE (12, *) 'storedrainprm=', storedrainprm
1575 WRITE (12, *) 'surfacearea=', surfacearea
1576 WRITE (12, *) 'tair_av=', tair_av
1577 WRITE (12, *) 'tau_a=', tau_a
1578 WRITE (12, *) 'tau_f=', tau_f
1579 WRITE (12, *) 'tau_r=', tau_r
1580 WRITE (12, *) 'tmax_id=', tmax_id
1581 WRITE (12, *) 'tmin_id=', tmin_id
1582 WRITE (12, *) 'BaseT_Cooling=', baset_cooling
1583 WRITE (12, *) 'BaseT_Heating=', baset_heating
1584 WRITE (12, *) 'temp_c=', temp_c
1585 WRITE (12, *) 'tempmeltfact=', tempmeltfact
1586 WRITE (12, *) 'th=', th
1587 WRITE (12, *) 'theta_bioco2=', theta_bioco2
1588 WRITE (12, *) 'timezone=', timezone
1589 WRITE (12, *) 'tl=', tl
1590 WRITE (12, *) 'trafficrate=', trafficrate
1591 WRITE (12, *) 'trafficunits=', trafficunits
1592 WRITE (12, *) 'traffprof_24hr=', traffprof_24hr
1593 ! write (12, *) 'ts5mindata_ir=', ts5mindata_ir
1594 WRITE (12, *) 'tstep=', tstep
1595 WRITE (12, *) 'tstep_prev=', tstep_prev
1596 WRITE (12, *) 'veg_type=', veg_type
1597 WRITE (12, *) 'waterdist=', waterdist
1598 WRITE (12, *) 'waterusemethod=', waterusemethod
1599 WRITE (12, *) 'wetthresh=', wetthresh_surf
1600 WRITE (12, *) 'wu_m3=', wu_m3
1601 WRITE (12, *) 'wuday_id=', wuday_id
1602 WRITE (12, *) 'decidcap_id=', decidcap_id
1603 WRITE (12, *) 'albdectr_id=', albdectr_id
1604 WRITE (12, *) 'albevetr_id=', albevetr_id
1605 WRITE (12, *) 'albgrass_id=', albgrass_id
1606 WRITE (12, *) 'porosity_id=', porosity_id
1607 WRITE (12, *) 'wuprofa_24hr=', wuprofa_24hr
1608 WRITE (12, *) 'wuprofm_24hr=', wuprofm_24hr
1609 WRITE (12, *) 'xsmd=', xsmd
1610 WRITE (12, *) 'z=', z
1611 WRITE (12, *) 'z0m_in=', z0m_in
1612 WRITE (12, *) 'zdm_in=', zdm_in
1613 WRITE (12, *) '/'
1614
1615 WRITE (12, *) ''
1616
1617 CLOSE (12)
1618
1619 END IF
1620
1621 ! ======================================================================
1622
1623 RETURN
1624
1625120 FORMAT(8f10.3, a16) !format (10g10.2)
1626121 FORMAT(a12, 24f10.4, a20)
1627
1628END SUBROUTINE suews_translate
1629!===================================================================================
1630
1631!SUEWS_TranslateBack
1632!Translates model variables to arrays for each grid
1633!Runs at the end of SUEWS_Calculations to store correct info for each grid
1634!Made by HW Nov 2014
1635!-----------------------------------------------------------------------------------
1636!Last modified:LJ 14 Sep 2015
1637! HCW 28 Nov 2014
1638!===================================================================================
1639SUBROUTINE suews_translateback(Gridiv, ir, irMax)
1640
1641 USE allocatearray
1644 USE data_in
1645 USE defaultnotused
1646 USE gis_data
1647 USE initial
1648 USE mod_z
1649 USE resist
1650 USE snowmod
1651 USE sues_data
1652 USE time
1653
1654 IMPLICIT NONE
1655
1656 INTEGER :: Gridiv, & ! Index of the analysed grid (Gridcounter)
1657 ir, & ! Meteorological forcing file index (set to zero if SUEWS_Translate called from InitialState)
1658 irMax ! Last row in current chunk of met data
1659
1660 ! =============================================================================
1661 ! === Translate values from variable names used in model to ModelDailyState ===
1662 ! =============================================================================
1663
1664 ! ModelDailyState(Gridiv,cMDS_porosity) = porosity(id)
1665 ! ModelDailyState(Gridiv,cMDS_albDecTr) = albDecTr(id)
1666 ! ModelDailyState(Gridiv,cMDS_albEveTr) = albEveTr(id)
1667 ! ModelDailyState(Gridiv,cMDS_albGrass) = albGrass(id)
1668 ! ModelDailyState(Gridiv,cMDS_DecidCap) = DecidCap(id)
1670
1676
1677 ! Save required DailyState variables for the current grid (HCW 27 Nov 2014)
1678 ! HDD_grids(:,:,Gridiv) = HDD(:,:)
1679 ! GDD_grids(:,:,Gridiv) = GDD(:,:)
1680 ! LAI_grids(:,:,Gridiv) = LAI(:,:)
1681 ! WUDay_grids(:,:,Gridiv) = WUDay(:,:)
1682 ! AlbDecTr_grids(:,Gridiv) = AlbDecTr(:)
1683 ! AlbEveTr_grids(:,Gridiv) = AlbEveTr(:)
1684 ! AlbGrass_grids(:,Gridiv) = AlbGrass(:)
1685 ! DecidCap_grids(:,Gridiv) = DecidCap(:)
1686 ! Porosity_grids(:,Gridiv) = Porosity(:)
1687
1688 ! ! update qn1 memory with values of current time step
1689 ! qn1_store(:,Gridiv) = qn1_store_grid(:)
1690 ! qn1_av_store(:,Gridiv) = qn1_av_store_grid(:)
1691 ! IF (SnowUse == 1) THEN
1692 ! qn1_S_store(:,Gridiv) = qn1_S_store_grid(:)
1693 ! qn1_S_av_store(:,Gridiv) = qn1_S_av_store_grid(:)
1694 ! ENDIF
1695
1696 ! update averaged qn1 memory
1697 dqndt_grids(gridiv) = dqndt
1698 qn_av_grids(gridiv) = qn_av
1699 tair_av_grids(gridiv) = tair_av
1700 IF (snowuse == 1) THEN
1701 dqnsdt_grids(gridiv) = dqnsdt
1702 qn_s_av_grids(gridiv) = qn_s_av
1703 END IF
1704
1705 ! added by TS 29 Jun 2018 to remove annual loops in main calculation
1706 gdd_id_grids(:, gridiv) = gdd_id
1707 sdd_id_grids(:, gridiv) = sdd_id
1708 tmin_id_grids(gridiv) = tmin_id
1709 tmax_id_grids(gridiv) = tmax_id
1710 lenday_id_grids(gridiv) = lenday_id
1711 hdd_id_grids(:, gridiv) = hdd_id
1712 lai_id_grids(:, gridiv) = lai_id
1713 wuday_id_grids(:, gridiv) = wuday_id
1714
1720
1721 ! ---- Snow density of each surface
1724
1725 IF (storageheatmethod == 5 .OR. netradiationmethod > 1000) THEN
1726 ! ---- ESTM_ext related ------------------------------
1727 ! roof
1728
1729 ! k_roof(1:nroof, 1:ndepth) = k_roof_grids(Gridiv, 1:nroof, 1:ndepth)
1730 ! dz_roof(1:nroof, 1:ndepth) = dz_roof_grids(Gridiv, 1:nroof, 1:ndepth)
1731 ! PRINT *, 'dz_roof in translate:', dz_roof(1:nroof, 1:ndepth)
1732 ! cp_roof(1:nroof, 1:ndepth) = cp_roof_grids(Gridiv, 1:nroof, 1:ndepth)
1733
1734 temp_roof_grids(gridiv, 1:nlayer, 1:ndepth) = temp_roof(1:nlayer, 1:ndepth)
1735 tsfc_roof_grids(gridiv, 1:nlayer) = tsfc_roof(1:nlayer)
1736 state_roof_grids(gridiv, :) = state_roof(:)
1737 soilstore_roof_grids(gridiv, :) = soilstore_roof(:)
1738 DEALLOCATE (tsfc_roof)
1739 DEALLOCATE (sfr_roof)
1740 DEALLOCATE (alb_roof)
1741 DEALLOCATE (emis_roof)
1742 DEALLOCATE (state_roof)
1743 DEALLOCATE (statelimit_roof)
1744 DEALLOCATE (wetthresh_roof)
1745 DEALLOCATE (soilstore_roof)
1746 DEALLOCATE (soilstorecap_roof)
1747 DEALLOCATE (roof_albedo_dir_mult_fact)
1748 DEALLOCATE (tin_roof)
1749 DEALLOCATE (k_roof)
1750 DEALLOCATE (cp_roof)
1751 DEALLOCATE (dz_roof)
1752 DEALLOCATE (temp_roof)
1753
1754 ! wall
1755 ! nwall = nwall_grids(Gridiv)
1756 ! ALLOCATE (sfr_wall(nwall))
1757 ! ALLOCATE (k_wall(nwall, ndepth))
1758 ! ALLOCATE (cp_wall(nwall, ndepth))
1759 ! ALLOCATE (dz_wall(nwall, ndepth))
1760 ! ALLOCATE (tsfc_wall(nwall))
1761 ! k_wall(1:nwall, 1:ndepth) = k_wall_grids(Gridiv, 1:nwall, 1:ndepth)
1762 ! dz_wall(1:nwall, 1:ndepth) = dz_wall_grids(Gridiv, 1:nwall, 1:ndepth)
1763 ! PRINT *, 'dz_wall in translate:', dz_wall(1:nwall, 1:ndepth)
1764 ! cp_wall(1:nwall, 1:ndepth) = cp_wall_grids(Gridiv, 1:nwall, 1:ndepth)
1765 ! tsfc_wall_grids(Gridiv, 1:nwall) = tsfc_wall(1:nwall)
1766 temp_wall_grids(gridiv, 1:nlayer, 1:ndepth) = temp_wall(1:nlayer, 1:ndepth)
1767 tsfc_wall_grids(gridiv, 1:nlayer) = tsfc_wall(1:nlayer)
1768 state_wall_grids(gridiv, :) = state_wall(:)
1769 soilstore_wall_grids(gridiv, :) = soilstore_wall(:)
1770 DEALLOCATE (tsfc_wall)
1771 DEALLOCATE (sfr_wall)
1772 DEALLOCATE (alb_wall)
1773 DEALLOCATE (emis_wall)
1774 DEALLOCATE (state_wall)
1775 DEALLOCATE (statelimit_wall)
1776 DEALLOCATE (wetthresh_wall)
1777 DEALLOCATE (soilstore_wall)
1778 DEALLOCATE (soilstorecap_wall)
1779 DEALLOCATE (wall_specular_frac)
1780 DEALLOCATE (k_wall)
1781 DEALLOCATE (cp_wall)
1782 DEALLOCATE (dz_wall)
1783 DEALLOCATE (tin_wall)
1784 DEALLOCATE (temp_wall)
1785
1786 ! surf
1787 ! tsfc_surf_grids(Gridiv, 1:nsurf) = tsfc_surf(1:nsurf)
1788 temp_surf_grids(gridiv, 1:nsurf, 1:ndepth) = temp_surf(1:nsurf, 1:ndepth)
1789 DEALLOCATE (k_surf)
1790 DEALLOCATE (cp_surf)
1791 DEALLOCATE (dz_surf)
1792 DEALLOCATE (tin_surf)
1793 DEALLOCATE (temp_surf)
1794
1795 DEALLOCATE (height)
1796 DEALLOCATE (building_frac)
1797 DEALLOCATE (veg_frac)
1798 DEALLOCATE (building_scale)
1799 DEALLOCATE (veg_scale)
1800 ! DEALLOCATE (veg_ext)
1801 ! DEALLOCATE (veg_fsd)
1802 ! DEALLOCATE (veg_contact_fraction)
1803 ! DEALLOCATE (alb_roof)
1804 ! DEALLOCATE (alb_wall)
1805 END IF
1806
1807 tsfc_surf_grids(gridiv, 1:nsurf) = tsfc_surf(1:nsurf)
1808
1809 IF (ALLOCATED(tsfc_surf)) DEALLOCATE (tsfc_surf)
1810 ! if (ALLOCATED(tin_surf)) DEALLOCATE (tin_surf)
1811 ! =============================================================================
1812 ! === Translate values from variable names used in model to ModelOutputData ===
1813 ! =============================================================================
1814
1815 modeloutputdata(ir, cmod_state(1:nsurf), gridiv) = state_surf(1:nsurf)
1817 modeloutputdata(ir, cmod_snowfrac(1:nsurf), gridiv) = snowfrac(1:nsurf)
1818 modeloutputdata(ir, cmod_snowpack(1:nsurf), gridiv) = snowpack(1:nsurf)
1820
1821 ! ---- ice fraction
1822 icefrac_grids(:, gridiv) = icefrac
1823
1824 IF (ir == irmax) THEN !Store variables ready for next chunk of met data
1825 modeloutputdata(0, cmod_state(1:nsurf), gridiv) = state_surf(1:nsurf)
1830 END IF
1831
1832 RETURN
1833END SUBROUTINE suews_translateback
1834!===================================================================================
real(kind(1d0)), dimension(maxnumberofgrids) decidcap_id_grids
real(kind(1d0)), dimension(12, maxnumberofgrids) hdd_id_grids
integer, dimension(5) c_wall_thick4_bldgs
real(kind(1d0)), dimension(5, nsurfincsnow) zsurf_suewssurfs
integer, dimension(nvegsurf) c_gddfull
real(kind(1d0)), dimension(:), allocatable statelimit_wall
real(kind(1d0)) pormax_dec
integer, dimension(5) c_internal_rhocp4_bldgs
real(kind(1d0)), dimension(:), allocatable dqndt_grids
integer, parameter bldgsurf
real(kind(1d0)), dimension(:, :), allocatable modeldailystate
real(kind(1d0)), dimension(nsurf) snowpack
integer, dimension(nsurfincsnow) c_surf_thick5
integer, dimension(nsurf) c_kkanohm
integer, dimension(5) c_surf_k3_bldgs
real(kind(1d0)), dimension(:, :), allocatable tsfc_wall_grids
real(kind(1d0)), dimension(:, :), allocatable soilstorecap_wall_grids
integer, dimension(5) c_wall_thick1_bldgs
real(kind(1d0)), dimension(:, :), allocatable dz_wall
real(kind(1d0)) tmin_id
real(kind(1d0)), dimension(nsurf) chanohm
integer, dimension(nsurfincsnow) c_surf_rhocp2
integer, dimension(24) c_hrproftraffwd
real(kind(1d0)), dimension(nsurf) soilstorecap_surf
real(kind(1d0)), dimension(0:23, 2) humactivity_24hr
integer, dimension(nsurf) c_cpanohm
real(kind(1d0)), dimension(:, :), allocatable ts5mindata
integer, dimension(5) c_ch_iwall_bldgs
integer, dimension(5) c_internal_rhocp1_bldgs
integer, dimension(24) c_hrprofsnowcwe
real(kind(1d0)), dimension(:, :), allocatable soilstore_wall_grids
integer, dimension(5) c_wall_k1_bldgs
integer, dimension(nsurfincsnow) c_ohmthresh_sw
real(kind(1d0)), dimension(:, :), allocatable tin_surf_grids
integer, dimension(nsurfincsnow) c_surf_k1
integer, parameter ncolsestmdata
real(kind(1d0)), dimension(1) waterdepth
integer, parameter conifsurf
integer, dimension(3) c_ie_a
integer c_tcriticcooling_we
integer, dimension(5) c_internal_thick3_bldgs
integer, dimension(nsurfincsnow) c_surf_thick4
real(kind(1d0)) albmin_grass
real(kind(1d0)), dimension(:, :, :), allocatable cp_wall_grids
integer, dimension(5) c_internal_k3_bldgs
real(kind(1d0)), dimension(:, :), allocatable emis_wall_grids
integer, dimension(3) c_surf_rhocp2_paved
real(kind(1d0)), dimension(nsurf) statelimit_surf
integer, dimension(nvegsurf) c_sddfull
integer, dimension(nvegsurf) c_beta_bioco2
real(kind(1d0)), dimension(:, :), allocatable metforcingdata_grid
integer, dimension(nsurf) c_wgtorunoff
integer, dimension(nsurf) c_wgtograss
integer, dimension(nsurfincsnow) c_a2_swet
real(kind(1d0)), dimension(nsurf) state_surf
integer, dimension(5) c_surf_k1_bldgs
real(kind(1d0)), dimension(nsurf) soildepth
integer, dimension(nsurf) c_wgtobldgs
real(kind(1d0)), dimension(nsurf) cpanohm
real(kind(1d0)), dimension(:), allocatable soilstorecap_wall
integer, dimension(nsurfincsnow) c_a1_wwet
real(kind(1d0)) porosity_id
real(kind(1d0)), dimension(nvegsurf) basete
real(kind(1d0)), dimension(:), allocatable tsfc_roof
real(kind(1d0)) narp_tz
integer, dimension(nvegsurf) c_gsmax
integer, dimension(nsurf) c_soilstcap
integer, dimension(nsurf) c_soildens
integer, dimension(nsurfincsnow) c_a1_swet
real(kind(1d0)), dimension(:), allocatable alb_roof
real(kind(1d0)), dimension(:, :, :), allocatable temp_surf_grids
integer, dimension(nsurf) c_soildepth
integer, dimension(5) c_surf_thick3_bldgs
integer, dimension(nsurf) c_wgtoevetr
integer, dimension(5) c_surf_rhocp2_bldgs
integer c_ahslopecooling_we
real(kind(1d0)), dimension(:), allocatable state_wall
real(kind(1d0)), dimension(0:23, 2) traffprof_24hr
integer, dimension(24) c_hrprofenusewe
real(kind(1d0)), dimension(nsurf+1) ohm_threshwd
real(kind(1d0)), dimension(0:23, 2) ahprof_24hr
integer, dimension(7) c_daywatper
real(kind(1d0)), dimension(:, :), allocatable tin_roof_grids
integer, dimension(5) c_surf_rhocp5_bldgs
real(kind(1d0)), dimension(:, :), allocatable building_frac_grids
integer, dimension(5) c_ch_ibld_bldgs
real(kind(1d0)), dimension(:, :, :), allocatable temp_wall_grids
integer, dimension(5) c_surf_rhocp4_bldgs
integer, dimension(5) c_internal_thick1_bldgs
real(kind(1d0)), dimension(nvegsurf) beta_enh_bioco2
integer, dimension(24) c_hrprofwuautowd
integer, dimension(nvegsurf) c_laimax
integer, dimension(nsurfincsnow) c_a2_sdry
integer, dimension(nsurf) c_statelimit
integer, dimension(3) c_ie_m
real(kind(1d0)), dimension(:, :), allocatable tin_wall_grids
integer c_tcriticheating_we
real(kind(1d0)), dimension(nsurf+1, 4, 3) ohm_coef
integer, dimension(nvegsurf) c_alpha_bioco2
real(kind(1d0)), dimension(:, :), allocatable temp_roof
integer, dimension(3) c_surf_k4_paved
real(kind(1d0)), dimension(nvegsurf) min_res_bioco2
real(kind(1d0)), dimension(:), allocatable wetthresh_wall
real(kind(1d0)), dimension(nvegsurf) lai_id
real(kind(1d0)), dimension(:), allocatable state_roof
integer, dimension(nsurf) c_drcoef2
real(kind(1d0)), dimension(:), allocatable dqnsdt_grids
integer, dimension(5) c_ch_iroof_bldgs
integer, dimension(nsurf) c_ksat
real(kind(1d0)), dimension(nvegsurf) baset
real(kind(1d0)), dimension(:, :), allocatable tsfc_roof_grids
real(kind(1d0)), dimension(:, :), allocatable dz_surf
integer c_ahslopecooling_wd
integer, dimension(nsurf) c_obssmmax
integer, dimension(nvegsurf) c_leafgp2
real(kind(1d0)), dimension(nvegsurf) resp_b
real(kind(1d0)) narp_long
integer, dimension(nsurf) c_chanohm
integer, dimension(5) c_surf_thick2_bldgs
real(kind(1d0)), dimension(nsurf) sfr_surf
real(kind(1d0)), dimension(maxnumberofgrids) albevetr_id_grids
real(kind(1d0)), dimension(:), allocatable qn_s_av_grids
integer, dimension(5) c_internal_rhocp2_bldgs
integer, dimension(:), allocatable nlayer_grids
real(kind(1d0)), dimension(4, nvegsurf) laipower
integer, dimension(5) c_wall_k3_bldgs
real(kind(1d0)), dimension(:, :), allocatable alb_wall_grids
real(kind(1d0)), dimension(nvegsurf) resp_a
real(kind(1d0)), dimension(5, nsurfincsnow) rsurf_suewssurfs
integer, dimension(5) c_wall_k5_bldgs
integer, dimension(nsurf) c_snowlimpat
integer, dimension(nsurfincsnow) c_ohmthresh_wd
real(kind(1d0)), dimension(nvegsurf) laimax
integer, dimension(nsurfincsnow) c_a3_wwet
real(kind(1d0)), dimension(0:23, 2) wuprofm_24hr
integer, dimension(5) c_surf_rhocp1_bldgs
real(kind(1d0)), dimension(:, :, :), allocatable cp_surf_grids
real(kind(1d0)), dimension(:), allocatable sfr_roof
integer, dimension(3) c_surf_k5_paved
integer, dimension(nsurf) c_stormin
integer c_tcriticheating_wd
integer, dimension(7) c_daywat
real(kind(1d0)), dimension(nsurf) emis
real(kind(1d0)), dimension(:, :, :), allocatable wall_specular_frac_grids
integer, dimension(5) c_wall_rhocp1_bldgs
real(kind(1d0)), dimension(:, :), allocatable alb_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable k_wall_grids
real(kind(1d0)), dimension(nvegsurf, maxnumberofgrids) sdd_id_grids
real(kind(1d0)), dimension(nvegsurf) gdd_id
integer, dimension(24) c_hrprofsnowcwd
real(kind(1d0)), dimension(maxnumberofgrids) tmin_id_grids
real(kind(1d0)), dimension(nvegsurf, maxnumberofgrids) lai_id_grids
real(kind(1d0)), dimension(:, :), allocatable emis_roof_grids
integer, dimension(5) c_wall_rhocp3_bldgs
real(kind(1d0)) capmin_dec
integer, dimension(nsurfincsnow) c_a3_sdry
real(kind(1d0)), dimension(maxnumberofgrids) tmax_id_grids
integer c_ahslopeheating_we
real(kind(1d0)) decidcap_id
real(kind(1d0)), dimension(:), allocatable building_scale
real(kind(1d0)), dimension(:, :, :), allocatable temp_roof_grids
real(kind(1d0)) tair_av
integer, dimension(5) c_surf_k2_bldgs
integer c_tcriticcooling_wd
integer, dimension(nsurfincsnow) c_surf_k5
real(kind(1d0)), dimension(:), allocatable soilstore_roof
integer, dimension(nsurf) c_wgtowater
real(kind(1d0)), dimension(:, :, :), allocatable cp_roof_grids
real(kind(1d0)), dimension(nsurf) soilstore_surf
real(kind(1d0)), dimension(:, :), allocatable tsfc_surf_grids
integer, dimension(24) c_hrprofpopwe
real(kind(1d0)), dimension(maxnumberofgrids) lenday_id_grids
integer, dimension(nsurfincsnow) c_surf_thick3
integer, dimension(nsurf) cmod_snowfrac
real(kind(1d0)), dimension(:, :), allocatable sfr_wall_grids
integer, dimension(nvegsurf) laitype
integer, dimension(nsurf) cmds_snowdens
real(kind(1d0)), dimension(:, :), allocatable state_wall_grids
real(kind(1d0)), dimension(:, :), allocatable building_scale_grids
real(kind(1d0)), dimension(:, :, :), allocatable dz_surf_grids
integer, dimension(3) c_surf_k1_paved
real(kind(1d0)), dimension(:), allocatable height
integer, dimension(nsurf) cmod_snowwaterstate
integer, dimension(5) c_surf_k5_bldgs
real(kind(1d0)), dimension(5, nsurfincsnow) ksurf_suewssurfs
real(kind(1d0)), dimension(:, :), allocatable cp_wall
integer, dimension(nsurf) c_wgtosoilstore
real(kind(1d0)), dimension(maxnumberofgrids) albgrass_id_grids
integer, dimension(nvegsurf) c_laimin
integer, dimension(3) c_surf_rhocp4_paved
real(kind(1d0)), dimension(nsurf) sathydraulicconduct
real(kind(1d0)) lenday_id
real(kind(1d0)) narp_lat
real(kind(1d0)) qn_s_av
real(kind(1d0)), dimension(6, nsurf) storedrainprm
real(kind(1d0)), dimension(:, :), allocatable soilstore_roof_grids
integer, dimension(nvegsurf) c_alpha_enh_bioco2
real(kind(1d0)), dimension(nsurf) kkanohm
real(kind(1d0)), dimension(nvegsurf) theta_bioco2
integer, dimension(24) c_hrprofpopwd
integer, parameter nspec
real(kind(1d0)), dimension(nsurf+1, nsurf - 1) waterdist
real(kind(1d0)), dimension(:), allocatable emis_roof
real(kind(1d0)), dimension(:), allocatable tsfc_surf
integer, dimension(nsurfincsnow) c_surf_thick1
real(kind(1d0)) narp_emis_snow
integer, dimension(nsurf) c_wgtopaved
integer, dimension(5) c_internal_thick4_bldgs
real(kind(1d0)), dimension(:, :), allocatable cp_surf
integer, dimension(nsurfincsnow) c_a3_wdry
integer, dimension(24) c_hrprofwumanuwe
real(kind(1d0)), dimension(nsurf+1) ohm_threshsw
integer, dimension(nvegsurf) c_min_res_bioco2
integer, dimension(nvegsurf) c_resp_b
real(kind(1d0)), dimension(:, :, :), allocatable k_roof_grids
integer, dimension(5) c_internal_rhocp5_bldgs
real(kind(1d0)), dimension(:, :, :), allocatable metforcingdata
integer, dimension(nsurf) c_albmin
integer, dimension(5) c_internal_k5_bldgs
real(kind(1d0)), dimension(:, :), allocatable k_roof
integer c_frfossilfuel_heat
real(kind(1d0)), dimension(:), allocatable wetthresh_roof
integer, dimension(nsurf) c_obssmdepth
real(kind(1d0)), dimension(:), allocatable soilstorecap_roof
real(kind(1d0)), dimension(:), allocatable veg_frac
real(kind(1d0)), dimension(:, :), allocatable k_surf
real(kind(1d0)) capmax_dec
real(kind(1d0)), dimension(nvegsurf) beta_bioco2
integer, dimension(24) c_hrproftraffwe
integer, dimension(5) c_wall_rhocp5_bldgs
integer, dimension(24) c_hrprofwumanuwd
integer, dimension(5) c_surf_thick5_bldgs
integer, dimension(5) c_wall_k2_bldgs
integer, dimension(nsurfincsnow) c_a3_swet
real(kind(1d0)), dimension(:, :), allocatable surfacechar
integer, dimension(nsurf) cmod_snowpack
integer c_ahslopeheating_wd
real(kind(1d0)) albevetr_id
integer, parameter ivgrass
real(kind(1d0)), dimension(:, :), allocatable statelimit_wall_grids
real(kind(1d0)), dimension(nsurf) snowwater
real(kind(1d0)) narp_trans_site
integer, dimension(3) c_surf_thick4_paved
integer, dimension(nsurf) c_stormax
integer, dimension(nsurfincsnow) c_surf_rhocp3
real(kind(1d0)), dimension(:, :), allocatable wetthresh_roof_grids
real(kind(1d0)), dimension(0:23, 2) wuprofa_24hr
integer, dimension(nsurf) c_snowlimrem
integer, dimension(3) c_surf_rhocp1_paved
integer c_frfossilfuel_nonheat
integer, dimension(nvegsurf) c_baset
real(kind(1d0)), dimension(:, :), allocatable roof_albedo_dir_mult_fact
integer, dimension(nsurf) c_emis
real(kind(1d0)), dimension(:, :), allocatable soilstorecap_roof_grids
real(kind(1d0)) albmax_dectr
integer, dimension(nvegsurf) c_resp_a
integer, dimension(nsurfincsnow) c_surf_thick2
real(kind(1d0)), dimension(nvegsurf) sdd_id
integer, dimension(5) c_nroom_bldgs
real(kind(1d0)), dimension(nvegsurf) sddfull
integer, dimension(5) c_internal_k2_bldgs
integer, dimension(5) c_internal_k4_bldgs
integer, dimension(5) c_surf_k4_bldgs
real(kind(1d0)), dimension(nvegsurf) laimin
real(kind(1d0)) albmin_dectr
integer, dimension(24) c_hrprofhumactivitywe
real(kind(1d0)), dimension(maxnumberofgrids) porosity_id_grids
real(kind(1d0)), dimension(:), allocatable tin_surf
integer, parameter watersurf
real(kind(1d0)), dimension(:), allocatable tin_wall
integer, parameter grasssurf
integer, dimension(3) c_surf_thick1_paved
real(kind(1d0)), dimension(nvegsurf) alpha_enh_bioco2
real(kind(1d0)), dimension(:, :, :), allocatable dz_roof_grids
real(kind(1d0)), dimension(:), allocatable statelimit_roof
real(kind(1d0)), dimension(:), allocatable alb_wall
real(kind(1d0)), dimension(:, :, :), allocatable roof_albedo_dir_mult_fact_grids
integer, dimension(nsurfincsnow) c_estmcode
real(kind(1d0)), dimension(9) wuday_id
real(kind(1d0)) albdectr_id
integer, parameter nvegsurf
integer, dimension(nsurf) cmod_soilstate
real(kind(1d0)), dimension(:, :), allocatable wall_specular_frac
real(kind(1d0)) narp_year
real(kind(1d0)) qn_av
integer, dimension(nsurfincsnow) c_surf_k3
real(kind(1d0)), dimension(:, :), allocatable height_grids
real(kind(1d0)), dimension(maxnumberofgrids) albdectr_id_grids
integer, dimension(3) c_surf_rhocp5_paved
integer, parameter ivdecid
real(kind(1d0)), dimension(:, :), allocatable veg_scale_grids
integer, dimension(5) c_surf_thick4_bldgs
integer, dimension(3) c_surf_thick2_paved
real(kind(1d0)), dimension(:, :), allocatable dz_roof
real(kind(1d0)), dimension(:, :, :), allocatable k_surf_grids
integer, parameter bsoilsurf
real(kind(1d0)) albmax_grass
real(kind(1d0)) pormin_dec
real(kind(1d0)), dimension(:, :), allocatable temp_surf
integer, dimension(5) c_surf_thick1_bldgs
real(kind(1d0)), dimension(9, maxnumberofgrids) wuday_id_grids
real(kind(1d0)), dimension(nsurf) snowdens
integer, dimension(nsurfincsnow) c_surf_k2
integer, dimension(3) c_surf_rhocp3_paved
integer, dimension(nsurfincsnow) c_surf_rhocp5
integer, dimension(nsurf) c_wgtodectr
integer, dimension(5) c_internal_rhocp3_bldgs
real(kind(1d0)), dimension(:), allocatable emis_wall
integer, dimension(nvegsurf) c_beta_enh_bioco2
integer, dimension(nvegsurf) c_porositymax
real(kind(1d0)), dimension(:), allocatable ts5mindata_ir
integer, parameter nsurf
integer, parameter pavsurf
integer, dimension(5) c_em_ibld_bldgs
real(kind(1d0)) dqnsdt
real(kind(1d0)) tmax_id
integer, dimension(3) c_surf_k3_paved
integer, dimension(nvegsurf) c_theta_bioco2
real(kind(1d0)) albmax_evetr
integer, dimension(nvegsurf) c_porositymin
real(kind(1d0)), dimension(nsurf) wetthresh_surf
integer, dimension(nvegsurf) c_leafgp1
integer, dimension(3) c_surf_thick5_paved
integer, dimension(nsurfincsnow) c_surf_k4
real(kind(1d0)), dimension(:, :), allocatable cp_roof
real(kind(1d0)), dimension(nsurf) alb
real(kind(1d0)), dimension(:), allocatable building_frac
integer, dimension(nsurf) c_obssnrfrac
integer, parameter ndepth
integer, dimension(5) c_wall_thick5_bldgs
real(kind(1d0)), dimension(:, :, :), allocatable modeloutputdata
real(kind(1d0)), dimension(:, :), allocatable veg_frac_grids
integer, dimension(5) c_alb_ibld_bldgs
integer, dimension(24) c_hrprofwuautowe
integer, dimension(nsurf) cmod_state
integer, parameter ivconif
integer, dimension(3) c_surf_thick3_paved
real(kind(1d0)), dimension(:, :), allocatable state_roof_grids
integer, dimension(nsurfincsnow) c_surf_rhocp1
real(kind(1d0)), dimension(nsurf, maxnumberofgrids) icefrac_grids
real(kind(1d0)), dimension(nvegsurf) maxconductance
integer, dimension(24) c_hrprofhumactivitywd
real(kind(1d0)), dimension(:, :), allocatable statelimit_roof_grids
real(kind(1d0)), dimension(:, :), allocatable sfr_roof_grids
integer, dimension(5) c_wall_rhocp4_bldgs
integer, dimension(nsurf) c_wgtobsoil
integer, dimension(nsurfincsnow) c_a1_wdry
real(kind(1d0)), dimension(0:23, 2) popprof_24hr
real(kind(1d0)), dimension(nvegsurf) gddfull
integer, dimension(nsurfincsnow) c_a2_wdry
integer, dimension(nvegsurf) c_laieq
real(kind(1d0)), dimension(:, :), allocatable temp_wall
integer, dimension(5) c_wall_k4_bldgs
real(kind(1d0)), dimension(:, :, :), allocatable dz_wall_grids
real(kind(1d0)), dimension(:), allocatable tair_av_grids
integer, dimension(nsurfincsnow) c_a1_sdry
integer, dimension(nsurfincsnow) c_surf_rhocp4
real(kind(1d0)), dimension(:, :), allocatable k_wall
real(kind(1d0)), dimension(:, :, :), allocatable estmforcingdata
integer, dimension(nvegsurf) c_leafop1
real(kind(1d0)), dimension(:), allocatable sfr_wall
integer, dimension(5) c_surf_rhocp3_bldgs
integer, dimension(nsurf) c_wetthresh
real(kind(1d0)) dqndt
real(kind(1d0)), dimension(nsurf) snowpacklimit
real(kind(1d0)), dimension(:), allocatable veg_scale
integer, dimension(5) c_internal_thick2_bldgs
real(kind(1d0)), dimension(nvegsurf, maxnumberofgrids) gdd_id_grids
integer, dimension(5) c_internal_k1_bldgs
integer, dimension(nsurfincsnow) c_a2_wwet
real(kind(1d0)), dimension(12) hdd_id
real(kind(1d0)), dimension(:), allocatable qn_av_grids
real(kind(1d0)), dimension(:, :), allocatable wetthresh_wall_grids
integer, dimension(nvegsurf) c_leafop2
real(kind(1d0)), dimension(:), allocatable tin_roof
integer, parameter nsurfincsnow
real(kind(1d0)), dimension(:), allocatable soilstore_wall
integer, dimension(5) c_internal_thick5_bldgs
integer, dimension(24) c_hrprofenusewd
integer, dimension(nsurf) c_dreq
integer, dimension(nsurf) c_albmax
integer, parameter decidsurf
integer, dimension(5) c_wall_rhocp2_bldgs
real(kind(1d0)) albgrass_id
integer, dimension(3) c_surf_k2_paved
real(kind(1d0)), dimension(nsurf) icefrac
integer, dimension(5) c_wall_thick2_bldgs
integer, dimension(nsurf) c_drcoef1
real(kind(1d0)) albmin_evetr
real(kind(1d0)), dimension(:), allocatable tsfc_wall
integer, dimension(nvegsurf) c_basete
real(kind(1d0)), dimension(nvegsurf) alpha_bioco2
real(kind(1d0)), dimension(nsurf) snowfrac
integer, dimension(5) c_wall_thick3_bldgs
integer, dimension(5) c_fr_estmclass_bldgs
integer, dimension(3) c_fr_estmclass_paved
real(kind(1d0)) emis_snow
real(kind(1d0)) enprofwe
real(kind(1d0)) drainrt
integer netradiationmethod
integer evapmethod
real(kind(1d0)) timezone
character(len=20) filecode
real(kind(1d0)) minqfmetab
real(kind(1d0)) trafficunits
real(kind(1d0)) rainmaxres
real(kind(1d0)) frfossilfuel_heat
real(kind(1d0)) co2pointsource
character(len=150) fileoutputpath
integer ohmincqf
real(kind(1d0)) fcld_obs
integer smdmethod
real(kind(1d0)), dimension(2) fcef_v_kgkm
integer laicalcyes
real(kind(1d0)), dimension(2) qf0_beu
real(kind(1d0)) lng
real(kind(1d0)), dimension(2) qf_a
real(kind(1d0)) trans_site
real(kind(1d0)) ef_umolco2perj
real(kind(1d0)) maxqfmetab
real(kind(1d0)) lai_obs
real(kind(1d0)) traffprofwd
real(kind(1d0)) ldown_obs
character(len=150) filestateinit
real(kind(1d0)) qf_obs
real(kind(1d0)) enprofwd
real(kind(1d0)), dimension(2) ah_slope_heating
character(len=150) filechoices
real(kind(1d0)) snowfrac_obs
real(kind(1d0)) baset_hc
real(kind(1d0)) co2mwe
integer emissionsmethod
real(kind(1d0)) kdir
real(kind(1d0)) precip
real(kind(1d0)), dimension(2) ah_min
real(kind(1d0)), dimension(2) baset_heating
real(kind(1d0)) lat
real(kind(1d0)) popprofwe
real(kind(1d0)) wu_m3
real(kind(1d0)) co2mwd
integer startdls
real(kind(1d0)), dimension(2) ah_slope_cooling
real(kind(1d0)) press_hpa
integer diagnose
real(kind(1d0)), dimension(2) qf_c
real(kind(1d0)) qn1_obs
real(kind(1d0)) qs_obs
real(kind(1d0)) qh_obs
integer waterusemethod
real(kind(1d0)) avrh
real(kind(1d0)) maxfcmetab
integer storageheatmethod
real(kind(1d0)), dimension(2) trafficrate
real(kind(1d0)) enef_v_jkm
real(kind(1d0)), dimension(2) qf_b
real(kind(1d0)) traffprofwe
real(kind(1d0)) raincover
integer roughlenmommethod
real(kind(1d0)) kdiff
real(kind(1d0)) avu1
real(kind(1d0)) popprofwd
real(kind(1d0)) temp_c
real(kind(1d0)) wdir
real(kind(1d0)), dimension(2) popdensdaytime
real(kind(1d0)) xsmd
real(kind(1d0)) minfcmetab
real(kind(1d0)), dimension(2) baset_cooling
real(kind(1d0)) alt
real(kind(1d0)) avkdn
real(kind(1d0)) popdensnighttime
real(kind(1d0)) qe_obs
real(kind(1d0)) frfossilfuel_nonheat
real(kind(1d0)) notused
real(kind(1d0)), dimension(5, 3) rsurf_paved
real(kind(1d0)), dimension(5) em_ibld_bldgs
real(kind(1d0)), dimension(5) zground
real(kind(1d0)), dimension(5, 5) ribld_bldgs
integer ndepth_roof
real(kind(1d0)), dimension(5, 5) kibld_bldgs
real(kind(1d0)), dimension(5, 5) rwall_bldgs
real(kind(1d0)) froof
real(kind(1d0)) alb_ibld
real(kind(1d0)), dimension(5) alb_ibld_bldgs
real(kind(1d0)) ch_iwall
real(kind(1d0)), dimension(5, 3) zsurf_paved
integer ndepth_ibld
real(kind(1d0)), dimension(5) kwall
real(kind(1d0)) nroom
real(kind(1d0)), dimension(5) kroof
real(kind(1d0)), dimension(5) kground
integer ndepth_wall
real(kind(1d0)), dimension(5) zibld
real(kind(1d0)), dimension(5, 5) zibld_bldgs
real(kind(1d0)), dimension(5) ch_iwall_bldgs
real(kind(1d0)), dimension(5, 5) kwall_bldgs
real(kind(1d0)), dimension(5) rwall
real(kind(1d0)), dimension(5) ch_iroof_bldgs
real(kind(1d0)) fwall
real(kind(1d0)), dimension(5, 5) zwall_bldgs
real(kind(1d0)) areawall
real(kind(1d0)), dimension(5) estmsfr_bldgs
real(kind(1d0)), dimension(5, 5) rsurf_bldgs
real(kind(1d0)) ch_ibld
real(kind(1d0)) fground
real(kind(1d0)) em_ibld
real(kind(1d0)) ch_iroof
real(kind(1d0)), dimension(5) rroof
real(kind(1d0)), dimension(5, 3) ksurf_paved
real(kind(1d0)), dimension(5, 5) ksurf_bldgs
real(kind(1d0)), dimension(5) kibld
integer ndepth_ground
real(kind(1d0)), dimension(5) zwall
real(kind(1d0)), dimension(5, 5) zsurf_bldgs
real(kind(1d0)), dimension(3) estmsfr_paved
real(kind(1d0)) fveg
real(kind(1d0)), dimension(5) rground
real(kind(1d0)), dimension(5) nroom_bldgs
real(kind(1d0)), dimension(5) ribld
real(kind(1d0)), dimension(5) ch_ibld_bldgs
real(kind(1d0)), dimension(5) zroof
subroutine estm_translate(Gridiv)
real(kind(1d0)) vegfraction
real(kind(1d0)) veg_fr
real(kind(1d0)) faibldg
real(kind(1d0)) bldgh
real(kind(1d0)) evetreeh
real(kind(1d0)) nonwaterfraction
real(kind(1d0)) dectreeh
real(kind(1d0)) areazh
real(kind(1d0)) treeh
real(kind(1d0)) faievetree
real(kind(1d0)) pervfraction
real(kind(1d0)) faidectree
real(kind(1d0)) faitree
real(kind(1d0)) impervfraction
real(kind(1d0)) zdm
real(kind(1d0)) z
real(kind(1d0)) z0m
real(kind(1d0)) zdm_in
real(kind(1d0)) zzd
real(kind(1d0)) z0m_in
real(kind(1d0)) g1
real(kind(1d0)) th
real(kind(1d0)) tl
real(kind(1d0)) s2
real(kind(1d0)) g3
integer gsmodel
real(kind(1d0)) s1
real(kind(1d0)) g4
real(kind(1d0)) g6
real(kind(1d0)) g2
real(kind(1d0)) kmax
real(kind(1d0)) g5
real(kind(1d0)) snowfallcum
real(kind(1d0)), dimension(0:23, 2) snowprof_24hr
real(kind(1d0)) snowlimpaved
real(kind(1d0)) snowalbmax
real(kind(1d0)) radmeltfact
real(kind(1d0)) crwmax
real(kind(1d0)) tau_r
real(kind(1d0)) tempmeltfact
real(kind(1d0)) snowdensmin
real(kind(1d0)) snowlimbldg
real(kind(1d0)) snowalbmin
real(kind(1d0)) preciplimitalb
real(kind(1d0)) snowdensmax
real(kind(1d0)) snowalb
real(kind(1d0)) tau_a
real(kind(1d0)) tau_f
real(kind(1d0)) preciplimit
real(kind(1d0)) crwmin
real(kind(1d0)) irrfracgrass
real(kind(1d0)) irrfracbldgs
real(kind(1d0)) faut
integer stabilitymethod
integer aerodynamicresistancemethod
real(kind(1d0)) runofftowater
real(kind(1d0)), dimension(7) daywat
real(kind(1d0)) wuareaevetr_m2
real(kind(1d0)) flowchange
real(kind(1d0)) wuareagrass_m2
real(kind(1d0)) irrfracevetr
real(kind(1d0)) soildensity
real(kind(1d0)) soilrocks
real(kind(1d0)), dimension(3) ie_a
real(kind(1d0)) smcap
real(kind(1d0)) surfacearea_ha
real(kind(1d0)) irrfracdectr
real(kind(1d0)) irrfracbsoil
real(kind(1d0)) pipecapacity
integer roughlenheatmethod
real(kind(1d0)) irrfracwater
real(kind(1d0)), dimension(7) daywatper
real(kind(1d0)) irrfracpaved
real(kind(1d0)) wuareadectr_m2
real(kind(1d0)) surfacearea
real(kind(1d0)), dimension(3) ie_m
real(kind(1d0)) internalwateruse_h
real(kind(1d0)) soildepthmeas
real(kind(1d0)) h_maintain
integer dt_since_start
integer isec
integer iy
integer it
integer imin
integer id
real(kind(1d0)) dectime
character(len=10) gridid_text
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
subroutine checkinitial
subroutine suews_translateback(Gridiv, ir, irMax)
subroutine suews_translate(Gridiv, ir, iMB)