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