SUEWS API Site
Documentation of SUEWS source code
suews_phys_anemsn.f95
Go to the documentation of this file.
2  implicit none
3 
4  !===================================================================================
5  !Simple Anthropogenic Heat and Carbon Dioxide Parameterization routines
6  !This subroutine is still under development and in the equations concerning CO2 fluxes
7  !there are bugs and missing comments.
8  !Last modified
9  ! TS 01 Jul 2018 - replaced annual HDD array with a simplied daily array HDD_id_use
10  ! MH 29 Jun 2017 - Finalised the code to calculate the anthropogenic emissions of heat and CO2
11  ! HCW 21 Apr 2017 - renamed from SUEWS_SAHP.f95. Now includes CO2 fluxes as well as QF.
12  ! Tidied code. Combined three subroutines into 1 to avoid repetition.
13  ! HCW 24 Feb 2017 - Added new anthropogenic heat flux calculation (AnthropEmissionsMethod=3)
14  ! HCW 25 Aug 2016 - Outputs base QF (part without temp. dependence)
15  ! LJ 27 Jan 2016 - Removal of Tabs
16  ! HCW 20 Jan 2015 - v2015 applies a profile at each model timestep
17  ! these have been interpolated from the hourly profile input data (SUEWS_Profiles)
18  ! vthey are now normalised (sum to 1) in InitializeSurfaceCharacteristics
19  ! N.B. previous versions were not applying weekday/weekend profiles correctly
20  !
21  ! EmissionsMethod = 0 - Use values in met forcing file, or default QF
22  ! EmissionsMethod = 1 - Method according to Loridan et al. (2011) : SAHP
23  ! EmissionsMethod = 2 - Method according to Jarvi et al. (2011) : SAHP_2
24  !
25  !===================================================================================
26 
27 contains
28 
29  SUBROUTINE anthropogenicemissions( &
30  CO2PointSource, EmissionsMethod, &
31  id, it, imin, DLS, nsh, DayofWeek_id, &
32  EF_umolCO2perJ, FcEF_v_kgkm, EnEF_v_Jkm, TrafficUnits, &
33  FrFossilFuel_Heat, FrFossilFuel_NonHeat, &
34  MinFCMetab, MaxFCMetab, MinQFMetab, MaxQFMetab, &
35  PopDensDaytime, PopDensNighttime, &
36  Temp_C, HDD_id, Qf_A, Qf_B, Qf_C, &
37  AH_MIN, AH_SLOPE_Heating, AH_SLOPE_Cooling, &
38  T_CRITIC_Heating, T_CRITIC_Cooling, &
39  TrafficRate, &
40  QF0_BEU, QF_SAHP, &
41  Fc_anthro, Fc_metab, Fc_traff, Fc_build, Fc_point, &
42  AHProf_24hr, HumActivity_24hr, TraffProf_24hr, PopProf_24hr, SurfaceArea)
43 
44  ! Simple anthropogenic heat parameterisation and co2 calculation
45  ! Calculates QF_SAHP and Fc_anthro
46 
47  IMPLICIT NONE
48 
49  INTEGER, INTENT(in):: &
50  EmissionsMethod, &
51  id, & !Hour
52  it, & !Hour
53  imin, & !Minutes
54  DLS, & !day lightsavings =1+1h=0
55  nsh !Number of timesteps per hour
56 
57  INTEGER, DIMENSION(3), INTENT(in)::DayofWeek_id !1 - day of week; 2 - month; 3 - season
58 
59  REAL(KIND(1d0)), DIMENSION(12), INTENT(in):: HDD_id !Heating Degree Days (see SUEWS_DailyState.f95)
60 
61  REAL(KIND(1d0)), DIMENSION(2), INTENT(in):: &
62  Qf_A, Qf_B, Qf_C, & !Qf coefficients
63  AH_MIN, & !Minimum anthropogenic heat flux
64  AH_SLOPE_Heating, & !Slope of the anthropogenic heat flux calculation
65  AH_SLOPE_Cooling, &
66  FcEF_v_kgkm, & !CO2 Emission factor
67  PopDensDaytime, & !Daytime population density [ha-1] (i.e. workers)
68  T_CRITIC_Heating, & !Critical temperature
69  T_CRITIC_Cooling, & !Critical cooling temperature
70  TrafficRate, & !Traffic rate
71  QF0_BEU
72 
73  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in):: AHProf_24hr
74  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in):: HumActivity_24hr
75  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in):: TraffProf_24hr
76  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in):: PopProf_24hr
77 
78  REAL(KIND(1D0)), INTENT(in):: &
79  CO2PointSource, & !Point source [kgC day-1]
80  EF_umolCO2perJ, &
81  EnEF_v_Jkm, & !Energy Emission factor
82  TrafficUnits, & !Traffic Units choice
83  FrFossilFuel_Heat, & !Fraction of Fossil Fuel heat
84  FrFossilFuel_NonHeat, &!Fraction of Fossil Fuel non heat
85  MinFCMetab, & !Minimum FC Metabolism
86  MaxFCMetab, & !Maximum FC Metabolism
87  MinQFMetab, & !Minimum QF Metabolism
88  MaxQFMetab, & !Maximum QF Metabolism
89  PopDensNighttime, & !Nighttime population density [ha-1] (i.e. residents)
90  SurfaceArea, & !Surface area [m-2]
91  Temp_C !Air temperature
92 
93  REAL(KIND(1D0)), INTENT(out):: &
94  QF_SAHP, &
95  Fc_anthro, &
96  Fc_metab, Fc_traff, Fc_build, Fc_point
97 
98  INTEGER:: &
99  iu, & !1=weekday OR 2=weekend
100  ih
101 
102  REAL(KIND(1D0)):: &
103  get_Prof_SpecTime_inst, &
104  get_Prof_SpecTime_mean, & !external function to get profile value at specified timestamp
105  HDD_daily, & !daily HDD
106  CDD_daily, & !daily HDD
107  Tair_avg_daily, & !daily mean air temperature
108  NumCapita(2), &
109  DP_x_RhoPop, DP_x_RhoPop_traff, &
110  QF_build, QF_metab, QF_traff, &
111  QF_SAHP_base, & !Anthropogenic heat flux calculated by SAHP (temp independent part)
112  QF_SAHP_heat, & !Anthropogenic heat flux calculated by SAHP (heating part only)
113  QF_SAHP_ac, & !AC contribution
114  PopDorNorT, & ! Population
115  ActDorNorT, & ! Human activity
116  TraffDorNorT, & ! Traffic
117  AHDorNorT ! Anthropogenic heat
118 
119  ! initialisation
120  qf_traff = 0
121  qf_sahp_heat = 0
122  qf_sahp_ac = 0
123 
124  ! Transfer HDD values to local explict variables
125  hdd_daily = hdd_id(7)
126  cdd_daily = hdd_id(8)
127  ! NB: temporarily use 5-day running mean to test the performance
128  tair_avg_daily = hdd_id(10)
129 
130  ! Tair_avg_daily= HDD_id_use(3) ! this is daily
131 
132  ! use average of both daytime and nighttime population values
133  ! TS 20 Sep 2019: moved from `translate` here to simplify the interface
134  IF (popdensdaytime(1) >= 0 .AND. popdensnighttime >= 0) numcapita(1) = (popdensdaytime(1) + popdensnighttime)/2 !If both, use average
135  IF (popdensdaytime(2) >= 0 .AND. popdensnighttime >= 0) numcapita(2) = (popdensdaytime(2) + popdensnighttime)/2 !If both, use average
136 
137  !NumCapita = (PopDensDaytime + PopDensNighttime)/2
138 
139  !-----------------------------------------------------------------------
140  ! Account for Daylight saving
141  ih = it - dls
142  IF (ih < 0) ih = 23
143 
144  ! Set weekday/weekend counter
145  iu = 1 !Set to 1=weekday
146  IF (dayofweek_id(1) == 1 .OR. dayofweek_id(1) == 7) iu = 2 !Set to 2=weekend
147 
148  ! Calculate energy emissions and CO2 from human metabolism -------------
149  ! Pop dens (cap ha-1 -> cap m-2) x activity level (W cap-1)
150  ! PopDorNorT = PopProf_tstep((NSH*(ih+1-1)+imin*NSH/60+1),iu) ! 1=night, 2=day, 1-2=transition
151  ! ActDorNorT = HumActivity_tstep((NSH*(ih+1-1)+imin*NSH/60+1),iu) ! 1=night, 2=day, 1-2=transition
152  ! TraffDorNorT = TraffProf_tstep((NSH*(ih+1-1)+imin*NSH/60+1),iu) ! normalise so the AVERAGE of the multipliers is equal to 1
153  ! AHDorNorT = AHProf_tstep((NSH*(ih+1-1)+imin*NSH/60+1),iu) ! normalise so the AVERAGE of the multipliers is equal to 1
154  ! PRINT*, ''
155  ! PRINT*, 'AHDorNorT old:',AHDorNorT
156  popdornort = get_prof_spectime_inst(ih, imin, 0, popprof_24hr(:, iu))
157  actdornort = get_prof_spectime_inst(ih, imin, 0, humactivity_24hr(:, iu))
158  traffdornort = get_prof_spectime_mean(ih, imin, 0, traffprof_24hr(:, iu))
159  ahdornort = get_prof_spectime_mean(ih, imin, 0, ahprof_24hr(:, iu))
160 
161  ! Diurnal profile times population density [cap ha-1]
162  dp_x_rhopop = ahdornort*numcapita(iu)
163 
164  qf_metab = (popdensnighttime*minqfmetab*((2 - actdornort) + (2 - popdornort))/2 + &
165  popdensdaytime(iu)*maxqfmetab*((actdornort - 1) + (popdornort - 1))/2)/10000 !W m-2
166 
167  fc_metab = (popdensnighttime*minfcmetab*((2 - actdornort) + (2 - popdornort))/2 + &
168  popdensdaytime(iu)*maxfcmetab*((actdornort - 1) + (popdornort - 1))/2)/10000 !umol m-2 s-1
169 
170  !----------------------------------------------------------------------------------------------------
171  !Different methods to calculate the anthopogenic heat and CO2 emissions.
172  !1-3: CO2 emission is calculated from QF which can be calculated with three methods
173  !41-43: CO2 emission is calculated with local information. QF methods are used for housing and human metabolism
174 
175  IF (emissionsmethod == 1 .OR. emissionsmethod == 4 .OR. emissionsmethod == 11 .OR. emissionsmethod == 14 .OR. &
176  emissionsmethod == 21 .OR. emissionsmethod == 24 .OR. emissionsmethod == 31 .OR. emissionsmethod == 34 .OR. &
177  emissionsmethod == 41 .OR. emissionsmethod == 44) THEN ! (formerly SAHP_1 subroutine)
178  ! Loridan et al. (2011) JAMC Eq 13: linear relation with air temperature
179  ! Weekday/weekend differences due to profile only
180  ! Now scales with population density
181 
182  IF (temp_c < t_critic_heating(iu)) THEN
183  qf_sahp = (ah_min(iu) + ah_slope_heating(iu)*(t_critic_heating(iu) - temp_c))*ahdornort
184  ELSE
185  qf_sahp = ah_min(iu)*ahdornort
186  ENDIF
187 
188  ! Need to be checked later, not recommended to use
189  ! QF_SAHP_base = AH_MIN(iu) * DP_x_RhoPop ! Temperature-independent contribution
190  qf_sahp_base = ah_min(iu)*ahdornort ! Temperature-independent contribution
191  qf_sahp_heat = qf_sahp - qf_sahp_base ! Heating contribution
192  qf_sahp_ac = 0 ! No AC contribution with this method
193 
194  ELSEIF (emissionsmethod == 2 .OR. emissionsmethod == 5 .OR. emissionsmethod == 12 .OR. emissionsmethod == 15 .OR. &
195  emissionsmethod == 22 .OR. emissionsmethod == 25 .OR. emissionsmethod == 32 .OR. emissionsmethod == 35 .OR. &
196  emissionsmethod == 42 .OR. emissionsmethod == 45) THEN ! (formerly SAHP_2 subroutine)
197  ! Jarvi et al. (2011) JH Eq 3 using HDD and CDD
198  ! Weekday/weekend differences due to profile and coefficients QF_a,b,c
199  ! Scales with population density
200  qf_sahp = (qf_a(iu) + qf_b(iu)*cdd_daily + qf_c(iu)*hdd_daily)*dp_x_rhopop !This contains QF from all three sources: buildings, metabolism and traffic!
201  qf_sahp_base = (qf_a(iu))*dp_x_rhopop ! Temperature-independent contribution from buildings, traffic and human metabolism
202  qf_sahp_heat = (qf_c(iu)*hdd_daily)*dp_x_rhopop ! Heating contribution
203  qf_sahp_ac = (qf_b(iu)*cdd_daily)*dp_x_rhopop ! Cooling (AC) contribution
204 
205  ELSEIF (emissionsmethod == 3 .OR. emissionsmethod == 6 .OR. emissionsmethod == 13 .OR. emissionsmethod == 16 .OR. &
206  emissionsmethod == 23 .OR. emissionsmethod == 26 .OR. emissionsmethod == 33 .OR. emissionsmethod == 36 .OR. &
207  emissionsmethod == 43 .OR. emissionsmethod == 46) THEN
208  ! Updated Loridan et al. (2011) method using daily (not instantaneous) air temperature (HDD_id_use(3))
209  ! Linear relation with air temperature
210  ! Weekday/weekend differences due to profile only
211  ! Scales with population density
212 
213  ! Need to be checked later, not recommended to use
214  ! QF_SAHP_base = AH_MIN(iu) * DP_x_RhoPop ! Temperature-independent contribution
215  qf_sahp_base = ah_min(iu)*ahdornort ! Temperature-independent contribution
216 
217  IF (tair_avg_daily < t_critic_heating(iu)) THEN ! Heating
218  qf_sahp = (ah_min(iu) + ah_slope_heating(iu)*(t_critic_heating(iu) - tair_avg_daily))*ahdornort
219  qf_sahp_heat = qf_sahp - qf_sahp_base ! Heating contribution
220  qf_sahp_ac = 0
221 
222  ELSEIF (tair_avg_daily > t_critic_cooling(iu)) THEN ! Air-conditioning
223  qf_sahp = (ah_min(iu) + ah_slope_cooling(iu)*(tair_avg_daily - t_critic_cooling(iu)))*ahdornort
224  qf_sahp_heat = 0
225  qf_sahp_ac = qf_sahp - qf_sahp_base ! AC contribution
226 
227  ELSE
228  qf_sahp = ah_min(iu)*ahdornort
229  ENDIF
230 
231  ENDIF
232 
233  IF (emissionsmethod >= 1 .AND. emissionsmethod <= 3 .OR. emissionsmethod >= 11 .AND. emissionsmethod <= 13 .OR. &
234  emissionsmethod >= 21 .AND. emissionsmethod <= 23 .OR. emissionsmethod >= 31 .AND. emissionsmethod <= 33 .OR. &
235  emissionsmethod >= 41 .AND. emissionsmethod <= 43) THEN
236 
237  ! Calculate QF from buildings. First remove (if possibe) human metabolism from the total value given by SAHP.
238  IF ((qf_sahp_base - qf_metab) > 0) THEN
239  qf_build = qf_sahp_base*qf0_beu(iu) + qf_sahp_heat + qf_sahp_ac !QF0_BEU = QF0_BuildingEnergyUse = Fraction of base value coming from buildings
240  !relative to traffic as metabolism is separately calculated
241  ELSE
242  ! CALL ErrorHint(69,'QF metab exceeds base QF.',QF_metab,QF_SAHP_base,notUsedI)
243  CALL errorhint(69, 'QF metab exceeds base QF.', qf_metab, qf_sahp_base)
244 
245  qf_build = qf_sahp_heat + qf_sahp_ac + (qf_sahp_base - qf_metab) !If human metabolism greater than Base QF, remove this from the heating/cooling contribution also
246  ENDIF
247 
248  ! Consider the various components of QF_build to calculate Fc_build
249  ! Assume all A/C electric, so QF_SAHP_ac is not associated with any local CO2 emissions
250  ! HDD part is building energy use, split between electricity (no local emissions CO2) and combustion (CO2) heating...
251  fc_build = qf_sahp_heat*frfossilfuel_heat*ef_umolco2perj
252 
253  ! ... and there is also a temperature-independent contribution from building energy use.
254  IF ((qf_sahp_base - qf_metab) > 0) THEN
255  fc_build = fc_build + qf_sahp_base*qf0_beu(iu)*frfossilfuel_nonheat*ef_umolco2perj
256  ENDIF
257 
258  ! Remainder of temperature-independent part must be traffic
259  !QF_traff = (QF_SAHP_base-QF_metab)*(1.0-QF0_BEU(iu))
260  qf_traff = qf_sahp_base*(1.0 - qf0_beu(iu)) - qf_metab
261 
262  ! Divide QF by energy emission factor and multiply by CO2 factor
263  fc_traff = qf_traff/enef_v_jkm*fcef_v_kgkm(iu)*1e3*1e6/44
264 
265  !CO2 point source [kg C day-1] * 1e3 g kg-1 * 1e6 umol mol-1 /(12 g mol-1 * m-2)
266  IF (co2pointsource > 0) THEN
267  fc_point = co2pointsource*1e3*1e6/(12*60*60*24*surfacearea)
268  ELSE
269  fc_point = 0
270  ENDIF
271 
272  ! Sum components to give anthropogenic CO2 flux [umol m-2 s-1]
273  fc_anthro = fc_metab + fc_traff + fc_build + fc_point
274 
275  ELSEIF (emissionsmethod >= 4 .AND. emissionsmethod <= 6 .OR. emissionsmethod >= 14 .AND. emissionsmethod <= 16 .OR. &
276  emissionsmethod >= 24 .AND. emissionsmethod <= 26 .OR. emissionsmethod >= 34 .AND. emissionsmethod <= 36 .OR. &
277  emissionsmethod >= 44 .AND. emissionsmethod <= 46) THEN
278  ! Calculate QF and Fc using building energy use and transport statistics
279 
280  ! Calculate energy released from traffic
281  IF (trafficunits == 1) THEN ! [veh km m-2 day-1]
282  ! Calculate using mean traffic rate [veh km m-2 day-1] * emission factor [J km-1]
283  qf_traff = trafficrate(iu)/(60*60*24)*enef_v_jkm*traffdornort
284  ! Use mean traffic rate [veh km m-2 s-1] * emission factor [kg km-1] * 1e3 g kg-1 /44 g mol-1 * 1e6 umol mol-1
285  fc_traff = trafficrate(iu)/(60*60*24)*fcef_v_kgkm(iu)*1e3*1e6/44*traffdornort
286 
287  ELSEIF (trafficunits == 2) THEN ! [veh km cap-1 day-1]
288  dp_x_rhopop_traff = traffdornort*numcapita(iu)/10000 ! [cap m-2]
289  ! Use mean traffic rate [veh km cap-1 day-1] * emission factor [J km-1]
290  qf_traff = trafficrate(iu)/(60*60*24)*enef_v_jkm*dp_x_rhopop_traff
291  ! Use mean traffic rate [veh km cap-1 day-1] * emission factor [kg km-1] * 1e3 g kg-1 /44 g mol-1 * 1e6 umol mol-1
292  fc_traff = trafficrate(iu)/(60*60*24)*fcef_v_kgkm(iu)*1e3*1e6/44*dp_x_rhopop_traff
293 
294  ELSE ! If TrafficUnits doesn't match possible units
295  CALL errorhint(75, 'Check TrafficUnits', trafficunits)
296 
297  ENDIF
298 
299  ! Energy released from buildings only
300  ! Should buildings have their own profile? Now using population profile
301  qf_build = ((qf_sahp_base*qf0_beu(iu) + qf_sahp_heat + qf_sahp_ac)/dp_x_rhopop)* &
302  (popdensnighttime*(2 - popdornort) + popdensdaytime(iu)*(popdornort - 1))
303 
304  ! Consider the various components of QF_build to calculate Fc_build
305  fc_build = qf_sahp_heat*frfossilfuel_heat*ef_umolco2perj
306  ! ... and there is also a temperature-independent contribution from building energy use
307  fc_build = fc_build + qf_sahp_base*qf0_beu(iu)*frfossilfuel_nonheat*ef_umolco2perj
308 
309  !CO2 point source [kg C day-1] * 1e3 g kg-1 * 1e6 umol mol-1 /(12 g mol-1 * m-2)
310  IF (co2pointsource > 0) THEN
311  fc_point = co2pointsource*1e3*1e6/(12*60*60*24*surfacearea)
312  ELSE
313  fc_point = 0
314  ENDIF
315 
316  ! Add other QF components to QF_SAHP_base (because if AnthropEmissionsMethod = 4, QF calculated above is building part only)
317  qf_sahp_base = qf_sahp_base + qf_traff + qf_metab
318 
319  ! Sum components to give anthropogenic heat flux [W m-2]
320  qf_sahp = qf_metab + qf_traff + qf_build
321 
322  ! Sum components to give anthropogenic CO2 flux [umol m-2 s-1]
323  fc_anthro = fc_metab + fc_traff + fc_build + fc_point
324 
325  ENDIF
326 
327  RETURN
328  END SUBROUTINE anthropogenicemissions
329 
330 end module anemsn_module
331 !========================================================================================
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
subroutine anthropogenicemissions(CO2PointSource, EmissionsMethod, id, it, imin, DLS, nsh, DayofWeek_id, EF_umolCO2perJ, FcEF_v_kgkm, EnEF_v_Jkm, TrafficUnits, FrFossilFuel_Heat, FrFossilFuel_NonHeat, MinFCMetab, MaxFCMetab, MinQFMetab, MaxQFMetab, PopDensDaytime, PopDensNighttime, Temp_C, HDD_id, Qf_A, Qf_B, Qf_C, AH_MIN, AH_SLOPE_Heating, AH_SLOPE_Cooling, T_CRITIC_Heating, T_CRITIC_Cooling, TrafficRate, QF0_BEU, QF_SAHP, Fc_anthro, Fc_metab, Fc_traff, Fc_build, Fc_point, AHProf_24hr, HumActivity_24hr, TraffProf_24hr, PopProf_24hr, SurfaceArea)