[1682] | 1 | !> @file init_3d_model.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1036] | 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
[2000] | 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. |
---|
[1036] | 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 | ! |
---|
[1818] | 17 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[254] | 20 | ! Current revisions: |
---|
[732] | 21 | ! ------------------ |
---|
[1961] | 22 | ! |
---|
[2038] | 23 | ! |
---|
[1961] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: init_3d_model.f90 2038 2016-10-26 11:16:56Z maronga $ |
---|
| 27 | ! |
---|
[2038] | 28 | ! 2037 2016-10-26 11:15:40Z knoop |
---|
| 29 | ! Anelastic approximation implemented |
---|
| 30 | ! |
---|
[2032] | 31 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
| 32 | ! renamed variable rho to rho_ocean |
---|
| 33 | ! |
---|
[2012] | 34 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
| 35 | ! Flag urban_surface is now defined in module control_parameters. |
---|
| 36 | ! |
---|
[2008] | 37 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
| 38 | ! Added support for urban surface model, |
---|
| 39 | ! adjusted location_message in case of plant_canopy |
---|
| 40 | ! |
---|
[2001] | 41 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 42 | ! Forced header and separation lines into 80 columns |
---|
| 43 | ! |
---|
[1993] | 44 | ! 1992 2016-08-12 15:14:59Z suehring |
---|
| 45 | ! Initializaton of scalarflux at model top |
---|
| 46 | ! Bugfixes in initialization of surface and top salinity flux, top scalar and |
---|
| 47 | ! humidity fluxes |
---|
| 48 | ! |
---|
[1961] | 49 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
[1960] | 50 | ! Separate humidity and passive scalar |
---|
| 51 | ! Increase dimension for mean_inflow_profiles |
---|
| 52 | ! Remove inadvertent write-statement |
---|
| 53 | ! Bugfix, large-scale forcing is still not implemented for passive scalars |
---|
[1919] | 54 | ! |
---|
[1958] | 55 | ! 1957 2016-07-07 10:43:48Z suehring |
---|
| 56 | ! flight module added |
---|
| 57 | ! |
---|
[1921] | 58 | ! 1920 2016-05-30 10:50:15Z suehring |
---|
| 59 | ! Initialize us with very small number to avoid segmentation fault during |
---|
| 60 | ! calculation of Obukhov length |
---|
| 61 | ! |
---|
[1919] | 62 | ! 1918 2016-05-27 14:35:57Z raasch |
---|
| 63 | ! intermediate_timestep_count is set 0 instead 1 for first call of pres, |
---|
| 64 | ! bugfix: initialization of local sum arrays are moved to the beginning of the |
---|
| 65 | ! routine because otherwise results from pres are overwritten |
---|
| 66 | ! |
---|
[1917] | 67 | ! 1914 2016-05-26 14:44:07Z witha |
---|
| 68 | ! Added initialization of the wind turbine model |
---|
| 69 | ! |
---|
[1879] | 70 | ! 1878 2016-04-19 12:30:36Z hellstea |
---|
| 71 | ! The zeroth element of weight_pres removed as unnecessary |
---|
| 72 | ! |
---|
[1851] | 73 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
[1849] | 74 | ! Adapted for modularization of microphysics. |
---|
| 75 | ! precipitation_amount, precipitation_rate, prr moved to arrays_3d. |
---|
[1852] | 76 | ! Initialization of nc_1d, nr_1d, pt_1d, qc_1d, qr_1d, q_1d moved to |
---|
[1849] | 77 | ! microphysics_init. |
---|
| 78 | ! |
---|
[1846] | 79 | ! 1845 2016-04-08 08:29:13Z raasch |
---|
| 80 | ! nzb_2d replaced by nzb_u|v_inner |
---|
[1914] | 81 | ! |
---|
[1834] | 82 | ! 1833 2016-04-07 14:23:03Z raasch |
---|
| 83 | ! initialization of spectra quantities moved to spectra_mod |
---|
| 84 | ! |
---|
[1832] | 85 | ! 1831 2016-04-07 13:15:51Z hoffmann |
---|
| 86 | ! turbulence renamed collision_turbulence |
---|
| 87 | ! |
---|
[1827] | 88 | ! 1826 2016-04-07 12:01:39Z maronga |
---|
| 89 | ! Renamed radiation calls. |
---|
| 90 | ! Renamed canopy model calls. |
---|
| 91 | ! |
---|
[1823] | 92 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
| 93 | ! icloud_scheme replaced by microphysics_* |
---|
[1914] | 94 | ! |
---|
[1818] | 95 | ! 1817 2016-04-06 15:44:20Z maronga |
---|
| 96 | ! Renamed lsm calls. |
---|
| 97 | ! |
---|
[1816] | 98 | ! 1815 2016-04-06 13:49:59Z raasch |
---|
| 99 | ! zero-settings for velocities inside topography re-activated (was deactivated |
---|
| 100 | ! in r1762) |
---|
| 101 | ! |
---|
[1789] | 102 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
| 103 | ! Added z0q. |
---|
| 104 | ! Syntax layout improved. |
---|
| 105 | ! |
---|
[1784] | 106 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 107 | ! netcdf module name changed + related changes |
---|
| 108 | ! |
---|
[1765] | 109 | ! 1764 2016-02-28 12:45:19Z raasch |
---|
| 110 | ! bugfix: increase size of volume_flow_area_l and volume_flow_initial_l by 1 |
---|
| 111 | ! |
---|
[1763] | 112 | ! 1762 2016-02-25 12:31:13Z hellstea |
---|
| 113 | ! Introduction of nested domain feature |
---|
| 114 | ! |
---|
[1739] | 115 | ! 1738 2015-12-18 13:56:05Z raasch |
---|
| 116 | ! calculate mean surface level height for each statistic region |
---|
| 117 | ! |
---|
[1735] | 118 | ! 1734 2015-12-02 12:17:12Z raasch |
---|
| 119 | ! no initial disturbances in case that the disturbance energy limit has been |
---|
| 120 | ! set zero |
---|
| 121 | ! |
---|
[1708] | 122 | ! 1707 2015-11-02 15:24:52Z maronga |
---|
| 123 | ! Bugfix: transfer of Richardson number from 1D model to Obukhov length caused |
---|
| 124 | ! devision by zero in neutral stratification |
---|
| 125 | ! |
---|
[1692] | 126 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 127 | ! Call to init_surface_layer added. rif is replaced by ol and zeta. |
---|
| 128 | ! |
---|
[1683] | 129 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 130 | ! Code annotations made doxygen readable |
---|
| 131 | ! |
---|
[1616] | 132 | ! 1615 2015-07-08 18:49:19Z suehring |
---|
| 133 | ! Enable turbulent inflow for passive_scalar and humidity |
---|
| 134 | ! |
---|
[1586] | 135 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
| 136 | ! Initialization of radiation code is now done after LSM initializtion |
---|
| 137 | ! |
---|
[1576] | 138 | ! 1575 2015-03-27 09:56:27Z raasch |
---|
| 139 | ! adjustments for psolver-queries |
---|
| 140 | ! |
---|
[1552] | 141 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
[1817] | 142 | ! Allocation of land surface arrays is now done in the subroutine lsm_init_arrays, |
---|
[1552] | 143 | ! which is part of land_surface_model. |
---|
| 144 | ! |
---|
[1508] | 145 | ! 1507 2014-12-10 12:14:18Z suehring |
---|
| 146 | ! Bugfix: set horizontal velocity components to zero inside topography |
---|
| 147 | ! |
---|
[1497] | 148 | ! 1496 2014-12-02 17:25:50Z maronga |
---|
| 149 | ! Added initialization of the land surface and radiation schemes |
---|
| 150 | ! |
---|
[1485] | 151 | ! 1484 2014-10-21 10:53:05Z kanani |
---|
[1484] | 152 | ! Changes due to new module structure of the plant canopy model: |
---|
[1508] | 153 | ! canopy-related initialization (e.g. lad and canopy_heat_flux) moved to new |
---|
| 154 | ! subroutine init_plant_canopy within the module plant_canopy_model_mod, |
---|
| 155 | ! call of subroutine init_plant_canopy added. |
---|
[1341] | 156 | ! |
---|
[1432] | 157 | ! 1431 2014-07-15 14:47:17Z suehring |
---|
| 158 | ! var_d added, in order to normalize spectra. |
---|
| 159 | ! |
---|
[1430] | 160 | ! 1429 2014-07-15 12:53:45Z knoop |
---|
| 161 | ! Ensemble run capability added to parallel random number generator |
---|
| 162 | ! |
---|
[1412] | 163 | ! 1411 2014-05-16 18:01:51Z suehring |
---|
| 164 | ! Initial horizontal velocity profiles were not set to zero at the first vertical |
---|
| 165 | ! grid level in case of non-cyclic lateral boundary conditions. |
---|
| 166 | ! |
---|
[1407] | 167 | ! 1406 2014-05-16 13:47:01Z raasch |
---|
| 168 | ! bugfix: setting of initial velocities at k=1 to zero not in case of a |
---|
| 169 | ! no-slip boundary condition for uv |
---|
| 170 | ! |
---|
[1403] | 171 | ! 1402 2014-05-09 14:25:13Z raasch |
---|
| 172 | ! location messages modified |
---|
| 173 | ! |
---|
[1401] | 174 | ! 1400 2014-05-09 14:03:54Z knoop |
---|
| 175 | ! Parallel random number generator added |
---|
| 176 | ! |
---|
[1385] | 177 | ! 1384 2014-05-02 14:31:06Z raasch |
---|
| 178 | ! location messages added |
---|
| 179 | ! |
---|
[1362] | 180 | ! 1361 2014-04-16 15:17:48Z hoffmann |
---|
| 181 | ! tend_* removed |
---|
| 182 | ! Bugfix: w_subs is not allocated anymore if it is already allocated |
---|
| 183 | ! |
---|
[1360] | 184 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 185 | ! module lpm_init_mod added to use statements, because lpm_init has become a |
---|
| 186 | ! module |
---|
| 187 | ! |
---|
[1354] | 188 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 189 | ! REAL constants provided with KIND-attribute |
---|
| 190 | ! |
---|
[1341] | 191 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 192 | ! REAL constants defined as wp-kind |
---|
| 193 | ! |
---|
[1323] | 194 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 195 | ! REAL constants defined as wp-kind |
---|
| 196 | ! module interfaces removed |
---|
| 197 | ! |
---|
[1321] | 198 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
| 199 | ! ONLY-attribute added to USE-statements, |
---|
| 200 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 201 | ! kinds are defined in new module kinds, |
---|
| 202 | ! revision history before 2012 removed, |
---|
| 203 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 204 | ! all variable declaration statements |
---|
| 205 | ! |
---|
[1317] | 206 | ! 1316 2014-03-17 07:44:59Z heinze |
---|
| 207 | ! Bugfix: allocation of w_subs |
---|
| 208 | ! |
---|
[1300] | 209 | ! 1299 2014-03-06 13:15:21Z heinze |
---|
| 210 | ! Allocate w_subs due to extension of large scale subsidence in combination |
---|
| 211 | ! with large scale forcing data (LSF_DATA) |
---|
| 212 | ! |
---|
[1242] | 213 | ! 1241 2013-10-30 11:36:58Z heinze |
---|
| 214 | ! Overwrite initial profiles in case of nudging |
---|
| 215 | ! Inititialize shf and qsws in case of large_scale_forcing |
---|
| 216 | ! |
---|
[1222] | 217 | ! 1221 2013-09-10 08:59:13Z raasch |
---|
| 218 | ! +rflags_s_inner in copyin statement, use copyin for most arrays instead of |
---|
| 219 | ! copy |
---|
| 220 | ! |
---|
[1213] | 221 | ! 1212 2013-08-15 08:46:27Z raasch |
---|
| 222 | ! array tri is allocated and included in data copy statement |
---|
| 223 | ! |
---|
[1196] | 224 | ! 1195 2013-07-01 12:27:57Z heinze |
---|
| 225 | ! Bugfix: move allocation of ref_state to parin.f90 and read_var_list.f90 |
---|
| 226 | ! |
---|
[1182] | 227 | ! 1179 2013-06-14 05:57:58Z raasch |
---|
| 228 | ! allocate and set ref_state to be used in buoyancy terms |
---|
| 229 | ! |
---|
[1172] | 230 | ! 1171 2013-05-30 11:27:45Z raasch |
---|
| 231 | ! diss array is allocated with full size if accelerator boards are used |
---|
| 232 | ! |
---|
[1160] | 233 | ! 1159 2013-05-21 11:58:22Z fricke |
---|
| 234 | ! -bc_lr_dirneu, bc_lr_neudir, bc_ns_dirneu, bc_ns_neudir |
---|
| 235 | ! |
---|
[1154] | 236 | ! 1153 2013-05-10 14:33:08Z raasch |
---|
| 237 | ! diss array is allocated with dummy elements even if it is not needed |
---|
[1171] | 238 | ! (required by PGI 13.4 / CUDA 5.0) |
---|
[1154] | 239 | ! |
---|
[1116] | 240 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 241 | ! unused variables removed |
---|
| 242 | ! |
---|
[1114] | 243 | ! 1113 2013-03-10 02:48:14Z raasch |
---|
| 244 | ! openACC directive modified |
---|
| 245 | ! |
---|
[1112] | 246 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
| 247 | ! openACC directives added for pres |
---|
| 248 | ! array diss allocated only if required |
---|
| 249 | ! |
---|
[1093] | 250 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 251 | ! unused variables removed |
---|
| 252 | ! |
---|
[1066] | 253 | ! 1065 2012-11-22 17:42:36Z hoffmann |
---|
| 254 | ! allocation of diss (dissipation rate) in case of turbulence = .TRUE. added |
---|
| 255 | ! |
---|
[1054] | 256 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
[1053] | 257 | ! allocation and initialisation of necessary data arrays for the two-moment |
---|
| 258 | ! cloud physics scheme the two new prognostic equations (nr, qr): |
---|
| 259 | ! +dr, lambda_r, mu_r, sed_*, xr, *s, *sws, *swst, *, *_p, t*_m, *_1, *_2, *_3, |
---|
| 260 | ! +tend_*, prr |
---|
[979] | 261 | ! |
---|
[1037] | 262 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 263 | ! code put under GPL (PALM 3.9) |
---|
| 264 | ! |
---|
[1033] | 265 | ! 1032 2012-10-21 13:03:21Z letzel |
---|
| 266 | ! save memory by not allocating pt_2 in case of neutral = .T. |
---|
| 267 | ! |
---|
[1026] | 268 | ! 1025 2012-10-07 16:04:41Z letzel |
---|
| 269 | ! bugfix: swap indices of mask for ghost boundaries |
---|
| 270 | ! |
---|
[1017] | 271 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 272 | ! mask is set to zero for ghost boundaries |
---|
| 273 | ! |
---|
[1011] | 274 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
| 275 | ! cpp switch __nopointer added for pointer free version |
---|
| 276 | ! |
---|
[1004] | 277 | ! 1003 2012-09-14 14:35:53Z raasch |
---|
| 278 | ! nxra,nyna, nzta replaced ny nxr, nyn, nzt |
---|
| 279 | ! |
---|
[1002] | 280 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
| 281 | ! all actions concerning leapfrog scheme removed |
---|
| 282 | ! |
---|
[997] | 283 | ! 996 2012-09-07 10:41:47Z raasch |
---|
| 284 | ! little reformatting |
---|
| 285 | ! |
---|
[979] | 286 | ! 978 2012-08-09 08:28:32Z fricke |
---|
[978] | 287 | ! outflow damping layer removed |
---|
| 288 | ! roughness length for scalar quantites z0h added |
---|
| 289 | ! damping zone for the potential temperatur in case of non-cyclic lateral |
---|
| 290 | ! boundaries added |
---|
| 291 | ! initialization of ptdf_x, ptdf_y |
---|
| 292 | ! initialization of c_u_m, c_u_m_l, c_v_m, c_v_m_l, c_w_m, c_w_m_l |
---|
[708] | 293 | ! |
---|
[850] | 294 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 295 | ! init_particles renamed lpm_init |
---|
| 296 | ! |
---|
[826] | 297 | ! 825 2012-02-19 03:03:44Z raasch |
---|
| 298 | ! wang_collision_kernel renamed wang_kernel |
---|
| 299 | ! |
---|
[1] | 300 | ! Revision 1.1 1998/03/09 16:22:22 raasch |
---|
| 301 | ! Initial revision |
---|
| 302 | ! |
---|
| 303 | ! |
---|
| 304 | ! Description: |
---|
| 305 | ! ------------ |
---|
[1682] | 306 | !> Allocation of arrays and initialization of the 3D model via |
---|
| 307 | !> a) pre-run the 1D model |
---|
| 308 | !> or |
---|
| 309 | !> b) pre-set constant linear profiles |
---|
| 310 | !> or |
---|
| 311 | !> c) read values of a previous run |
---|
[1] | 312 | !------------------------------------------------------------------------------! |
---|
[1682] | 313 | SUBROUTINE init_3d_model |
---|
| 314 | |
---|
[1] | 315 | |
---|
[667] | 316 | USE advec_ws |
---|
[1320] | 317 | |
---|
[1] | 318 | USE arrays_3d |
---|
[1849] | 319 | |
---|
[2037] | 320 | USE cloud_parameters, & |
---|
| 321 | ONLY: cp, l_v, r_d |
---|
| 322 | |
---|
[1320] | 323 | USE constants, & |
---|
| 324 | ONLY: pi |
---|
| 325 | |
---|
[1] | 326 | USE control_parameters |
---|
[1320] | 327 | |
---|
[1957] | 328 | USE flight_mod, & |
---|
| 329 | ONLY: flight_init |
---|
| 330 | |
---|
[1320] | 331 | USE grid_variables, & |
---|
[2037] | 332 | ONLY: dx, dy, ddx2_mg, ddy2_mg |
---|
[1320] | 333 | |
---|
[1] | 334 | USE indices |
---|
[1359] | 335 | |
---|
[1429] | 336 | USE lpm_init_mod, & |
---|
[1359] | 337 | ONLY: lpm_init |
---|
[1320] | 338 | |
---|
| 339 | USE kinds |
---|
[1496] | 340 | |
---|
| 341 | USE land_surface_model_mod, & |
---|
[1817] | 342 | ONLY: lsm_init, lsm_init_arrays, land_surface |
---|
[1496] | 343 | |
---|
[1241] | 344 | USE ls_forcing_mod |
---|
[1849] | 345 | |
---|
| 346 | USE microphysics_mod, & |
---|
| 347 | ONLY: collision_turbulence, microphysics_init |
---|
| 348 | |
---|
[1320] | 349 | USE model_1d, & |
---|
| 350 | ONLY: e1d, kh1d, km1d, l1d, rif1d, u1d, us1d, usws1d, v1d, vsws1d |
---|
| 351 | |
---|
[1783] | 352 | USE netcdf_interface, & |
---|
| 353 | ONLY: dots_max, dots_num |
---|
[1320] | 354 | |
---|
| 355 | USE particle_attributes, & |
---|
| 356 | ONLY: particle_advection, use_sgs_for_particles, wang_kernel |
---|
| 357 | |
---|
[1] | 358 | USE pegrid |
---|
[1320] | 359 | |
---|
[1484] | 360 | USE plant_canopy_model_mod, & |
---|
[1826] | 361 | ONLY: pcm_init, plant_canopy |
---|
[1496] | 362 | |
---|
| 363 | USE radiation_model_mod, & |
---|
[1826] | 364 | ONLY: radiation_init, radiation |
---|
[1484] | 365 | |
---|
[1320] | 366 | USE random_function_mod |
---|
| 367 | |
---|
[1400] | 368 | USE random_generator_parallel, & |
---|
| 369 | ONLY: random_number_parallel, random_seed_parallel, random_dummy, & |
---|
| 370 | id_random_array, seq_random_array |
---|
| 371 | |
---|
[1320] | 372 | USE statistics, & |
---|
[1738] | 373 | ONLY: hom, hom_sum, mean_surface_level_height, pr_palm, rmask, & |
---|
[1833] | 374 | statistic_regions, sums, sums_divnew_l, sums_divold_l, sums_l, & |
---|
| 375 | sums_l_l, sums_up_fraction_l, sums_wsts_bc_l, ts_value, & |
---|
| 376 | weight_pres, weight_substep |
---|
[1691] | 377 | |
---|
| 378 | USE surface_layer_fluxes_mod, & |
---|
| 379 | ONLY: init_surface_layer_fluxes |
---|
| 380 | |
---|
[2007] | 381 | USE transpose_indices |
---|
[1] | 382 | |
---|
[2007] | 383 | USE urban_surface_mod, & |
---|
[2011] | 384 | ONLY: usm_init_urban_surface |
---|
[2007] | 385 | |
---|
[1914] | 386 | USE wind_turbine_model_mod, & |
---|
| 387 | ONLY: wtm_init, wtm_init_arrays, wind_turbine |
---|
| 388 | |
---|
[1] | 389 | IMPLICIT NONE |
---|
| 390 | |
---|
[1682] | 391 | INTEGER(iwp) :: i !< |
---|
| 392 | INTEGER(iwp) :: ind_array(1) !< |
---|
| 393 | INTEGER(iwp) :: j !< |
---|
| 394 | INTEGER(iwp) :: k !< |
---|
| 395 | INTEGER(iwp) :: sr !< |
---|
[1] | 396 | |
---|
[1682] | 397 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: ngp_2dh_l !< |
---|
[1] | 398 | |
---|
[1682] | 399 | INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer_l !< |
---|
| 400 | INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_s_inner_l !< |
---|
[1] | 401 | |
---|
[2037] | 402 | REAL(wp) :: t_surface !< air temperature at the surface |
---|
| 403 | |
---|
| 404 | REAL(wp), DIMENSION(:), ALLOCATABLE :: p_hydrostatic !< hydrostatic pressure |
---|
| 405 | |
---|
| 406 | INTEGER(iwp) :: l !< loop variable |
---|
| 407 | INTEGER(iwp) :: nzt_l !< index of top PE boundary for multigrid level |
---|
| 408 | REAL(wp) :: dx_l !< grid spacing along x on different multigrid level |
---|
| 409 | REAL(wp) :: dy_l !< grid spacing along y on different multigrid level |
---|
| 410 | |
---|
[1764] | 411 | REAL(wp), DIMENSION(1:3) :: volume_flow_area_l !< |
---|
| 412 | REAL(wp), DIMENSION(1:3) :: volume_flow_initial_l !< |
---|
[1] | 413 | |
---|
[1738] | 414 | REAL(wp), DIMENSION(:), ALLOCATABLE :: mean_surface_level_height_l !< |
---|
[1682] | 415 | REAL(wp), DIMENSION(:), ALLOCATABLE :: ngp_3d_inner_l !< |
---|
| 416 | REAL(wp), DIMENSION(:), ALLOCATABLE :: ngp_3d_inner_tmp !< |
---|
[1] | 417 | |
---|
[485] | 418 | |
---|
[1402] | 419 | CALL location_message( 'allocating arrays', .FALSE. ) |
---|
[1] | 420 | ! |
---|
| 421 | !-- Allocate arrays |
---|
[1788] | 422 | ALLOCATE( mean_surface_level_height(0:statistic_regions), & |
---|
| 423 | mean_surface_level_height_l(0:statistic_regions), & |
---|
| 424 | ngp_2dh(0:statistic_regions), ngp_2dh_l(0:statistic_regions), & |
---|
| 425 | ngp_3d(0:statistic_regions), & |
---|
| 426 | ngp_3d_inner(0:statistic_regions), & |
---|
| 427 | ngp_3d_inner_l(0:statistic_regions), & |
---|
| 428 | ngp_3d_inner_tmp(0:statistic_regions), & |
---|
| 429 | sums_divnew_l(0:statistic_regions), & |
---|
[1] | 430 | sums_divold_l(0:statistic_regions) ) |
---|
[1195] | 431 | ALLOCATE( dp_smooth_factor(nzb:nzt), rdf(nzb+1:nzt), rdf_sc(nzb+1:nzt) ) |
---|
[1788] | 432 | ALLOCATE( ngp_2dh_outer(nzb:nzt+1,0:statistic_regions), & |
---|
| 433 | ngp_2dh_outer_l(nzb:nzt+1,0:statistic_regions), & |
---|
| 434 | ngp_2dh_s_inner(nzb:nzt+1,0:statistic_regions), & |
---|
| 435 | ngp_2dh_s_inner_l(nzb:nzt+1,0:statistic_regions), & |
---|
| 436 | rmask(nysg:nyng,nxlg:nxrg,0:statistic_regions), & |
---|
| 437 | sums(nzb:nzt+1,pr_palm+max_pr_user), & |
---|
| 438 | sums_l(nzb:nzt+1,pr_palm+max_pr_user,0:threads_per_task-1), & |
---|
| 439 | sums_l_l(nzb:nzt+1,0:statistic_regions,0:threads_per_task-1), & |
---|
| 440 | sums_up_fraction_l(10,3,0:statistic_regions), & |
---|
| 441 | sums_wsts_bc_l(nzb:nzt+1,0:statistic_regions), & |
---|
[394] | 442 | ts_value(dots_max,0:statistic_regions) ) |
---|
[978] | 443 | ALLOCATE( ptdf_x(nxlg:nxrg), ptdf_y(nysg:nyng) ) |
---|
[1] | 444 | |
---|
[1788] | 445 | ALLOCATE( ol(nysg:nyng,nxlg:nxrg), shf(nysg:nyng,nxlg:nxrg), & |
---|
| 446 | ts(nysg:nyng,nxlg:nxrg), tswst(nysg:nyng,nxlg:nxrg), & |
---|
| 447 | us(nysg:nyng,nxlg:nxrg), usws(nysg:nyng,nxlg:nxrg), & |
---|
| 448 | uswst(nysg:nyng,nxlg:nxrg), vsws(nysg:nyng,nxlg:nxrg), & |
---|
| 449 | vswst(nysg:nyng,nxlg:nxrg), z0(nysg:nyng,nxlg:nxrg), & |
---|
| 450 | z0h(nysg:nyng,nxlg:nxrg), z0q(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 451 | |
---|
[1788] | 452 | ALLOCATE( d(nzb+1:nzt,nys:nyn,nxl:nxr), & |
---|
| 453 | kh(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 454 | km(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 455 | p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 456 | tend(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 457 | |
---|
| 458 | #if defined( __nopointer ) |
---|
[1788] | 459 | ALLOCATE( e(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 460 | e_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 461 | pt(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 462 | pt_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 463 | u(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 464 | u_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 465 | v(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 466 | v_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 467 | w(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 468 | w_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 469 | te_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 470 | tpt_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 471 | tu_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 472 | tv_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 473 | tw_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 474 | #else |
---|
[1788] | 475 | ALLOCATE( e_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 476 | e_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 477 | e_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 478 | pt_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 479 | pt_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 480 | u_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 481 | u_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 482 | u_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 483 | v_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 484 | v_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 485 | v_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 486 | w_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 487 | w_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[667] | 488 | w_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1788] | 489 | IF ( .NOT. neutral ) THEN |
---|
[1032] | 490 | ALLOCATE( pt_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 491 | ENDIF |
---|
[1010] | 492 | #endif |
---|
| 493 | |
---|
[673] | 494 | ! |
---|
[707] | 495 | !-- Following array is required for perturbation pressure within the iterative |
---|
| 496 | !-- pressure solvers. For the multistep schemes (Runge-Kutta), array p holds |
---|
| 497 | !-- the weighted average of the substeps and cannot be used in the Poisson |
---|
| 498 | !-- solver. |
---|
| 499 | IF ( psolver == 'sor' ) THEN |
---|
| 500 | ALLOCATE( p_loc(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1575] | 501 | ELSEIF ( psolver(1:9) == 'multigrid' ) THEN |
---|
[707] | 502 | ! |
---|
| 503 | !-- For performance reasons, multigrid is using one ghost layer only |
---|
| 504 | ALLOCATE( p_loc(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[673] | 505 | ENDIF |
---|
[1] | 506 | |
---|
[1111] | 507 | ! |
---|
| 508 | !-- Array for storing constant coeffficients of the tridiagonal solver |
---|
| 509 | IF ( psolver == 'poisfft' ) THEN |
---|
[1212] | 510 | ALLOCATE( tri(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1,2) ) |
---|
[1111] | 511 | ALLOCATE( tric(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1) ) |
---|
| 512 | ENDIF |
---|
| 513 | |
---|
[1960] | 514 | IF ( humidity ) THEN |
---|
[1] | 515 | ! |
---|
[1960] | 516 | !-- 2D-humidity |
---|
[1788] | 517 | ALLOCATE ( qs(nysg:nyng,nxlg:nxrg), & |
---|
| 518 | qsws(nysg:nyng,nxlg:nxrg), & |
---|
[1001] | 519 | qswst(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 520 | |
---|
| 521 | ! |
---|
[1960] | 522 | !-- 3D-humidity |
---|
[1010] | 523 | #if defined( __nopointer ) |
---|
[1788] | 524 | ALLOCATE( q(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 525 | q_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 526 | tq_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 527 | #else |
---|
[1788] | 528 | ALLOCATE( q_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 529 | q_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[667] | 530 | q_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 531 | #endif |
---|
[1] | 532 | |
---|
| 533 | ! |
---|
[1960] | 534 | !-- 3D-arrays needed for humidity |
---|
[75] | 535 | IF ( humidity ) THEN |
---|
[1010] | 536 | #if defined( __nopointer ) |
---|
| 537 | ALLOCATE( vpt(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 538 | #else |
---|
[667] | 539 | ALLOCATE( vpt_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 540 | #endif |
---|
[1] | 541 | |
---|
[1788] | 542 | IF ( cloud_physics ) THEN |
---|
[1053] | 543 | |
---|
[1] | 544 | ! |
---|
| 545 | !-- Liquid water content |
---|
[1010] | 546 | #if defined( __nopointer ) |
---|
| 547 | ALLOCATE ( ql(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 548 | #else |
---|
[667] | 549 | ALLOCATE ( ql_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 550 | #endif |
---|
[72] | 551 | ! |
---|
| 552 | !-- Precipitation amount and rate (only needed if output is switched) |
---|
[1788] | 553 | ALLOCATE( precipitation_amount(nysg:nyng,nxlg:nxrg), & |
---|
[667] | 554 | precipitation_rate(nysg:nyng,nxlg:nxrg) ) |
---|
[1053] | 555 | |
---|
| 556 | ! |
---|
[1822] | 557 | !-- 3D-cloud water content |
---|
[1053] | 558 | #if defined( __nopointer ) |
---|
[1822] | 559 | ALLOCATE( qc(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1053] | 560 | #else |
---|
[1822] | 561 | ALLOCATE( qc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1053] | 562 | #endif |
---|
[1822] | 563 | ! |
---|
| 564 | !-- 3d-precipitation rate |
---|
| 565 | ALLOCATE( prr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1115] | 566 | |
---|
[1822] | 567 | IF ( microphysics_seifert ) THEN |
---|
[1053] | 568 | ! |
---|
[1822] | 569 | !-- 2D-rain water content and rain drop concentration arrays |
---|
| 570 | ALLOCATE ( qrs(nysg:nyng,nxlg:nxrg), & |
---|
| 571 | qrsws(nysg:nyng,nxlg:nxrg), & |
---|
| 572 | qrswst(nysg:nyng,nxlg:nxrg), & |
---|
| 573 | nrs(nysg:nyng,nxlg:nxrg), & |
---|
| 574 | nrsws(nysg:nyng,nxlg:nxrg), & |
---|
| 575 | nrswst(nysg:nyng,nxlg:nxrg) ) |
---|
[1115] | 576 | ! |
---|
[1822] | 577 | !-- 3D-rain water content, rain drop concentration arrays |
---|
[1115] | 578 | #if defined( __nopointer ) |
---|
[1822] | 579 | ALLOCATE( nr(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 580 | nr_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 581 | qr(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 582 | qr_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 583 | tnr_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 584 | tqr_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1115] | 585 | #else |
---|
[1822] | 586 | ALLOCATE( nr_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 587 | nr_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 588 | nr_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 589 | qr_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 590 | qr_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 591 | qr_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1115] | 592 | #endif |
---|
[1822] | 593 | ENDIF |
---|
[1053] | 594 | |
---|
[1] | 595 | ENDIF |
---|
| 596 | |
---|
| 597 | IF ( cloud_droplets ) THEN |
---|
| 598 | ! |
---|
[1010] | 599 | !-- Liquid water content, change in liquid water content |
---|
| 600 | #if defined( __nopointer ) |
---|
[1788] | 601 | ALLOCATE ( ql(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 602 | ql_c(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 603 | #else |
---|
[1788] | 604 | ALLOCATE ( ql_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 605 | ql_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 606 | #endif |
---|
| 607 | ! |
---|
| 608 | !-- Real volume of particles (with weighting), volume of particles |
---|
[1788] | 609 | ALLOCATE ( ql_v(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[667] | 610 | ql_vp(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 611 | ENDIF |
---|
| 612 | |
---|
| 613 | ENDIF |
---|
| 614 | |
---|
| 615 | ENDIF |
---|
[1960] | 616 | |
---|
| 617 | |
---|
| 618 | IF ( passive_scalar ) THEN |
---|
| 619 | ! |
---|
| 620 | !-- 2D-scalar arrays |
---|
| 621 | ALLOCATE ( ss(nysg:nyng,nxlg:nxrg), & |
---|
| 622 | ssws(nysg:nyng,nxlg:nxrg), & |
---|
| 623 | sswst(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 624 | |
---|
[1960] | 625 | ! |
---|
| 626 | !-- 3D scalar arrays |
---|
| 627 | #if defined( __nopointer ) |
---|
| 628 | ALLOCATE( s(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 629 | s_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 630 | ts_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 631 | #else |
---|
| 632 | ALLOCATE( s_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 633 | s_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 634 | s_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 635 | #endif |
---|
| 636 | ENDIF |
---|
| 637 | |
---|
[94] | 638 | IF ( ocean ) THEN |
---|
[1788] | 639 | ALLOCATE( saswsb(nysg:nyng,nxlg:nxrg), & |
---|
[1001] | 640 | saswst(nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 641 | #if defined( __nopointer ) |
---|
[1788] | 642 | ALLOCATE( prho(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[2031] | 643 | rho_ocean(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1788] | 644 | sa(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 645 | sa_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 646 | tsa_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 647 | #else |
---|
[1788] | 648 | ALLOCATE( prho_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 649 | rho_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 650 | sa_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 651 | sa_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[667] | 652 | sa_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[388] | 653 | prho => prho_1 |
---|
[2031] | 654 | rho_ocean => rho_1 ! routines calc_mean_profile and diffusion_e require |
---|
[388] | 655 | ! density to be apointer |
---|
[1010] | 656 | #endif |
---|
[108] | 657 | IF ( humidity_remote ) THEN |
---|
[667] | 658 | ALLOCATE( qswst_remote(nysg:nyng,nxlg:nxrg)) |
---|
[1340] | 659 | qswst_remote = 0.0_wp |
---|
[108] | 660 | ENDIF |
---|
[94] | 661 | ENDIF |
---|
| 662 | |
---|
[1] | 663 | ! |
---|
[2037] | 664 | !-- Allocation of anelastic and Boussinesq approximation specific arrays |
---|
| 665 | ALLOCATE( p_hydrostatic(nzb:nzt+1) ) |
---|
| 666 | ALLOCATE( rho_air(nzb:nzt+1) ) |
---|
| 667 | ALLOCATE( rho_air_zw(nzb:nzt+1) ) |
---|
| 668 | ALLOCATE( drho_air(nzb:nzt+1) ) |
---|
| 669 | ALLOCATE( drho_air_zw(nzb:nzt+1) ) |
---|
| 670 | |
---|
| 671 | ! |
---|
| 672 | !-- Density profile calculation for anelastic approximation |
---|
| 673 | IF ( TRIM( approximation ) == 'anelastic' ) THEN |
---|
| 674 | t_surface = pt_surface * ( surface_pressure / 1000.0_wp )**( r_d / cp ) |
---|
| 675 | DO k = nzb, nzt+1 |
---|
| 676 | p_hydrostatic(k) = surface_pressure * 100.0_wp * & |
---|
| 677 | ( 1 - ( g * zu(k) ) / ( cp * t_surface ) & |
---|
| 678 | )**( cp / r_d ) |
---|
| 679 | rho_air(k) = ( p_hydrostatic(k) * & |
---|
| 680 | ( 100000.0_wp / p_hydrostatic(k) & |
---|
| 681 | )**( r_d / cp ) & |
---|
| 682 | ) / ( r_d * pt_init(k) ) |
---|
| 683 | ENDDO |
---|
| 684 | DO k = nzb, nzt |
---|
| 685 | rho_air_zw(k) = 0.5_wp * ( rho_air(k) + rho_air(k+1) ) |
---|
| 686 | ENDDO |
---|
| 687 | rho_air_zw(nzt+1) = rho_air_zw(nzt) & |
---|
| 688 | + 2.0_wp * ( rho_air(nzt+1) - rho_air_zw(nzt) ) |
---|
| 689 | ELSE |
---|
| 690 | rho_air = 1.0_wp |
---|
| 691 | rho_air_zw = 1.0_wp |
---|
| 692 | ENDIF |
---|
| 693 | |
---|
| 694 | !-- compute the inverse density array in order to avoid expencive divisions |
---|
| 695 | drho_air = 1.0_wp / rho_air |
---|
| 696 | drho_air_zw = 1.0_wp / rho_air_zw |
---|
| 697 | |
---|
| 698 | ! |
---|
| 699 | !-- Allocation of flux conversion arrays |
---|
| 700 | ALLOCATE( heatflux_input_conversion(nzb:nzt+1) ) |
---|
| 701 | ALLOCATE( waterflux_input_conversion(nzb:nzt+1) ) |
---|
| 702 | ALLOCATE( momentumflux_input_conversion(nzb:nzt+1) ) |
---|
| 703 | ALLOCATE( heatflux_output_conversion(nzb:nzt+1) ) |
---|
| 704 | ALLOCATE( waterflux_output_conversion(nzb:nzt+1) ) |
---|
| 705 | ALLOCATE( momentumflux_output_conversion(nzb:nzt+1) ) |
---|
| 706 | |
---|
| 707 | ! |
---|
| 708 | !-- calculate flux conversion factors according to approximation and in-/output mode |
---|
| 709 | DO k = nzb, nzt+1 |
---|
| 710 | |
---|
| 711 | IF ( TRIM( flux_input_mode ) == 'kinematic' ) THEN |
---|
| 712 | heatflux_input_conversion(k) = rho_air_zw(k) |
---|
| 713 | waterflux_input_conversion(k) = rho_air_zw(k) |
---|
| 714 | momentumflux_input_conversion(k) = rho_air_zw(k) |
---|
| 715 | ELSEIF ( TRIM( flux_input_mode ) == 'dynamic' ) THEN |
---|
| 716 | heatflux_input_conversion(k) = 1.0_wp / cp |
---|
| 717 | waterflux_input_conversion(k) = 1.0_wp / l_v |
---|
| 718 | momentumflux_input_conversion(k) = 1.0_wp |
---|
| 719 | ENDIF |
---|
| 720 | |
---|
| 721 | IF ( TRIM( flux_output_mode ) == 'kinematic' ) THEN |
---|
| 722 | heatflux_output_conversion(k) = drho_air_zw(k) |
---|
| 723 | waterflux_output_conversion(k) = drho_air_zw(k) |
---|
| 724 | momentumflux_output_conversion(k) = drho_air_zw(k) |
---|
| 725 | ELSEIF ( TRIM( flux_output_mode ) == 'dynamic' ) THEN |
---|
| 726 | heatflux_output_conversion(k) = cp |
---|
| 727 | waterflux_output_conversion(k) = l_v |
---|
| 728 | momentumflux_output_conversion(k) = 1.0_wp |
---|
| 729 | ENDIF |
---|
| 730 | |
---|
| 731 | IF ( .NOT. humidity ) THEN |
---|
| 732 | waterflux_input_conversion(k) = 1.0_wp |
---|
| 733 | waterflux_output_conversion(k) = 1.0_wp |
---|
| 734 | ENDIF |
---|
| 735 | |
---|
| 736 | ENDDO |
---|
| 737 | |
---|
| 738 | ! |
---|
| 739 | !-- In case of multigrid method, compute grid lengths and grid factors for the |
---|
| 740 | !-- grid levels with respective density on each grid |
---|
| 741 | IF ( psolver(1:9) == 'multigrid' ) THEN |
---|
| 742 | |
---|
| 743 | ALLOCATE( ddx2_mg(maximum_grid_level) ) |
---|
| 744 | ALLOCATE( ddy2_mg(maximum_grid_level) ) |
---|
| 745 | ALLOCATE( dzu_mg(nzb+1:nzt+1,maximum_grid_level) ) |
---|
| 746 | ALLOCATE( dzw_mg(nzb+1:nzt+1,maximum_grid_level) ) |
---|
| 747 | ALLOCATE( f1_mg(nzb+1:nzt,maximum_grid_level) ) |
---|
| 748 | ALLOCATE( f2_mg(nzb+1:nzt,maximum_grid_level) ) |
---|
| 749 | ALLOCATE( f3_mg(nzb+1:nzt,maximum_grid_level) ) |
---|
| 750 | ALLOCATE( rho_air_mg(nzb:nzt+1,maximum_grid_level) ) |
---|
| 751 | ALLOCATE( rho_air_zw_mg(nzb:nzt+1,maximum_grid_level) ) |
---|
| 752 | |
---|
| 753 | dzu_mg(:,maximum_grid_level) = dzu |
---|
| 754 | rho_air_mg(:,maximum_grid_level) = rho_air |
---|
| 755 | ! |
---|
| 756 | !-- Next line to ensure an equally spaced grid. |
---|
| 757 | dzu_mg(1,maximum_grid_level) = dzu(2) |
---|
| 758 | rho_air_mg(nzb,maximum_grid_level) = rho_air(nzb) + & |
---|
| 759 | (rho_air(nzb) - rho_air(nzb+1)) |
---|
| 760 | |
---|
| 761 | dzw_mg(:,maximum_grid_level) = dzw |
---|
| 762 | rho_air_zw_mg(:,maximum_grid_level) = rho_air_zw |
---|
| 763 | nzt_l = nzt |
---|
| 764 | DO l = maximum_grid_level-1, 1, -1 |
---|
| 765 | dzu_mg(nzb+1,l) = 2.0_wp * dzu_mg(nzb+1,l+1) |
---|
| 766 | dzw_mg(nzb+1,l) = 2.0_wp * dzw_mg(nzb+1,l+1) |
---|
| 767 | rho_air_mg(nzb,l) = rho_air_mg(nzb,l+1) + (rho_air_mg(nzb,l+1) - rho_air_mg(nzb+1,l+1)) |
---|
| 768 | rho_air_zw_mg(nzb,l) = rho_air_zw_mg(nzb,l+1) + (rho_air_zw_mg(nzb,l+1) - rho_air_zw_mg(nzb+1,l+1)) |
---|
| 769 | rho_air_mg(nzb+1,l) = rho_air_mg(nzb+1,l+1) |
---|
| 770 | rho_air_zw_mg(nzb+1,l) = rho_air_zw_mg(nzb+1,l+1) |
---|
| 771 | nzt_l = nzt_l / 2 |
---|
| 772 | DO k = 2, nzt_l+1 |
---|
| 773 | dzu_mg(k,l) = dzu_mg(2*k-2,l+1) + dzu_mg(2*k-1,l+1) |
---|
| 774 | dzw_mg(k,l) = dzw_mg(2*k-2,l+1) + dzw_mg(2*k-1,l+1) |
---|
| 775 | rho_air_mg(k,l) = rho_air_mg(2*k-1,l+1) |
---|
| 776 | rho_air_zw_mg(k,l) = rho_air_zw_mg(2*k-1,l+1) |
---|
| 777 | ENDDO |
---|
| 778 | ENDDO |
---|
| 779 | |
---|
| 780 | nzt_l = nzt |
---|
| 781 | dx_l = dx |
---|
| 782 | dy_l = dy |
---|
| 783 | DO l = maximum_grid_level, 1, -1 |
---|
| 784 | ddx2_mg(l) = 1.0_wp / dx_l**2 |
---|
| 785 | ddy2_mg(l) = 1.0_wp / dy_l**2 |
---|
| 786 | DO k = nzb+1, nzt_l |
---|
| 787 | f2_mg(k,l) = rho_air_zw_mg(k,l) / ( dzu_mg(k+1,l) * dzw_mg(k,l) ) |
---|
| 788 | f3_mg(k,l) = rho_air_zw_mg(k-1,l) / ( dzu_mg(k,l) * dzw_mg(k,l) ) |
---|
| 789 | f1_mg(k,l) = 2.0_wp * ( ddx2_mg(l) + ddy2_mg(l) ) & |
---|
| 790 | * rho_air_mg(k,l) + f2_mg(k,l) + f3_mg(k,l) |
---|
| 791 | ENDDO |
---|
| 792 | nzt_l = nzt_l / 2 |
---|
| 793 | dx_l = dx_l * 2.0_wp |
---|
| 794 | dy_l = dy_l * 2.0_wp |
---|
| 795 | ENDDO |
---|
| 796 | |
---|
| 797 | ENDIF |
---|
| 798 | |
---|
| 799 | ! |
---|
[1] | 800 | !-- 3D-array for storing the dissipation, needed for calculating the sgs |
---|
| 801 | !-- particle velocities |
---|
[1831] | 802 | IF ( use_sgs_for_particles .OR. wang_kernel .OR. collision_turbulence & |
---|
| 803 | .OR. num_acc_per_node > 0 ) THEN |
---|
[1153] | 804 | ALLOCATE( diss(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 805 | ENDIF |
---|
| 806 | |
---|
| 807 | ! |
---|
[1299] | 808 | !-- 1D-array for large scale subsidence velocity |
---|
[1361] | 809 | IF ( .NOT. ALLOCATED( w_subs ) ) THEN |
---|
| 810 | ALLOCATE ( w_subs(nzb:nzt+1) ) |
---|
| 811 | w_subs = 0.0_wp |
---|
| 812 | ENDIF |
---|
[1299] | 813 | |
---|
| 814 | ! |
---|
[1400] | 815 | !-- ID-array and state-space-array for the parallel random number generator |
---|
| 816 | IF ( random_generator == 'random-parallel' ) THEN |
---|
| 817 | ALLOCATE ( seq_random_array(5,nysg:nyng,nxlg:nxrg) ) |
---|
| 818 | ALLOCATE ( id_random_array(0:ny,0:nx) ) |
---|
| 819 | seq_random_array = 0 |
---|
| 820 | id_random_array = 0 |
---|
| 821 | ENDIF |
---|
| 822 | |
---|
| 823 | ! |
---|
[51] | 824 | !-- 4D-array for storing the Rif-values at vertical walls |
---|
| 825 | IF ( topography /= 'flat' ) THEN |
---|
[667] | 826 | ALLOCATE( rif_wall(nzb:nzt+1,nysg:nyng,nxlg:nxrg,1:4) ) |
---|
[1340] | 827 | rif_wall = 0.0_wp |
---|
[51] | 828 | ENDIF |
---|
| 829 | |
---|
| 830 | ! |
---|
[106] | 831 | !-- Arrays to store velocity data from t-dt and the phase speeds which |
---|
| 832 | !-- are needed for radiation boundary conditions |
---|
[73] | 833 | IF ( outflow_l ) THEN |
---|
[1788] | 834 | ALLOCATE( u_m_l(nzb:nzt+1,nysg:nyng,1:2), & |
---|
| 835 | v_m_l(nzb:nzt+1,nysg:nyng,0:1), & |
---|
[667] | 836 | w_m_l(nzb:nzt+1,nysg:nyng,0:1) ) |
---|
[73] | 837 | ENDIF |
---|
| 838 | IF ( outflow_r ) THEN |
---|
[1788] | 839 | ALLOCATE( u_m_r(nzb:nzt+1,nysg:nyng,nx-1:nx), & |
---|
| 840 | v_m_r(nzb:nzt+1,nysg:nyng,nx-1:nx), & |
---|
[667] | 841 | w_m_r(nzb:nzt+1,nysg:nyng,nx-1:nx) ) |
---|
[73] | 842 | ENDIF |
---|
[106] | 843 | IF ( outflow_l .OR. outflow_r ) THEN |
---|
[1788] | 844 | ALLOCATE( c_u(nzb:nzt+1,nysg:nyng), c_v(nzb:nzt+1,nysg:nyng), & |
---|
[667] | 845 | c_w(nzb:nzt+1,nysg:nyng) ) |
---|
[106] | 846 | ENDIF |
---|
[73] | 847 | IF ( outflow_s ) THEN |
---|
[1788] | 848 | ALLOCATE( u_m_s(nzb:nzt+1,0:1,nxlg:nxrg), & |
---|
| 849 | v_m_s(nzb:nzt+1,1:2,nxlg:nxrg), & |
---|
[667] | 850 | w_m_s(nzb:nzt+1,0:1,nxlg:nxrg) ) |
---|
[73] | 851 | ENDIF |
---|
| 852 | IF ( outflow_n ) THEN |
---|
[1788] | 853 | ALLOCATE( u_m_n(nzb:nzt+1,ny-1:ny,nxlg:nxrg), & |
---|
| 854 | v_m_n(nzb:nzt+1,ny-1:ny,nxlg:nxrg), & |
---|
[667] | 855 | w_m_n(nzb:nzt+1,ny-1:ny,nxlg:nxrg) ) |
---|
[73] | 856 | ENDIF |
---|
[106] | 857 | IF ( outflow_s .OR. outflow_n ) THEN |
---|
[1788] | 858 | ALLOCATE( c_u(nzb:nzt+1,nxlg:nxrg), c_v(nzb:nzt+1,nxlg:nxrg), & |
---|
[667] | 859 | c_w(nzb:nzt+1,nxlg:nxrg) ) |
---|
[106] | 860 | ENDIF |
---|
[996] | 861 | IF ( outflow_l .OR. outflow_r .OR. outflow_s .OR. outflow_n ) THEN |
---|
[978] | 862 | ALLOCATE( c_u_m_l(nzb:nzt+1), c_v_m_l(nzb:nzt+1), c_w_m_l(nzb:nzt+1) ) |
---|
| 863 | ALLOCATE( c_u_m(nzb:nzt+1), c_v_m(nzb:nzt+1), c_w_m(nzb:nzt+1) ) |
---|
| 864 | ENDIF |
---|
[73] | 865 | |
---|
[978] | 866 | |
---|
[1010] | 867 | #if ! defined( __nopointer ) |
---|
[73] | 868 | ! |
---|
[1] | 869 | !-- Initial assignment of the pointers |
---|
[1001] | 870 | e => e_1; e_p => e_2; te_m => e_3 |
---|
[1032] | 871 | IF ( .NOT. neutral ) THEN |
---|
| 872 | pt => pt_1; pt_p => pt_2; tpt_m => pt_3 |
---|
| 873 | ELSE |
---|
| 874 | pt => pt_1; pt_p => pt_1; tpt_m => pt_3 |
---|
| 875 | ENDIF |
---|
[1001] | 876 | u => u_1; u_p => u_2; tu_m => u_3 |
---|
| 877 | v => v_1; v_p => v_2; tv_m => v_3 |
---|
| 878 | w => w_1; w_p => w_2; tw_m => w_3 |
---|
[1] | 879 | |
---|
[1960] | 880 | IF ( humidity ) THEN |
---|
[1001] | 881 | q => q_1; q_p => q_2; tq_m => q_3 |
---|
[1053] | 882 | IF ( humidity ) THEN |
---|
| 883 | vpt => vpt_1 |
---|
| 884 | IF ( cloud_physics ) THEN |
---|
| 885 | ql => ql_1 |
---|
[1822] | 886 | qc => qc_1 |
---|
| 887 | IF ( microphysics_seifert ) THEN |
---|
| 888 | qr => qr_1; qr_p => qr_2; tqr_m => qr_3 |
---|
| 889 | nr => nr_1; nr_p => nr_2; tnr_m => nr_3 |
---|
[1053] | 890 | ENDIF |
---|
| 891 | ENDIF |
---|
| 892 | ENDIF |
---|
[1001] | 893 | IF ( cloud_droplets ) THEN |
---|
| 894 | ql => ql_1 |
---|
| 895 | ql_c => ql_2 |
---|
[1] | 896 | ENDIF |
---|
[1001] | 897 | ENDIF |
---|
[1960] | 898 | |
---|
| 899 | IF ( passive_scalar ) THEN |
---|
| 900 | s => s_1; s_p => s_2; ts_m => s_3 |
---|
| 901 | ENDIF |
---|
[1] | 902 | |
---|
[1001] | 903 | IF ( ocean ) THEN |
---|
| 904 | sa => sa_1; sa_p => sa_2; tsa_m => sa_3 |
---|
| 905 | ENDIF |
---|
[1010] | 906 | #endif |
---|
[1] | 907 | |
---|
| 908 | ! |
---|
[1551] | 909 | !-- Allocate land surface model arrays |
---|
| 910 | IF ( land_surface ) THEN |
---|
[1817] | 911 | CALL lsm_init_arrays |
---|
[1551] | 912 | ENDIF |
---|
| 913 | |
---|
| 914 | ! |
---|
[1914] | 915 | !-- Allocate wind turbine model arrays |
---|
| 916 | IF ( wind_turbine ) THEN |
---|
| 917 | CALL wtm_init_arrays |
---|
| 918 | ENDIF |
---|
[1957] | 919 | |
---|
| 920 | ! |
---|
| 921 | !-- Initialize virtual flight measurements |
---|
| 922 | IF ( virtual_flight ) THEN |
---|
| 923 | CALL flight_init |
---|
| 924 | ENDIF |
---|
[1914] | 925 | |
---|
| 926 | ! |
---|
[709] | 927 | !-- Allocate arrays containing the RK coefficient for calculation of |
---|
| 928 | !-- perturbation pressure and turbulent fluxes. At this point values are |
---|
| 929 | !-- set for pressure calculation during initialization (where no timestep |
---|
| 930 | !-- is done). Further below the values needed within the timestep scheme |
---|
| 931 | !-- will be set. |
---|
[1788] | 932 | ALLOCATE( weight_substep(1:intermediate_timestep_count_max), & |
---|
[1878] | 933 | weight_pres(1:intermediate_timestep_count_max) ) |
---|
[1340] | 934 | weight_substep = 1.0_wp |
---|
| 935 | weight_pres = 1.0_wp |
---|
[1918] | 936 | intermediate_timestep_count = 0 ! needed when simulated_time = 0.0 |
---|
[673] | 937 | |
---|
[1402] | 938 | CALL location_message( 'finished', .TRUE. ) |
---|
[1918] | 939 | |
---|
[673] | 940 | ! |
---|
[1918] | 941 | !-- Initialize local summation arrays for routine flow_statistics. |
---|
| 942 | !-- This is necessary because they may not yet have been initialized when they |
---|
| 943 | !-- are called from flow_statistics (or - depending on the chosen model run - |
---|
| 944 | !-- are never initialized) |
---|
| 945 | sums_divnew_l = 0.0_wp |
---|
| 946 | sums_divold_l = 0.0_wp |
---|
| 947 | sums_l_l = 0.0_wp |
---|
| 948 | sums_up_fraction_l = 0.0_wp |
---|
| 949 | sums_wsts_bc_l = 0.0_wp |
---|
| 950 | |
---|
| 951 | |
---|
| 952 | ! |
---|
[1] | 953 | !-- Initialize model variables |
---|
[1788] | 954 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. & |
---|
[328] | 955 | TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN |
---|
[1] | 956 | ! |
---|
| 957 | !-- First model run of a possible job queue. |
---|
| 958 | !-- Initial profiles of the variables must be computes. |
---|
| 959 | IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN |
---|
[1384] | 960 | |
---|
[1402] | 961 | CALL location_message( 'initializing with 1D model profiles', .FALSE. ) |
---|
[1] | 962 | ! |
---|
| 963 | !-- Use solutions of the 1D model as initial profiles, |
---|
| 964 | !-- start 1D model |
---|
| 965 | CALL init_1d_model |
---|
| 966 | ! |
---|
| 967 | !-- Transfer initial profiles to the arrays of the 3D model |
---|
[667] | 968 | DO i = nxlg, nxrg |
---|
| 969 | DO j = nysg, nyng |
---|
[1] | 970 | e(:,j,i) = e1d |
---|
| 971 | kh(:,j,i) = kh1d |
---|
| 972 | km(:,j,i) = km1d |
---|
| 973 | pt(:,j,i) = pt_init |
---|
| 974 | u(:,j,i) = u1d |
---|
| 975 | v(:,j,i) = v1d |
---|
| 976 | ENDDO |
---|
| 977 | ENDDO |
---|
| 978 | |
---|
[1960] | 979 | IF ( humidity ) THEN |
---|
[667] | 980 | DO i = nxlg, nxrg |
---|
| 981 | DO j = nysg, nyng |
---|
[1] | 982 | q(:,j,i) = q_init |
---|
| 983 | ENDDO |
---|
| 984 | ENDDO |
---|
[1822] | 985 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1053] | 986 | DO i = nxlg, nxrg |
---|
| 987 | DO j = nysg, nyng |
---|
[1340] | 988 | qr(:,j,i) = 0.0_wp |
---|
| 989 | nr(:,j,i) = 0.0_wp |
---|
[1053] | 990 | ENDDO |
---|
| 991 | ENDDO |
---|
[1115] | 992 | |
---|
[1053] | 993 | ENDIF |
---|
[1] | 994 | ENDIF |
---|
[1960] | 995 | IF ( passive_scalar ) THEN |
---|
| 996 | DO i = nxlg, nxrg |
---|
| 997 | DO j = nysg, nyng |
---|
| 998 | s(:,j,i) = s_init |
---|
| 999 | ENDDO |
---|
| 1000 | ENDDO |
---|
| 1001 | ENDIF |
---|
[1] | 1002 | |
---|
| 1003 | IF ( .NOT. constant_diffusion ) THEN |
---|
[667] | 1004 | DO i = nxlg, nxrg |
---|
| 1005 | DO j = nysg, nyng |
---|
[1] | 1006 | e(:,j,i) = e1d |
---|
| 1007 | ENDDO |
---|
| 1008 | ENDDO |
---|
| 1009 | ! |
---|
| 1010 | !-- Store initial profiles for output purposes etc. |
---|
| 1011 | hom(:,1,25,:) = SPREAD( l1d, 2, statistic_regions+1 ) |
---|
| 1012 | |
---|
[1691] | 1013 | IF ( constant_flux_layer ) THEN |
---|
[1707] | 1014 | ol = ( zu(nzb+1) - zw(nzb) ) / ( rif1d(nzb+1) + 1.0E-20_wp ) |
---|
[1340] | 1015 | ts = 0.0_wp ! could actually be computed more accurately in the |
---|
| 1016 | ! 1D model. Update when opportunity arises. |
---|
[1] | 1017 | us = us1d |
---|
| 1018 | usws = usws1d |
---|
| 1019 | vsws = vsws1d |
---|
| 1020 | ELSE |
---|
[1340] | 1021 | ts = 0.0_wp ! must be set, because used in |
---|
[1691] | 1022 | ol = ( zu(nzb+1) - zw(nzb) ) / zeta_min ! flowste |
---|
[1340] | 1023 | us = 0.0_wp |
---|
| 1024 | usws = 0.0_wp |
---|
| 1025 | vsws = 0.0_wp |
---|
[1] | 1026 | ENDIF |
---|
| 1027 | |
---|
| 1028 | ELSE |
---|
[1340] | 1029 | e = 0.0_wp ! must be set, because used in |
---|
[1691] | 1030 | ol = ( zu(nzb+1) - zw(nzb) ) / zeta_min ! flowste |
---|
[1340] | 1031 | ts = 0.0_wp |
---|
| 1032 | us = 0.0_wp |
---|
| 1033 | usws = 0.0_wp |
---|
| 1034 | vsws = 0.0_wp |
---|
[1] | 1035 | ENDIF |
---|
[2037] | 1036 | uswst = top_momentumflux_u * momentumflux_input_conversion(nzt+1) |
---|
| 1037 | vswst = top_momentumflux_v * momentumflux_input_conversion(nzt+1) |
---|
[1] | 1038 | |
---|
| 1039 | ! |
---|
| 1040 | !-- In every case qs = 0.0 (see also pt) |
---|
| 1041 | !-- This could actually be computed more accurately in the 1D model. |
---|
| 1042 | !-- Update when opportunity arises! |
---|
[1960] | 1043 | IF ( humidity ) THEN |
---|
[1340] | 1044 | qs = 0.0_wp |
---|
[1822] | 1045 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1340] | 1046 | qrs = 0.0_wp |
---|
| 1047 | nrs = 0.0_wp |
---|
[1053] | 1048 | ENDIF |
---|
| 1049 | ENDIF |
---|
[1960] | 1050 | ! |
---|
| 1051 | !-- Initialize scaling parameter for passive scalar |
---|
| 1052 | IF ( passive_scalar ) ss = 0.0_wp |
---|
[1] | 1053 | |
---|
| 1054 | ! |
---|
[1762] | 1055 | !-- Inside buildings set velocities back to zero |
---|
[1] | 1056 | IF ( topography /= 'flat' ) THEN |
---|
[1762] | 1057 | DO i = nxlg, nxrg |
---|
| 1058 | DO j = nysg, nyng |
---|
[1340] | 1059 | u(nzb:nzb_u_inner(j,i),j,i) = 0.0_wp |
---|
| 1060 | v(nzb:nzb_v_inner(j,i),j,i) = 0.0_wp |
---|
[1] | 1061 | ENDDO |
---|
| 1062 | ENDDO |
---|
[667] | 1063 | |
---|
[1] | 1064 | ! |
---|
| 1065 | !-- WARNING: The extra boundary conditions set after running the |
---|
| 1066 | !-- ------- 1D model impose an error on the divergence one layer |
---|
| 1067 | !-- below the topography; need to correct later |
---|
| 1068 | !-- ATTENTION: Provisional correction for Piacsek & Williams |
---|
| 1069 | !-- --------- advection scheme: keep u and v zero one layer below |
---|
| 1070 | !-- the topography. |
---|
[667] | 1071 | IF ( ibc_uv_b == 1 ) THEN |
---|
| 1072 | ! |
---|
[1] | 1073 | !-- Neumann condition |
---|
| 1074 | DO i = nxl-1, nxr+1 |
---|
| 1075 | DO j = nys-1, nyn+1 |
---|
| 1076 | IF ( nzb_u_inner(j,i) == 0 ) u(0,j,i) = u(1,j,i) |
---|
| 1077 | IF ( nzb_v_inner(j,i) == 0 ) v(0,j,i) = v(1,j,i) |
---|
| 1078 | ENDDO |
---|
| 1079 | ENDDO |
---|
| 1080 | |
---|
| 1081 | ENDIF |
---|
| 1082 | |
---|
| 1083 | ENDIF |
---|
| 1084 | |
---|
[1402] | 1085 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1086 | |
---|
[1788] | 1087 | ELSEIF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) & |
---|
[1] | 1088 | THEN |
---|
[1241] | 1089 | |
---|
[1402] | 1090 | CALL location_message( 'initializing with constant profiles', .FALSE. ) |
---|
[1] | 1091 | ! |
---|
[1241] | 1092 | !-- Overwrite initial profiles in case of nudging |
---|
[1788] | 1093 | IF ( nudging ) THEN |
---|
[1241] | 1094 | pt_init = ptnudge(:,1) |
---|
| 1095 | u_init = unudge(:,1) |
---|
| 1096 | v_init = vnudge(:,1) |
---|
[1960] | 1097 | IF ( humidity ) THEN ! is passive_scalar correct??? |
---|
[1241] | 1098 | q_init = qnudge(:,1) |
---|
| 1099 | ENDIF |
---|
| 1100 | |
---|
[1788] | 1101 | WRITE( message_string, * ) 'Initial profiles of u, v and ', & |
---|
[1241] | 1102 | 'scalars from NUDGING_DATA are used.' |
---|
| 1103 | CALL message( 'init_3d_model', 'PA0370', 0, 0, 0, 6, 0 ) |
---|
| 1104 | ENDIF |
---|
| 1105 | |
---|
| 1106 | ! |
---|
[1] | 1107 | !-- Use constructed initial profiles (velocity constant with height, |
---|
| 1108 | !-- temperature profile with constant gradient) |
---|
[667] | 1109 | DO i = nxlg, nxrg |
---|
| 1110 | DO j = nysg, nyng |
---|
[1] | 1111 | pt(:,j,i) = pt_init |
---|
| 1112 | u(:,j,i) = u_init |
---|
| 1113 | v(:,j,i) = v_init |
---|
| 1114 | ENDDO |
---|
| 1115 | ENDDO |
---|
[75] | 1116 | |
---|
[1] | 1117 | ! |
---|
[292] | 1118 | !-- Set initial horizontal velocities at the lowest computational grid |
---|
| 1119 | !-- levels to zero in order to avoid too small time steps caused by the |
---|
| 1120 | !-- diffusion limit in the initial phase of a run (at k=1, dz/2 occurs |
---|
[1815] | 1121 | !-- in the limiting formula!). |
---|
| 1122 | IF ( ibc_uv_b /= 1 ) THEN |
---|
| 1123 | DO i = nxlg, nxrg |
---|
| 1124 | DO j = nysg, nyng |
---|
| 1125 | u(nzb:nzb_u_inner(j,i)+1,j,i) = 0.0_wp |
---|
| 1126 | v(nzb:nzb_v_inner(j,i)+1,j,i) = 0.0_wp |
---|
| 1127 | ENDDO |
---|
| 1128 | ENDDO |
---|
| 1129 | ENDIF |
---|
[1] | 1130 | |
---|
[1960] | 1131 | IF ( humidity ) THEN |
---|
[667] | 1132 | DO i = nxlg, nxrg |
---|
| 1133 | DO j = nysg, nyng |
---|
[1] | 1134 | q(:,j,i) = q_init |
---|
| 1135 | ENDDO |
---|
| 1136 | ENDDO |
---|
[1822] | 1137 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1115] | 1138 | |
---|
[1822] | 1139 | DO i = nxlg, nxrg |
---|
| 1140 | DO j = nysg, nyng |
---|
| 1141 | qr(:,j,i) = 0.0_wp |
---|
| 1142 | nr(:,j,i) = 0.0_wp |
---|
[1053] | 1143 | ENDDO |
---|
[1822] | 1144 | ENDDO |
---|
[1115] | 1145 | |
---|
[1053] | 1146 | ENDIF |
---|
[1] | 1147 | ENDIF |
---|
[1960] | 1148 | |
---|
| 1149 | IF ( passive_scalar ) THEN |
---|
| 1150 | DO i = nxlg, nxrg |
---|
| 1151 | DO j = nysg, nyng |
---|
| 1152 | s(:,j,i) = s_init |
---|
| 1153 | ENDDO |
---|
| 1154 | ENDDO |
---|
| 1155 | ENDIF |
---|
[1] | 1156 | |
---|
[94] | 1157 | IF ( ocean ) THEN |
---|
[667] | 1158 | DO i = nxlg, nxrg |
---|
| 1159 | DO j = nysg, nyng |
---|
[94] | 1160 | sa(:,j,i) = sa_init |
---|
| 1161 | ENDDO |
---|
| 1162 | ENDDO |
---|
| 1163 | ENDIF |
---|
[1] | 1164 | |
---|
| 1165 | IF ( constant_diffusion ) THEN |
---|
| 1166 | km = km_constant |
---|
| 1167 | kh = km / prandtl_number |
---|
[1340] | 1168 | e = 0.0_wp |
---|
| 1169 | ELSEIF ( e_init > 0.0_wp ) THEN |
---|
[108] | 1170 | DO k = nzb+1, nzt |
---|
[1340] | 1171 | km(k,:,:) = 0.1_wp * l_grid(k) * SQRT( e_init ) |
---|
[108] | 1172 | ENDDO |
---|
| 1173 | km(nzb,:,:) = km(nzb+1,:,:) |
---|
| 1174 | km(nzt+1,:,:) = km(nzt,:,:) |
---|
| 1175 | kh = km / prandtl_number |
---|
| 1176 | e = e_init |
---|
[1] | 1177 | ELSE |
---|
[108] | 1178 | IF ( .NOT. ocean ) THEN |
---|
[1340] | 1179 | kh = 0.01_wp ! there must exist an initial diffusion, because |
---|
| 1180 | km = 0.01_wp ! otherwise no TKE would be produced by the |
---|
[108] | 1181 | ! production terms, as long as not yet |
---|
| 1182 | ! e = (u*/cm)**2 at k=nzb+1 |
---|
| 1183 | ELSE |
---|
[1340] | 1184 | kh = 0.00001_wp |
---|
| 1185 | km = 0.00001_wp |
---|
[108] | 1186 | ENDIF |
---|
[1340] | 1187 | e = 0.0_wp |
---|
[1] | 1188 | ENDIF |
---|
[1691] | 1189 | ol = ( zu(nzb+1) - zw(nzb) ) / zeta_min |
---|
[1340] | 1190 | ts = 0.0_wp |
---|
[1920] | 1191 | ! |
---|
| 1192 | !-- Very small number is required for calculation of Obukhov length |
---|
| 1193 | !-- at first timestep |
---|
| 1194 | us = 1E-30_wp |
---|
[1340] | 1195 | usws = 0.0_wp |
---|
[2037] | 1196 | uswst = top_momentumflux_u * momentumflux_input_conversion(nzt+1) |
---|
[1340] | 1197 | vsws = 0.0_wp |
---|
[2037] | 1198 | vswst = top_momentumflux_v * momentumflux_input_conversion(nzt+1) |
---|
[1960] | 1199 | IF ( humidity ) qs = 0.0_wp |
---|
| 1200 | IF ( passive_scalar ) ss = 0.0_wp |
---|
[1] | 1201 | |
---|
| 1202 | ! |
---|
| 1203 | !-- Compute initial temperature field and other constants used in case |
---|
| 1204 | !-- of a sloping surface |
---|
| 1205 | IF ( sloping_surface ) CALL init_slope |
---|
| 1206 | |
---|
[1402] | 1207 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1208 | |
---|
[1788] | 1209 | ELSEIF ( INDEX(initializing_actions, 'by_user') /= 0 ) & |
---|
[46] | 1210 | THEN |
---|
[1384] | 1211 | |
---|
[1402] | 1212 | CALL location_message( 'initializing by user', .FALSE. ) |
---|
[46] | 1213 | ! |
---|
| 1214 | !-- Initialization will completely be done by the user |
---|
| 1215 | CALL user_init_3d_model |
---|
| 1216 | |
---|
[1402] | 1217 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1218 | |
---|
[1] | 1219 | ENDIF |
---|
[1384] | 1220 | |
---|
[1402] | 1221 | CALL location_message( 'initializing statistics, boundary conditions, etc.', & |
---|
| 1222 | .FALSE. ) |
---|
[1384] | 1223 | |
---|
[667] | 1224 | ! |
---|
| 1225 | !-- Bottom boundary |
---|
| 1226 | IF ( ibc_uv_b == 0 .OR. ibc_uv_b == 2 ) THEN |
---|
[1340] | 1227 | u(nzb,:,:) = 0.0_wp |
---|
| 1228 | v(nzb,:,:) = 0.0_wp |
---|
[667] | 1229 | ENDIF |
---|
[1] | 1230 | |
---|
| 1231 | ! |
---|
[151] | 1232 | !-- Apply channel flow boundary condition |
---|
[132] | 1233 | IF ( TRIM( bc_uv_t ) == 'dirichlet_0' ) THEN |
---|
[1340] | 1234 | u(nzt+1,:,:) = 0.0_wp |
---|
| 1235 | v(nzt+1,:,:) = 0.0_wp |
---|
[132] | 1236 | ENDIF |
---|
| 1237 | |
---|
| 1238 | ! |
---|
[1] | 1239 | !-- Calculate virtual potential temperature |
---|
[1960] | 1240 | IF ( humidity ) vpt = pt * ( 1.0_wp + 0.61_wp * q ) |
---|
[1] | 1241 | |
---|
| 1242 | ! |
---|
| 1243 | !-- Store initial profiles for output purposes etc. |
---|
| 1244 | hom(:,1,5,:) = SPREAD( u(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1245 | hom(:,1,6,:) = SPREAD( v(:,nys,nxl), 2, statistic_regions+1 ) |
---|
[667] | 1246 | IF ( ibc_uv_b == 0 .OR. ibc_uv_b == 2) THEN |
---|
[1340] | 1247 | hom(nzb,1,5,:) = 0.0_wp |
---|
| 1248 | hom(nzb,1,6,:) = 0.0_wp |
---|
[1] | 1249 | ENDIF |
---|
| 1250 | hom(:,1,7,:) = SPREAD( pt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1251 | hom(:,1,23,:) = SPREAD( km(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1252 | hom(:,1,24,:) = SPREAD( kh(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1253 | |
---|
[97] | 1254 | IF ( ocean ) THEN |
---|
| 1255 | ! |
---|
| 1256 | !-- Store initial salinity profile |
---|
| 1257 | hom(:,1,26,:) = SPREAD( sa(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1258 | ENDIF |
---|
[1] | 1259 | |
---|
[75] | 1260 | IF ( humidity ) THEN |
---|
[1] | 1261 | ! |
---|
| 1262 | !-- Store initial profile of total water content, virtual potential |
---|
| 1263 | !-- temperature |
---|
| 1264 | hom(:,1,26,:) = SPREAD( q(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1265 | hom(:,1,29,:) = SPREAD( vpt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1266 | IF ( cloud_physics .OR. cloud_droplets ) THEN |
---|
| 1267 | ! |
---|
| 1268 | !-- Store initial profile of specific humidity and potential |
---|
| 1269 | !-- temperature |
---|
| 1270 | hom(:,1,27,:) = SPREAD( q(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1271 | hom(:,1,28,:) = SPREAD( pt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1272 | ENDIF |
---|
| 1273 | ENDIF |
---|
| 1274 | |
---|
| 1275 | IF ( passive_scalar ) THEN |
---|
| 1276 | ! |
---|
| 1277 | !-- Store initial scalar profile |
---|
[1960] | 1278 | hom(:,1,115,:) = SPREAD( s(:,nys,nxl), 2, statistic_regions+1 ) |
---|
[1] | 1279 | ENDIF |
---|
| 1280 | |
---|
| 1281 | ! |
---|
[1400] | 1282 | !-- Initialize the random number generators (from numerical recipes) |
---|
| 1283 | CALL random_function_ini |
---|
[1429] | 1284 | |
---|
[1400] | 1285 | IF ( random_generator == 'random-parallel' ) THEN |
---|
[1429] | 1286 | !-- Asigning an ID to every vertical gridpoint column |
---|
| 1287 | !-- dependig on the ensemble run number. |
---|
| 1288 | random_dummy=1 |
---|
[1400] | 1289 | DO j=0,ny |
---|
| 1290 | DO i=0,nx |
---|
[1788] | 1291 | id_random_array(j,i) = random_dummy + 1E6 & |
---|
| 1292 | * ( ensemble_member_nr - 1000 ) |
---|
[1429] | 1293 | random_dummy = random_dummy + 1 |
---|
[1400] | 1294 | END DO |
---|
| 1295 | ENDDO |
---|
[1429] | 1296 | !-- Initializing with random_seed_parallel for every vertical |
---|
| 1297 | !-- gridpoint column. |
---|
| 1298 | random_dummy=0 |
---|
[1400] | 1299 | DO j = nysg, nyng |
---|
| 1300 | DO i = nxlg, nxrg |
---|
| 1301 | CALL random_seed_parallel (random_sequence=id_random_array(j, i)) |
---|
| 1302 | CALL random_number_parallel (random_dummy) |
---|
| 1303 | CALL random_seed_parallel (get=seq_random_array(:, j, i)) |
---|
| 1304 | END DO |
---|
| 1305 | ENDDO |
---|
| 1306 | ENDIF |
---|
| 1307 | |
---|
| 1308 | ! |
---|
[19] | 1309 | !-- Initialize fluxes at bottom surface |
---|
[1] | 1310 | IF ( use_surface_fluxes ) THEN |
---|
| 1311 | |
---|
| 1312 | IF ( constant_heatflux ) THEN |
---|
| 1313 | ! |
---|
| 1314 | !-- Heat flux is prescribed |
---|
| 1315 | IF ( random_heatflux ) THEN |
---|
| 1316 | CALL disturb_heatflux |
---|
| 1317 | ELSE |
---|
[2037] | 1318 | shf = surface_heatflux * heatflux_input_conversion(nzb) |
---|
[1] | 1319 | ! |
---|
[1241] | 1320 | !-- Initialize shf with data from external file LSF_DATA |
---|
[1788] | 1321 | IF ( large_scale_forcing .AND. lsf_surf ) THEN |
---|
[1241] | 1322 | CALL ls_forcing_surf ( simulated_time ) |
---|
| 1323 | ENDIF |
---|
| 1324 | |
---|
| 1325 | ! |
---|
[1] | 1326 | !-- Over topography surface_heatflux is replaced by wall_heatflux(0) |
---|
| 1327 | IF ( TRIM( topography ) /= 'flat' ) THEN |
---|
[667] | 1328 | DO i = nxlg, nxrg |
---|
| 1329 | DO j = nysg, nyng |
---|
[1] | 1330 | IF ( nzb_s_inner(j,i) /= 0 ) THEN |
---|
[2037] | 1331 | shf(j,i) = wall_heatflux(0) & |
---|
| 1332 | * heatflux_input_conversion(nzb_s_inner(j,i)) |
---|
[1] | 1333 | ENDIF |
---|
| 1334 | ENDDO |
---|
| 1335 | ENDDO |
---|
| 1336 | ENDIF |
---|
| 1337 | ENDIF |
---|
| 1338 | ENDIF |
---|
| 1339 | |
---|
| 1340 | ! |
---|
| 1341 | !-- Determine the near-surface water flux |
---|
[1960] | 1342 | IF ( humidity ) THEN |
---|
[1822] | 1343 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1340] | 1344 | qrsws = 0.0_wp |
---|
| 1345 | nrsws = 0.0_wp |
---|
[1053] | 1346 | ENDIF |
---|
[1] | 1347 | IF ( constant_waterflux ) THEN |
---|
[2037] | 1348 | qsws = surface_waterflux * waterflux_input_conversion(nzb) |
---|
[407] | 1349 | ! |
---|
| 1350 | !-- Over topography surface_waterflux is replaced by |
---|
| 1351 | !-- wall_humidityflux(0) |
---|
| 1352 | IF ( TRIM( topography ) /= 'flat' ) THEN |
---|
| 1353 | wall_qflux = wall_humidityflux |
---|
[667] | 1354 | DO i = nxlg, nxrg |
---|
| 1355 | DO j = nysg, nyng |
---|
[407] | 1356 | IF ( nzb_s_inner(j,i) /= 0 ) THEN |
---|
[2037] | 1357 | qsws(j,i) = wall_qflux(0) & |
---|
| 1358 | * waterflux_input_conversion(nzb_s_inner(j,i)) |
---|
[407] | 1359 | ENDIF |
---|
| 1360 | ENDDO |
---|
| 1361 | ENDDO |
---|
| 1362 | ENDIF |
---|
[1] | 1363 | ENDIF |
---|
| 1364 | ENDIF |
---|
[1960] | 1365 | ! |
---|
| 1366 | !-- Initialize the near-surface scalar flux |
---|
| 1367 | IF ( passive_scalar ) THEN |
---|
| 1368 | IF ( constant_scalarflux ) THEN |
---|
| 1369 | ssws = surface_scalarflux |
---|
| 1370 | ! |
---|
| 1371 | !-- Over topography surface_scalarflux is replaced by |
---|
| 1372 | !-- wall_scalarflux(0) |
---|
| 1373 | IF ( TRIM( topography ) /= 'flat' ) THEN |
---|
| 1374 | wall_sflux = wall_scalarflux |
---|
| 1375 | DO i = nxlg, nxrg |
---|
| 1376 | DO j = nysg, nyng |
---|
| 1377 | IF ( nzb_s_inner(j,i) /= 0 ) ssws(j,i) = wall_sflux(0) |
---|
| 1378 | ENDDO |
---|
| 1379 | ENDDO |
---|
| 1380 | ENDIF |
---|
| 1381 | ENDIF |
---|
[1992] | 1382 | ENDIF |
---|
| 1383 | ! |
---|
| 1384 | !-- Initialize near-surface salinity flux |
---|
| 1385 | IF ( ocean ) saswsb = bottom_salinityflux |
---|
[1] | 1386 | |
---|
| 1387 | ENDIF |
---|
| 1388 | |
---|
| 1389 | ! |
---|
[19] | 1390 | !-- Initialize fluxes at top surface |
---|
[94] | 1391 | !-- Currently, only the heatflux and salinity flux can be prescribed. |
---|
| 1392 | !-- The latent flux is zero in this case! |
---|
[19] | 1393 | IF ( use_top_fluxes ) THEN |
---|
| 1394 | ! |
---|
[1992] | 1395 | !-- Prescribe to heat flux |
---|
[2037] | 1396 | IF ( constant_top_heatflux ) tswst = top_heatflux & |
---|
| 1397 | * heatflux_input_conversion(nzt+1) |
---|
[1992] | 1398 | ! |
---|
| 1399 | !-- Prescribe zero latent flux at the top |
---|
| 1400 | IF ( humidity ) THEN |
---|
| 1401 | qswst = 0.0_wp |
---|
| 1402 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
| 1403 | nrswst = 0.0_wp |
---|
| 1404 | qrswst = 0.0_wp |
---|
[1053] | 1405 | ENDIF |
---|
[102] | 1406 | ENDIF |
---|
| 1407 | ! |
---|
[1992] | 1408 | !-- Prescribe top scalar flux |
---|
| 1409 | IF ( passive_scalar .AND. constant_top_scalarflux ) & |
---|
| 1410 | sswst = top_scalarflux |
---|
| 1411 | ! |
---|
| 1412 | !-- Prescribe top salinity flux |
---|
| 1413 | IF ( ocean .AND. constant_top_salinityflux) & |
---|
| 1414 | saswst = top_salinityflux |
---|
| 1415 | ! |
---|
[102] | 1416 | !-- Initialization in case of a coupled model run |
---|
| 1417 | IF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
[1340] | 1418 | tswst = 0.0_wp |
---|
[102] | 1419 | ENDIF |
---|
| 1420 | |
---|
[19] | 1421 | ENDIF |
---|
| 1422 | |
---|
| 1423 | ! |
---|
[1] | 1424 | !-- Initialize Prandtl layer quantities |
---|
[1691] | 1425 | IF ( constant_flux_layer ) THEN |
---|
[1] | 1426 | |
---|
| 1427 | z0 = roughness_length |
---|
[978] | 1428 | z0h = z0h_factor * z0 |
---|
[1788] | 1429 | z0q = z0h_factor * z0 |
---|
[1] | 1430 | |
---|
| 1431 | IF ( .NOT. constant_heatflux ) THEN |
---|
| 1432 | ! |
---|
| 1433 | !-- Surface temperature is prescribed. Here the heat flux cannot be |
---|
[1691] | 1434 | !-- simply estimated, because therefore ol, u* and theta* would have |
---|
[1] | 1435 | !-- to be computed by iteration. This is why the heat flux is assumed |
---|
| 1436 | !-- to be zero before the first time step. It approaches its correct |
---|
| 1437 | !-- value in the course of the first few time steps. |
---|
[1340] | 1438 | shf = 0.0_wp |
---|
[1] | 1439 | ENDIF |
---|
| 1440 | |
---|
[1960] | 1441 | IF ( humidity ) THEN |
---|
[1788] | 1442 | IF ( .NOT. constant_waterflux ) qsws = 0.0_wp |
---|
[1822] | 1443 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1340] | 1444 | qrsws = 0.0_wp |
---|
| 1445 | nrsws = 0.0_wp |
---|
[1053] | 1446 | ENDIF |
---|
[1] | 1447 | ENDIF |
---|
[1960] | 1448 | IF ( passive_scalar .AND. .NOT. constant_scalarflux ) ssws = 0.0_wp |
---|
[1] | 1449 | |
---|
| 1450 | ENDIF |
---|
| 1451 | |
---|
[1179] | 1452 | ! |
---|
| 1453 | !-- Set the reference state to be used in the buoyancy terms (for ocean runs |
---|
| 1454 | !-- the reference state will be set (overwritten) in init_ocean) |
---|
| 1455 | IF ( use_single_reference_value ) THEN |
---|
[1788] | 1456 | IF ( .NOT. humidity ) THEN |
---|
[1179] | 1457 | ref_state(:) = pt_reference |
---|
| 1458 | ELSE |
---|
| 1459 | ref_state(:) = vpt_reference |
---|
| 1460 | ENDIF |
---|
| 1461 | ELSE |
---|
[1788] | 1462 | IF ( .NOT. humidity ) THEN |
---|
[1179] | 1463 | ref_state(:) = pt_init(:) |
---|
| 1464 | ELSE |
---|
| 1465 | ref_state(:) = vpt(:,nys,nxl) |
---|
| 1466 | ENDIF |
---|
| 1467 | ENDIF |
---|
[152] | 1468 | |
---|
| 1469 | ! |
---|
[707] | 1470 | !-- For the moment, vertical velocity is zero |
---|
[1340] | 1471 | w = 0.0_wp |
---|
[1] | 1472 | |
---|
| 1473 | ! |
---|
| 1474 | !-- Initialize array sums (must be defined in first call of pres) |
---|
[1340] | 1475 | sums = 0.0_wp |
---|
[1] | 1476 | |
---|
| 1477 | ! |
---|
[707] | 1478 | !-- In case of iterative solvers, p must get an initial value |
---|
[1575] | 1479 | IF ( psolver(1:9) == 'multigrid' .OR. psolver == 'sor' ) p = 0.0_wp |
---|
[707] | 1480 | |
---|
| 1481 | ! |
---|
[72] | 1482 | !-- Treating cloud physics, liquid water content and precipitation amount |
---|
| 1483 | !-- are zero at beginning of the simulation |
---|
| 1484 | IF ( cloud_physics ) THEN |
---|
[1340] | 1485 | ql = 0.0_wp |
---|
[1822] | 1486 | qc = 0.0_wp |
---|
| 1487 | |
---|
| 1488 | precipitation_amount = 0.0_wp |
---|
[72] | 1489 | ENDIF |
---|
[673] | 1490 | ! |
---|
[1] | 1491 | !-- Impose vortex with vertical axis on the initial velocity profile |
---|
| 1492 | IF ( INDEX( initializing_actions, 'initialize_vortex' ) /= 0 ) THEN |
---|
| 1493 | CALL init_rankine |
---|
| 1494 | ENDIF |
---|
| 1495 | |
---|
| 1496 | ! |
---|
| 1497 | !-- Impose temperature anomaly (advection test only) |
---|
| 1498 | IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 ) THEN |
---|
| 1499 | CALL init_pt_anomaly |
---|
| 1500 | ENDIF |
---|
| 1501 | |
---|
| 1502 | ! |
---|
| 1503 | !-- If required, change the surface temperature at the start of the 3D run |
---|
[1340] | 1504 | IF ( pt_surface_initial_change /= 0.0_wp ) THEN |
---|
[1] | 1505 | pt(nzb,:,:) = pt(nzb,:,:) + pt_surface_initial_change |
---|
| 1506 | ENDIF |
---|
| 1507 | |
---|
| 1508 | ! |
---|
| 1509 | !-- If required, change the surface humidity/scalar at the start of the 3D |
---|
| 1510 | !-- run |
---|
[1960] | 1511 | IF ( humidity .AND. q_surface_initial_change /= 0.0_wp ) & |
---|
[1] | 1512 | q(nzb,:,:) = q(nzb,:,:) + q_surface_initial_change |
---|
[1960] | 1513 | |
---|
| 1514 | IF ( passive_scalar .AND. s_surface_initial_change /= 0.0_wp ) & |
---|
| 1515 | s(nzb,:,:) = s(nzb,:,:) + s_surface_initial_change |
---|
| 1516 | |
---|
[1] | 1517 | |
---|
| 1518 | ! |
---|
| 1519 | !-- Initialize old and new time levels. |
---|
[1340] | 1520 | te_m = 0.0_wp; tpt_m = 0.0_wp; tu_m = 0.0_wp; tv_m = 0.0_wp; tw_m = 0.0_wp |
---|
[1] | 1521 | e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w |
---|
| 1522 | |
---|
[1960] | 1523 | IF ( humidity ) THEN |
---|
[1340] | 1524 | tq_m = 0.0_wp |
---|
[1] | 1525 | q_p = q |
---|
[1822] | 1526 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1340] | 1527 | tqr_m = 0.0_wp |
---|
[1822] | 1528 | qr_p = qr |
---|
[1340] | 1529 | tnr_m = 0.0_wp |
---|
[1822] | 1530 | nr_p = nr |
---|
[1053] | 1531 | ENDIF |
---|
[1] | 1532 | ENDIF |
---|
[1960] | 1533 | |
---|
| 1534 | IF ( passive_scalar ) THEN |
---|
| 1535 | ts_m = 0.0_wp |
---|
| 1536 | s_p = s |
---|
| 1537 | ENDIF |
---|
[1] | 1538 | |
---|
[94] | 1539 | IF ( ocean ) THEN |
---|
[1340] | 1540 | tsa_m = 0.0_wp |
---|
[94] | 1541 | sa_p = sa |
---|
| 1542 | ENDIF |
---|
[667] | 1543 | |
---|
[1402] | 1544 | CALL location_message( 'finished', .TRUE. ) |
---|
[94] | 1545 | |
---|
[1788] | 1546 | ELSEIF ( TRIM( initializing_actions ) == 'read_restart_data' .OR. & |
---|
| 1547 | TRIM( initializing_actions ) == 'cyclic_fill' ) & |
---|
[1] | 1548 | THEN |
---|
[1384] | 1549 | |
---|
[1402] | 1550 | CALL location_message( 'initializing in case of restart / cyclic_fill', & |
---|
| 1551 | .FALSE. ) |
---|
[1] | 1552 | ! |
---|
[767] | 1553 | !-- When reading data for cyclic fill of 3D prerun data files, read |
---|
| 1554 | !-- some of the global variables from the restart file which are required |
---|
| 1555 | !-- for initializing the inflow |
---|
[328] | 1556 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' ) THEN |
---|
[559] | 1557 | |
---|
[759] | 1558 | DO i = 0, io_blocks-1 |
---|
| 1559 | IF ( i == io_group ) THEN |
---|
| 1560 | CALL read_parts_of_var_list |
---|
| 1561 | CALL close_file( 13 ) |
---|
| 1562 | ENDIF |
---|
| 1563 | #if defined( __parallel ) |
---|
| 1564 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1565 | #endif |
---|
| 1566 | ENDDO |
---|
[328] | 1567 | |
---|
[767] | 1568 | ENDIF |
---|
| 1569 | |
---|
[151] | 1570 | ! |
---|
[767] | 1571 | !-- Read binary data from restart file |
---|
| 1572 | DO i = 0, io_blocks-1 |
---|
| 1573 | IF ( i == io_group ) THEN |
---|
| 1574 | CALL read_3d_binary |
---|
| 1575 | ENDIF |
---|
| 1576 | #if defined( __parallel ) |
---|
| 1577 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1578 | #endif |
---|
| 1579 | ENDDO |
---|
| 1580 | |
---|
[328] | 1581 | ! |
---|
[767] | 1582 | !-- Initialization of the turbulence recycling method |
---|
[1788] | 1583 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' .AND. & |
---|
[767] | 1584 | turbulent_inflow ) THEN |
---|
| 1585 | ! |
---|
| 1586 | !-- First store the profiles to be used at the inflow. |
---|
| 1587 | !-- These profiles are the (temporally) and horizontally averaged vertical |
---|
| 1588 | !-- profiles from the prerun. Alternatively, prescribed profiles |
---|
| 1589 | !-- for u,v-components can be used. |
---|
[1960] | 1590 | ALLOCATE( mean_inflow_profiles(nzb:nzt+1,7) ) |
---|
[151] | 1591 | |
---|
[767] | 1592 | IF ( use_prescribed_profile_data ) THEN |
---|
| 1593 | mean_inflow_profiles(:,1) = u_init ! u |
---|
| 1594 | mean_inflow_profiles(:,2) = v_init ! v |
---|
| 1595 | ELSE |
---|
[328] | 1596 | mean_inflow_profiles(:,1) = hom_sum(:,1,0) ! u |
---|
| 1597 | mean_inflow_profiles(:,2) = hom_sum(:,2,0) ! v |
---|
[767] | 1598 | ENDIF |
---|
| 1599 | mean_inflow_profiles(:,4) = hom_sum(:,4,0) ! pt |
---|
| 1600 | mean_inflow_profiles(:,5) = hom_sum(:,8,0) ! e |
---|
[1960] | 1601 | IF ( humidity ) & |
---|
| 1602 | mean_inflow_profiles(:,6) = hom_sum(:,41,0) ! q |
---|
| 1603 | IF ( passive_scalar ) & |
---|
| 1604 | mean_inflow_profiles(:,7) = hom_sum(:,115,0) ! s |
---|
[151] | 1605 | |
---|
| 1606 | ! |
---|
[767] | 1607 | !-- If necessary, adjust the horizontal flow field to the prescribed |
---|
| 1608 | !-- profiles |
---|
| 1609 | IF ( use_prescribed_profile_data ) THEN |
---|
| 1610 | DO i = nxlg, nxrg |
---|
[667] | 1611 | DO j = nysg, nyng |
---|
[328] | 1612 | DO k = nzb, nzt+1 |
---|
[767] | 1613 | u(k,j,i) = u(k,j,i) - hom_sum(k,1,0) + u_init(k) |
---|
| 1614 | v(k,j,i) = v(k,j,i) - hom_sum(k,2,0) + v_init(k) |
---|
[328] | 1615 | ENDDO |
---|
[151] | 1616 | ENDDO |
---|
[767] | 1617 | ENDDO |
---|
| 1618 | ENDIF |
---|
[151] | 1619 | |
---|
| 1620 | ! |
---|
[767] | 1621 | !-- Use these mean profiles at the inflow (provided that Dirichlet |
---|
| 1622 | !-- conditions are used) |
---|
| 1623 | IF ( inflow_l ) THEN |
---|
| 1624 | DO j = nysg, nyng |
---|
| 1625 | DO k = nzb, nzt+1 |
---|
| 1626 | u(k,j,nxlg:-1) = mean_inflow_profiles(k,1) |
---|
| 1627 | v(k,j,nxlg:-1) = mean_inflow_profiles(k,2) |
---|
[1340] | 1628 | w(k,j,nxlg:-1) = 0.0_wp |
---|
[767] | 1629 | pt(k,j,nxlg:-1) = mean_inflow_profiles(k,4) |
---|
| 1630 | e(k,j,nxlg:-1) = mean_inflow_profiles(k,5) |
---|
[1960] | 1631 | IF ( humidity ) & |
---|
[1615] | 1632 | q(k,j,nxlg:-1) = mean_inflow_profiles(k,6) |
---|
[1960] | 1633 | IF ( passive_scalar ) & |
---|
| 1634 | s(k,j,nxlg:-1) = mean_inflow_profiles(k,7) |
---|
[767] | 1635 | ENDDO |
---|
| 1636 | ENDDO |
---|
| 1637 | ENDIF |
---|
| 1638 | |
---|
[151] | 1639 | ! |
---|
[767] | 1640 | !-- Calculate the damping factors to be used at the inflow. For a |
---|
| 1641 | !-- turbulent inflow the turbulent fluctuations have to be limited |
---|
| 1642 | !-- vertically because otherwise the turbulent inflow layer will grow |
---|
| 1643 | !-- in time. |
---|
[1340] | 1644 | IF ( inflow_damping_height == 9999999.9_wp ) THEN |
---|
[767] | 1645 | ! |
---|
| 1646 | !-- Default: use the inversion height calculated by the prerun; if |
---|
| 1647 | !-- this is zero, inflow_damping_height must be explicitly |
---|
| 1648 | !-- specified. |
---|
[1340] | 1649 | IF ( hom_sum(nzb+6,pr_palm,0) /= 0.0_wp ) THEN |
---|
[767] | 1650 | inflow_damping_height = hom_sum(nzb+6,pr_palm,0) |
---|
| 1651 | ELSE |
---|
[1788] | 1652 | WRITE( message_string, * ) 'inflow_damping_height must be ', & |
---|
| 1653 | 'explicitly specified because&the inversion height ', & |
---|
[767] | 1654 | 'calculated by the prerun is zero.' |
---|
| 1655 | CALL message( 'init_3d_model', 'PA0318', 1, 2, 0, 6, 0 ) |
---|
[292] | 1656 | ENDIF |
---|
[151] | 1657 | |
---|
[767] | 1658 | ENDIF |
---|
| 1659 | |
---|
[1340] | 1660 | IF ( inflow_damping_width == 9999999.9_wp ) THEN |
---|
[151] | 1661 | ! |
---|
[767] | 1662 | !-- Default for the transition range: one tenth of the undamped |
---|
| 1663 | !-- layer |
---|
[1340] | 1664 | inflow_damping_width = 0.1_wp * inflow_damping_height |
---|
[151] | 1665 | |
---|
[767] | 1666 | ENDIF |
---|
[151] | 1667 | |
---|
[767] | 1668 | ALLOCATE( inflow_damping_factor(nzb:nzt+1) ) |
---|
[151] | 1669 | |
---|
[767] | 1670 | DO k = nzb, nzt+1 |
---|
[151] | 1671 | |
---|
[767] | 1672 | IF ( zu(k) <= inflow_damping_height ) THEN |
---|
[1340] | 1673 | inflow_damping_factor(k) = 1.0_wp |
---|
[996] | 1674 | ELSEIF ( zu(k) <= ( inflow_damping_height + inflow_damping_width ) ) THEN |
---|
[1340] | 1675 | inflow_damping_factor(k) = 1.0_wp - & |
---|
[996] | 1676 | ( zu(k) - inflow_damping_height ) / & |
---|
| 1677 | inflow_damping_width |
---|
[767] | 1678 | ELSE |
---|
[1340] | 1679 | inflow_damping_factor(k) = 0.0_wp |
---|
[767] | 1680 | ENDIF |
---|
[151] | 1681 | |
---|
[767] | 1682 | ENDDO |
---|
[151] | 1683 | |
---|
[147] | 1684 | ENDIF |
---|
| 1685 | |
---|
[152] | 1686 | ! |
---|
[359] | 1687 | !-- Inside buildings set velocities and TKE back to zero |
---|
[1788] | 1688 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' .AND. & |
---|
[359] | 1689 | topography /= 'flat' ) THEN |
---|
| 1690 | ! |
---|
| 1691 | !-- Inside buildings set velocities and TKE back to zero. |
---|
| 1692 | !-- Other scalars (pt, q, s, km, kh, p, sa, ...) are ignored at present, |
---|
| 1693 | !-- maybe revise later. |
---|
[1001] | 1694 | DO i = nxlg, nxrg |
---|
| 1695 | DO j = nysg, nyng |
---|
[1340] | 1696 | u (nzb:nzb_u_inner(j,i),j,i) = 0.0_wp |
---|
| 1697 | v (nzb:nzb_v_inner(j,i),j,i) = 0.0_wp |
---|
| 1698 | w (nzb:nzb_w_inner(j,i),j,i) = 0.0_wp |
---|
| 1699 | e (nzb:nzb_w_inner(j,i),j,i) = 0.0_wp |
---|
| 1700 | tu_m(nzb:nzb_u_inner(j,i),j,i) = 0.0_wp |
---|
| 1701 | tv_m(nzb:nzb_v_inner(j,i),j,i) = 0.0_wp |
---|
| 1702 | tw_m(nzb:nzb_w_inner(j,i),j,i) = 0.0_wp |
---|
| 1703 | te_m(nzb:nzb_w_inner(j,i),j,i) = 0.0_wp |
---|
| 1704 | tpt_m(nzb:nzb_w_inner(j,i),j,i) = 0.0_wp |
---|
[359] | 1705 | ENDDO |
---|
[1001] | 1706 | ENDDO |
---|
[359] | 1707 | |
---|
| 1708 | ENDIF |
---|
| 1709 | |
---|
| 1710 | ! |
---|
[1] | 1711 | !-- Calculate initial temperature field and other constants used in case |
---|
| 1712 | !-- of a sloping surface |
---|
| 1713 | IF ( sloping_surface ) CALL init_slope |
---|
| 1714 | |
---|
| 1715 | ! |
---|
| 1716 | !-- Initialize new time levels (only done in order to set boundary values |
---|
| 1717 | !-- including ghost points) |
---|
| 1718 | e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w |
---|
[1960] | 1719 | IF ( humidity ) THEN |
---|
[1053] | 1720 | q_p = q |
---|
[1822] | 1721 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1053] | 1722 | qr_p = qr |
---|
| 1723 | nr_p = nr |
---|
| 1724 | ENDIF |
---|
| 1725 | ENDIF |
---|
[1960] | 1726 | IF ( passive_scalar ) s_p = s |
---|
| 1727 | IF ( ocean ) sa_p = sa |
---|
[1] | 1728 | |
---|
[181] | 1729 | ! |
---|
| 1730 | !-- Allthough tendency arrays are set in prognostic_equations, they have |
---|
| 1731 | !-- have to be predefined here because they are used (but multiplied with 0) |
---|
| 1732 | !-- there before they are set. |
---|
[1340] | 1733 | te_m = 0.0_wp; tpt_m = 0.0_wp; tu_m = 0.0_wp; tv_m = 0.0_wp; tw_m = 0.0_wp |
---|
[1960] | 1734 | IF ( humidity ) THEN |
---|
[1340] | 1735 | tq_m = 0.0_wp |
---|
[1822] | 1736 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1340] | 1737 | tqr_m = 0.0_wp |
---|
| 1738 | tnr_m = 0.0_wp |
---|
[1053] | 1739 | ENDIF |
---|
| 1740 | ENDIF |
---|
[1960] | 1741 | IF ( passive_scalar ) ts_m = 0.0_wp |
---|
| 1742 | IF ( ocean ) tsa_m = 0.0_wp |
---|
[181] | 1743 | |
---|
[1402] | 1744 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1745 | |
---|
[1] | 1746 | ELSE |
---|
| 1747 | ! |
---|
| 1748 | !-- Actually this part of the programm should not be reached |
---|
[254] | 1749 | message_string = 'unknown initializing problem' |
---|
| 1750 | CALL message( 'init_3d_model', 'PA0193', 1, 2, 0, 6, 0 ) |
---|
[1] | 1751 | ENDIF |
---|
| 1752 | |
---|
[151] | 1753 | |
---|
| 1754 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
[1] | 1755 | ! |
---|
[151] | 1756 | !-- Initialize old timelevels needed for radiation boundary conditions |
---|
| 1757 | IF ( outflow_l ) THEN |
---|
| 1758 | u_m_l(:,:,:) = u(:,:,1:2) |
---|
| 1759 | v_m_l(:,:,:) = v(:,:,0:1) |
---|
| 1760 | w_m_l(:,:,:) = w(:,:,0:1) |
---|
| 1761 | ENDIF |
---|
| 1762 | IF ( outflow_r ) THEN |
---|
| 1763 | u_m_r(:,:,:) = u(:,:,nx-1:nx) |
---|
| 1764 | v_m_r(:,:,:) = v(:,:,nx-1:nx) |
---|
| 1765 | w_m_r(:,:,:) = w(:,:,nx-1:nx) |
---|
| 1766 | ENDIF |
---|
| 1767 | IF ( outflow_s ) THEN |
---|
| 1768 | u_m_s(:,:,:) = u(:,0:1,:) |
---|
| 1769 | v_m_s(:,:,:) = v(:,1:2,:) |
---|
| 1770 | w_m_s(:,:,:) = w(:,0:1,:) |
---|
| 1771 | ENDIF |
---|
| 1772 | IF ( outflow_n ) THEN |
---|
| 1773 | u_m_n(:,:,:) = u(:,ny-1:ny,:) |
---|
| 1774 | v_m_n(:,:,:) = v(:,ny-1:ny,:) |
---|
| 1775 | w_m_n(:,:,:) = w(:,ny-1:ny,:) |
---|
| 1776 | ENDIF |
---|
[667] | 1777 | |
---|
[151] | 1778 | ENDIF |
---|
[680] | 1779 | |
---|
[667] | 1780 | ! |
---|
| 1781 | !-- Calculate the initial volume flow at the right and north boundary |
---|
[709] | 1782 | IF ( conserve_volume_flow ) THEN |
---|
[151] | 1783 | |
---|
[767] | 1784 | IF ( use_prescribed_profile_data ) THEN |
---|
[667] | 1785 | |
---|
[1340] | 1786 | volume_flow_initial_l = 0.0_wp |
---|
| 1787 | volume_flow_area_l = 0.0_wp |
---|
[732] | 1788 | |
---|
[667] | 1789 | IF ( nxr == nx ) THEN |
---|
| 1790 | DO j = nys, nyn |
---|
[1845] | 1791 | DO k = nzb_u_inner(j,nx)+1, nzt |
---|
[1788] | 1792 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
[767] | 1793 | u_init(k) * dzw(k) |
---|
| 1794 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzw(k) |
---|
| 1795 | ENDDO |
---|
| 1796 | ENDDO |
---|
| 1797 | ENDIF |
---|
| 1798 | |
---|
| 1799 | IF ( nyn == ny ) THEN |
---|
| 1800 | DO i = nxl, nxr |
---|
[1845] | 1801 | DO k = nzb_v_inner(ny,i)+1, nzt |
---|
[767] | 1802 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
| 1803 | v_init(k) * dzw(k) |
---|
| 1804 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzw(k) |
---|
| 1805 | ENDDO |
---|
| 1806 | ENDDO |
---|
| 1807 | ENDIF |
---|
| 1808 | |
---|
| 1809 | #if defined( __parallel ) |
---|
| 1810 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 1811 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1812 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 1813 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1814 | |
---|
| 1815 | #else |
---|
| 1816 | volume_flow_initial = volume_flow_initial_l |
---|
| 1817 | volume_flow_area = volume_flow_area_l |
---|
| 1818 | #endif |
---|
| 1819 | |
---|
| 1820 | ELSEIF ( TRIM( initializing_actions ) == 'cyclic_fill' ) THEN |
---|
| 1821 | |
---|
[1340] | 1822 | volume_flow_initial_l = 0.0_wp |
---|
| 1823 | volume_flow_area_l = 0.0_wp |
---|
[767] | 1824 | |
---|
| 1825 | IF ( nxr == nx ) THEN |
---|
| 1826 | DO j = nys, nyn |
---|
[1845] | 1827 | DO k = nzb_u_inner(j,nx)+1, nzt |
---|
[1788] | 1828 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
[667] | 1829 | hom_sum(k,1,0) * dzw(k) |
---|
| 1830 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzw(k) |
---|
| 1831 | ENDDO |
---|
| 1832 | ENDDO |
---|
| 1833 | ENDIF |
---|
| 1834 | |
---|
| 1835 | IF ( nyn == ny ) THEN |
---|
| 1836 | DO i = nxl, nxr |
---|
[1845] | 1837 | DO k = nzb_v_inner(ny,i)+1, nzt |
---|
[1788] | 1838 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
[709] | 1839 | hom_sum(k,2,0) * dzw(k) |
---|
[667] | 1840 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzw(k) |
---|
| 1841 | ENDDO |
---|
| 1842 | ENDDO |
---|
| 1843 | ENDIF |
---|
| 1844 | |
---|
[732] | 1845 | #if defined( __parallel ) |
---|
| 1846 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 1847 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1848 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 1849 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1850 | |
---|
| 1851 | #else |
---|
| 1852 | volume_flow_initial = volume_flow_initial_l |
---|
| 1853 | volume_flow_area = volume_flow_area_l |
---|
| 1854 | #endif |
---|
| 1855 | |
---|
[667] | 1856 | ELSEIF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
| 1857 | |
---|
[1340] | 1858 | volume_flow_initial_l = 0.0_wp |
---|
| 1859 | volume_flow_area_l = 0.0_wp |
---|
[732] | 1860 | |
---|
[667] | 1861 | IF ( nxr == nx ) THEN |
---|
| 1862 | DO j = nys, nyn |
---|
[1845] | 1863 | DO k = nzb_u_inner(j,nx)+1, nzt |
---|
[667] | 1864 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
[709] | 1865 | u(k,j,nx) * dzw(k) |
---|
[667] | 1866 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzw(k) |
---|
| 1867 | ENDDO |
---|
| 1868 | ENDDO |
---|
| 1869 | ENDIF |
---|
| 1870 | |
---|
| 1871 | IF ( nyn == ny ) THEN |
---|
| 1872 | DO i = nxl, nxr |
---|
[1845] | 1873 | DO k = nzb_v_inner(ny,i)+1, nzt |
---|
[1788] | 1874 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
[667] | 1875 | v(k,ny,i) * dzw(k) |
---|
| 1876 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzw(k) |
---|
| 1877 | ENDDO |
---|
| 1878 | ENDDO |
---|
| 1879 | ENDIF |
---|
| 1880 | |
---|
| 1881 | #if defined( __parallel ) |
---|
[732] | 1882 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 1883 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1884 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 1885 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
[667] | 1886 | |
---|
| 1887 | #else |
---|
[732] | 1888 | volume_flow_initial = volume_flow_initial_l |
---|
| 1889 | volume_flow_area = volume_flow_area_l |
---|
[667] | 1890 | #endif |
---|
| 1891 | |
---|
[732] | 1892 | ENDIF |
---|
| 1893 | |
---|
[151] | 1894 | ! |
---|
[709] | 1895 | !-- In case of 'bulk_velocity' mode, volume_flow_initial is calculated |
---|
| 1896 | !-- from u|v_bulk instead |
---|
[680] | 1897 | IF ( TRIM( conserve_volume_flow_mode ) == 'bulk_velocity' ) THEN |
---|
| 1898 | volume_flow_initial(1) = u_bulk * volume_flow_area(1) |
---|
| 1899 | volume_flow_initial(2) = v_bulk * volume_flow_area(2) |
---|
| 1900 | ENDIF |
---|
[667] | 1901 | |
---|
[680] | 1902 | ENDIF |
---|
| 1903 | |
---|
[787] | 1904 | ! |
---|
| 1905 | !-- Initialize quantities for special advections schemes |
---|
| 1906 | CALL init_advec |
---|
[680] | 1907 | |
---|
[667] | 1908 | ! |
---|
[680] | 1909 | !-- Impose random perturbation on the horizontal velocity field and then |
---|
| 1910 | !-- remove the divergences from the velocity field at the initial stage |
---|
[1788] | 1911 | IF ( create_disturbances .AND. disturbance_energy_limit /= 0.0_wp .AND. & |
---|
| 1912 | TRIM( initializing_actions ) /= 'read_restart_data' .AND. & |
---|
[680] | 1913 | TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN |
---|
| 1914 | |
---|
[1402] | 1915 | CALL location_message( 'creating initial disturbances', .FALSE. ) |
---|
[680] | 1916 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
| 1917 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
[1402] | 1918 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1919 | |
---|
[1402] | 1920 | CALL location_message( 'calling pressure solver', .FALSE. ) |
---|
[680] | 1921 | n_sor = nsor_ini |
---|
[1221] | 1922 | !$acc data copyin( d, ddzu, ddzw, nzb_s_inner, nzb_u_inner ) & |
---|
| 1923 | !$acc copyin( nzb_v_inner, nzb_w_inner, p, rflags_s_inner, tend ) & |
---|
| 1924 | !$acc copyin( weight_pres, weight_substep ) & |
---|
| 1925 | !$acc copy( tri, tric, u, v, w ) |
---|
[680] | 1926 | CALL pres |
---|
[1111] | 1927 | !$acc end data |
---|
[680] | 1928 | n_sor = nsor |
---|
[1402] | 1929 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1930 | |
---|
[680] | 1931 | ENDIF |
---|
| 1932 | |
---|
| 1933 | ! |
---|
[1484] | 1934 | !-- If required, initialize quantities needed for the plant canopy model |
---|
[2007] | 1935 | IF ( plant_canopy ) THEN |
---|
| 1936 | CALL location_message( 'initializing plant canopy model', .FALSE. ) |
---|
| 1937 | CALL pcm_init |
---|
| 1938 | CALL location_message( 'finished', .TRUE. ) |
---|
| 1939 | ENDIF |
---|
[138] | 1940 | |
---|
| 1941 | ! |
---|
[1] | 1942 | !-- If required, initialize dvrp-software |
---|
[1340] | 1943 | IF ( dt_dvrp /= 9999999.9_wp ) CALL init_dvrp |
---|
[1] | 1944 | |
---|
[96] | 1945 | IF ( ocean ) THEN |
---|
[1] | 1946 | ! |
---|
[96] | 1947 | !-- Initialize quantities needed for the ocean model |
---|
| 1948 | CALL init_ocean |
---|
[388] | 1949 | |
---|
[96] | 1950 | ELSE |
---|
| 1951 | ! |
---|
| 1952 | !-- Initialize quantities for handling cloud physics |
---|
[849] | 1953 | !-- This routine must be called before lpm_init, because |
---|
[96] | 1954 | !-- otherwise, array pt_d_t, needed in data_output_dvrp (called by |
---|
[849] | 1955 | !-- lpm_init) is not defined. |
---|
[96] | 1956 | CALL init_cloud_physics |
---|
[1849] | 1957 | ! |
---|
| 1958 | !-- Initialize bulk cloud microphysics |
---|
| 1959 | CALL microphysics_init |
---|
[96] | 1960 | ENDIF |
---|
[1] | 1961 | |
---|
| 1962 | ! |
---|
| 1963 | !-- If required, initialize particles |
---|
[849] | 1964 | IF ( particle_advection ) CALL lpm_init |
---|
[1] | 1965 | |
---|
[1585] | 1966 | ! |
---|
| 1967 | !-- If required, initialize quantities needed for the LSM |
---|
| 1968 | IF ( land_surface ) THEN |
---|
| 1969 | CALL location_message( 'initializing land surface model', .FALSE. ) |
---|
[1817] | 1970 | CALL lsm_init |
---|
[1585] | 1971 | CALL location_message( 'finished', .TRUE. ) |
---|
| 1972 | ENDIF |
---|
[1496] | 1973 | |
---|
[1] | 1974 | ! |
---|
[1691] | 1975 | !-- Initialize surface layer (done after LSM as roughness length are required |
---|
| 1976 | !-- for initialization |
---|
| 1977 | IF ( constant_flux_layer ) THEN |
---|
| 1978 | CALL location_message( 'initializing surface layer', .FALSE. ) |
---|
| 1979 | CALL init_surface_layer_fluxes |
---|
| 1980 | CALL location_message( 'finished', .TRUE. ) |
---|
| 1981 | ENDIF |
---|
| 1982 | |
---|
| 1983 | ! |
---|
[1496] | 1984 | !-- If required, initialize radiation model |
---|
| 1985 | IF ( radiation ) THEN |
---|
[1585] | 1986 | CALL location_message( 'initializing radiation model', .FALSE. ) |
---|
[1826] | 1987 | CALL radiation_init |
---|
[1585] | 1988 | CALL location_message( 'finished', .TRUE. ) |
---|
[1496] | 1989 | ENDIF |
---|
[2007] | 1990 | |
---|
[1914] | 1991 | ! |
---|
[2007] | 1992 | !-- If required, initialize urban surface model |
---|
| 1993 | IF ( urban_surface ) THEN |
---|
| 1994 | CALL location_message( 'initializing urban surface model', .FALSE. ) |
---|
| 1995 | CALL usm_init_urban_surface |
---|
| 1996 | CALL location_message( 'finished', .TRUE. ) |
---|
| 1997 | ENDIF |
---|
| 1998 | |
---|
| 1999 | ! |
---|
[1914] | 2000 | !-- If required, initialize quantities needed for the wind turbine model |
---|
| 2001 | IF ( wind_turbine ) THEN |
---|
| 2002 | CALL location_message( 'initializing wind turbine model', .FALSE. ) |
---|
| 2003 | CALL wtm_init |
---|
| 2004 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2005 | ENDIF |
---|
[1496] | 2006 | |
---|
[1914] | 2007 | |
---|
[1496] | 2008 | ! |
---|
[673] | 2009 | !-- Initialize the ws-scheme. |
---|
| 2010 | IF ( ws_scheme_sca .OR. ws_scheme_mom ) CALL ws_init |
---|
[1] | 2011 | |
---|
| 2012 | ! |
---|
[709] | 2013 | !-- Setting weighting factors for calculation of perturbation pressure |
---|
[1762] | 2014 | !-- and turbulent quantities from the RK substeps |
---|
[709] | 2015 | IF ( TRIM(timestep_scheme) == 'runge-kutta-3' ) THEN ! for RK3-method |
---|
| 2016 | |
---|
[1322] | 2017 | weight_substep(1) = 1._wp/6._wp |
---|
| 2018 | weight_substep(2) = 3._wp/10._wp |
---|
| 2019 | weight_substep(3) = 8._wp/15._wp |
---|
[709] | 2020 | |
---|
[1322] | 2021 | weight_pres(1) = 1._wp/3._wp |
---|
| 2022 | weight_pres(2) = 5._wp/12._wp |
---|
| 2023 | weight_pres(3) = 1._wp/4._wp |
---|
[709] | 2024 | |
---|
| 2025 | ELSEIF ( TRIM(timestep_scheme) == 'runge-kutta-2' ) THEN ! for RK2-method |
---|
| 2026 | |
---|
[1322] | 2027 | weight_substep(1) = 1._wp/2._wp |
---|
| 2028 | weight_substep(2) = 1._wp/2._wp |
---|
[673] | 2029 | |
---|
[1322] | 2030 | weight_pres(1) = 1._wp/2._wp |
---|
| 2031 | weight_pres(2) = 1._wp/2._wp |
---|
[709] | 2032 | |
---|
[1001] | 2033 | ELSE ! for Euler-method |
---|
[709] | 2034 | |
---|
[1340] | 2035 | weight_substep(1) = 1.0_wp |
---|
| 2036 | weight_pres(1) = 1.0_wp |
---|
[709] | 2037 | |
---|
[673] | 2038 | ENDIF |
---|
| 2039 | |
---|
| 2040 | ! |
---|
[1] | 2041 | !-- Initialize Rayleigh damping factors |
---|
[1340] | 2042 | rdf = 0.0_wp |
---|
| 2043 | rdf_sc = 0.0_wp |
---|
| 2044 | IF ( rayleigh_damping_factor /= 0.0_wp ) THEN |
---|
[1788] | 2045 | IF ( .NOT. ocean ) THEN |
---|
[108] | 2046 | DO k = nzb+1, nzt |
---|
| 2047 | IF ( zu(k) >= rayleigh_damping_height ) THEN |
---|
[1788] | 2048 | rdf(k) = rayleigh_damping_factor * & |
---|
[1340] | 2049 | ( SIN( pi * 0.5_wp * ( zu(k) - rayleigh_damping_height ) & |
---|
[1788] | 2050 | / ( zu(nzt) - rayleigh_damping_height ) ) & |
---|
[1] | 2051 | )**2 |
---|
[108] | 2052 | ENDIF |
---|
| 2053 | ENDDO |
---|
| 2054 | ELSE |
---|
| 2055 | DO k = nzt, nzb+1, -1 |
---|
| 2056 | IF ( zu(k) <= rayleigh_damping_height ) THEN |
---|
[1788] | 2057 | rdf(k) = rayleigh_damping_factor * & |
---|
[1340] | 2058 | ( SIN( pi * 0.5_wp * ( rayleigh_damping_height - zu(k) ) & |
---|
[1788] | 2059 | / ( rayleigh_damping_height - zu(nzb+1) ) ) & |
---|
[108] | 2060 | )**2 |
---|
| 2061 | ENDIF |
---|
| 2062 | ENDDO |
---|
| 2063 | ENDIF |
---|
[1] | 2064 | ENDIF |
---|
[785] | 2065 | IF ( scalar_rayleigh_damping ) rdf_sc = rdf |
---|
[1] | 2066 | |
---|
| 2067 | ! |
---|
[240] | 2068 | !-- Initialize the starting level and the vertical smoothing factor used for |
---|
| 2069 | !-- the external pressure gradient |
---|
[1340] | 2070 | dp_smooth_factor = 1.0_wp |
---|
[240] | 2071 | IF ( dp_external ) THEN |
---|
| 2072 | ! |
---|
| 2073 | !-- Set the starting level dp_level_ind_b only if it has not been set before |
---|
| 2074 | !-- (e.g. in init_grid). |
---|
| 2075 | IF ( dp_level_ind_b == 0 ) THEN |
---|
| 2076 | ind_array = MINLOC( ABS( dp_level_b - zu ) ) |
---|
| 2077 | dp_level_ind_b = ind_array(1) - 1 + nzb |
---|
| 2078 | ! MINLOC uses lower array bound 1 |
---|
| 2079 | ENDIF |
---|
| 2080 | IF ( dp_smooth ) THEN |
---|
[1340] | 2081 | dp_smooth_factor(:dp_level_ind_b) = 0.0_wp |
---|
[240] | 2082 | DO k = dp_level_ind_b+1, nzt |
---|
[1340] | 2083 | dp_smooth_factor(k) = 0.5_wp * ( 1.0_wp + SIN( pi * & |
---|
| 2084 | ( REAL( k - dp_level_ind_b, KIND=wp ) / & |
---|
| 2085 | REAL( nzt - dp_level_ind_b, KIND=wp ) - 0.5_wp ) ) ) |
---|
[240] | 2086 | ENDDO |
---|
| 2087 | ENDIF |
---|
| 2088 | ENDIF |
---|
| 2089 | |
---|
| 2090 | ! |
---|
[978] | 2091 | !-- Initialize damping zone for the potential temperature in case of |
---|
| 2092 | !-- non-cyclic lateral boundaries. The damping zone has the maximum value |
---|
| 2093 | !-- at the inflow boundary and decreases to zero at pt_damping_width. |
---|
[1340] | 2094 | ptdf_x = 0.0_wp |
---|
| 2095 | ptdf_y = 0.0_wp |
---|
[1159] | 2096 | IF ( bc_lr_dirrad ) THEN |
---|
[996] | 2097 | DO i = nxl, nxr |
---|
[978] | 2098 | IF ( ( i * dx ) < pt_damping_width ) THEN |
---|
[1340] | 2099 | ptdf_x(i) = pt_damping_factor * ( SIN( pi * 0.5_wp * & |
---|
| 2100 | REAL( pt_damping_width - i * dx, KIND=wp ) / ( & |
---|
[1788] | 2101 | REAL( pt_damping_width, KIND=wp ) ) ) )**2 |
---|
[73] | 2102 | ENDIF |
---|
| 2103 | ENDDO |
---|
[1159] | 2104 | ELSEIF ( bc_lr_raddir ) THEN |
---|
[996] | 2105 | DO i = nxl, nxr |
---|
[978] | 2106 | IF ( ( i * dx ) > ( nx * dx - pt_damping_width ) ) THEN |
---|
[1322] | 2107 | ptdf_x(i) = pt_damping_factor * & |
---|
[1340] | 2108 | SIN( pi * 0.5_wp * & |
---|
| 2109 | ( ( i - nx ) * dx + pt_damping_width ) / & |
---|
| 2110 | REAL( pt_damping_width, KIND=wp ) )**2 |
---|
[73] | 2111 | ENDIF |
---|
[978] | 2112 | ENDDO |
---|
[1159] | 2113 | ELSEIF ( bc_ns_dirrad ) THEN |
---|
[996] | 2114 | DO j = nys, nyn |
---|
[978] | 2115 | IF ( ( j * dy ) > ( ny * dy - pt_damping_width ) ) THEN |
---|
[1322] | 2116 | ptdf_y(j) = pt_damping_factor * & |
---|
[1340] | 2117 | SIN( pi * 0.5_wp * & |
---|
| 2118 | ( ( j - ny ) * dy + pt_damping_width ) / & |
---|
| 2119 | REAL( pt_damping_width, KIND=wp ) )**2 |
---|
[1] | 2120 | ENDIF |
---|
[978] | 2121 | ENDDO |
---|
[1159] | 2122 | ELSEIF ( bc_ns_raddir ) THEN |
---|
[996] | 2123 | DO j = nys, nyn |
---|
[978] | 2124 | IF ( ( j * dy ) < pt_damping_width ) THEN |
---|
[1322] | 2125 | ptdf_y(j) = pt_damping_factor * & |
---|
[1340] | 2126 | SIN( pi * 0.5_wp * & |
---|
| 2127 | ( pt_damping_width - j * dy ) / & |
---|
| 2128 | REAL( pt_damping_width, KIND=wp ) )**2 |
---|
[1] | 2129 | ENDIF |
---|
[73] | 2130 | ENDDO |
---|
[1] | 2131 | ENDIF |
---|
| 2132 | |
---|
| 2133 | ! |
---|
| 2134 | !-- Pre-set masks for regional statistics. Default is the total model domain. |
---|
[1015] | 2135 | !-- Ghost points are excluded because counting values at the ghost boundaries |
---|
| 2136 | !-- would bias the statistics |
---|
[1340] | 2137 | rmask = 1.0_wp |
---|
| 2138 | rmask(:,nxlg:nxl-1,:) = 0.0_wp; rmask(:,nxr+1:nxrg,:) = 0.0_wp |
---|
| 2139 | rmask(nysg:nys-1,:,:) = 0.0_wp; rmask(nyn+1:nyng,:,:) = 0.0_wp |
---|
[1] | 2140 | |
---|
| 2141 | ! |
---|
[51] | 2142 | !-- User-defined initializing actions. Check afterwards, if maximum number |
---|
[709] | 2143 | !-- of allowed timeseries is exceeded |
---|
[1] | 2144 | CALL user_init |
---|
| 2145 | |
---|
[51] | 2146 | IF ( dots_num > dots_max ) THEN |
---|
[1788] | 2147 | WRITE( message_string, * ) 'number of time series quantities exceeds', & |
---|
| 2148 | ' its maximum of dots_max = ', dots_max, & |
---|
[254] | 2149 | ' &Please increase dots_max in modules.f90.' |
---|
| 2150 | CALL message( 'init_3d_model', 'PA0194', 1, 2, 0, 6, 0 ) |
---|
[51] | 2151 | ENDIF |
---|
| 2152 | |
---|
[1] | 2153 | ! |
---|
| 2154 | !-- Input binary data file is not needed anymore. This line must be placed |
---|
| 2155 | !-- after call of user_init! |
---|
| 2156 | CALL close_file( 13 ) |
---|
| 2157 | |
---|
| 2158 | ! |
---|
| 2159 | !-- Compute total sum of active mask grid points |
---|
[1738] | 2160 | !-- and the mean surface level height for each statistic region |
---|
[1] | 2161 | !-- ngp_2dh: number of grid points of a horizontal cross section through the |
---|
| 2162 | !-- total domain |
---|
| 2163 | !-- ngp_3d: number of grid points of the total domain |
---|
[132] | 2164 | ngp_2dh_outer_l = 0 |
---|
| 2165 | ngp_2dh_outer = 0 |
---|
| 2166 | ngp_2dh_s_inner_l = 0 |
---|
| 2167 | ngp_2dh_s_inner = 0 |
---|
| 2168 | ngp_2dh_l = 0 |
---|
| 2169 | ngp_2dh = 0 |
---|
[1340] | 2170 | ngp_3d_inner_l = 0.0_wp |
---|
[132] | 2171 | ngp_3d_inner = 0 |
---|
| 2172 | ngp_3d = 0 |
---|
| 2173 | ngp_sums = ( nz + 2 ) * ( pr_palm + max_pr_user ) |
---|
[1] | 2174 | |
---|
[1738] | 2175 | mean_surface_level_height = 0.0_wp |
---|
| 2176 | mean_surface_level_height_l = 0.0_wp |
---|
| 2177 | |
---|
[1] | 2178 | DO sr = 0, statistic_regions |
---|
| 2179 | DO i = nxl, nxr |
---|
| 2180 | DO j = nys, nyn |
---|
[1340] | 2181 | IF ( rmask(j,i,sr) == 1.0_wp ) THEN |
---|
[1] | 2182 | ! |
---|
| 2183 | !-- All xy-grid points |
---|
| 2184 | ngp_2dh_l(sr) = ngp_2dh_l(sr) + 1 |
---|
[1788] | 2185 | mean_surface_level_height_l(sr) = mean_surface_level_height_l(sr) & |
---|
| 2186 | + zw(nzb_s_inner(j,i)) |
---|
[1] | 2187 | ! |
---|
| 2188 | !-- xy-grid points above topography |
---|
| 2189 | DO k = nzb_s_outer(j,i), nz + 1 |
---|
| 2190 | ngp_2dh_outer_l(k,sr) = ngp_2dh_outer_l(k,sr) + 1 |
---|
| 2191 | ENDDO |
---|
[132] | 2192 | DO k = nzb_s_inner(j,i), nz + 1 |
---|
| 2193 | ngp_2dh_s_inner_l(k,sr) = ngp_2dh_s_inner_l(k,sr) + 1 |
---|
| 2194 | ENDDO |
---|
[1] | 2195 | ! |
---|
| 2196 | !-- All grid points of the total domain above topography |
---|
[1788] | 2197 | ngp_3d_inner_l(sr) = ngp_3d_inner_l(sr) & |
---|
| 2198 | + ( nz - nzb_s_inner(j,i) + 2 ) |
---|
[1] | 2199 | ENDIF |
---|
| 2200 | ENDDO |
---|
| 2201 | ENDDO |
---|
| 2202 | ENDDO |
---|
| 2203 | |
---|
| 2204 | sr = statistic_regions + 1 |
---|
| 2205 | #if defined( __parallel ) |
---|
[622] | 2206 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1788] | 2207 | CALL MPI_ALLREDUCE( ngp_2dh_l(0), ngp_2dh(0), sr, MPI_INTEGER, MPI_SUM, & |
---|
[1] | 2208 | comm2d, ierr ) |
---|
[622] | 2209 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1788] | 2210 | CALL MPI_ALLREDUCE( ngp_2dh_outer_l(0,0), ngp_2dh_outer(0,0), (nz+2)*sr, & |
---|
[1] | 2211 | MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
[622] | 2212 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1788] | 2213 | CALL MPI_ALLREDUCE( ngp_2dh_s_inner_l(0,0), ngp_2dh_s_inner(0,0), & |
---|
[132] | 2214 | (nz+2)*sr, MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
[622] | 2215 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1788] | 2216 | CALL MPI_ALLREDUCE( ngp_3d_inner_l(0), ngp_3d_inner_tmp(0), sr, MPI_REAL, & |
---|
[1] | 2217 | MPI_SUM, comm2d, ierr ) |
---|
[485] | 2218 | ngp_3d_inner = INT( ngp_3d_inner_tmp, KIND = SELECTED_INT_KIND( 18 ) ) |
---|
[1738] | 2219 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1788] | 2220 | CALL MPI_ALLREDUCE( mean_surface_level_height_l(0), & |
---|
| 2221 | mean_surface_level_height(0), sr, MPI_REAL, & |
---|
[1738] | 2222 | MPI_SUM, comm2d, ierr ) |
---|
| 2223 | mean_surface_level_height = mean_surface_level_height / REAL( ngp_2dh ) |
---|
[1] | 2224 | #else |
---|
[132] | 2225 | ngp_2dh = ngp_2dh_l |
---|
| 2226 | ngp_2dh_outer = ngp_2dh_outer_l |
---|
| 2227 | ngp_2dh_s_inner = ngp_2dh_s_inner_l |
---|
[485] | 2228 | ngp_3d_inner = INT( ngp_3d_inner_l, KIND = SELECTED_INT_KIND( 18 ) ) |
---|
[1738] | 2229 | mean_surface_level_height = mean_surface_level_height_l / REAL( ngp_2dh_l ) |
---|
[1] | 2230 | #endif |
---|
| 2231 | |
---|
[560] | 2232 | ngp_3d = INT ( ngp_2dh, KIND = SELECTED_INT_KIND( 18 ) ) * & |
---|
| 2233 | INT ( (nz + 2 ), KIND = SELECTED_INT_KIND( 18 ) ) |
---|
[1] | 2234 | |
---|
| 2235 | ! |
---|
| 2236 | !-- Set a lower limit of 1 in order to avoid zero divisions in flow_statistics, |
---|
| 2237 | !-- buoyancy, etc. A zero value will occur for cases where all grid points of |
---|
| 2238 | !-- the respective subdomain lie below the surface topography |
---|
[667] | 2239 | ngp_2dh_outer = MAX( 1, ngp_2dh_outer(:,:) ) |
---|
[1788] | 2240 | ngp_3d_inner = MAX( INT(1, KIND = SELECTED_INT_KIND( 18 )), & |
---|
[631] | 2241 | ngp_3d_inner(:) ) |
---|
[667] | 2242 | ngp_2dh_s_inner = MAX( 1, ngp_2dh_s_inner(:,:) ) |
---|
[1] | 2243 | |
---|
[1788] | 2244 | DEALLOCATE( mean_surface_level_height_l, ngp_2dh_l, ngp_2dh_outer_l, & |
---|
[1738] | 2245 | ngp_3d_inner_l, ngp_3d_inner_tmp ) |
---|
[1] | 2246 | |
---|
[1402] | 2247 | CALL location_message( 'leaving init_3d_model', .TRUE. ) |
---|
[1] | 2248 | |
---|
| 2249 | END SUBROUTINE init_3d_model |
---|