source: palm/trunk/SOURCE/lpm_droplet_collision.f90 @ 3027

Last change on this file since 3027 was 2718, checked in by maronga, 7 years ago

deleting of deprecated files; headers updated where needed

  • Property svn:keywords set to Id
File size: 15.3 KB
Line 
1!> @file lpm_droplet_collision.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
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-2018 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: lpm_droplet_collision.f90 2718 2018-01-02 08:49:38Z knoop $
27! Corrected "Former revisions" section
28!
29! 2696 2017-12-14 17:12:51Z kanani
30! Change in file header (GPL part)
31!
32! 2375 2017-08-29 14:10:28Z schwenkel
33! Changed ONLY-dependencies
34!
35! 2312 2017-07-14 20:26:51Z hoffmann
36! Consideration of aerosol mass during collision. Average impact algorithm has
37! been removed.
38!
39! 2274 2017-06-09 13:27:48Z Giersch
40! Changed error messages
41!
42! 2123 2017-01-18 12:34:59Z hoffmann
43!
44! 2122 2017-01-18 12:22:54Z hoffmann
45! Some reformatting of the code.
46!
47! 2000 2016-08-20 18:09:15Z knoop
48! Forced header and separation lines into 80 columns
49!
50! 1884 2016-04-21 11:11:40Z hoffmann
51! Conservation of mass should only be checked if collisions took place.
52!
53! 1860 2016-04-13 13:21:28Z hoffmann
54! Interpolation of dissipation rate adjusted to more reasonable values.
55!
56! 1822 2016-04-07 07:49:42Z hoffmann
57! Integration of a new collision algortithm based on Shima et al. (2009) and
58! Soelch and Kaercher (2010) called all_or_nothing. The previous implemented
59! collision algorithm is called average_impact. Moreover, both algorithms are
60! now positive definit due to their construction, i.e., no negative weighting
61! factors should occur.
62!
63! 1682 2015-10-07 23:56:08Z knoop
64! Code annotations made doxygen readable
65!
66! 1359 2014-04-11 17:15:14Z hoffmann
67! New particle structure integrated.
68! Kind definition added to all floating point numbers.
69!
70! 1322 2014-03-20 16:38:49Z raasch
71! REAL constants defined as wp_kind
72!
73! 1320 2014-03-20 08:40:49Z raasch
74! ONLY-attribute added to USE-statements,
75! kind-parameters added to all INTEGER and REAL declaration statements,
76! kinds are defined in new module kinds,
77! revision history before 2012 removed,
78! comment fields (!:) to be used for variable explanations added to
79! all variable declaration statements
80!
81! 1092 2013-02-02 11:24:22Z raasch
82! unused variables removed
83!
84! 1071 2012-11-29 16:54:55Z franke
85! Calculation of Hall and Wang kernel now uses collision-coalescence formulation
86! proposed by Wang instead of the continuous collection equation (for more
87! information about new method see PALM documentation)
88! Bugfix: message identifiers added
89!
90! 1036 2012-10-22 13:43:42Z raasch
91! code put under GPL (PALM 3.9)
92!
93! 849 2012-03-15 10:35:09Z raasch
94! initial revision (former part of advec_particles)
95!
96!
97! Description:
98! ------------
99!> Calculates change in droplet radius by collision. Droplet collision is
100!> calculated for each grid box seperately. Collision is parameterized by
101!> using collision kernels. Two different kernels are available:
102!> Hall kernel: Kernel from Hall (1980, J. Atmos. Sci., 2486-2507), which
103!>              considers collision due to pure gravitational effects.
104!> Wang kernel: Beside gravitational effects (treated with the Hall-kernel) also
105!>              the effects of turbulence on the collision are considered using
106!>              parameterizations of Ayala et al. (2008, New J. Phys., 10,
107!>              075015) and Wang and Grabowski (2009, Atmos. Sci. Lett., 10,
108!>              1-8). This kernel includes three possible effects of turbulence:
109!>              the modification of the relative velocity between the droplets,
110!>              the effect of preferential concentration, and the enhancement of
111!>              collision efficiencies.
112!------------------------------------------------------------------------------!
113 SUBROUTINE lpm_droplet_collision (i,j,k)
114
115    USE arrays_3d,                                                             &
116        ONLY:  diss, ql_v, ql_vp
117
118    USE cloud_parameters,                                                      &
119        ONLY:  rho_l, rho_s
120
121    USE constants,                                                             &
122        ONLY:  pi
123
124    USE control_parameters,                                                    &
125        ONLY:  dt_3d, message_string, dz
126
127    USE cpulog,                                                                &
128        ONLY:  cpu_log, log_point_s
129
130    USE grid_variables,                                                        &
131        ONLY:  dx, dy
132
133    USE kinds
134
135    USE lpm_collision_kernels_mod,                                             &
136        ONLY:  ckernel, recalculate_kernel
137
138    USE particle_attributes,                                                   &
139        ONLY:  curvature_solution_effects, dissipation_classes, hall_kernel,   &
140               iran_part, number_of_particles, particles, particle_type,       &
141               prt_count, use_kernel_tables, wang_kernel
142
143    USE random_function_mod,                                                   &
144        ONLY:  random_function
145
146    USE pegrid
147
148    IMPLICIT NONE
149
150    INTEGER(iwp) ::  eclass   !<
151    INTEGER(iwp) ::  i        !<
152    INTEGER(iwp) ::  j        !<
153    INTEGER(iwp) ::  k        !<
154    INTEGER(iwp) ::  n        !<
155    INTEGER(iwp) ::  m        !<
156    INTEGER(iwp) ::  rclass_l !<
157    INTEGER(iwp) ::  rclass_s !<
158
159    REAL(wp) ::  collection_probability  !< probability for collection
160    REAL(wp) ::  ddV                     !< inverse grid box volume
161    REAL(wp) ::  epsilon                 !< dissipation rate
162    REAL(wp) ::  factor_volume_to_mass   !< 4.0 / 3.0 * pi * rho_l
163    REAL(wp) ::  xm                      !< droplet mass of super-droplet m
164    REAL(wp) ::  xn                      !< droplet mass of super-droplet n
165    REAL(wp) ::  xsm                     !< aerosol mass of super-droplet m
166    REAL(wp) ::  xsn                     !< aerosol mass of super-droplet n
167
168    REAL(wp), DIMENSION(:), ALLOCATABLE ::  weight    !< weighting factor
169    REAL(wp), DIMENSION(:), ALLOCATABLE ::  mass      !< total mass of super droplet
170    REAL(wp), DIMENSION(:), ALLOCATABLE ::  aero_mass !< total aerosol mass of super droplet
171
172    CALL cpu_log( log_point_s(43), 'lpm_droplet_coll', 'start' )
173
174    number_of_particles   = prt_count(k,j,i)
175    factor_volume_to_mass = 4.0_wp / 3.0_wp * pi * rho_l
176    ddV                   = 1.0_wp / ( dx * dy * dz )
177!
178!-- Collision requires at least one super droplet inside the box
179    IF ( number_of_particles > 0 )  THEN
180
181       IF ( use_kernel_tables )  THEN
182!
183!--       Fast method with pre-calculated collection kernels for
184!--       discrete radius- and dissipation-classes.
185          IF ( wang_kernel )  THEN
186             eclass = INT( diss(k,j,i) * 1.0E4_wp / 600.0_wp * &
187                           dissipation_classes ) + 1
188             epsilon = diss(k,j,i)
189          ELSE
190             epsilon = 0.0_wp
191          ENDIF
192
193          IF ( hall_kernel  .OR.  epsilon * 1.0E4_wp < 0.001_wp )  THEN
194             eclass = 0   ! Hall kernel is used
195          ELSE
196             eclass = MIN( dissipation_classes, eclass )
197          ENDIF
198
199       ELSE
200!
201!--       Collection kernels are re-calculated for every new
202!--       grid box. First, allocate memory for kernel table.
203!--       Third dimension is 1, because table is re-calculated for
204!--       every new dissipation value.
205          ALLOCATE( ckernel(1:number_of_particles,1:number_of_particles,1:1) )
206!
207!--       Now calculate collection kernel for this box. Note that
208!--       the kernel is based on the previous time step
209          CALL recalculate_kernel( i, j, k )
210
211       ENDIF
212!
213!--    Temporary fields for total mass of super-droplet, aerosol mass, and
214!--    weighting factor are allocated.
215       ALLOCATE(mass(1:number_of_particles), weight(1:number_of_particles))
216       IF ( curvature_solution_effects )  ALLOCATE(aero_mass(1:number_of_particles))
217
218       mass(1:number_of_particles)   = particles(1:number_of_particles)%weight_factor * &
219                                       particles(1:number_of_particles)%radius**3     * &
220                                       factor_volume_to_mass
221
222       weight(1:number_of_particles) = particles(1:number_of_particles)%weight_factor
223
224       IF ( curvature_solution_effects )  THEN
225          aero_mass(1:number_of_particles) = particles(1:number_of_particles)%weight_factor * &
226                                             particles(1:number_of_particles)%aux1**3       * &
227                                             4.0 / 3.0 * pi * rho_s
228       ENDIF
229!
230!--    Calculate collision/coalescence
231       DO  n = 1, number_of_particles
232
233          DO  m = n, number_of_particles
234!
235!--          For collisions, the weighting factor of at least one super-droplet
236!--          needs to be larger or equal to one.
237             IF ( MIN( weight(n), weight(m) ) .LT. 1.0 )  CYCLE
238!
239!--          Get mass of individual droplets (aerosols)
240             xn = mass(n) / weight(n)
241             xm = mass(m) / weight(m)
242             IF ( curvature_solution_effects )  THEN
243                xsn = aero_mass(n) / weight(n)
244                xsm = aero_mass(m) / weight(m)
245             ENDIF
246!
247!--          Probability that the necessary collisions take place
248             IF ( use_kernel_tables )  THEN
249                rclass_l = particles(n)%class
250                rclass_s = particles(m)%class
251
252                collection_probability  = MAX( weight(n), weight(m) ) *     &
253                                          ckernel(rclass_l,rclass_s,eclass) * ddV * dt_3d
254             ELSE
255                collection_probability  = MAX( weight(n), weight(m) ) *     &
256                                          ckernel(n,m,1) * ddV * dt_3d
257             ENDIF
258!
259!--          Calculate the number of collections and consider multiple collections.
260!--          (Accordingly, p_crit will be 0.0, 1.0, 2.0, ...)
261             IF ( collection_probability - FLOOR(collection_probability)    &
262                  .GT. random_function( iran_part ) )  THEN
263                collection_probability = FLOOR(collection_probability) + 1.0_wp
264             ELSE
265                collection_probability = FLOOR(collection_probability)
266             ENDIF
267
268             IF ( collection_probability .GT. 0.0 )  THEN
269!
270!--             Super-droplet n collects droplets of super-droplet m
271                IF ( weight(n) .LT. weight(m) )  THEN
272
273                   mass(n)   = mass(n)   + weight(n) * xm * collection_probability
274                   weight(m) = weight(m) - weight(n)      * collection_probability
275                   mass(m)   = mass(m)   - weight(n) * xm * collection_probability
276                   IF ( curvature_solution_effects )  THEN
277                      aero_mass(n) = aero_mass(n) + weight(n) * xsm * collection_probability
278                      aero_mass(m) = aero_mass(m) - weight(n) * xsm * collection_probability
279                   ENDIF
280
281                ELSEIF ( weight(m) .LT. weight(n) )  THEN
282
283                   mass(m)   = mass(m)   + weight(m) * xn * collection_probability
284                   weight(n) = weight(n) - weight(m)      * collection_probability
285                   mass(n)   = mass(n)   - weight(m) * xn * collection_probability
286                   IF ( curvature_solution_effects )  THEN
287                      aero_mass(m) = aero_mass(m) + weight(m) * xsn * collection_probability
288                      aero_mass(n) = aero_mass(n) - weight(m) * xsn * collection_probability
289                   ENDIF
290
291                ELSE
292!
293!--                Collisions of particles of the same weighting factor.
294!--                Particle n collects 1/2 weight(n) droplets of particle m,
295!--                particle m collects 1/2 weight(m) droplets of particle n.
296!--                The total mass mass changes accordingly.
297!--                If n = m, the first half of the droplets coalesces with the
298!--                second half of the droplets; mass is unchanged because
299!--                xm = xn for n = m.
300!--
301!--                Note: For m = n this equation is an approximation only
302!--                valid for weight >> 1 (which is usually the case). The
303!--                approximation is weight(n)-1 = weight(n).
304                   mass(n)   = mass(n)   + 0.5_wp * weight(n) * ( xm - xn )
305                   mass(m)   = mass(m)   + 0.5_wp * weight(m) * ( xn - xm )
306                   IF ( curvature_solution_effects )  THEN
307                      aero_mass(n) = aero_mass(n) + 0.5_wp * weight(n) * ( xsm - xsn )
308                      aero_mass(m) = aero_mass(m) + 0.5_wp * weight(m) * ( xsn - xsm )
309                   ENDIF
310                   weight(n) = weight(n) - 0.5_wp * weight(m)
311                   weight(m) = weight(n)
312
313                ENDIF
314
315             ENDIF
316
317          ENDDO
318
319          ql_vp(k,j,i) = ql_vp(k,j,i) + mass(n) / factor_volume_to_mass
320
321       ENDDO
322
323       IF ( ANY(weight < 0.0_wp) )  THEN
324             WRITE( message_string, * ) 'negative weighting factor'
325             CALL message( 'lpm_droplet_collision', 'PA0028',      &
326                            2, 2, -1, 6, 1 )
327       ENDIF
328
329       particles(1:number_of_particles)%radius = ( mass(1:number_of_particles) /   &
330                                                   ( weight(1:number_of_particles) &
331                                                     * factor_volume_to_mass       &
332                                                   )                               &
333                                                 )**0.33333333333333_wp
334
335       IF ( curvature_solution_effects )  THEN
336          particles(1:number_of_particles)%aux1 = ( aero_mass(1:number_of_particles) / &
337                                                    ( weight(1:number_of_particles)    &
338                                                      * 4.0_wp / 3.0_wp * pi * rho_s   &
339                                                    )                                  &
340                                                  )**0.33333333333333_wp
341       ENDIF
342
343       particles(1:number_of_particles)%weight_factor = weight(1:number_of_particles)
344
345       DEALLOCATE( weight, mass )
346       IF ( curvature_solution_effects )  DEALLOCATE( aero_mass )
347       IF ( .NOT. use_kernel_tables )  DEALLOCATE( ckernel )
348
349!
350!--    Check if LWC is conserved during collision process
351       IF ( ql_v(k,j,i) /= 0.0_wp )  THEN
352          IF ( ql_vp(k,j,i) / ql_v(k,j,i) >= 1.0001_wp  .OR.                      &
353               ql_vp(k,j,i) / ql_v(k,j,i) <= 0.9999_wp )  THEN
354             WRITE( message_string, * ) ' LWC is not conserved during',           &
355                                        ' collision! ',                           &
356                                        ' LWC after condensation: ', ql_v(k,j,i), &
357                                        ' LWC after collision: ', ql_vp(k,j,i)
358             CALL message( 'lpm_droplet_collision', 'PA0040', 2, 2, -1, 6, 1 )
359          ENDIF
360       ENDIF
361
362    ENDIF
363
364    CALL cpu_log( log_point_s(43), 'lpm_droplet_coll', 'stop' )
365
366 END SUBROUTINE lpm_droplet_collision
Note: See TracBrowser for help on using the repository browser.