[2263] | 1 | !> @file lpm_splitting.f90 |
---|
| 2 | !------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 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. |
---|
| 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 | ! |
---|
| 17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
| 18 | !------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
| 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
[2270] | 22 | ! |
---|
| 23 | ! |
---|
[2263] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! |
---|
[2278] | 27 | ! Added comments |
---|
[2270] | 28 | ! |
---|
| 29 | ! |
---|
[2278] | 30 | ! 2263 2017-06-08 14:59:01Z schwenkel |
---|
[2263] | 31 | ! Initial revision |
---|
| 32 | ! |
---|
| 33 | ! |
---|
| 34 | ! |
---|
| 35 | ! Description: |
---|
| 36 | ! ------------ |
---|
| 37 | ! This routine is a part of the Lagrangian particle model. Super droplets which |
---|
| 38 | ! fulfill certain criterion's (e.g. a big weighting factor and a large radius) |
---|
| 39 | ! can be split into several super droplets with a reduced number of |
---|
| 40 | ! represented particles of every super droplet. This mechanism ensures an |
---|
| 41 | ! improved representation of the right tail of the drop size distribution with |
---|
| 42 | ! a feasible amount of computational costs. The limits of particle creation |
---|
| 43 | ! should be chosen carefully! The idea of this algorithm is based on |
---|
| 44 | ! Unterstrasser and Soelch, 2014. |
---|
| 45 | !------------------------------------------------------------------------------! |
---|
| 46 | SUBROUTINE lpm_splitting |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | USE arrays_3d, & |
---|
| 50 | ONLY: ql |
---|
| 51 | |
---|
| 52 | USE cloud_parameters, & |
---|
| 53 | ONLY: rho_l |
---|
| 54 | |
---|
| 55 | USE constants, & |
---|
| 56 | ONLY: pi |
---|
| 57 | |
---|
| 58 | USE cpulog, & |
---|
| 59 | ONLY: cpu_log, log_point_s |
---|
| 60 | |
---|
| 61 | USE indices, & |
---|
| 62 | ONLY: nxl, nxr, nyn, nys, nzb, nzt |
---|
| 63 | |
---|
| 64 | USE kinds |
---|
| 65 | |
---|
| 66 | USE lpm_exchange_horiz_mod, & |
---|
| 67 | ONLY: realloc_particles_array |
---|
| 68 | |
---|
| 69 | USE particle_attributes, & |
---|
| 70 | ONLY: grid_particles, iran_part, initial_weighting_factor, isf, & |
---|
| 71 | i_splitting_mode, max_number_particles_per_gridbox, & |
---|
| 72 | new_particles, n_max, number_concentration, & |
---|
| 73 | number_of_particles, number_particles_per_gridbox, particles, & |
---|
| 74 | particle_type, prt_count, radius_split, splitting, & |
---|
| 75 | splitting_factor, splitting_factor_max, splitting_mode, & |
---|
| 76 | sum_new_particles, weight_factor_split |
---|
| 77 | |
---|
| 78 | USE pegrid |
---|
| 79 | |
---|
| 80 | IMPLICIT NONE |
---|
| 81 | |
---|
| 82 | INTEGER(iwp) :: i !< |
---|
| 83 | INTEGER(iwp) :: j !< |
---|
| 84 | INTEGER(iwp) :: jpp !< |
---|
| 85 | INTEGER(iwp) :: k !< |
---|
| 86 | INTEGER(iwp) :: n !< |
---|
| 87 | INTEGER(iwp) :: new_particles_gb !< counter of created particles within one grid box |
---|
| 88 | INTEGER(iwp) :: new_size !< new particle array size |
---|
[2278] | 89 | INTEGER(iwp) :: np !< |
---|
[2263] | 90 | INTEGER(iwp) :: old_size !< old particle array size |
---|
| 91 | |
---|
| 92 | LOGICAL :: first_loop_stride = .TRUE. !< flag to calculate constants only once |
---|
| 93 | |
---|
| 94 | REAL(wp) :: diameter !< diameter of droplet |
---|
| 95 | REAL(wp) :: dlog !< factor for DSD calculation |
---|
| 96 | REAL(wp) :: factor_volume_to_mass !< pre calculate factor volume to mass |
---|
| 97 | REAL(wp) :: lambda !< slope parameter of gamma-distribution |
---|
| 98 | REAL(wp) :: lwc !< liquid water content of grid box |
---|
| 99 | REAL(wp) :: lwc_total !< average liquid water content of cloud |
---|
| 100 | REAL(wp) :: m1 !< first moment of DSD |
---|
| 101 | REAL(wp) :: m1_total !< average over all PEs of first moment of DSD |
---|
| 102 | REAL(wp) :: m2 !< second moment of DSD |
---|
| 103 | REAL(wp) :: m2_total !< average average over all PEs second moment of DSD |
---|
| 104 | REAL(wp) :: m3 !< third moment of DSD |
---|
| 105 | REAL(wp) :: m3_total !< average average over all PEs third moment of DSD |
---|
| 106 | REAL(wp) :: mu !< spectral shape parameter of gamma distribution |
---|
| 107 | REAL(wp) :: nrclgb !< number of cloudy grid boxes (ql >= 1.0E-5 kg/kg) |
---|
| 108 | REAL(wp) :: nrclgb_total !< average over all PEs of number of cloudy grid boxes |
---|
| 109 | REAL(wp) :: nr !< number concentration of cloud droplets |
---|
| 110 | REAL(wp) :: nr_total !< average over all PEs of number of cloudy grid boxes |
---|
| 111 | REAL(wp) :: nr0 !< intercept parameter of gamma distribution |
---|
| 112 | REAL(wp) :: pirho_l !< pi * rho_l / 6.0 |
---|
| 113 | REAL(wp) :: ql_crit = 1.0E-5_wp !< threshold lwc for cloudy grid cells |
---|
| 114 | !< (Siebesma et al 2003, JAS, 60) |
---|
| 115 | REAL(wp) :: rm !< volume averaged mean radius |
---|
| 116 | REAL(wp) :: rm_total !< average over all PEs of volume averaged mean radius |
---|
| 117 | REAL(wp) :: r_min = 1.0E-6_wp !< minimum radius of approximated spectra |
---|
| 118 | REAL(wp) :: r_max = 1.0E-3_wp !< maximum radius of approximated spectra |
---|
| 119 | REAL(wp) :: sigma_log = 1.5_wp !< standard deviation of the LOG-distribution |
---|
| 120 | REAL(wp) :: zeta !< Parameter for DSD calculation of Seifert |
---|
| 121 | |
---|
| 122 | REAL(wp), DIMENSION(0:n_max-1) :: an_spl !< size dependent critical weight factor |
---|
| 123 | REAL(wp), DIMENSION(0:n_max-1) :: r_bin_mid !< mass weighted mean radius of a bin |
---|
| 124 | REAL(wp), DIMENSION(0:n_max) :: r_bin !< boundaries of a radius bin |
---|
| 125 | |
---|
| 126 | TYPE(particle_type) :: tmp_particle !< temporary particle TYPE |
---|
| 127 | |
---|
| 128 | CALL cpu_log( log_point_s(80), 'lpm_splitting', 'start' ) |
---|
| 129 | |
---|
| 130 | IF ( first_loop_stride ) THEN |
---|
| 131 | IF ( i_splitting_mode == 2 .OR. i_splitting_mode == 3 ) THEN |
---|
| 132 | dlog = ( LOG10(r_max) - LOG10(r_min) ) / ( n_max - 1 ) |
---|
| 133 | DO i = 0, n_max-1 |
---|
| 134 | r_bin(i) = 10.0_wp**( LOG10(r_min) + i * dlog - 0.5_wp * dlog ) |
---|
| 135 | r_bin_mid(i) = 10.0_wp**( LOG10(r_min) + i * dlog ) |
---|
| 136 | ENDDO |
---|
| 137 | r_bin(n_max) = 10.0_wp**( LOG10(r_min) + n_max * dlog - 0.5_wp * dlog ) |
---|
| 138 | ENDIF |
---|
| 139 | factor_volume_to_mass = 4.0_wp / 3.0_wp * pi * rho_l |
---|
| 140 | pirho_l = pi * rho_l / 6.0_wp |
---|
| 141 | IF ( weight_factor_split == -1.0_wp ) THEN |
---|
| 142 | weight_factor_split = 0.1_wp * initial_weighting_factor |
---|
| 143 | ENDIF |
---|
| 144 | ENDIF |
---|
| 145 | |
---|
| 146 | new_particles = 0 |
---|
| 147 | |
---|
| 148 | IF ( i_splitting_mode == 1 ) THEN |
---|
| 149 | |
---|
| 150 | DO i = nxl, nxr |
---|
| 151 | DO j = nys, nyn |
---|
| 152 | DO k = nzb+1, nzt |
---|
| 153 | |
---|
| 154 | new_particles_gb = 0 |
---|
| 155 | number_of_particles = prt_count(k,j,i) |
---|
| 156 | IF ( number_of_particles <= 0 .OR. & |
---|
| 157 | ql(k,j,i) < ql_crit ) CYCLE |
---|
| 158 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 159 | ! |
---|
| 160 | !-- Start splitting operations. Each particle is checked if it |
---|
| 161 | !-- fulfilled the splitting criterion's. In splitting mode 'const' |
---|
| 162 | !-- a critical radius (radius_split) a critical weighting factor |
---|
| 163 | !-- (weight_factor_split) and a splitting factor (splitting_factor) |
---|
| 164 | !-- must be prescribed (see particles_par). Super droplets which |
---|
| 165 | !-- have a larger radius and larger weighting factor are split into |
---|
| 166 | !-- 'splitting_factor' super droplets. Therefore, the weighting |
---|
| 167 | !-- factor of the super droplet and all created clones is reduced |
---|
| 168 | !-- by the factor of 'splitting_factor'. |
---|
| 169 | DO n = 1, number_of_particles |
---|
| 170 | IF ( particles(n)%particle_mask .AND. & |
---|
| 171 | particles(n)%radius >= radius_split .AND. & |
---|
| 172 | particles(n)%weight_factor >= weight_factor_split ) & |
---|
| 173 | THEN |
---|
| 174 | ! |
---|
| 175 | !-- Calculate the new number of particles. |
---|
| 176 | new_size = prt_count(k,j,i) + splitting_factor - 1 |
---|
| 177 | ! |
---|
| 178 | !-- Cycle if maximum number of particles per grid box |
---|
| 179 | !-- is greater than the allowed maximum number. |
---|
| 180 | IF ( new_size >= max_number_particles_per_gridbox ) CYCLE |
---|
| 181 | ! |
---|
| 182 | !-- Reallocate particle array if necessary. |
---|
| 183 | IF ( new_size > SIZE(particles) ) THEN |
---|
| 184 | CALL realloc_particles_array(i,j,k,new_size) |
---|
| 185 | ENDIF |
---|
| 186 | old_size = prt_count(k,j,i) |
---|
| 187 | ! |
---|
| 188 | !-- Calculate new weighting factor. |
---|
| 189 | particles(n)%weight_factor = & |
---|
| 190 | particles(n)%weight_factor / splitting_factor |
---|
| 191 | tmp_particle = particles(n) |
---|
| 192 | ! |
---|
| 193 | !-- Create splitting_factor-1 new particles. |
---|
| 194 | DO jpp = 1, splitting_factor-1 |
---|
| 195 | grid_particles(k,j,i)%particles(jpp+old_size) = & |
---|
| 196 | tmp_particle |
---|
| 197 | ENDDO |
---|
| 198 | new_particles_gb = new_particles_gb + splitting_factor - 1 |
---|
| 199 | ! |
---|
| 200 | !-- Save the new number of super droplets for every grid box. |
---|
| 201 | prt_count(k,j,i) = prt_count(k,j,i) + & |
---|
| 202 | splitting_factor - 1 |
---|
| 203 | ENDIF |
---|
| 204 | ENDDO |
---|
| 205 | |
---|
| 206 | new_particles = new_particles + new_particles_gb |
---|
| 207 | sum_new_particles = sum_new_particles + new_particles_gb |
---|
| 208 | ENDDO |
---|
| 209 | ENDDO |
---|
| 210 | ENDDO |
---|
| 211 | |
---|
| 212 | ELSEIF ( i_splitting_mode == 2 ) THEN |
---|
| 213 | ! |
---|
| 214 | !-- Initialize summing variables. |
---|
| 215 | lwc = 0.0_wp |
---|
| 216 | lwc_total = 0.0_wp |
---|
| 217 | m1 = 0.0_wp |
---|
| 218 | m1_total = 0.0_wp |
---|
| 219 | m2 = 0.0_wp |
---|
| 220 | m2_total = 0.0_wp |
---|
| 221 | m3 = 0.0_wp |
---|
| 222 | m3_total = 0.0_wp |
---|
| 223 | nr = 0.0_wp |
---|
| 224 | nrclgb = 0.0_wp |
---|
| 225 | nrclgb_total = 0.0_wp |
---|
| 226 | nr_total = 0.0_wp |
---|
| 227 | rm = 0.0_wp |
---|
| 228 | rm_total = 0.0_wp |
---|
| 229 | |
---|
| 230 | DO i = nxl, nxr |
---|
| 231 | DO j = nys, nyn |
---|
| 232 | DO k = nzb+1, nzt |
---|
| 233 | number_of_particles = prt_count(k,j,i) |
---|
| 234 | IF ( number_of_particles <= 0 .OR. & |
---|
| 235 | ql(k,j,i) < ql_crit ) CYCLE |
---|
| 236 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 237 | nrclgb = nrclgb + 1.0_wp |
---|
| 238 | ! |
---|
| 239 | !-- Calculate moments of DSD. |
---|
| 240 | DO n = 1, number_of_particles |
---|
| 241 | IF ( particles(n)%particle_mask .AND. & |
---|
| 242 | particles(n)%radius >= r_min ) & |
---|
| 243 | THEN |
---|
| 244 | nr = nr + particles(n)%weight_factor |
---|
| 245 | rm = rm + factor_volume_to_mass * & |
---|
| 246 | particles(n)%radius**3 * & |
---|
| 247 | particles(n)%weight_factor |
---|
| 248 | IF ( isf == 1 ) THEN |
---|
| 249 | diameter = particles(n)%radius * 2.0_wp |
---|
| 250 | lwc = lwc + factor_volume_to_mass * & |
---|
| 251 | particles(n)%radius**3 * & |
---|
| 252 | particles(n)%weight_factor |
---|
| 253 | m1 = m1 + particles(n)%weight_factor * diameter |
---|
| 254 | m2 = m2 + particles(n)%weight_factor * diameter**2 |
---|
| 255 | m3 = m3 + particles(n)%weight_factor * diameter**3 |
---|
| 256 | ENDIF |
---|
| 257 | ENDIF |
---|
| 258 | ENDDO |
---|
| 259 | ENDDO |
---|
| 260 | ENDDO |
---|
| 261 | ENDDO |
---|
| 262 | |
---|
| 263 | #if defined( __parallel ) |
---|
| 264 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 265 | CALL MPI_ALLREDUCE( nr, nr_total, 1 , & |
---|
| 266 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 267 | CALL MPI_ALLREDUCE( rm, rm_total, 1 , & |
---|
| 268 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 269 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 270 | CALL MPI_ALLREDUCE( nrclgb, nrclgb_total, 1 , & |
---|
| 271 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 272 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 273 | CALL MPI_ALLREDUCE( lwc, lwc_total, 1 , & |
---|
| 274 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 275 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 276 | CALL MPI_ALLREDUCE( m1, m1_total, 1 , & |
---|
| 277 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 278 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 279 | CALL MPI_ALLREDUCE( m2, m2_total, 1 , & |
---|
| 280 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 281 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 282 | CALL MPI_ALLREDUCE( m3, m3_total, 1 , & |
---|
| 283 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 284 | #endif |
---|
| 285 | |
---|
| 286 | ! |
---|
| 287 | !-- Calculate number concentration and mean volume averaged radius. |
---|
| 288 | nr_total = MERGE( nr_total / nrclgb_total, & |
---|
| 289 | 0.0_wp, nrclgb_total > 0.0_wp & |
---|
| 290 | ) |
---|
| 291 | rm_total = MERGE( ( rm_total / & |
---|
| 292 | ( nr_total * factor_volume_to_mass ) & |
---|
| 293 | )**0.3333333_wp, 0.0_wp, nrclgb_total > 0.0_wp & |
---|
| 294 | ) |
---|
| 295 | ! |
---|
| 296 | !-- Check which function should be used to approximate the DSD. |
---|
| 297 | IF ( isf == 1 ) THEN |
---|
| 298 | lwc_total = MERGE( lwc_total / nrclgb_total, & |
---|
| 299 | 0.0_wp, nrclgb_total > 0.0_wp & |
---|
| 300 | ) |
---|
| 301 | m1_total = MERGE( m1_total / nrclgb_total, & |
---|
| 302 | 0.0_wp, nrclgb_total > 0.0_wp & |
---|
| 303 | ) |
---|
| 304 | m2_total = MERGE( m2_total / nrclgb_total, & |
---|
| 305 | 0.0_wp, nrclgb_total > 0.0_wp & |
---|
| 306 | ) |
---|
| 307 | m3_total = MERGE( m3_total / nrclgb_total, & |
---|
| 308 | 0.0_wp, nrclgb_total > 0.0_wp & |
---|
| 309 | ) |
---|
| 310 | zeta = m1_total * m3_total / m2_total**2 |
---|
| 311 | mu = MAX( ( ( 1.0_wp - zeta ) * 2.0_wp + 1.0_wp ) / & |
---|
| 312 | ( zeta - 1.0_wp ), 0.0_wp & |
---|
| 313 | ) |
---|
| 314 | |
---|
| 315 | lambda = ( pirho_l * nr_total / lwc_total * & |
---|
| 316 | ( mu + 3.0_wp ) * ( mu + 2.0_wp ) * ( mu + 1.0_wp ) & |
---|
| 317 | )**0.3333333_wp |
---|
| 318 | nr0 = nr_total / gamma( mu + 1.0_wp ) * lambda**( mu + 1.0_wp ) |
---|
| 319 | |
---|
| 320 | DO n = 0, n_max-1 |
---|
| 321 | diameter = r_bin_mid(n) * 2.0_wp |
---|
| 322 | an_spl(n) = nr0 * diameter**mu * EXP( -lambda * diameter ) * & |
---|
| 323 | ( r_bin(n+1) - r_bin(n) ) * 2.0_wp |
---|
| 324 | ENDDO |
---|
| 325 | ELSEIF ( isf == 2 ) THEN |
---|
| 326 | DO n = 0, n_max-1 |
---|
| 327 | an_spl(n) = nr_total / ( SQRT( 2.0_wp * pi ) * & |
---|
| 328 | LOG(sigma_log) * r_bin_mid(n) & |
---|
| 329 | ) * & |
---|
| 330 | EXP( -( LOG( r_bin_mid(n) / rm_total )**2 ) / & |
---|
| 331 | ( 2.0_wp * LOG(sigma_log)**2 ) & |
---|
| 332 | ) * & |
---|
| 333 | ( r_bin(n+1) - r_bin(n) ) |
---|
| 334 | ENDDO |
---|
| 335 | ELSEIF( isf == 3 ) THEN |
---|
| 336 | DO n = 0, n_max-1 |
---|
| 337 | an_spl(n) = 3.0_wp * nr_total * r_bin_mid(n)**2 / rm_total**3 * & |
---|
| 338 | EXP( - ( r_bin_mid(n)**3 / rm_total**3 ) ) * & |
---|
| 339 | ( r_bin(n+1) - r_bin(n) ) |
---|
| 340 | ENDDO |
---|
| 341 | ENDIF |
---|
| 342 | ! |
---|
| 343 | !-- Criterion to avoid super droplets with a weighting factor < 1.0. |
---|
| 344 | an_spl = MAX(an_spl, 1.0_wp) |
---|
| 345 | |
---|
| 346 | DO i = nxl, nxr |
---|
| 347 | DO j = nys, nyn |
---|
| 348 | DO k = nzb+1, nzt |
---|
| 349 | number_of_particles = prt_count(k,j,i) |
---|
| 350 | IF ( number_of_particles <= 0 .OR. & |
---|
| 351 | ql(k,j,i) < ql_crit ) CYCLE |
---|
| 352 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 353 | new_particles_gb = 0 |
---|
| 354 | ! |
---|
| 355 | !-- Start splitting operations. Each particle is checked if it |
---|
| 356 | !-- fulfilled the splitting criterion's. In splitting mode 'cl_av' |
---|
| 357 | !-- a critical radius (radius_split) and a splitting function must |
---|
| 358 | !-- be prescribed (see particles_par). The critical weighting factor |
---|
| 359 | !-- is calculated while approximating a 'gamma', 'log' or 'exp'- |
---|
| 360 | !-- drop size distribution. In this mode the DSD is calculated as |
---|
| 361 | !-- an average over all cloudy grid boxes. Super droplets which |
---|
| 362 | !-- have a larger radius and larger weighting factor are split into |
---|
| 363 | !-- 'splitting_factor' super droplets. In this case the splitting |
---|
| 364 | !-- factor is calculated of weighting factor of the super droplet |
---|
| 365 | !-- and the approximated number concentration for droplet of such |
---|
| 366 | !-- a size. Due to the splitting, the weighting factor of the |
---|
| 367 | !-- super droplet and all created clones is reduced by the factor |
---|
| 368 | !-- of 'splitting_facor'. |
---|
| 369 | DO n = 1, number_of_particles |
---|
| 370 | DO np = 0, n_max-1 |
---|
| 371 | IF ( r_bin(np) >= radius_split .AND. & |
---|
| 372 | particles(n)%particle_mask .AND. & |
---|
| 373 | particles(n)%radius >= r_bin(np) .AND. & |
---|
| 374 | particles(n)%radius < r_bin(np+1) .AND. & |
---|
| 375 | particles(n)%weight_factor >= an_spl(np) ) & |
---|
| 376 | THEN |
---|
| 377 | ! |
---|
| 378 | !-- Calculate splitting factor |
---|
| 379 | splitting_factor = & |
---|
| 380 | MIN( INT( particles(n)%weight_factor / & |
---|
| 381 | an_spl(np) & |
---|
| 382 | ), splitting_factor_max & |
---|
| 383 | ) |
---|
| 384 | IF ( splitting_factor < 2 ) CYCLE |
---|
| 385 | ! |
---|
| 386 | !-- Calculate the new number of particles. |
---|
| 387 | new_size = prt_count(k,j,i) + splitting_factor - 1 |
---|
| 388 | ! |
---|
| 389 | !-- Cycle if maximum number of particles per grid box |
---|
| 390 | !-- is greater than the allowed maximum number. |
---|
| 391 | IF ( new_size >= max_number_particles_per_gridbox ) & |
---|
| 392 | CYCLE |
---|
| 393 | ! |
---|
| 394 | !-- Reallocate particle array if necessary. |
---|
| 395 | IF ( new_size > SIZE(particles) ) THEN |
---|
| 396 | CALL realloc_particles_array(i,j,k,new_size) |
---|
| 397 | ENDIF |
---|
| 398 | old_size = prt_count(k,j,i) |
---|
| 399 | new_particles_gb = new_particles_gb + & |
---|
| 400 | splitting_factor - 1 |
---|
| 401 | ! |
---|
| 402 | !-- Calculate new weighting factor. |
---|
| 403 | particles(n)%weight_factor = & |
---|
| 404 | particles(n)%weight_factor / splitting_factor |
---|
| 405 | tmp_particle = particles(n) |
---|
| 406 | ! |
---|
| 407 | !-- Create splitting_factor-1 new particles. |
---|
| 408 | DO jpp = 1, splitting_factor-1 |
---|
| 409 | grid_particles(k,j,i)%particles(jpp+old_size) = & |
---|
| 410 | tmp_particle |
---|
| 411 | ENDDO |
---|
| 412 | ! |
---|
| 413 | !-- Save the new number of super droplets. |
---|
| 414 | prt_count(k,j,i) = prt_count(k,j,i) + & |
---|
| 415 | splitting_factor - 1 |
---|
| 416 | ENDIF |
---|
| 417 | ENDDO |
---|
| 418 | ENDDO |
---|
| 419 | |
---|
| 420 | new_particles = new_particles + new_particles_gb |
---|
| 421 | sum_new_particles = sum_new_particles + new_particles_gb |
---|
| 422 | ENDDO |
---|
| 423 | ENDDO |
---|
| 424 | ENDDO |
---|
| 425 | |
---|
| 426 | ELSEIF ( i_splitting_mode == 3 ) THEN |
---|
| 427 | |
---|
| 428 | DO i = nxl, nxr |
---|
| 429 | DO j = nys, nyn |
---|
| 430 | DO k = nzb+1, nzt |
---|
| 431 | |
---|
| 432 | ! |
---|
| 433 | !-- Initialize summing variables. |
---|
| 434 | lwc = 0.0_wp |
---|
| 435 | m1 = 0.0_wp |
---|
| 436 | m2 = 0.0_wp |
---|
| 437 | m3 = 0.0_wp |
---|
| 438 | nr = 0.0_wp |
---|
| 439 | rm = 0.0_wp |
---|
| 440 | |
---|
| 441 | new_particles_gb = 0 |
---|
| 442 | number_of_particles = prt_count(k,j,i) |
---|
| 443 | IF ( number_of_particles <= 0 .OR. & |
---|
| 444 | ql(k,j,i) < ql_crit ) CYCLE |
---|
| 445 | particles => grid_particles(k,j,i)%particles |
---|
| 446 | ! |
---|
| 447 | !-- Calculate moments of DSD. |
---|
| 448 | DO n = 1, number_of_particles |
---|
| 449 | IF ( particles(n)%particle_mask .AND. & |
---|
| 450 | particles(n)%radius >= r_min ) & |
---|
| 451 | THEN |
---|
| 452 | nr = nr + particles(n)%weight_factor |
---|
| 453 | rm = rm + factor_volume_to_mass * & |
---|
| 454 | particles(n)%radius**3 * & |
---|
| 455 | particles(n)%weight_factor |
---|
| 456 | IF ( isf == 1 ) THEN |
---|
| 457 | diameter = particles(n)%radius * 2.0_wp |
---|
| 458 | lwc = lwc + factor_volume_to_mass * & |
---|
| 459 | particles(n)%radius**3 * & |
---|
| 460 | particles(n)%weight_factor |
---|
| 461 | m1 = m1 + particles(n)%weight_factor * diameter |
---|
| 462 | m2 = m2 + particles(n)%weight_factor * diameter**2 |
---|
| 463 | m3 = m3 + particles(n)%weight_factor * diameter**3 |
---|
| 464 | ENDIF |
---|
| 465 | ENDIF |
---|
| 466 | ENDDO |
---|
| 467 | |
---|
| 468 | IF ( nr <= 0.0 .OR. rm <= 0.0_wp ) CYCLE |
---|
| 469 | ! |
---|
| 470 | !-- Calculate mean volume averaged radius. |
---|
| 471 | rm = ( rm / ( nr * factor_volume_to_mass ) )**0.3333333_wp |
---|
| 472 | ! |
---|
| 473 | !-- Check which function should be used to approximate the DSD. |
---|
| 474 | IF ( isf == 1 ) THEN |
---|
| 475 | ! |
---|
| 476 | !-- Gamma size distribution to calculate |
---|
| 477 | !-- critical weight_factor (e.g. Marshall + Palmer, 1948). |
---|
| 478 | zeta = m1 * m3 / m2**2 |
---|
| 479 | mu = MAX( ( ( 1.0_wp - zeta ) * 2.0_wp + 1.0_wp ) / & |
---|
| 480 | ( zeta - 1.0_wp ), 0.0_wp & |
---|
| 481 | ) |
---|
| 482 | lambda = ( pirho_l * nr / lwc * & |
---|
| 483 | ( mu + 3.0_wp ) * ( mu + 2.0_wp ) * & |
---|
| 484 | ( mu + 1.0_wp ) & |
---|
| 485 | )**0.3333333_wp |
---|
| 486 | nr0 = ( nr / (gamma( mu + 1.0_wp ) ) ) * & |
---|
| 487 | lambda**( mu + 1.0_wp ) |
---|
| 488 | |
---|
| 489 | DO n = 0, n_max-1 |
---|
| 490 | diameter = r_bin_mid(n) * 2.0_wp |
---|
| 491 | an_spl(n) = nr0 * diameter**mu * & |
---|
| 492 | EXP( -lambda * diameter ) * & |
---|
| 493 | ( r_bin(n+1) - r_bin(n) ) * 2.0_wp |
---|
| 494 | ENDDO |
---|
| 495 | ELSEIF ( isf == 2 ) THEN |
---|
| 496 | ! |
---|
| 497 | !-- Lognormal size distribution to calculate critical |
---|
| 498 | !-- weight_factor (e.g. Levin, 1971, Bradley + Stow, 1974). |
---|
| 499 | DO n = 0, n_max-1 |
---|
| 500 | an_spl(n) = nr / ( SQRT( 2.0_wp * pi ) * & |
---|
| 501 | LOG(sigma_log) * r_bin_mid(n) & |
---|
| 502 | ) * & |
---|
| 503 | EXP( -( LOG( r_bin_mid(n) / rm )**2 ) / & |
---|
| 504 | ( 2.0_wp * LOG(sigma_log)**2 ) & |
---|
| 505 | ) * & |
---|
| 506 | ( r_bin(n+1) - r_bin(n) ) |
---|
| 507 | ENDDO |
---|
| 508 | ELSEIF ( isf == 3 ) THEN |
---|
| 509 | ! |
---|
| 510 | !-- Exponential size distribution to calculate critical |
---|
| 511 | !-- weight_factor (e.g. Berry + Reinhardt, 1974). |
---|
| 512 | DO n = 0, n_max-1 |
---|
| 513 | an_spl(n) = 3.0_wp * nr * r_bin_mid(n)**2 / rm**3 * & |
---|
| 514 | EXP( - ( r_bin_mid(n)**3 / rm**3 ) ) * & |
---|
| 515 | ( r_bin(n+1) - r_bin(n) ) |
---|
| 516 | ENDDO |
---|
| 517 | ENDIF |
---|
| 518 | |
---|
| 519 | ! |
---|
| 520 | !-- Criterion to avoid super droplets with a weighting factor < 1.0. |
---|
| 521 | an_spl = MAX(an_spl, 1.0_wp) |
---|
| 522 | ! |
---|
| 523 | !-- Start splitting operations. Each particle is checked if it |
---|
| 524 | !-- fulfilled the splitting criterion's. In splitting mode 'gb_av' |
---|
| 525 | !-- a critical radius (radius_split) and a splitting function must |
---|
| 526 | !-- be prescribed (see particles_par). The critical weighting factor |
---|
| 527 | !-- is calculated while appoximating a 'gamma', 'log' or 'exp'- |
---|
| 528 | !-- drop size distribution. In this mode a DSD is calculated for |
---|
| 529 | !-- every cloudy grid box. Super droplets which have a larger |
---|
| 530 | !-- radius and larger weighting factor are split into |
---|
| 531 | !-- 'splitting_factor' super droplets. In this case the splitting |
---|
| 532 | !-- factor is calculated of weighting factor of the super droplet |
---|
| 533 | !-- and theapproximated number concentration for droplet of such |
---|
| 534 | !-- a size. Due to the splitting, the weighting factor of the |
---|
| 535 | !-- super droplet and all created clones is reduced by the factor |
---|
| 536 | !-- of 'splitting_facor'. |
---|
| 537 | DO n = 1, number_of_particles |
---|
| 538 | DO np = 0, n_max-1 |
---|
| 539 | IF ( r_bin(np) >= radius_split .AND. & |
---|
| 540 | particles(n)%particle_mask .AND. & |
---|
| 541 | particles(n)%radius >= r_bin(np) .AND. & |
---|
| 542 | particles(n)%radius < r_bin(np+1) .AND. & |
---|
| 543 | particles(n)%weight_factor >= an_spl(np) ) & |
---|
| 544 | THEN |
---|
| 545 | ! |
---|
| 546 | !-- Calculate splitting factor. |
---|
| 547 | splitting_factor = & |
---|
| 548 | MIN( INT( particles(n)%weight_factor / & |
---|
| 549 | an_spl(np) & |
---|
| 550 | ), splitting_factor_max & |
---|
| 551 | ) |
---|
| 552 | IF ( splitting_factor < 2 ) CYCLE |
---|
| 553 | |
---|
| 554 | ! |
---|
| 555 | !-- Calculate the new number of particles. |
---|
| 556 | new_size = prt_count(k,j,i) + splitting_factor - 1 |
---|
| 557 | ! |
---|
| 558 | !-- Cycle if maximum number of particles per grid box |
---|
| 559 | !-- is greater than the allowed maximum number. |
---|
| 560 | IF ( new_size >= max_number_particles_per_gridbox ) & |
---|
| 561 | CYCLE |
---|
| 562 | ! |
---|
| 563 | !-- Reallocate particle array if necessary. |
---|
| 564 | IF ( new_size > SIZE(particles) ) THEN |
---|
| 565 | CALL realloc_particles_array(i,j,k,new_size) |
---|
| 566 | ENDIF |
---|
| 567 | ! |
---|
| 568 | !-- Calculate new weighting factor. |
---|
| 569 | particles(n)%weight_factor = & |
---|
| 570 | particles(n)%weight_factor / splitting_factor |
---|
| 571 | tmp_particle = particles(n) |
---|
| 572 | old_size = prt_count(k,j,i) |
---|
| 573 | ! |
---|
| 574 | !-- Create splitting_factor-1 new particles. |
---|
| 575 | DO jpp = 1, splitting_factor-1 |
---|
| 576 | grid_particles(k,j,i)%particles(jpp+old_size) = & |
---|
| 577 | tmp_particle |
---|
| 578 | ENDDO |
---|
| 579 | ! |
---|
| 580 | !-- Save the new number of droplets for every grid box. |
---|
| 581 | prt_count(k,j,i) = prt_count(k,j,i) + & |
---|
| 582 | splitting_factor - 1 |
---|
| 583 | new_particles_gb = new_particles_gb + & |
---|
| 584 | splitting_factor - 1 |
---|
| 585 | ENDIF |
---|
| 586 | ENDDO |
---|
| 587 | ENDDO |
---|
| 588 | |
---|
| 589 | new_particles = new_particles + new_particles_gb |
---|
| 590 | sum_new_particles = sum_new_particles + new_particles_gb |
---|
| 591 | ENDDO |
---|
| 592 | ENDDO |
---|
| 593 | ENDDO |
---|
| 594 | ENDIF |
---|
| 595 | |
---|
| 596 | CALL cpu_log( log_point_s(80), 'lpm_splitting', 'stop' ) |
---|
| 597 | |
---|
| 598 | END SUBROUTINE lpm_splitting |
---|
| 599 | |
---|