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