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