[1682] | 1 | !> @file init_3d_model.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 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 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[254] | 20 | ! Current revisions: |
---|
[732] | 21 | ! ------------------ |
---|
[2233] | 22 | ! |
---|
[3473] | 23 | ! |
---|
[2233] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: init_3d_model.f90 3473 2018-10-30 20:50:15Z suehring $ |
---|
[3473] | 27 | ! Add virtual measurement module |
---|
| 28 | ! |
---|
| 29 | ! 3472 2018-10-30 20:43:50Z suehring |
---|
[3469] | 30 | ! Add indoor model (kanani, srissman, tlang) |
---|
| 31 | ! |
---|
| 32 | ! 3467 2018-10-30 19:05:21Z suehring |
---|
[3467] | 33 | ! Implementation of a new aerosol module salsa. |
---|
| 34 | ! |
---|
| 35 | ! 3458 2018-10-30 14:51:23Z kanani |
---|
[3458] | 36 | ! from chemistry branch r3443, basit: |
---|
| 37 | ! bug fixed in sums and sums_l for chemistry profile output |
---|
| 38 | ! |
---|
| 39 | ! 3448 2018-10-29 18:14:31Z kanani |
---|
[3448] | 40 | ! Add biometeorology |
---|
| 41 | ! |
---|
| 42 | ! 3421 2018-10-24 18:39:32Z gronemeier |
---|
[3421] | 43 | ! Initialize surface data output |
---|
| 44 | ! |
---|
| 45 | ! 3415 2018-10-24 11:57:50Z suehring |
---|
[3404] | 46 | ! Set bottom boundary condition for geostrophic wind components in inifor |
---|
| 47 | ! initialization |
---|
| 48 | ! |
---|
| 49 | ! 3347 2018-10-15 14:21:08Z suehring |
---|
[3347] | 50 | ! - Separate offline nesting from large_scale_nudging_mod |
---|
| 51 | ! - Improve the synthetic turbulence generator |
---|
| 52 | ! |
---|
| 53 | ! 3298 2018-10-02 12:21:11Z kanani |
---|
| 54 | ! Minor formatting (kanani) |
---|
| 55 | ! Added CALL to the chem_emissions module (Russo) |
---|
| 56 | ! |
---|
| 57 | ! 3294 2018-10-01 02:37:10Z raasch |
---|
[3302] | 58 | ! allocate and set stokes drift velocity profiles |
---|
| 59 | ! |
---|
| 60 | ! 3298 2018-10-02 12:21:11Z kanani |
---|
[3298] | 61 | ! Minor formatting (kanani) |
---|
| 62 | ! Added CALL to the chem_emissions module (Russo) |
---|
| 63 | ! |
---|
| 64 | ! 3294 2018-10-01 02:37:10Z raasch |
---|
[3294] | 65 | ! changes concerning modularization of ocean option |
---|
| 66 | ! |
---|
| 67 | ! 3289 2018-09-28 10:23:58Z suehring |
---|
[3289] | 68 | ! Introduce module parameter for number of inflow profiles |
---|
| 69 | ! |
---|
| 70 | ! 3288 2018-09-28 10:23:08Z suehring |
---|
[3274] | 71 | ! Modularization of all bulk cloud physics code components |
---|
| 72 | ! |
---|
| 73 | ! 3241 2018-09-12 15:02:00Z raasch |
---|
[3241] | 74 | ! unused variables removed |
---|
| 75 | ! |
---|
| 76 | ! 3234 2018-09-07 13:46:58Z schwenkel |
---|
[3234] | 77 | ! The increase of dots_num in case of radiation or land surface model must |
---|
| 78 | ! be done before user_init is called |
---|
| 79 | ! |
---|
| 80 | ! 3183 2018-07-27 14:25:55Z suehring |
---|
[3183] | 81 | ! Revise Inifor initialization |
---|
| 82 | ! |
---|
| 83 | ! 3182 2018-07-27 13:36:03Z suehring |
---|
[3159] | 84 | ! Added multi agent system |
---|
| 85 | ! |
---|
| 86 | ! 3129 2018-07-16 07:45:13Z gronemeier |
---|
[3051] | 87 | ! Move initialization call for nudging and 1D/3D offline nesting. |
---|
| 88 | ! Revise initialization with inifor data. |
---|
| 89 | ! |
---|
| 90 | ! 3045 2018-05-28 07:55:41Z Giersch |
---|
[3045] | 91 | ! Error messages revised |
---|
| 92 | ! |
---|
[3049] | 93 | ! 3045 2018-05-28 07:55:41Z Giersch |
---|
| 94 | ! Error messages revised |
---|
| 95 | ! |
---|
[3045] | 96 | ! 3042 2018-05-25 10:44:37Z schwenkel |
---|
[3042] | 97 | ! Changed the name specific humidity to mixing ratio |
---|
| 98 | ! |
---|
| 99 | ! 3040 2018-05-25 10:22:08Z schwenkel |
---|
[3035] | 100 | ! Add option to initialize warm air bubble close to surface |
---|
| 101 | ! |
---|
| 102 | ! 3014 2018-05-09 08:42:38Z maronga |
---|
[3014] | 103 | ! Bugfix: initialization of ts_value missing |
---|
| 104 | ! |
---|
| 105 | ! 3011 2018-05-07 14:38:42Z schwenkel |
---|
[3011] | 106 | ! removed redundant if statement |
---|
| 107 | ! |
---|
| 108 | ! 3004 2018-04-27 12:33:25Z Giersch |
---|
[3004] | 109 | ! precipitation_rate removed |
---|
| 110 | ! |
---|
| 111 | ! 2995 2018-04-19 12:13:16Z Giersch |
---|
[2995] | 112 | ! CALL radiation_control is not necessary during initialization because |
---|
| 113 | ! calculation of radiative fluxes at model start is done in radiation_init |
---|
| 114 | ! in any case |
---|
| 115 | ! |
---|
| 116 | ! 2977 2018-04-17 10:27:57Z kanani |
---|
[2977] | 117 | ! Implement changes from branch radiation (r2948-2971) with minor modifications |
---|
| 118 | ! (moh.hefny): |
---|
| 119 | ! - set radiation_interactions according to the existence of urban/land vertical |
---|
| 120 | ! surfaces and trees to activiate RTM |
---|
| 121 | ! - set average_radiation to TRUE if RTM is activiated |
---|
| 122 | ! |
---|
| 123 | ! 2938 2018-03-27 15:52:42Z suehring |
---|
[2938] | 124 | ! - Revise Inifor initialization for geostrophic wind components |
---|
| 125 | ! - Initialize synthetic turbulence generator in case of Inifor initialization |
---|
| 126 | ! |
---|
| 127 | ! 2936 2018-03-27 14:49:27Z suehring |
---|
[2934] | 128 | ! Synchronize parent and child models after initialization. |
---|
| 129 | ! Remove obsolete masking of topography grid points for Runge-Kutta weighted |
---|
| 130 | ! tendency arrays. |
---|
| 131 | ! |
---|
| 132 | ! 2920 2018-03-22 11:22:01Z kanani |
---|
[2920] | 133 | ! Add call for precalculating apparent solar positions (moh.hefny) |
---|
| 134 | ! |
---|
| 135 | ! 2906 2018-03-19 08:56:40Z Giersch |
---|
[2906] | 136 | ! The variables read/write_svf_on_init have been removed. Instead ENVIRONMENT |
---|
| 137 | ! variables read/write_svf have been introduced. Location_message has been |
---|
| 138 | ! added. |
---|
| 139 | ! |
---|
| 140 | ! 2894 2018-03-15 09:17:58Z Giersch |
---|
[2894] | 141 | ! Renamed routines with respect to reading restart data, file 13 is closed in |
---|
| 142 | ! rrd_read_parts_of_global now |
---|
| 143 | ! |
---|
| 144 | ! 2867 2018-03-09 09:40:23Z suehring |
---|
[2867] | 145 | ! Further bugfix concerning call of user_init. |
---|
| 146 | ! |
---|
| 147 | ! 2864 2018-03-08 11:57:45Z suehring |
---|
[2864] | 148 | ! Bugfix, move call of user_init in front of initialization of grid-point |
---|
| 149 | ! arrays |
---|
| 150 | ! |
---|
| 151 | ! 2817 2018-02-19 16:32:21Z knoop |
---|
[2817] | 152 | ! Preliminary gust module interface implemented |
---|
| 153 | ! |
---|
| 154 | ! 2776 2018-01-31 10:44:42Z Giersch |
---|
[2776] | 155 | ! Variable use_synthetic_turbulence_generator has been abbreviated |
---|
| 156 | ! |
---|
| 157 | ! 2766 2018-01-22 17:17:47Z kanani |
---|
[2766] | 158 | ! Removed preprocessor directive __chem |
---|
| 159 | ! |
---|
| 160 | ! 2758 2018-01-17 12:55:21Z suehring |
---|
[2758] | 161 | ! In case of spinup of land- and urban-surface model, do not mask wind velocity |
---|
| 162 | ! at first computational grid level |
---|
| 163 | ! |
---|
| 164 | ! 2746 2018-01-15 12:06:04Z suehring |
---|
[2746] | 165 | ! Move flag plant canopy to modules |
---|
| 166 | ! |
---|
| 167 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 168 | ! Corrected "Former revisions" section |
---|
| 169 | ! |
---|
| 170 | ! 2705 2017-12-18 11:26:23Z maronga |
---|
[2705] | 171 | ! Bugfix for reading initial profiles from ls/nuding file |
---|
[2716] | 172 | ! |
---|
| 173 | ! 2701 2017-12-15 15:40:50Z suehring |
---|
| 174 | ! Changes from last commit documented |
---|
[2705] | 175 | ! |
---|
[2716] | 176 | ! 2700 2017-12-15 14:12:35Z suehring |
---|
[2701] | 177 | ! Bugfix, missing initialization of surface attributes in case of |
---|
| 178 | ! inifor-initialization branch |
---|
[2716] | 179 | ! |
---|
| 180 | ! 2698 2017-12-14 18:46:24Z suehring |
---|
| 181 | ! Bugfix in get_topography_top_index |
---|
| 182 | ! |
---|
| 183 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 184 | ! Change in file header (GPL part) |
---|
[2696] | 185 | ! Implementation of uv exposure model (FK) |
---|
| 186 | ! Moved initialisation of diss, e, kh, km to turbulence_closure_mod (TG) |
---|
| 187 | ! Added chemical emissions (FK) |
---|
| 188 | ! Initialize masking arrays and number-of-grid-points arrays before initialize |
---|
| 189 | ! LSM, USM and radiation module |
---|
| 190 | ! Initialization with inifor (MS) |
---|
| 191 | ! |
---|
| 192 | ! 2618 2017-11-16 15:37:30Z suehring |
---|
[2618] | 193 | ! Reorder calls of init_surfaces. |
---|
| 194 | ! |
---|
| 195 | ! 2564 2017-10-19 15:56:56Z Giersch |
---|
[2564] | 196 | ! Variable wind_turbine was added to control_parameters. |
---|
| 197 | ! |
---|
| 198 | ! 2550 2017-10-16 17:12:01Z boeske |
---|
[2550] | 199 | ! Modifications to cyclic fill method and turbulence recycling method in case of |
---|
| 200 | ! complex terrain simulations |
---|
| 201 | ! |
---|
| 202 | ! 2513 2017-10-04 09:24:39Z kanani |
---|
[2513] | 203 | ! Bugfix in storing initial scalar profile (wrong index) |
---|
| 204 | ! |
---|
| 205 | ! 2350 2017-08-15 11:48:26Z kanani |
---|
[2350] | 206 | ! Bugfix in nopointer version |
---|
| 207 | ! |
---|
| 208 | ! 2339 2017-08-07 13:55:26Z gronemeier |
---|
[2339] | 209 | ! corrected timestamp in header |
---|
| 210 | ! |
---|
| 211 | ! 2338 2017-08-07 12:15:38Z gronemeier |
---|
[2338] | 212 | ! Modularize 1D model |
---|
| 213 | ! |
---|
[2339] | 214 | ! 2329 2017-08-03 14:24:56Z knoop |
---|
[2329] | 215 | ! Removed temporary bugfix (r2327) as bug is properly resolved by this revision |
---|
| 216 | ! |
---|
| 217 | ! 2327 2017-08-02 07:40:57Z maronga |
---|
[2327] | 218 | ! Temporary bugfix |
---|
| 219 | ! |
---|
| 220 | ! 2320 2017-07-21 12:47:43Z suehring |
---|
[2320] | 221 | ! Modularize large-scale forcing and nudging |
---|
| 222 | ! |
---|
| 223 | ! 2292 2017-06-20 09:51:42Z schwenkel |
---|
[2292] | 224 | ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' |
---|
| 225 | ! includes two more prognostic equations for cloud drop concentration (nc) |
---|
| 226 | ! and cloud water content (qc). |
---|
| 227 | ! |
---|
| 228 | ! 2277 2017-06-12 10:47:51Z kanani |
---|
[2277] | 229 | ! Removed unused variable sums_up_fraction_l |
---|
| 230 | ! |
---|
| 231 | ! 2270 2017-06-09 12:18:47Z maronga |
---|
[2270] | 232 | ! dots_num must be increased when LSM and/or radiation is used |
---|
| 233 | ! |
---|
| 234 | ! 2259 2017-06-08 09:09:11Z gronemeier |
---|
[2259] | 235 | ! Implemented synthetic turbulence generator |
---|
| 236 | ! |
---|
| 237 | ! 2252 2017-06-07 09:35:37Z knoop |
---|
[2252] | 238 | ! rho_air now depending on surface_pressure even in Boussinesq mode |
---|
| 239 | ! |
---|
| 240 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[2233] | 241 | ! |
---|
| 242 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
[2232] | 243 | ! Adjustments to new topography and surface concept: |
---|
| 244 | ! - Modify passed parameters for disturb_field |
---|
| 245 | ! - Topography representation via flags |
---|
| 246 | ! - Remove unused arrays. |
---|
| 247 | ! - Move initialization of surface-related quantities to surface_mod |
---|
[1961] | 248 | ! |
---|
[2173] | 249 | ! 2172 2017-03-08 15:55:25Z knoop |
---|
| 250 | ! Bugfix: moved parallel random generator initialization into its module |
---|
| 251 | ! |
---|
[2119] | 252 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
| 253 | ! OpenACC directives removed |
---|
| 254 | ! |
---|
[2038] | 255 | ! 2037 2016-10-26 11:15:40Z knoop |
---|
| 256 | ! Anelastic approximation implemented |
---|
| 257 | ! |
---|
[2032] | 258 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
| 259 | ! renamed variable rho to rho_ocean |
---|
| 260 | ! |
---|
[2012] | 261 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
| 262 | ! Flag urban_surface is now defined in module control_parameters. |
---|
| 263 | ! |
---|
[2008] | 264 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
| 265 | ! Added support for urban surface model, |
---|
| 266 | ! adjusted location_message in case of plant_canopy |
---|
| 267 | ! |
---|
[2001] | 268 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 269 | ! Forced header and separation lines into 80 columns |
---|
| 270 | ! |
---|
[1993] | 271 | ! 1992 2016-08-12 15:14:59Z suehring |
---|
| 272 | ! Initializaton of scalarflux at model top |
---|
| 273 | ! Bugfixes in initialization of surface and top salinity flux, top scalar and |
---|
| 274 | ! humidity fluxes |
---|
| 275 | ! |
---|
[1961] | 276 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
[1960] | 277 | ! Separate humidity and passive scalar |
---|
| 278 | ! Increase dimension for mean_inflow_profiles |
---|
| 279 | ! Remove inadvertent write-statement |
---|
| 280 | ! Bugfix, large-scale forcing is still not implemented for passive scalars |
---|
[1919] | 281 | ! |
---|
[1958] | 282 | ! 1957 2016-07-07 10:43:48Z suehring |
---|
| 283 | ! flight module added |
---|
| 284 | ! |
---|
[1921] | 285 | ! 1920 2016-05-30 10:50:15Z suehring |
---|
| 286 | ! Initialize us with very small number to avoid segmentation fault during |
---|
| 287 | ! calculation of Obukhov length |
---|
| 288 | ! |
---|
[1919] | 289 | ! 1918 2016-05-27 14:35:57Z raasch |
---|
| 290 | ! intermediate_timestep_count is set 0 instead 1 for first call of pres, |
---|
| 291 | ! bugfix: initialization of local sum arrays are moved to the beginning of the |
---|
| 292 | ! routine because otherwise results from pres are overwritten |
---|
| 293 | ! |
---|
[1917] | 294 | ! 1914 2016-05-26 14:44:07Z witha |
---|
| 295 | ! Added initialization of the wind turbine model |
---|
| 296 | ! |
---|
[1879] | 297 | ! 1878 2016-04-19 12:30:36Z hellstea |
---|
| 298 | ! The zeroth element of weight_pres removed as unnecessary |
---|
| 299 | ! |
---|
[1851] | 300 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
[1849] | 301 | ! Adapted for modularization of microphysics. |
---|
| 302 | ! precipitation_amount, precipitation_rate, prr moved to arrays_3d. |
---|
[1852] | 303 | ! Initialization of nc_1d, nr_1d, pt_1d, qc_1d, qr_1d, q_1d moved to |
---|
[3274] | 304 | ! bcm_init. |
---|
[1849] | 305 | ! |
---|
[1846] | 306 | ! 1845 2016-04-08 08:29:13Z raasch |
---|
| 307 | ! nzb_2d replaced by nzb_u|v_inner |
---|
[1914] | 308 | ! |
---|
[1834] | 309 | ! 1833 2016-04-07 14:23:03Z raasch |
---|
| 310 | ! initialization of spectra quantities moved to spectra_mod |
---|
| 311 | ! |
---|
[1832] | 312 | ! 1831 2016-04-07 13:15:51Z hoffmann |
---|
| 313 | ! turbulence renamed collision_turbulence |
---|
| 314 | ! |
---|
[1827] | 315 | ! 1826 2016-04-07 12:01:39Z maronga |
---|
| 316 | ! Renamed radiation calls. |
---|
| 317 | ! Renamed canopy model calls. |
---|
| 318 | ! |
---|
[1823] | 319 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
| 320 | ! icloud_scheme replaced by microphysics_* |
---|
[1914] | 321 | ! |
---|
[1818] | 322 | ! 1817 2016-04-06 15:44:20Z maronga |
---|
| 323 | ! Renamed lsm calls. |
---|
| 324 | ! |
---|
[1816] | 325 | ! 1815 2016-04-06 13:49:59Z raasch |
---|
| 326 | ! zero-settings for velocities inside topography re-activated (was deactivated |
---|
| 327 | ! in r1762) |
---|
| 328 | ! |
---|
[1789] | 329 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
| 330 | ! Added z0q. |
---|
| 331 | ! Syntax layout improved. |
---|
| 332 | ! |
---|
[1784] | 333 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 334 | ! netcdf module name changed + related changes |
---|
| 335 | ! |
---|
[1765] | 336 | ! 1764 2016-02-28 12:45:19Z raasch |
---|
| 337 | ! bugfix: increase size of volume_flow_area_l and volume_flow_initial_l by 1 |
---|
| 338 | ! |
---|
[1763] | 339 | ! 1762 2016-02-25 12:31:13Z hellstea |
---|
| 340 | ! Introduction of nested domain feature |
---|
| 341 | ! |
---|
[1739] | 342 | ! 1738 2015-12-18 13:56:05Z raasch |
---|
| 343 | ! calculate mean surface level height for each statistic region |
---|
| 344 | ! |
---|
[1735] | 345 | ! 1734 2015-12-02 12:17:12Z raasch |
---|
| 346 | ! no initial disturbances in case that the disturbance energy limit has been |
---|
| 347 | ! set zero |
---|
| 348 | ! |
---|
[1708] | 349 | ! 1707 2015-11-02 15:24:52Z maronga |
---|
| 350 | ! Bugfix: transfer of Richardson number from 1D model to Obukhov length caused |
---|
| 351 | ! devision by zero in neutral stratification |
---|
| 352 | ! |
---|
[1692] | 353 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 354 | ! Call to init_surface_layer added. rif is replaced by ol and zeta. |
---|
| 355 | ! |
---|
[1683] | 356 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 357 | ! Code annotations made doxygen readable |
---|
| 358 | ! |
---|
[1616] | 359 | ! 1615 2015-07-08 18:49:19Z suehring |
---|
| 360 | ! Enable turbulent inflow for passive_scalar and humidity |
---|
| 361 | ! |
---|
[1586] | 362 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
| 363 | ! Initialization of radiation code is now done after LSM initializtion |
---|
| 364 | ! |
---|
[1576] | 365 | ! 1575 2015-03-27 09:56:27Z raasch |
---|
| 366 | ! adjustments for psolver-queries |
---|
| 367 | ! |
---|
[1552] | 368 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
[1817] | 369 | ! Allocation of land surface arrays is now done in the subroutine lsm_init_arrays, |
---|
[1552] | 370 | ! which is part of land_surface_model. |
---|
| 371 | ! |
---|
[1508] | 372 | ! 1507 2014-12-10 12:14:18Z suehring |
---|
| 373 | ! Bugfix: set horizontal velocity components to zero inside topography |
---|
| 374 | ! |
---|
[1497] | 375 | ! 1496 2014-12-02 17:25:50Z maronga |
---|
| 376 | ! Added initialization of the land surface and radiation schemes |
---|
| 377 | ! |
---|
[1485] | 378 | ! 1484 2014-10-21 10:53:05Z kanani |
---|
[1484] | 379 | ! Changes due to new module structure of the plant canopy model: |
---|
[1508] | 380 | ! canopy-related initialization (e.g. lad and canopy_heat_flux) moved to new |
---|
| 381 | ! subroutine init_plant_canopy within the module plant_canopy_model_mod, |
---|
| 382 | ! call of subroutine init_plant_canopy added. |
---|
[1341] | 383 | ! |
---|
[1432] | 384 | ! 1431 2014-07-15 14:47:17Z suehring |
---|
| 385 | ! var_d added, in order to normalize spectra. |
---|
| 386 | ! |
---|
[1430] | 387 | ! 1429 2014-07-15 12:53:45Z knoop |
---|
| 388 | ! Ensemble run capability added to parallel random number generator |
---|
| 389 | ! |
---|
[1412] | 390 | ! 1411 2014-05-16 18:01:51Z suehring |
---|
| 391 | ! Initial horizontal velocity profiles were not set to zero at the first vertical |
---|
| 392 | ! grid level in case of non-cyclic lateral boundary conditions. |
---|
| 393 | ! |
---|
[1407] | 394 | ! 1406 2014-05-16 13:47:01Z raasch |
---|
| 395 | ! bugfix: setting of initial velocities at k=1 to zero not in case of a |
---|
| 396 | ! no-slip boundary condition for uv |
---|
| 397 | ! |
---|
[1403] | 398 | ! 1402 2014-05-09 14:25:13Z raasch |
---|
| 399 | ! location messages modified |
---|
| 400 | ! |
---|
[1401] | 401 | ! 1400 2014-05-09 14:03:54Z knoop |
---|
| 402 | ! Parallel random number generator added |
---|
| 403 | ! |
---|
[1385] | 404 | ! 1384 2014-05-02 14:31:06Z raasch |
---|
| 405 | ! location messages added |
---|
| 406 | ! |
---|
[1362] | 407 | ! 1361 2014-04-16 15:17:48Z hoffmann |
---|
| 408 | ! tend_* removed |
---|
| 409 | ! Bugfix: w_subs is not allocated anymore if it is already allocated |
---|
| 410 | ! |
---|
[1360] | 411 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 412 | ! module lpm_init_mod added to use statements, because lpm_init has become a |
---|
| 413 | ! module |
---|
| 414 | ! |
---|
[1354] | 415 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 416 | ! REAL constants provided with KIND-attribute |
---|
| 417 | ! |
---|
[1341] | 418 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 419 | ! REAL constants defined as wp-kind |
---|
| 420 | ! |
---|
[1323] | 421 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 422 | ! REAL constants defined as wp-kind |
---|
| 423 | ! module interfaces removed |
---|
| 424 | ! |
---|
[1321] | 425 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
| 426 | ! ONLY-attribute added to USE-statements, |
---|
| 427 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 428 | ! kinds are defined in new module kinds, |
---|
| 429 | ! revision history before 2012 removed, |
---|
| 430 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 431 | ! all variable declaration statements |
---|
| 432 | ! |
---|
[1317] | 433 | ! 1316 2014-03-17 07:44:59Z heinze |
---|
| 434 | ! Bugfix: allocation of w_subs |
---|
| 435 | ! |
---|
[1300] | 436 | ! 1299 2014-03-06 13:15:21Z heinze |
---|
| 437 | ! Allocate w_subs due to extension of large scale subsidence in combination |
---|
| 438 | ! with large scale forcing data (LSF_DATA) |
---|
| 439 | ! |
---|
[1242] | 440 | ! 1241 2013-10-30 11:36:58Z heinze |
---|
| 441 | ! Overwrite initial profiles in case of nudging |
---|
| 442 | ! Inititialize shf and qsws in case of large_scale_forcing |
---|
| 443 | ! |
---|
[1222] | 444 | ! 1221 2013-09-10 08:59:13Z raasch |
---|
| 445 | ! +rflags_s_inner in copyin statement, use copyin for most arrays instead of |
---|
| 446 | ! copy |
---|
| 447 | ! |
---|
[1213] | 448 | ! 1212 2013-08-15 08:46:27Z raasch |
---|
| 449 | ! array tri is allocated and included in data copy statement |
---|
| 450 | ! |
---|
[1196] | 451 | ! 1195 2013-07-01 12:27:57Z heinze |
---|
| 452 | ! Bugfix: move allocation of ref_state to parin.f90 and read_var_list.f90 |
---|
| 453 | ! |
---|
[1182] | 454 | ! 1179 2013-06-14 05:57:58Z raasch |
---|
| 455 | ! allocate and set ref_state to be used in buoyancy terms |
---|
| 456 | ! |
---|
[1172] | 457 | ! 1171 2013-05-30 11:27:45Z raasch |
---|
| 458 | ! diss array is allocated with full size if accelerator boards are used |
---|
| 459 | ! |
---|
[1160] | 460 | ! 1159 2013-05-21 11:58:22Z fricke |
---|
| 461 | ! -bc_lr_dirneu, bc_lr_neudir, bc_ns_dirneu, bc_ns_neudir |
---|
| 462 | ! |
---|
[1154] | 463 | ! 1153 2013-05-10 14:33:08Z raasch |
---|
| 464 | ! diss array is allocated with dummy elements even if it is not needed |
---|
[1171] | 465 | ! (required by PGI 13.4 / CUDA 5.0) |
---|
[1154] | 466 | ! |
---|
[1116] | 467 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 468 | ! unused variables removed |
---|
| 469 | ! |
---|
[1114] | 470 | ! 1113 2013-03-10 02:48:14Z raasch |
---|
| 471 | ! openACC directive modified |
---|
| 472 | ! |
---|
[1112] | 473 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
| 474 | ! openACC directives added for pres |
---|
| 475 | ! array diss allocated only if required |
---|
| 476 | ! |
---|
[1093] | 477 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 478 | ! unused variables removed |
---|
| 479 | ! |
---|
[1066] | 480 | ! 1065 2012-11-22 17:42:36Z hoffmann |
---|
| 481 | ! allocation of diss (dissipation rate) in case of turbulence = .TRUE. added |
---|
| 482 | ! |
---|
[1054] | 483 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
[1053] | 484 | ! allocation and initialisation of necessary data arrays for the two-moment |
---|
| 485 | ! cloud physics scheme the two new prognostic equations (nr, qr): |
---|
| 486 | ! +dr, lambda_r, mu_r, sed_*, xr, *s, *sws, *swst, *, *_p, t*_m, *_1, *_2, *_3, |
---|
| 487 | ! +tend_*, prr |
---|
[979] | 488 | ! |
---|
[1037] | 489 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 490 | ! code put under GPL (PALM 3.9) |
---|
| 491 | ! |
---|
[1033] | 492 | ! 1032 2012-10-21 13:03:21Z letzel |
---|
| 493 | ! save memory by not allocating pt_2 in case of neutral = .T. |
---|
| 494 | ! |
---|
[1026] | 495 | ! 1025 2012-10-07 16:04:41Z letzel |
---|
| 496 | ! bugfix: swap indices of mask for ghost boundaries |
---|
| 497 | ! |
---|
[1017] | 498 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 499 | ! mask is set to zero for ghost boundaries |
---|
| 500 | ! |
---|
[1011] | 501 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
| 502 | ! cpp switch __nopointer added for pointer free version |
---|
| 503 | ! |
---|
[1004] | 504 | ! 1003 2012-09-14 14:35:53Z raasch |
---|
| 505 | ! nxra,nyna, nzta replaced ny nxr, nyn, nzt |
---|
| 506 | ! |
---|
[1002] | 507 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
| 508 | ! all actions concerning leapfrog scheme removed |
---|
| 509 | ! |
---|
[997] | 510 | ! 996 2012-09-07 10:41:47Z raasch |
---|
| 511 | ! little reformatting |
---|
| 512 | ! |
---|
[979] | 513 | ! 978 2012-08-09 08:28:32Z fricke |
---|
[978] | 514 | ! outflow damping layer removed |
---|
| 515 | ! roughness length for scalar quantites z0h added |
---|
| 516 | ! damping zone for the potential temperatur in case of non-cyclic lateral |
---|
| 517 | ! boundaries added |
---|
| 518 | ! initialization of ptdf_x, ptdf_y |
---|
| 519 | ! initialization of c_u_m, c_u_m_l, c_v_m, c_v_m_l, c_w_m, c_w_m_l |
---|
[708] | 520 | ! |
---|
[850] | 521 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 522 | ! init_particles renamed lpm_init |
---|
| 523 | ! |
---|
[826] | 524 | ! 825 2012-02-19 03:03:44Z raasch |
---|
| 525 | ! wang_collision_kernel renamed wang_kernel |
---|
| 526 | ! |
---|
[1] | 527 | ! Revision 1.1 1998/03/09 16:22:22 raasch |
---|
| 528 | ! Initial revision |
---|
| 529 | ! |
---|
| 530 | ! |
---|
| 531 | ! Description: |
---|
| 532 | ! ------------ |
---|
[1682] | 533 | !> Allocation of arrays and initialization of the 3D model via |
---|
| 534 | !> a) pre-run the 1D model |
---|
| 535 | !> or |
---|
| 536 | !> b) pre-set constant linear profiles |
---|
| 537 | !> or |
---|
| 538 | !> c) read values of a previous run |
---|
[1] | 539 | !------------------------------------------------------------------------------! |
---|
[1682] | 540 | SUBROUTINE init_3d_model |
---|
[1] | 541 | |
---|
[3298] | 542 | |
---|
[667] | 543 | USE advec_ws |
---|
[1320] | 544 | |
---|
[1] | 545 | USE arrays_3d |
---|
[1849] | 546 | |
---|
[3274] | 547 | USE basic_constants_and_equations_mod, & |
---|
| 548 | ONLY: c_p, g, l_v, pi, r_d, exner_function, exner_function_invers, & |
---|
| 549 | ideal_gas_law_rho, ideal_gas_law_rho_pt, barometric_formula |
---|
| 550 | |
---|
[3448] | 551 | USE biometeorology_mod, & |
---|
| 552 | ONLY: biom_init, biom_init_arrays |
---|
| 553 | |
---|
[3274] | 554 | USE bulk_cloud_model_mod, & |
---|
| 555 | ONLY: bulk_cloud_model, bcm_init, bcm_init_arrays |
---|
| 556 | |
---|
[3298] | 557 | USE chem_emissions_mod, & |
---|
| 558 | ONLY: chem_emissions_init |
---|
[2696] | 559 | |
---|
[3298] | 560 | USE chem_modules, & |
---|
| 561 | ONLY: do_emis, max_pr_cs, nspec_out |
---|
| 562 | |
---|
[1] | 563 | USE control_parameters |
---|
[3298] | 564 | |
---|
[1957] | 565 | USE flight_mod, & |
---|
| 566 | ONLY: flight_init |
---|
[3298] | 567 | |
---|
[1320] | 568 | USE grid_variables, & |
---|
[2037] | 569 | ONLY: dx, dy, ddx2_mg, ddy2_mg |
---|
[2817] | 570 | |
---|
| 571 | USE gust_mod, & |
---|
| 572 | ONLY: gust_init, gust_init_arrays, gust_module_enabled |
---|
[3448] | 573 | |
---|
[1] | 574 | USE indices |
---|
[3469] | 575 | |
---|
| 576 | USE indoor_model_mod, & |
---|
| 577 | ONLY: im_init |
---|
| 578 | |
---|
[1320] | 579 | USE kinds |
---|
[1496] | 580 | |
---|
| 581 | USE land_surface_model_mod, & |
---|
[2232] | 582 | ONLY: lsm_init, lsm_init_arrays |
---|
[3159] | 583 | |
---|
| 584 | USE lpm_init_mod, & |
---|
| 585 | ONLY: lpm_init |
---|
[1496] | 586 | |
---|
[2320] | 587 | USE lsf_nudging_mod, & |
---|
[2696] | 588 | ONLY: lsf_init, ls_forcing_surf, nudge_init |
---|
[1849] | 589 | |
---|
[2338] | 590 | USE model_1d_mod, & |
---|
[3241] | 591 | ONLY: init_1d_model, l1d, u1d, v1d |
---|
[2338] | 592 | |
---|
[3159] | 593 | USE multi_agent_system_mod, & |
---|
| 594 | ONLY: agents_active, mas_init |
---|
| 595 | |
---|
[1783] | 596 | USE netcdf_interface, & |
---|
[2817] | 597 | ONLY: dots_max, dots_num, dots_unit, dots_label |
---|
[2696] | 598 | |
---|
[2906] | 599 | USE netcdf_data_input_mod, & |
---|
[3298] | 600 | ONLY: chem_emis, chem_emis_att, init_3d, & |
---|
| 601 | netcdf_data_input_init_3d, netcdf_data_input_interpolate |
---|
[3448] | 602 | |
---|
[3347] | 603 | USE nesting_offl_mod, & |
---|
| 604 | ONLY: nesting_offl_init |
---|
[3294] | 605 | |
---|
| 606 | USE ocean_mod, & |
---|
| 607 | ONLY: ocean_init, ocean_init_arrays |
---|
[3298] | 608 | |
---|
[1320] | 609 | USE particle_attributes, & |
---|
[3241] | 610 | ONLY: particle_advection |
---|
[3298] | 611 | |
---|
[1] | 612 | USE pegrid |
---|
[3298] | 613 | |
---|
[1484] | 614 | USE plant_canopy_model_mod, & |
---|
[2746] | 615 | ONLY: pcm_init |
---|
[1496] | 616 | |
---|
[2934] | 617 | USE pmc_interface, & |
---|
| 618 | ONLY: nested_run |
---|
| 619 | |
---|
[1496] | 620 | USE radiation_model_mod, & |
---|
[2977] | 621 | ONLY: average_radiation, & |
---|
[2995] | 622 | radiation_init, radiation, radiation_scheme, & |
---|
[2906] | 623 | radiation_calc_svf, radiation_write_svf, & |
---|
[2696] | 624 | radiation_interaction, radiation_interactions, & |
---|
[2920] | 625 | radiation_interaction_init, radiation_read_svf, & |
---|
[2977] | 626 | radiation_presimulate_solar_pos, radiation_interactions_on |
---|
[1484] | 627 | |
---|
[1320] | 628 | USE random_function_mod |
---|
| 629 | |
---|
[1400] | 630 | USE random_generator_parallel, & |
---|
[2172] | 631 | ONLY: init_parallel_random_generator |
---|
[3467] | 632 | |
---|
[2894] | 633 | USE read_restart_data_mod, & |
---|
[3467] | 634 | ONLY: rrd_read_parts_of_global, rrd_local |
---|
| 635 | |
---|
| 636 | USE salsa_mod, & |
---|
| 637 | ONLY: salsa, salsa_init, salsa_init_arrays |
---|
[1400] | 638 | |
---|
[1320] | 639 | USE statistics, & |
---|
[1738] | 640 | ONLY: hom, hom_sum, mean_surface_level_height, pr_palm, rmask, & |
---|
[1833] | 641 | statistic_regions, sums, sums_divnew_l, sums_divold_l, sums_l, & |
---|
[2277] | 642 | sums_l_l, sums_wsts_bc_l, ts_value, & |
---|
[1833] | 643 | weight_pres, weight_substep |
---|
[2259] | 644 | |
---|
| 645 | USE synthetic_turbulence_generator_mod, & |
---|
[3347] | 646 | ONLY: parametrize_inflow_turbulence, stg_adjust, stg_init, & |
---|
| 647 | use_syn_turb_gen |
---|
| 648 | |
---|
[1691] | 649 | USE surface_layer_fluxes_mod, & |
---|
| 650 | ONLY: init_surface_layer_fluxes |
---|
[2232] | 651 | |
---|
| 652 | USE surface_mod, & |
---|
| 653 | ONLY : init_surface_arrays, init_surfaces, surf_def_h, surf_lsm_h, & |
---|
[2977] | 654 | surf_usm_h, get_topography_top_index_ji, vertical_surfaces_exist |
---|
[3448] | 655 | |
---|
[3421] | 656 | USE surface_output_mod, & |
---|
| 657 | ONLY: surface_output_init |
---|
[1691] | 658 | |
---|
[2007] | 659 | USE transpose_indices |
---|
[1] | 660 | |
---|
[2696] | 661 | USE turbulence_closure_mod, & |
---|
| 662 | ONLY: tcm_init_arrays, tcm_init |
---|
| 663 | |
---|
[2007] | 664 | USE urban_surface_mod, & |
---|
[2696] | 665 | ONLY: usm_init_urban_surface, usm_allocate_surface |
---|
[2007] | 666 | |
---|
[2696] | 667 | USE uv_exposure_model_mod, & |
---|
| 668 | ONLY: uvem_init, uvem_init_arrays |
---|
[3472] | 669 | |
---|
| 670 | USE virtual_measurement_mod, & |
---|
| 671 | ONLY: vm_init |
---|
[2696] | 672 | |
---|
[1914] | 673 | USE wind_turbine_model_mod, & |
---|
[2564] | 674 | ONLY: wtm_init, wtm_init_arrays |
---|
[1914] | 675 | |
---|
[1] | 676 | IMPLICIT NONE |
---|
| 677 | |
---|
[1682] | 678 | INTEGER(iwp) :: i !< |
---|
| 679 | INTEGER(iwp) :: ind_array(1) !< |
---|
| 680 | INTEGER(iwp) :: j !< |
---|
| 681 | INTEGER(iwp) :: k !< |
---|
[2232] | 682 | INTEGER(iwp) :: k_surf !< surface level index |
---|
| 683 | INTEGER(iwp) :: m !< index of surface element in surface data type |
---|
| 684 | INTEGER(iwp) :: sr !< index of statistic region |
---|
[1] | 685 | |
---|
[1682] | 686 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: ngp_2dh_l !< |
---|
[1] | 687 | |
---|
[1682] | 688 | INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer_l !< |
---|
| 689 | INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_s_inner_l !< |
---|
[1] | 690 | |
---|
[2037] | 691 | REAL(wp) :: t_surface !< air temperature at the surface |
---|
| 692 | |
---|
[3182] | 693 | REAL(wp), DIMENSION(:), ALLOCATABLE :: init_l !< dummy array used for averaging 3D data to obtain inital profiles |
---|
[2037] | 694 | REAL(wp), DIMENSION(:), ALLOCATABLE :: p_hydrostatic !< hydrostatic pressure |
---|
| 695 | |
---|
| 696 | INTEGER(iwp) :: l !< loop variable |
---|
| 697 | INTEGER(iwp) :: nzt_l !< index of top PE boundary for multigrid level |
---|
| 698 | REAL(wp) :: dx_l !< grid spacing along x on different multigrid level |
---|
| 699 | REAL(wp) :: dy_l !< grid spacing along y on different multigrid level |
---|
| 700 | |
---|
[1764] | 701 | REAL(wp), DIMENSION(1:3) :: volume_flow_area_l !< |
---|
| 702 | REAL(wp), DIMENSION(1:3) :: volume_flow_initial_l !< |
---|
[1] | 703 | |
---|
[1738] | 704 | REAL(wp), DIMENSION(:), ALLOCATABLE :: mean_surface_level_height_l !< |
---|
[1682] | 705 | REAL(wp), DIMENSION(:), ALLOCATABLE :: ngp_3d_inner_l !< |
---|
| 706 | REAL(wp), DIMENSION(:), ALLOCATABLE :: ngp_3d_inner_tmp !< |
---|
[1] | 707 | |
---|
[2550] | 708 | INTEGER(iwp) :: nz_u_shift !< |
---|
| 709 | INTEGER(iwp) :: nz_v_shift !< |
---|
| 710 | INTEGER(iwp) :: nz_w_shift !< |
---|
| 711 | INTEGER(iwp) :: nz_s_shift !< |
---|
| 712 | INTEGER(iwp) :: nz_u_shift_l !< |
---|
| 713 | INTEGER(iwp) :: nz_v_shift_l !< |
---|
| 714 | INTEGER(iwp) :: nz_w_shift_l !< |
---|
| 715 | INTEGER(iwp) :: nz_s_shift_l !< |
---|
[485] | 716 | |
---|
[1402] | 717 | CALL location_message( 'allocating arrays', .FALSE. ) |
---|
[1] | 718 | ! |
---|
| 719 | !-- Allocate arrays |
---|
[1788] | 720 | ALLOCATE( mean_surface_level_height(0:statistic_regions), & |
---|
| 721 | mean_surface_level_height_l(0:statistic_regions), & |
---|
| 722 | ngp_2dh(0:statistic_regions), ngp_2dh_l(0:statistic_regions), & |
---|
| 723 | ngp_3d(0:statistic_regions), & |
---|
| 724 | ngp_3d_inner(0:statistic_regions), & |
---|
| 725 | ngp_3d_inner_l(0:statistic_regions), & |
---|
| 726 | ngp_3d_inner_tmp(0:statistic_regions), & |
---|
| 727 | sums_divnew_l(0:statistic_regions), & |
---|
[1] | 728 | sums_divold_l(0:statistic_regions) ) |
---|
[1195] | 729 | ALLOCATE( dp_smooth_factor(nzb:nzt), rdf(nzb+1:nzt), rdf_sc(nzb+1:nzt) ) |
---|
[1788] | 730 | ALLOCATE( ngp_2dh_outer(nzb:nzt+1,0:statistic_regions), & |
---|
| 731 | ngp_2dh_outer_l(nzb:nzt+1,0:statistic_regions), & |
---|
| 732 | ngp_2dh_s_inner(nzb:nzt+1,0:statistic_regions), & |
---|
| 733 | ngp_2dh_s_inner_l(nzb:nzt+1,0:statistic_regions), & |
---|
| 734 | rmask(nysg:nyng,nxlg:nxrg,0:statistic_regions), & |
---|
[3458] | 735 | sums(nzb:nzt+1,pr_palm+max_pr_user+max_pr_cs), & |
---|
| 736 | sums_l(nzb:nzt+1,pr_palm+max_pr_user+max_pr_cs,0:threads_per_task-1), & |
---|
[1788] | 737 | sums_l_l(nzb:nzt+1,0:statistic_regions,0:threads_per_task-1), & |
---|
| 738 | sums_wsts_bc_l(nzb:nzt+1,0:statistic_regions), & |
---|
[394] | 739 | ts_value(dots_max,0:statistic_regions) ) |
---|
[978] | 740 | ALLOCATE( ptdf_x(nxlg:nxrg), ptdf_y(nysg:nyng) ) |
---|
[1] | 741 | |
---|
[1788] | 742 | ALLOCATE( d(nzb+1:nzt,nys:nyn,nxl:nxr), & |
---|
| 743 | p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 744 | tend(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 745 | |
---|
| 746 | #if defined( __nopointer ) |
---|
[2696] | 747 | ALLOCATE( pt(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1788] | 748 | pt_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 749 | u(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 750 | u_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 751 | v(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 752 | v_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 753 | w(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 754 | w_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 755 | tpt_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 756 | tu_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 757 | tv_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1010] | 758 | tw_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 759 | #else |
---|
[2696] | 760 | ALLOCATE( pt_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[1788] | 761 | pt_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 762 | u_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 763 | u_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 764 | u_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 765 | v_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 766 | v_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 767 | v_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 768 | w_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 769 | w_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[667] | 770 | w_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1788] | 771 | IF ( .NOT. neutral ) THEN |
---|
[1032] | 772 | ALLOCATE( pt_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 773 | ENDIF |
---|
[1010] | 774 | #endif |
---|
| 775 | |
---|
[673] | 776 | ! |
---|
[707] | 777 | !-- Following array is required for perturbation pressure within the iterative |
---|
| 778 | !-- pressure solvers. For the multistep schemes (Runge-Kutta), array p holds |
---|
| 779 | !-- the weighted average of the substeps and cannot be used in the Poisson |
---|
| 780 | !-- solver. |
---|
| 781 | IF ( psolver == 'sor' ) THEN |
---|
| 782 | ALLOCATE( p_loc(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1575] | 783 | ELSEIF ( psolver(1:9) == 'multigrid' ) THEN |
---|
[707] | 784 | ! |
---|
| 785 | !-- For performance reasons, multigrid is using one ghost layer only |
---|
| 786 | ALLOCATE( p_loc(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[673] | 787 | ENDIF |
---|
[1] | 788 | |
---|
[1111] | 789 | ! |
---|
| 790 | !-- Array for storing constant coeffficients of the tridiagonal solver |
---|
| 791 | IF ( psolver == 'poisfft' ) THEN |
---|
[1212] | 792 | ALLOCATE( tri(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1,2) ) |
---|
[1111] | 793 | ALLOCATE( tric(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1) ) |
---|
| 794 | ENDIF |
---|
| 795 | |
---|
[1960] | 796 | IF ( humidity ) THEN |
---|
[1] | 797 | ! |
---|
[1960] | 798 | !-- 3D-humidity |
---|
[1010] | 799 | #if defined( __nopointer ) |
---|
[1788] | 800 | ALLOCATE( q(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 801 | q_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[3011] | 802 | tq_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 803 | vpt(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 804 | #else |
---|
[1788] | 805 | ALLOCATE( q_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 806 | q_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
[3011] | 807 | q_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 808 | vpt_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 809 | #endif |
---|
[1] | 810 | |
---|
[3011] | 811 | IF ( cloud_droplets ) THEN |
---|
[1] | 812 | ! |
---|
[3011] | 813 | !-- Liquid water content, change in liquid water content |
---|
[1010] | 814 | #if defined( __nopointer ) |
---|
[3011] | 815 | ALLOCATE ( ql(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 816 | ql_c(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 817 | #else |
---|
[3011] | 818 | ALLOCATE ( ql_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 819 | ql_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1010] | 820 | #endif |
---|
| 821 | ! |
---|
[3011] | 822 | !-- Real volume of particles (with weighting), volume of particles |
---|
| 823 | ALLOCATE ( ql_v(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 824 | ql_vp(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 825 | ENDIF |
---|
| 826 | |
---|
[3011] | 827 | ENDIF |
---|
[1960] | 828 | |
---|
| 829 | IF ( passive_scalar ) THEN |
---|
[1] | 830 | |
---|
[1960] | 831 | ! |
---|
| 832 | !-- 3D scalar arrays |
---|
| 833 | #if defined( __nopointer ) |
---|
| 834 | ALLOCATE( s(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 835 | s_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 836 | ts_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 837 | #else |
---|
| 838 | ALLOCATE( s_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 839 | s_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 840 | s_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 841 | #endif |
---|
| 842 | ENDIF |
---|
| 843 | |
---|
[1] | 844 | ! |
---|
[3302] | 845 | !-- Allocate and set 1d-profiles for Stokes drift velocity. It may be set to |
---|
| 846 | !-- non-zero values later in ocean_init |
---|
| 847 | ALLOCATE( u_stokes_zu(nzb:nzt+1), u_stokes_zw(nzb:nzt+1), & |
---|
| 848 | v_stokes_zu(nzb:nzt+1), v_stokes_zw(nzb:nzt+1) ) |
---|
| 849 | u_stokes_zu(:) = 0.0_wp |
---|
| 850 | u_stokes_zw(:) = 0.0_wp |
---|
| 851 | v_stokes_zu(:) = 0.0_wp |
---|
| 852 | v_stokes_zw(:) = 0.0_wp |
---|
| 853 | |
---|
| 854 | ! |
---|
[2037] | 855 | !-- Allocation of anelastic and Boussinesq approximation specific arrays |
---|
| 856 | ALLOCATE( p_hydrostatic(nzb:nzt+1) ) |
---|
| 857 | ALLOCATE( rho_air(nzb:nzt+1) ) |
---|
| 858 | ALLOCATE( rho_air_zw(nzb:nzt+1) ) |
---|
| 859 | ALLOCATE( drho_air(nzb:nzt+1) ) |
---|
| 860 | ALLOCATE( drho_air_zw(nzb:nzt+1) ) |
---|
| 861 | ! |
---|
| 862 | !-- Density profile calculation for anelastic approximation |
---|
[3274] | 863 | t_surface = pt_surface * ( surface_pressure / 1000.0_wp )**( r_d / c_p ) |
---|
[2037] | 864 | IF ( TRIM( approximation ) == 'anelastic' ) THEN |
---|
| 865 | DO k = nzb, nzt+1 |
---|
| 866 | p_hydrostatic(k) = surface_pressure * 100.0_wp * & |
---|
[3274] | 867 | ( 1 - ( g * zu(k) ) / ( c_p * t_surface ) & |
---|
| 868 | )**( c_p / r_d ) |
---|
[2037] | 869 | rho_air(k) = ( p_hydrostatic(k) * & |
---|
| 870 | ( 100000.0_wp / p_hydrostatic(k) & |
---|
[3274] | 871 | )**( r_d / c_p ) & |
---|
[2037] | 872 | ) / ( r_d * pt_init(k) ) |
---|
| 873 | ENDDO |
---|
| 874 | DO k = nzb, nzt |
---|
| 875 | rho_air_zw(k) = 0.5_wp * ( rho_air(k) + rho_air(k+1) ) |
---|
| 876 | ENDDO |
---|
| 877 | rho_air_zw(nzt+1) = rho_air_zw(nzt) & |
---|
| 878 | + 2.0_wp * ( rho_air(nzt+1) - rho_air_zw(nzt) ) |
---|
| 879 | ELSE |
---|
[2252] | 880 | DO k = nzb, nzt+1 |
---|
| 881 | p_hydrostatic(k) = surface_pressure * 100.0_wp * & |
---|
[3274] | 882 | ( 1 - ( g * zu(nzb) ) / ( c_p * t_surface ) & |
---|
| 883 | )**( c_p / r_d ) |
---|
[2252] | 884 | rho_air(k) = ( p_hydrostatic(k) * & |
---|
| 885 | ( 100000.0_wp / p_hydrostatic(k) & |
---|
[3274] | 886 | )**( r_d / c_p ) & |
---|
[2252] | 887 | ) / ( r_d * pt_init(nzb) ) |
---|
| 888 | ENDDO |
---|
| 889 | DO k = nzb, nzt |
---|
| 890 | rho_air_zw(k) = 0.5_wp * ( rho_air(k) + rho_air(k+1) ) |
---|
| 891 | ENDDO |
---|
| 892 | rho_air_zw(nzt+1) = rho_air_zw(nzt) & |
---|
| 893 | + 2.0_wp * ( rho_air(nzt+1) - rho_air_zw(nzt) ) |
---|
[2037] | 894 | ENDIF |
---|
[2696] | 895 | ! |
---|
[2037] | 896 | !-- compute the inverse density array in order to avoid expencive divisions |
---|
| 897 | drho_air = 1.0_wp / rho_air |
---|
| 898 | drho_air_zw = 1.0_wp / rho_air_zw |
---|
| 899 | |
---|
| 900 | ! |
---|
| 901 | !-- Allocation of flux conversion arrays |
---|
| 902 | ALLOCATE( heatflux_input_conversion(nzb:nzt+1) ) |
---|
| 903 | ALLOCATE( waterflux_input_conversion(nzb:nzt+1) ) |
---|
| 904 | ALLOCATE( momentumflux_input_conversion(nzb:nzt+1) ) |
---|
| 905 | ALLOCATE( heatflux_output_conversion(nzb:nzt+1) ) |
---|
| 906 | ALLOCATE( waterflux_output_conversion(nzb:nzt+1) ) |
---|
| 907 | ALLOCATE( momentumflux_output_conversion(nzb:nzt+1) ) |
---|
| 908 | |
---|
| 909 | ! |
---|
| 910 | !-- calculate flux conversion factors according to approximation and in-/output mode |
---|
| 911 | DO k = nzb, nzt+1 |
---|
| 912 | |
---|
| 913 | IF ( TRIM( flux_input_mode ) == 'kinematic' ) THEN |
---|
| 914 | heatflux_input_conversion(k) = rho_air_zw(k) |
---|
| 915 | waterflux_input_conversion(k) = rho_air_zw(k) |
---|
| 916 | momentumflux_input_conversion(k) = rho_air_zw(k) |
---|
| 917 | ELSEIF ( TRIM( flux_input_mode ) == 'dynamic' ) THEN |
---|
[3274] | 918 | heatflux_input_conversion(k) = 1.0_wp / c_p |
---|
[2037] | 919 | waterflux_input_conversion(k) = 1.0_wp / l_v |
---|
| 920 | momentumflux_input_conversion(k) = 1.0_wp |
---|
| 921 | ENDIF |
---|
| 922 | |
---|
| 923 | IF ( TRIM( flux_output_mode ) == 'kinematic' ) THEN |
---|
| 924 | heatflux_output_conversion(k) = drho_air_zw(k) |
---|
| 925 | waterflux_output_conversion(k) = drho_air_zw(k) |
---|
| 926 | momentumflux_output_conversion(k) = drho_air_zw(k) |
---|
| 927 | ELSEIF ( TRIM( flux_output_mode ) == 'dynamic' ) THEN |
---|
[3274] | 928 | heatflux_output_conversion(k) = c_p |
---|
[2037] | 929 | waterflux_output_conversion(k) = l_v |
---|
| 930 | momentumflux_output_conversion(k) = 1.0_wp |
---|
| 931 | ENDIF |
---|
| 932 | |
---|
| 933 | IF ( .NOT. humidity ) THEN |
---|
| 934 | waterflux_input_conversion(k) = 1.0_wp |
---|
| 935 | waterflux_output_conversion(k) = 1.0_wp |
---|
| 936 | ENDIF |
---|
| 937 | |
---|
| 938 | ENDDO |
---|
| 939 | |
---|
| 940 | ! |
---|
| 941 | !-- In case of multigrid method, compute grid lengths and grid factors for the |
---|
| 942 | !-- grid levels with respective density on each grid |
---|
| 943 | IF ( psolver(1:9) == 'multigrid' ) THEN |
---|
| 944 | |
---|
| 945 | ALLOCATE( ddx2_mg(maximum_grid_level) ) |
---|
| 946 | ALLOCATE( ddy2_mg(maximum_grid_level) ) |
---|
| 947 | ALLOCATE( dzu_mg(nzb+1:nzt+1,maximum_grid_level) ) |
---|
| 948 | ALLOCATE( dzw_mg(nzb+1:nzt+1,maximum_grid_level) ) |
---|
| 949 | ALLOCATE( f1_mg(nzb+1:nzt,maximum_grid_level) ) |
---|
| 950 | ALLOCATE( f2_mg(nzb+1:nzt,maximum_grid_level) ) |
---|
| 951 | ALLOCATE( f3_mg(nzb+1:nzt,maximum_grid_level) ) |
---|
| 952 | ALLOCATE( rho_air_mg(nzb:nzt+1,maximum_grid_level) ) |
---|
| 953 | ALLOCATE( rho_air_zw_mg(nzb:nzt+1,maximum_grid_level) ) |
---|
| 954 | |
---|
| 955 | dzu_mg(:,maximum_grid_level) = dzu |
---|
| 956 | rho_air_mg(:,maximum_grid_level) = rho_air |
---|
| 957 | ! |
---|
| 958 | !-- Next line to ensure an equally spaced grid. |
---|
| 959 | dzu_mg(1,maximum_grid_level) = dzu(2) |
---|
| 960 | rho_air_mg(nzb,maximum_grid_level) = rho_air(nzb) + & |
---|
| 961 | (rho_air(nzb) - rho_air(nzb+1)) |
---|
| 962 | |
---|
| 963 | dzw_mg(:,maximum_grid_level) = dzw |
---|
| 964 | rho_air_zw_mg(:,maximum_grid_level) = rho_air_zw |
---|
| 965 | nzt_l = nzt |
---|
| 966 | DO l = maximum_grid_level-1, 1, -1 |
---|
| 967 | dzu_mg(nzb+1,l) = 2.0_wp * dzu_mg(nzb+1,l+1) |
---|
| 968 | dzw_mg(nzb+1,l) = 2.0_wp * dzw_mg(nzb+1,l+1) |
---|
| 969 | rho_air_mg(nzb,l) = rho_air_mg(nzb,l+1) + (rho_air_mg(nzb,l+1) - rho_air_mg(nzb+1,l+1)) |
---|
| 970 | 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)) |
---|
| 971 | rho_air_mg(nzb+1,l) = rho_air_mg(nzb+1,l+1) |
---|
| 972 | rho_air_zw_mg(nzb+1,l) = rho_air_zw_mg(nzb+1,l+1) |
---|
| 973 | nzt_l = nzt_l / 2 |
---|
| 974 | DO k = 2, nzt_l+1 |
---|
| 975 | dzu_mg(k,l) = dzu_mg(2*k-2,l+1) + dzu_mg(2*k-1,l+1) |
---|
| 976 | dzw_mg(k,l) = dzw_mg(2*k-2,l+1) + dzw_mg(2*k-1,l+1) |
---|
| 977 | rho_air_mg(k,l) = rho_air_mg(2*k-1,l+1) |
---|
| 978 | rho_air_zw_mg(k,l) = rho_air_zw_mg(2*k-1,l+1) |
---|
| 979 | ENDDO |
---|
| 980 | ENDDO |
---|
| 981 | |
---|
| 982 | nzt_l = nzt |
---|
| 983 | dx_l = dx |
---|
| 984 | dy_l = dy |
---|
| 985 | DO l = maximum_grid_level, 1, -1 |
---|
| 986 | ddx2_mg(l) = 1.0_wp / dx_l**2 |
---|
| 987 | ddy2_mg(l) = 1.0_wp / dy_l**2 |
---|
| 988 | DO k = nzb+1, nzt_l |
---|
| 989 | f2_mg(k,l) = rho_air_zw_mg(k,l) / ( dzu_mg(k+1,l) * dzw_mg(k,l) ) |
---|
| 990 | f3_mg(k,l) = rho_air_zw_mg(k-1,l) / ( dzu_mg(k,l) * dzw_mg(k,l) ) |
---|
| 991 | f1_mg(k,l) = 2.0_wp * ( ddx2_mg(l) + ddy2_mg(l) ) & |
---|
| 992 | * rho_air_mg(k,l) + f2_mg(k,l) + f3_mg(k,l) |
---|
| 993 | ENDDO |
---|
| 994 | nzt_l = nzt_l / 2 |
---|
| 995 | dx_l = dx_l * 2.0_wp |
---|
| 996 | dy_l = dy_l * 2.0_wp |
---|
| 997 | ENDDO |
---|
| 998 | |
---|
| 999 | ENDIF |
---|
| 1000 | |
---|
| 1001 | ! |
---|
[1299] | 1002 | !-- 1D-array for large scale subsidence velocity |
---|
[1361] | 1003 | IF ( .NOT. ALLOCATED( w_subs ) ) THEN |
---|
| 1004 | ALLOCATE ( w_subs(nzb:nzt+1) ) |
---|
| 1005 | w_subs = 0.0_wp |
---|
| 1006 | ENDIF |
---|
[1299] | 1007 | |
---|
| 1008 | ! |
---|
[106] | 1009 | !-- Arrays to store velocity data from t-dt and the phase speeds which |
---|
| 1010 | !-- are needed for radiation boundary conditions |
---|
[3182] | 1011 | IF ( bc_radiation_l ) THEN |
---|
[1788] | 1012 | ALLOCATE( u_m_l(nzb:nzt+1,nysg:nyng,1:2), & |
---|
| 1013 | v_m_l(nzb:nzt+1,nysg:nyng,0:1), & |
---|
[667] | 1014 | w_m_l(nzb:nzt+1,nysg:nyng,0:1) ) |
---|
[73] | 1015 | ENDIF |
---|
[3182] | 1016 | IF ( bc_radiation_r ) THEN |
---|
[1788] | 1017 | ALLOCATE( u_m_r(nzb:nzt+1,nysg:nyng,nx-1:nx), & |
---|
| 1018 | v_m_r(nzb:nzt+1,nysg:nyng,nx-1:nx), & |
---|
[667] | 1019 | w_m_r(nzb:nzt+1,nysg:nyng,nx-1:nx) ) |
---|
[73] | 1020 | ENDIF |
---|
[3182] | 1021 | IF ( bc_radiation_l .OR. bc_radiation_r ) THEN |
---|
[1788] | 1022 | ALLOCATE( c_u(nzb:nzt+1,nysg:nyng), c_v(nzb:nzt+1,nysg:nyng), & |
---|
[667] | 1023 | c_w(nzb:nzt+1,nysg:nyng) ) |
---|
[106] | 1024 | ENDIF |
---|
[3182] | 1025 | IF ( bc_radiation_s ) THEN |
---|
[1788] | 1026 | ALLOCATE( u_m_s(nzb:nzt+1,0:1,nxlg:nxrg), & |
---|
| 1027 | v_m_s(nzb:nzt+1,1:2,nxlg:nxrg), & |
---|
[667] | 1028 | w_m_s(nzb:nzt+1,0:1,nxlg:nxrg) ) |
---|
[73] | 1029 | ENDIF |
---|
[3182] | 1030 | IF ( bc_radiation_n ) THEN |
---|
[1788] | 1031 | ALLOCATE( u_m_n(nzb:nzt+1,ny-1:ny,nxlg:nxrg), & |
---|
| 1032 | v_m_n(nzb:nzt+1,ny-1:ny,nxlg:nxrg), & |
---|
[667] | 1033 | w_m_n(nzb:nzt+1,ny-1:ny,nxlg:nxrg) ) |
---|
[73] | 1034 | ENDIF |
---|
[3182] | 1035 | IF ( bc_radiation_s .OR. bc_radiation_n ) THEN |
---|
[1788] | 1036 | ALLOCATE( c_u(nzb:nzt+1,nxlg:nxrg), c_v(nzb:nzt+1,nxlg:nxrg), & |
---|
[667] | 1037 | c_w(nzb:nzt+1,nxlg:nxrg) ) |
---|
[106] | 1038 | ENDIF |
---|
[3182] | 1039 | IF ( bc_radiation_l .OR. bc_radiation_r .OR. bc_radiation_s .OR. & |
---|
| 1040 | bc_radiation_n ) THEN |
---|
[978] | 1041 | ALLOCATE( c_u_m_l(nzb:nzt+1), c_v_m_l(nzb:nzt+1), c_w_m_l(nzb:nzt+1) ) |
---|
| 1042 | ALLOCATE( c_u_m(nzb:nzt+1), c_v_m(nzb:nzt+1), c_w_m(nzb:nzt+1) ) |
---|
| 1043 | ENDIF |
---|
[73] | 1044 | |
---|
[978] | 1045 | |
---|
[1010] | 1046 | #if ! defined( __nopointer ) |
---|
[73] | 1047 | ! |
---|
[1] | 1048 | !-- Initial assignment of the pointers |
---|
[1032] | 1049 | IF ( .NOT. neutral ) THEN |
---|
| 1050 | pt => pt_1; pt_p => pt_2; tpt_m => pt_3 |
---|
| 1051 | ELSE |
---|
| 1052 | pt => pt_1; pt_p => pt_1; tpt_m => pt_3 |
---|
| 1053 | ENDIF |
---|
[1001] | 1054 | u => u_1; u_p => u_2; tu_m => u_3 |
---|
| 1055 | v => v_1; v_p => v_2; tv_m => v_3 |
---|
| 1056 | w => w_1; w_p => w_2; tw_m => w_3 |
---|
[1] | 1057 | |
---|
[1960] | 1058 | IF ( humidity ) THEN |
---|
[1001] | 1059 | q => q_1; q_p => q_2; tq_m => q_3 |
---|
[3274] | 1060 | vpt => vpt_1 |
---|
[1001] | 1061 | IF ( cloud_droplets ) THEN |
---|
| 1062 | ql => ql_1 |
---|
| 1063 | ql_c => ql_2 |
---|
[1] | 1064 | ENDIF |
---|
[1001] | 1065 | ENDIF |
---|
[1960] | 1066 | |
---|
| 1067 | IF ( passive_scalar ) THEN |
---|
| 1068 | s => s_1; s_p => s_2; ts_m => s_3 |
---|
| 1069 | ENDIF |
---|
[3294] | 1070 | #endif |
---|
[1] | 1071 | |
---|
| 1072 | ! |
---|
[2696] | 1073 | !-- Initialize arrays for turbulence closure |
---|
| 1074 | CALL tcm_init_arrays |
---|
| 1075 | ! |
---|
| 1076 | !-- Initialize surface arrays |
---|
[2232] | 1077 | CALL init_surface_arrays |
---|
| 1078 | ! |
---|
[3294] | 1079 | !-- Allocate arrays for other modules |
---|
[3448] | 1080 | IF ( biometeorology ) CALL biom_init_arrays |
---|
[3294] | 1081 | IF ( bulk_cloud_model ) CALL bcm_init_arrays |
---|
| 1082 | IF ( gust_module_enabled ) CALL gust_init_arrays |
---|
| 1083 | IF ( land_surface ) CALL lsm_init_arrays |
---|
| 1084 | IF ( ocean_mode ) CALL ocean_init_arrays |
---|
[3467] | 1085 | IF ( salsa ) CALL salsa_init_arrays |
---|
[3294] | 1086 | IF ( wind_turbine ) CALL wtm_init_arrays |
---|
| 1087 | IF ( uv_exposure ) CALL uvem_init_arrays |
---|
[1551] | 1088 | |
---|
| 1089 | ! |
---|
[1957] | 1090 | !-- Initialize virtual flight measurements |
---|
| 1091 | IF ( virtual_flight ) THEN |
---|
| 1092 | CALL flight_init |
---|
| 1093 | ENDIF |
---|
[1914] | 1094 | |
---|
| 1095 | ! |
---|
[2696] | 1096 | !-- Read uv exposure input data |
---|
| 1097 | IF ( uv_exposure ) THEN |
---|
| 1098 | CALL uvem_init |
---|
[2320] | 1099 | ENDIF |
---|
| 1100 | |
---|
| 1101 | ! |
---|
[709] | 1102 | !-- Allocate arrays containing the RK coefficient for calculation of |
---|
| 1103 | !-- perturbation pressure and turbulent fluxes. At this point values are |
---|
| 1104 | !-- set for pressure calculation during initialization (where no timestep |
---|
| 1105 | !-- is done). Further below the values needed within the timestep scheme |
---|
| 1106 | !-- will be set. |
---|
[1788] | 1107 | ALLOCATE( weight_substep(1:intermediate_timestep_count_max), & |
---|
[1878] | 1108 | weight_pres(1:intermediate_timestep_count_max) ) |
---|
[1340] | 1109 | weight_substep = 1.0_wp |
---|
| 1110 | weight_pres = 1.0_wp |
---|
[1918] | 1111 | intermediate_timestep_count = 0 ! needed when simulated_time = 0.0 |
---|
[673] | 1112 | |
---|
[1402] | 1113 | CALL location_message( 'finished', .TRUE. ) |
---|
[1918] | 1114 | |
---|
[673] | 1115 | ! |
---|
[3014] | 1116 | !-- Initialize time series |
---|
| 1117 | ts_value = 0.0_wp |
---|
| 1118 | |
---|
| 1119 | ! |
---|
[1918] | 1120 | !-- Initialize local summation arrays for routine flow_statistics. |
---|
| 1121 | !-- This is necessary because they may not yet have been initialized when they |
---|
| 1122 | !-- are called from flow_statistics (or - depending on the chosen model run - |
---|
| 1123 | !-- are never initialized) |
---|
| 1124 | sums_divnew_l = 0.0_wp |
---|
| 1125 | sums_divold_l = 0.0_wp |
---|
| 1126 | sums_l_l = 0.0_wp |
---|
| 1127 | sums_wsts_bc_l = 0.0_wp |
---|
[3182] | 1128 | |
---|
[1918] | 1129 | ! |
---|
[1] | 1130 | !-- Initialize model variables |
---|
[1788] | 1131 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. & |
---|
[328] | 1132 | TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN |
---|
[1] | 1133 | ! |
---|
[2696] | 1134 | !-- Initialization with provided input data derived from larger-scale model |
---|
| 1135 | IF ( INDEX( initializing_actions, 'inifor' ) /= 0 ) THEN |
---|
| 1136 | CALL location_message( 'initializing with INIFOR', .FALSE. ) |
---|
| 1137 | ! |
---|
[3051] | 1138 | !-- Read initial 1D profiles or 3D data from NetCDF file, depending |
---|
| 1139 | !-- on the provided level-of-detail. |
---|
[2696] | 1140 | !-- At the moment, only u, v, w, pt and q are provided. |
---|
| 1141 | CALL netcdf_data_input_init_3d |
---|
| 1142 | ! |
---|
[3182] | 1143 | !-- Please note, Inifor provides data from nzb+1 to nzt. |
---|
| 1144 | !-- Bottom and top boundary conditions for Inifor profiles are already |
---|
| 1145 | !-- set (just after reading), so that this is not necessary here. |
---|
| 1146 | !-- Depending on the provided level-of-detail, initial Inifor data is |
---|
| 1147 | !-- either stored on data type (lod=1), or directly on 3D arrays (lod=2). |
---|
| 1148 | !-- In order to obtain also initial profiles in case of lod=2 (which |
---|
| 1149 | !-- is required for e.g. damping), average over 3D data. |
---|
| 1150 | IF( init_3d%lod_u == 1 ) THEN |
---|
| 1151 | u_init = init_3d%u_init |
---|
| 1152 | ELSEIF( init_3d%lod_u == 2 ) THEN |
---|
| 1153 | ALLOCATE( init_l(nzb:nzt+1) ) |
---|
| 1154 | DO k = nzb, nzt+1 |
---|
| 1155 | init_l(k) = SUM( u(k,nys:nyn,nxl:nxr) ) |
---|
| 1156 | ENDDO |
---|
| 1157 | init_l = init_l / REAL( ( nx + 1 ) * ( ny + 1 ), KIND = wp ) |
---|
[1384] | 1158 | |
---|
[3182] | 1159 | #if defined( __parallel ) |
---|
| 1160 | CALL MPI_ALLREDUCE( init_l, u_init, nzt+1-nzb+1, & |
---|
| 1161 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1162 | #else |
---|
| 1163 | u_init = init_l |
---|
| 1164 | #endif |
---|
| 1165 | DEALLOCATE( init_l ) |
---|
[3051] | 1166 | |
---|
[2696] | 1167 | ENDIF |
---|
[3182] | 1168 | |
---|
| 1169 | IF( init_3d%lod_v == 1 ) THEN |
---|
| 1170 | v_init = init_3d%v_init |
---|
| 1171 | ELSEIF( init_3d%lod_v == 2 ) THEN |
---|
| 1172 | ALLOCATE( init_l(nzb:nzt+1) ) |
---|
| 1173 | DO k = nzb, nzt+1 |
---|
| 1174 | init_l(k) = SUM( v(k,nys:nyn,nxl:nxr) ) |
---|
| 1175 | ENDDO |
---|
| 1176 | init_l = init_l / REAL( ( nx + 1 ) * ( ny + 1 ), KIND = wp ) |
---|
[2696] | 1177 | |
---|
[3182] | 1178 | #if defined( __parallel ) |
---|
| 1179 | CALL MPI_ALLREDUCE( init_l, v_init, nzt+1-nzb+1, & |
---|
| 1180 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1181 | #else |
---|
| 1182 | v_init = init_l |
---|
| 1183 | #endif |
---|
| 1184 | DEALLOCATE( init_l ) |
---|
| 1185 | ENDIF |
---|
| 1186 | IF( .NOT. neutral ) THEN |
---|
| 1187 | IF( init_3d%lod_pt == 1 ) THEN |
---|
| 1188 | pt_init = init_3d%pt_init |
---|
| 1189 | ELSEIF( init_3d%lod_pt == 2 ) THEN |
---|
| 1190 | ALLOCATE( init_l(nzb:nzt+1) ) |
---|
| 1191 | DO k = nzb, nzt+1 |
---|
| 1192 | init_l(k) = SUM( pt(k,nys:nyn,nxl:nxr) ) |
---|
| 1193 | ENDDO |
---|
| 1194 | init_l = init_l / REAL( ( nx + 1 ) * ( ny + 1 ), KIND = wp ) |
---|
| 1195 | |
---|
| 1196 | #if defined( __parallel ) |
---|
| 1197 | CALL MPI_ALLREDUCE( init_l, pt_init, nzt+1-nzb+1, & |
---|
| 1198 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1199 | #else |
---|
| 1200 | pt_init = init_l |
---|
| 1201 | #endif |
---|
| 1202 | DEALLOCATE( init_l ) |
---|
| 1203 | ENDIF |
---|
| 1204 | ENDIF |
---|
| 1205 | |
---|
| 1206 | |
---|
| 1207 | IF( humidity ) THEN |
---|
| 1208 | IF( init_3d%lod_q == 1 ) THEN |
---|
| 1209 | q_init = init_3d%q_init |
---|
| 1210 | ELSEIF( init_3d%lod_q == 2 ) THEN |
---|
| 1211 | ALLOCATE( init_l(nzb:nzt+1) ) |
---|
| 1212 | DO k = nzb, nzt+1 |
---|
| 1213 | init_l(k) = SUM( q(k,nys:nyn,nxl:nxr) ) |
---|
| 1214 | ENDDO |
---|
| 1215 | init_l = init_l / REAL( ( nx + 1 ) * ( ny + 1 ), KIND = wp ) |
---|
| 1216 | |
---|
| 1217 | #if defined( __parallel ) |
---|
| 1218 | CALL MPI_ALLREDUCE( init_l, q_init, nzt+1-nzb+1, & |
---|
| 1219 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1220 | #else |
---|
| 1221 | q_init = init_l |
---|
| 1222 | #endif |
---|
| 1223 | DEALLOCATE( init_l ) |
---|
| 1224 | ENDIF |
---|
| 1225 | ENDIF |
---|
| 1226 | |
---|
[2696] | 1227 | ! |
---|
[3182] | 1228 | !-- Write initial profiles onto 3D arrays. Note, only in case of lod = 1, |
---|
| 1229 | !-- for lod = 2 data is already on 3D arrays. |
---|
[2696] | 1230 | DO i = nxlg, nxrg |
---|
| 1231 | DO j = nysg, nyng |
---|
[3051] | 1232 | IF( init_3d%lod_u == 1 ) u(:,j,i) = u_init(:) |
---|
| 1233 | IF( init_3d%lod_v == 1 ) v(:,j,i) = v_init(:) |
---|
| 1234 | IF( .NOT. neutral .AND. init_3d%lod_pt == 1 ) & |
---|
| 1235 | pt(:,j,i) = pt_init(:) |
---|
[3182] | 1236 | IF( humidity .AND. init_3d%lod_q == 1 ) q(:,j,i) = q_init(:) |
---|
[2696] | 1237 | ENDDO |
---|
| 1238 | ENDDO |
---|
| 1239 | ! |
---|
[3182] | 1240 | !-- Exchange ghost points in case of level-of-detail = 2 |
---|
| 1241 | IF( init_3d%lod_u == 2 ) CALL exchange_horiz( u, nbgp ) |
---|
| 1242 | IF( init_3d%lod_v == 2 ) CALL exchange_horiz( v, nbgp ) |
---|
| 1243 | IF( init_3d%lod_w == 2 ) CALL exchange_horiz( w, nbgp ) |
---|
| 1244 | IF( .NOT. neutral .AND. init_3d%lod_pt == 2 ) & |
---|
| 1245 | CALL exchange_horiz( pt, nbgp ) |
---|
| 1246 | IF( humidity .AND. init_3d%lod_q == 2 ) & |
---|
| 1247 | CALL exchange_horiz( q, nbgp ) |
---|
| 1248 | ! |
---|
| 1249 | !-- Set geostrophic wind components. |
---|
[2938] | 1250 | IF ( init_3d%from_file_ug ) THEN |
---|
| 1251 | ug(:) = init_3d%ug_init(:) |
---|
| 1252 | ENDIF |
---|
| 1253 | IF ( init_3d%from_file_vg ) THEN |
---|
| 1254 | vg(:) = init_3d%vg_init(:) |
---|
| 1255 | ENDIF |
---|
[3404] | 1256 | ! |
---|
| 1257 | !-- Set bottom and top boundary condition for geostrophic wind |
---|
[2938] | 1258 | ug(nzt+1) = ug(nzt) |
---|
| 1259 | vg(nzt+1) = vg(nzt) |
---|
[3404] | 1260 | ug(nzb) = ug(nzb+1) |
---|
| 1261 | vg(nzb) = vg(nzb+1) |
---|
[2696] | 1262 | ! |
---|
| 1263 | !-- Set inital w to 0 |
---|
| 1264 | w = 0.0_wp |
---|
| 1265 | |
---|
| 1266 | IF ( passive_scalar ) THEN |
---|
| 1267 | DO i = nxlg, nxrg |
---|
| 1268 | DO j = nysg, nyng |
---|
| 1269 | s(:,j,i) = s_init |
---|
| 1270 | ENDDO |
---|
| 1271 | ENDDO |
---|
| 1272 | ENDIF |
---|
| 1273 | |
---|
| 1274 | ! |
---|
| 1275 | !-- Set velocity components at non-atmospheric / oceanic grid points to |
---|
| 1276 | !-- zero. |
---|
| 1277 | u = MERGE( u, 0.0_wp, BTEST( wall_flags_0, 1 ) ) |
---|
| 1278 | v = MERGE( v, 0.0_wp, BTEST( wall_flags_0, 2 ) ) |
---|
| 1279 | w = MERGE( w, 0.0_wp, BTEST( wall_flags_0, 3 ) ) |
---|
[2700] | 1280 | ! |
---|
| 1281 | !-- Initialize surface variables, e.g. friction velocity, momentum |
---|
| 1282 | !-- fluxes, etc. |
---|
| 1283 | CALL init_surfaces |
---|
[2938] | 1284 | ! |
---|
| 1285 | !-- Initialize turbulence generator |
---|
| 1286 | IF( use_syn_turb_gen ) CALL stg_init |
---|
[2696] | 1287 | |
---|
| 1288 | CALL location_message( 'finished', .TRUE. ) |
---|
| 1289 | ! |
---|
| 1290 | !-- Initialization via computed 1D-model profiles |
---|
| 1291 | ELSEIF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN |
---|
| 1292 | |
---|
[1402] | 1293 | CALL location_message( 'initializing with 1D model profiles', .FALSE. ) |
---|
[1] | 1294 | ! |
---|
| 1295 | !-- Use solutions of the 1D model as initial profiles, |
---|
| 1296 | !-- start 1D model |
---|
| 1297 | CALL init_1d_model |
---|
| 1298 | ! |
---|
| 1299 | !-- Transfer initial profiles to the arrays of the 3D model |
---|
[667] | 1300 | DO i = nxlg, nxrg |
---|
| 1301 | DO j = nysg, nyng |
---|
[1] | 1302 | pt(:,j,i) = pt_init |
---|
| 1303 | u(:,j,i) = u1d |
---|
| 1304 | v(:,j,i) = v1d |
---|
| 1305 | ENDDO |
---|
| 1306 | ENDDO |
---|
| 1307 | |
---|
[1960] | 1308 | IF ( humidity ) THEN |
---|
[667] | 1309 | DO i = nxlg, nxrg |
---|
| 1310 | DO j = nysg, nyng |
---|
[1] | 1311 | q(:,j,i) = q_init |
---|
| 1312 | ENDDO |
---|
| 1313 | ENDDO |
---|
| 1314 | ENDIF |
---|
[2292] | 1315 | |
---|
[1960] | 1316 | IF ( passive_scalar ) THEN |
---|
| 1317 | DO i = nxlg, nxrg |
---|
| 1318 | DO j = nysg, nyng |
---|
| 1319 | s(:,j,i) = s_init |
---|
| 1320 | ENDDO |
---|
| 1321 | ENDDO |
---|
| 1322 | ENDIF |
---|
[1] | 1323 | ! |
---|
| 1324 | !-- Store initial profiles for output purposes etc. |
---|
[2696] | 1325 | IF ( .NOT. constant_diffusion ) THEN |
---|
[1] | 1326 | hom(:,1,25,:) = SPREAD( l1d, 2, statistic_regions+1 ) |
---|
| 1327 | ENDIF |
---|
| 1328 | ! |
---|
[2696] | 1329 | !-- Set velocities back to zero |
---|
[2758] | 1330 | u = MERGE( u, 0.0_wp, BTEST( wall_flags_0, 1 ) ) |
---|
| 1331 | v = MERGE( v, 0.0_wp, BTEST( wall_flags_0, 2 ) ) |
---|
[1] | 1332 | ! |
---|
[2696] | 1333 | !-- WARNING: The extra boundary conditions set after running the |
---|
| 1334 | !-- ------- 1D model impose an error on the divergence one layer |
---|
| 1335 | !-- below the topography; need to correct later |
---|
| 1336 | !-- ATTENTION: Provisional correction for Piacsek & Williams |
---|
| 1337 | !-- --------- advection scheme: keep u and v zero one layer below |
---|
| 1338 | !-- the topography. |
---|
| 1339 | IF ( ibc_uv_b == 1 ) THEN |
---|
[667] | 1340 | ! |
---|
[2696] | 1341 | !-- Neumann condition |
---|
| 1342 | DO i = nxl-1, nxr+1 |
---|
| 1343 | DO j = nys-1, nyn+1 |
---|
| 1344 | u(nzb,j,i) = u(nzb+1,j,i) |
---|
| 1345 | v(nzb,j,i) = v(nzb+1,j,i) |
---|
[1] | 1346 | ENDDO |
---|
[2696] | 1347 | ENDDO |
---|
[1] | 1348 | |
---|
| 1349 | ENDIF |
---|
[2618] | 1350 | ! |
---|
| 1351 | !-- Initialize surface variables, e.g. friction velocity, momentum |
---|
| 1352 | !-- fluxes, etc. |
---|
| 1353 | CALL init_surfaces |
---|
[1] | 1354 | |
---|
[1402] | 1355 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1356 | |
---|
[1788] | 1357 | ELSEIF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) & |
---|
[1] | 1358 | THEN |
---|
[1241] | 1359 | |
---|
[1402] | 1360 | CALL location_message( 'initializing with constant profiles', .FALSE. ) |
---|
[1] | 1361 | ! |
---|
[2259] | 1362 | !-- Overwrite initial profiles in case of synthetic turbulence generator |
---|
[2938] | 1363 | IF( use_syn_turb_gen ) CALL stg_init |
---|
[2259] | 1364 | |
---|
| 1365 | ! |
---|
[1] | 1366 | !-- Use constructed initial profiles (velocity constant with height, |
---|
| 1367 | !-- temperature profile with constant gradient) |
---|
[667] | 1368 | DO i = nxlg, nxrg |
---|
| 1369 | DO j = nysg, nyng |
---|
[1] | 1370 | pt(:,j,i) = pt_init |
---|
| 1371 | u(:,j,i) = u_init |
---|
| 1372 | v(:,j,i) = v_init |
---|
| 1373 | ENDDO |
---|
| 1374 | ENDDO |
---|
| 1375 | ! |
---|
[2758] | 1376 | !-- Mask topography |
---|
| 1377 | u = MERGE( u, 0.0_wp, BTEST( wall_flags_0, 1 ) ) |
---|
| 1378 | v = MERGE( v, 0.0_wp, BTEST( wall_flags_0, 2 ) ) |
---|
| 1379 | ! |
---|
[292] | 1380 | !-- Set initial horizontal velocities at the lowest computational grid |
---|
| 1381 | !-- levels to zero in order to avoid too small time steps caused by the |
---|
| 1382 | !-- diffusion limit in the initial phase of a run (at k=1, dz/2 occurs |
---|
[2758] | 1383 | !-- in the limiting formula!). |
---|
| 1384 | !-- Please note, in case land- or urban-surface model is used and a |
---|
| 1385 | !-- spinup is applied, masking the lowest computational level is not |
---|
| 1386 | !-- possible as MOST as well as energy-balance parametrizations will not |
---|
| 1387 | !-- work with zero wind velocity. |
---|
| 1388 | IF ( ibc_uv_b /= 1 .AND. .NOT. spinup ) THEN |
---|
[1815] | 1389 | DO i = nxlg, nxrg |
---|
| 1390 | DO j = nysg, nyng |
---|
[2232] | 1391 | DO k = nzb, nzt |
---|
| 1392 | u(k,j,i) = MERGE( u(k,j,i), 0.0_wp, & |
---|
| 1393 | BTEST( wall_flags_0(k,j,i), 20 ) ) |
---|
| 1394 | v(k,j,i) = MERGE( v(k,j,i), 0.0_wp, & |
---|
| 1395 | BTEST( wall_flags_0(k,j,i), 21 ) ) |
---|
| 1396 | ENDDO |
---|
[1815] | 1397 | ENDDO |
---|
| 1398 | ENDDO |
---|
| 1399 | ENDIF |
---|
[1] | 1400 | |
---|
[1960] | 1401 | IF ( humidity ) THEN |
---|
[667] | 1402 | DO i = nxlg, nxrg |
---|
| 1403 | DO j = nysg, nyng |
---|
[1] | 1404 | q(:,j,i) = q_init |
---|
| 1405 | ENDDO |
---|
| 1406 | ENDDO |
---|
| 1407 | ENDIF |
---|
[1960] | 1408 | |
---|
| 1409 | IF ( passive_scalar ) THEN |
---|
| 1410 | DO i = nxlg, nxrg |
---|
| 1411 | DO j = nysg, nyng |
---|
| 1412 | s(:,j,i) = s_init |
---|
| 1413 | ENDDO |
---|
| 1414 | ENDDO |
---|
| 1415 | ENDIF |
---|
[1] | 1416 | |
---|
[1920] | 1417 | ! |
---|
[1] | 1418 | !-- Compute initial temperature field and other constants used in case |
---|
| 1419 | !-- of a sloping surface |
---|
| 1420 | IF ( sloping_surface ) CALL init_slope |
---|
[2618] | 1421 | ! |
---|
| 1422 | !-- Initialize surface variables, e.g. friction velocity, momentum |
---|
| 1423 | !-- fluxes, etc. |
---|
| 1424 | CALL init_surfaces |
---|
[1] | 1425 | |
---|
[1402] | 1426 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1427 | |
---|
[1788] | 1428 | ELSEIF ( INDEX(initializing_actions, 'by_user') /= 0 ) & |
---|
[46] | 1429 | THEN |
---|
[1384] | 1430 | |
---|
[1402] | 1431 | CALL location_message( 'initializing by user', .FALSE. ) |
---|
[46] | 1432 | ! |
---|
[2618] | 1433 | !-- Pre-initialize surface variables, i.e. setting start- and end-indices |
---|
| 1434 | !-- at each (j,i)-location. Please note, this does not supersede |
---|
| 1435 | !-- user-defined initialization of surface quantities. |
---|
| 1436 | CALL init_surfaces |
---|
| 1437 | ! |
---|
[46] | 1438 | !-- Initialization will completely be done by the user |
---|
| 1439 | CALL user_init_3d_model |
---|
| 1440 | |
---|
[1402] | 1441 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1442 | |
---|
[1] | 1443 | ENDIF |
---|
[1384] | 1444 | |
---|
[1402] | 1445 | CALL location_message( 'initializing statistics, boundary conditions, etc.', & |
---|
| 1446 | .FALSE. ) |
---|
[1384] | 1447 | |
---|
[667] | 1448 | ! |
---|
| 1449 | !-- Bottom boundary |
---|
| 1450 | IF ( ibc_uv_b == 0 .OR. ibc_uv_b == 2 ) THEN |
---|
[1340] | 1451 | u(nzb,:,:) = 0.0_wp |
---|
| 1452 | v(nzb,:,:) = 0.0_wp |
---|
[667] | 1453 | ENDIF |
---|
[1] | 1454 | |
---|
| 1455 | ! |
---|
[151] | 1456 | !-- Apply channel flow boundary condition |
---|
[132] | 1457 | IF ( TRIM( bc_uv_t ) == 'dirichlet_0' ) THEN |
---|
[1340] | 1458 | u(nzt+1,:,:) = 0.0_wp |
---|
| 1459 | v(nzt+1,:,:) = 0.0_wp |
---|
[132] | 1460 | ENDIF |
---|
| 1461 | |
---|
| 1462 | ! |
---|
[1] | 1463 | !-- Calculate virtual potential temperature |
---|
[1960] | 1464 | IF ( humidity ) vpt = pt * ( 1.0_wp + 0.61_wp * q ) |
---|
[1] | 1465 | |
---|
| 1466 | ! |
---|
[2696] | 1467 | !-- Store initial profiles for output purposes etc.. Please note, in case of |
---|
| 1468 | !-- initialization of u, v, w, pt, and q via output data derived from larger |
---|
| 1469 | !-- scale models, data will not be horizontally homogeneous. Actually, a mean |
---|
| 1470 | !-- profile should be calculated before. |
---|
[1] | 1471 | hom(:,1,5,:) = SPREAD( u(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1472 | hom(:,1,6,:) = SPREAD( v(:,nys,nxl), 2, statistic_regions+1 ) |
---|
[667] | 1473 | IF ( ibc_uv_b == 0 .OR. ibc_uv_b == 2) THEN |
---|
[1340] | 1474 | hom(nzb,1,5,:) = 0.0_wp |
---|
| 1475 | hom(nzb,1,6,:) = 0.0_wp |
---|
[1] | 1476 | ENDIF |
---|
| 1477 | hom(:,1,7,:) = SPREAD( pt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1478 | |
---|
[75] | 1479 | IF ( humidity ) THEN |
---|
[1] | 1480 | ! |
---|
| 1481 | !-- Store initial profile of total water content, virtual potential |
---|
| 1482 | !-- temperature |
---|
| 1483 | hom(:,1,26,:) = SPREAD( q(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1484 | hom(:,1,29,:) = SPREAD( vpt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
[2696] | 1485 | ! |
---|
[3040] | 1486 | !-- Store initial profile of mixing ratio and potential |
---|
[2696] | 1487 | !-- temperature |
---|
[3274] | 1488 | IF ( bulk_cloud_model .OR. cloud_droplets ) THEN |
---|
[1] | 1489 | hom(:,1,27,:) = SPREAD( q(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1490 | hom(:,1,28,:) = SPREAD( pt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 1491 | ENDIF |
---|
| 1492 | ENDIF |
---|
| 1493 | |
---|
[2696] | 1494 | ! |
---|
| 1495 | !-- Store initial scalar profile |
---|
[1] | 1496 | IF ( passive_scalar ) THEN |
---|
[2513] | 1497 | hom(:,1,121,:) = SPREAD( s(:,nys,nxl), 2, statistic_regions+1 ) |
---|
[1] | 1498 | ENDIF |
---|
| 1499 | |
---|
| 1500 | ! |
---|
[1400] | 1501 | !-- Initialize the random number generators (from numerical recipes) |
---|
| 1502 | CALL random_function_ini |
---|
[1429] | 1503 | |
---|
[1400] | 1504 | IF ( random_generator == 'random-parallel' ) THEN |
---|
[3241] | 1505 | CALL init_parallel_random_generator( nx, nys, nyn, nxl, nxr ) |
---|
[1400] | 1506 | ENDIF |
---|
| 1507 | ! |
---|
[1179] | 1508 | !-- Set the reference state to be used in the buoyancy terms (for ocean runs |
---|
| 1509 | !-- the reference state will be set (overwritten) in init_ocean) |
---|
| 1510 | IF ( use_single_reference_value ) THEN |
---|
[1788] | 1511 | IF ( .NOT. humidity ) THEN |
---|
[1179] | 1512 | ref_state(:) = pt_reference |
---|
| 1513 | ELSE |
---|
| 1514 | ref_state(:) = vpt_reference |
---|
| 1515 | ENDIF |
---|
| 1516 | ELSE |
---|
[1788] | 1517 | IF ( .NOT. humidity ) THEN |
---|
[1179] | 1518 | ref_state(:) = pt_init(:) |
---|
| 1519 | ELSE |
---|
| 1520 | ref_state(:) = vpt(:,nys,nxl) |
---|
| 1521 | ENDIF |
---|
| 1522 | ENDIF |
---|
[152] | 1523 | |
---|
| 1524 | ! |
---|
[707] | 1525 | !-- For the moment, vertical velocity is zero |
---|
[1340] | 1526 | w = 0.0_wp |
---|
[1] | 1527 | |
---|
| 1528 | ! |
---|
| 1529 | !-- Initialize array sums (must be defined in first call of pres) |
---|
[1340] | 1530 | sums = 0.0_wp |
---|
[1] | 1531 | |
---|
| 1532 | ! |
---|
[707] | 1533 | !-- In case of iterative solvers, p must get an initial value |
---|
[1575] | 1534 | IF ( psolver(1:9) == 'multigrid' .OR. psolver == 'sor' ) p = 0.0_wp |
---|
[707] | 1535 | ! |
---|
[1] | 1536 | !-- Impose vortex with vertical axis on the initial velocity profile |
---|
| 1537 | IF ( INDEX( initializing_actions, 'initialize_vortex' ) /= 0 ) THEN |
---|
| 1538 | CALL init_rankine |
---|
| 1539 | ENDIF |
---|
| 1540 | |
---|
| 1541 | ! |
---|
[3035] | 1542 | !-- Impose temperature anomaly (advection test only) or warm air bubble |
---|
| 1543 | !-- close to surface |
---|
| 1544 | IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 .OR. & |
---|
| 1545 | INDEX( initializing_actions, 'initialize_bubble' ) /= 0 ) THEN |
---|
[1] | 1546 | CALL init_pt_anomaly |
---|
| 1547 | ENDIF |
---|
[3035] | 1548 | |
---|
[1] | 1549 | ! |
---|
| 1550 | !-- If required, change the surface temperature at the start of the 3D run |
---|
[1340] | 1551 | IF ( pt_surface_initial_change /= 0.0_wp ) THEN |
---|
[1] | 1552 | pt(nzb,:,:) = pt(nzb,:,:) + pt_surface_initial_change |
---|
| 1553 | ENDIF |
---|
| 1554 | |
---|
| 1555 | ! |
---|
| 1556 | !-- If required, change the surface humidity/scalar at the start of the 3D |
---|
| 1557 | !-- run |
---|
[1960] | 1558 | IF ( humidity .AND. q_surface_initial_change /= 0.0_wp ) & |
---|
[1] | 1559 | q(nzb,:,:) = q(nzb,:,:) + q_surface_initial_change |
---|
[1960] | 1560 | |
---|
| 1561 | IF ( passive_scalar .AND. s_surface_initial_change /= 0.0_wp ) & |
---|
| 1562 | s(nzb,:,:) = s(nzb,:,:) + s_surface_initial_change |
---|
| 1563 | |
---|
[1] | 1564 | |
---|
| 1565 | ! |
---|
| 1566 | !-- Initialize old and new time levels. |
---|
[2696] | 1567 | tpt_m = 0.0_wp; tu_m = 0.0_wp; tv_m = 0.0_wp; tw_m = 0.0_wp |
---|
| 1568 | pt_p = pt; u_p = u; v_p = v; w_p = w |
---|
[1] | 1569 | |
---|
[1960] | 1570 | IF ( humidity ) THEN |
---|
[1340] | 1571 | tq_m = 0.0_wp |
---|
[1] | 1572 | q_p = q |
---|
| 1573 | ENDIF |
---|
[1960] | 1574 | |
---|
| 1575 | IF ( passive_scalar ) THEN |
---|
| 1576 | ts_m = 0.0_wp |
---|
| 1577 | s_p = s |
---|
| 1578 | ENDIF |
---|
[1] | 1579 | |
---|
[1402] | 1580 | CALL location_message( 'finished', .TRUE. ) |
---|
[94] | 1581 | |
---|
[1788] | 1582 | ELSEIF ( TRIM( initializing_actions ) == 'read_restart_data' .OR. & |
---|
[2232] | 1583 | TRIM( initializing_actions ) == 'cyclic_fill' ) & |
---|
[1] | 1584 | THEN |
---|
[1384] | 1585 | |
---|
[1402] | 1586 | CALL location_message( 'initializing in case of restart / cyclic_fill', & |
---|
| 1587 | .FALSE. ) |
---|
[1] | 1588 | ! |
---|
[2232] | 1589 | !-- Initialize surface elements and its attributes, e.g. heat- and |
---|
| 1590 | !-- momentumfluxes, roughness, scaling parameters. As number of surface |
---|
| 1591 | !-- elements might be different between runs, e.g. in case of cyclic fill, |
---|
| 1592 | !-- and not all surface elements are read, surface elements need to be |
---|
| 1593 | !-- initialized before. |
---|
| 1594 | CALL init_surfaces |
---|
| 1595 | ! |
---|
[767] | 1596 | !-- When reading data for cyclic fill of 3D prerun data files, read |
---|
| 1597 | !-- some of the global variables from the restart file which are required |
---|
| 1598 | !-- for initializing the inflow |
---|
[328] | 1599 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' ) THEN |
---|
[559] | 1600 | |
---|
[759] | 1601 | DO i = 0, io_blocks-1 |
---|
| 1602 | IF ( i == io_group ) THEN |
---|
[2894] | 1603 | CALL rrd_read_parts_of_global |
---|
[759] | 1604 | ENDIF |
---|
| 1605 | #if defined( __parallel ) |
---|
| 1606 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1607 | #endif |
---|
| 1608 | ENDDO |
---|
[328] | 1609 | |
---|
[767] | 1610 | ENDIF |
---|
| 1611 | |
---|
[151] | 1612 | ! |
---|
[2894] | 1613 | !-- Read processor specific binary data from restart file |
---|
[767] | 1614 | DO i = 0, io_blocks-1 |
---|
| 1615 | IF ( i == io_group ) THEN |
---|
[2894] | 1616 | CALL rrd_local |
---|
[767] | 1617 | ENDIF |
---|
| 1618 | #if defined( __parallel ) |
---|
| 1619 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1620 | #endif |
---|
| 1621 | ENDDO |
---|
| 1622 | |
---|
[328] | 1623 | ! |
---|
[2550] | 1624 | !-- In case of complex terrain and cyclic fill method as initialization, |
---|
| 1625 | !-- shift initial data in the vertical direction for each point in the |
---|
| 1626 | !-- x-y-plane depending on local surface height |
---|
| 1627 | IF ( complex_terrain .AND. & |
---|
| 1628 | TRIM( initializing_actions ) == 'cyclic_fill' ) THEN |
---|
| 1629 | DO i = nxlg, nxrg |
---|
| 1630 | DO j = nysg, nyng |
---|
[2698] | 1631 | nz_u_shift = get_topography_top_index_ji( j, i, 'u' ) |
---|
| 1632 | nz_v_shift = get_topography_top_index_ji( j, i, 'v' ) |
---|
| 1633 | nz_w_shift = get_topography_top_index_ji( j, i, 'w' ) |
---|
| 1634 | nz_s_shift = get_topography_top_index_ji( j, i, 's' ) |
---|
[2550] | 1635 | |
---|
| 1636 | u(nz_u_shift:nzt+1,j,i) = u(0:nzt+1-nz_u_shift,j,i) |
---|
| 1637 | |
---|
| 1638 | v(nz_v_shift:nzt+1,j,i) = v(0:nzt+1-nz_v_shift,j,i) |
---|
| 1639 | |
---|
| 1640 | w(nz_w_shift:nzt+1,j,i) = w(0:nzt+1-nz_w_shift,j,i) |
---|
| 1641 | |
---|
| 1642 | p(nz_s_shift:nzt+1,j,i) = p(0:nzt+1-nz_s_shift,j,i) |
---|
| 1643 | pt(nz_s_shift:nzt+1,j,i) = pt(0:nzt+1-nz_s_shift,j,i) |
---|
| 1644 | ENDDO |
---|
| 1645 | ENDDO |
---|
| 1646 | ENDIF |
---|
| 1647 | |
---|
| 1648 | ! |
---|
[767] | 1649 | !-- Initialization of the turbulence recycling method |
---|
[1788] | 1650 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' .AND. & |
---|
[767] | 1651 | turbulent_inflow ) THEN |
---|
| 1652 | ! |
---|
| 1653 | !-- First store the profiles to be used at the inflow. |
---|
| 1654 | !-- These profiles are the (temporally) and horizontally averaged vertical |
---|
| 1655 | !-- profiles from the prerun. Alternatively, prescribed profiles |
---|
| 1656 | !-- for u,v-components can be used. |
---|
[3288] | 1657 | ALLOCATE( mean_inflow_profiles(nzb:nzt+1,1:num_mean_inflow_profiles) ) |
---|
[151] | 1658 | |
---|
[767] | 1659 | IF ( use_prescribed_profile_data ) THEN |
---|
| 1660 | mean_inflow_profiles(:,1) = u_init ! u |
---|
| 1661 | mean_inflow_profiles(:,2) = v_init ! v |
---|
| 1662 | ELSE |
---|
[328] | 1663 | mean_inflow_profiles(:,1) = hom_sum(:,1,0) ! u |
---|
| 1664 | mean_inflow_profiles(:,2) = hom_sum(:,2,0) ! v |
---|
[767] | 1665 | ENDIF |
---|
| 1666 | mean_inflow_profiles(:,4) = hom_sum(:,4,0) ! pt |
---|
[1960] | 1667 | IF ( humidity ) & |
---|
| 1668 | mean_inflow_profiles(:,6) = hom_sum(:,41,0) ! q |
---|
| 1669 | IF ( passive_scalar ) & |
---|
| 1670 | mean_inflow_profiles(:,7) = hom_sum(:,115,0) ! s |
---|
[2550] | 1671 | ! |
---|
| 1672 | !-- In case of complex terrain, determine vertical displacement at inflow |
---|
| 1673 | !-- boundary and adjust mean inflow profiles |
---|
| 1674 | IF ( complex_terrain ) THEN |
---|
| 1675 | IF ( nxlg <= 0 .AND. nxrg >= 0 .AND. nysg <= 0 .AND. nyng >= 0 ) THEN |
---|
[2698] | 1676 | nz_u_shift_l = get_topography_top_index_ji( 0, 0, 'u' ) |
---|
| 1677 | nz_v_shift_l = get_topography_top_index_ji( 0, 0, 'v' ) |
---|
| 1678 | nz_w_shift_l = get_topography_top_index_ji( 0, 0, 'w' ) |
---|
| 1679 | nz_s_shift_l = get_topography_top_index_ji( 0, 0, 's' ) |
---|
[2550] | 1680 | ELSE |
---|
| 1681 | nz_u_shift_l = 0 |
---|
| 1682 | nz_v_shift_l = 0 |
---|
| 1683 | nz_w_shift_l = 0 |
---|
| 1684 | nz_s_shift_l = 0 |
---|
| 1685 | ENDIF |
---|
[151] | 1686 | |
---|
[2550] | 1687 | #if defined( __parallel ) |
---|
| 1688 | CALL MPI_ALLREDUCE(nz_u_shift_l, nz_u_shift, 1, MPI_INTEGER, & |
---|
| 1689 | MPI_MAX, comm2d, ierr) |
---|
| 1690 | CALL MPI_ALLREDUCE(nz_v_shift_l, nz_v_shift, 1, MPI_INTEGER, & |
---|
| 1691 | MPI_MAX, comm2d, ierr) |
---|
| 1692 | CALL MPI_ALLREDUCE(nz_w_shift_l, nz_w_shift, 1, MPI_INTEGER, & |
---|
| 1693 | MPI_MAX, comm2d, ierr) |
---|
| 1694 | CALL MPI_ALLREDUCE(nz_s_shift_l, nz_s_shift, 1, MPI_INTEGER, & |
---|
| 1695 | MPI_MAX, comm2d, ierr) |
---|
| 1696 | #else |
---|
| 1697 | nz_u_shift = nz_u_shift_l |
---|
| 1698 | nz_v_shift = nz_v_shift_l |
---|
| 1699 | nz_w_shift = nz_w_shift_l |
---|
| 1700 | nz_s_shift = nz_s_shift_l |
---|
| 1701 | #endif |
---|
| 1702 | |
---|
| 1703 | mean_inflow_profiles(:,1) = 0.0_wp |
---|
| 1704 | mean_inflow_profiles(nz_u_shift:nzt+1,1) = hom_sum(0:nzt+1-nz_u_shift,1,0) ! u |
---|
| 1705 | |
---|
| 1706 | mean_inflow_profiles(:,2) = 0.0_wp |
---|
| 1707 | mean_inflow_profiles(nz_v_shift:nzt+1,2) = hom_sum(0:nzt+1-nz_v_shift,2,0) ! v |
---|
| 1708 | |
---|
| 1709 | mean_inflow_profiles(nz_s_shift:nzt+1,4) = hom_sum(0:nzt+1-nz_s_shift,4,0) ! pt |
---|
| 1710 | |
---|
| 1711 | ENDIF |
---|
| 1712 | |
---|
[151] | 1713 | ! |
---|
[767] | 1714 | !-- If necessary, adjust the horizontal flow field to the prescribed |
---|
| 1715 | !-- profiles |
---|
| 1716 | IF ( use_prescribed_profile_data ) THEN |
---|
| 1717 | DO i = nxlg, nxrg |
---|
[667] | 1718 | DO j = nysg, nyng |
---|
[328] | 1719 | DO k = nzb, nzt+1 |
---|
[767] | 1720 | u(k,j,i) = u(k,j,i) - hom_sum(k,1,0) + u_init(k) |
---|
| 1721 | v(k,j,i) = v(k,j,i) - hom_sum(k,2,0) + v_init(k) |
---|
[328] | 1722 | ENDDO |
---|
[151] | 1723 | ENDDO |
---|
[767] | 1724 | ENDDO |
---|
| 1725 | ENDIF |
---|
[151] | 1726 | |
---|
| 1727 | ! |
---|
[767] | 1728 | !-- Use these mean profiles at the inflow (provided that Dirichlet |
---|
| 1729 | !-- conditions are used) |
---|
[3182] | 1730 | IF ( bc_dirichlet_l ) THEN |
---|
[767] | 1731 | DO j = nysg, nyng |
---|
| 1732 | DO k = nzb, nzt+1 |
---|
| 1733 | u(k,j,nxlg:-1) = mean_inflow_profiles(k,1) |
---|
| 1734 | v(k,j,nxlg:-1) = mean_inflow_profiles(k,2) |
---|
[1340] | 1735 | w(k,j,nxlg:-1) = 0.0_wp |
---|
[767] | 1736 | pt(k,j,nxlg:-1) = mean_inflow_profiles(k,4) |
---|
[1960] | 1737 | IF ( humidity ) & |
---|
[1615] | 1738 | q(k,j,nxlg:-1) = mean_inflow_profiles(k,6) |
---|
[1960] | 1739 | IF ( passive_scalar ) & |
---|
| 1740 | s(k,j,nxlg:-1) = mean_inflow_profiles(k,7) |
---|
[767] | 1741 | ENDDO |
---|
| 1742 | ENDDO |
---|
| 1743 | ENDIF |
---|
| 1744 | |
---|
[151] | 1745 | ! |
---|
[767] | 1746 | !-- Calculate the damping factors to be used at the inflow. For a |
---|
| 1747 | !-- turbulent inflow the turbulent fluctuations have to be limited |
---|
| 1748 | !-- vertically because otherwise the turbulent inflow layer will grow |
---|
| 1749 | !-- in time. |
---|
[1340] | 1750 | IF ( inflow_damping_height == 9999999.9_wp ) THEN |
---|
[767] | 1751 | ! |
---|
| 1752 | !-- Default: use the inversion height calculated by the prerun; if |
---|
| 1753 | !-- this is zero, inflow_damping_height must be explicitly |
---|
| 1754 | !-- specified. |
---|
[1340] | 1755 | IF ( hom_sum(nzb+6,pr_palm,0) /= 0.0_wp ) THEN |
---|
[767] | 1756 | inflow_damping_height = hom_sum(nzb+6,pr_palm,0) |
---|
| 1757 | ELSE |
---|
[1788] | 1758 | WRITE( message_string, * ) 'inflow_damping_height must be ', & |
---|
| 1759 | 'explicitly specified because&the inversion height ', & |
---|
[767] | 1760 | 'calculated by the prerun is zero.' |
---|
| 1761 | CALL message( 'init_3d_model', 'PA0318', 1, 2, 0, 6, 0 ) |
---|
[292] | 1762 | ENDIF |
---|
[151] | 1763 | |
---|
[767] | 1764 | ENDIF |
---|
| 1765 | |
---|
[1340] | 1766 | IF ( inflow_damping_width == 9999999.9_wp ) THEN |
---|
[151] | 1767 | ! |
---|
[767] | 1768 | !-- Default for the transition range: one tenth of the undamped |
---|
| 1769 | !-- layer |
---|
[1340] | 1770 | inflow_damping_width = 0.1_wp * inflow_damping_height |
---|
[151] | 1771 | |
---|
[767] | 1772 | ENDIF |
---|
[151] | 1773 | |
---|
[767] | 1774 | ALLOCATE( inflow_damping_factor(nzb:nzt+1) ) |
---|
[151] | 1775 | |
---|
[767] | 1776 | DO k = nzb, nzt+1 |
---|
[151] | 1777 | |
---|
[767] | 1778 | IF ( zu(k) <= inflow_damping_height ) THEN |
---|
[1340] | 1779 | inflow_damping_factor(k) = 1.0_wp |
---|
[996] | 1780 | ELSEIF ( zu(k) <= ( inflow_damping_height + inflow_damping_width ) ) THEN |
---|
[1340] | 1781 | inflow_damping_factor(k) = 1.0_wp - & |
---|
[996] | 1782 | ( zu(k) - inflow_damping_height ) / & |
---|
| 1783 | inflow_damping_width |
---|
[767] | 1784 | ELSE |
---|
[1340] | 1785 | inflow_damping_factor(k) = 0.0_wp |
---|
[767] | 1786 | ENDIF |
---|
[151] | 1787 | |
---|
[767] | 1788 | ENDDO |
---|
[151] | 1789 | |
---|
[147] | 1790 | ENDIF |
---|
| 1791 | |
---|
[152] | 1792 | ! |
---|
[2696] | 1793 | !-- Inside buildings set velocities back to zero |
---|
[1788] | 1794 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' .AND. & |
---|
[359] | 1795 | topography /= 'flat' ) THEN |
---|
| 1796 | ! |
---|
[2696] | 1797 | !-- Inside buildings set velocities back to zero. |
---|
| 1798 | !-- Other scalars (pt, q, s, p, sa, ...) are ignored at present, |
---|
[359] | 1799 | !-- maybe revise later. |
---|
[1001] | 1800 | DO i = nxlg, nxrg |
---|
| 1801 | DO j = nysg, nyng |
---|
[2232] | 1802 | DO k = nzb, nzt |
---|
| 1803 | u(k,j,i) = MERGE( u(k,j,i), 0.0_wp, & |
---|
| 1804 | BTEST( wall_flags_0(k,j,i), 1 ) ) |
---|
| 1805 | v(k,j,i) = MERGE( v(k,j,i), 0.0_wp, & |
---|
| 1806 | BTEST( wall_flags_0(k,j,i), 2 ) ) |
---|
| 1807 | w(k,j,i) = MERGE( w(k,j,i), 0.0_wp, & |
---|
| 1808 | BTEST( wall_flags_0(k,j,i), 3 ) ) |
---|
| 1809 | ENDDO |
---|
[359] | 1810 | ENDDO |
---|
[1001] | 1811 | ENDDO |
---|
[359] | 1812 | |
---|
| 1813 | ENDIF |
---|
| 1814 | |
---|
| 1815 | ! |
---|
[1] | 1816 | !-- Calculate initial temperature field and other constants used in case |
---|
| 1817 | !-- of a sloping surface |
---|
| 1818 | IF ( sloping_surface ) CALL init_slope |
---|
| 1819 | |
---|
| 1820 | ! |
---|
| 1821 | !-- Initialize new time levels (only done in order to set boundary values |
---|
| 1822 | !-- including ghost points) |
---|
[2696] | 1823 | pt_p = pt; u_p = u; v_p = v; w_p = w |
---|
[1960] | 1824 | IF ( humidity ) THEN |
---|
[1053] | 1825 | q_p = q |
---|
| 1826 | ENDIF |
---|
[1960] | 1827 | IF ( passive_scalar ) s_p = s |
---|
[181] | 1828 | ! |
---|
| 1829 | !-- Allthough tendency arrays are set in prognostic_equations, they have |
---|
| 1830 | !-- have to be predefined here because they are used (but multiplied with 0) |
---|
| 1831 | !-- there before they are set. |
---|
[2696] | 1832 | tpt_m = 0.0_wp; tu_m = 0.0_wp; tv_m = 0.0_wp; tw_m = 0.0_wp |
---|
[1960] | 1833 | IF ( humidity ) THEN |
---|
[1340] | 1834 | tq_m = 0.0_wp |
---|
[1053] | 1835 | ENDIF |
---|
[1960] | 1836 | IF ( passive_scalar ) ts_m = 0.0_wp |
---|
[2259] | 1837 | ! |
---|
| 1838 | !-- Initialize synthetic turbulence generator in case of restart. |
---|
| 1839 | IF ( TRIM( initializing_actions ) == 'read_restart_data' .AND. & |
---|
[2776] | 1840 | use_syn_turb_gen ) CALL stg_init |
---|
[181] | 1841 | |
---|
[1402] | 1842 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 1843 | |
---|
[1] | 1844 | ELSE |
---|
| 1845 | ! |
---|
| 1846 | !-- Actually this part of the programm should not be reached |
---|
[254] | 1847 | message_string = 'unknown initializing problem' |
---|
| 1848 | CALL message( 'init_3d_model', 'PA0193', 1, 2, 0, 6, 0 ) |
---|
[1] | 1849 | ENDIF |
---|
| 1850 | |
---|
[2696] | 1851 | ! |
---|
| 1852 | !-- Initialize TKE, Kh and Km |
---|
| 1853 | CALL tcm_init |
---|
[151] | 1854 | |
---|
[2696] | 1855 | |
---|
[151] | 1856 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
[1] | 1857 | ! |
---|
[151] | 1858 | !-- Initialize old timelevels needed for radiation boundary conditions |
---|
[3182] | 1859 | IF ( bc_radiation_l ) THEN |
---|
[151] | 1860 | u_m_l(:,:,:) = u(:,:,1:2) |
---|
| 1861 | v_m_l(:,:,:) = v(:,:,0:1) |
---|
| 1862 | w_m_l(:,:,:) = w(:,:,0:1) |
---|
| 1863 | ENDIF |
---|
[3182] | 1864 | IF ( bc_radiation_r ) THEN |
---|
[151] | 1865 | u_m_r(:,:,:) = u(:,:,nx-1:nx) |
---|
| 1866 | v_m_r(:,:,:) = v(:,:,nx-1:nx) |
---|
| 1867 | w_m_r(:,:,:) = w(:,:,nx-1:nx) |
---|
| 1868 | ENDIF |
---|
[3182] | 1869 | IF ( bc_radiation_s ) THEN |
---|
[151] | 1870 | u_m_s(:,:,:) = u(:,0:1,:) |
---|
| 1871 | v_m_s(:,:,:) = v(:,1:2,:) |
---|
| 1872 | w_m_s(:,:,:) = w(:,0:1,:) |
---|
| 1873 | ENDIF |
---|
[3182] | 1874 | IF ( bc_radiation_n ) THEN |
---|
[151] | 1875 | u_m_n(:,:,:) = u(:,ny-1:ny,:) |
---|
| 1876 | v_m_n(:,:,:) = v(:,ny-1:ny,:) |
---|
| 1877 | w_m_n(:,:,:) = w(:,ny-1:ny,:) |
---|
| 1878 | ENDIF |
---|
[667] | 1879 | |
---|
[151] | 1880 | ENDIF |
---|
[680] | 1881 | |
---|
[667] | 1882 | ! |
---|
| 1883 | !-- Calculate the initial volume flow at the right and north boundary |
---|
[709] | 1884 | IF ( conserve_volume_flow ) THEN |
---|
[151] | 1885 | |
---|
[767] | 1886 | IF ( use_prescribed_profile_data ) THEN |
---|
[667] | 1887 | |
---|
[1340] | 1888 | volume_flow_initial_l = 0.0_wp |
---|
| 1889 | volume_flow_area_l = 0.0_wp |
---|
[732] | 1890 | |
---|
[667] | 1891 | IF ( nxr == nx ) THEN |
---|
| 1892 | DO j = nys, nyn |
---|
[2232] | 1893 | DO k = nzb+1, nzt |
---|
[1788] | 1894 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
[2232] | 1895 | u_init(k) * dzw(k) & |
---|
| 1896 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1897 | BTEST( wall_flags_0(k,j,nxr), 1 )& |
---|
| 1898 | ) |
---|
| 1899 | |
---|
| 1900 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzw(k) & |
---|
| 1901 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1902 | BTEST( wall_flags_0(k,j,nxr), 1 )& |
---|
| 1903 | ) |
---|
[767] | 1904 | ENDDO |
---|
| 1905 | ENDDO |
---|
| 1906 | ENDIF |
---|
| 1907 | |
---|
| 1908 | IF ( nyn == ny ) THEN |
---|
| 1909 | DO i = nxl, nxr |
---|
[2232] | 1910 | DO k = nzb+1, nzt |
---|
| 1911 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
| 1912 | v_init(k) * dzw(k) & |
---|
| 1913 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1914 | BTEST( wall_flags_0(k,nyn,i), 2 )& |
---|
| 1915 | ) |
---|
| 1916 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzw(k) & |
---|
| 1917 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1918 | BTEST( wall_flags_0(k,nyn,i), 2 )& |
---|
| 1919 | ) |
---|
[767] | 1920 | ENDDO |
---|
| 1921 | ENDDO |
---|
| 1922 | ENDIF |
---|
| 1923 | |
---|
| 1924 | #if defined( __parallel ) |
---|
| 1925 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 1926 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1927 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 1928 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1929 | |
---|
| 1930 | #else |
---|
| 1931 | volume_flow_initial = volume_flow_initial_l |
---|
| 1932 | volume_flow_area = volume_flow_area_l |
---|
| 1933 | #endif |
---|
| 1934 | |
---|
| 1935 | ELSEIF ( TRIM( initializing_actions ) == 'cyclic_fill' ) THEN |
---|
| 1936 | |
---|
[1340] | 1937 | volume_flow_initial_l = 0.0_wp |
---|
| 1938 | volume_flow_area_l = 0.0_wp |
---|
[767] | 1939 | |
---|
| 1940 | IF ( nxr == nx ) THEN |
---|
| 1941 | DO j = nys, nyn |
---|
[2232] | 1942 | DO k = nzb+1, nzt |
---|
[1788] | 1943 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
[2232] | 1944 | hom_sum(k,1,0) * dzw(k) & |
---|
| 1945 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1946 | BTEST( wall_flags_0(k,j,nx), 1 ) & |
---|
| 1947 | ) |
---|
| 1948 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzw(k) & |
---|
| 1949 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1950 | BTEST( wall_flags_0(k,j,nx), 1 ) & |
---|
| 1951 | ) |
---|
[667] | 1952 | ENDDO |
---|
| 1953 | ENDDO |
---|
| 1954 | ENDIF |
---|
| 1955 | |
---|
| 1956 | IF ( nyn == ny ) THEN |
---|
| 1957 | DO i = nxl, nxr |
---|
[2232] | 1958 | DO k = nzb+1, nzt |
---|
[1788] | 1959 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
[2232] | 1960 | hom_sum(k,2,0) * dzw(k) & |
---|
| 1961 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1962 | BTEST( wall_flags_0(k,ny,i), 2 ) & |
---|
| 1963 | ) |
---|
| 1964 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzw(k) & |
---|
| 1965 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1966 | BTEST( wall_flags_0(k,ny,i), 2 ) & |
---|
| 1967 | ) |
---|
[667] | 1968 | ENDDO |
---|
| 1969 | ENDDO |
---|
| 1970 | ENDIF |
---|
| 1971 | |
---|
[732] | 1972 | #if defined( __parallel ) |
---|
| 1973 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 1974 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1975 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 1976 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1977 | |
---|
| 1978 | #else |
---|
| 1979 | volume_flow_initial = volume_flow_initial_l |
---|
| 1980 | volume_flow_area = volume_flow_area_l |
---|
| 1981 | #endif |
---|
| 1982 | |
---|
[667] | 1983 | ELSEIF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
| 1984 | |
---|
[1340] | 1985 | volume_flow_initial_l = 0.0_wp |
---|
| 1986 | volume_flow_area_l = 0.0_wp |
---|
[732] | 1987 | |
---|
[667] | 1988 | IF ( nxr == nx ) THEN |
---|
| 1989 | DO j = nys, nyn |
---|
[2232] | 1990 | DO k = nzb+1, nzt |
---|
| 1991 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
| 1992 | u(k,j,nx) * dzw(k) & |
---|
| 1993 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1994 | BTEST( wall_flags_0(k,j,nx), 1 ) & |
---|
| 1995 | ) |
---|
| 1996 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzw(k) & |
---|
| 1997 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1998 | BTEST( wall_flags_0(k,j,nx), 1 ) & |
---|
| 1999 | ) |
---|
[667] | 2000 | ENDDO |
---|
| 2001 | ENDDO |
---|
| 2002 | ENDIF |
---|
| 2003 | |
---|
| 2004 | IF ( nyn == ny ) THEN |
---|
| 2005 | DO i = nxl, nxr |
---|
[2232] | 2006 | DO k = nzb+1, nzt |
---|
[1788] | 2007 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
[2232] | 2008 | v(k,ny,i) * dzw(k) & |
---|
| 2009 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 2010 | BTEST( wall_flags_0(k,ny,i), 2 ) & |
---|
| 2011 | ) |
---|
| 2012 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzw(k) & |
---|
| 2013 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 2014 | BTEST( wall_flags_0(k,ny,i), 2 ) & |
---|
| 2015 | ) |
---|
[667] | 2016 | ENDDO |
---|
| 2017 | ENDDO |
---|
| 2018 | ENDIF |
---|
| 2019 | |
---|
| 2020 | #if defined( __parallel ) |
---|
[732] | 2021 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 2022 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 2023 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 2024 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
[667] | 2025 | |
---|
| 2026 | #else |
---|
[732] | 2027 | volume_flow_initial = volume_flow_initial_l |
---|
| 2028 | volume_flow_area = volume_flow_area_l |
---|
[667] | 2029 | #endif |
---|
| 2030 | |
---|
[732] | 2031 | ENDIF |
---|
| 2032 | |
---|
[151] | 2033 | ! |
---|
[709] | 2034 | !-- In case of 'bulk_velocity' mode, volume_flow_initial is calculated |
---|
| 2035 | !-- from u|v_bulk instead |
---|
[680] | 2036 | IF ( TRIM( conserve_volume_flow_mode ) == 'bulk_velocity' ) THEN |
---|
| 2037 | volume_flow_initial(1) = u_bulk * volume_flow_area(1) |
---|
| 2038 | volume_flow_initial(2) = v_bulk * volume_flow_area(2) |
---|
| 2039 | ENDIF |
---|
[667] | 2040 | |
---|
[680] | 2041 | ENDIF |
---|
[2232] | 2042 | ! |
---|
[2618] | 2043 | !-- Finally, if random_heatflux is set, disturb shf at horizontal |
---|
| 2044 | !-- surfaces. Actually, this should be done in surface_mod, where all other |
---|
| 2045 | !-- initializations of surface quantities are done. However, this |
---|
| 2046 | !-- would create a ring dependency, hence, it is done here. Maybe delete |
---|
| 2047 | !-- disturb_heatflux and tranfer the respective code directly into the |
---|
| 2048 | !-- initialization in surface_mod. |
---|
[2232] | 2049 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. & |
---|
| 2050 | TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN |
---|
[2618] | 2051 | |
---|
[2232] | 2052 | IF ( use_surface_fluxes .AND. constant_heatflux .AND. & |
---|
| 2053 | random_heatflux ) THEN |
---|
| 2054 | IF ( surf_def_h(0)%ns >= 1 ) CALL disturb_heatflux( surf_def_h(0) ) |
---|
| 2055 | IF ( surf_lsm_h%ns >= 1 ) CALL disturb_heatflux( surf_lsm_h ) |
---|
| 2056 | IF ( surf_usm_h%ns >= 1 ) CALL disturb_heatflux( surf_usm_h ) |
---|
| 2057 | ENDIF |
---|
| 2058 | ENDIF |
---|
[680] | 2059 | |
---|
[787] | 2060 | ! |
---|
[2696] | 2061 | !-- Before initializing further modules, compute total sum of active mask |
---|
| 2062 | !-- grid points and the mean surface level height for each statistic region. |
---|
| 2063 | !-- ngp_2dh: number of grid points of a horizontal cross section through the |
---|
| 2064 | !-- total domain |
---|
| 2065 | !-- ngp_3d: number of grid points of the total domain |
---|
| 2066 | ngp_2dh_outer_l = 0 |
---|
| 2067 | ngp_2dh_outer = 0 |
---|
| 2068 | ngp_2dh_s_inner_l = 0 |
---|
| 2069 | ngp_2dh_s_inner = 0 |
---|
| 2070 | ngp_2dh_l = 0 |
---|
| 2071 | ngp_2dh = 0 |
---|
| 2072 | ngp_3d_inner_l = 0.0_wp |
---|
| 2073 | ngp_3d_inner = 0 |
---|
| 2074 | ngp_3d = 0 |
---|
| 2075 | ngp_sums = ( nz + 2 ) * ( pr_palm + max_pr_user ) |
---|
| 2076 | |
---|
| 2077 | mean_surface_level_height = 0.0_wp |
---|
| 2078 | mean_surface_level_height_l = 0.0_wp |
---|
| 2079 | ! |
---|
| 2080 | !-- Pre-set masks for regional statistics. Default is the total model domain. |
---|
| 2081 | !-- Ghost points are excluded because counting values at the ghost boundaries |
---|
| 2082 | !-- would bias the statistics |
---|
| 2083 | rmask = 1.0_wp |
---|
| 2084 | rmask(:,nxlg:nxl-1,:) = 0.0_wp; rmask(:,nxr+1:nxrg,:) = 0.0_wp |
---|
| 2085 | rmask(nysg:nys-1,:,:) = 0.0_wp; rmask(nyn+1:nyng,:,:) = 0.0_wp |
---|
[3234] | 2086 | |
---|
[2696] | 2087 | ! |
---|
[3234] | 2088 | !-- Temporary solution to add LSM and radiation time series to the default |
---|
| 2089 | !-- output |
---|
| 2090 | IF ( land_surface .OR. radiation ) THEN |
---|
| 2091 | IF ( TRIM( radiation_scheme ) == 'rrtmg' ) THEN |
---|
| 2092 | dots_num = dots_num + 15 |
---|
| 2093 | ELSE |
---|
| 2094 | dots_num = dots_num + 11 |
---|
| 2095 | ENDIF |
---|
| 2096 | ENDIF |
---|
| 2097 | ! |
---|
[2867] | 2098 | !-- User-defined initializing actions |
---|
| 2099 | CALL user_init |
---|
| 2100 | ! |
---|
[2696] | 2101 | !-- To do: New concept for these non-topography grid points! |
---|
| 2102 | DO sr = 0, statistic_regions |
---|
| 2103 | DO i = nxl, nxr |
---|
| 2104 | DO j = nys, nyn |
---|
| 2105 | IF ( rmask(j,i,sr) == 1.0_wp ) THEN |
---|
| 2106 | ! |
---|
| 2107 | !-- All xy-grid points |
---|
| 2108 | ngp_2dh_l(sr) = ngp_2dh_l(sr) + 1 |
---|
| 2109 | ! |
---|
| 2110 | !-- Determine mean surface-level height. In case of downward- |
---|
| 2111 | !-- facing walls are present, more than one surface level exist. |
---|
| 2112 | !-- In this case, use the lowest surface-level height. |
---|
| 2113 | IF ( surf_def_h(0)%start_index(j,i) <= & |
---|
| 2114 | surf_def_h(0)%end_index(j,i) ) THEN |
---|
| 2115 | m = surf_def_h(0)%start_index(j,i) |
---|
| 2116 | k = surf_def_h(0)%k(m) |
---|
| 2117 | mean_surface_level_height_l(sr) = & |
---|
| 2118 | mean_surface_level_height_l(sr) + zw(k-1) |
---|
| 2119 | ENDIF |
---|
| 2120 | IF ( surf_lsm_h%start_index(j,i) <= & |
---|
| 2121 | surf_lsm_h%end_index(j,i) ) THEN |
---|
| 2122 | m = surf_lsm_h%start_index(j,i) |
---|
| 2123 | k = surf_lsm_h%k(m) |
---|
| 2124 | mean_surface_level_height_l(sr) = & |
---|
| 2125 | mean_surface_level_height_l(sr) + zw(k-1) |
---|
| 2126 | ENDIF |
---|
| 2127 | IF ( surf_usm_h%start_index(j,i) <= & |
---|
| 2128 | surf_usm_h%end_index(j,i) ) THEN |
---|
| 2129 | m = surf_usm_h%start_index(j,i) |
---|
| 2130 | k = surf_usm_h%k(m) |
---|
| 2131 | mean_surface_level_height_l(sr) = & |
---|
| 2132 | mean_surface_level_height_l(sr) + zw(k-1) |
---|
| 2133 | ENDIF |
---|
| 2134 | |
---|
| 2135 | k_surf = k - 1 |
---|
| 2136 | |
---|
| 2137 | DO k = nzb, nzt+1 |
---|
| 2138 | ! |
---|
| 2139 | !-- xy-grid points above topography |
---|
| 2140 | ngp_2dh_outer_l(k,sr) = ngp_2dh_outer_l(k,sr) + & |
---|
| 2141 | MERGE( 1, 0, BTEST( wall_flags_0(k,j,i), 24 ) ) |
---|
| 2142 | |
---|
| 2143 | ngp_2dh_s_inner_l(k,sr) = ngp_2dh_s_inner_l(k,sr) + & |
---|
| 2144 | MERGE( 1, 0, BTEST( wall_flags_0(k,j,i), 22 ) ) |
---|
| 2145 | |
---|
| 2146 | ENDDO |
---|
| 2147 | ! |
---|
| 2148 | !-- All grid points of the total domain above topography |
---|
| 2149 | ngp_3d_inner_l(sr) = ngp_3d_inner_l(sr) + ( nz - k_surf + 2 ) |
---|
| 2150 | |
---|
| 2151 | |
---|
| 2152 | |
---|
| 2153 | ENDIF |
---|
| 2154 | ENDDO |
---|
| 2155 | ENDDO |
---|
| 2156 | ENDDO |
---|
[2864] | 2157 | ! |
---|
| 2158 | !-- Initialize arrays encompassing number of grid-points in inner and outer |
---|
| 2159 | !-- domains, statistic regions, etc. Mainly used for horizontal averaging |
---|
| 2160 | !-- of turbulence statistics. Please note, user_init must be called before |
---|
| 2161 | !-- doing this. |
---|
[2696] | 2162 | sr = statistic_regions + 1 |
---|
| 2163 | #if defined( __parallel ) |
---|
| 2164 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 2165 | CALL MPI_ALLREDUCE( ngp_2dh_l(0), ngp_2dh(0), sr, MPI_INTEGER, MPI_SUM, & |
---|
| 2166 | comm2d, ierr ) |
---|
| 2167 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 2168 | CALL MPI_ALLREDUCE( ngp_2dh_outer_l(0,0), ngp_2dh_outer(0,0), (nz+2)*sr, & |
---|
| 2169 | MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
| 2170 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 2171 | CALL MPI_ALLREDUCE( ngp_2dh_s_inner_l(0,0), ngp_2dh_s_inner(0,0), & |
---|
| 2172 | (nz+2)*sr, MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
| 2173 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 2174 | CALL MPI_ALLREDUCE( ngp_3d_inner_l(0), ngp_3d_inner_tmp(0), sr, MPI_REAL, & |
---|
| 2175 | MPI_SUM, comm2d, ierr ) |
---|
| 2176 | ngp_3d_inner = INT( ngp_3d_inner_tmp, KIND = SELECTED_INT_KIND( 18 ) ) |
---|
| 2177 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 2178 | CALL MPI_ALLREDUCE( mean_surface_level_height_l(0), & |
---|
| 2179 | mean_surface_level_height(0), sr, MPI_REAL, & |
---|
| 2180 | MPI_SUM, comm2d, ierr ) |
---|
| 2181 | mean_surface_level_height = mean_surface_level_height / REAL( ngp_2dh ) |
---|
| 2182 | #else |
---|
| 2183 | ngp_2dh = ngp_2dh_l |
---|
| 2184 | ngp_2dh_outer = ngp_2dh_outer_l |
---|
| 2185 | ngp_2dh_s_inner = ngp_2dh_s_inner_l |
---|
| 2186 | ngp_3d_inner = INT( ngp_3d_inner_l, KIND = SELECTED_INT_KIND( 18 ) ) |
---|
| 2187 | mean_surface_level_height = mean_surface_level_height_l / REAL( ngp_2dh_l ) |
---|
| 2188 | #endif |
---|
| 2189 | |
---|
| 2190 | ngp_3d = INT ( ngp_2dh, KIND = SELECTED_INT_KIND( 18 ) ) * & |
---|
| 2191 | INT ( (nz + 2 ), KIND = SELECTED_INT_KIND( 18 ) ) |
---|
| 2192 | |
---|
| 2193 | ! |
---|
| 2194 | !-- Set a lower limit of 1 in order to avoid zero divisions in flow_statistics, |
---|
| 2195 | !-- buoyancy, etc. A zero value will occur for cases where all grid points of |
---|
| 2196 | !-- the respective subdomain lie below the surface topography |
---|
| 2197 | ngp_2dh_outer = MAX( 1, ngp_2dh_outer(:,:) ) |
---|
| 2198 | ngp_3d_inner = MAX( INT(1, KIND = SELECTED_INT_KIND( 18 )), & |
---|
| 2199 | ngp_3d_inner(:) ) |
---|
| 2200 | ngp_2dh_s_inner = MAX( 1, ngp_2dh_s_inner(:,:) ) |
---|
| 2201 | |
---|
| 2202 | DEALLOCATE( mean_surface_level_height_l, ngp_2dh_l, ngp_2dh_outer_l, & |
---|
| 2203 | ngp_3d_inner_l, ngp_3d_inner_tmp ) |
---|
| 2204 | |
---|
| 2205 | ! |
---|
[3051] | 2206 | !-- Initialize nudging if required |
---|
| 2207 | IF ( nudging ) CALL nudge_init |
---|
| 2208 | ! |
---|
[3347] | 2209 | !-- Initialize 1D large-scale forcing and nudging and read data from external |
---|
| 2210 | !-- ASCII file |
---|
| 2211 | IF ( large_scale_forcing ) CALL lsf_init |
---|
[3051] | 2212 | ! |
---|
[2232] | 2213 | !-- Initialize surface forcing corresponding to large-scale forcing. Therein, |
---|
| 2214 | !-- initialize heat-fluxes, etc. via datatype. Revise it later! |
---|
| 2215 | IF ( large_scale_forcing .AND. lsf_surf ) THEN |
---|
| 2216 | IF ( use_surface_fluxes .AND. constant_heatflux ) THEN |
---|
| 2217 | CALL ls_forcing_surf ( simulated_time ) |
---|
| 2218 | ENDIF |
---|
| 2219 | ENDIF |
---|
| 2220 | ! |
---|
[3347] | 2221 | !-- Initializae 3D offline nesting in COSMO model and read data from |
---|
| 2222 | !-- external NetCDF file. |
---|
| 2223 | IF ( nesting_offline ) CALL nesting_offl_init |
---|
| 2224 | ! |
---|
[787] | 2225 | !-- Initialize quantities for special advections schemes |
---|
| 2226 | CALL init_advec |
---|
[680] | 2227 | |
---|
[667] | 2228 | ! |
---|
[680] | 2229 | !-- Impose random perturbation on the horizontal velocity field and then |
---|
| 2230 | !-- remove the divergences from the velocity field at the initial stage |
---|
[1788] | 2231 | IF ( create_disturbances .AND. disturbance_energy_limit /= 0.0_wp .AND. & |
---|
| 2232 | TRIM( initializing_actions ) /= 'read_restart_data' .AND. & |
---|
[680] | 2233 | TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN |
---|
| 2234 | |
---|
[1402] | 2235 | CALL location_message( 'creating initial disturbances', .FALSE. ) |
---|
[2232] | 2236 | CALL disturb_field( 'u', tend, u ) |
---|
| 2237 | CALL disturb_field( 'v', tend, v ) |
---|
[1402] | 2238 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 2239 | |
---|
[1402] | 2240 | CALL location_message( 'calling pressure solver', .FALSE. ) |
---|
[680] | 2241 | n_sor = nsor_ini |
---|
| 2242 | CALL pres |
---|
| 2243 | n_sor = nsor |
---|
[1402] | 2244 | CALL location_message( 'finished', .TRUE. ) |
---|
[1384] | 2245 | |
---|
[680] | 2246 | ENDIF |
---|
| 2247 | |
---|
| 2248 | ! |
---|
[1484] | 2249 | !-- If required, initialize quantities needed for the plant canopy model |
---|
[2007] | 2250 | IF ( plant_canopy ) THEN |
---|
| 2251 | CALL location_message( 'initializing plant canopy model', .FALSE. ) |
---|
| 2252 | CALL pcm_init |
---|
| 2253 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2254 | ENDIF |
---|
[138] | 2255 | |
---|
| 2256 | ! |
---|
[1] | 2257 | !-- If required, initialize dvrp-software |
---|
[1340] | 2258 | IF ( dt_dvrp /= 9999999.9_wp ) CALL init_dvrp |
---|
[1] | 2259 | |
---|
| 2260 | ! |
---|
[3294] | 2261 | !-- Initialize quantities needed for the ocean model |
---|
| 2262 | IF ( ocean_mode ) CALL ocean_init |
---|
[388] | 2263 | |
---|
[96] | 2264 | ! |
---|
[3294] | 2265 | !-- Initialize quantities for handling cloud physics. |
---|
| 2266 | !-- This routine must be called before lpm_init, becaus otherwise, |
---|
| 2267 | !-- array d_exner, needed in data_output_dvrp (called by lpm_init) is not defined. |
---|
| 2268 | IF ( .NOT. ocean_mode ) THEN |
---|
[3274] | 2269 | |
---|
| 2270 | ALLOCATE( hyp(nzb:nzt+1) ) |
---|
| 2271 | ALLOCATE( d_exner(nzb:nzt+1) ) |
---|
| 2272 | ALLOCATE( exner(nzb:nzt+1) ) |
---|
| 2273 | ALLOCATE( hyrho(nzb:nzt+1) ) |
---|
[1849] | 2274 | ! |
---|
[3274] | 2275 | !-- Check temperature in case of too large domain height |
---|
| 2276 | DO k = nzb, nzt+1 |
---|
| 2277 | IF ( ( pt_surface * exner_function(surface_pressure * 100.0_wp) - g/c_p * zu(k) ) < 0.0_wp ) THEN |
---|
| 2278 | WRITE( message_string, * ) 'absolute temperature < 0.0 at zu(', k, & |
---|
| 2279 | ') = ', zu(k) |
---|
| 2280 | CALL message( 'init_bulk_cloud_model', 'PA0142', 1, 2, 0, 6, 0 ) |
---|
| 2281 | ENDIF |
---|
| 2282 | ENDDO |
---|
| 2283 | |
---|
| 2284 | ! |
---|
| 2285 | !-- Calculate vertical profile of the hydrostatic pressure (hyp) |
---|
| 2286 | hyp = barometric_formula(zu, pt_surface * exner_function(surface_pressure * 100.0_wp), surface_pressure * 100.0_wp) |
---|
| 2287 | d_exner = exner_function_invers(hyp) |
---|
| 2288 | exner = 1.0_wp / exner_function_invers(hyp) |
---|
| 2289 | hyrho = ideal_gas_law_rho_pt(hyp, pt_init) |
---|
| 2290 | ! |
---|
| 2291 | !-- Compute reference density |
---|
| 2292 | rho_surface = ideal_gas_law_rho(surface_pressure * 100.0_wp, pt_surface * exner_function(surface_pressure * 100.0_wp)) |
---|
| 2293 | |
---|
[96] | 2294 | ENDIF |
---|
[3274] | 2295 | ! |
---|
| 2296 | !-- If required, initialize quantities needed for the microphysics module |
---|
| 2297 | IF ( bulk_cloud_model ) THEN |
---|
| 2298 | CALL bcm_init |
---|
| 2299 | ENDIF |
---|
[1] | 2300 | |
---|
| 2301 | ! |
---|
| 2302 | !-- If required, initialize particles |
---|
[849] | 2303 | IF ( particle_advection ) CALL lpm_init |
---|
[1] | 2304 | |
---|
[1585] | 2305 | ! |
---|
[3159] | 2306 | !-- If required, initialize particles |
---|
| 2307 | IF ( agents_active ) CALL mas_init |
---|
| 2308 | |
---|
| 2309 | ! |
---|
[1585] | 2310 | !-- If required, initialize quantities needed for the LSM |
---|
| 2311 | IF ( land_surface ) THEN |
---|
| 2312 | CALL location_message( 'initializing land surface model', .FALSE. ) |
---|
[1817] | 2313 | CALL lsm_init |
---|
[1585] | 2314 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2315 | ENDIF |
---|
[1496] | 2316 | |
---|
[1] | 2317 | ! |
---|
[2696] | 2318 | !-- If required, allocate USM and LSM surfaces |
---|
| 2319 | IF ( urban_surface ) THEN |
---|
| 2320 | CALL location_message( 'initializing and allocating urban surfaces', .FALSE. ) |
---|
| 2321 | CALL usm_allocate_surface |
---|
| 2322 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2323 | ENDIF |
---|
| 2324 | ! |
---|
| 2325 | !-- If required, initialize urban surface model |
---|
| 2326 | IF ( urban_surface ) THEN |
---|
| 2327 | CALL location_message( 'initializing urban surface model', .FALSE. ) |
---|
| 2328 | CALL usm_init_urban_surface |
---|
| 2329 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2330 | ENDIF |
---|
| 2331 | |
---|
| 2332 | ! |
---|
[1691] | 2333 | !-- Initialize surface layer (done after LSM as roughness length are required |
---|
| 2334 | !-- for initialization |
---|
| 2335 | IF ( constant_flux_layer ) THEN |
---|
| 2336 | CALL location_message( 'initializing surface layer', .FALSE. ) |
---|
| 2337 | CALL init_surface_layer_fluxes |
---|
| 2338 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2339 | ENDIF |
---|
| 2340 | ! |
---|
[3347] | 2341 | !-- In case the synthetic turbulence generator does not have any information |
---|
| 2342 | !-- about the inflow turbulence, these information will be parametrized |
---|
| 2343 | !-- depending on the initial atmospheric conditions and surface properties. |
---|
| 2344 | !-- Please note, within pre-determined time intervals these turbulence |
---|
| 2345 | !-- information can be updated if desired. |
---|
| 2346 | IF ( use_syn_turb_gen .AND. parametrize_inflow_turbulence ) & |
---|
| 2347 | CALL stg_adjust |
---|
| 2348 | ! |
---|
[2696] | 2349 | !-- If required, set chemical emissions |
---|
[3298] | 2350 | !-- Initialize values of cssws according to chemistry emission values |
---|
| 2351 | IF ( air_chemistry .AND. do_emis ) THEN |
---|
| 2352 | CALL chem_emissions_init( chem_emis_att, chem_emis, nspec_out ) |
---|
[2696] | 2353 | ENDIF |
---|
| 2354 | ! |
---|
| 2355 | !-- Initialize radiation processes |
---|
[1496] | 2356 | IF ( radiation ) THEN |
---|
[2696] | 2357 | ! |
---|
[2977] | 2358 | !-- Activate radiation_interactions according to the existence of vertical surfaces and/or trees. |
---|
| 2359 | !-- The namelist parameter radiation_interactions_on can override this behavior. |
---|
| 2360 | !-- (This check cannot be performed in check_parameters, because vertical_surfaces_exist is first set in |
---|
| 2361 | !-- init_surface_arrays.) |
---|
| 2362 | IF ( radiation_interactions_on ) THEN |
---|
| 2363 | IF ( vertical_surfaces_exist .OR. plant_canopy ) THEN |
---|
| 2364 | radiation_interactions = .TRUE. |
---|
| 2365 | average_radiation = .TRUE. |
---|
| 2366 | ELSE |
---|
| 2367 | radiation_interactions_on = .FALSE. !< reset namelist parameter: no interactions |
---|
| 2368 | !< calculations necessary in case of flat surface |
---|
| 2369 | ENDIF |
---|
| 2370 | ELSEIF ( vertical_surfaces_exist .OR. plant_canopy ) THEN |
---|
| 2371 | message_string = 'radiation_interactions_on is set to .FALSE. although ' // & |
---|
| 2372 | 'vertical surfaces and/or trees exist. The model will run ' // & |
---|
| 2373 | 'without RTM (no shadows, no radiation reflections)' |
---|
| 2374 | CALL message( 'init_3d_model', 'PA0348', 0, 1, 0, 6, 0 ) |
---|
| 2375 | ENDIF |
---|
| 2376 | ! |
---|
[2696] | 2377 | !-- If required, initialize radiation interactions between surfaces |
---|
[2920] | 2378 | !-- via sky-view factors. This must be done before radiation is initialized. |
---|
[2696] | 2379 | IF ( radiation_interactions ) CALL radiation_interaction_init |
---|
| 2380 | |
---|
| 2381 | ! |
---|
| 2382 | !-- Initialize radiation model |
---|
[1585] | 2383 | CALL location_message( 'initializing radiation model', .FALSE. ) |
---|
[1826] | 2384 | CALL radiation_init |
---|
[1585] | 2385 | CALL location_message( 'finished', .TRUE. ) |
---|
[2696] | 2386 | |
---|
| 2387 | ! |
---|
[2920] | 2388 | !-- Find all discretized apparent solar positions for radiation interaction. |
---|
| 2389 | !-- This must be done after radiation_init. |
---|
| 2390 | IF ( radiation_interactions ) CALL radiation_presimulate_solar_pos |
---|
| 2391 | |
---|
| 2392 | ! |
---|
[2696] | 2393 | !-- If required, read or calculate and write out the SVF |
---|
[2906] | 2394 | IF ( radiation_interactions .AND. read_svf) THEN |
---|
[2696] | 2395 | ! |
---|
| 2396 | !-- Read sky-view factors and further required data from file |
---|
| 2397 | CALL location_message( ' Start reading SVF from file', .FALSE. ) |
---|
| 2398 | CALL radiation_read_svf() |
---|
| 2399 | CALL location_message( ' Reading SVF from file has finished', .TRUE. ) |
---|
| 2400 | |
---|
[2906] | 2401 | ELSEIF ( radiation_interactions .AND. .NOT. read_svf) THEN |
---|
[2696] | 2402 | ! |
---|
| 2403 | !-- calculate SFV and CSF |
---|
| 2404 | CALL location_message( ' Start calculation of SVF', .FALSE. ) |
---|
| 2405 | CALL radiation_calc_svf() |
---|
| 2406 | CALL location_message( ' Calculation of SVF has finished', .TRUE. ) |
---|
| 2407 | ENDIF |
---|
| 2408 | |
---|
[2906] | 2409 | IF ( radiation_interactions .AND. write_svf) THEN |
---|
[2696] | 2410 | ! |
---|
| 2411 | !-- Write svf, csf svfsurf and csfsurf data to file |
---|
[2906] | 2412 | CALL location_message( ' Start writing SVF in file', .FALSE. ) |
---|
[2696] | 2413 | CALL radiation_write_svf() |
---|
[2906] | 2414 | CALL location_message( ' Writing SVF in file has finished', .TRUE. ) |
---|
[2696] | 2415 | ENDIF |
---|
| 2416 | |
---|
| 2417 | ! |
---|
| 2418 | !-- Adjust radiative fluxes. In case of urban and land surfaces, also |
---|
| 2419 | !-- call an initial interaction. |
---|
| 2420 | IF ( radiation_interactions ) THEN |
---|
| 2421 | CALL radiation_interaction |
---|
| 2422 | ENDIF |
---|
[1496] | 2423 | ENDIF |
---|
[3234] | 2424 | |
---|
[1914] | 2425 | ! |
---|
| 2426 | !-- If required, initialize quantities needed for the wind turbine model |
---|
| 2427 | IF ( wind_turbine ) THEN |
---|
| 2428 | CALL location_message( 'initializing wind turbine model', .FALSE. ) |
---|
| 2429 | CALL wtm_init |
---|
| 2430 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2431 | ENDIF |
---|
[1496] | 2432 | |
---|
[2817] | 2433 | ! |
---|
[3467] | 2434 | !-- If required, initialize quantities needed in SALSA |
---|
| 2435 | IF ( salsa ) THEN |
---|
| 2436 | CALL location_message( 'initializing SALSA model', .TRUE. ) |
---|
| 2437 | CALL salsa_init |
---|
| 2438 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2439 | ENDIF |
---|
| 2440 | |
---|
| 2441 | ! |
---|
[2817] | 2442 | !-- If required, initialize quantities needed for the gust module |
---|
| 2443 | IF ( gust_module_enabled ) THEN |
---|
| 2444 | CALL gust_init( dots_label, dots_unit, dots_num, dots_max ) |
---|
| 2445 | ENDIF |
---|
[3421] | 2446 | ! |
---|
| 2447 | !-- Initialize surface data output |
---|
| 2448 | IF ( surface_data_output ) THEN |
---|
| 2449 | CALL surface_output_init |
---|
| 2450 | ENDIF |
---|
[3472] | 2451 | ! |
---|
| 2452 | !-- If virtual measurements should be taken, initialize all relevant |
---|
| 2453 | !-- arrays and quantities. |
---|
| 2454 | IF ( virtual_measurement ) CALL vm_init |
---|
[1914] | 2455 | |
---|
[1496] | 2456 | ! |
---|
[3448] | 2457 | !-- If required initialize biometeorology module |
---|
| 2458 | IF ( biometeorology ) THEN |
---|
| 2459 | CALL location_message( 'initializing biometeorology module', .FALSE. ) |
---|
| 2460 | CALL biom_init |
---|
| 2461 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2462 | ENDIF |
---|
| 2463 | |
---|
| 2464 | ! |
---|
[3469] | 2465 | !-- If required, initialize indoor model |
---|
| 2466 | IF ( indoor_model ) THEN |
---|
| 2467 | CALL location_message( 'initializing indoor model', .FALSE. ) |
---|
| 2468 | CALL im_init |
---|
| 2469 | CALL location_message( 'finished', .TRUE. ) |
---|
| 2470 | ENDIF |
---|
| 2471 | |
---|
| 2472 | ! |
---|
[673] | 2473 | !-- Initialize the ws-scheme. |
---|
[3448] | 2474 | IF ( ws_scheme_sca .OR. ws_scheme_mom ) CALL ws_init |
---|
[1] | 2475 | |
---|
| 2476 | ! |
---|
[709] | 2477 | !-- Setting weighting factors for calculation of perturbation pressure |
---|
[1762] | 2478 | !-- and turbulent quantities from the RK substeps |
---|
[709] | 2479 | IF ( TRIM(timestep_scheme) == 'runge-kutta-3' ) THEN ! for RK3-method |
---|
| 2480 | |
---|
[1322] | 2481 | weight_substep(1) = 1._wp/6._wp |
---|
| 2482 | weight_substep(2) = 3._wp/10._wp |
---|
| 2483 | weight_substep(3) = 8._wp/15._wp |
---|
[709] | 2484 | |
---|
[1322] | 2485 | weight_pres(1) = 1._wp/3._wp |
---|
| 2486 | weight_pres(2) = 5._wp/12._wp |
---|
| 2487 | weight_pres(3) = 1._wp/4._wp |
---|
[709] | 2488 | |
---|
| 2489 | ELSEIF ( TRIM(timestep_scheme) == 'runge-kutta-2' ) THEN ! for RK2-method |
---|
| 2490 | |
---|
[1322] | 2491 | weight_substep(1) = 1._wp/2._wp |
---|
| 2492 | weight_substep(2) = 1._wp/2._wp |
---|
[673] | 2493 | |
---|
[1322] | 2494 | weight_pres(1) = 1._wp/2._wp |
---|
| 2495 | weight_pres(2) = 1._wp/2._wp |
---|
[709] | 2496 | |
---|
[1001] | 2497 | ELSE ! for Euler-method |
---|
[709] | 2498 | |
---|
[1340] | 2499 | weight_substep(1) = 1.0_wp |
---|
| 2500 | weight_pres(1) = 1.0_wp |
---|
[709] | 2501 | |
---|
[673] | 2502 | ENDIF |
---|
| 2503 | |
---|
| 2504 | ! |
---|
[1] | 2505 | !-- Initialize Rayleigh damping factors |
---|
[1340] | 2506 | rdf = 0.0_wp |
---|
| 2507 | rdf_sc = 0.0_wp |
---|
| 2508 | IF ( rayleigh_damping_factor /= 0.0_wp ) THEN |
---|
[3294] | 2509 | |
---|
| 2510 | IF ( .NOT. ocean_mode ) THEN |
---|
[108] | 2511 | DO k = nzb+1, nzt |
---|
| 2512 | IF ( zu(k) >= rayleigh_damping_height ) THEN |
---|
[1788] | 2513 | rdf(k) = rayleigh_damping_factor * & |
---|
[1340] | 2514 | ( SIN( pi * 0.5_wp * ( zu(k) - rayleigh_damping_height ) & |
---|
[1788] | 2515 | / ( zu(nzt) - rayleigh_damping_height ) ) & |
---|
[1] | 2516 | )**2 |
---|
[108] | 2517 | ENDIF |
---|
| 2518 | ENDDO |
---|
| 2519 | ELSE |
---|
[3294] | 2520 | ! |
---|
| 2521 | !-- In ocean mode, rayleigh damping is applied in the lower part of the |
---|
| 2522 | !-- model domain |
---|
[108] | 2523 | DO k = nzt, nzb+1, -1 |
---|
| 2524 | IF ( zu(k) <= rayleigh_damping_height ) THEN |
---|
[1788] | 2525 | rdf(k) = rayleigh_damping_factor * & |
---|
[1340] | 2526 | ( SIN( pi * 0.5_wp * ( rayleigh_damping_height - zu(k) ) & |
---|
[1788] | 2527 | / ( rayleigh_damping_height - zu(nzb+1) ) ) & |
---|
[108] | 2528 | )**2 |
---|
| 2529 | ENDIF |
---|
| 2530 | ENDDO |
---|
| 2531 | ENDIF |
---|
[3294] | 2532 | |
---|
[1] | 2533 | ENDIF |
---|
[785] | 2534 | IF ( scalar_rayleigh_damping ) rdf_sc = rdf |
---|
[1] | 2535 | |
---|
| 2536 | ! |
---|
[240] | 2537 | !-- Initialize the starting level and the vertical smoothing factor used for |
---|
| 2538 | !-- the external pressure gradient |
---|
[1340] | 2539 | dp_smooth_factor = 1.0_wp |
---|
[240] | 2540 | IF ( dp_external ) THEN |
---|
| 2541 | ! |
---|
| 2542 | !-- Set the starting level dp_level_ind_b only if it has not been set before |
---|
| 2543 | !-- (e.g. in init_grid). |
---|
| 2544 | IF ( dp_level_ind_b == 0 ) THEN |
---|
| 2545 | ind_array = MINLOC( ABS( dp_level_b - zu ) ) |
---|
| 2546 | dp_level_ind_b = ind_array(1) - 1 + nzb |
---|
| 2547 | ! MINLOC uses lower array bound 1 |
---|
| 2548 | ENDIF |
---|
| 2549 | IF ( dp_smooth ) THEN |
---|
[1340] | 2550 | dp_smooth_factor(:dp_level_ind_b) = 0.0_wp |
---|
[240] | 2551 | DO k = dp_level_ind_b+1, nzt |
---|
[1340] | 2552 | dp_smooth_factor(k) = 0.5_wp * ( 1.0_wp + SIN( pi * & |
---|
| 2553 | ( REAL( k - dp_level_ind_b, KIND=wp ) / & |
---|
| 2554 | REAL( nzt - dp_level_ind_b, KIND=wp ) - 0.5_wp ) ) ) |
---|
[240] | 2555 | ENDDO |
---|
| 2556 | ENDIF |
---|
| 2557 | ENDIF |
---|
| 2558 | |
---|
| 2559 | ! |
---|
[978] | 2560 | !-- Initialize damping zone for the potential temperature in case of |
---|
| 2561 | !-- non-cyclic lateral boundaries. The damping zone has the maximum value |
---|
| 2562 | !-- at the inflow boundary and decreases to zero at pt_damping_width. |
---|
[1340] | 2563 | ptdf_x = 0.0_wp |
---|
| 2564 | ptdf_y = 0.0_wp |
---|
[1159] | 2565 | IF ( bc_lr_dirrad ) THEN |
---|
[996] | 2566 | DO i = nxl, nxr |
---|
[978] | 2567 | IF ( ( i * dx ) < pt_damping_width ) THEN |
---|
[1340] | 2568 | ptdf_x(i) = pt_damping_factor * ( SIN( pi * 0.5_wp * & |
---|
| 2569 | REAL( pt_damping_width - i * dx, KIND=wp ) / ( & |
---|
[1788] | 2570 | REAL( pt_damping_width, KIND=wp ) ) ) )**2 |
---|
[73] | 2571 | ENDIF |
---|
| 2572 | ENDDO |
---|
[1159] | 2573 | ELSEIF ( bc_lr_raddir ) THEN |
---|
[996] | 2574 | DO i = nxl, nxr |
---|
[978] | 2575 | IF ( ( i * dx ) > ( nx * dx - pt_damping_width ) ) THEN |
---|
[1322] | 2576 | ptdf_x(i) = pt_damping_factor * & |
---|
[1340] | 2577 | SIN( pi * 0.5_wp * & |
---|
| 2578 | ( ( i - nx ) * dx + pt_damping_width ) / & |
---|
| 2579 | REAL( pt_damping_width, KIND=wp ) )**2 |
---|
[73] | 2580 | ENDIF |
---|
[978] | 2581 | ENDDO |
---|
[1159] | 2582 | ELSEIF ( bc_ns_dirrad ) THEN |
---|
[996] | 2583 | DO j = nys, nyn |
---|
[978] | 2584 | IF ( ( j * dy ) > ( ny * dy - pt_damping_width ) ) THEN |
---|
[1322] | 2585 | ptdf_y(j) = pt_damping_factor * & |
---|
[1340] | 2586 | SIN( pi * 0.5_wp * & |
---|
| 2587 | ( ( j - ny ) * dy + pt_damping_width ) / & |
---|
| 2588 | REAL( pt_damping_width, KIND=wp ) )**2 |
---|
[1] | 2589 | ENDIF |
---|
[978] | 2590 | ENDDO |
---|
[1159] | 2591 | ELSEIF ( bc_ns_raddir ) THEN |
---|
[996] | 2592 | DO j = nys, nyn |
---|
[978] | 2593 | IF ( ( j * dy ) < pt_damping_width ) THEN |
---|
[1322] | 2594 | ptdf_y(j) = pt_damping_factor * & |
---|
[1340] | 2595 | SIN( pi * 0.5_wp * & |
---|
| 2596 | ( pt_damping_width - j * dy ) / & |
---|
| 2597 | REAL( pt_damping_width, KIND=wp ) )**2 |
---|
[1] | 2598 | ENDIF |
---|
[73] | 2599 | ENDDO |
---|
[1] | 2600 | ENDIF |
---|
| 2601 | ! |
---|
[2864] | 2602 | !-- Check if maximum number of allowed timeseries is exceeded |
---|
[51] | 2603 | IF ( dots_num > dots_max ) THEN |
---|
[1788] | 2604 | WRITE( message_string, * ) 'number of time series quantities exceeds', & |
---|
| 2605 | ' its maximum of dots_max = ', dots_max, & |
---|
[3046] | 2606 | '&Please increase dots_max in modules.f90.' |
---|
[254] | 2607 | CALL message( 'init_3d_model', 'PA0194', 1, 2, 0, 6, 0 ) |
---|
[51] | 2608 | ENDIF |
---|
| 2609 | |
---|
[1] | 2610 | ! |
---|
| 2611 | !-- Input binary data file is not needed anymore. This line must be placed |
---|
| 2612 | !-- after call of user_init! |
---|
| 2613 | CALL close_file( 13 ) |
---|
[2934] | 2614 | ! |
---|
| 2615 | !-- In case of nesting, put an barrier to assure that all parent and child |
---|
| 2616 | !-- domains finished initialization. |
---|
| 2617 | #if defined( __parallel ) |
---|
| 2618 | IF ( nested_run ) CALL MPI_BARRIER( MPI_COMM_WORLD, ierr ) |
---|
| 2619 | #endif |
---|
[1] | 2620 | |
---|
[2934] | 2621 | |
---|
[1402] | 2622 | CALL location_message( 'leaving init_3d_model', .TRUE. ) |
---|
[1] | 2623 | |
---|
| 2624 | END SUBROUTINE init_3d_model |
---|