[4246] | 1 | !> @file indoor_model_mod.f90 |
---|
| 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of the PALM model system. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[4481] | 17 | ! Copyright 2018-2020 Leibniz Universitaet Hannover |
---|
| 18 | ! Copyright 2018-2020 Hochschule Offenburg |
---|
[4246] | 19 | !--------------------------------------------------------------------------------! |
---|
| 20 | ! |
---|
| 21 | ! Current revisions: |
---|
| 22 | ! ----------------- |
---|
[4227] | 23 | ! |
---|
[4442] | 24 | ! |
---|
[4246] | 25 | ! Former revisions: |
---|
| 26 | ! ----------------- |
---|
| 27 | ! $Id: indoor_model_mod.f90 4481 2020-03-31 18:55:54Z monakurppa $ |
---|
[4442] | 28 | ! Change order of dimension in surface array %frac to allow for better |
---|
| 29 | ! vectorization. |
---|
| 30 | ! |
---|
| 31 | ! 4441 2020-03-04 19:20:35Z suehring |
---|
[4402] | 32 | ! Major bugfix in calculation of energy demand - floor-area-per-facade was wrongly |
---|
| 33 | ! calculated leading to unrealistically high energy demands and thus to |
---|
| 34 | ! unreallistically high waste-heat fluxes. |
---|
| 35 | ! |
---|
| 36 | ! 4346 2019-12-18 11:55:56Z motisi |
---|
[4346] | 37 | ! Introduction of wall_flags_total_0, which currently sets bits based on static |
---|
| 38 | ! topography information used in wall_flags_static_0 |
---|
| 39 | ! |
---|
| 40 | ! 4329 2019-12-10 15:46:36Z motisi |
---|
[4329] | 41 | ! Renamed wall_flags_0 to wall_flags_static_0 |
---|
| 42 | ! |
---|
| 43 | ! 4310 2019-11-26 19:01:28Z suehring |
---|
[4310] | 44 | ! Remove dt_indoor from namelist input. The indoor model is an hourly-based |
---|
| 45 | ! model, calling it more/less often lead to inaccurate results. |
---|
| 46 | ! |
---|
| 47 | ! 4299 2019-11-22 10:13:38Z suehring |
---|
[4299] | 48 | ! Output of indoor temperature revised (to avoid non-defined values within |
---|
| 49 | ! buildings) |
---|
| 50 | ! |
---|
| 51 | ! 4267 2019-10-16 18:58:49Z suehring |
---|
[4267] | 52 | ! Bugfix in initialization, some indices to access building_pars where wrong. |
---|
| 53 | ! Introduction of seasonal parameters. |
---|
[4246] | 54 | ! |
---|
[4267] | 55 | ! 4246 2019-09-30 09:27:52Z pavelkrc |
---|
[4246] | 56 | ! |
---|
[4267] | 57 | ! |
---|
[4245] | 58 | ! 4242 2019-09-27 12:59:10Z suehring |
---|
[4246] | 59 | ! Bugfix in array index |
---|
| 60 | ! |
---|
| 61 | ! 4238 2019-09-25 16:06:01Z suehring |
---|
| 62 | ! - Bugfix in determination of minimum facade height and in location message |
---|
| 63 | ! - Bugfix, avoid division by zero |
---|
| 64 | ! - Some optimization |
---|
| 65 | ! |
---|
| 66 | ! 4227 2019-09-10 18:04:34Z gronemeier |
---|
| 67 | ! implement new palm_date_time_mod |
---|
| 68 | ! |
---|
| 69 | ! 4217 2019-09-04 09:47:05Z scharf |
---|
| 70 | ! Corrected "Former revisions" section |
---|
| 71 | ! |
---|
| 72 | ! 4209 2019-09-02 12:00:03Z suehring |
---|
| 73 | ! - Bugfix in initialization of indoor temperature |
---|
| 74 | ! - Prescibe default indoor temperature in case it is not given in the |
---|
| 75 | ! namelist input |
---|
| 76 | ! |
---|
| 77 | ! 4182 2019-08-21 14:37:54Z scharf |
---|
| 78 | ! Corrected "Former revisions" section |
---|
| 79 | ! |
---|
| 80 | ! 4148 2019-08-08 11:26:00Z suehring |
---|
| 81 | ! Bugfix in case of non grid-resolved buildings. Further, vertical grid spacing |
---|
| 82 | ! is now considered at the correct level. |
---|
| 83 | ! - change calculation of a_m and c_m |
---|
| 84 | ! - change calculation of u-values (use h_es in building array) |
---|
| 85 | ! - rename h_tr_... to h_t_... |
---|
| 86 | ! h_tr_em to h_t_wm |
---|
| 87 | ! h_tr_op to h_t_wall |
---|
| 88 | ! h_tr_w to h_t_es |
---|
| 89 | ! - rename h_ve to h_v |
---|
| 90 | ! - rename h_is to h_ms |
---|
| 91 | ! - inserted net_floor_area |
---|
| 92 | ! - inserted params_waste_heat_h, params_waste_heat_c from building database |
---|
| 93 | ! in building array |
---|
| 94 | ! - change calculation of q_waste_heat |
---|
| 95 | ! - bugfix in averaging mean indoor temperature |
---|
| 96 | ! |
---|
| 97 | ! 3759 2019-02-21 15:53:45Z suehring |
---|
| 98 | ! - Calculation of total building volume |
---|
| 99 | ! - Several bugfixes |
---|
| 100 | ! - Calculation of building height revised |
---|
| 101 | ! |
---|
| 102 | ! 3745 2019-02-15 18:57:56Z suehring |
---|
| 103 | ! - remove building_type from module |
---|
| 104 | ! - initialize parameters for each building individually instead of a bulk |
---|
| 105 | ! initializaion with identical building type for all |
---|
| 106 | ! - output revised |
---|
| 107 | ! - add missing _wp |
---|
| 108 | ! - some restructuring of variables in building data structure |
---|
| 109 | ! |
---|
| 110 | ! 3744 2019-02-15 18:38:58Z suehring |
---|
| 111 | ! Some interface calls moved to module_interface + cleanup |
---|
| 112 | ! |
---|
| 113 | ! 3469 2018-10-30 20:05:07Z kanani |
---|
| 114 | ! Initial revision (tlang, suehring, kanani, srissman)! |
---|
| 115 | ! |
---|
| 116 | ! Authors: |
---|
| 117 | ! -------- |
---|
| 118 | ! @author Tobias Lang |
---|
| 119 | ! @author Jens Pfafferott |
---|
| 120 | ! @author Farah Kanani-Suehring |
---|
| 121 | ! @author Matthias Suehring |
---|
| 122 | ! @author Sascha RiÃmann |
---|
| 123 | ! |
---|
| 124 | ! |
---|
| 125 | ! Description: |
---|
| 126 | ! ------------ |
---|
| 127 | !> <Description of the new module> |
---|
| 128 | !> Module for Indoor Climate Model (ICM) |
---|
| 129 | !> The module is based on the DIN EN ISO 13790 with simplified hour-based procedure. |
---|
| 130 | !> This model is a equivalent circuit diagram of a three-point RC-model (5R1C). |
---|
| 131 | !> This module differ between indoor-air temperature an average temperature of indoor surfaces which make it prossible to determine thermal comfort |
---|
| 132 | !> the heat transfer between indoor and outdoor is simplified |
---|
| 133 | |
---|
| 134 | !> @todo Replace window_area_per_facade by %frac(1,m) for window |
---|
| 135 | !> @todo emissivity change for window blinds if solar_protection_on=1 |
---|
| 136 | |
---|
| 137 | !> @note Do we allow use of integer flags, or only logical flags? (concerns e.g. cooling_on, heating_on) |
---|
| 138 | !> @note How to write indoor temperature output to pt array? |
---|
| 139 | !> |
---|
| 140 | !> @bug <Enter known bugs here> |
---|
| 141 | !------------------------------------------------------------------------------! |
---|
| 142 | MODULE indoor_model_mod |
---|
| 143 | |
---|
[4402] | 144 | USE arrays_3d, & |
---|
| 145 | ONLY: ddzw, & |
---|
| 146 | dzw, & |
---|
| 147 | pt |
---|
| 148 | |
---|
[4246] | 149 | USE control_parameters, & |
---|
| 150 | ONLY: initializing_actions |
---|
| 151 | |
---|
| 152 | USE kinds |
---|
| 153 | |
---|
| 154 | USE netcdf_data_input_mod, & |
---|
| 155 | ONLY: building_id_f, building_type_f |
---|
| 156 | |
---|
[4267] | 157 | USE palm_date_time_mod, & |
---|
| 158 | ONLY: get_date_time, northward_equinox, seconds_per_hour, & |
---|
| 159 | southward_equinox |
---|
| 160 | |
---|
[4246] | 161 | USE surface_mod, & |
---|
| 162 | ONLY: surf_usm_h, surf_usm_v |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | IMPLICIT NONE |
---|
| 166 | |
---|
| 167 | ! |
---|
| 168 | !-- Define data structure for buidlings. |
---|
| 169 | TYPE build |
---|
| 170 | |
---|
| 171 | INTEGER(iwp) :: id !< building ID |
---|
| 172 | INTEGER(iwp) :: kb_min !< lowest vertical index of a building |
---|
| 173 | INTEGER(iwp) :: kb_max !< highest vertical index of a building |
---|
| 174 | INTEGER(iwp) :: num_facades_per_building_h = 0 !< total number of horizontal facades elements |
---|
| 175 | INTEGER(iwp) :: num_facades_per_building_h_l = 0 !< number of horizontal facade elements on local subdomain |
---|
| 176 | INTEGER(iwp) :: num_facades_per_building_v = 0 !< total number of vertical facades elements |
---|
| 177 | INTEGER(iwp) :: num_facades_per_building_v_l = 0 !< number of vertical facade elements on local subdomain |
---|
| 178 | INTEGER(iwp) :: ventilation_int_loads !< [-] allocation of activity in the building |
---|
| 179 | |
---|
| 180 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: l_v !< index array linking surface-element orientation index |
---|
| 181 | !< for vertical surfaces with building |
---|
| 182 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: m_h !< index array linking surface-element index for |
---|
| 183 | !< horizontal surfaces with building |
---|
| 184 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: m_v !< index array linking surface-element index for |
---|
| 185 | !< vertical surfaces with building |
---|
| 186 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: num_facade_h !< number of horizontal facade elements per buidling |
---|
| 187 | !< and height level |
---|
| 188 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: num_facade_v !< number of vertical facades elements per buidling |
---|
| 189 | !< and height level |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | LOGICAL :: on_pe = .FALSE. !< flag indicating whether a building with certain ID is on local subdomain |
---|
| 193 | |
---|
| 194 | REAL(wp) :: air_change_high !< [1/h] air changes per time_utc_hour |
---|
| 195 | REAL(wp) :: air_change_low !< [1/h] air changes per time_utc_hour |
---|
| 196 | REAL(wp) :: area_facade !< [m2] area of total facade |
---|
| 197 | REAL(wp) :: building_height !< building height |
---|
| 198 | REAL(wp) :: eta_ve !< [-] heat recovery efficiency |
---|
| 199 | REAL(wp) :: factor_a !< [-] Dynamic parameters specific effective surface according to Table 12; 2.5 |
---|
| 200 | !< (very light, light and medium), 3.0 (heavy), 3.5 (very heavy) |
---|
| 201 | REAL(wp) :: factor_c !< [J/(m2 K)] Dynamic parameters inner heatstorage according to Table 12; 80000 |
---|
| 202 | !< (very light), 110000 (light), 165000 (medium), 260000 (heavy), 370000 (very heavy) |
---|
| 203 | REAL(wp) :: f_c_win !< [-] shading factor |
---|
[4402] | 204 | REAL(wp) :: fapf !< [m2/m2] floor area per facade |
---|
[4246] | 205 | REAL(wp) :: g_value_win !< [-] SHGC factor |
---|
| 206 | REAL(wp) :: h_es !< [W/(m2 K)] surface-related heat transfer coefficient between extern and surface |
---|
| 207 | REAL(wp) :: height_cei_con !< [m] ceiling construction heigth |
---|
| 208 | REAL(wp) :: height_storey !< [m] storey heigth |
---|
| 209 | REAL(wp) :: params_waste_heat_c !< [-] anthropogenic heat outputs for cooling e.g. 1.33 for KKM with COP = 3 |
---|
| 210 | REAL(wp) :: params_waste_heat_h !< [-] anthropogenic heat outputs for heating e.g. 1 - 0.9 = 0.1 for combustion with eta = 0.9 or -2 for WP with COP = 3 |
---|
| 211 | REAL(wp) :: phi_c_max !< [W] Max. Cooling capacity (negative) |
---|
| 212 | REAL(wp) :: phi_h_max !< [W] Max. Heating capacity (positive) |
---|
| 213 | REAL(wp) :: q_c_max !< [W/m2] Max. Cooling heat flux per netto floor area (negative) |
---|
| 214 | REAL(wp) :: q_h_max !< [W/m2] Max. Heating heat flux per netto floor area (positive) |
---|
| 215 | REAL(wp) :: qint_high !< [W/m2] internal heat gains, option Database qint_0-23 |
---|
| 216 | REAL(wp) :: qint_low !< [W/m2] internal heat gains, option Database qint_0-23 |
---|
| 217 | REAL(wp) :: lambda_at !< [-] ratio internal surface/floor area chap. 7.2.2.2. |
---|
| 218 | REAL(wp) :: lambda_layer3 !< [W/(m*K)] Thermal conductivity of the inner layer |
---|
| 219 | REAL(wp) :: net_floor_area !< [m2] netto ground area |
---|
| 220 | REAL(wp) :: s_layer3 !< [m] half thickness of the inner layer (layer_3) |
---|
| 221 | REAL(wp) :: theta_int_c_set !< [degree_C] Max. Setpoint temperature (summer) |
---|
| 222 | REAL(wp) :: theta_int_h_set !< [degree_C] Max. Setpoint temperature (winter) |
---|
| 223 | REAL(wp) :: u_value_win !< [W/(m2*K)] transmittance |
---|
| 224 | REAL(wp) :: vol_tot !< [m3] total building volume |
---|
| 225 | |
---|
| 226 | REAL(wp), DIMENSION(:), ALLOCATABLE :: t_in !< mean building indoor temperature, height dependent |
---|
| 227 | REAL(wp), DIMENSION(:), ALLOCATABLE :: t_in_l !< mean building indoor temperature on local subdomain, height dependent |
---|
| 228 | REAL(wp), DIMENSION(:), ALLOCATABLE :: volume !< total building volume, height dependent |
---|
| 229 | REAL(wp), DIMENSION(:), ALLOCATABLE :: vol_frac !< fraction of local on total building volume, height dependent |
---|
| 230 | REAL(wp), DIMENSION(:), ALLOCATABLE :: vpf !< building volume volume per facade element, height dependent |
---|
| 231 | |
---|
| 232 | END TYPE build |
---|
| 233 | |
---|
| 234 | TYPE(build), DIMENSION(:), ALLOCATABLE :: buildings !< building array |
---|
| 235 | |
---|
| 236 | INTEGER(iwp) :: num_build !< total number of buildings in domain |
---|
| 237 | ! |
---|
| 238 | !-- Declare all global variables within the module |
---|
| 239 | INTEGER(iwp) :: cooling_on !< Indoor cooling flag (0=off, 1=on) |
---|
| 240 | INTEGER(iwp) :: heating_on !< Indoor heating flag (0=off, 1=on) |
---|
| 241 | INTEGER(iwp) :: solar_protection_off !< Solar protection off |
---|
| 242 | INTEGER(iwp) :: solar_protection_on !< Solar protection on |
---|
| 243 | |
---|
[4310] | 244 | REAL(wp), PARAMETER :: dt_indoor = 3600.0_wp !< [s] time interval for indoor-model application, fixed to 3600.0 due to model requirements |
---|
| 245 | |
---|
[4246] | 246 | REAL(wp) :: a_m !< [m2] the effective mass-related area |
---|
| 247 | REAL(wp) :: air_change !< [1/h] Airflow |
---|
| 248 | REAL(wp) :: c_m !< [J/K] internal heat storage capacity |
---|
| 249 | REAL(wp) :: facade_element_area !< [m2_facade] building surface facade |
---|
| 250 | REAL(wp) :: floor_area_per_facade !< [m2/m2] floor area per facade area |
---|
| 251 | REAL(wp) :: h_t_1 !< [W/K] Heat transfer coefficient auxiliary variable 1 |
---|
| 252 | REAL(wp) :: h_t_2 !< [W/K] Heat transfer coefficient auxiliary variable 2 |
---|
| 253 | REAL(wp) :: h_t_3 !< [W/K] Heat transfer coefficient auxiliary variable 3 |
---|
| 254 | REAL(wp) :: h_t_wm !< [W/K] Heat transfer coefficient of the emmision (got with h_t_ms the thermal mass) |
---|
| 255 | REAL(wp) :: h_t_is !< [W/K] thermal coupling conductance (Thermischer Kopplungsleitwert) |
---|
| 256 | REAL(wp) :: h_t_ms !< [W/K] Heat transfer conductance term (got with h_t_wm the thermal mass) |
---|
| 257 | REAL(wp) :: h_t_wall !< [W/K] heat transfer coefficient of opaque components (assumption: got all |
---|
| 258 | !< thermal mass) contains of h_t_wm and h_t_ms |
---|
| 259 | REAL(wp) :: h_t_es !< [W/K] heat transfer coefficient of doors, windows, curtain walls and |
---|
| 260 | !< glazed walls (assumption: thermal mass=0) |
---|
| 261 | REAL(wp) :: h_v !< [W/K] heat transfer of ventilation |
---|
| 262 | REAL(wp) :: indoor_volume_per_facade !< [m3] indoor air volume per facade element |
---|
| 263 | REAL(wp) :: initial_indoor_temperature = 293.15 !< [K] initial indoor temperature (namelist parameter) |
---|
| 264 | REAL(wp) :: net_sw_in !< [W/m2] net short-wave radiation |
---|
| 265 | REAL(wp) :: phi_hc_nd !< [W] heating demand and/or cooling demand |
---|
| 266 | REAL(wp) :: phi_hc_nd_10 !< [W] heating demand and/or cooling demand for heating or cooling |
---|
| 267 | REAL(wp) :: phi_hc_nd_ac !< [W] actual heating demand and/or cooling demand |
---|
| 268 | REAL(wp) :: phi_hc_nd_un !< [W] unlimited heating demand and/or cooling demand which is necessary to |
---|
| 269 | !< reach the demanded required temperature (heating is positive, |
---|
| 270 | !< cooling is negative) |
---|
| 271 | REAL(wp) :: phi_ia !< [W] internal air load = internal loads * 0.5, Eq. (C.1) |
---|
| 272 | REAL(wp) :: phi_m !< [W] mass specific thermal load (internal and external) |
---|
| 273 | REAL(wp) :: phi_mtot !< [W] total mass specific thermal load (internal and external) |
---|
| 274 | REAL(wp) :: phi_sol !< [W] solar loads |
---|
| 275 | REAL(wp) :: phi_st !< [W] mass specific thermal load implied non thermal mass |
---|
| 276 | REAL(wp) :: q_wall_win !< [W/m2]heat flux from indoor into wall/window |
---|
| 277 | REAL(wp) :: q_waste_heat !< [W/m2]waste heat, sum of waste heat over the roof to Palm |
---|
| 278 | |
---|
| 279 | REAL(wp) :: q_c_m !< [W] Energy of thermal storage mass specific thermal load for internal |
---|
| 280 | !< and external heatsources (for energy bilanz) |
---|
| 281 | REAL(wp) :: q_c_st !< [W] Energy of thermal storage mass specific thermal load implied non thermal mass (for energy bilanz) |
---|
| 282 | REAL(wp) :: q_int !< [W] Energy of internal air load (for energy bilanz) |
---|
| 283 | REAL(wp) :: q_sol !< [W] Energy of solar (for energy bilanz) |
---|
| 284 | REAL(wp) :: q_trans !< [W] Energy of transmission (for energy bilanz) |
---|
| 285 | REAL(wp) :: q_vent !< [W] Energy of ventilation (for energy bilanz) |
---|
| 286 | |
---|
| 287 | REAL(wp) :: schedule_d !< [-] activation for internal loads (low or high + low) |
---|
| 288 | REAL(wp) :: skip_time_do_indoor = 0.0_wp !< [s] Indoor model is not called before this time |
---|
| 289 | REAL(wp) :: theta_air !< [degree_C] air temperature of the RC-node |
---|
| 290 | REAL(wp) :: theta_air_0 !< [degree_C] air temperature of the RC-node in equilibrium |
---|
| 291 | REAL(wp) :: theta_air_10 !< [degree_C] air temperature of the RC-node from a heating capacity |
---|
| 292 | !< of 10 W/m2 |
---|
| 293 | REAL(wp) :: theta_air_ac !< [degree_C] actual room temperature after heating/cooling |
---|
| 294 | REAL(wp) :: theta_air_set !< [degree_C] Setpoint_temperature for the room |
---|
| 295 | REAL(wp) :: theta_m !< [degree_C} inner temperature of the RC-node |
---|
| 296 | REAL(wp) :: theta_m_t !< [degree_C] (Fictive) component temperature timestep |
---|
| 297 | REAL(wp) :: theta_m_t_prev !< [degree_C] (Fictive) component temperature previous timestep (do not change) |
---|
| 298 | REAL(wp) :: theta_op !< [degree_C] operative temperature |
---|
| 299 | REAL(wp) :: theta_s !< [degree_C] surface temperature of the RC-node |
---|
| 300 | REAL(wp) :: time_indoor = 0.0_wp !< [s] time since last call of indoor model |
---|
| 301 | REAL(wp) :: total_area !< [m2] area of all surfaces pointing to zone |
---|
| 302 | REAL(wp) :: window_area_per_facade !< [m2] window area per facade element |
---|
| 303 | |
---|
| 304 | REAL(wp), PARAMETER :: h_is = 3.45_wp !< [W/(m2 K)] surface-related heat transfer coefficient between |
---|
| 305 | !< surface and air (chap. 7.2.2.2) |
---|
| 306 | REAL(wp), PARAMETER :: h_ms = 9.1_wp !< [W/(m2 K)] surface-related heat transfer coefficient between component and surface (chap. 12.2.2) |
---|
| 307 | REAL(wp), PARAMETER :: params_f_f = 0.3_wp !< [-] frame ratio chap. 8.3.2.1.1 for buildings with mostly cooling 2.0_wp |
---|
| 308 | REAL(wp), PARAMETER :: params_f_w = 0.9_wp !< [-] correction factor (fuer nicht senkrechten Stahlungseinfall |
---|
| 309 | !< DIN 4108-2 chap.8, (hier konstant, keine WinkelabhÀngigkeit) |
---|
| 310 | REAL(wp), PARAMETER :: params_f_win = 0.5_wp !< [-] proportion of window area, Database A_win aus |
---|
| 311 | !< Datenbank 27 window_area_per_facade_percent |
---|
| 312 | REAL(wp), PARAMETER :: params_solar_protection = 300.0_wp !< [W/m2] chap. G.5.3.1 sun protection closed, if the radiation |
---|
| 313 | !< on facade exceeds this value |
---|
[4267] | 314 | ! |
---|
| 315 | !-- Definition of seasonal parameters, summer and winter, for different building types |
---|
| 316 | REAL(wp), DIMENSION(0:1,1:7) :: summer_pars = RESHAPE( (/ & ! building_type 1 |
---|
| 317 | 0.5_wp, & ! basical airflow without occupancy of the room |
---|
| 318 | 2.0_wp, & ! additional airflow depend of occupancy of the room |
---|
| 319 | 0.5_wp, & ! building_type 2: basical airflow without occupancy of the room |
---|
| 320 | 2.0_wp, & ! additional airflow depend of occupancy of the room |
---|
| 321 | 0.8_wp, & ! building_type 3: basical airflow without occupancy of the room |
---|
| 322 | 2.0_wp, & ! additional airflow depend of occupancy of the room |
---|
| 323 | 0.1_wp, & ! building_type 4: basical airflow without occupancy of the room |
---|
| 324 | 1.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 325 | 0.1_wp, & ! building_type 5: basical airflow without occupancy of the room |
---|
| 326 | 1.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 327 | 0.1_wp, & ! building_type 6: basical airflow without occupancy of the room |
---|
| 328 | 1.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 329 | 0.1_wp, & ! building_type 7: basical airflow without occupancy of the room |
---|
| 330 | 1.5_wp & ! additional airflow depend of occupancy of the room |
---|
| 331 | /), (/ 2, 7 /) ) |
---|
[4246] | 332 | |
---|
[4267] | 333 | REAL(wp), DIMENSION(0:1,1:7) :: winter_pars = RESHAPE( (/ & ! building_type 1 |
---|
| 334 | 0.1_wp, & ! basical airflow without occupancy of the room |
---|
| 335 | 0.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 336 | 0.1_wp, & ! building_type 2: basical airflow without occupancy of the room |
---|
| 337 | 0.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 338 | 0.1_wp, & ! building_type 3: basical airflow without occupancy of the room |
---|
| 339 | 0.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 340 | 0.1_wp, & ! building_type 4: basical airflow without occupancy of the room |
---|
| 341 | 1.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 342 | 0.1_wp, & ! building_type 5: basical airflow without occupancy of the room |
---|
| 343 | 1.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 344 | 0.1_wp, & ! building_type 6: basical airflow without occupancy of the room |
---|
| 345 | 1.5_wp, & ! additional airflow depend of occupancy of the room |
---|
| 346 | 0.1_wp, & ! building_type 7: basical airflow without occupancy of the room |
---|
| 347 | 1.5_wp & ! additional airflow depend of occupancy of the room |
---|
| 348 | /), (/ 2, 7 /) ) |
---|
| 349 | |
---|
[4246] | 350 | SAVE |
---|
| 351 | |
---|
| 352 | |
---|
| 353 | PRIVATE |
---|
| 354 | |
---|
| 355 | ! |
---|
| 356 | !-- Add INTERFACES that must be available to other modules |
---|
| 357 | PUBLIC im_init, im_main_heatcool, im_parin, im_define_netcdf_grid, & |
---|
| 358 | im_check_data_output, im_data_output_3d, im_check_parameters |
---|
| 359 | |
---|
| 360 | |
---|
| 361 | ! |
---|
| 362 | !-- Add VARIABLES that must be available to other modules |
---|
| 363 | PUBLIC dt_indoor, skip_time_do_indoor, time_indoor |
---|
| 364 | |
---|
| 365 | ! |
---|
| 366 | !-- PALM interfaces: |
---|
| 367 | !-- Data output checks for 2D/3D data to be done in check_parameters |
---|
| 368 | INTERFACE im_check_data_output |
---|
| 369 | MODULE PROCEDURE im_check_data_output |
---|
| 370 | END INTERFACE im_check_data_output |
---|
| 371 | ! |
---|
| 372 | !-- Input parameter checks to be done in check_parameters |
---|
| 373 | INTERFACE im_check_parameters |
---|
| 374 | MODULE PROCEDURE im_check_parameters |
---|
| 375 | END INTERFACE im_check_parameters |
---|
| 376 | ! |
---|
| 377 | !-- Data output of 3D data |
---|
| 378 | INTERFACE im_data_output_3d |
---|
| 379 | MODULE PROCEDURE im_data_output_3d |
---|
| 380 | END INTERFACE im_data_output_3d |
---|
| 381 | |
---|
| 382 | ! |
---|
| 383 | !-- Definition of data output quantities |
---|
| 384 | INTERFACE im_define_netcdf_grid |
---|
| 385 | MODULE PROCEDURE im_define_netcdf_grid |
---|
| 386 | END INTERFACE im_define_netcdf_grid |
---|
| 387 | ! |
---|
| 388 | ! ! |
---|
| 389 | ! !-- Output of information to the header file |
---|
| 390 | ! INTERFACE im_header |
---|
| 391 | ! MODULE PROCEDURE im_header |
---|
| 392 | ! END INTERFACE im_header |
---|
| 393 | ! |
---|
| 394 | !-- Calculations for indoor temperatures |
---|
| 395 | INTERFACE im_calc_temperatures |
---|
| 396 | MODULE PROCEDURE im_calc_temperatures |
---|
| 397 | END INTERFACE im_calc_temperatures |
---|
| 398 | ! |
---|
| 399 | !-- Initialization actions |
---|
| 400 | INTERFACE im_init |
---|
| 401 | MODULE PROCEDURE im_init |
---|
| 402 | END INTERFACE im_init |
---|
| 403 | ! |
---|
| 404 | !-- Main part of indoor model |
---|
| 405 | INTERFACE im_main_heatcool |
---|
| 406 | MODULE PROCEDURE im_main_heatcool |
---|
| 407 | END INTERFACE im_main_heatcool |
---|
| 408 | ! |
---|
| 409 | !-- Reading of NAMELIST parameters |
---|
| 410 | INTERFACE im_parin |
---|
| 411 | MODULE PROCEDURE im_parin |
---|
| 412 | END INTERFACE im_parin |
---|
| 413 | |
---|
| 414 | CONTAINS |
---|
| 415 | |
---|
| 416 | !------------------------------------------------------------------------------! |
---|
| 417 | ! Description: |
---|
| 418 | ! ------------ |
---|
| 419 | !< Calculation of the air temperatures and mean radiation temperature |
---|
| 420 | !< This is basis for the operative temperature |
---|
| 421 | !< Based on a Crank-Nicholson scheme with a timestep of a hour |
---|
| 422 | !------------------------------------------------------------------------------! |
---|
| 423 | SUBROUTINE im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, & |
---|
| 424 | near_facade_temperature, phi_hc_nd_dummy ) |
---|
[4402] | 425 | |
---|
[4246] | 426 | INTEGER(iwp) :: i |
---|
| 427 | INTEGER(iwp) :: j |
---|
| 428 | INTEGER(iwp) :: k |
---|
| 429 | |
---|
| 430 | REAL(wp) :: indoor_wall_window_temperature !< weighted temperature of innermost wall/window layer |
---|
| 431 | REAL(wp) :: near_facade_temperature |
---|
| 432 | REAL(wp) :: phi_hc_nd_dummy |
---|
| 433 | ! |
---|
| 434 | !-- Calculation of total mass specific thermal load (internal and external) |
---|
| 435 | phi_mtot = ( phi_m + h_t_wm * indoor_wall_window_temperature & |
---|
| 436 | + h_t_3 * ( phi_st + h_t_es * pt(k,j,i) & |
---|
| 437 | + h_t_1 * & |
---|
| 438 | ( ( ( phi_ia + phi_hc_nd_dummy ) / h_v ) & |
---|
| 439 | + near_facade_temperature ) & |
---|
| 440 | ) / h_t_2 & |
---|
| 441 | ) !< [degree_C] Eq. (C.5) |
---|
| 442 | ! |
---|
| 443 | !-- Calculation of component temperature at factual timestep |
---|
| 444 | theta_m_t = ( ( theta_m_t_prev & |
---|
| 445 | * ( ( c_m / 3600.0_wp ) - 0.5_wp * ( h_t_3 + h_t_wm ) ) & |
---|
| 446 | + phi_mtot & |
---|
| 447 | ) & |
---|
| 448 | / ( ( c_m / 3600.0_wp ) + 0.5_wp * ( h_t_3 + h_t_wm ) ) & |
---|
| 449 | ) !< [degree_C] Eq. (C.4) |
---|
| 450 | ! |
---|
| 451 | !-- Calculation of mean inner temperature for the RC-node in actual timestep |
---|
| 452 | theta_m = ( theta_m_t + theta_m_t_prev ) * 0.5_wp !< [degree_C] Eq. (C.9) |
---|
| 453 | |
---|
| 454 | ! |
---|
| 455 | !-- Calculation of mean surface temperature of the RC-node in actual timestep |
---|
| 456 | theta_s = ( ( h_t_ms * theta_m + phi_st + h_t_es * pt(k,j,i) & |
---|
| 457 | + h_t_1 * ( near_facade_temperature & |
---|
| 458 | + ( phi_ia + phi_hc_nd_dummy ) / h_v ) & |
---|
| 459 | ) & |
---|
| 460 | / ( h_t_ms + h_t_es + h_t_1 ) & |
---|
| 461 | ) !< [degree_C] Eq. (C.10) |
---|
| 462 | |
---|
| 463 | ! |
---|
| 464 | !-- Calculation of the air temperature of the RC-node |
---|
| 465 | theta_air = ( h_t_is * theta_s + h_v * near_facade_temperature & |
---|
| 466 | + phi_ia + phi_hc_nd_dummy ) / ( h_t_is + h_v ) !< [degree_C] Eq. (C.11) |
---|
| 467 | |
---|
| 468 | END SUBROUTINE im_calc_temperatures |
---|
| 469 | |
---|
| 470 | !------------------------------------------------------------------------------! |
---|
| 471 | ! Description: |
---|
| 472 | ! ------------ |
---|
| 473 | !> Initialization of the indoor model. |
---|
| 474 | !> Static information are calculated here, e.g. building parameters and |
---|
| 475 | !> geometrical information, everything that doesn't change in time. |
---|
| 476 | ! |
---|
| 477 | !-- Input values |
---|
| 478 | !-- Input datas from Palm, M4 |
---|
| 479 | ! i_global --> net_sw_in !< global radiation [W/m2] |
---|
| 480 | ! theta_e --> pt(k,j,i) !< undisturbed outside temperature, 1. PALM volume, for windows |
---|
| 481 | ! theta_sup = theta_f --> surf_usm_h%pt_10cm(m) |
---|
| 482 | ! surf_usm_v(l)%pt_10cm(m) !< Air temperature, facade near (10cm) air temperature from 1. Palm volume |
---|
| 483 | ! theta_node --> t_wall_h(nzt_wall,m) |
---|
| 484 | ! t_wall_v(l)%t(nzt_wall,m) !< Temperature of innermost wall layer, for opaque wall |
---|
| 485 | !------------------------------------------------------------------------------! |
---|
| 486 | SUBROUTINE im_init |
---|
| 487 | |
---|
| 488 | USE control_parameters, & |
---|
[4267] | 489 | ONLY: message_string, time_since_reference_point |
---|
[4246] | 490 | |
---|
| 491 | USE indices, & |
---|
[4346] | 492 | ONLY: nxl, nxr, nyn, nys, nzb, nzt, wall_flags_total_0 |
---|
[4246] | 493 | |
---|
| 494 | USE grid_variables, & |
---|
| 495 | ONLY: dx, dy |
---|
| 496 | |
---|
| 497 | USE pegrid |
---|
| 498 | |
---|
| 499 | USE surface_mod, & |
---|
| 500 | ONLY: surf_usm_h, surf_usm_v |
---|
| 501 | |
---|
| 502 | USE urban_surface_mod, & |
---|
| 503 | ONLY: building_pars, building_type |
---|
| 504 | |
---|
[4267] | 505 | INTEGER(iwp) :: bt !< local building type |
---|
| 506 | INTEGER(iwp) :: day_of_year !< day of the year |
---|
| 507 | INTEGER(iwp) :: i !< running index along x-direction |
---|
| 508 | INTEGER(iwp) :: j !< running index along y-direction |
---|
| 509 | INTEGER(iwp) :: k !< running index along z-direction |
---|
| 510 | INTEGER(iwp) :: l !< running index for surface-element orientation |
---|
| 511 | INTEGER(iwp) :: m !< running index surface elements |
---|
| 512 | INTEGER(iwp) :: n !< building index |
---|
| 513 | INTEGER(iwp) :: nb !< building index |
---|
[4246] | 514 | |
---|
| 515 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: build_ids !< building IDs on entire model domain |
---|
| 516 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: build_ids_final !< building IDs on entire model domain, |
---|
| 517 | !< multiple occurences are sorted out |
---|
| 518 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: build_ids_final_tmp !< temporary array used for resizing |
---|
| 519 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: build_ids_l !< building IDs on local subdomain |
---|
| 520 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: build_ids_l_tmp !< temporary array used to resize array of building IDs |
---|
| 521 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: displace_dum !< displacements of start addresses, used for MPI_ALLGATHERV |
---|
| 522 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: k_max_l !< highest vertical index of a building on subdomain |
---|
| 523 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: k_min_l !< lowest vertical index of a building on subdomain |
---|
| 524 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: n_fa !< counting array |
---|
| 525 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: num_facades_h !< dummy array used for summing-up total number of |
---|
| 526 | !< horizontal facade elements |
---|
| 527 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: num_facades_v !< dummy array used for summing-up total number of |
---|
| 528 | !< vertical facade elements |
---|
| 529 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: receive_dum_h !< dummy array used for MPI_ALLREDUCE |
---|
| 530 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: receive_dum_v !< dummy array used for MPI_ALLREDUCE |
---|
| 531 | |
---|
| 532 | INTEGER(iwp), DIMENSION(0:numprocs-1) :: num_buildings !< number of buildings with different ID on entire model domain |
---|
| 533 | INTEGER(iwp), DIMENSION(0:numprocs-1) :: num_buildings_l !< number of buildings with different ID on local subdomain |
---|
| 534 | |
---|
| 535 | REAL(wp) :: u_tmp !< dummy for temporary calculation of u-value without h_is |
---|
| 536 | REAL(wp) :: du_tmp !< 1/u_tmp |
---|
| 537 | REAL(wp) :: du_win_tmp !< 1/building(nb)%u_value_win |
---|
| 538 | REAL(wp) :: facade_area_v !< dummy to compute the total facade area from vertical walls |
---|
| 539 | |
---|
| 540 | REAL(wp), DIMENSION(:), ALLOCATABLE :: volume !< total building volume at each discrete height level |
---|
| 541 | REAL(wp), DIMENSION(:), ALLOCATABLE :: volume_l !< total building volume at each discrete height level, |
---|
| 542 | !< on local subdomain |
---|
| 543 | |
---|
| 544 | CALL location_message( 'initializing indoor model', 'start' ) |
---|
| 545 | ! |
---|
| 546 | !-- Initializing of indoor model is only possible if buildings can be |
---|
| 547 | !-- distinguished by their IDs. |
---|
| 548 | IF ( .NOT. building_id_f%from_file ) THEN |
---|
| 549 | message_string = 'Indoor model requires information about building_id' |
---|
| 550 | CALL message( 'im_init', 'PA0999', 1, 2, 0, 6, 0 ) |
---|
| 551 | ENDIF |
---|
| 552 | ! |
---|
| 553 | !-- Determine number of different building IDs on local subdomain. |
---|
| 554 | num_buildings_l = 0 |
---|
| 555 | num_buildings = 0 |
---|
| 556 | ALLOCATE( build_ids_l(1) ) |
---|
| 557 | DO i = nxl, nxr |
---|
| 558 | DO j = nys, nyn |
---|
| 559 | IF ( building_id_f%var(j,i) /= building_id_f%fill ) THEN |
---|
| 560 | IF ( num_buildings_l(myid) > 0 ) THEN |
---|
| 561 | IF ( ANY( building_id_f%var(j,i) .EQ. build_ids_l ) ) THEN |
---|
| 562 | CYCLE |
---|
| 563 | ELSE |
---|
| 564 | num_buildings_l(myid) = num_buildings_l(myid) + 1 |
---|
| 565 | ! |
---|
| 566 | !-- Resize array with different local building ids |
---|
| 567 | ALLOCATE( build_ids_l_tmp(1:SIZE(build_ids_l)) ) |
---|
| 568 | build_ids_l_tmp = build_ids_l |
---|
| 569 | DEALLOCATE( build_ids_l ) |
---|
| 570 | ALLOCATE( build_ids_l(1:num_buildings_l(myid)) ) |
---|
| 571 | build_ids_l(1:num_buildings_l(myid)-1) = & |
---|
| 572 | build_ids_l_tmp(1:num_buildings_l(myid)-1) |
---|
| 573 | build_ids_l(num_buildings_l(myid)) = building_id_f%var(j,i) |
---|
| 574 | DEALLOCATE( build_ids_l_tmp ) |
---|
| 575 | ENDIF |
---|
| 576 | ! |
---|
| 577 | !-- First occuring building id on PE |
---|
| 578 | ELSE |
---|
| 579 | num_buildings_l(myid) = num_buildings_l(myid) + 1 |
---|
| 580 | build_ids_l(1) = building_id_f%var(j,i) |
---|
| 581 | ENDIF |
---|
| 582 | ENDIF |
---|
| 583 | ENDDO |
---|
| 584 | ENDDO |
---|
| 585 | ! |
---|
| 586 | !-- Determine number of building IDs for the entire domain. (Note, building IDs |
---|
| 587 | !-- can appear multiple times as buildings might be distributed over several |
---|
| 588 | !-- PEs.) |
---|
| 589 | #if defined( __parallel ) |
---|
| 590 | CALL MPI_ALLREDUCE( num_buildings_l, num_buildings, numprocs, & |
---|
| 591 | MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
| 592 | #else |
---|
| 593 | num_buildings = num_buildings_l |
---|
| 594 | #endif |
---|
| 595 | ALLOCATE( build_ids(1:SUM(num_buildings)) ) |
---|
| 596 | ! |
---|
| 597 | !-- Gather building IDs. Therefore, first, determine displacements used |
---|
| 598 | !-- required for MPI_GATHERV call. |
---|
| 599 | ALLOCATE( displace_dum(0:numprocs-1) ) |
---|
| 600 | displace_dum(0) = 0 |
---|
| 601 | DO i = 1, numprocs-1 |
---|
| 602 | displace_dum(i) = displace_dum(i-1) + num_buildings(i-1) |
---|
| 603 | ENDDO |
---|
| 604 | |
---|
| 605 | #if defined( __parallel ) |
---|
| 606 | CALL MPI_ALLGATHERV( build_ids_l(1:num_buildings_l(myid)), & |
---|
| 607 | num_buildings(myid), & |
---|
| 608 | MPI_INTEGER, & |
---|
| 609 | build_ids, & |
---|
| 610 | num_buildings, & |
---|
| 611 | displace_dum, & |
---|
| 612 | MPI_INTEGER, & |
---|
| 613 | comm2d, ierr ) |
---|
| 614 | |
---|
| 615 | DEALLOCATE( displace_dum ) |
---|
| 616 | |
---|
| 617 | #else |
---|
| 618 | build_ids = build_ids_l |
---|
| 619 | #endif |
---|
| 620 | ! |
---|
| 621 | !-- Note: in parallel mode, building IDs can occur mutliple times, as |
---|
| 622 | !-- each PE has send its own ids. Therefore, sort out building IDs which |
---|
| 623 | !-- appear multiple times. |
---|
| 624 | num_build = 0 |
---|
| 625 | DO n = 1, SIZE(build_ids) |
---|
| 626 | |
---|
| 627 | IF ( ALLOCATED(build_ids_final) ) THEN |
---|
| 628 | IF ( ANY( build_ids(n) == build_ids_final ) ) THEN |
---|
| 629 | CYCLE |
---|
| 630 | ELSE |
---|
| 631 | num_build = num_build + 1 |
---|
| 632 | ! |
---|
| 633 | !-- Resize |
---|
| 634 | ALLOCATE( build_ids_final_tmp(1:num_build) ) |
---|
| 635 | build_ids_final_tmp(1:num_build-1) = build_ids_final(1:num_build-1) |
---|
| 636 | DEALLOCATE( build_ids_final ) |
---|
| 637 | ALLOCATE( build_ids_final(1:num_build) ) |
---|
| 638 | build_ids_final(1:num_build-1) = build_ids_final_tmp(1:num_build-1) |
---|
| 639 | build_ids_final(num_build) = build_ids(n) |
---|
| 640 | DEALLOCATE( build_ids_final_tmp ) |
---|
| 641 | ENDIF |
---|
| 642 | ELSE |
---|
| 643 | num_build = num_build + 1 |
---|
| 644 | ALLOCATE( build_ids_final(1:num_build) ) |
---|
| 645 | build_ids_final(num_build) = build_ids(n) |
---|
| 646 | ENDIF |
---|
| 647 | ENDDO |
---|
| 648 | |
---|
| 649 | ! |
---|
| 650 | !-- Allocate building-data structure array. Note, this is a global array |
---|
| 651 | !-- and all building IDs on domain are known by each PE. Further attributes, |
---|
| 652 | !-- e.g. height-dependent arrays, however, are only allocated on PEs where |
---|
| 653 | !-- the respective building is present (in order to reduce memory demands). |
---|
| 654 | ALLOCATE( buildings(1:num_build) ) |
---|
| 655 | |
---|
| 656 | ! |
---|
| 657 | !-- Store building IDs and check if building with certain ID is present on |
---|
| 658 | !-- subdomain. |
---|
| 659 | DO nb = 1, num_build |
---|
| 660 | buildings(nb)%id = build_ids_final(nb) |
---|
| 661 | |
---|
| 662 | IF ( ANY( building_id_f%var(nys:nyn,nxl:nxr) == buildings(nb)%id ) ) & |
---|
| 663 | buildings(nb)%on_pe = .TRUE. |
---|
| 664 | ENDDO |
---|
| 665 | ! |
---|
| 666 | !-- Determine the maximum vertical dimension occupied by each building. |
---|
| 667 | ALLOCATE( k_min_l(1:num_build) ) |
---|
| 668 | ALLOCATE( k_max_l(1:num_build) ) |
---|
| 669 | k_min_l = nzt + 1 |
---|
| 670 | k_max_l = 0 |
---|
| 671 | |
---|
| 672 | DO i = nxl, nxr |
---|
| 673 | DO j = nys, nyn |
---|
| 674 | IF ( building_id_f%var(j,i) /= building_id_f%fill ) THEN |
---|
| 675 | nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), & |
---|
| 676 | DIM = 1 ) |
---|
| 677 | DO k = nzb, nzt+1 |
---|
| 678 | ! |
---|
| 679 | !-- Check if grid point belongs to a building. |
---|
[4346] | 680 | IF ( BTEST( wall_flags_total_0(k,j,i), 6 ) ) THEN |
---|
[4246] | 681 | k_min_l(nb) = MIN( k_min_l(nb), k ) |
---|
| 682 | k_max_l(nb) = MAX( k_max_l(nb), k ) |
---|
| 683 | ENDIF |
---|
| 684 | |
---|
| 685 | ENDDO |
---|
| 686 | ENDIF |
---|
| 687 | ENDDO |
---|
| 688 | ENDDO |
---|
| 689 | |
---|
| 690 | #if defined( __parallel ) |
---|
| 691 | CALL MPI_ALLREDUCE( k_min_l(:), buildings(:)%kb_min, num_build, & |
---|
| 692 | MPI_INTEGER, MPI_MIN, comm2d, ierr ) |
---|
| 693 | CALL MPI_ALLREDUCE( k_max_l(:), buildings(:)%kb_max, num_build, & |
---|
| 694 | MPI_INTEGER, MPI_MAX, comm2d, ierr ) |
---|
| 695 | #else |
---|
| 696 | buildings(:)%kb_min = k_min_l(:) |
---|
| 697 | buildings(:)%kb_max = k_max_l(:) |
---|
| 698 | #endif |
---|
| 699 | |
---|
| 700 | DEALLOCATE( k_min_l ) |
---|
| 701 | DEALLOCATE( k_max_l ) |
---|
| 702 | ! |
---|
| 703 | !-- Calculate building height. |
---|
| 704 | DO nb = 1, num_build |
---|
| 705 | buildings(nb)%building_height = 0.0_wp |
---|
| 706 | DO k = buildings(nb)%kb_min, buildings(nb)%kb_max |
---|
| 707 | buildings(nb)%building_height = buildings(nb)%building_height & |
---|
| 708 | + dzw(k+1) |
---|
| 709 | ENDDO |
---|
| 710 | ENDDO |
---|
| 711 | ! |
---|
| 712 | !-- Calculate building volume |
---|
| 713 | DO nb = 1, num_build |
---|
| 714 | ! |
---|
| 715 | !-- Allocate temporary array for summing-up building volume |
---|
| 716 | ALLOCATE( volume(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 717 | ALLOCATE( volume_l(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 718 | volume = 0.0_wp |
---|
| 719 | volume_l = 0.0_wp |
---|
| 720 | ! |
---|
| 721 | !-- Calculate building volume per height level on each PE where |
---|
| 722 | !-- these building is present. |
---|
| 723 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 724 | |
---|
| 725 | ALLOCATE( buildings(nb)%volume(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 726 | ALLOCATE( buildings(nb)%vol_frac(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 727 | buildings(nb)%volume = 0.0_wp |
---|
| 728 | buildings(nb)%vol_frac = 0.0_wp |
---|
| 729 | |
---|
| 730 | IF ( ANY( building_id_f%var(nys:nyn,nxl:nxr) == buildings(nb)%id ) ) & |
---|
| 731 | THEN |
---|
| 732 | DO i = nxl, nxr |
---|
| 733 | DO j = nys, nyn |
---|
| 734 | DO k = buildings(nb)%kb_min, buildings(nb)%kb_max |
---|
| 735 | IF ( building_id_f%var(j,i) /= building_id_f%fill ) & |
---|
| 736 | volume_l(k) = volume_l(k) + dx * dy * dzw(k+1) |
---|
| 737 | ENDDO |
---|
| 738 | ENDDO |
---|
| 739 | ENDDO |
---|
| 740 | ENDIF |
---|
| 741 | ENDIF |
---|
| 742 | ! |
---|
| 743 | !-- Sum-up building volume from all subdomains |
---|
| 744 | #if defined( __parallel ) |
---|
| 745 | CALL MPI_ALLREDUCE( volume_l, volume, SIZE(volume), MPI_REAL, MPI_SUM, & |
---|
| 746 | comm2d, ierr ) |
---|
| 747 | #else |
---|
| 748 | volume = volume_l |
---|
| 749 | #endif |
---|
| 750 | ! |
---|
| 751 | !-- Save total building volume as well as local fraction on volume on |
---|
| 752 | !-- building data structure. |
---|
| 753 | IF ( ALLOCATED( buildings(nb)%volume ) ) buildings(nb)%volume = volume |
---|
| 754 | ! |
---|
| 755 | !-- Determine fraction of local on total building volume |
---|
| 756 | IF ( buildings(nb)%on_pe ) buildings(nb)%vol_frac = volume_l / volume |
---|
| 757 | ! |
---|
| 758 | !-- Calculate total building volume |
---|
| 759 | IF ( ALLOCATED( buildings(nb)%volume ) ) & |
---|
| 760 | buildings(nb)%vol_tot = SUM( buildings(nb)%volume ) |
---|
| 761 | |
---|
| 762 | DEALLOCATE( volume ) |
---|
| 763 | DEALLOCATE( volume_l ) |
---|
| 764 | |
---|
| 765 | ENDDO |
---|
| 766 | ! |
---|
| 767 | !-- Allocate arrays for indoor temperature. |
---|
| 768 | DO nb = 1, num_build |
---|
| 769 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 770 | ALLOCATE( buildings(nb)%t_in(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 771 | ALLOCATE( buildings(nb)%t_in_l(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 772 | buildings(nb)%t_in = 0.0_wp |
---|
| 773 | buildings(nb)%t_in_l = 0.0_wp |
---|
| 774 | ENDIF |
---|
| 775 | ENDDO |
---|
| 776 | ! |
---|
| 777 | !-- Allocate arrays for number of facades per height level. Distinguish between |
---|
| 778 | !-- horizontal and vertical facades. |
---|
| 779 | DO nb = 1, num_build |
---|
| 780 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 781 | ALLOCATE( buildings(nb)%num_facade_h(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 782 | ALLOCATE( buildings(nb)%num_facade_v(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 783 | |
---|
| 784 | buildings(nb)%num_facade_h = 0 |
---|
| 785 | buildings(nb)%num_facade_v = 0 |
---|
| 786 | ENDIF |
---|
| 787 | ENDDO |
---|
| 788 | ! |
---|
| 789 | !-- Determine number of facade elements per building on local subdomain. |
---|
| 790 | !-- Distinguish between horizontal and vertical facade elements. |
---|
| 791 | ! |
---|
| 792 | !-- Horizontal facades |
---|
| 793 | buildings(:)%num_facades_per_building_h_l = 0 |
---|
| 794 | DO m = 1, surf_usm_h%ns |
---|
| 795 | ! |
---|
| 796 | !-- For the current facade element determine corresponding building index. |
---|
| 797 | !-- First, obtain j,j,k indices of the building. Please note the |
---|
| 798 | !-- offset between facade/surface element and building location (for |
---|
| 799 | !-- horizontal surface elements the horizontal offsets are zero). |
---|
| 800 | i = surf_usm_h%i(m) + surf_usm_h%ioff |
---|
| 801 | j = surf_usm_h%j(m) + surf_usm_h%joff |
---|
| 802 | k = surf_usm_h%k(m) + surf_usm_h%koff |
---|
| 803 | ! |
---|
| 804 | !-- Determine building index and check whether building is on PE |
---|
| 805 | nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), DIM = 1 ) |
---|
| 806 | |
---|
| 807 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 808 | ! |
---|
| 809 | !-- Count number of facade elements at each height level. |
---|
| 810 | buildings(nb)%num_facade_h(k) = buildings(nb)%num_facade_h(k) + 1 |
---|
| 811 | ! |
---|
| 812 | !-- Moreover, sum up number of local facade elements per building. |
---|
| 813 | buildings(nb)%num_facades_per_building_h_l = & |
---|
| 814 | buildings(nb)%num_facades_per_building_h_l + 1 |
---|
| 815 | ENDIF |
---|
| 816 | ENDDO |
---|
| 817 | ! |
---|
| 818 | !-- Vertical facades |
---|
| 819 | buildings(:)%num_facades_per_building_v_l = 0 |
---|
| 820 | DO l = 0, 3 |
---|
| 821 | DO m = 1, surf_usm_v(l)%ns |
---|
| 822 | ! |
---|
| 823 | !-- For the current facade element determine corresponding building index. |
---|
| 824 | !-- First, obtain j,j,k indices of the building. Please note the |
---|
| 825 | !-- offset between facade/surface element and building location (for |
---|
| 826 | !-- vertical surface elements the vertical offsets are zero). |
---|
| 827 | i = surf_usm_v(l)%i(m) + surf_usm_v(l)%ioff |
---|
| 828 | j = surf_usm_v(l)%j(m) + surf_usm_v(l)%joff |
---|
| 829 | k = surf_usm_v(l)%k(m) + surf_usm_v(l)%koff |
---|
| 830 | |
---|
| 831 | nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), & |
---|
| 832 | DIM = 1 ) |
---|
| 833 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 834 | buildings(nb)%num_facade_v(k) = buildings(nb)%num_facade_v(k) + 1 |
---|
| 835 | buildings(nb)%num_facades_per_building_v_l = & |
---|
| 836 | buildings(nb)%num_facades_per_building_v_l + 1 |
---|
| 837 | ENDIF |
---|
| 838 | ENDDO |
---|
| 839 | ENDDO |
---|
| 840 | ! |
---|
| 841 | !-- Determine total number of facade elements per building and assign number to |
---|
| 842 | !-- building data type. |
---|
| 843 | DO nb = 1, num_build |
---|
| 844 | ! |
---|
| 845 | !-- Allocate dummy array used for summing-up facade elements. |
---|
| 846 | !-- Please note, dummy arguments are necessary as building-date type |
---|
| 847 | !-- arrays are not necessarily allocated on all PEs. |
---|
| 848 | ALLOCATE( num_facades_h(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 849 | ALLOCATE( num_facades_v(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 850 | ALLOCATE( receive_dum_h(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 851 | ALLOCATE( receive_dum_v(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 852 | num_facades_h = 0 |
---|
| 853 | num_facades_v = 0 |
---|
| 854 | receive_dum_h = 0 |
---|
| 855 | receive_dum_v = 0 |
---|
| 856 | |
---|
| 857 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 858 | num_facades_h = buildings(nb)%num_facade_h |
---|
| 859 | num_facades_v = buildings(nb)%num_facade_v |
---|
| 860 | ENDIF |
---|
| 861 | |
---|
| 862 | #if defined( __parallel ) |
---|
| 863 | CALL MPI_ALLREDUCE( num_facades_h, & |
---|
| 864 | receive_dum_h, & |
---|
| 865 | buildings(nb)%kb_max - buildings(nb)%kb_min + 1, & |
---|
| 866 | MPI_INTEGER, & |
---|
| 867 | MPI_SUM, & |
---|
| 868 | comm2d, & |
---|
| 869 | ierr ) |
---|
| 870 | |
---|
| 871 | CALL MPI_ALLREDUCE( num_facades_v, & |
---|
| 872 | receive_dum_v, & |
---|
| 873 | buildings(nb)%kb_max - buildings(nb)%kb_min + 1, & |
---|
| 874 | MPI_INTEGER, & |
---|
| 875 | MPI_SUM, & |
---|
| 876 | comm2d, & |
---|
| 877 | ierr ) |
---|
| 878 | IF ( ALLOCATED( buildings(nb)%num_facade_h ) ) & |
---|
| 879 | buildings(nb)%num_facade_h = receive_dum_h |
---|
| 880 | IF ( ALLOCATED( buildings(nb)%num_facade_v ) ) & |
---|
| 881 | buildings(nb)%num_facade_v = receive_dum_v |
---|
| 882 | #else |
---|
| 883 | buildings(nb)%num_facade_h = num_facades_h |
---|
| 884 | buildings(nb)%num_facade_v = num_facades_v |
---|
| 885 | #endif |
---|
| 886 | |
---|
| 887 | ! |
---|
| 888 | !-- Deallocate dummy arrays |
---|
| 889 | DEALLOCATE( num_facades_h ) |
---|
| 890 | DEALLOCATE( num_facades_v ) |
---|
| 891 | DEALLOCATE( receive_dum_h ) |
---|
| 892 | DEALLOCATE( receive_dum_v ) |
---|
| 893 | ! |
---|
| 894 | !-- Allocate index arrays which link facade elements with surface-data type. |
---|
| 895 | !-- Please note, no height levels are considered here (information is stored |
---|
| 896 | !-- in surface-data type itself). |
---|
| 897 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 898 | ! |
---|
| 899 | !-- Determine number of facade elements per building. |
---|
| 900 | buildings(nb)%num_facades_per_building_h = SUM( buildings(nb)%num_facade_h ) |
---|
| 901 | buildings(nb)%num_facades_per_building_v = SUM( buildings(nb)%num_facade_v ) |
---|
| 902 | ! |
---|
| 903 | !-- Allocate arrays which link the building with the horizontal and vertical |
---|
| 904 | !-- urban-type surfaces. Please note, linking arrays are allocated over all |
---|
| 905 | !-- facade elements, which is required in case a building is located at the |
---|
| 906 | !-- subdomain boundaries, where the building and the corresponding surface |
---|
| 907 | !-- elements are located on different subdomains. |
---|
| 908 | ALLOCATE( buildings(nb)%m_h(1:buildings(nb)%num_facades_per_building_h_l) ) |
---|
| 909 | |
---|
| 910 | ALLOCATE( buildings(nb)%l_v(1:buildings(nb)%num_facades_per_building_v_l) ) |
---|
| 911 | ALLOCATE( buildings(nb)%m_v(1:buildings(nb)%num_facades_per_building_v_l) ) |
---|
| 912 | ENDIF |
---|
[4402] | 913 | |
---|
[4246] | 914 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 915 | ALLOCATE( buildings(nb)%vpf(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 916 | buildings(nb)%vpf = 0.0_wp |
---|
[4402] | 917 | |
---|
[4246] | 918 | facade_area_v = 0.0_wp |
---|
| 919 | DO k = buildings(nb)%kb_min, buildings(nb)%kb_max |
---|
| 920 | facade_area_v = facade_area_v + buildings(nb)%num_facade_v(k) & |
---|
| 921 | * dzw(k+1) * dx |
---|
| 922 | ENDDO |
---|
[4402] | 923 | ! |
---|
| 924 | !-- Determine volume per total facade area (vpf). For the horizontal facade |
---|
| 925 | !-- area num_facades_per_building_h can be taken, multiplied with dx*dy. |
---|
| 926 | !-- However, due to grid stretching, vertical facade elements must be |
---|
| 927 | !-- summed-up vertically. Please note, if dx /= dy, an error is made! |
---|
[4246] | 928 | buildings(nb)%vpf = buildings(nb)%vol_tot / & |
---|
| 929 | ( buildings(nb)%num_facades_per_building_h * dx * dy + & |
---|
| 930 | facade_area_v ) |
---|
[4402] | 931 | ! |
---|
| 932 | !-- Determine floor-area-per-facade. |
---|
| 933 | buildings(nb)%fapf = buildings(nb)%num_facades_per_building_h & |
---|
| 934 | * dx * dy & |
---|
| 935 | / ( buildings(nb)%num_facades_per_building_h & |
---|
| 936 | * dx * dy + facade_area_v ) |
---|
[4246] | 937 | ENDIF |
---|
| 938 | ENDDO |
---|
| 939 | ! |
---|
| 940 | !-- Link facade elements with surface data type. |
---|
| 941 | !-- Allocate array for counting. |
---|
| 942 | ALLOCATE( n_fa(1:num_build) ) |
---|
| 943 | n_fa = 1 |
---|
| 944 | |
---|
| 945 | DO m = 1, surf_usm_h%ns |
---|
| 946 | i = surf_usm_h%i(m) + surf_usm_h%ioff |
---|
| 947 | j = surf_usm_h%j(m) + surf_usm_h%joff |
---|
| 948 | |
---|
| 949 | nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), DIM = 1 ) |
---|
| 950 | |
---|
| 951 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 952 | buildings(nb)%m_h(n_fa(nb)) = m |
---|
| 953 | n_fa(nb) = n_fa(nb) + 1 |
---|
| 954 | ENDIF |
---|
| 955 | ENDDO |
---|
| 956 | |
---|
| 957 | n_fa = 1 |
---|
| 958 | DO l = 0, 3 |
---|
| 959 | DO m = 1, surf_usm_v(l)%ns |
---|
| 960 | i = surf_usm_v(l)%i(m) + surf_usm_v(l)%ioff |
---|
| 961 | j = surf_usm_v(l)%j(m) + surf_usm_v(l)%joff |
---|
| 962 | |
---|
| 963 | nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), DIM = 1 ) |
---|
| 964 | |
---|
| 965 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 966 | buildings(nb)%l_v(n_fa(nb)) = l |
---|
| 967 | buildings(nb)%m_v(n_fa(nb)) = m |
---|
| 968 | n_fa(nb) = n_fa(nb) + 1 |
---|
| 969 | ENDIF |
---|
| 970 | ENDDO |
---|
| 971 | ENDDO |
---|
| 972 | DEALLOCATE( n_fa ) |
---|
| 973 | ! |
---|
| 974 | !-- Initialize building parameters, first by mean building type. Note, |
---|
| 975 | !-- in this case all buildings have the same type. |
---|
| 976 | !-- In a second step initialize with building tpyes from static input file, |
---|
| 977 | !-- where building types can be individual for each building. |
---|
[4267] | 978 | buildings(:)%lambda_layer3 = building_pars(31,building_type) |
---|
| 979 | buildings(:)%s_layer3 = building_pars(44,building_type) |
---|
[4246] | 980 | buildings(:)%f_c_win = building_pars(119,building_type) |
---|
| 981 | buildings(:)%g_value_win = building_pars(120,building_type) |
---|
[4267] | 982 | buildings(:)%u_value_win = building_pars(121,building_type) |
---|
[4246] | 983 | buildings(:)%eta_ve = building_pars(124,building_type) |
---|
| 984 | buildings(:)%factor_a = building_pars(125,building_type) |
---|
| 985 | buildings(:)%factor_c = building_pars(126,building_type) |
---|
| 986 | buildings(:)%lambda_at = building_pars(127,building_type) |
---|
[4267] | 987 | buildings(:)%theta_int_h_set = building_pars(13,building_type) |
---|
| 988 | buildings(:)%theta_int_c_set = building_pars(12,building_type) |
---|
[4246] | 989 | buildings(:)%q_h_max = building_pars(128,building_type) |
---|
| 990 | buildings(:)%q_c_max = building_pars(129,building_type) |
---|
| 991 | buildings(:)%qint_high = building_pars(130,building_type) |
---|
| 992 | buildings(:)%qint_low = building_pars(131,building_type) |
---|
| 993 | buildings(:)%height_storey = building_pars(132,building_type) |
---|
| 994 | buildings(:)%height_cei_con = building_pars(133,building_type) |
---|
| 995 | buildings(:)%params_waste_heat_h = building_pars(134,building_type) |
---|
| 996 | buildings(:)%params_waste_heat_c = building_pars(135,building_type) |
---|
| 997 | ! |
---|
[4267] | 998 | !-- Initialize seasonal dependent parameters, depending on day of the year. |
---|
| 999 | !-- First, calculated day of the year. |
---|
| 1000 | CALL get_date_time( time_since_reference_point, day_of_year = day_of_year ) |
---|
| 1001 | ! |
---|
| 1002 | !-- Summer is defined in between northward- and southward equinox. |
---|
| 1003 | IF ( day_of_year >= northward_equinox .AND. & |
---|
| 1004 | day_of_year <= southward_equinox ) THEN |
---|
| 1005 | buildings(:)%air_change_low = summer_pars(0,building_type) |
---|
| 1006 | buildings(:)%air_change_high = summer_pars(1,building_type) |
---|
| 1007 | ELSE |
---|
| 1008 | buildings(:)%air_change_low = winter_pars(0,building_type) |
---|
| 1009 | buildings(:)%air_change_high = winter_pars(1,building_type) |
---|
| 1010 | ENDIF |
---|
| 1011 | ! |
---|
[4246] | 1012 | !-- Initialize ventilaation load. Please note, building types > 7 are actually |
---|
| 1013 | !-- not allowed (check already in urban_surface_mod and netcdf_data_input_mod. |
---|
| 1014 | !-- However, the building data base may be later extended. |
---|
| 1015 | IF ( building_type == 1 .OR. building_type == 2 .OR. & |
---|
| 1016 | building_type == 3 .OR. building_type == 10 .OR. & |
---|
| 1017 | building_type == 11 .OR. building_type == 12 ) THEN |
---|
| 1018 | buildings(:)%ventilation_int_loads = 1 |
---|
| 1019 | ! |
---|
| 1020 | !-- Office, building with large windows |
---|
| 1021 | ELSEIF ( building_type == 4 .OR. building_type == 5 .OR. & |
---|
| 1022 | building_type == 6 .OR. building_type == 7 .OR. & |
---|
| 1023 | building_type == 8 .OR. building_type == 9) THEN |
---|
| 1024 | buildings(:)%ventilation_int_loads = 2 |
---|
| 1025 | ! |
---|
| 1026 | !-- Industry, hospitals |
---|
| 1027 | ELSEIF ( building_type == 13 .OR. building_type == 14 .OR. & |
---|
| 1028 | building_type == 15 .OR. building_type == 16 .OR. & |
---|
| 1029 | building_type == 17 .OR. building_type == 18 ) THEN |
---|
| 1030 | buildings(:)%ventilation_int_loads = 3 |
---|
| 1031 | ENDIF |
---|
| 1032 | ! |
---|
| 1033 | !-- Initialization of building parameters - level 2 |
---|
| 1034 | IF ( building_type_f%from_file ) THEN |
---|
| 1035 | DO i = nxl, nxr |
---|
| 1036 | DO j = nys, nyn |
---|
| 1037 | IF ( building_id_f%var(j,i) /= building_id_f%fill ) THEN |
---|
| 1038 | nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), & |
---|
| 1039 | DIM = 1 ) |
---|
| 1040 | bt = building_type_f%var(j,i) |
---|
| 1041 | |
---|
[4267] | 1042 | buildings(nb)%lambda_layer3 = building_pars(31,bt) |
---|
| 1043 | buildings(nb)%s_layer3 = building_pars(44,bt) |
---|
[4246] | 1044 | buildings(nb)%f_c_win = building_pars(119,bt) |
---|
| 1045 | buildings(nb)%g_value_win = building_pars(120,bt) |
---|
| 1046 | buildings(nb)%u_value_win = building_pars(121,bt) |
---|
| 1047 | buildings(nb)%eta_ve = building_pars(124,bt) |
---|
| 1048 | buildings(nb)%factor_a = building_pars(125,bt) |
---|
| 1049 | buildings(nb)%factor_c = building_pars(126,bt) |
---|
| 1050 | buildings(nb)%lambda_at = building_pars(127,bt) |
---|
[4267] | 1051 | buildings(nb)%theta_int_h_set = building_pars(13,bt) |
---|
| 1052 | buildings(nb)%theta_int_c_set = building_pars(12,bt) |
---|
[4246] | 1053 | buildings(nb)%q_h_max = building_pars(128,bt) |
---|
| 1054 | buildings(nb)%q_c_max = building_pars(129,bt) |
---|
| 1055 | buildings(nb)%qint_high = building_pars(130,bt) |
---|
| 1056 | buildings(nb)%qint_low = building_pars(131,bt) |
---|
| 1057 | buildings(nb)%height_storey = building_pars(132,bt) |
---|
| 1058 | buildings(nb)%height_cei_con = building_pars(133,bt) |
---|
| 1059 | buildings(nb)%params_waste_heat_h = building_pars(134,bt) |
---|
| 1060 | buildings(nb)%params_waste_heat_c = building_pars(135,bt) |
---|
[4267] | 1061 | |
---|
| 1062 | IF ( day_of_year >= northward_equinox .AND. & |
---|
| 1063 | day_of_year <= southward_equinox ) THEN |
---|
| 1064 | buildings(nb)%air_change_low = summer_pars(0,bt) |
---|
| 1065 | buildings(nb)%air_change_high = summer_pars(1,bt) |
---|
| 1066 | ELSE |
---|
| 1067 | buildings(nb)%air_change_low = winter_pars(0,bt) |
---|
| 1068 | buildings(nb)%air_change_high = winter_pars(1,bt) |
---|
| 1069 | ENDIF |
---|
| 1070 | |
---|
[4246] | 1071 | ! |
---|
| 1072 | !-- Initialize ventilaation load. Please note, building types > 7 |
---|
| 1073 | !-- are actually not allowed (check already in urban_surface_mod |
---|
| 1074 | !-- and netcdf_data_input_mod. However, the building data base may |
---|
| 1075 | !-- be later extended. |
---|
| 1076 | IF ( bt == 1 .OR. bt == 2 .OR. & |
---|
| 1077 | bt == 3 .OR. bt == 10 .OR. & |
---|
| 1078 | bt == 11 .OR. bt == 12 ) THEN |
---|
| 1079 | buildings(nb)%ventilation_int_loads = 1 |
---|
| 1080 | ! |
---|
| 1081 | !-- Office, building with large windows |
---|
| 1082 | ELSEIF ( bt == 4 .OR. bt == 5 .OR. & |
---|
| 1083 | bt == 6 .OR. bt == 7 .OR. & |
---|
| 1084 | bt == 8 .OR. bt == 9) THEN |
---|
| 1085 | buildings(nb)%ventilation_int_loads = 2 |
---|
| 1086 | ! |
---|
| 1087 | !-- Industry, hospitals |
---|
| 1088 | ELSEIF ( bt == 13 .OR. bt == 14 .OR. & |
---|
| 1089 | bt == 15 .OR. bt == 16 .OR. & |
---|
| 1090 | bt == 17 .OR. bt == 18 ) THEN |
---|
| 1091 | buildings(nb)%ventilation_int_loads = 3 |
---|
| 1092 | ENDIF |
---|
| 1093 | ENDIF |
---|
| 1094 | ENDDO |
---|
| 1095 | ENDDO |
---|
| 1096 | ENDIF |
---|
| 1097 | ! |
---|
| 1098 | !-- Calculation of surface-related heat transfer coeffiecient |
---|
| 1099 | !-- out of standard u-values from building database |
---|
| 1100 | !-- only amount of extern and surface is used |
---|
| 1101 | !-- otherwise amount between air and surface taken account twice |
---|
| 1102 | DO nb = 1, num_build |
---|
| 1103 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 1104 | du_win_tmp = 1.0_wp / buildings(nb)%u_value_win |
---|
| 1105 | u_tmp = buildings(nb)%u_value_win * ( du_win_tmp / ( du_win_tmp - & |
---|
| 1106 | 0.125_wp + ( 1.0_wp / h_is ) ) ) |
---|
| 1107 | |
---|
| 1108 | du_tmp = 1.0_wp / u_tmp |
---|
| 1109 | |
---|
[4267] | 1110 | buildings(nb)%h_es = 1.0_wp / ( du_tmp - ( 1.0_wp / h_is ) ) |
---|
| 1111 | |
---|
[4246] | 1112 | ENDIF |
---|
| 1113 | ENDDO |
---|
| 1114 | ! |
---|
| 1115 | !-- Initial room temperature [K] |
---|
| 1116 | !-- (after first loop, use theta_m_t as theta_m_t_prev) |
---|
| 1117 | theta_m_t_prev = initial_indoor_temperature |
---|
| 1118 | ! |
---|
| 1119 | !-- Initialize indoor temperature. Actually only for output at initial state. |
---|
| 1120 | DO nb = 1, num_build |
---|
| 1121 | IF ( buildings(nb)%on_pe ) & |
---|
| 1122 | buildings(nb)%t_in(:) = initial_indoor_temperature |
---|
| 1123 | ENDDO |
---|
| 1124 | |
---|
| 1125 | CALL location_message( 'initializing indoor model', 'finished' ) |
---|
| 1126 | |
---|
| 1127 | END SUBROUTINE im_init |
---|
| 1128 | |
---|
| 1129 | |
---|
| 1130 | !------------------------------------------------------------------------------! |
---|
| 1131 | ! Description: |
---|
| 1132 | ! ------------ |
---|
| 1133 | !> Main part of the indoor model. |
---|
| 1134 | !> Calculation of .... (kanani: Please describe) |
---|
| 1135 | !------------------------------------------------------------------------------! |
---|
| 1136 | SUBROUTINE im_main_heatcool |
---|
| 1137 | |
---|
| 1138 | ! USE basic_constants_and_equations_mod, & |
---|
| 1139 | ! ONLY: c_p |
---|
| 1140 | |
---|
| 1141 | USE control_parameters, & |
---|
| 1142 | ONLY: time_since_reference_point |
---|
| 1143 | |
---|
| 1144 | USE grid_variables, & |
---|
| 1145 | ONLY: dx, dy |
---|
| 1146 | |
---|
| 1147 | USE pegrid |
---|
| 1148 | |
---|
| 1149 | USE surface_mod, & |
---|
| 1150 | ONLY: ind_veg_wall, ind_wat_win, surf_usm_h, surf_usm_v |
---|
| 1151 | |
---|
| 1152 | USE urban_surface_mod, & |
---|
| 1153 | ONLY: nzt_wall, t_wall_h, t_wall_v, t_window_h, t_window_v, & |
---|
| 1154 | building_type |
---|
| 1155 | |
---|
| 1156 | INTEGER(iwp) :: i !< index of facade-adjacent atmosphere grid point in x-direction |
---|
| 1157 | INTEGER(iwp) :: j !< index of facade-adjacent atmosphere grid point in y-direction |
---|
| 1158 | INTEGER(iwp) :: k !< index of facade-adjacent atmosphere grid point in z-direction |
---|
| 1159 | INTEGER(iwp) :: kk !< vertical index of indoor grid point adjacent to facade |
---|
| 1160 | INTEGER(iwp) :: l !< running index for surface-element orientation |
---|
| 1161 | INTEGER(iwp) :: m !< running index surface elements |
---|
| 1162 | INTEGER(iwp) :: nb !< running index for buildings |
---|
| 1163 | INTEGER(iwp) :: fa !< running index for facade elements of each building |
---|
| 1164 | |
---|
| 1165 | REAL(wp) :: indoor_wall_window_temperature !< weighted temperature of innermost wall/window layer |
---|
| 1166 | REAL(wp) :: near_facade_temperature !< outside air temperature 10cm away from facade |
---|
| 1167 | REAL(wp) :: second_of_day !< second of the current day |
---|
| 1168 | REAL(wp) :: time_utc_hour !< time of day (hour UTC) |
---|
| 1169 | |
---|
| 1170 | REAL(wp), DIMENSION(:), ALLOCATABLE :: t_in_l_send !< dummy send buffer used for summing-up indoor temperature per kk-level |
---|
| 1171 | REAL(wp), DIMENSION(:), ALLOCATABLE :: t_in_recv !< dummy recv buffer used for summing-up indoor temperature per kk-level |
---|
| 1172 | ! |
---|
| 1173 | !-- Determine time of day in hours. |
---|
| 1174 | CALL get_date_time( time_since_reference_point, second_of_day=second_of_day ) |
---|
| 1175 | time_utc_hour = second_of_day / seconds_per_hour |
---|
| 1176 | ! |
---|
| 1177 | !-- Following calculations must be done for each facade element. |
---|
| 1178 | DO nb = 1, num_build |
---|
| 1179 | ! |
---|
| 1180 | !-- First, check whether building is present on local subdomain. |
---|
| 1181 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 1182 | ! |
---|
| 1183 | !-- Determine daily schedule. 08:00-18:00 = 1, other hours = 0. |
---|
| 1184 | !-- Residental Building, panel WBS 70 |
---|
| 1185 | IF ( buildings(nb)%ventilation_int_loads == 1 ) THEN |
---|
[4267] | 1186 | IF ( time_utc_hour >= 8.0_wp .AND. time_utc_hour <= 18.0_wp ) THEN |
---|
| 1187 | schedule_d = 0 |
---|
| 1188 | ELSE |
---|
[4246] | 1189 | schedule_d = 1 |
---|
| 1190 | ENDIF |
---|
| 1191 | ENDIF |
---|
| 1192 | ! |
---|
| 1193 | !-- Office, building with large windows |
---|
| 1194 | IF ( buildings(nb)%ventilation_int_loads == 2 ) THEN |
---|
| 1195 | IF ( time_utc_hour >= 8.0_wp .AND. time_utc_hour <= 18.0_wp ) THEN |
---|
| 1196 | schedule_d = 1 |
---|
| 1197 | ELSE |
---|
| 1198 | schedule_d = 0 |
---|
| 1199 | ENDIF |
---|
| 1200 | ENDIF |
---|
| 1201 | ! |
---|
| 1202 | !-- Industry, hospitals |
---|
| 1203 | IF ( buildings(nb)%ventilation_int_loads == 3 ) THEN |
---|
| 1204 | IF ( time_utc_hour >= 6.0_wp .AND. time_utc_hour <= 22.0_wp ) THEN |
---|
| 1205 | schedule_d = 1 |
---|
| 1206 | ELSE |
---|
| 1207 | schedule_d = 0 |
---|
| 1208 | ENDIF |
---|
| 1209 | ENDIF |
---|
| 1210 | ! |
---|
| 1211 | !-- Initialize/reset indoor temperature |
---|
| 1212 | buildings(nb)%t_in_l = 0.0_wp |
---|
| 1213 | ! |
---|
| 1214 | !-- Horizontal surfaces |
---|
| 1215 | DO fa = 1, buildings(nb)%num_facades_per_building_h_l |
---|
| 1216 | ! |
---|
| 1217 | !-- Determine index where corresponding surface-type information |
---|
| 1218 | !-- is stored. |
---|
| 1219 | m = buildings(nb)%m_h(fa) |
---|
| 1220 | ! |
---|
| 1221 | !-- Determine building height level index. |
---|
| 1222 | kk = surf_usm_h%k(m) + surf_usm_h%koff |
---|
[4402] | 1223 | ! |
---|
[4246] | 1224 | !-- Building geometries --> not time-dependent |
---|
[4402] | 1225 | facade_element_area = dx * dy !< [m2] surface area per facade element |
---|
| 1226 | floor_area_per_facade = buildings(nb)%fapf !< [m2/m2] floor area per facade area |
---|
| 1227 | indoor_volume_per_facade = buildings(nb)%vpf(kk) !< [m3/m2] indoor air volume per facade area |
---|
[4246] | 1228 | buildings(nb)%area_facade = facade_element_area * & |
---|
| 1229 | ( buildings(nb)%num_facades_per_building_h + & |
---|
| 1230 | buildings(nb)%num_facades_per_building_v ) !< [m2] area of total facade |
---|
[4441] | 1231 | window_area_per_facade = surf_usm_h%frac(m,ind_wat_win) * facade_element_area !< [m2] window area per facade element |
---|
[4246] | 1232 | |
---|
| 1233 | buildings(nb)%net_floor_area = buildings(nb)%vol_tot / ( buildings(nb)%height_storey ) |
---|
| 1234 | total_area = buildings(nb)%net_floor_area !< [m2] area of all surfaces pointing to zone Eq. (9) according to section 7.2.2.2 |
---|
| 1235 | a_m = buildings(nb)%factor_a * total_area * & |
---|
| 1236 | ( facade_element_area / buildings(nb)%area_facade ) * & |
---|
| 1237 | buildings(nb)%lambda_at !< [m2] standard values according to Table 12 section 12.3.1.2 (calculate over Eq. (65) according to section 12.3.1.2) |
---|
| 1238 | c_m = buildings(nb)%factor_c * total_area * & |
---|
| 1239 | ( facade_element_area / buildings(nb)%area_facade ) !< [J/K] standard values according to table 12 section 12.3.1.2 (calculate over Eq. (66) according to section 12.3.1.2) |
---|
| 1240 | ! |
---|
| 1241 | !-- Calculation of heat transfer coefficient for transmission --> not time-dependent |
---|
| 1242 | h_t_es = window_area_per_facade * buildings(nb)%h_es !< [W/K] only for windows |
---|
| 1243 | |
---|
| 1244 | h_t_is = buildings(nb)%area_facade * h_is !< [W/K] with h_is = 3.45 W / (m2 K) between surface and air, Eq. (9) |
---|
| 1245 | h_t_ms = a_m * h_ms !< [W/K] with h_ms = 9.10 W / (m2 K) between component and surface, Eq. (64) |
---|
| 1246 | h_t_wall = 1.0_wp / ( 1.0_wp / ( ( facade_element_area - window_area_per_facade ) & !< [W/K] |
---|
| 1247 | * buildings(nb)%lambda_layer3 / buildings(nb)%s_layer3 * 0.5_wp & |
---|
| 1248 | ) + 1.0_wp / h_t_ms ) !< [W/K] opaque components |
---|
| 1249 | h_t_wm = 1.0_wp / ( 1.0_wp / h_t_wall - 1.0_wp / h_t_ms ) !< [W/K] emmision Eq. (63), Section 12.2.2 |
---|
| 1250 | ! |
---|
| 1251 | !-- internal air loads dependent on the occupacy of the room |
---|
| 1252 | !-- basical internal heat gains (qint_low) with additional internal heat gains by occupancy (qint_high) (0,5*phi_int) |
---|
| 1253 | phi_ia = 0.5_wp * ( ( buildings(nb)%qint_high * schedule_d + buildings(nb)%qint_low ) & |
---|
| 1254 | * floor_area_per_facade ) |
---|
| 1255 | q_int = phi_ia / total_area |
---|
| 1256 | ! |
---|
| 1257 | !-- Airflow dependent on the occupacy of the room |
---|
| 1258 | !-- basical airflow (air_change_low) with additional airflow gains by occupancy (air_change_high) |
---|
| 1259 | air_change = ( buildings(nb)%air_change_high * schedule_d + buildings(nb)%air_change_low ) !< [1/h]? |
---|
| 1260 | ! |
---|
| 1261 | !-- Heat transfer of ventilation |
---|
| 1262 | !-- not less than 0.01 W/K to provide division by 0 in further calculations |
---|
| 1263 | !-- with heat capacity of air 0.33 Wh/m2K |
---|
| 1264 | h_v = MAX( 0.01_wp , ( air_change * indoor_volume_per_facade * & |
---|
| 1265 | 0.33_wp * (1.0_wp - buildings(nb)%eta_ve ) ) ) !< [W/K] from ISO 13789 Eq.(10) |
---|
| 1266 | |
---|
| 1267 | !-- Heat transfer coefficient auxiliary variables |
---|
| 1268 | h_t_1 = 1.0_wp / ( ( 1.0_wp / h_v ) + ( 1.0_wp / h_t_is ) ) !< [W/K] Eq. (C.6) |
---|
| 1269 | h_t_2 = h_t_1 + h_t_es !< [W/K] Eq. (C.7) |
---|
| 1270 | h_t_3 = 1.0_wp / ( ( 1.0_wp / h_t_2 ) + ( 1.0_wp / h_t_ms ) ) !< [W/K] Eq. (C.8) |
---|
| 1271 | ! |
---|
| 1272 | !-- Net short-wave radiation through window area (was i_global) |
---|
| 1273 | net_sw_in = surf_usm_h%rad_sw_in(m) - surf_usm_h%rad_sw_out(m) |
---|
| 1274 | ! |
---|
| 1275 | !-- Quantities needed for im_calc_temperatures |
---|
| 1276 | i = surf_usm_h%i(m) |
---|
| 1277 | j = surf_usm_h%j(m) |
---|
| 1278 | k = surf_usm_h%k(m) |
---|
| 1279 | near_facade_temperature = surf_usm_h%pt_10cm(m) |
---|
| 1280 | indoor_wall_window_temperature = & |
---|
[4441] | 1281 | surf_usm_h%frac(m,ind_veg_wall) * t_wall_h(nzt_wall,m) & |
---|
| 1282 | + surf_usm_h%frac(m,ind_wat_win) * t_window_h(nzt_wall,m) |
---|
[4246] | 1283 | ! |
---|
| 1284 | !-- Solar thermal gains. If net_sw_in larger than sun-protection |
---|
| 1285 | !-- threshold parameter (params_solar_protection), sun protection will |
---|
| 1286 | !-- be activated |
---|
| 1287 | IF ( net_sw_in <= params_solar_protection ) THEN |
---|
| 1288 | solar_protection_off = 1 |
---|
| 1289 | solar_protection_on = 0 |
---|
| 1290 | ELSE |
---|
| 1291 | solar_protection_off = 0 |
---|
| 1292 | solar_protection_on = 1 |
---|
| 1293 | ENDIF |
---|
| 1294 | ! |
---|
| 1295 | !-- Calculation of total heat gains from net_sw_in through windows [W] in respect on automatic sun protection |
---|
| 1296 | !-- DIN 4108 - 2 chap.8 |
---|
| 1297 | phi_sol = ( window_area_per_facade * net_sw_in * solar_protection_off & |
---|
| 1298 | + window_area_per_facade * net_sw_in * buildings(nb)%f_c_win * solar_protection_on ) & |
---|
| 1299 | * buildings(nb)%g_value_win * ( 1.0_wp - params_f_f ) * params_f_w |
---|
| 1300 | q_sol = phi_sol |
---|
| 1301 | ! |
---|
| 1302 | !-- Calculation of the mass specific thermal load for internal and external heatsources of the inner node |
---|
| 1303 | phi_m = (a_m / total_area) * ( phi_ia + phi_sol ) !< [W] Eq. (C.2) with phi_ia=0,5*phi_int |
---|
| 1304 | q_c_m = phi_m |
---|
| 1305 | ! |
---|
| 1306 | !-- Calculation mass specific thermal load implied non thermal mass |
---|
| 1307 | phi_st = ( 1.0_wp - ( a_m / total_area ) - ( h_t_es / ( 9.1_wp * total_area ) ) ) & |
---|
| 1308 | * ( phi_ia + phi_sol ) !< [W] Eq. (C.3) with phi_ia=0,5*phi_int |
---|
| 1309 | q_c_st = phi_st |
---|
| 1310 | ! |
---|
| 1311 | !-- Calculations for deriving indoor temperature and heat flux into the wall |
---|
| 1312 | !-- Step 1: Indoor temperature without heating and cooling |
---|
| 1313 | !-- section C.4.1 Picture C.2 zone 3) |
---|
| 1314 | phi_hc_nd = 0.0_wp |
---|
| 1315 | |
---|
| 1316 | CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, & |
---|
| 1317 | near_facade_temperature, phi_hc_nd ) |
---|
| 1318 | ! |
---|
| 1319 | !-- If air temperature between border temperatures of heating and cooling, assign output variable, then ready |
---|
| 1320 | IF ( buildings(nb)%theta_int_h_set <= theta_air .AND. theta_air <= buildings(nb)%theta_int_c_set ) THEN |
---|
| 1321 | phi_hc_nd_ac = 0.0_wp |
---|
| 1322 | phi_hc_nd = phi_hc_nd_ac |
---|
| 1323 | theta_air_ac = theta_air |
---|
| 1324 | ! |
---|
| 1325 | !-- Step 2: Else, apply 10 W/m2 heating/cooling power and calculate indoor temperature |
---|
| 1326 | !-- again. |
---|
| 1327 | ELSE |
---|
| 1328 | ! |
---|
| 1329 | !-- Temperature not correct, calculation method according to section C4.2 |
---|
| 1330 | theta_air_0 = theta_air !< temperature without heating/cooling |
---|
| 1331 | ! |
---|
| 1332 | !-- Heating or cooling? |
---|
| 1333 | IF ( theta_air_0 > buildings(nb)%theta_int_c_set ) THEN |
---|
| 1334 | theta_air_set = buildings(nb)%theta_int_c_set |
---|
| 1335 | ELSE |
---|
| 1336 | theta_air_set = buildings(nb)%theta_int_h_set |
---|
| 1337 | ENDIF |
---|
| 1338 | ! |
---|
| 1339 | !-- Calculate the temperature with phi_hc_nd_10 |
---|
| 1340 | phi_hc_nd_10 = 10.0_wp * floor_area_per_facade |
---|
| 1341 | phi_hc_nd = phi_hc_nd_10 |
---|
| 1342 | |
---|
| 1343 | CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, & |
---|
| 1344 | near_facade_temperature, phi_hc_nd ) |
---|
| 1345 | theta_air_10 = theta_air !< temperature with 10 W/m2 of heating |
---|
| 1346 | phi_hc_nd_un = phi_hc_nd_10 * (theta_air_set - theta_air_0) & |
---|
| 1347 | / (theta_air_10 - theta_air_0) !< Eq. (C.13) |
---|
| 1348 | ! |
---|
| 1349 | !-- Step 3: With temperature ratio to determine the heating or cooling capacity |
---|
| 1350 | !-- If necessary, limit the power to maximum power |
---|
| 1351 | !-- section C.4.1 Picture C.2 zone 2) and 4) |
---|
| 1352 | buildings(nb)%phi_c_max = buildings(nb)%q_c_max * floor_area_per_facade |
---|
| 1353 | buildings(nb)%phi_h_max = buildings(nb)%q_h_max * floor_area_per_facade |
---|
| 1354 | IF ( buildings(nb)%phi_c_max < phi_hc_nd_un .AND. phi_hc_nd_un < buildings(nb)%phi_h_max ) THEN |
---|
| 1355 | phi_hc_nd_ac = phi_hc_nd_un |
---|
| 1356 | phi_hc_nd = phi_hc_nd_un |
---|
| 1357 | ELSE |
---|
| 1358 | ! |
---|
| 1359 | !-- Step 4: Inner temperature with maximum heating (phi_hc_nd_un positive) or cooling (phi_hc_nd_un negative) |
---|
| 1360 | !-- section C.4.1 Picture C.2 zone 1) and 5) |
---|
| 1361 | IF ( phi_hc_nd_un > 0.0_wp ) THEN |
---|
| 1362 | phi_hc_nd_ac = buildings(nb)%phi_h_max !< Limit heating |
---|
| 1363 | ELSE |
---|
| 1364 | phi_hc_nd_ac = buildings(nb)%phi_c_max !< Limit cooling |
---|
| 1365 | ENDIF |
---|
| 1366 | ENDIF |
---|
| 1367 | phi_hc_nd = phi_hc_nd_ac |
---|
| 1368 | ! |
---|
| 1369 | !-- Calculate the temperature with phi_hc_nd_ac (new) |
---|
| 1370 | CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, & |
---|
| 1371 | near_facade_temperature, phi_hc_nd ) |
---|
| 1372 | theta_air_ac = theta_air |
---|
| 1373 | ENDIF |
---|
| 1374 | ! |
---|
| 1375 | !-- Update theta_m_t_prev |
---|
| 1376 | theta_m_t_prev = theta_m_t |
---|
| 1377 | |
---|
| 1378 | q_vent = h_v * ( theta_air - near_facade_temperature ) |
---|
| 1379 | ! |
---|
| 1380 | !-- Calculate the operating temperature with weighted mean temperature of air and mean solar temperature |
---|
| 1381 | !-- Will be used for thermal comfort calculations |
---|
| 1382 | theta_op = 0.3_wp * theta_air_ac + 0.7_wp * theta_s !< [degree_C] operative Temperature Eq. (C.12) |
---|
| 1383 | ! surf_usm_h%t_indoor(m) = theta_op !< not integrated now |
---|
| 1384 | ! |
---|
| 1385 | !-- Heat flux into the wall. Value needed in urban_surface_mod to |
---|
| 1386 | !-- calculate heat transfer through wall layers towards the facade |
---|
| 1387 | !-- (use c_p * rho_surface to convert [W/m2] into [K m/s]) |
---|
| 1388 | q_wall_win = h_t_ms * ( theta_s - theta_m ) & |
---|
| 1389 | / ( facade_element_area & |
---|
| 1390 | - window_area_per_facade ) |
---|
| 1391 | q_trans = q_wall_win * facade_element_area |
---|
| 1392 | ! |
---|
| 1393 | !-- Transfer q_wall_win back to USM (innermost wall/window layer) |
---|
| 1394 | surf_usm_h%iwghf_eb(m) = q_wall_win |
---|
| 1395 | surf_usm_h%iwghf_eb_window(m) = q_wall_win |
---|
| 1396 | ! |
---|
| 1397 | !-- Sum up operational indoor temperature per kk-level. Further below, |
---|
| 1398 | !-- this temperature is reduced by MPI to one temperature per kk-level |
---|
| 1399 | !-- and building (processor overlapping) |
---|
| 1400 | buildings(nb)%t_in_l(kk) = buildings(nb)%t_in_l(kk) + theta_op |
---|
| 1401 | ! |
---|
| 1402 | !-- Calculation of waste heat |
---|
| 1403 | !-- Anthropogenic heat output |
---|
| 1404 | IF ( phi_hc_nd_ac > 0.0_wp ) THEN |
---|
| 1405 | heating_on = 1 |
---|
| 1406 | cooling_on = 0 |
---|
| 1407 | ELSE |
---|
| 1408 | heating_on = 0 |
---|
| 1409 | cooling_on = -1 |
---|
| 1410 | ENDIF |
---|
| 1411 | |
---|
| 1412 | q_waste_heat = ( phi_hc_nd * ( & |
---|
| 1413 | buildings(nb)%params_waste_heat_h * heating_on + & |
---|
| 1414 | buildings(nb)%params_waste_heat_c * cooling_on ) & |
---|
| 1415 | ) / facade_element_area !< [W/m2] , observe the directional convention in PALM! |
---|
| 1416 | surf_usm_h%waste_heat(m) = q_waste_heat |
---|
| 1417 | ENDDO !< Horizontal surfaces loop |
---|
| 1418 | ! |
---|
| 1419 | !-- Vertical surfaces |
---|
| 1420 | DO fa = 1, buildings(nb)%num_facades_per_building_v_l |
---|
| 1421 | ! |
---|
| 1422 | !-- Determine indices where corresponding surface-type information |
---|
| 1423 | !-- is stored. |
---|
| 1424 | l = buildings(nb)%l_v(fa) |
---|
| 1425 | m = buildings(nb)%m_v(fa) |
---|
| 1426 | ! |
---|
| 1427 | !-- Determine building height level index. |
---|
| 1428 | kk = surf_usm_v(l)%k(m) + surf_usm_v(l)%koff |
---|
| 1429 | ! |
---|
| 1430 | !-- (SOME OF THE FOLLOWING (not time-dependent COULD PROBABLY GO INTO A FUNCTION |
---|
| 1431 | !-- EXCEPT facade_element_area, EVERYTHING IS CALCULATED EQUALLY) |
---|
| 1432 | !-- Building geometries --> not time-dependent |
---|
[4402] | 1433 | IF ( l == 0 .OR. l == 1 ) facade_element_area = dx * dzw(kk+1) !< [m2] surface area per facade element |
---|
| 1434 | IF ( l == 2 .OR. l == 3 ) facade_element_area = dy * dzw(kk+1) !< [m2] surface area per facade element |
---|
| 1435 | |
---|
| 1436 | floor_area_per_facade = buildings(nb)%fapf !< [m2/m2] floor area per facade area |
---|
| 1437 | indoor_volume_per_facade = buildings(nb)%vpf(kk) !< [m3/m2] indoor air volume per facade area |
---|
[4246] | 1438 | buildings(nb)%area_facade = facade_element_area * & |
---|
| 1439 | ( buildings(nb)%num_facades_per_building_h + & |
---|
| 1440 | buildings(nb)%num_facades_per_building_v ) !< [m2] area of total facade |
---|
[4441] | 1441 | window_area_per_facade = surf_usm_v(l)%frac(m,ind_wat_win) * facade_element_area !< [m2] window area per facade element |
---|
[4246] | 1442 | |
---|
| 1443 | buildings(nb)%net_floor_area = buildings(nb)%vol_tot / ( buildings(nb)%height_storey ) |
---|
| 1444 | total_area = buildings(nb)%net_floor_area !< [m2] area of all surfaces pointing to zone Eq. (9) according to section 7.2.2.2 |
---|
| 1445 | a_m = buildings(nb)%factor_a * total_area * & |
---|
| 1446 | ( facade_element_area / buildings(nb)%area_facade ) * & |
---|
| 1447 | buildings(nb)%lambda_at !< [m2] standard values according to Table 12 section 12.3.1.2 (calculate over Eq. (65) according to section 12.3.1.2) |
---|
| 1448 | c_m = buildings(nb)%factor_c * total_area * & |
---|
| 1449 | ( facade_element_area / buildings(nb)%area_facade ) !< [J/K] standard values according to table 12 section 12.3.1.2 (calculate over Eq. (66) according to section 12.3.1.2) |
---|
| 1450 | ! |
---|
| 1451 | !-- Calculation of heat transfer coefficient for transmission --> not time-dependent |
---|
| 1452 | h_t_es = window_area_per_facade * buildings(nb)%h_es !< [W/K] only for windows |
---|
| 1453 | |
---|
| 1454 | h_t_is = buildings(nb)%area_facade * h_is !< [W/K] with h_is = 3.45 W / (m2 K) between surface and air, Eq. (9) |
---|
| 1455 | h_t_ms = a_m * h_ms !< [W/K] with h_ms = 9.10 W / (m2 K) between component and surface, Eq. (64) |
---|
| 1456 | h_t_wall = 1.0_wp / ( 1.0_wp / ( ( facade_element_area - window_area_per_facade ) & !< [W/K] |
---|
| 1457 | * buildings(nb)%lambda_layer3 / buildings(nb)%s_layer3 * 0.5_wp & |
---|
| 1458 | ) + 1.0_wp / h_t_ms ) !< [W/K] opaque components |
---|
| 1459 | h_t_wm = 1.0_wp / ( 1.0_wp / h_t_wall - 1.0_wp / h_t_ms ) !< [W/K] emmision Eq. (63), Section 12.2.2 |
---|
| 1460 | ! |
---|
| 1461 | !-- internal air loads dependent on the occupacy of the room |
---|
| 1462 | !-- basical internal heat gains (qint_low) with additional internal heat gains by occupancy (qint_high) (0,5*phi_int) |
---|
| 1463 | phi_ia = 0.5_wp * ( ( buildings(nb)%qint_high * schedule_d + buildings(nb)%qint_low ) & |
---|
| 1464 | * floor_area_per_facade ) |
---|
| 1465 | q_int = phi_ia |
---|
| 1466 | |
---|
| 1467 | ! |
---|
| 1468 | !-- Airflow dependent on the occupacy of the room |
---|
| 1469 | !-- basical airflow (air_change_low) with additional airflow gains by occupancy (air_change_high) |
---|
| 1470 | air_change = ( buildings(nb)%air_change_high * schedule_d + buildings(nb)%air_change_low ) |
---|
| 1471 | ! |
---|
| 1472 | !-- Heat transfer of ventilation |
---|
| 1473 | !-- not less than 0.01 W/K to provide division by 0 in further calculations |
---|
| 1474 | !-- with heat capacity of air 0.33 Wh/m2K |
---|
| 1475 | h_v = MAX( 0.01_wp , ( air_change * indoor_volume_per_facade * & |
---|
| 1476 | 0.33_wp * (1.0_wp - buildings(nb)%eta_ve ) ) ) !< [W/K] from ISO 13789 Eq.(10) |
---|
| 1477 | |
---|
| 1478 | !-- Heat transfer coefficient auxiliary variables |
---|
| 1479 | h_t_1 = 1.0_wp / ( ( 1.0_wp / h_v ) + ( 1.0_wp / h_t_is ) ) !< [W/K] Eq. (C.6) |
---|
| 1480 | h_t_2 = h_t_1 + h_t_es !< [W/K] Eq. (C.7) |
---|
| 1481 | h_t_3 = 1.0_wp / ( ( 1.0_wp / h_t_2 ) + ( 1.0_wp / h_t_ms ) ) !< [W/K] Eq. (C.8) |
---|
| 1482 | ! |
---|
| 1483 | !-- Net short-wave radiation through window area (was i_global) |
---|
| 1484 | net_sw_in = surf_usm_v(l)%rad_sw_in(m) - surf_usm_v(l)%rad_sw_out(m) |
---|
| 1485 | ! |
---|
| 1486 | !-- Quantities needed for im_calc_temperatures |
---|
| 1487 | i = surf_usm_v(l)%i(m) |
---|
| 1488 | j = surf_usm_v(l)%j(m) |
---|
| 1489 | k = surf_usm_v(l)%k(m) |
---|
| 1490 | near_facade_temperature = surf_usm_v(l)%pt_10cm(m) |
---|
| 1491 | indoor_wall_window_temperature = & |
---|
[4441] | 1492 | surf_usm_v(l)%frac(m,ind_veg_wall) * t_wall_v(l)%t(nzt_wall,m) & |
---|
| 1493 | + surf_usm_v(l)%frac(m,ind_wat_win) * t_window_v(l)%t(nzt_wall,m) |
---|
[4246] | 1494 | ! |
---|
| 1495 | !-- Solar thermal gains. If net_sw_in larger than sun-protection |
---|
| 1496 | !-- threshold parameter (params_solar_protection), sun protection will |
---|
| 1497 | !-- be activated |
---|
| 1498 | IF ( net_sw_in <= params_solar_protection ) THEN |
---|
| 1499 | solar_protection_off = 1 |
---|
| 1500 | solar_protection_on = 0 |
---|
| 1501 | ELSE |
---|
| 1502 | solar_protection_off = 0 |
---|
| 1503 | solar_protection_on = 1 |
---|
| 1504 | ENDIF |
---|
| 1505 | ! |
---|
| 1506 | !-- Calculation of total heat gains from net_sw_in through windows [W] in respect on automatic sun protection |
---|
| 1507 | !-- DIN 4108 - 2 chap.8 |
---|
| 1508 | phi_sol = ( window_area_per_facade * net_sw_in * solar_protection_off & |
---|
| 1509 | + window_area_per_facade * net_sw_in * buildings(nb)%f_c_win * solar_protection_on ) & |
---|
| 1510 | * buildings(nb)%g_value_win * ( 1.0_wp - params_f_f ) * params_f_w |
---|
| 1511 | q_sol = phi_sol |
---|
| 1512 | ! |
---|
| 1513 | !-- Calculation of the mass specific thermal load for internal and external heatsources |
---|
| 1514 | phi_m = (a_m / total_area) * ( phi_ia + phi_sol ) !< [W] Eq. (C.2) with phi_ia=0,5*phi_int |
---|
| 1515 | q_c_m = phi_m |
---|
| 1516 | ! |
---|
| 1517 | !-- Calculation mass specific thermal load implied non thermal mass |
---|
| 1518 | phi_st = ( 1.0_wp - ( a_m / total_area ) - ( h_t_es / ( 9.1_wp * total_area ) ) ) & |
---|
| 1519 | * ( phi_ia + phi_sol ) !< [W] Eq. (C.3) with phi_ia=0,5*phi_int |
---|
| 1520 | q_c_st = phi_st |
---|
| 1521 | ! |
---|
| 1522 | !-- Calculations for deriving indoor temperature and heat flux into the wall |
---|
| 1523 | !-- Step 1: Indoor temperature without heating and cooling |
---|
| 1524 | !-- section C.4.1 Picture C.2 zone 3) |
---|
| 1525 | phi_hc_nd = 0.0_wp |
---|
| 1526 | CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, & |
---|
| 1527 | near_facade_temperature, phi_hc_nd ) |
---|
| 1528 | ! |
---|
| 1529 | !-- If air temperature between border temperatures of heating and cooling, assign output variable, then ready |
---|
| 1530 | IF ( buildings(nb)%theta_int_h_set <= theta_air .AND. theta_air <= buildings(nb)%theta_int_c_set ) THEN |
---|
| 1531 | phi_hc_nd_ac = 0.0_wp |
---|
| 1532 | phi_hc_nd = phi_hc_nd_ac |
---|
| 1533 | theta_air_ac = theta_air |
---|
| 1534 | ! |
---|
| 1535 | !-- Step 2: Else, apply 10 W/m2 heating/cooling power and calculate indoor temperature |
---|
| 1536 | !-- again. |
---|
| 1537 | ELSE |
---|
| 1538 | ! |
---|
| 1539 | !-- Temperature not correct, calculation method according to section C4.2 |
---|
| 1540 | theta_air_0 = theta_air !< Note temperature without heating/cooling |
---|
| 1541 | ! |
---|
| 1542 | !-- Heating or cooling? |
---|
| 1543 | IF ( theta_air_0 > buildings(nb)%theta_int_c_set ) THEN |
---|
| 1544 | theta_air_set = buildings(nb)%theta_int_c_set |
---|
| 1545 | ELSE |
---|
| 1546 | theta_air_set = buildings(nb)%theta_int_h_set |
---|
| 1547 | ENDIF |
---|
| 1548 | |
---|
| 1549 | !-- Calculate the temperature with phi_hc_nd_10 |
---|
| 1550 | phi_hc_nd_10 = 10.0_wp * floor_area_per_facade |
---|
| 1551 | phi_hc_nd = phi_hc_nd_10 |
---|
| 1552 | |
---|
| 1553 | CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, & |
---|
| 1554 | near_facade_temperature, phi_hc_nd ) |
---|
| 1555 | |
---|
| 1556 | theta_air_10 = theta_air !< Note the temperature with 10 W/m2 of heating |
---|
| 1557 | |
---|
| 1558 | phi_hc_nd_un = phi_hc_nd_10 * ( theta_air_set - theta_air_0 ) & |
---|
| 1559 | / ( theta_air_10 - theta_air_0 ) !< Eq. (C.13) |
---|
| 1560 | ! |
---|
| 1561 | !-- Step 3: With temperature ratio to determine the heating or cooling capacity |
---|
| 1562 | !-- If necessary, limit the power to maximum power |
---|
| 1563 | !-- section C.4.1 Picture C.2 zone 2) and 4) |
---|
| 1564 | buildings(nb)%phi_c_max = buildings(nb)%q_c_max * floor_area_per_facade |
---|
| 1565 | buildings(nb)%phi_h_max = buildings(nb)%q_h_max * floor_area_per_facade |
---|
| 1566 | IF ( buildings(nb)%phi_c_max < phi_hc_nd_un .AND. phi_hc_nd_un < buildings(nb)%phi_h_max ) THEN |
---|
| 1567 | phi_hc_nd_ac = phi_hc_nd_un |
---|
| 1568 | phi_hc_nd = phi_hc_nd_un |
---|
| 1569 | ELSE |
---|
| 1570 | ! |
---|
| 1571 | !-- Step 4: Inner temperature with maximum heating (phi_hc_nd_un positive) or cooling (phi_hc_nd_un negative) |
---|
| 1572 | !-- section C.4.1 Picture C.2 zone 1) and 5) |
---|
| 1573 | IF ( phi_hc_nd_un > 0.0_wp ) THEN |
---|
| 1574 | phi_hc_nd_ac = buildings(nb)%phi_h_max !< Limit heating |
---|
| 1575 | ELSE |
---|
| 1576 | phi_hc_nd_ac = buildings(nb)%phi_c_max !< Limit cooling |
---|
| 1577 | ENDIF |
---|
| 1578 | ENDIF |
---|
| 1579 | phi_hc_nd = phi_hc_nd_ac |
---|
| 1580 | ! |
---|
| 1581 | !-- Calculate the temperature with phi_hc_nd_ac (new) |
---|
| 1582 | CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, & |
---|
| 1583 | near_facade_temperature, phi_hc_nd ) |
---|
| 1584 | theta_air_ac = theta_air |
---|
| 1585 | ENDIF |
---|
| 1586 | ! |
---|
| 1587 | !-- Update theta_m_t_prev |
---|
| 1588 | theta_m_t_prev = theta_m_t |
---|
| 1589 | |
---|
| 1590 | q_vent = h_v * ( theta_air - near_facade_temperature ) |
---|
| 1591 | ! |
---|
| 1592 | !-- Calculate the operating temperature with weighted mean of temperature of air and mean |
---|
| 1593 | !-- Will be used for thermal comfort calculations |
---|
| 1594 | theta_op = 0.3_wp * theta_air_ac + 0.7_wp * theta_s |
---|
| 1595 | ! surf_usm_v(l)%t_indoor(m) = theta_op !< not integrated yet |
---|
| 1596 | ! |
---|
| 1597 | !-- Heat flux into the wall. Value needed in urban_surface_mod to |
---|
| 1598 | !-- calculate heat transfer through wall layers towards the facade |
---|
| 1599 | q_wall_win = h_t_ms * ( theta_s - theta_m ) & |
---|
| 1600 | / ( facade_element_area & |
---|
| 1601 | - window_area_per_facade ) |
---|
| 1602 | q_trans = q_wall_win * facade_element_area |
---|
| 1603 | ! |
---|
| 1604 | !-- Transfer q_wall_win back to USM (innermost wall/window layer) |
---|
| 1605 | surf_usm_v(l)%iwghf_eb(m) = q_wall_win |
---|
| 1606 | surf_usm_v(l)%iwghf_eb_window(m) = q_wall_win |
---|
| 1607 | ! |
---|
| 1608 | !-- Sum up operational indoor temperature per kk-level. Further below, |
---|
| 1609 | !-- this temperature is reduced by MPI to one temperature per kk-level |
---|
| 1610 | !-- and building (processor overlapping) |
---|
| 1611 | buildings(nb)%t_in_l(kk) = buildings(nb)%t_in_l(kk) + theta_op |
---|
| 1612 | ! |
---|
| 1613 | !-- Calculation of waste heat |
---|
| 1614 | !-- Anthropogenic heat output |
---|
| 1615 | IF ( phi_hc_nd_ac > 0.0_wp ) THEN |
---|
| 1616 | heating_on = 1 |
---|
| 1617 | cooling_on = 0 |
---|
| 1618 | ELSE |
---|
| 1619 | heating_on = 0 |
---|
| 1620 | cooling_on = -1 |
---|
| 1621 | ENDIF |
---|
| 1622 | |
---|
| 1623 | q_waste_heat = ( phi_hc_nd * ( & |
---|
| 1624 | buildings(nb)%params_waste_heat_h * heating_on + & |
---|
| 1625 | buildings(nb)%params_waste_heat_c * cooling_on ) & |
---|
| 1626 | ) / facade_element_area !< [W/m2] , observe the directional convention in PALM! |
---|
| 1627 | surf_usm_v(l)%waste_heat(m) = q_waste_heat |
---|
| 1628 | ENDDO !< Vertical surfaces loop |
---|
| 1629 | ENDIF !< buildings(nb)%on_pe |
---|
| 1630 | ENDDO !< buildings loop |
---|
| 1631 | |
---|
| 1632 | ! |
---|
| 1633 | !-- Determine the mean building temperature. |
---|
| 1634 | DO nb = 1, num_build |
---|
| 1635 | ! |
---|
| 1636 | !-- Allocate dummy array used for summing-up facade elements. |
---|
| 1637 | !-- Please note, dummy arguments are necessary as building-date type |
---|
| 1638 | !-- arrays are not necessarily allocated on all PEs. |
---|
| 1639 | ALLOCATE( t_in_l_send(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 1640 | ALLOCATE( t_in_recv(buildings(nb)%kb_min:buildings(nb)%kb_max) ) |
---|
| 1641 | t_in_l_send = 0.0_wp |
---|
| 1642 | t_in_recv = 0.0_wp |
---|
| 1643 | |
---|
| 1644 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 1645 | t_in_l_send = buildings(nb)%t_in_l |
---|
| 1646 | ENDIF |
---|
| 1647 | |
---|
| 1648 | |
---|
| 1649 | #if defined( __parallel ) |
---|
| 1650 | CALL MPI_ALLREDUCE( t_in_l_send, & |
---|
| 1651 | t_in_recv, & |
---|
| 1652 | buildings(nb)%kb_max - buildings(nb)%kb_min + 1, & |
---|
| 1653 | MPI_REAL, & |
---|
| 1654 | MPI_SUM, & |
---|
| 1655 | comm2d, & |
---|
| 1656 | ierr ) |
---|
| 1657 | |
---|
| 1658 | IF ( ALLOCATED( buildings(nb)%t_in ) ) & |
---|
| 1659 | buildings(nb)%t_in = t_in_recv |
---|
| 1660 | #else |
---|
| 1661 | IF ( ALLOCATED( buildings(nb)%t_in ) ) & |
---|
| 1662 | buildings(nb)%t_in = buildings(nb)%t_in_l |
---|
| 1663 | #endif |
---|
| 1664 | |
---|
| 1665 | IF ( ALLOCATED( buildings(nb)%t_in ) ) THEN |
---|
| 1666 | ! |
---|
| 1667 | !-- Average indoor temperature. Note, in case a building is completely |
---|
| 1668 | !-- surrounded by higher buildings, it may have no facade elements |
---|
[4299] | 1669 | !-- at some height levels, which will lead to a divide by zero. |
---|
[4246] | 1670 | DO k = buildings(nb)%kb_min, buildings(nb)%kb_max |
---|
| 1671 | IF ( buildings(nb)%num_facade_h(k) + & |
---|
| 1672 | buildings(nb)%num_facade_v(k) > 0 ) THEN |
---|
| 1673 | buildings(nb)%t_in(k) = buildings(nb)%t_in(k) / & |
---|
| 1674 | REAL( buildings(nb)%num_facade_h(k) + & |
---|
| 1675 | buildings(nb)%num_facade_v(k), KIND = wp ) |
---|
| 1676 | ENDIF |
---|
| 1677 | ENDDO |
---|
[4299] | 1678 | ! |
---|
| 1679 | !-- If indoor temperature is not defined because of missing facade |
---|
| 1680 | !-- elements, the values from the above-lying level will be taken. |
---|
| 1681 | !-- At least at the top of the buildings facades are defined, so that |
---|
| 1682 | !-- at least there an indoor temperature is defined. This information |
---|
| 1683 | !-- will propagate downwards the building. |
---|
| 1684 | DO k = buildings(nb)%kb_max-1, buildings(nb)%kb_min, -1 |
---|
| 1685 | IF ( buildings(nb)%num_facade_h(k) + & |
---|
| 1686 | buildings(nb)%num_facade_v(k) <= 0 ) THEN |
---|
| 1687 | buildings(nb)%t_in(k) = buildings(nb)%t_in(k+1) |
---|
| 1688 | ENDIF |
---|
| 1689 | ENDDO |
---|
[4246] | 1690 | ENDIF |
---|
| 1691 | |
---|
| 1692 | |
---|
| 1693 | ! |
---|
| 1694 | !-- Deallocate dummy arrays |
---|
| 1695 | DEALLOCATE( t_in_l_send ) |
---|
| 1696 | DEALLOCATE( t_in_recv ) |
---|
| 1697 | |
---|
| 1698 | ENDDO |
---|
| 1699 | |
---|
| 1700 | END SUBROUTINE im_main_heatcool |
---|
| 1701 | |
---|
| 1702 | !-----------------------------------------------------------------------------! |
---|
| 1703 | ! Description: |
---|
| 1704 | !------------- |
---|
| 1705 | !> Check data output for plant canopy model |
---|
| 1706 | !-----------------------------------------------------------------------------! |
---|
| 1707 | SUBROUTINE im_check_data_output( var, unit ) |
---|
[4402] | 1708 | |
---|
[4246] | 1709 | CHARACTER (LEN=*) :: unit !< |
---|
| 1710 | CHARACTER (LEN=*) :: var !< |
---|
| 1711 | |
---|
| 1712 | SELECT CASE ( TRIM( var ) ) |
---|
| 1713 | |
---|
| 1714 | |
---|
| 1715 | CASE ( 'im_hf_roof') |
---|
| 1716 | unit = 'W m-2' |
---|
| 1717 | |
---|
| 1718 | CASE ( 'im_hf_wall_win' ) |
---|
| 1719 | unit = 'W m-2' |
---|
| 1720 | |
---|
| 1721 | CASE ( 'im_hf_wall_win_waste' ) |
---|
| 1722 | unit = 'W m-2' |
---|
| 1723 | |
---|
| 1724 | CASE ( 'im_hf_roof_waste' ) |
---|
| 1725 | unit = 'W m-2' |
---|
| 1726 | |
---|
| 1727 | CASE ( 'im_t_indoor_mean' ) |
---|
| 1728 | unit = 'K' |
---|
| 1729 | |
---|
| 1730 | CASE ( 'im_t_indoor_roof' ) |
---|
| 1731 | unit = 'K' |
---|
| 1732 | |
---|
| 1733 | CASE ( 'im_t_indoor_wall_win' ) |
---|
| 1734 | unit = 'K' |
---|
| 1735 | |
---|
| 1736 | CASE DEFAULT |
---|
| 1737 | unit = 'illegal' |
---|
| 1738 | |
---|
| 1739 | END SELECT |
---|
| 1740 | |
---|
| 1741 | END SUBROUTINE |
---|
| 1742 | |
---|
| 1743 | |
---|
| 1744 | !-----------------------------------------------------------------------------! |
---|
| 1745 | ! Description: |
---|
| 1746 | !------------- |
---|
| 1747 | !> Check parameters routine for plant canopy model |
---|
| 1748 | !-----------------------------------------------------------------------------! |
---|
| 1749 | SUBROUTINE im_check_parameters |
---|
| 1750 | |
---|
| 1751 | ! USE control_parameters, |
---|
| 1752 | ! ONLY: message_string |
---|
| 1753 | |
---|
| 1754 | END SUBROUTINE im_check_parameters |
---|
| 1755 | |
---|
| 1756 | !-----------------------------------------------------------------------------! |
---|
| 1757 | ! Description: |
---|
| 1758 | !------------- |
---|
| 1759 | !> Subroutine defining appropriate grid for netcdf variables. |
---|
| 1760 | !> It is called from subroutine netcdf. |
---|
| 1761 | !-----------------------------------------------------------------------------! |
---|
| 1762 | SUBROUTINE im_define_netcdf_grid( var, found, grid_x, grid_y, grid_z ) |
---|
| 1763 | |
---|
| 1764 | |
---|
| 1765 | CHARACTER (LEN=*), INTENT(IN) :: var |
---|
| 1766 | LOGICAL, INTENT(OUT) :: found |
---|
| 1767 | CHARACTER (LEN=*), INTENT(OUT) :: grid_x |
---|
| 1768 | CHARACTER (LEN=*), INTENT(OUT) :: grid_y |
---|
| 1769 | CHARACTER (LEN=*), INTENT(OUT) :: grid_z |
---|
| 1770 | |
---|
| 1771 | found = .TRUE. |
---|
| 1772 | |
---|
| 1773 | ! |
---|
| 1774 | !-- Check for the grid |
---|
| 1775 | SELECT CASE ( TRIM( var ) ) |
---|
| 1776 | |
---|
| 1777 | CASE ( 'im_hf_roof', 'im_hf_roof_waste' ) |
---|
| 1778 | grid_x = 'x' |
---|
| 1779 | grid_y = 'y' |
---|
| 1780 | grid_z = 'zw' |
---|
| 1781 | ! |
---|
| 1782 | !-- Heat fluxes at vertical walls are actually defined on stagged grid, i.e. xu, yv. |
---|
| 1783 | CASE ( 'im_hf_wall_win', 'im_hf_wall_win_waste' ) |
---|
| 1784 | grid_x = 'x' |
---|
| 1785 | grid_y = 'y' |
---|
| 1786 | grid_z = 'zu' |
---|
| 1787 | |
---|
| 1788 | CASE ( 'im_t_indoor_mean', 'im_t_indoor_roof', 'im_t_indoor_wall_win') |
---|
| 1789 | grid_x = 'x' |
---|
| 1790 | grid_y = 'y' |
---|
| 1791 | grid_z = 'zw' |
---|
| 1792 | |
---|
| 1793 | CASE DEFAULT |
---|
| 1794 | found = .FALSE. |
---|
| 1795 | grid_x = 'none' |
---|
| 1796 | grid_y = 'none' |
---|
| 1797 | grid_z = 'none' |
---|
| 1798 | END SELECT |
---|
| 1799 | |
---|
| 1800 | END SUBROUTINE im_define_netcdf_grid |
---|
| 1801 | |
---|
| 1802 | !------------------------------------------------------------------------------! |
---|
| 1803 | ! Description: |
---|
| 1804 | ! ------------ |
---|
| 1805 | !> Subroutine defining 3D output variables |
---|
| 1806 | !------------------------------------------------------------------------------! |
---|
| 1807 | SUBROUTINE im_data_output_3d( av, variable, found, local_pf, fill_value, & |
---|
| 1808 | nzb_do, nzt_do ) |
---|
| 1809 | |
---|
[4402] | 1810 | USE indices |
---|
| 1811 | |
---|
| 1812 | USE kinds |
---|
| 1813 | |
---|
[4246] | 1814 | CHARACTER (LEN=*) :: variable !< |
---|
| 1815 | |
---|
| 1816 | INTEGER(iwp) :: av !< |
---|
| 1817 | INTEGER(iwp) :: i !< |
---|
| 1818 | INTEGER(iwp) :: j !< |
---|
| 1819 | INTEGER(iwp) :: k !< |
---|
| 1820 | INTEGER(iwp) :: l !< |
---|
| 1821 | INTEGER(iwp) :: m !< |
---|
| 1822 | INTEGER(iwp) :: nb !< index of the building in the building data structure |
---|
| 1823 | INTEGER(iwp) :: nzb_do !< lower limit of the data output (usually 0) |
---|
| 1824 | INTEGER(iwp) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) |
---|
| 1825 | |
---|
| 1826 | LOGICAL :: found !< |
---|
| 1827 | |
---|
| 1828 | REAL(wp), INTENT(IN) :: fill_value !< value for the _FillValue attribute |
---|
| 1829 | |
---|
| 1830 | REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< |
---|
| 1831 | |
---|
| 1832 | local_pf = fill_value |
---|
| 1833 | |
---|
| 1834 | found = .TRUE. |
---|
| 1835 | |
---|
| 1836 | SELECT CASE ( TRIM( variable ) ) |
---|
| 1837 | ! |
---|
| 1838 | !-- Output of indoor temperature. All grid points within the building are |
---|
| 1839 | !-- filled with values, while atmospheric grid points are set to _FillValues. |
---|
| 1840 | CASE ( 'im_t_indoor_mean' ) |
---|
| 1841 | IF ( av == 0 ) THEN |
---|
| 1842 | DO i = nxl, nxr |
---|
| 1843 | DO j = nys, nyn |
---|
| 1844 | IF ( building_id_f%var(j,i) /= building_id_f%fill ) THEN |
---|
| 1845 | ! |
---|
| 1846 | !-- Determine index of the building within the building data structure. |
---|
| 1847 | nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), & |
---|
| 1848 | DIM = 1 ) |
---|
| 1849 | IF ( buildings(nb)%on_pe ) THEN |
---|
| 1850 | ! |
---|
| 1851 | !-- Write mean building temperature onto output array. Please note, |
---|
| 1852 | !-- in contrast to many other loops in the output, the vertical |
---|
| 1853 | !-- bounds are determined by the lowest and hightest vertical index |
---|
| 1854 | !-- occupied by the building. |
---|
| 1855 | DO k = buildings(nb)%kb_min, buildings(nb)%kb_max |
---|
| 1856 | local_pf(i,j,k) = buildings(nb)%t_in(k) |
---|
| 1857 | ENDDO |
---|
| 1858 | ENDIF |
---|
| 1859 | ENDIF |
---|
| 1860 | ENDDO |
---|
| 1861 | ENDDO |
---|
| 1862 | ENDIF |
---|
| 1863 | |
---|
| 1864 | CASE ( 'im_hf_roof' ) |
---|
| 1865 | IF ( av == 0 ) THEN |
---|
| 1866 | DO m = 1, surf_usm_h%ns |
---|
| 1867 | i = surf_usm_h%i(m) !+ surf_usm_h%ioff |
---|
| 1868 | j = surf_usm_h%j(m) !+ surf_usm_h%joff |
---|
| 1869 | k = surf_usm_h%k(m) !+ surf_usm_h%koff |
---|
| 1870 | local_pf(i,j,k) = surf_usm_h%iwghf_eb(m) |
---|
| 1871 | ENDDO |
---|
| 1872 | ENDIF |
---|
| 1873 | |
---|
| 1874 | CASE ( 'im_hf_roof_waste' ) |
---|
| 1875 | IF ( av == 0 ) THEN |
---|
| 1876 | DO m = 1, surf_usm_h%ns |
---|
| 1877 | i = surf_usm_h%i(m) !+ surf_usm_h%ioff |
---|
| 1878 | j = surf_usm_h%j(m) !+ surf_usm_h%joff |
---|
| 1879 | k = surf_usm_h%k(m) !+ surf_usm_h%koff |
---|
| 1880 | local_pf(i,j,k) = surf_usm_h%waste_heat(m) |
---|
| 1881 | ENDDO |
---|
| 1882 | ENDIF |
---|
| 1883 | |
---|
| 1884 | CASE ( 'im_hf_wall_win' ) |
---|
| 1885 | IF ( av == 0 ) THEN |
---|
| 1886 | DO l = 0, 3 |
---|
| 1887 | DO m = 1, surf_usm_v(l)%ns |
---|
| 1888 | i = surf_usm_v(l)%i(m) !+ surf_usm_v(l)%ioff |
---|
| 1889 | j = surf_usm_v(l)%j(m) !+ surf_usm_v(l)%joff |
---|
| 1890 | k = surf_usm_v(l)%k(m) !+ surf_usm_v(l)%koff |
---|
| 1891 | local_pf(i,j,k) = surf_usm_v(l)%iwghf_eb(m) |
---|
| 1892 | ENDDO |
---|
| 1893 | ENDDO |
---|
| 1894 | ENDIF |
---|
| 1895 | |
---|
| 1896 | CASE ( 'im_hf_wall_win_waste' ) |
---|
| 1897 | IF ( av == 0 ) THEN |
---|
| 1898 | DO l = 0, 3 |
---|
| 1899 | DO m = 1, surf_usm_v(l)%ns |
---|
| 1900 | i = surf_usm_v(l)%i(m) !+ surf_usm_v(l)%ioff |
---|
| 1901 | j = surf_usm_v(l)%j(m) !+ surf_usm_v(l)%joff |
---|
| 1902 | k = surf_usm_v(l)%k(m) !+ surf_usm_v(l)%koff |
---|
| 1903 | local_pf(i,j,k) = surf_usm_v(l)%waste_heat(m) |
---|
| 1904 | ENDDO |
---|
| 1905 | ENDDO |
---|
| 1906 | ENDIF |
---|
| 1907 | |
---|
| 1908 | ! |
---|
| 1909 | !< NOTE im_t_indoor_roof and im_t_indoor_wall_win not work yet |
---|
| 1910 | |
---|
| 1911 | ! CASE ( 'im_t_indoor_roof' ) |
---|
| 1912 | ! IF ( av == 0 ) THEN |
---|
| 1913 | ! DO m = 1, surf_usm_h%ns |
---|
| 1914 | ! i = surf_usm_h%i(m) !+ surf_usm_h%ioff |
---|
| 1915 | ! j = surf_usm_h%j(m) !+ surf_usm_h%joff |
---|
| 1916 | ! k = surf_usm_h%k(m) !+ surf_usm_h%koff |
---|
| 1917 | ! local_pf(i,j,k) = surf_usm_h%t_indoor(m) |
---|
| 1918 | ! ENDDO |
---|
| 1919 | ! ENDIF |
---|
| 1920 | ! |
---|
| 1921 | ! CASE ( 'im_t_indoor_wall_win' ) |
---|
| 1922 | ! IF ( av == 0 ) THEN |
---|
| 1923 | ! DO l = 0, 3 |
---|
| 1924 | ! DO m = 1, surf_usm_v(l)%ns |
---|
| 1925 | ! i = surf_usm_v(l)%i(m) !+ surf_usm_v(l)%ioff |
---|
| 1926 | ! j = surf_usm_v(l)%j(m) !+ surf_usm_v(l)%joff |
---|
| 1927 | ! k = surf_usm_v(l)%k(m) !+ surf_usm_v(l)%koff |
---|
| 1928 | ! local_pf(i,j,k) = surf_usm_v(l)%t_indoor(m) |
---|
| 1929 | ! ENDDO |
---|
| 1930 | ! ENDDO |
---|
| 1931 | ! ENDIF |
---|
| 1932 | |
---|
| 1933 | CASE DEFAULT |
---|
| 1934 | found = .FALSE. |
---|
| 1935 | |
---|
| 1936 | END SELECT |
---|
| 1937 | |
---|
| 1938 | END SUBROUTINE im_data_output_3d |
---|
| 1939 | !------------------------------------------------------------------------------! |
---|
| 1940 | ! Description: |
---|
| 1941 | ! ------------ |
---|
| 1942 | !> Parin for &indoor_parameters for indoor model |
---|
| 1943 | !------------------------------------------------------------------------------! |
---|
| 1944 | SUBROUTINE im_parin |
---|
| 1945 | |
---|
| 1946 | USE control_parameters, & |
---|
| 1947 | ONLY: indoor_model |
---|
| 1948 | |
---|
[4402] | 1949 | |
---|
[4246] | 1950 | CHARACTER (LEN=80) :: line !< string containing current line of file PARIN |
---|
| 1951 | |
---|
[4310] | 1952 | NAMELIST /indoor_parameters/ initial_indoor_temperature |
---|
[4246] | 1953 | |
---|
| 1954 | ! |
---|
| 1955 | !-- Try to find indoor model package |
---|
| 1956 | REWIND ( 11 ) |
---|
| 1957 | line = ' ' |
---|
| 1958 | DO WHILE ( INDEX( line, '&indoor_parameters' ) == 0 ) |
---|
| 1959 | READ ( 11, '(A)', END=10 ) line |
---|
| 1960 | ENDDO |
---|
| 1961 | BACKSPACE ( 11 ) |
---|
| 1962 | |
---|
| 1963 | ! |
---|
| 1964 | !-- Read user-defined namelist |
---|
| 1965 | READ ( 11, indoor_parameters ) |
---|
| 1966 | ! |
---|
| 1967 | !-- Set flag that indicates that the indoor model is switched on |
---|
| 1968 | indoor_model = .TRUE. |
---|
| 1969 | |
---|
| 1970 | ! |
---|
| 1971 | !-- Activate spinup (maybe later |
---|
| 1972 | ! IF ( spinup_time > 0.0_wp ) THEN |
---|
| 1973 | ! coupling_start_time = spinup_time |
---|
| 1974 | ! end_time = end_time + spinup_time |
---|
| 1975 | ! IF ( spinup_pt_mean == 9999999.9_wp ) THEN |
---|
| 1976 | ! spinup_pt_mean = pt_surface |
---|
| 1977 | ! ENDIF |
---|
| 1978 | ! spinup = .TRUE. |
---|
| 1979 | ! ENDIF |
---|
| 1980 | |
---|
| 1981 | 10 CONTINUE |
---|
| 1982 | |
---|
| 1983 | END SUBROUTINE im_parin |
---|
| 1984 | |
---|
| 1985 | |
---|
| 1986 | END MODULE indoor_model_mod |
---|