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