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