[1682] | 1 | !> @file lpm.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1036] | 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
[2000] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
[1036] | 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[2101] | 17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[230] | 20 | ! Current revisions: |
---|
[759] | 21 | ! ------------------ |
---|
[1823] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1823] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: lpm.f90 2606 2017-11-10 10:36:31Z raasch $ |
---|
[2606] | 27 | ! Changed particle box locations: center of particle box now coincides |
---|
| 28 | ! with scalar grid point of same index. |
---|
| 29 | ! Renamed module and subroutines: lpm_pack_arrays_mod -> lpm_pack_and_sort_mod |
---|
| 30 | ! lpm_pack_all_arrays -> lpm_sort_in_subboxes, lpm_pack_arrays -> lpm_pack |
---|
| 31 | ! lpm_sort -> lpm_sort_timeloop_done |
---|
| 32 | ! |
---|
| 33 | ! 2418 2017-09-06 15:24:24Z suehring |
---|
[2417] | 34 | ! Major bugfixes in modeling SGS particle speeds (since revision 1359). |
---|
| 35 | ! Particle sorting added to distinguish between already completed and |
---|
| 36 | ! non-completed particles. |
---|
| 37 | ! |
---|
| 38 | ! 2263 2017-06-08 14:59:01Z schwenkel |
---|
[2263] | 39 | ! Implemented splitting and merging algorithm |
---|
| 40 | ! |
---|
| 41 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[1823] | 42 | ! |
---|
[2233] | 43 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 44 | ! Adjustments to new topography concept |
---|
| 45 | ! |
---|
[2001] | 46 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 47 | ! Forced header and separation lines into 80 columns |
---|
| 48 | ! |
---|
[1937] | 49 | ! 1936 2016-06-13 13:37:44Z suehring |
---|
| 50 | ! Call routine for deallocation of unused memory. |
---|
| 51 | ! Formatting adjustments |
---|
| 52 | ! |
---|
[1930] | 53 | ! 1929 2016-06-09 16:25:25Z suehring |
---|
| 54 | ! Call wall boundary conditions only if particles are in the vertical range of |
---|
| 55 | ! topography. |
---|
| 56 | ! |
---|
[1823] | 57 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
[1822] | 58 | ! Tails removed. |
---|
| 59 | ! |
---|
| 60 | ! Initialization of sgs model not necessary for the use of cloud_droplets and |
---|
| 61 | ! use_sgs_for_particles. |
---|
| 62 | ! |
---|
| 63 | ! lpm_release_set integrated. |
---|
| 64 | ! |
---|
| 65 | ! Unused variabled removed. |
---|
[1321] | 66 | ! |
---|
[1683] | 67 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 68 | ! Code annotations made doxygen readable |
---|
| 69 | ! |
---|
[1417] | 70 | ! 1416 2014-06-04 16:04:03Z suehring |
---|
| 71 | ! user_lpm_advec is called for each gridpoint. |
---|
| 72 | ! Bugfix: in order to prevent an infinite loop, time_loop_done is set .TRUE. |
---|
| 73 | ! at the head of the do-loop. |
---|
| 74 | ! |
---|
[1360] | 75 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 76 | ! New particle structure integrated. |
---|
| 77 | ! Kind definition added to all floating point numbers. |
---|
| 78 | ! |
---|
[1321] | 79 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 80 | ! ONLY-attribute added to USE-statements, |
---|
| 81 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 82 | ! kinds are defined in new module kinds, |
---|
| 83 | ! revision history before 2012 removed, |
---|
| 84 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 85 | ! all variable declaration statements |
---|
[829] | 86 | ! |
---|
[1319] | 87 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 88 | ! module interfaces removed |
---|
| 89 | ! |
---|
[1037] | 90 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 91 | ! code put under GPL (PALM 3.9) |
---|
| 92 | ! |
---|
[852] | 93 | ! 851 2012-03-15 14:32:58Z raasch |
---|
| 94 | ! Bugfix: resetting of particle_mask and tail mask moved from routine |
---|
| 95 | ! lpm_exchange_horiz to here (end of sub-timestep loop) |
---|
| 96 | ! |
---|
[850] | 97 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 98 | ! original routine advec_particles split into several subroutines and renamed |
---|
| 99 | ! lpm |
---|
| 100 | ! |
---|
[832] | 101 | ! 831 2012-02-22 00:29:39Z raasch |
---|
| 102 | ! thermal_conductivity_l and diff_coeff_l now depend on temperature and |
---|
| 103 | ! pressure |
---|
| 104 | ! |
---|
[829] | 105 | ! 828 2012-02-21 12:00:36Z raasch |
---|
[828] | 106 | ! fast hall/wang kernels with fixed radius/dissipation classes added, |
---|
| 107 | ! particle feature color renamed class, routine colker renamed |
---|
| 108 | ! recalculate_kernel, |
---|
| 109 | ! lower limit for droplet radius changed from 1E-7 to 1E-8 |
---|
[826] | 110 | ! |
---|
[828] | 111 | ! Bugfix: transformation factor for dissipation changed from 1E5 to 1E4 |
---|
| 112 | ! |
---|
[826] | 113 | ! 825 2012-02-19 03:03:44Z raasch |
---|
[825] | 114 | ! droplet growth by condensation may include curvature and solution effects, |
---|
| 115 | ! initialisation of temporary particle array for resorting removed, |
---|
| 116 | ! particle attributes speed_x|y|z_sgs renamed rvar1|2|3, |
---|
| 117 | ! module wang_kernel_mod renamed lpm_collision_kernels_mod, |
---|
| 118 | ! wang_collision_kernel renamed wang_kernel |
---|
[482] | 119 | ! |
---|
[800] | 120 | ! |
---|
[1] | 121 | ! Revision 1.1 1999/11/25 16:16:06 raasch |
---|
| 122 | ! Initial revision |
---|
| 123 | ! |
---|
| 124 | ! |
---|
| 125 | ! Description: |
---|
| 126 | ! ------------ |
---|
[1682] | 127 | !> Particle advection |
---|
[1] | 128 | !------------------------------------------------------------------------------! |
---|
[1682] | 129 | SUBROUTINE lpm |
---|
| 130 | |
---|
[1] | 131 | |
---|
[1320] | 132 | USE arrays_3d, & |
---|
| 133 | ONLY: ql_c, ql_v, ql_vp |
---|
| 134 | |
---|
| 135 | USE control_parameters, & |
---|
| 136 | ONLY: cloud_droplets, dt_3d, dt_3d_reached, dt_3d_reached_l, & |
---|
[1359] | 137 | molecular_viscosity, simulated_time, topography |
---|
[1320] | 138 | |
---|
| 139 | USE cpulog, & |
---|
| 140 | ONLY: cpu_log, log_point, log_point_s |
---|
| 141 | |
---|
[1359] | 142 | USE indices, & |
---|
[2232] | 143 | ONLY: nxl, nxr, nys, nyn, nzb, nzb_max, nzt |
---|
[1359] | 144 | |
---|
[1320] | 145 | USE kinds |
---|
| 146 | |
---|
[1359] | 147 | USE lpm_exchange_horiz_mod, & |
---|
[1936] | 148 | ONLY: dealloc_particles_array, lpm_exchange_horiz, lpm_move_particle |
---|
[1359] | 149 | |
---|
[1822] | 150 | USE lpm_init_mod, & |
---|
| 151 | ONLY: lpm_create_particle, PHASE_RELEASE |
---|
| 152 | |
---|
[2606] | 153 | USE lpm_pack_and_sort_mod, & |
---|
| 154 | ONLY: lpm_sort_in_subboxes, lpm_sort_timeloop_done |
---|
[1359] | 155 | |
---|
[1320] | 156 | USE particle_attributes, & |
---|
[1936] | 157 | ONLY: collision_kernel, deleted_particles, deallocate_memory, & |
---|
[1359] | 158 | dt_write_particle_data, dt_prel, end_time_prel, & |
---|
[2263] | 159 | grid_particles, merging, number_of_particles, & |
---|
| 160 | number_of_particle_groups, particles, particle_groups, & |
---|
| 161 | prt_count, splitting, step_dealloc, time_prel, & |
---|
| 162 | time_write_particle_data, trlp_count_sum, trlp_count_recv_sum, & |
---|
| 163 | trnp_count_sum, trnp_count_recv_sum, trrp_count_sum, & |
---|
| 164 | trrp_count_recv_sum, trsp_count_sum, trsp_count_recv_sum, & |
---|
[1359] | 165 | use_sgs_for_particles, write_particle_statistics |
---|
[2263] | 166 | |
---|
[1] | 167 | USE pegrid |
---|
| 168 | |
---|
| 169 | IMPLICIT NONE |
---|
| 170 | |
---|
[1682] | 171 | INTEGER(iwp) :: i !< |
---|
| 172 | INTEGER(iwp) :: ie !< |
---|
| 173 | INTEGER(iwp) :: is !< |
---|
| 174 | INTEGER(iwp) :: j !< |
---|
| 175 | INTEGER(iwp) :: je !< |
---|
| 176 | INTEGER(iwp) :: js !< |
---|
[1936] | 177 | INTEGER(iwp), SAVE :: lpm_count = 0 !< |
---|
[1682] | 178 | INTEGER(iwp) :: k !< |
---|
| 179 | INTEGER(iwp) :: ke !< |
---|
| 180 | INTEGER(iwp) :: ks !< |
---|
| 181 | INTEGER(iwp) :: m !< |
---|
| 182 | INTEGER(iwp), SAVE :: steps = 0 !< |
---|
[1] | 183 | |
---|
[1682] | 184 | LOGICAL :: first_loop_stride !< |
---|
[60] | 185 | |
---|
[849] | 186 | CALL cpu_log( log_point(25), 'lpm', 'start' ) |
---|
[824] | 187 | |
---|
[849] | 188 | ! |
---|
| 189 | !-- Write particle data at current time on file. |
---|
| 190 | !-- This has to be done here, before particles are further processed, |
---|
| 191 | !-- because they may be deleted within this timestep (in case that |
---|
| 192 | !-- dt_write_particle_data = dt_prel = particle_maximum_age). |
---|
| 193 | time_write_particle_data = time_write_particle_data + dt_3d |
---|
| 194 | IF ( time_write_particle_data >= dt_write_particle_data ) THEN |
---|
[1] | 195 | |
---|
[849] | 196 | CALL lpm_data_output_particles |
---|
[824] | 197 | ! |
---|
[849] | 198 | !-- The MOD function allows for changes in the output interval with restart |
---|
| 199 | !-- runs. |
---|
| 200 | time_write_particle_data = MOD( time_write_particle_data, & |
---|
| 201 | MAX( dt_write_particle_data, dt_3d ) ) |
---|
| 202 | ENDIF |
---|
[1] | 203 | |
---|
[849] | 204 | ! |
---|
[1822] | 205 | !-- Initialize arrays for marking those particles to be deleted after the |
---|
[849] | 206 | !-- (sub-) timestep |
---|
| 207 | deleted_particles = 0 |
---|
[60] | 208 | |
---|
[1] | 209 | ! |
---|
[849] | 210 | !-- Initialize variables used for accumulating the number of particles |
---|
| 211 | !-- exchanged between the subdomains during all sub-timesteps (if sgs |
---|
| 212 | !-- velocities are included). These data are output further below on the |
---|
| 213 | !-- particle statistics file. |
---|
| 214 | trlp_count_sum = 0 |
---|
| 215 | trlp_count_recv_sum = 0 |
---|
| 216 | trrp_count_sum = 0 |
---|
| 217 | trrp_count_recv_sum = 0 |
---|
| 218 | trsp_count_sum = 0 |
---|
| 219 | trsp_count_recv_sum = 0 |
---|
| 220 | trnp_count_sum = 0 |
---|
| 221 | trnp_count_recv_sum = 0 |
---|
[1] | 222 | |
---|
| 223 | |
---|
| 224 | ! |
---|
| 225 | !-- Calculate exponential term used in case of particle inertia for each |
---|
| 226 | !-- of the particle groups |
---|
| 227 | DO m = 1, number_of_particle_groups |
---|
[1359] | 228 | IF ( particle_groups(m)%density_ratio /= 0.0_wp ) THEN |
---|
[1] | 229 | particle_groups(m)%exp_arg = & |
---|
[1359] | 230 | 4.5_wp * particle_groups(m)%density_ratio * & |
---|
[1] | 231 | molecular_viscosity / ( particle_groups(m)%radius )**2 |
---|
[1359] | 232 | |
---|
| 233 | particle_groups(m)%exp_term = EXP( -particle_groups(m)%exp_arg * & |
---|
| 234 | dt_3d ) |
---|
[1] | 235 | ENDIF |
---|
| 236 | ENDDO |
---|
| 237 | |
---|
| 238 | ! |
---|
[1359] | 239 | !-- If necessary, release new set of particles |
---|
| 240 | IF ( time_prel >= dt_prel .AND. end_time_prel > simulated_time ) THEN |
---|
[1] | 241 | |
---|
[1822] | 242 | CALL lpm_create_particle(PHASE_RELEASE) |
---|
[1] | 243 | ! |
---|
[1359] | 244 | !-- The MOD function allows for changes in the output interval with |
---|
| 245 | !-- restart runs. |
---|
| 246 | time_prel = MOD( time_prel, MAX( dt_prel, dt_3d ) ) |
---|
[1] | 247 | |
---|
[1359] | 248 | ENDIF |
---|
[1] | 249 | ! |
---|
[1359] | 250 | !-- Reset summation arrays |
---|
| 251 | IF ( cloud_droplets) THEN |
---|
| 252 | ql_c = 0.0_wp |
---|
| 253 | ql_v = 0.0_wp |
---|
| 254 | ql_vp = 0.0_wp |
---|
[849] | 255 | ENDIF |
---|
[420] | 256 | |
---|
[1359] | 257 | first_loop_stride = .TRUE. |
---|
| 258 | grid_particles(:,:,:)%time_loop_done = .TRUE. |
---|
[1] | 259 | ! |
---|
[849] | 260 | !-- Timestep loop for particle advection. |
---|
[1] | 261 | !-- This loop has to be repeated until the advection time of every particle |
---|
[849] | 262 | !-- (within the total domain!) has reached the LES timestep (dt_3d). |
---|
| 263 | !-- In case of including the SGS velocities, the particle timestep may be |
---|
[1359] | 264 | !-- smaller than the LES timestep (because of the Lagrangian timescale |
---|
| 265 | !-- restriction) and particles may require to undergo several particle |
---|
| 266 | !-- timesteps, before the LES timestep is reached. Because the number of these |
---|
| 267 | !-- particle timesteps to be carried out is unknown at first, these steps are |
---|
| 268 | !-- carried out in the following infinite loop with exit condition. |
---|
[1] | 269 | DO |
---|
[849] | 270 | CALL cpu_log( log_point_s(44), 'lpm_advec', 'start' ) |
---|
[1359] | 271 | CALL cpu_log( log_point_s(44), 'lpm_advec', 'pause' ) |
---|
[1416] | 272 | |
---|
[1359] | 273 | ! |
---|
| 274 | !-- If particle advection includes SGS velocity components, calculate the |
---|
| 275 | !-- required SGS quantities (i.e. gradients of the TKE, as well as |
---|
| 276 | !-- horizontally averaged profiles of the SGS TKE and the resolved-scale |
---|
| 277 | !-- velocity variances) |
---|
[1822] | 278 | IF ( use_sgs_for_particles .AND. .NOT. cloud_droplets ) THEN |
---|
| 279 | CALL lpm_init_sgs_tke |
---|
| 280 | ENDIF |
---|
[1359] | 281 | |
---|
[2417] | 282 | ! |
---|
| 283 | !-- In case SGS-particle speed is considered, particles may carry out |
---|
| 284 | !-- several particle timesteps. In order to prevent unnecessary |
---|
| 285 | !-- treatment of particles that already reached the final time level, |
---|
| 286 | !-- particles are sorted into contiguous blocks of finished and |
---|
| 287 | !-- not-finished particles, in addition to their already sorting |
---|
| 288 | !-- according to their sub-boxes. |
---|
| 289 | IF ( .NOT. first_loop_stride .AND. use_sgs_for_particles ) & |
---|
[2606] | 290 | CALL lpm_sort_timeloop_done |
---|
[2417] | 291 | |
---|
[1359] | 292 | DO i = nxl, nxr |
---|
| 293 | DO j = nys, nyn |
---|
| 294 | DO k = nzb+1, nzt |
---|
| 295 | |
---|
| 296 | number_of_particles = prt_count(k,j,i) |
---|
[1] | 297 | ! |
---|
[1359] | 298 | !-- If grid cell gets empty, flag must be true |
---|
| 299 | IF ( number_of_particles <= 0 ) THEN |
---|
| 300 | grid_particles(k,j,i)%time_loop_done = .TRUE. |
---|
| 301 | CYCLE |
---|
| 302 | ENDIF |
---|
[1] | 303 | |
---|
[1359] | 304 | IF ( .NOT. first_loop_stride .AND. & |
---|
| 305 | grid_particles(k,j,i)%time_loop_done ) CYCLE |
---|
| 306 | |
---|
| 307 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 308 | |
---|
| 309 | particles(1:number_of_particles)%particle_mask = .TRUE. |
---|
[1] | 310 | ! |
---|
[1359] | 311 | !-- Initialize the variable storing the total time that a particle |
---|
| 312 | !-- has advanced within the timestep procedure |
---|
| 313 | IF ( first_loop_stride ) THEN |
---|
| 314 | particles(1:number_of_particles)%dt_sum = 0.0_wp |
---|
| 315 | ENDIF |
---|
| 316 | ! |
---|
| 317 | !-- Particle (droplet) growth by condensation/evaporation and |
---|
| 318 | !-- collision |
---|
| 319 | IF ( cloud_droplets .AND. first_loop_stride) THEN |
---|
| 320 | ! |
---|
| 321 | !-- Droplet growth by condensation / evaporation |
---|
| 322 | CALL lpm_droplet_condensation(i,j,k) |
---|
| 323 | ! |
---|
| 324 | !-- Particle growth by collision |
---|
| 325 | IF ( collision_kernel /= 'none' ) THEN |
---|
| 326 | CALL lpm_droplet_collision(i,j,k) |
---|
| 327 | ENDIF |
---|
[1] | 328 | |
---|
[1359] | 329 | ENDIF |
---|
[1] | 330 | ! |
---|
[1359] | 331 | !-- Initialize the switch used for the loop exit condition checked |
---|
| 332 | !-- at the end of this loop. If at least one particle has failed to |
---|
| 333 | !-- reach the LES timestep, this switch will be set false in |
---|
| 334 | !-- lpm_advec. |
---|
| 335 | dt_3d_reached_l = .TRUE. |
---|
[57] | 336 | |
---|
| 337 | ! |
---|
[1359] | 338 | !-- Particle advection |
---|
| 339 | CALL lpm_advec(i,j,k) |
---|
| 340 | ! |
---|
[1929] | 341 | !-- Particle reflection from walls. Only applied if the particles |
---|
| 342 | !-- are in the vertical range of the topography. (Here, some |
---|
| 343 | !-- optimization is still possible.) |
---|
| 344 | IF ( topography /= 'flat' .AND. k < nzb_max + 2 ) THEN |
---|
[2418] | 345 | CALL lpm_boundary_conds( 'walls' ) |
---|
[1359] | 346 | ENDIF |
---|
| 347 | ! |
---|
| 348 | !-- User-defined actions after the calculation of the new particle |
---|
| 349 | !-- position |
---|
[1416] | 350 | CALL user_lpm_advec(i,j,k) |
---|
[1359] | 351 | ! |
---|
| 352 | !-- Apply boundary conditions to those particles that have crossed |
---|
| 353 | !-- the top or bottom boundary and delete those particles, which are |
---|
| 354 | !-- older than allowed |
---|
[2418] | 355 | CALL lpm_boundary_conds( 'bottom/top' ) |
---|
[1359] | 356 | ! |
---|
| 357 | !--- If not all particles of the actual grid cell have reached the |
---|
[2417] | 358 | !-- LES timestep, this cell has to do another loop iteration. Due to |
---|
| 359 | !-- the fact that particles can move into neighboring grid cells, |
---|
| 360 | !-- these neighbor cells also have to perform another loop iteration. |
---|
| 361 | !-- Please note, this realization does not work properly if |
---|
| 362 | !-- particles move into another subdomain. |
---|
[1359] | 363 | IF ( .NOT. dt_3d_reached_l ) THEN |
---|
[2417] | 364 | ks = MAX(nzb+1,k-1) |
---|
| 365 | ke = MIN(nzt,k+1) |
---|
| 366 | js = MAX(nys,j-1) |
---|
| 367 | je = MIN(nyn,j+1) |
---|
| 368 | is = MAX(nxl,i-1) |
---|
| 369 | ie = MIN(nxr,i+1) |
---|
[1359] | 370 | grid_particles(ks:ke,js:je,is:ie)%time_loop_done = .FALSE. |
---|
[2417] | 371 | ELSE |
---|
| 372 | grid_particles(k,j,i)%time_loop_done = .TRUE. |
---|
[1359] | 373 | ENDIF |
---|
[57] | 374 | |
---|
[1359] | 375 | ENDDO |
---|
| 376 | ENDDO |
---|
| 377 | ENDDO |
---|
| 378 | |
---|
| 379 | steps = steps + 1 |
---|
| 380 | dt_3d_reached_l = ALL(grid_particles(:,:,:)%time_loop_done) |
---|
[57] | 381 | ! |
---|
[1] | 382 | !-- Find out, if all particles on every PE have completed the LES timestep |
---|
| 383 | !-- and set the switch corespondingly |
---|
| 384 | #if defined( __parallel ) |
---|
[622] | 385 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1] | 386 | CALL MPI_ALLREDUCE( dt_3d_reached_l, dt_3d_reached, 1, MPI_LOGICAL, & |
---|
| 387 | MPI_LAND, comm2d, ierr ) |
---|
| 388 | #else |
---|
| 389 | dt_3d_reached = dt_3d_reached_l |
---|
[799] | 390 | #endif |
---|
[1] | 391 | |
---|
[849] | 392 | CALL cpu_log( log_point_s(44), 'lpm_advec', 'stop' ) |
---|
[1] | 393 | |
---|
| 394 | ! |
---|
| 395 | !-- Increment time since last release |
---|
| 396 | IF ( dt_3d_reached ) time_prel = time_prel + dt_3d |
---|
| 397 | ! |
---|
[2263] | 398 | !-- Apply splitting and merging algorithm |
---|
| 399 | IF ( cloud_droplets ) THEN |
---|
| 400 | IF ( splitting ) THEN |
---|
| 401 | CALL lpm_splitting |
---|
| 402 | ENDIF |
---|
| 403 | IF ( merging ) THEN |
---|
| 404 | CALL lpm_merging |
---|
| 405 | ENDIF |
---|
| 406 | ENDIF |
---|
| 407 | ! |
---|
[1359] | 408 | !-- Move Particles local to PE to a different grid cell |
---|
| 409 | CALL lpm_move_particle |
---|
[1] | 410 | |
---|
| 411 | ! |
---|
[849] | 412 | !-- Horizontal boundary conditions including exchange between subdmains |
---|
| 413 | CALL lpm_exchange_horiz |
---|
[1] | 414 | ! |
---|
| 415 | !-- Pack particles (eliminate those marked for deletion), |
---|
| 416 | !-- determine new number of particles |
---|
[2606] | 417 | CALL lpm_sort_in_subboxes |
---|
[851] | 418 | ! |
---|
[1359] | 419 | !-- Initialize variables for the next (sub-) timestep, i.e., for marking |
---|
| 420 | !-- those particles to be deleted after the timestep |
---|
[851] | 421 | deleted_particles = 0 |
---|
| 422 | |
---|
[1] | 423 | IF ( dt_3d_reached ) EXIT |
---|
| 424 | |
---|
[1359] | 425 | first_loop_stride = .FALSE. |
---|
[1] | 426 | ENDDO ! timestep loop |
---|
| 427 | |
---|
| 428 | ! |
---|
[1359] | 429 | !-- Calculate the new liquid water content for each grid box |
---|
[1936] | 430 | IF ( cloud_droplets ) CALL lpm_calc_liquid_water_content |
---|
| 431 | ! |
---|
| 432 | !-- Deallocate unused memory |
---|
| 433 | IF ( deallocate_memory .AND. lpm_count == step_dealloc ) THEN |
---|
| 434 | CALL dealloc_particles_array |
---|
| 435 | lpm_count = 0 |
---|
| 436 | ELSEIF ( deallocate_memory ) THEN |
---|
| 437 | lpm_count = lpm_count + 1 |
---|
[116] | 438 | ENDIF |
---|
| 439 | |
---|
[1] | 440 | ! |
---|
[828] | 441 | !-- Set particle attributes. |
---|
| 442 | !-- Feature is not available if collision is activated, because the respective |
---|
| 443 | !-- particle attribute (class) is then used for storing the particle radius |
---|
| 444 | !-- class. |
---|
[849] | 445 | IF ( collision_kernel == 'none' ) CALL lpm_set_attributes |
---|
[264] | 446 | |
---|
| 447 | ! |
---|
[1] | 448 | !-- Set particle attributes defined by the user |
---|
[849] | 449 | CALL user_lpm_set_attributes |
---|
[1] | 450 | |
---|
| 451 | ! |
---|
[849] | 452 | !-- Write particle statistics (in particular the number of particles |
---|
| 453 | !-- exchanged between the subdomains) on file |
---|
| 454 | IF ( write_particle_statistics ) CALL lpm_write_exchange_statistics |
---|
[1] | 455 | |
---|
[849] | 456 | CALL cpu_log( log_point(25), 'lpm', 'stop' ) |
---|
[1] | 457 | |
---|
[849] | 458 | END SUBROUTINE lpm |
---|