[1873] | 1 | !> @file lpm_init.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: |
---|
[1] | 21 | ! ----------------- |
---|
[2318] | 22 | ! |
---|
[2701] | 23 | ! |
---|
[1930] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: lpm_init.f90 2967 2018-04-13 11:22:08Z suehring $ |
---|
[2967] | 27 | ! nesting routine is only called if nesting is switched on |
---|
| 28 | ! |
---|
| 29 | ! 2954 2018-04-09 14:35:46Z schwenkel |
---|
[2954] | 30 | ! Bugfix for particle initialization in case of ocean |
---|
| 31 | ! |
---|
| 32 | ! 2801 2018-02-14 16:01:55Z thiele |
---|
[2801] | 33 | ! Introduce particle transfer in nested models. |
---|
| 34 | ! |
---|
| 35 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 36 | ! Corrected "Former revisions" section |
---|
[2701] | 37 | ! |
---|
[2716] | 38 | ! 2701 2017-12-15 15:40:50Z suehring |
---|
| 39 | ! Changes from last commit documented |
---|
| 40 | ! |
---|
[2701] | 41 | ! 2698 2017-12-14 18:46:24Z suehring |
---|
[2716] | 42 | ! Grid indices passed to lpm_boundary_conds. (responsible Philipp Thiele) |
---|
| 43 | ! |
---|
| 44 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 45 | ! Change in file header (GPL part) |
---|
| 46 | ! |
---|
| 47 | ! 2628 2017-11-20 12:40:38Z schwenkel |
---|
[2628] | 48 | ! Enabled particle advection with grid stretching. |
---|
| 49 | ! |
---|
| 50 | ! 2608 2017-11-13 14:04:26Z schwenkel |
---|
[2608] | 51 | ! Calculation of magnus equation in external module (diagnostic_quantities_mod). |
---|
| 52 | ! |
---|
| 53 | ! 2606 2017-11-10 10:36:31Z schwenkel |
---|
[2606] | 54 | ! Changed particle box locations: center of particle box now coincides |
---|
| 55 | ! with scalar grid point of same index. |
---|
| 56 | ! Renamed module and subroutines: lpm_pack_arrays_mod -> lpm_pack_and_sort_mod |
---|
| 57 | ! lpm_pack_all_arrays -> lpm_sort_in_subboxes, lpm_pack_arrays -> lpm_pack |
---|
| 58 | ! lpm_sort -> lpm_sort_timeloop_done |
---|
| 59 | ! |
---|
| 60 | ! 2375 2017-08-29 14:10:28Z schwenkel |
---|
[2375] | 61 | ! Initialization of chemical aerosol composition |
---|
| 62 | ! |
---|
| 63 | ! 2346 2017-08-09 16:39:17Z suehring |
---|
[2346] | 64 | ! Bugfix, correct determination of topography top index |
---|
| 65 | ! |
---|
| 66 | ! 2318 2017-07-20 17:27:44Z suehring |
---|
[2318] | 67 | ! Get topography top index via Function call |
---|
| 68 | ! |
---|
| 69 | ! 2317 2017-07-20 17:27:19Z suehring |
---|
[2312] | 70 | ! Extended particle data type. Aerosol initialization improved. |
---|
| 71 | ! |
---|
| 72 | ! 2305 2017-07-06 11:18:47Z hoffmann |
---|
[2305] | 73 | ! Improved calculation of particle IDs. |
---|
[2312] | 74 | ! |
---|
[2305] | 75 | ! 2274 2017-06-09 13:27:48Z Giersch |
---|
[2274] | 76 | ! Changed error messages |
---|
[2312] | 77 | ! |
---|
[2274] | 78 | ! 2265 2017-06-08 16:58:28Z schwenkel |
---|
[2265] | 79 | ! Unused variables removed. |
---|
[2312] | 80 | ! |
---|
[2265] | 81 | ! 2263 2017-06-08 14:59:01Z schwenkel |
---|
[2263] | 82 | ! Implemented splitting and merging algorithm |
---|
[2312] | 83 | ! |
---|
[2263] | 84 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[1930] | 85 | ! |
---|
[2233] | 86 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 87 | ! Adjustments according to new topography realization |
---|
[2312] | 88 | ! |
---|
| 89 | ! |
---|
[2224] | 90 | ! 2223 2017-05-15 16:38:09Z suehring |
---|
| 91 | ! Add check for particle release at model top |
---|
[2312] | 92 | ! |
---|
[2183] | 93 | ! 2182 2017-03-17 14:27:40Z schwenkel |
---|
| 94 | ! Added parameters for simplified particle initialization. |
---|
[2305] | 95 | ! |
---|
[2123] | 96 | ! 2122 2017-01-18 12:22:54Z hoffmann |
---|
[2312] | 97 | ! Improved initialization of equilibrium aerosol radii |
---|
[2123] | 98 | ! Calculation of particle ID |
---|
| 99 | ! |
---|
[2001] | 100 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 101 | ! Forced header and separation lines into 80 columns |
---|
[2312] | 102 | ! |
---|
[1930] | 103 | ! 2016-06-09 16:25:25Z suehring |
---|
[2312] | 104 | ! Bugfix in determining initial particle height and grid index in case of |
---|
[1929] | 105 | ! seed_follows_topography. |
---|
[2312] | 106 | ! Bugfix concerning random positions, ensure that particles do not move more |
---|
[1929] | 107 | ! than one grid length. |
---|
| 108 | ! Bugfix logarithmic interpolation. |
---|
| 109 | ! Initial setting of sgs_wf_part. |
---|
[1321] | 110 | ! |
---|
[1891] | 111 | ! 1890 2016-04-22 08:52:11Z hoffmann |
---|
[2312] | 112 | ! Initialization of aerosol equilibrium radius not possible in supersaturated |
---|
[1891] | 113 | ! environments. Therefore, a maximum supersaturation of -1 % is assumed during |
---|
| 114 | ! initialization. |
---|
| 115 | ! |
---|
[1874] | 116 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
[1929] | 117 | ! Module renamed (removed _mod |
---|
[2312] | 118 | ! |
---|
[1872] | 119 | ! 1871 2016-04-15 11:46:09Z hoffmann |
---|
| 120 | ! Initialization of aerosols added. |
---|
| 121 | ! |
---|
[1851] | 122 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 123 | ! Module renamed |
---|
| 124 | ! |
---|
[1832] | 125 | ! 1831 2016-04-07 13:15:51Z hoffmann |
---|
| 126 | ! curvature_solution_effects moved to particle_attributes |
---|
| 127 | ! |
---|
[1823] | 128 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
| 129 | ! Unused variables removed. |
---|
| 130 | ! |
---|
[1784] | 131 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 132 | ! netcdf module added |
---|
| 133 | ! |
---|
[2312] | 134 | ! 1725 2015-11-17 13:01:51Z hoffmann |
---|
| 135 | ! Bugfix: Processor-dependent seed for random function is generated before it is |
---|
[1726] | 136 | ! used. |
---|
| 137 | ! |
---|
[1692] | 138 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 139 | ! Renamed prandtl_layer to constant_flux_layer. |
---|
| 140 | ! |
---|
[1686] | 141 | ! 1685 2015-10-08 07:32:13Z raasch |
---|
| 142 | ! bugfix concerning vertical index offset in case of ocean |
---|
| 143 | ! |
---|
[1683] | 144 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
[2312] | 145 | ! Code annotations made doxygen readable |
---|
[1683] | 146 | ! |
---|
[1576] | 147 | ! 1575 2015-03-27 09:56:27Z raasch |
---|
| 148 | ! initial vertical particle position is allowed to follow the topography |
---|
| 149 | ! |
---|
[1360] | 150 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
[2312] | 151 | ! New particle structure integrated. |
---|
[1360] | 152 | ! Kind definition added to all floating point numbers. |
---|
| 153 | ! lpm_init changed form a subroutine to a module. |
---|
[2312] | 154 | ! |
---|
[1329] | 155 | ! 1327 2014-03-21 11:00:16Z raasch |
---|
| 156 | ! -netcdf_output |
---|
| 157 | ! |
---|
[1323] | 158 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 159 | ! REAL functions provided with KIND-attribute |
---|
| 160 | ! |
---|
[1321] | 161 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 162 | ! ONLY-attribute added to USE-statements, |
---|
| 163 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 164 | ! kinds are defined in new module kinds, |
---|
| 165 | ! revision history before 2012 removed, |
---|
| 166 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 167 | ! all variable declaration statements |
---|
| 168 | ! bugfix: #if defined( __parallel ) added |
---|
[850] | 169 | ! |
---|
[1315] | 170 | ! 1314 2014-03-14 18:25:17Z suehring |
---|
[2312] | 171 | ! Vertical logarithmic interpolation of horizontal particle speed for particles |
---|
[1315] | 172 | ! between roughness height and first vertical grid level. |
---|
| 173 | ! |
---|
[1093] | 174 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 175 | ! unused variables removed |
---|
| 176 | ! |
---|
[1037] | 177 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 178 | ! code put under GPL (PALM 3.9) |
---|
| 179 | ! |
---|
[850] | 180 | ! 849 2012-03-15 10:35:09Z raasch |
---|
[849] | 181 | ! routine renamed: init_particles -> lpm_init |
---|
| 182 | ! de_dx, de_dy, de_dz are allocated here (instead of automatic arrays in |
---|
| 183 | ! advec_particles), |
---|
| 184 | ! sort_particles renamed lpm_sort_arrays, user_init_particles renamed lpm_init |
---|
[392] | 185 | ! |
---|
[829] | 186 | ! 828 2012-02-21 12:00:36Z raasch |
---|
| 187 | ! call of init_kernels, particle feature color renamed class |
---|
| 188 | ! |
---|
[826] | 189 | ! 824 2012-02-17 09:09:57Z raasch |
---|
| 190 | ! particle attributes speed_x|y|z_sgs renamed rvar1|2|3, |
---|
| 191 | ! array particles implemented as pointer |
---|
| 192 | ! |
---|
[668] | 193 | ! 667 2010-12-23 12:06:00Z suehring/gryschka |
---|
[2312] | 194 | ! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng for allocation |
---|
[668] | 195 | ! of arrays. |
---|
| 196 | ! |
---|
[1] | 197 | ! Revision 1.1 1999/11/25 16:22:38 raasch |
---|
| 198 | ! Initial revision |
---|
| 199 | ! |
---|
| 200 | ! |
---|
| 201 | ! Description: |
---|
| 202 | ! ------------ |
---|
[1682] | 203 | !> This routine initializes a set of particles and their attributes (position, |
---|
| 204 | !> radius, ..) which are used by the Lagrangian particle model (see lpm). |
---|
[1] | 205 | !------------------------------------------------------------------------------! |
---|
[1682] | 206 | MODULE lpm_init_mod |
---|
[2312] | 207 | |
---|
[2305] | 208 | USE, INTRINSIC :: ISO_C_BINDING |
---|
[1] | 209 | |
---|
[1320] | 210 | USE arrays_3d, & |
---|
[2232] | 211 | ONLY: de_dx, de_dy, de_dz, zu, zw |
---|
[1320] | 212 | |
---|
| 213 | USE control_parameters, & |
---|
[1691] | 214 | ONLY: cloud_droplets, constant_flux_layer, current_timestep_number, & |
---|
[2312] | 215 | dt_3d, dz, initializing_actions, message_string, ocean, & |
---|
| 216 | simulated_time |
---|
[1320] | 217 | |
---|
| 218 | USE grid_variables, & |
---|
[1359] | 219 | ONLY: ddx, dx, ddy, dy |
---|
[1320] | 220 | |
---|
| 221 | USE indices, & |
---|
[1575] | 222 | ONLY: nx, nxl, nxlg, nxrg, nxr, ny, nyn, nys, nyng, nysg, nz, nzb, & |
---|
[2317] | 223 | nzt, wall_flags_0 |
---|
[1320] | 224 | |
---|
| 225 | USE kinds |
---|
| 226 | |
---|
| 227 | USE lpm_collision_kernels_mod, & |
---|
| 228 | ONLY: init_kernels |
---|
| 229 | |
---|
[1783] | 230 | USE netcdf_interface, & |
---|
| 231 | ONLY: netcdf_data_format |
---|
| 232 | |
---|
[1320] | 233 | USE particle_attributes, & |
---|
[1359] | 234 | ONLY: alloc_factor, bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, & |
---|
| 235 | block_offset, block_offset_def, collision_kernel, & |
---|
[2265] | 236 | curvature_solution_effects, density_ratio, grid_particles, & |
---|
| 237 | isf,i_splitting_mode, initial_weighting_factor, ibc_par_b, & |
---|
| 238 | ibc_par_lr, ibc_par_ns, ibc_par_t, iran_part, log_z_z0, & |
---|
| 239 | max_number_of_particle_groups, min_nr_particle, & |
---|
[2305] | 240 | number_concentration, & |
---|
[2265] | 241 | number_particles_per_gridbox, number_of_particles, & |
---|
[1320] | 242 | number_of_particle_groups, number_of_sublayers, & |
---|
[1822] | 243 | offset_ocean_nzt, offset_ocean_nzt_m1, & |
---|
[1359] | 244 | particles, particle_advection_start, particle_groups, & |
---|
| 245 | particle_groups_type, particles_per_point, & |
---|
[2312] | 246 | particle_type, pdx, pdy, pdz, prt_count, psb, psl, psn, psr, & |
---|
| 247 | pss, pst, radius, random_start_position, & |
---|
[2265] | 248 | read_particles_from_restartfile, seed_follows_topography, & |
---|
| 249 | sgs_wf_part, sort_count, splitting_function, splitting_mode, & |
---|
| 250 | total_number_of_particles, use_sgs_for_particles, & |
---|
| 251 | write_particle_statistics, zero_particle, z0_av_global |
---|
[1320] | 252 | |
---|
[1] | 253 | USE pegrid |
---|
| 254 | |
---|
[1320] | 255 | USE random_function_mod, & |
---|
| 256 | ONLY: random_function |
---|
[1] | 257 | |
---|
[2232] | 258 | USE surface_mod, & |
---|
[2698] | 259 | ONLY: get_topography_top_index_ji, surf_def_h, surf_lsm_h, surf_usm_h |
---|
[2232] | 260 | |
---|
[2801] | 261 | USE pmc_particle_interface, & |
---|
| 262 | ONLY: pmcp_g_init |
---|
| 263 | |
---|
[1359] | 264 | IMPLICIT NONE |
---|
[1320] | 265 | |
---|
[1359] | 266 | PRIVATE |
---|
| 267 | |
---|
[1682] | 268 | INTEGER(iwp), PARAMETER :: PHASE_INIT = 1 !< |
---|
| 269 | INTEGER(iwp), PARAMETER, PUBLIC :: PHASE_RELEASE = 2 !< |
---|
[1359] | 270 | |
---|
| 271 | INTERFACE lpm_init |
---|
| 272 | MODULE PROCEDURE lpm_init |
---|
| 273 | END INTERFACE lpm_init |
---|
| 274 | |
---|
| 275 | INTERFACE lpm_create_particle |
---|
| 276 | MODULE PROCEDURE lpm_create_particle |
---|
| 277 | END INTERFACE lpm_create_particle |
---|
| 278 | |
---|
| 279 | PUBLIC lpm_init, lpm_create_particle |
---|
| 280 | |
---|
[1929] | 281 | CONTAINS |
---|
[1359] | 282 | |
---|
[1682] | 283 | !------------------------------------------------------------------------------! |
---|
| 284 | ! Description: |
---|
| 285 | ! ------------ |
---|
| 286 | !> @todo Missing subroutine description. |
---|
| 287 | !------------------------------------------------------------------------------! |
---|
[1359] | 288 | SUBROUTINE lpm_init |
---|
| 289 | |
---|
| 290 | USE lpm_collision_kernels_mod, & |
---|
| 291 | ONLY: init_kernels |
---|
| 292 | |
---|
[2967] | 293 | USE pmc_interface, & |
---|
| 294 | ONLY: nested_run |
---|
| 295 | |
---|
[1] | 296 | IMPLICIT NONE |
---|
| 297 | |
---|
[1682] | 298 | INTEGER(iwp) :: i !< |
---|
| 299 | INTEGER(iwp) :: j !< |
---|
| 300 | INTEGER(iwp) :: k !< |
---|
[1320] | 301 | |
---|
[2312] | 302 | REAL(wp) :: div !< |
---|
[1682] | 303 | REAL(wp) :: height_int !< |
---|
| 304 | REAL(wp) :: height_p !< |
---|
| 305 | REAL(wp) :: z_p !< |
---|
| 306 | REAL(wp) :: z0_av_local !< |
---|
[1] | 307 | |
---|
[1359] | 308 | |
---|
[1] | 309 | ! |
---|
[150] | 310 | !-- In case of oceans runs, the vertical index calculations need an offset, |
---|
| 311 | !-- because otherwise the k indices will become negative |
---|
| 312 | IF ( ocean ) THEN |
---|
| 313 | offset_ocean_nzt = nzt |
---|
| 314 | offset_ocean_nzt_m1 = nzt - 1 |
---|
| 315 | ENDIF |
---|
| 316 | |
---|
[1359] | 317 | ! |
---|
| 318 | !-- Define block offsets for dividing a gridcell in 8 sub cells |
---|
[2606] | 319 | !-- See documentation for List of subgrid boxes |
---|
| 320 | !-- See pack_and_sort in lpm_pack_arrays.f90 for assignment of the subgrid boxes |
---|
| 321 | block_offset(0) = block_offset_def ( 0, 0, 0) |
---|
| 322 | block_offset(1) = block_offset_def ( 0, 0,-1) |
---|
| 323 | block_offset(2) = block_offset_def ( 0,-1, 0) |
---|
| 324 | block_offset(3) = block_offset_def ( 0,-1,-1) |
---|
| 325 | block_offset(4) = block_offset_def (-1, 0, 0) |
---|
| 326 | block_offset(5) = block_offset_def (-1, 0,-1) |
---|
| 327 | block_offset(6) = block_offset_def (-1,-1, 0) |
---|
| 328 | block_offset(7) = block_offset_def (-1,-1,-1) |
---|
[150] | 329 | ! |
---|
[1] | 330 | !-- Check the number of particle groups. |
---|
| 331 | IF ( number_of_particle_groups > max_number_of_particle_groups ) THEN |
---|
[274] | 332 | WRITE( message_string, * ) 'max_number_of_particle_groups =', & |
---|
| 333 | max_number_of_particle_groups , & |
---|
[254] | 334 | '&number_of_particle_groups reset to ', & |
---|
| 335 | max_number_of_particle_groups |
---|
[849] | 336 | CALL message( 'lpm_init', 'PA0213', 0, 1, 0, 6, 0 ) |
---|
[1] | 337 | number_of_particle_groups = max_number_of_particle_groups |
---|
| 338 | ENDIF |
---|
[2232] | 339 | ! |
---|
| 340 | !-- Check if downward-facing walls exist. This case, reflection boundary |
---|
| 341 | !-- conditions (as well as subgrid-scale velocities) may do not work |
---|
[2312] | 342 | !-- propably (not realized so far). |
---|
[2232] | 343 | IF ( surf_def_h(1)%ns >= 1 ) THEN |
---|
[2312] | 344 | WRITE( message_string, * ) 'Overhanging topography do not work '// & |
---|
| 345 | 'with particles' |
---|
[2232] | 346 | CALL message( 'lpm_init', 'PA0212', 0, 1, 0, 6, 0 ) |
---|
[1] | 347 | |
---|
[2312] | 348 | ENDIF |
---|
[2232] | 349 | |
---|
[1] | 350 | ! |
---|
| 351 | !-- Set default start positions, if necessary |
---|
[2606] | 352 | IF ( psl(1) == 9999999.9_wp ) psl(1) = 0.0_wp |
---|
| 353 | IF ( psr(1) == 9999999.9_wp ) psr(1) = ( nx +1 ) * dx |
---|
| 354 | IF ( pss(1) == 9999999.9_wp ) pss(1) = 0.0_wp |
---|
| 355 | IF ( psn(1) == 9999999.9_wp ) psn(1) = ( ny +1 ) * dy |
---|
[1359] | 356 | IF ( psb(1) == 9999999.9_wp ) psb(1) = zu(nz/2) |
---|
| 357 | IF ( pst(1) == 9999999.9_wp ) pst(1) = psb(1) |
---|
[1] | 358 | |
---|
[1359] | 359 | IF ( pdx(1) == 9999999.9_wp .OR. pdx(1) == 0.0_wp ) pdx(1) = dx |
---|
| 360 | IF ( pdy(1) == 9999999.9_wp .OR. pdy(1) == 0.0_wp ) pdy(1) = dy |
---|
| 361 | IF ( pdz(1) == 9999999.9_wp .OR. pdz(1) == 0.0_wp ) pdz(1) = zu(2) - zu(1) |
---|
[1] | 362 | |
---|
[2182] | 363 | ! |
---|
| 364 | !-- If number_particles_per_gridbox is set, the parametres pdx, pdy and pdz are |
---|
| 365 | !-- calculated diagnostically. Therfore an isotropic distribution is prescribed. |
---|
[2312] | 366 | IF ( number_particles_per_gridbox /= -1 .AND. & |
---|
[2182] | 367 | number_particles_per_gridbox >= 1 ) THEN |
---|
[2312] | 368 | pdx(1) = (( dx * dy * ( zu(2) - zu(1) ) ) / & |
---|
[2182] | 369 | REAL(number_particles_per_gridbox))**0.3333333_wp |
---|
| 370 | ! |
---|
[2312] | 371 | !-- Ensure a smooth value (two significant digits) of distance between |
---|
[2182] | 372 | !-- particles (pdx, pdy, pdz). |
---|
| 373 | div = 1000.0_wp |
---|
| 374 | DO WHILE ( pdx(1) < div ) |
---|
| 375 | div = div / 10.0_wp |
---|
| 376 | ENDDO |
---|
| 377 | pdx(1) = NINT( pdx(1) * 100.0_wp / div ) * div / 100.0_wp |
---|
| 378 | pdy(1) = pdx(1) |
---|
| 379 | pdz(1) = pdx(1) |
---|
| 380 | |
---|
| 381 | ENDIF |
---|
| 382 | |
---|
[1] | 383 | DO j = 2, number_of_particle_groups |
---|
[1359] | 384 | IF ( psl(j) == 9999999.9_wp ) psl(j) = psl(j-1) |
---|
| 385 | IF ( psr(j) == 9999999.9_wp ) psr(j) = psr(j-1) |
---|
| 386 | IF ( pss(j) == 9999999.9_wp ) pss(j) = pss(j-1) |
---|
| 387 | IF ( psn(j) == 9999999.9_wp ) psn(j) = psn(j-1) |
---|
| 388 | IF ( psb(j) == 9999999.9_wp ) psb(j) = psb(j-1) |
---|
| 389 | IF ( pst(j) == 9999999.9_wp ) pst(j) = pst(j-1) |
---|
| 390 | IF ( pdx(j) == 9999999.9_wp .OR. pdx(j) == 0.0_wp ) pdx(j) = pdx(j-1) |
---|
| 391 | IF ( pdy(j) == 9999999.9_wp .OR. pdy(j) == 0.0_wp ) pdy(j) = pdy(j-1) |
---|
| 392 | IF ( pdz(j) == 9999999.9_wp .OR. pdz(j) == 0.0_wp ) pdz(j) = pdz(j-1) |
---|
[1] | 393 | ENDDO |
---|
| 394 | |
---|
| 395 | ! |
---|
[2312] | 396 | !-- Allocate arrays required for calculating particle SGS velocities. |
---|
[1929] | 397 | !-- Initialize prefactor required for stoachastic Weil equation. |
---|
[1822] | 398 | IF ( use_sgs_for_particles .AND. .NOT. cloud_droplets ) THEN |
---|
[849] | 399 | ALLOCATE( de_dx(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 400 | de_dy(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 401 | de_dz(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1929] | 402 | |
---|
[2312] | 403 | sgs_wf_part = 1.0_wp / 3.0_wp |
---|
[849] | 404 | ENDIF |
---|
| 405 | |
---|
| 406 | ! |
---|
[2312] | 407 | !-- Allocate array required for logarithmic vertical interpolation of |
---|
[1314] | 408 | !-- horizontal particle velocities between the surface and the first vertical |
---|
[2312] | 409 | !-- grid level. In order to avoid repeated CPU cost-intensive CALLS of |
---|
| 410 | !-- intrinsic FORTRAN procedure LOG(z/z0), LOG(z/z0) is precalculated for |
---|
| 411 | !-- several heights. Splitting into 20 sublayers turned out to be sufficient. |
---|
[1314] | 412 | !-- To obtain exact height levels of particles, linear interpolation is applied |
---|
| 413 | !-- (see lpm_advec.f90). |
---|
[1691] | 414 | IF ( constant_flux_layer ) THEN |
---|
[2312] | 415 | |
---|
| 416 | ALLOCATE ( log_z_z0(0:number_of_sublayers) ) |
---|
[2232] | 417 | z_p = zu(nzb+1) - zw(nzb) |
---|
[1314] | 418 | |
---|
| 419 | ! |
---|
| 420 | !-- Calculate horizontal mean value of z0 used for logartihmic |
---|
[2312] | 421 | !-- interpolation. Note: this is not exact for heterogeneous z0. |
---|
| 422 | !-- However, sensitivity studies showed that the effect is |
---|
| 423 | !-- negligible. |
---|
[2232] | 424 | z0_av_local = SUM( surf_def_h(0)%z0 ) + SUM( surf_lsm_h%z0 ) + & |
---|
| 425 | SUM( surf_usm_h%z0 ) |
---|
[1359] | 426 | z0_av_global = 0.0_wp |
---|
[1314] | 427 | |
---|
[1320] | 428 | #if defined( __parallel ) |
---|
[1314] | 429 | CALL MPI_ALLREDUCE(z0_av_local, z0_av_global, 1, MPI_REAL, MPI_SUM, & |
---|
| 430 | comm2d, ierr ) |
---|
[1320] | 431 | #else |
---|
| 432 | z0_av_global = z0_av_local |
---|
| 433 | #endif |
---|
[1314] | 434 | |
---|
| 435 | z0_av_global = z0_av_global / ( ( ny + 1 ) * ( nx + 1 ) ) |
---|
| 436 | ! |
---|
| 437 | !-- Horizontal wind speed is zero below and at z0 |
---|
[1359] | 438 | log_z_z0(0) = 0.0_wp |
---|
[1314] | 439 | ! |
---|
| 440 | !-- Calculate vertical depth of the sublayers |
---|
[1322] | 441 | height_int = ( z_p - z0_av_global ) / REAL( number_of_sublayers, KIND=wp ) |
---|
[1314] | 442 | ! |
---|
| 443 | !-- Precalculate LOG(z/z0) |
---|
[1929] | 444 | height_p = z0_av_global |
---|
[1314] | 445 | DO k = 1, number_of_sublayers |
---|
| 446 | |
---|
| 447 | height_p = height_p + height_int |
---|
| 448 | log_z_z0(k) = LOG( height_p / z0_av_global ) |
---|
| 449 | |
---|
| 450 | ENDDO |
---|
| 451 | |
---|
| 452 | ENDIF |
---|
| 453 | |
---|
| 454 | ! |
---|
[1359] | 455 | !-- Check boundary condition and set internal variables |
---|
| 456 | SELECT CASE ( bc_par_b ) |
---|
[2312] | 457 | |
---|
[1359] | 458 | CASE ( 'absorb' ) |
---|
| 459 | ibc_par_b = 1 |
---|
| 460 | |
---|
| 461 | CASE ( 'reflect' ) |
---|
| 462 | ibc_par_b = 2 |
---|
[2312] | 463 | |
---|
[1359] | 464 | CASE DEFAULT |
---|
| 465 | WRITE( message_string, * ) 'unknown boundary condition ', & |
---|
| 466 | 'bc_par_b = "', TRIM( bc_par_b ), '"' |
---|
| 467 | CALL message( 'lpm_init', 'PA0217', 1, 2, 0, 6, 0 ) |
---|
[2312] | 468 | |
---|
[1359] | 469 | END SELECT |
---|
| 470 | SELECT CASE ( bc_par_t ) |
---|
[2312] | 471 | |
---|
[1359] | 472 | CASE ( 'absorb' ) |
---|
| 473 | ibc_par_t = 1 |
---|
| 474 | |
---|
| 475 | CASE ( 'reflect' ) |
---|
| 476 | ibc_par_t = 2 |
---|
[2801] | 477 | |
---|
| 478 | CASE ( 'nested' ) |
---|
| 479 | ibc_par_t = 3 |
---|
[2312] | 480 | |
---|
[1359] | 481 | CASE DEFAULT |
---|
| 482 | WRITE( message_string, * ) 'unknown boundary condition ', & |
---|
| 483 | 'bc_par_t = "', TRIM( bc_par_t ), '"' |
---|
| 484 | CALL message( 'lpm_init', 'PA0218', 1, 2, 0, 6, 0 ) |
---|
[2312] | 485 | |
---|
[1359] | 486 | END SELECT |
---|
| 487 | SELECT CASE ( bc_par_lr ) |
---|
| 488 | |
---|
| 489 | CASE ( 'cyclic' ) |
---|
| 490 | ibc_par_lr = 0 |
---|
| 491 | |
---|
| 492 | CASE ( 'absorb' ) |
---|
| 493 | ibc_par_lr = 1 |
---|
| 494 | |
---|
| 495 | CASE ( 'reflect' ) |
---|
| 496 | ibc_par_lr = 2 |
---|
[2801] | 497 | |
---|
| 498 | CASE ( 'nested' ) |
---|
| 499 | ibc_par_lr = 3 |
---|
[2312] | 500 | |
---|
[1359] | 501 | CASE DEFAULT |
---|
| 502 | WRITE( message_string, * ) 'unknown boundary condition ', & |
---|
| 503 | 'bc_par_lr = "', TRIM( bc_par_lr ), '"' |
---|
| 504 | CALL message( 'lpm_init', 'PA0219', 1, 2, 0, 6, 0 ) |
---|
[2312] | 505 | |
---|
[1359] | 506 | END SELECT |
---|
| 507 | SELECT CASE ( bc_par_ns ) |
---|
| 508 | |
---|
| 509 | CASE ( 'cyclic' ) |
---|
| 510 | ibc_par_ns = 0 |
---|
| 511 | |
---|
| 512 | CASE ( 'absorb' ) |
---|
| 513 | ibc_par_ns = 1 |
---|
| 514 | |
---|
| 515 | CASE ( 'reflect' ) |
---|
| 516 | ibc_par_ns = 2 |
---|
[2801] | 517 | |
---|
| 518 | CASE ( 'nested' ) |
---|
| 519 | ibc_par_ns = 3 |
---|
[2312] | 520 | |
---|
[1359] | 521 | CASE DEFAULT |
---|
| 522 | WRITE( message_string, * ) 'unknown boundary condition ', & |
---|
| 523 | 'bc_par_ns = "', TRIM( bc_par_ns ), '"' |
---|
| 524 | CALL message( 'lpm_init', 'PA0220', 1, 2, 0, 6, 0 ) |
---|
[2312] | 525 | |
---|
[1359] | 526 | END SELECT |
---|
[2263] | 527 | SELECT CASE ( splitting_mode ) |
---|
[2312] | 528 | |
---|
[2263] | 529 | CASE ( 'const' ) |
---|
| 530 | i_splitting_mode = 1 |
---|
[1359] | 531 | |
---|
[2263] | 532 | CASE ( 'cl_av' ) |
---|
| 533 | i_splitting_mode = 2 |
---|
| 534 | |
---|
| 535 | CASE ( 'gb_av' ) |
---|
| 536 | i_splitting_mode = 3 |
---|
[2312] | 537 | |
---|
[2263] | 538 | CASE DEFAULT |
---|
| 539 | WRITE( message_string, * ) 'unknown splitting condition ', & |
---|
| 540 | 'splitting_mode = "', TRIM( splitting_mode ), '"' |
---|
| 541 | CALL message( 'lpm_init', 'PA0146', 1, 2, 0, 6, 0 ) |
---|
[2312] | 542 | |
---|
[2263] | 543 | END SELECT |
---|
| 544 | SELECT CASE ( splitting_function ) |
---|
[2312] | 545 | |
---|
[2263] | 546 | CASE ( 'gamma' ) |
---|
| 547 | isf = 1 |
---|
| 548 | |
---|
| 549 | CASE ( 'log' ) |
---|
| 550 | isf = 2 |
---|
| 551 | |
---|
| 552 | CASE ( 'exp' ) |
---|
| 553 | isf = 3 |
---|
[2312] | 554 | |
---|
[2263] | 555 | CASE DEFAULT |
---|
| 556 | WRITE( message_string, * ) 'unknown splitting function ', & |
---|
| 557 | 'splitting_function = "', TRIM( splitting_function ), '"' |
---|
| 558 | CALL message( 'lpm_init', 'PA0147', 1, 2, 0, 6, 0 ) |
---|
[2312] | 559 | |
---|
[2263] | 560 | END SELECT |
---|
| 561 | |
---|
[2312] | 562 | |
---|
[1359] | 563 | ! |
---|
[828] | 564 | !-- Initialize collision kernels |
---|
| 565 | IF ( collision_kernel /= 'none' ) CALL init_kernels |
---|
| 566 | |
---|
| 567 | ! |
---|
[1] | 568 | !-- For the first model run of a possible job chain initialize the |
---|
[849] | 569 | !-- particles, otherwise read the particle data from restart file. |
---|
[1] | 570 | IF ( TRIM( initializing_actions ) == 'read_restart_data' & |
---|
| 571 | .AND. read_particles_from_restartfile ) THEN |
---|
| 572 | |
---|
[849] | 573 | CALL lpm_read_restart_file |
---|
[1] | 574 | |
---|
| 575 | ELSE |
---|
| 576 | |
---|
| 577 | ! |
---|
| 578 | !-- Allocate particle arrays and set attributes of the initial set of |
---|
| 579 | !-- particles, which can be also periodically released at later times. |
---|
[1359] | 580 | ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 581 | grid_particles(nzb+1:nzt,nys:nyn,nxl:nxr) ) |
---|
[1] | 582 | |
---|
[1359] | 583 | number_of_particles = 0 |
---|
[792] | 584 | |
---|
| 585 | sort_count = 0 |
---|
[1359] | 586 | prt_count = 0 |
---|
[792] | 587 | |
---|
[1] | 588 | ! |
---|
[2312] | 589 | !-- initialize counter for particle IDs |
---|
[2305] | 590 | grid_particles%id_counter = 1 |
---|
[2122] | 591 | |
---|
| 592 | ! |
---|
[1] | 593 | !-- Initialize all particles with dummy values (otherwise errors may |
---|
| 594 | !-- occur within restart runs). The reason for this is still not clear |
---|
| 595 | !-- and may be presumably caused by errors in the respective user-interface. |
---|
[1359] | 596 | zero_particle = particle_type( 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, & |
---|
| 597 | 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, & |
---|
| 598 | 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, & |
---|
[2312] | 599 | 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, & |
---|
[2305] | 600 | 0, 0, 0_idp, .FALSE., -1 ) |
---|
[1822] | 601 | |
---|
[1359] | 602 | particle_groups = particle_groups_type( 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp ) |
---|
[1] | 603 | |
---|
| 604 | ! |
---|
| 605 | !-- Set values for the density ratio and radius for all particle |
---|
| 606 | !-- groups, if necessary |
---|
[1359] | 607 | IF ( density_ratio(1) == 9999999.9_wp ) density_ratio(1) = 0.0_wp |
---|
| 608 | IF ( radius(1) == 9999999.9_wp ) radius(1) = 0.0_wp |
---|
[1] | 609 | DO i = 2, number_of_particle_groups |
---|
[1359] | 610 | IF ( density_ratio(i) == 9999999.9_wp ) THEN |
---|
[1] | 611 | density_ratio(i) = density_ratio(i-1) |
---|
| 612 | ENDIF |
---|
[1359] | 613 | IF ( radius(i) == 9999999.9_wp ) radius(i) = radius(i-1) |
---|
[1] | 614 | ENDDO |
---|
| 615 | |
---|
| 616 | DO i = 1, number_of_particle_groups |
---|
[1359] | 617 | IF ( density_ratio(i) /= 0.0_wp .AND. radius(i) == 0 ) THEN |
---|
[254] | 618 | WRITE( message_string, * ) 'particle group #', i, 'has a', & |
---|
| 619 | 'density ratio /= 0 but radius = 0' |
---|
[849] | 620 | CALL message( 'lpm_init', 'PA0215', 1, 2, 0, 6, 0 ) |
---|
[1] | 621 | ENDIF |
---|
| 622 | particle_groups(i)%density_ratio = density_ratio(i) |
---|
| 623 | particle_groups(i)%radius = radius(i) |
---|
| 624 | ENDDO |
---|
| 625 | |
---|
| 626 | ! |
---|
[1359] | 627 | !-- Set a seed value for the random number generator to be exclusively |
---|
| 628 | !-- used for the particle code. The generated random numbers should be |
---|
| 629 | !-- different on the different PEs. |
---|
| 630 | iran_part = iran_part + myid |
---|
| 631 | |
---|
[1725] | 632 | CALL lpm_create_particle (PHASE_INIT) |
---|
[1359] | 633 | ! |
---|
| 634 | !-- User modification of initial particles |
---|
| 635 | CALL user_lpm_init |
---|
| 636 | |
---|
| 637 | ! |
---|
| 638 | !-- Open file for statistical informations about particle conditions |
---|
| 639 | IF ( write_particle_statistics ) THEN |
---|
| 640 | CALL check_open( 80 ) |
---|
| 641 | WRITE ( 80, 8000 ) current_timestep_number, simulated_time, & |
---|
[2312] | 642 | number_of_particles |
---|
[1359] | 643 | CALL close_file( 80 ) |
---|
| 644 | ENDIF |
---|
| 645 | |
---|
| 646 | ENDIF |
---|
| 647 | |
---|
[2967] | 648 | IF ( nested_run ) CALL pmcp_g_init |
---|
[2801] | 649 | |
---|
[1359] | 650 | ! |
---|
[2312] | 651 | !-- To avoid programm abort, assign particles array to the local version of |
---|
[1359] | 652 | !-- first grid cell |
---|
| 653 | number_of_particles = prt_count(nzb+1,nys,nxl) |
---|
| 654 | particles => grid_particles(nzb+1,nys,nxl)%particles(1:number_of_particles) |
---|
| 655 | ! |
---|
| 656 | !-- Formats |
---|
| 657 | 8000 FORMAT (I6,1X,F7.2,4X,I10,71X,I10) |
---|
| 658 | |
---|
| 659 | END SUBROUTINE lpm_init |
---|
| 660 | |
---|
[1682] | 661 | !------------------------------------------------------------------------------! |
---|
| 662 | ! Description: |
---|
| 663 | ! ------------ |
---|
| 664 | !> @todo Missing subroutine description. |
---|
| 665 | !------------------------------------------------------------------------------! |
---|
[1359] | 666 | SUBROUTINE lpm_create_particle (phase) |
---|
[2628] | 667 | |
---|
| 668 | USE arrays_3d, & |
---|
| 669 | ONLY: zw |
---|
[1359] | 670 | USE lpm_exchange_horiz_mod, & |
---|
| 671 | ONLY: lpm_exchange_horiz, lpm_move_particle, realloc_particles_array |
---|
| 672 | |
---|
[2628] | 673 | USE lpm_pack_and_sort_mod, & |
---|
[2606] | 674 | ONLY: lpm_sort_in_subboxes |
---|
[1359] | 675 | |
---|
[1871] | 676 | USE particle_attributes, & |
---|
[2312] | 677 | ONLY: deleted_particles |
---|
[1871] | 678 | |
---|
[1359] | 679 | IMPLICIT NONE |
---|
| 680 | |
---|
[1929] | 681 | INTEGER(iwp) :: alloc_size !< relative increase of allocated memory for particles |
---|
| 682 | INTEGER(iwp) :: i !< loop variable ( particle groups ) |
---|
| 683 | INTEGER(iwp) :: ip !< index variable along x |
---|
| 684 | INTEGER(iwp) :: j !< loop variable ( particles per point ) |
---|
| 685 | INTEGER(iwp) :: jp !< index variable along y |
---|
[2232] | 686 | INTEGER(iwp) :: k !< index variable along z |
---|
| 687 | INTEGER(iwp) :: k_surf !< index of surface grid point |
---|
[1929] | 688 | INTEGER(iwp) :: kp !< index variable along z |
---|
| 689 | INTEGER(iwp) :: loop_stride !< loop variable for initialization |
---|
| 690 | INTEGER(iwp) :: n !< loop variable ( number of particles ) |
---|
| 691 | INTEGER(iwp) :: new_size !< new size of allocated memory for particles |
---|
[1359] | 692 | |
---|
[1929] | 693 | INTEGER(iwp), INTENT(IN) :: phase !< mode of inititialization |
---|
[1359] | 694 | |
---|
[1929] | 695 | INTEGER(iwp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: local_count !< start address of new particle |
---|
| 696 | INTEGER(iwp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: local_start !< start address of new particle |
---|
[1359] | 697 | |
---|
[1929] | 698 | LOGICAL :: first_stride !< flag for initialization |
---|
[1359] | 699 | |
---|
[2312] | 700 | REAL(wp) :: pos_x !< increment for particle position in x |
---|
| 701 | REAL(wp) :: pos_y !< increment for particle position in y |
---|
| 702 | REAL(wp) :: pos_z !< increment for particle position in z |
---|
[1929] | 703 | REAL(wp) :: rand_contr !< dummy argument for random position |
---|
[1359] | 704 | |
---|
[1929] | 705 | TYPE(particle_type),TARGET :: tmp_particle !< temporary particle used for initialization |
---|
[1359] | 706 | |
---|
| 707 | ! |
---|
| 708 | !-- Calculate particle positions and store particle attributes, if |
---|
| 709 | !-- particle is situated on this PE |
---|
| 710 | DO loop_stride = 1, 2 |
---|
| 711 | first_stride = (loop_stride == 1) |
---|
| 712 | IF ( first_stride ) THEN |
---|
| 713 | local_count = 0 ! count number of particles |
---|
| 714 | ELSE |
---|
| 715 | local_count = prt_count ! Start address of new particles |
---|
| 716 | ENDIF |
---|
| 717 | |
---|
[2182] | 718 | ! |
---|
| 719 | !-- Calculate initial_weighting_factor diagnostically |
---|
| 720 | IF ( number_concentration /= -1.0_wp .AND. number_concentration > 0.0_wp ) THEN |
---|
[2312] | 721 | initial_weighting_factor = number_concentration * 1.0E6_wp * & |
---|
| 722 | pdx(1) * pdy(1) * pdz(1) |
---|
[2182] | 723 | END IF |
---|
| 724 | |
---|
[1] | 725 | n = 0 |
---|
| 726 | DO i = 1, number_of_particle_groups |
---|
| 727 | |
---|
| 728 | pos_z = psb(i) |
---|
| 729 | |
---|
| 730 | DO WHILE ( pos_z <= pst(i) ) |
---|
| 731 | |
---|
[2954] | 732 | IF ( pos_z >= zw(0) .AND. pos_z < zw(nzt) ) THEN |
---|
[1] | 733 | |
---|
| 734 | |
---|
[2223] | 735 | pos_y = pss(i) |
---|
[1] | 736 | |
---|
[2223] | 737 | DO WHILE ( pos_y <= psn(i) ) |
---|
[1] | 738 | |
---|
[2606] | 739 | IF ( pos_y >= nys * dy .AND. & |
---|
| 740 | pos_y < ( nyn + 1 ) * dy ) THEN |
---|
[1] | 741 | |
---|
[2223] | 742 | pos_x = psl(i) |
---|
[1] | 743 | |
---|
[2223] | 744 | xloop: DO WHILE ( pos_x <= psr(i) ) |
---|
[1] | 745 | |
---|
[2606] | 746 | IF ( pos_x >= nxl * dx .AND. & |
---|
| 747 | pos_x < ( nxr + 1) * dx ) THEN |
---|
[2223] | 748 | |
---|
| 749 | DO j = 1, particles_per_point |
---|
| 750 | |
---|
[2305] | 751 | |
---|
[2223] | 752 | n = n + 1 |
---|
| 753 | tmp_particle%x = pos_x |
---|
| 754 | tmp_particle%y = pos_y |
---|
| 755 | tmp_particle%z = pos_z |
---|
| 756 | tmp_particle%age = 0.0_wp |
---|
| 757 | tmp_particle%age_m = 0.0_wp |
---|
| 758 | tmp_particle%dt_sum = 0.0_wp |
---|
| 759 | tmp_particle%e_m = 0.0_wp |
---|
[2312] | 760 | tmp_particle%rvar1 = 0.0_wp |
---|
| 761 | tmp_particle%rvar2 = 0.0_wp |
---|
| 762 | tmp_particle%rvar3 = 0.0_wp |
---|
[2223] | 763 | tmp_particle%speed_x = 0.0_wp |
---|
| 764 | tmp_particle%speed_y = 0.0_wp |
---|
| 765 | tmp_particle%speed_z = 0.0_wp |
---|
| 766 | tmp_particle%origin_x = pos_x |
---|
| 767 | tmp_particle%origin_y = pos_y |
---|
| 768 | tmp_particle%origin_z = pos_z |
---|
[2312] | 769 | IF ( curvature_solution_effects ) THEN |
---|
| 770 | tmp_particle%aux1 = 0.0_wp ! dry aerosol radius |
---|
| 771 | tmp_particle%aux2 = dt_3d ! last Rosenbrock timestep |
---|
| 772 | ELSE |
---|
| 773 | tmp_particle%aux1 = 0.0_wp ! free to use |
---|
| 774 | tmp_particle%aux2 = 0.0_wp ! free to use |
---|
| 775 | ENDIF |
---|
[2223] | 776 | tmp_particle%radius = particle_groups(i)%radius |
---|
| 777 | tmp_particle%weight_factor = initial_weighting_factor |
---|
| 778 | tmp_particle%class = 1 |
---|
| 779 | tmp_particle%group = i |
---|
[2305] | 780 | tmp_particle%id = 0_idp |
---|
[2223] | 781 | tmp_particle%particle_mask = .TRUE. |
---|
| 782 | tmp_particle%block_nr = -1 |
---|
[1] | 783 | ! |
---|
[2223] | 784 | !-- Determine the grid indices of the particle position |
---|
[2606] | 785 | ip = tmp_particle%x * ddx |
---|
| 786 | jp = tmp_particle%y * ddy |
---|
[2628] | 787 | kp = tmp_particle%z / dz + 1 + offset_ocean_nzt |
---|
| 788 | DO WHILE( zw(kp) < tmp_particle%z ) |
---|
| 789 | kp = kp + 1 |
---|
| 790 | ENDDO |
---|
| 791 | DO WHILE( zw(kp-1) > tmp_particle%z ) |
---|
| 792 | kp = kp - 1 |
---|
| 793 | ENDDO |
---|
[2232] | 794 | ! |
---|
| 795 | !-- Determine surface level. Therefore, check for |
---|
[2317] | 796 | !-- upward-facing wall on w-grid. |
---|
[2698] | 797 | k_surf = get_topography_top_index_ji( jp, ip, 'w' ) |
---|
[1] | 798 | |
---|
[2223] | 799 | IF ( seed_follows_topography ) THEN |
---|
[1575] | 800 | ! |
---|
[2223] | 801 | !-- Particle height is given relative to topography |
---|
[2232] | 802 | kp = kp + k_surf |
---|
| 803 | tmp_particle%z = tmp_particle%z + zw(k_surf) |
---|
| 804 | !-- Skip particle release if particle position is |
---|
| 805 | !-- above model top, or within topography in case |
---|
| 806 | !-- of overhanging structures. |
---|
| 807 | IF ( kp > nzt .OR. & |
---|
| 808 | .NOT. BTEST( wall_flags_0(kp,jp,ip), 0 ) ) THEN |
---|
[2223] | 809 | pos_x = pos_x + pdx(i) |
---|
| 810 | CYCLE xloop |
---|
| 811 | ENDIF |
---|
[2232] | 812 | ! |
---|
[2312] | 813 | !-- Skip particle release if particle position is |
---|
[2232] | 814 | !-- below surface, or within topography in case |
---|
| 815 | !-- of overhanging structures. |
---|
[2223] | 816 | ELSEIF ( .NOT. seed_follows_topography .AND. & |
---|
[2232] | 817 | tmp_particle%z <= zw(k_surf) .OR. & |
---|
| 818 | .NOT. BTEST( wall_flags_0(kp,jp,ip), 0 ) )& |
---|
| 819 | THEN |
---|
[1575] | 820 | pos_x = pos_x + pdx(i) |
---|
[2312] | 821 | CYCLE xloop |
---|
[1575] | 822 | ENDIF |
---|
| 823 | |
---|
[2223] | 824 | local_count(kp,jp,ip) = local_count(kp,jp,ip) + 1 |
---|
[2182] | 825 | |
---|
[2223] | 826 | IF ( .NOT. first_stride ) THEN |
---|
| 827 | IF ( ip < nxl .OR. jp < nys .OR. kp < nzb+1 ) THEN |
---|
| 828 | write(6,*) 'xl ',ip,jp,kp,nxl,nys,nzb+1 |
---|
| 829 | ENDIF |
---|
| 830 | IF ( ip > nxr .OR. jp > nyn .OR. kp > nzt ) THEN |
---|
| 831 | write(6,*) 'xu ',ip,jp,kp,nxr,nyn,nzt |
---|
| 832 | ENDIF |
---|
| 833 | grid_particles(kp,jp,ip)%particles(local_count(kp,jp,ip)) = tmp_particle |
---|
| 834 | |
---|
[1359] | 835 | ENDIF |
---|
[2223] | 836 | ENDDO |
---|
[1929] | 837 | |
---|
[2223] | 838 | ENDIF |
---|
[1] | 839 | |
---|
[2223] | 840 | pos_x = pos_x + pdx(i) |
---|
[1] | 841 | |
---|
[2223] | 842 | ENDDO xloop |
---|
[1] | 843 | |
---|
[2223] | 844 | ENDIF |
---|
[1] | 845 | |
---|
[2223] | 846 | pos_y = pos_y + pdy(i) |
---|
[1] | 847 | |
---|
[2223] | 848 | ENDDO |
---|
[1] | 849 | |
---|
[2223] | 850 | ENDIF |
---|
[1] | 851 | |
---|
| 852 | pos_z = pos_z + pdz(i) |
---|
| 853 | |
---|
| 854 | ENDDO |
---|
| 855 | |
---|
| 856 | ENDDO |
---|
| 857 | |
---|
[1359] | 858 | IF ( first_stride ) THEN |
---|
| 859 | DO ip = nxl, nxr |
---|
| 860 | DO jp = nys, nyn |
---|
| 861 | DO kp = nzb+1, nzt |
---|
| 862 | IF ( phase == PHASE_INIT ) THEN |
---|
| 863 | IF ( local_count(kp,jp,ip) > 0 ) THEN |
---|
| 864 | alloc_size = MAX( INT( local_count(kp,jp,ip) * & |
---|
| 865 | ( 1.0_wp + alloc_factor / 100.0_wp ) ), & |
---|
| 866 | min_nr_particle ) |
---|
| 867 | ELSE |
---|
| 868 | alloc_size = min_nr_particle |
---|
| 869 | ENDIF |
---|
| 870 | ALLOCATE(grid_particles(kp,jp,ip)%particles(1:alloc_size)) |
---|
| 871 | DO n = 1, alloc_size |
---|
| 872 | grid_particles(kp,jp,ip)%particles(n) = zero_particle |
---|
| 873 | ENDDO |
---|
| 874 | ELSEIF ( phase == PHASE_RELEASE ) THEN |
---|
| 875 | IF ( local_count(kp,jp,ip) > 0 ) THEN |
---|
| 876 | new_size = local_count(kp,jp,ip) + prt_count(kp,jp,ip) |
---|
| 877 | alloc_size = MAX( INT( new_size * ( 1.0_wp + & |
---|
| 878 | alloc_factor / 100.0_wp ) ), min_nr_particle ) |
---|
| 879 | IF( alloc_size > SIZE( grid_particles(kp,jp,ip)%particles) ) THEN |
---|
[2182] | 880 | CALL realloc_particles_array(ip,jp,kp,alloc_size) |
---|
[1359] | 881 | ENDIF |
---|
| 882 | ENDIF |
---|
| 883 | ENDIF |
---|
| 884 | ENDDO |
---|
| 885 | ENDDO |
---|
| 886 | ENDDO |
---|
| 887 | ENDIF |
---|
[1929] | 888 | |
---|
[1359] | 889 | ENDDO |
---|
[1] | 890 | |
---|
[2182] | 891 | |
---|
| 892 | |
---|
[1359] | 893 | local_start = prt_count+1 |
---|
| 894 | prt_count = local_count |
---|
[1871] | 895 | |
---|
[1] | 896 | ! |
---|
[2122] | 897 | !-- Calculate particle IDs |
---|
| 898 | DO ip = nxl, nxr |
---|
| 899 | DO jp = nys, nyn |
---|
| 900 | DO kp = nzb+1, nzt |
---|
| 901 | number_of_particles = prt_count(kp,jp,ip) |
---|
| 902 | IF ( number_of_particles <= 0 ) CYCLE |
---|
| 903 | particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles) |
---|
| 904 | |
---|
[2312] | 905 | DO n = local_start(kp,jp,ip), number_of_particles !only new particles |
---|
[2122] | 906 | |
---|
[2305] | 907 | particles(n)%id = 10000_idp**3 * grid_particles(kp,jp,ip)%id_counter + & |
---|
| 908 | 10000_idp**2 * kp + 10000_idp * jp + ip |
---|
| 909 | ! |
---|
| 910 | !-- Count the number of particles that have been released before |
---|
[2122] | 911 | grid_particles(kp,jp,ip)%id_counter = & |
---|
| 912 | grid_particles(kp,jp,ip)%id_counter + 1 |
---|
| 913 | |
---|
| 914 | ENDDO |
---|
| 915 | |
---|
| 916 | ENDDO |
---|
| 917 | ENDDO |
---|
| 918 | ENDDO |
---|
| 919 | |
---|
| 920 | ! |
---|
[1871] | 921 | !-- Initialize aerosol background spectrum |
---|
[2312] | 922 | IF ( curvature_solution_effects ) THEN |
---|
[1871] | 923 | CALL lpm_init_aerosols(local_start) |
---|
| 924 | ENDIF |
---|
| 925 | |
---|
| 926 | ! |
---|
[1929] | 927 | !-- Add random fluctuation to particle positions. |
---|
[1359] | 928 | IF ( random_start_position ) THEN |
---|
| 929 | DO ip = nxl, nxr |
---|
| 930 | DO jp = nys, nyn |
---|
| 931 | DO kp = nzb+1, nzt |
---|
| 932 | number_of_particles = prt_count(kp,jp,ip) |
---|
| 933 | IF ( number_of_particles <= 0 ) CYCLE |
---|
| 934 | particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles) |
---|
[1929] | 935 | ! |
---|
[2312] | 936 | !-- Move only new particles. Moreover, limit random fluctuation |
---|
| 937 | !-- in order to prevent that particles move more than one grid box, |
---|
| 938 | !-- which would lead to problems concerning particle exchange |
---|
| 939 | !-- between processors in case pdx/pdy are larger than dx/dy, |
---|
| 940 | !-- respectively. |
---|
[1929] | 941 | DO n = local_start(kp,jp,ip), number_of_particles |
---|
[1359] | 942 | IF ( psl(particles(n)%group) /= psr(particles(n)%group) ) THEN |
---|
[1929] | 943 | rand_contr = ( random_function( iran_part ) - 0.5_wp ) * & |
---|
| 944 | pdx(particles(n)%group) |
---|
[1359] | 945 | particles(n)%x = particles(n)%x + & |
---|
[2232] | 946 | MERGE( rand_contr, SIGN( dx, rand_contr ), & |
---|
[1929] | 947 | ABS( rand_contr ) < dx & |
---|
[2312] | 948 | ) |
---|
[1359] | 949 | ENDIF |
---|
| 950 | IF ( pss(particles(n)%group) /= psn(particles(n)%group) ) THEN |
---|
[1929] | 951 | rand_contr = ( random_function( iran_part ) - 0.5_wp ) * & |
---|
| 952 | pdy(particles(n)%group) |
---|
[1359] | 953 | particles(n)%y = particles(n)%y + & |
---|
[2232] | 954 | MERGE( rand_contr, SIGN( dy, rand_contr ), & |
---|
[1929] | 955 | ABS( rand_contr ) < dy & |
---|
[2312] | 956 | ) |
---|
[1359] | 957 | ENDIF |
---|
| 958 | IF ( psb(particles(n)%group) /= pst(particles(n)%group) ) THEN |
---|
[1929] | 959 | rand_contr = ( random_function( iran_part ) - 0.5_wp ) * & |
---|
| 960 | pdz(particles(n)%group) |
---|
[1359] | 961 | particles(n)%z = particles(n)%z + & |
---|
[2232] | 962 | MERGE( rand_contr, SIGN( dz, rand_contr ), & |
---|
[1929] | 963 | ABS( rand_contr ) < dz & |
---|
[2312] | 964 | ) |
---|
[1359] | 965 | ENDIF |
---|
| 966 | ENDDO |
---|
[1] | 967 | ! |
---|
[1929] | 968 | !-- Identify particles located outside the model domain and reflect |
---|
| 969 | !-- or absorb them if necessary. |
---|
[2698] | 970 | CALL lpm_boundary_conds( 'bottom/top', i, j, k ) |
---|
[1929] | 971 | ! |
---|
| 972 | !-- Furthermore, remove particles located in topography. Note, as |
---|
[2312] | 973 | !-- the particle speed is still zero at this point, wall |
---|
[1929] | 974 | !-- reflection boundary conditions will not work in this case. |
---|
| 975 | particles => & |
---|
| 976 | grid_particles(kp,jp,ip)%particles(1:number_of_particles) |
---|
| 977 | DO n = local_start(kp,jp,ip), number_of_particles |
---|
[2606] | 978 | i = particles(n)%x * ddx |
---|
| 979 | j = particles(n)%y * ddy |
---|
[2628] | 980 | k = particles(n)%z / dz + 1 + offset_ocean_nzt |
---|
| 981 | DO WHILE( zw(k) < particles(n)%z ) |
---|
| 982 | k = k + 1 |
---|
| 983 | ENDDO |
---|
| 984 | DO WHILE( zw(k-1) > particles(n)%z ) |
---|
| 985 | k = k - 1 |
---|
| 986 | ENDDO |
---|
[2232] | 987 | ! |
---|
| 988 | !-- Check if particle is within topography |
---|
| 989 | IF ( .NOT. BTEST( wall_flags_0(k,j,i), 0 ) ) THEN |
---|
[1929] | 990 | particles(n)%particle_mask = .FALSE. |
---|
| 991 | deleted_particles = deleted_particles + 1 |
---|
| 992 | ENDIF |
---|
[2232] | 993 | |
---|
[1929] | 994 | ENDDO |
---|
[1359] | 995 | ENDDO |
---|
| 996 | ENDDO |
---|
| 997 | ENDDO |
---|
[1] | 998 | ! |
---|
[1359] | 999 | !-- Exchange particles between grid cells and processors |
---|
| 1000 | CALL lpm_move_particle |
---|
| 1001 | CALL lpm_exchange_horiz |
---|
[1] | 1002 | |
---|
[1359] | 1003 | ENDIF |
---|
[1] | 1004 | ! |
---|
[2312] | 1005 | !-- In case of random_start_position, delete particles identified by |
---|
| 1006 | !-- lpm_exchange_horiz and lpm_boundary_conds. Then sort particles into blocks, |
---|
| 1007 | !-- which is needed for a fast interpolation of the LES fields on the particle |
---|
[1359] | 1008 | !-- position. |
---|
[2606] | 1009 | CALL lpm_sort_in_subboxes |
---|
[1] | 1010 | |
---|
| 1011 | ! |
---|
[2265] | 1012 | !-- Determine the current number of particles |
---|
[1359] | 1013 | DO ip = nxl, nxr |
---|
| 1014 | DO jp = nys, nyn |
---|
| 1015 | DO kp = nzb+1, nzt |
---|
| 1016 | number_of_particles = number_of_particles & |
---|
| 1017 | + prt_count(kp,jp,ip) |
---|
[1] | 1018 | ENDDO |
---|
[1359] | 1019 | ENDDO |
---|
| 1020 | ENDDO |
---|
[1] | 1021 | ! |
---|
[1822] | 1022 | !-- Calculate the number of particles of the total domain |
---|
[1] | 1023 | #if defined( __parallel ) |
---|
[1359] | 1024 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1025 | CALL MPI_ALLREDUCE( number_of_particles, total_number_of_particles, 1, & |
---|
| 1026 | MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
[1] | 1027 | #else |
---|
[1359] | 1028 | total_number_of_particles = number_of_particles |
---|
[1] | 1029 | #endif |
---|
| 1030 | |
---|
[1359] | 1031 | RETURN |
---|
[1] | 1032 | |
---|
[1359] | 1033 | END SUBROUTINE lpm_create_particle |
---|
[336] | 1034 | |
---|
[1871] | 1035 | SUBROUTINE lpm_init_aerosols(local_start) |
---|
| 1036 | |
---|
| 1037 | USE arrays_3d, & |
---|
[2312] | 1038 | ONLY: hyp, pt, q |
---|
[1871] | 1039 | |
---|
| 1040 | USE cloud_parameters, & |
---|
[2375] | 1041 | ONLY: l_d_rv, molecular_weight_of_solute, & |
---|
| 1042 | molecular_weight_of_water, rho_l, r_v, rho_s, vanthoff |
---|
[1871] | 1043 | |
---|
| 1044 | USE constants, & |
---|
| 1045 | ONLY: pi |
---|
| 1046 | |
---|
[2608] | 1047 | USE diagnostic_quantities_mod, & |
---|
| 1048 | ONLY: magnus |
---|
| 1049 | |
---|
| 1050 | |
---|
[1871] | 1051 | USE kinds |
---|
| 1052 | |
---|
| 1053 | USE particle_attributes, & |
---|
[2375] | 1054 | ONLY: aero_species, aero_type, aero_weight, log_sigma, na, rm |
---|
[1871] | 1055 | |
---|
| 1056 | IMPLICIT NONE |
---|
| 1057 | |
---|
[2122] | 1058 | REAL(wp) :: afactor !< curvature effects |
---|
[1871] | 1059 | REAL(wp) :: bfactor !< solute effects |
---|
[2312] | 1060 | REAL(wp) :: dlogr !< logarithmic width of radius bin |
---|
[1871] | 1061 | REAL(wp) :: e_a !< vapor pressure |
---|
| 1062 | REAL(wp) :: e_s !< saturation vapor pressure |
---|
[2312] | 1063 | REAL(wp) :: rmin = 0.005e-6_wp !< minimum aerosol radius |
---|
| 1064 | REAL(wp) :: rmax = 10.0e-6_wp !< maximum aerosol radius |
---|
| 1065 | REAL(wp) :: r_mid !< mean radius of bin |
---|
| 1066 | REAL(wp) :: r_l !< left radius of bin |
---|
| 1067 | REAL(wp) :: r_r !< right radius of bin |
---|
[2122] | 1068 | REAL(wp) :: sigma !< surface tension |
---|
[1871] | 1069 | REAL(wp) :: t_int !< temperature |
---|
| 1070 | |
---|
[1890] | 1071 | INTEGER(iwp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg), INTENT(IN) :: local_start !< |
---|
[1871] | 1072 | |
---|
| 1073 | INTEGER(iwp) :: n !< |
---|
| 1074 | INTEGER(iwp) :: ip !< |
---|
| 1075 | INTEGER(iwp) :: jp !< |
---|
| 1076 | INTEGER(iwp) :: kp !< |
---|
| 1077 | |
---|
| 1078 | ! |
---|
[2375] | 1079 | !-- Set constants for different aerosol species |
---|
| 1080 | IF ( TRIM(aero_species) .EQ. 'nacl' ) THEN |
---|
| 1081 | molecular_weight_of_solute = 0.05844_wp |
---|
| 1082 | rho_s = 2165.0_wp |
---|
| 1083 | vanthoff = 2.0_wp |
---|
| 1084 | ELSEIF ( TRIM(aero_species) .EQ. 'c3h4o4' ) THEN |
---|
| 1085 | molecular_weight_of_solute = 0.10406_wp |
---|
| 1086 | rho_s = 1600.0_wp |
---|
| 1087 | vanthoff = 1.37_wp |
---|
| 1088 | ELSEIF ( TRIM(aero_species) .EQ. 'nh4o3' ) THEN |
---|
| 1089 | molecular_weight_of_solute = 0.08004_wp |
---|
| 1090 | rho_s = 1720.0_wp |
---|
| 1091 | vanthoff = 2.31_wp |
---|
| 1092 | ELSE |
---|
| 1093 | WRITE( message_string, * ) 'unknown aerosol species ', & |
---|
| 1094 | 'aero_species = "', TRIM( aero_species ), '"' |
---|
| 1095 | CALL message( 'lpm_init', 'PA0470', 1, 2, 0, 6, 0 ) |
---|
| 1096 | ENDIF |
---|
| 1097 | ! |
---|
[2312] | 1098 | !-- The following typical aerosol spectra are taken from Jaenicke (1993): |
---|
| 1099 | !-- Tropospheric aerosols. Published in Aerosol-Cloud-Climate Interactions. |
---|
| 1100 | IF ( TRIM(aero_type) .EQ. 'polar' ) THEN |
---|
| 1101 | na = (/ 2.17e1, 1.86e-1, 3.04e-4 /) * 1.0E6 |
---|
| 1102 | rm = (/ 0.0689, 0.375, 4.29 /) * 1.0E-6 |
---|
| 1103 | log_sigma = (/ 0.245, 0.300, 0.291 /) |
---|
| 1104 | ELSEIF ( TRIM(aero_type) .EQ. 'background' ) THEN |
---|
| 1105 | na = (/ 1.29e2, 5.97e1, 6.35e1 /) * 1.0E6 |
---|
| 1106 | rm = (/ 0.0036, 0.127, 0.259 /) * 1.0E-6 |
---|
| 1107 | log_sigma = (/ 0.645, 0.253, 0.425 /) |
---|
| 1108 | ELSEIF ( TRIM(aero_type) .EQ. 'maritime' ) THEN |
---|
| 1109 | na = (/ 1.33e2, 6.66e1, 3.06e0 /) * 1.0E6 |
---|
| 1110 | rm = (/ 0.0039, 0.133, 0.29 /) * 1.0E-6 |
---|
| 1111 | log_sigma = (/ 0.657, 0.210, 0.396 /) |
---|
| 1112 | ELSEIF ( TRIM(aero_type) .EQ. 'continental' ) THEN |
---|
| 1113 | na = (/ 3.20e3, 2.90e3, 3.00e-1 /) * 1.0E6 |
---|
| 1114 | rm = (/ 0.01, 0.058, 0.9 /) * 1.0E-6 |
---|
| 1115 | log_sigma = (/ 0.161, 0.217, 0.380 /) |
---|
| 1116 | ELSEIF ( TRIM(aero_type) .EQ. 'desert' ) THEN |
---|
| 1117 | na = (/ 7.26e2, 1.14e3, 1.78e-1 /) * 1.0E6 |
---|
| 1118 | rm = (/ 0.001, 0.0188, 10.8 /) * 1.0E-6 |
---|
| 1119 | log_sigma = (/ 0.247, 0.770, 0.438 /) |
---|
| 1120 | ELSEIF ( TRIM(aero_type) .EQ. 'rural' ) THEN |
---|
| 1121 | na = (/ 6.65e3, 1.47e2, 1.99e3 /) * 1.0E6 |
---|
| 1122 | rm = (/ 0.00739, 0.0269, 0.0419 /) * 1.0E-6 |
---|
| 1123 | log_sigma = (/ 0.225, 0.557, 0.266 /) |
---|
| 1124 | ELSEIF ( TRIM(aero_type) .EQ. 'urban' ) THEN |
---|
| 1125 | na = (/ 9.93e4, 1.11e3, 3.64e4 /) * 1.0E6 |
---|
| 1126 | rm = (/ 0.00651, 0.00714, 0.0248 /) * 1.0E-6 |
---|
| 1127 | log_sigma = (/ 0.245, 0.666, 0.337 /) |
---|
| 1128 | ELSEIF ( TRIM(aero_type) .EQ. 'user' ) THEN |
---|
| 1129 | CONTINUE |
---|
| 1130 | ELSE |
---|
| 1131 | WRITE( message_string, * ) 'unknown aerosol type ', & |
---|
| 1132 | 'aero_type = "', TRIM( aero_type ), '"' |
---|
| 1133 | CALL message( 'lpm_init', 'PA0459', 1, 2, 0, 6, 0 ) |
---|
[1871] | 1134 | ENDIF |
---|
| 1135 | |
---|
| 1136 | DO ip = nxl, nxr |
---|
| 1137 | DO jp = nys, nyn |
---|
| 1138 | DO kp = nzb+1, nzt |
---|
| 1139 | |
---|
| 1140 | number_of_particles = prt_count(kp,jp,ip) |
---|
| 1141 | IF ( number_of_particles <= 0 ) CYCLE |
---|
| 1142 | particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles) |
---|
[2312] | 1143 | |
---|
| 1144 | dlogr = ( LOG10(rmax) - LOG10(rmin) ) / ( number_of_particles - local_start(kp,jp,ip) + 1 ) |
---|
[1871] | 1145 | ! |
---|
| 1146 | !-- Initialize the aerosols with a predefined spectral distribution |
---|
[2312] | 1147 | !-- of the dry radius (logarithmically increasing bins) and a varying |
---|
[1871] | 1148 | !-- weighting factor |
---|
[2312] | 1149 | DO n = local_start(kp,jp,ip), number_of_particles !only new particles |
---|
[1871] | 1150 | |
---|
[2312] | 1151 | r_l = 10.0**( LOG10( rmin ) + (n-1) * dlogr ) |
---|
| 1152 | r_r = 10.0**( LOG10( rmin ) + n * dlogr ) |
---|
| 1153 | r_mid = SQRT( r_l * r_r ) |
---|
[1871] | 1154 | |
---|
[2312] | 1155 | particles(n)%aux1 = r_mid |
---|
| 1156 | particles(n)%weight_factor = & |
---|
| 1157 | ( na(1) / ( SQRT( 2.0 * pi ) * log_sigma(1) ) * & |
---|
| 1158 | EXP( - LOG10( r_mid / rm(1) )**2 / ( 2.0 * log_sigma(1)**2 ) ) + & |
---|
| 1159 | na(2) / ( SQRT( 2.0 * pi ) * log_sigma(2) ) * & |
---|
| 1160 | EXP( - LOG10( r_mid / rm(2) )**2 / ( 2.0 * log_sigma(2)**2 ) ) + & |
---|
| 1161 | na(3) / ( SQRT( 2.0 * pi ) * log_sigma(3) ) * & |
---|
| 1162 | EXP( - LOG10( r_mid / rm(3) )**2 / ( 2.0 * log_sigma(3)**2 ) ) & |
---|
| 1163 | ) * ( LOG10(r_r) - LOG10(r_l) ) * ( dx * dy * dz ) |
---|
[1871] | 1164 | |
---|
[2312] | 1165 | ! |
---|
| 1166 | !-- Multiply weight_factor with the namelist parameter aero_weight |
---|
| 1167 | !-- to increase or decrease the number of simulated aerosols |
---|
| 1168 | particles(n)%weight_factor = particles(n)%weight_factor * aero_weight |
---|
[1871] | 1169 | |
---|
[2312] | 1170 | IF ( particles(n)%weight_factor - FLOOR(particles(n)%weight_factor,KIND=wp) & |
---|
| 1171 | .GT. random_function( iran_part ) ) THEN |
---|
| 1172 | particles(n)%weight_factor = FLOOR(particles(n)%weight_factor,KIND=wp) + 1.0 |
---|
| 1173 | ELSE |
---|
| 1174 | particles(n)%weight_factor = FLOOR(particles(n)%weight_factor,KIND=wp) |
---|
[1871] | 1175 | ENDIF |
---|
| 1176 | ! |
---|
[2312] | 1177 | !-- Unnecessary particles will be deleted |
---|
| 1178 | IF ( particles(n)%weight_factor .LE. 0.0 ) particles(n)%particle_mask = .FALSE. |
---|
[1871] | 1179 | |
---|
[2312] | 1180 | ENDDO |
---|
[1871] | 1181 | ! |
---|
| 1182 | !-- Set particle radius to equilibrium radius based on the environmental |
---|
| 1183 | !-- supersaturation (Khvorostyanov and Curry, 2007, JGR). This avoids |
---|
[2312] | 1184 | !-- the sometimes lengthy growth toward their equilibrium radius within |
---|
[1871] | 1185 | !-- the simulation. |
---|
| 1186 | t_int = pt(kp,jp,ip) * ( hyp(kp) / 100000.0_wp )**0.286_wp |
---|
| 1187 | |
---|
[2608] | 1188 | e_s = magnus( t_int ) |
---|
| 1189 | e_a = q(kp,jp,ip) * hyp(kp) / ( q(kp,jp,ip) + 0.622_wp ) |
---|
[1871] | 1190 | |
---|
[2122] | 1191 | sigma = 0.0761_wp - 0.000155_wp * ( t_int - 273.15_wp ) |
---|
| 1192 | afactor = 2.0_wp * sigma / ( rho_l * r_v * t_int ) |
---|
| 1193 | |
---|
| 1194 | bfactor = vanthoff * molecular_weight_of_water * & |
---|
| 1195 | rho_s / ( molecular_weight_of_solute * rho_l ) |
---|
[1871] | 1196 | ! |
---|
[2312] | 1197 | !-- The formula is only valid for subsaturated environments. For |
---|
[2122] | 1198 | !-- supersaturations higher than -5 %, the supersaturation is set to -5%. |
---|
| 1199 | IF ( e_a / e_s >= 0.95_wp ) e_a = 0.95_wp * e_s |
---|
[1871] | 1200 | |
---|
[2312] | 1201 | DO n = local_start(kp,jp,ip), number_of_particles !only new particles |
---|
[2122] | 1202 | ! |
---|
[2312] | 1203 | !-- For details on this equation, see Eq. (14) of Khvorostyanov and |
---|
| 1204 | !-- Curry (2007, JGR) |
---|
[2122] | 1205 | particles(n)%radius = bfactor**0.3333333_wp * & |
---|
[2312] | 1206 | particles(n)%aux1 / ( 1.0_wp - e_a / e_s )**0.3333333_wp / & |
---|
[2122] | 1207 | ( 1.0_wp + ( afactor / ( 3.0_wp * bfactor**0.3333333_wp * & |
---|
[2312] | 1208 | particles(n)%aux1 ) ) / & |
---|
[2122] | 1209 | ( 1.0_wp - e_a / e_s )**0.6666666_wp & |
---|
| 1210 | ) |
---|
[1871] | 1211 | |
---|
[2122] | 1212 | ENDDO |
---|
[1871] | 1213 | |
---|
| 1214 | ENDDO |
---|
| 1215 | ENDDO |
---|
| 1216 | ENDDO |
---|
| 1217 | |
---|
| 1218 | END SUBROUTINE lpm_init_aerosols |
---|
| 1219 | |
---|
[1359] | 1220 | END MODULE lpm_init_mod |
---|