source: palm/trunk/SOURCE/lpm_collision_kernels.f90 @ 828

Last change on this file since 828 was 828, checked in by raasch, 12 years ago

New:
---

Changed:


Optimization of collision kernels. Collision tables can be calculated once at
simulation start for defined radius (and dissipation) classes instead of
re-calculating them at every timestep and for the particle ensemble in
every gridbox.
For this purpose the particle feature color is renamed class.
New parpar parameters radius_classes and dissipation_classes.
(Makefile, advec_particles, check_parameters, data_output_dvrp, header, init_particles, lpm_collision_kernels, modules, package_parin, set_particle_attributes)

Lower limit for droplet radius changed from 1E-7 to 1E-8.
(advec_particles)

Complete re-formatting of collision code (including changes in names of
variables, modules and subroutines).
(advec_particles, lpm_collision_kernels)

Errors:


Bugfix: transformation factor for dissipation changed from 1E5 to 1E4
(advec_particles, lpm_collision_kernels)

  • Property svn:keywords set to Id
File size: 30.9 KB
Line 
1 MODULE lpm_collision_kernels_mod
2
3!------------------------------------------------------------------------------!
4! Current revisions:
5! -----------------
6! code has been completely reformatted, routine colker renamed
7! recalculate_kernel,
8! routine init_kernels added, radius is now communicated to the collision
9! routines by array radclass
10!
11! Bugfix: transformation factor for dissipation changed from 1E5 to 1E4
12!
13! Former revisions:
14! -----------------
15! $Id: lpm_collision_kernels.f90 828 2012-02-21 12:00:36Z raasch $
16!
17! 825 2012-02-19 03:03:44Z raasch
18! routine renamed from wang_kernel to lpm_collision_kernels,
19! turbulence_effects on collision replaced by wang_kernel
20!
21! 799 2011-12-21 17:48:03Z franke
22! speed optimizations and formatting
23! Bugfix: iq=1 is not allowed (routine effic)
24! Bugfix: replaced stop by ec=0.0 in case of very small ec (routine effic)
25!
26! 790 2011-11-29 03:11:20Z raasch
27! initial revision
28!
29! Description:
30! ------------
31! This module calculates collision efficiencies either due to pure gravitational
32! effects (Hall kernel, see Hall, 1980: J. Atmos. Sci., 2486-2507) or
33! including the effects of (SGS) turbulence (Wang kernel, see Wang and
34! Grabowski, 2009: Atmos. Sci. Lett., 10, 1-8). The original code has been
35! provided by L.-P. Wang but is substantially reformatted and speed optimized
36! here.
37!
38! ATTENTION:
39! Physical quantities (like g, densities, etc.) used in this module still
40! have to be adjusted to those values used in the main PALM code.
41! Also, quantities in CGS-units should be converted to SI-units eventually.
42!------------------------------------------------------------------------------!
43
44    USE arrays_3d
45    USE cloud_parameters
46    USE constants
47    USE particle_attributes
48    USE pegrid
49
50
51    IMPLICIT NONE
52
53    PRIVATE
54
55    PUBLIC  ckernel, init_kernels,  rclass_lbound, rclass_ubound, &
56            recalculate_kernel           
57
58    REAL ::  epsilon, eps2, rclass_lbound, rclass_ubound, urms, urms2
59
60    REAL, DIMENSION(:),   ALLOCATABLE ::  epsclass, radclass, winf
61    REAL, DIMENSION(:,:), ALLOCATABLE ::  ec, ecf, gck, hkernel, hwratio
62    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  ckernel
63
64    SAVE
65
66!
67!-- Public interfaces
68    INTERFACE init_kernels
69       MODULE PROCEDURE init_kernels
70    END INTERFACE init_kernels
71
72    INTERFACE recalculate_kernel
73       MODULE PROCEDURE recalculate_kernel
74    END INTERFACE recalculate_kernel
75
76
77    CONTAINS
78
79
80    SUBROUTINE init_kernels
81!------------------------------------------------------------------------------!
82! Initialization of the collision efficiency matrix with fixed radius and
83! dissipation classes, calculated at simulation start only.
84!------------------------------------------------------------------------------!
85
86       IMPLICIT NONE
87
88       INTEGER ::  i, j, k
89
90
91!
92!--    Calculate collision efficiencies for fixed radius- and dissipation
93!--    classes
94       IF ( collision_kernel(6:9) == 'fast' )  THEN
95
96          ALLOCATE( ckernel(1:radius_classes,1:radius_classes,               &
97                    0:dissipation_classes), epsclass(1:dissipation_classes), &
98                    radclass(1:radius_classes) )
99
100!
101!--       Calculate the radius class bounds with logarithmic distances
102!--       in the interval [1.0E-6, 2.0E-4] m
103          rclass_lbound = LOG( 1.0E-6 )
104          rclass_ubound = LOG( 2.0E-4 )
105          radclass(1)   = 1.0E-6
106          DO  i = 2, radius_classes
107             radclass(i) = EXP( rclass_lbound +                                &
108                                ( rclass_ubound - rclass_lbound ) * ( i-1.0 ) /&
109                                ( radius_classes - 1.0 ) )
110!             IF ( myid == 0 )  THEN
111!                PRINT*, 'i=', i, ' r = ', radclass(i)*1.0E6
112!             ENDIF
113          ENDDO
114!
115!--       Collision routines expect radius to be in cm
116          radclass = radclass * 100.0
117
118!
119!--       Set the class bounds for dissipation in interval [0, 1000] cm**2/s**3
120          DO  i = 1, dissipation_classes
121             epsclass(i) = 1000.0 * REAL( i ) / dissipation_classes
122!             IF ( myid == 0 )  THEN
123!                PRINT*, 'i=', i, ' eps = ', epsclass(i)
124!             ENDIF
125          ENDDO
126!
127!--       Calculate collision efficiencies of the Wang/ayala kernel
128          ALLOCATE( ec(1:radius_classes,1:radius_classes),  &
129                    ecf(1:radius_classes,1:radius_classes), &
130                    gck(1:radius_classes,1:radius_classes), &
131                    winf(1:radius_classes) )
132
133          DO  k = 1, dissipation_classes
134
135             epsilon = epsclass(k)
136             urms    = 202.0 * ( epsilon / 400.0 )**( 1.0 / 3.0 )
137
138             CALL turbsd
139             CALL turb_enhance_eff
140             CALL effic
141
142             DO  j = 1, radius_classes
143                DO  i = 1, radius_classes
144                   ckernel(i,j,k) = ec(i,j) * gck(i,j) * ecf(i,j)
145                ENDDO
146             ENDDO
147
148          ENDDO
149
150!
151!--       Calculate collision efficiencies of the Hall kernel
152          ALLOCATE( hkernel(1:radius_classes,1:radius_classes), &
153                    hwratio(1:radius_classes,1:radius_classes) )
154
155          CALL fallg
156          CALL effic
157
158          DO  j = 1, radius_classes
159             DO  i =  1, radius_classes
160                hkernel(i,j) = pi * ( radclass(j) + radclass(i) )**2 &
161                                  * ec(i,j) * ABS( winf(j) - winf(i) )
162                ckernel(i,j,0) = hkernel(i,j)  ! hall kernel stored on index 0
163              ENDDO
164          ENDDO
165
166!
167!--       Test output of efficiencies
168          IF ( j == -1 )  THEN
169
170             PRINT*, '*** Hall kernel'
171             WRITE ( *,'(5X,20(F4.0,1X))' ) ( radclass(i)*1.0E4, i = 1,radius_classes )
172             DO  j = 1, radius_classes
173                WRITE ( *,'(F4.0,1X,20(F4.2,1X))' ) radclass(j), ( hkernel(i,j), i = 1,radius_classes )
174             ENDDO
175
176             DO  k = 1, dissipation_classes
177                DO  i = 1, radius_classes
178                   DO  j = 1, radius_classes
179                      IF ( hkernel(i,j) == 0.0 )  THEN
180                         hwratio(i,j) = 9999999.9
181                      ELSE
182                         hwratio(i,j) = ckernel(i,j,k) / hkernel(i,j)
183                      ENDIF
184                   ENDDO
185                ENDDO
186
187                PRINT*, '*** epsilon = ', epsclass(k)
188                WRITE ( *,'(5X,20(F4.0,1X))' ) ( radclass(i)*1.0E4, i = 1,radius_classes )
189                DO  j = 1, radius_classes
190!                   WRITE ( *,'(F4.0,1X,20(F4.2,1X))' ) radclass(j)*1.0E4, ( ckernel(i,j,k), i = 1,radius_classes )
191                   WRITE ( *,'(F4.0,1X,20(F4.2,1X))' ) radclass(j)*1.0E4, ( hwratio(i,j), i = 1,radius_classes )
192                ENDDO
193             ENDDO
194
195          ENDIF
196
197          DEALLOCATE( ec, ecf, epsclass, gck, hkernel, winf )
198
199          ckernel = ckernel * 1.0E-6   ! kernel is needed in m**3/s
200
201       ELSEIF( collision_kernel == 'hall'  .OR.  collision_kernel == 'wang' ) &
202       THEN
203!
204!--       Initial settings for Hall- and Wang-Kernel
205!--       To be done: move here parts from turbsd, fallg, ecoll, etc.
206       ENDIF
207
208    END SUBROUTINE init_kernels
209
210
211!------------------------------------------------------------------------------!
212! Calculation of collision kernels during each timestep and for each grid box
213!------------------------------------------------------------------------------!
214    SUBROUTINE recalculate_kernel( i1, j1, k1 )
215
216       USE arrays_3d
217       USE cloud_parameters
218       USE constants
219       USE cpulog
220       USE indices
221       USE interfaces
222       USE particle_attributes
223
224       IMPLICIT NONE
225
226       INTEGER ::  i, i1, j, j1, k1, pend, pstart
227
228
229       pstart = prt_start_index(k1,j1,i1)
230       pend   = prt_start_index(k1,j1,i1) + prt_count(k1,j1,i1) - 1
231       radius_classes = prt_count(k1,j1,i1)
232
233       ALLOCATE( ec(1:radius_classes,1:radius_classes), &
234                 radclass(1:radius_classes), winf(1:radius_classes) )
235
236!
237!--    Store particle radii on the radclass array. Collision routines
238!--    expect radii to be in cm.
239       radclass(1:radius_classes) = particles(pstart:pend)%radius * 100.0
240
241       epsilon = diss(k1,j1,i1) * 1.0E4   ! dissipation rate in cm**2/s**-3
242       urms    = 202.0 * ( epsilon / 400.0 )**( 0.33333333333 )
243
244       IF ( wang_kernel  .AND.  epsilon > 0.001 )  THEN
245!
246!--       Call routines to calculate efficiencies for the Wang kernel
247          ALLOCATE( gck(1:radius_classes,1:radius_classes), &
248                    ecf(1:radius_classes,1:radius_classes) )
249
250          CALL turbsd
251          CALL turb_enhance_eff
252          CALL effic
253
254          DO  j = 1, radius_classes
255             DO  i =  1, radius_classes
256                ckernel(pstart+i-1,pstart+j-1,1) = ec(i,j) * gck(i,j) * ecf(i,j)
257             ENDDO
258          ENDDO
259
260          DEALLOCATE( gck, ecf )
261
262       ELSE
263!
264!--       Call routines to calculate efficiencies for the Hall kernel
265          CALL fallg
266          CALL effic
267
268          DO  j = 1, radius_classes
269             DO  i =  1, radius_classes
270                ckernel(pstart+i-1,pstart+j-1,1) = pi *                       &
271                                          ( radclass(j) + radclass(i) )**2    &
272                                          * ec(i,j) * ABS( winf(j) - winf(i) )
273             ENDDO
274          ENDDO
275
276       ENDIF
277
278       ckernel = ckernel * 1.0E-6   ! kernel is needed in m**3/s
279
280       DEALLOCATE( ec, radclass, winf )
281
282    END SUBROUTINE recalculate_kernel
283
284
285!------------------------------------------------------------------------------!
286! Calculation of gck
287! This is from Aayala 2008b, page 37ff.
288! Necessary input parameters: water density, radii of droplets, air density,
289! air viscosity, turbulent dissipation rate, taylor microscale reynolds number,
290! gravitational acceleration  --> to be replaced by PALM parameters
291!------------------------------------------------------------------------------!
292    SUBROUTINE turbsd
293
294       USE constants
295       USE cloud_parameters
296       USE particle_attributes
297       USE arrays_3d
298
299       IMPLICIT NONE
300
301       INTEGER ::  i, j
302
303       LOGICAL, SAVE ::  first = .TRUE.
304
305       REAL ::  ao, ao_gr, bbb, be, b1, b2, ccc, c1, c1_gr, c2, d1, d2, eta, &
306                e1, e2, fao_gr, fr, grfin, lambda, lambda_re, lf, rc, rrp,   &
307                sst, tauk, tl, t2, tt, t1, vk, vrms1xy, vrms2xy, v1, v1v2xy, &
308                v1xysq, v2, v2xysq, wrfin, wrgrav2, wrtur2xy, xx, yy, z
309
310       REAL, SAVE ::  airdens, airvisc, anu, gravity, waterdens
311
312       REAL, DIMENSION(1:radius_classes) ::  st, tau
313
314
315!
316!--    Initial assignment of constants
317       IF ( first )  THEN
318
319          first = .FALSE.
320          airvisc   = 0.1818     ! dynamic viscosity in mg/cm*s
321          airdens   = 1.2250     ! air density in mg/cm**3
322          waterdens = 1000.0     ! water density in mg/cm**3
323          gravity   = 980.6650   ! in cm/s**2
324          anu = airvisc/airdens  ! kinetic viscosity in cm**2/s
325
326       ENDIF   
327
328       lambda    = urms * SQRT( 15.0 * anu / epsilon )     ! in cm
329       lambda_re = urms**2 * SQRT( 15.0 / epsilon / anu )
330       tl        = urms**2 / epsilon                       ! in s
331       lf        = 0.5 * urms**3 / epsilon                 ! in cm
332       tauk      = SQRT( anu / epsilon )                   ! in s
333       eta       = ( anu**3 / epsilon )**0.25              ! in cm
334       vk        = eta / tauk                              ! in cm/s
335
336       ao = ( 11.0 + 7.0 * lambda_re ) / ( 205.0 + lambda_re )
337       tt = SQRT( 2.0 * lambda_re / ( SQRT( 15.0 ) * ao ) ) * tauk   ! in s
338
339       CALL fallg    ! gives winf in cm/s
340
341       DO  i = 1, radius_classes
342          tau(i) = winf(i) / gravity    ! in s
343          st(i)  = tau(i) / tauk
344       ENDDO
345
346!
347!--    Calculate wr (from Aayala 2008b, page 38f)
348       z   = tt / tl
349       be  = SQRT( 2.0 ) * lambda / lf
350       bbb = SQRT( 1.0 - 2.0 * be**2 )
351       d1  = ( 1.0 + bbb ) / ( 2.0 * bbb )
352       e1  = lf * ( 1.0 + bbb ) * 0.5   ! in cm
353       d2  = ( 1.0 - bbb ) * 0.5 / bbb
354       e2  = lf * ( 1.0 - bbb ) * 0.5   ! in cm
355       ccc = SQRT( 1.0 - 2.0 * z**2 )
356       b1  = ( 1.0 + ccc ) * 0.5 / ccc
357       c1  = tl * ( 1.0 + ccc ) * 0.5   ! in s
358       b2  = ( 1.0 - ccc ) * 0.5 / ccc
359       c2  = tl * ( 1.0 - ccc ) * 0.5   ! in s
360
361       DO  i = 1, radius_classes
362
363          v1 = winf(i)        ! in cm/s
364          t1 = tau(i)         ! in s
365
366          DO  j = 1, i
367             rrp = radclass(i) + radclass(j)               ! radius in cm
368             v2  = winf(j)                                 ! in cm/s
369             t2  = tau(j)                                  ! in s
370
371             v1xysq  = b1 * d1 * phi(c1,e1,v1,t1) - b1 * d2 * phi(c1,e2,v1,t1) &
372                     - b2 * d1 * phi(c2,e1,v1,t1) + b2 * d2 * phi(c2,e2,v1,t1)
373             v1xysq  = v1xysq * urms**2 / t1                ! in cm**2/s**2
374             vrms1xy = SQRT( v1xysq )                       ! in cm/s
375
376             v2xysq  = b1 * d1 * phi(c1,e1,v2,t2) - b1 * d2 * phi(c1,e2,v2,t2) &
377                     - b2 * d1 * phi(c2,e1,v2,t2) + b2 * d2 * phi(c2,e2,v2,t2)
378             v2xysq  = v2xysq * urms**2 / t2                ! in cm**2/s**2
379             vrms2xy = SQRT( v2xysq )                       ! in cm/s
380
381             IF ( winf(i) >= winf(j) )  THEN
382                v1 = winf(i)
383                t1 = tau(i)
384                v2 = winf(j)
385                t2 = tau(j)
386             ELSE
387                v1 = winf(j)
388                t1 = tau(j)
389                v2 = winf(i)
390                t2 = tau(i)
391             ENDIF
392
393             v1v2xy   =  b1 * d1 * zhi(c1,e1,v1,t1,v2,t2) - &
394                         b1 * d2 * zhi(c1,e2,v1,t1,v2,t2) - &
395                         b2 * d1 * zhi(c2,e1,v1,t1,v2,t2) + &
396                         b2 * d2* zhi(c2,e2,v1,t1,v2,t2)
397             fr       = d1 * EXP( -rrp / e1 ) - d2 * EXP( -rrp / e2 )
398             v1v2xy   = v1v2xy * fr * urms**2 / tau(i) / tau(j)  ! in cm**2/s**2
399             wrtur2xy = vrms1xy**2 + vrms2xy**2 - 2.0 * v1v2xy   ! in cm**2/s**2
400             IF ( wrtur2xy < 0.0 )  wrtur2xy = 0.0
401             wrgrav2  = pi / 8.0 * ( winf(j) - winf(i) )**2
402             wrfin    = SQRT( ( 2.0 / pi ) * ( wrtur2xy + wrgrav2) )   ! in cm/s
403
404!
405!--          Calculate gr
406             IF ( st(j) > st(i) )  THEN
407                sst = st(j)
408             ELSE
409                sst = st(i)
410             ENDIF
411
412             xx = -0.1988 * sst**4 + 1.5275 * sst**3 - 4.2942 * sst**2 + &
413                   5.3406 * sst
414             IF ( xx < 0.0 )  xx = 0.0
415             yy = 0.1886 * EXP( 20.306 / lambda_re )
416
417             c1_gr  =  xx / ( gravity / vk * tauk )**yy
418
419             ao_gr  = ao + ( pi / 8.0) * ( gravity / vk * tauk )**2
420             fao_gr = 20.115 * SQRT( ao_gr / lambda_re )
421             rc     = SQRT( fao_gr * ABS( st(j) - st(i) ) ) * eta   ! in cm
422
423             grfin  = ( ( eta**2 + rc**2 ) / ( rrp**2 + rc**2) )**( c1_gr*0.5 )
424             IF ( grfin < 1.0 )  grfin = 1.0
425
426             gck(i,j) = 2.0 * pi * rrp**2 * wrfin * grfin           ! in cm**3/s
427             gck(j,i) = gck(i,j)
428
429          ENDDO
430       ENDDO
431
432    END SUBROUTINE turbsd
433
434
435!------------------------------------------------------------------------------!
436! phi as a function
437!------------------------------------------------------------------------------!
438    REAL FUNCTION phi( a, b, vsett, tau0 )
439
440       IMPLICIT NONE
441
442       REAL ::  a, aa1, b, tau0, vsett
443
444       aa1 = 1.0 / tau0 + 1.0 / a + vsett / b
445       phi = 1.0 / aa1  - 0.5 * vsett / b / aa1**2  ! in s
446
447    END FUNCTION phi
448
449
450!------------------------------------------------------------------------------!
451! zeta as a function
452!------------------------------------------------------------------------------!
453    REAL FUNCTION zhi( a, b, vsett1, tau1, vsett2, tau2 )
454
455       IMPLICIT NONE
456
457       REAL ::  a, aa1, aa2, aa3, aa4, aa5, aa6, b, tau1, tau2, vsett1, vsett2
458
459       aa1 = vsett2 / b - 1.0 / tau2 - 1.0 / a
460       aa2 = vsett1 / b + 1.0 / tau1 + 1.0 / a
461       aa3 = ( vsett1 - vsett2 ) / b + 1.0 / tau1 + 1.0 / tau2
462       aa4 = ( vsett2 / b )**2 - ( 1.0 / tau2 + 1.0 / a )**2
463       aa5 = vsett2 / b + 1.0 / tau2 + 1.0 / a
464       aa6 = 1.0 / tau1 - 1.0 / a + ( 1.0 / tau2 + 1.0 / a) * vsett1 / vsett2
465       zhi = (1.0 / aa1 - 1.0 / aa2 ) * ( vsett1 - vsett2 ) * 0.5 / b / aa3**2 &
466           + (4.0 / aa4 - 1.0 / aa5**2 - 1.0 / aa1**2 ) * vsett2 * 0.5 / b /aa6&
467           + (2.0 * ( b / aa2 - b / aa1 ) - vsett1 / aa2**2 + vsett2 / aa1**2 )&
468           * 0.5 / b / aa3      ! in s**2
469
470    END FUNCTION zhi
471
472
473!------------------------------------------------------------------------------!
474! Calculation of terminal velocity winf
475!------------------------------------------------------------------------------!
476    SUBROUTINE fallg
477
478       USE constants
479       USE cloud_parameters
480       USE particle_attributes
481       USE arrays_3d
482
483       IMPLICIT NONE
484
485       INTEGER ::  i, j
486
487       LOGICAL, SAVE ::  first = .TRUE.
488
489       REAL, SAVE ::  cunh, eta, grav, phy, py, rhoa, rhow, sigma, stb, stok, &
490                      t0, xlamb
491
492       REAL ::  bond, x, xrey, y
493
494       REAL, DIMENSION(1:7), SAVE  ::  b
495       REAL, DIMENSION(1:6), SAVE  ::  c
496
497!
498!--    Initial assignment of constants
499       IF ( first )  THEN
500
501          first = .FALSE.
502          b = (/  -0.318657E1,  0.992696E0, -0.153193E-2, -0.987059E-3, &
503                 -0.578878E-3, 0.855176E-4, -0.327815E-5 /)
504          c = (/  -0.500015E1,  0.523778E1,  -0.204914E1,   0.475294E0, &
505                 -0.542819E-1, 0.238449E-2 /)
506
507          eta   = 1.818E-4          ! in poise = g/(cm s)
508          xlamb = 6.62E-6           ! in cm
509          rhow  = 1.0               ! in g/cm**3
510          rhoa  = 1.225E-3          ! in g/cm**3
511          grav  = 980.665           ! in cm/s**2
512          cunh  = 1.257 * xlamb     ! in cm
513          t0    = 273.15            ! in K
514          sigma = 76.1 - 0.155 * ( 293.15 - t0 )              ! in N/m = g/s**2
515          stok  = 2.0  * grav * ( rhow - rhoa ) / ( 9.0 * eta ) ! in 1/(cm s)
516          stb   = 32.0 * rhoa * ( rhow - rhoa) * grav / (3.0 * eta * eta)
517                                                                ! in 1/cm**3
518          phy   = sigma**3 * rhoa**2 / ( eta**4 * grav * ( rhow - rhoa ) )
519          py    = phy**( 1.0 / 6.0 )
520
521       ENDIF
522
523       DO  j = 1, radius_classes
524
525          IF ( radclass(j) <= 1.0E-3 ) THEN
526
527             winf(j) = stok * ( radclass(j)**2 + cunh * radclass(j) ) ! in cm/s
528
529          ELSEIF ( radclass(j) > 1.0E-3  .AND.  radclass(j) <= 5.35E-2 )  THEN
530
531             x = LOG( stb * radclass(j)**3 )
532             y = 0.0
533
534             DO  i = 1, 7
535                y = y + b(i) * x**(i-1)
536             ENDDO
537
538             xrey = ( 1.0 + cunh / radclass(j) ) * EXP( y )
539             winf(j) = xrey * eta / ( 2.0 * rhoa * radclass(j) )      ! in cm/s
540
541          ELSEIF ( radclass(j) > 5.35E-2 )  THEN
542
543             IF ( radclass(j) > 0.35 )  THEN
544                bond = grav * ( rhow - rhoa ) * 0.35**2 / sigma
545             ELSE
546                bond = grav * ( rhow - rhoa ) * radclass(j)**2 / sigma
547             ENDIF
548
549             x = LOG( 16.0 * bond * py / 3.0 )
550             y = 0.0
551
552             DO  i = 1, 6
553                y = y + c(i) * x**(i-1)
554             ENDDO
555
556             xrey = py * EXP( y )
557
558             IF ( radclass(j) > 0.35 )  THEN
559                winf(j) = xrey * eta / ( 2.0 * rhoa * 0.35 )           ! in cm/s
560             ELSE
561                winf(j) = xrey * eta / ( 2.0 * rhoa * radclass(j) )    ! in cm/s
562             ENDIF
563
564          ENDIF
565
566       ENDDO
567
568    END SUBROUTINE fallg
569
570
571!------------------------------------------------------------------------------!
572! Calculation of collision efficencies for the Hall kernel
573!------------------------------------------------------------------------------!
574    SUBROUTINE effic
575
576       USE arrays_3d
577       USE cloud_parameters
578       USE constants
579       USE particle_attributes
580
581       IMPLICIT NONE
582
583       INTEGER ::  i, iq, ir, j, k, kk
584
585       INTEGER, DIMENSION(:), ALLOCATABLE ::  ira
586
587       LOGICAL, SAVE ::  first = .TRUE.
588
589       REAL ::  ek, particle_radius, pp, qq, rq
590
591       REAL, DIMENSION(1:21), SAVE ::  rat
592       REAL, DIMENSION(1:15), SAVE ::  r0
593       REAL, DIMENSION(1:15,1:21), SAVE ::  ecoll
594
595!
596!--    Initial assignment of constants
597       IF ( first )  THEN
598
599         first = .FALSE.
600         r0  = (/ 6.0, 8.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60., &
601                  70.0, 100.0, 150.0, 200.0, 300.0 /)
602         rat = (/ 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, &
603                  0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, &
604                  1.00 /)
605
606         ecoll(:,1) = (/0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, &
607                        0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001/)
608         ecoll(:,2) = (/0.003, 0.003, 0.003, 0.004, 0.005, 0.005, 0.005, &
609                        0.010, 0.100, 0.050, 0.200, 0.500, 0.770, 0.870, 0.970/)
610         ecoll(:,3) = (/0.007, 0.007, 0.007, 0.008, 0.009, 0.010, 0.010, &
611                        0.070, 0.400, 0.430, 0.580, 0.790, 0.930, 0.960, 1.000/)
612         ecoll(:,4) = (/0.009, 0.009, 0.009, 0.012, 0.015, 0.010, 0.020, &
613                        0.280, 0.600, 0.640, 0.750, 0.910, 0.970, 0.980, 1.000/)
614         ecoll(:,5) = (/0.014, 0.014, 0.014, 0.015, 0.016, 0.030, 0.060, &
615                        0.500, 0.700, 0.770, 0.840, 0.950, 0.970, 1.000, 1.000/)
616         ecoll(:,6) = (/0.017, 0.017, 0.017, 0.020, 0.022, 0.060, 0.100, &
617                        0.620, 0.780, 0.840, 0.880, 0.950, 1.000, 1.000, 1.000/)
618         ecoll(:,7) = (/0.030, 0.030, 0.024, 0.022, 0.032, 0.062, 0.200, &
619                        0.680, 0.830, 0.870, 0.900, 0.950, 1.000, 1.000, 1.000/)
620         ecoll(:,8) = (/0.025, 0.025, 0.025, 0.036, 0.043, 0.130, 0.270, &
621                        0.740, 0.860, 0.890, 0.920, 1.000, 1.000, 1.000, 1.000/)
622         ecoll(:,9) = (/0.027, 0.027, 0.027, 0.040, 0.052, 0.200, 0.400, &
623                        0.780, 0.880, 0.900, 0.940, 1.000, 1.000, 1.000, 1.000/)
624         ecoll(:,10)= (/0.030, 0.030, 0.030, 0.047, 0.064, 0.250, 0.500, &
625                        0.800, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
626         ecoll(:,11)= (/0.040, 0.040, 0.033, 0.037, 0.068, 0.240, 0.550, &
627                        0.800, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
628         ecoll(:,12)= (/0.035, 0.035, 0.035, 0.055, 0.079, 0.290, 0.580, &
629                        0.800, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
630         ecoll(:,13)= (/0.037, 0.037, 0.037, 0.062, 0.082, 0.290, 0.590, &
631                        0.780, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
632         ecoll(:,14)= (/0.037, 0.037, 0.037, 0.060, 0.080, 0.290, 0.580, &
633                        0.770, 0.890, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
634         ecoll(:,15)= (/0.037, 0.037, 0.037, 0.041, 0.075, 0.250, 0.540, &
635                        0.760, 0.880, 0.920, 0.950, 1.000, 1.000, 1.000, 1.000/)
636         ecoll(:,16)= (/0.037, 0.037, 0.037, 0.052, 0.067, 0.250, 0.510, &
637                        0.770, 0.880, 0.930, 0.970, 1.000, 1.000, 1.000, 1.000/)
638         ecoll(:,17)= (/0.037, 0.037, 0.037, 0.047, 0.057, 0.250, 0.490, &
639                        0.770, 0.890, 0.950, 1.000, 1.000, 1.000, 1.000, 1.000/)
640         ecoll(:,18)= (/0.036, 0.036, 0.036, 0.042, 0.048, 0.230, 0.470, &
641                        0.780, 0.920, 1.000, 1.020, 1.020, 1.020, 1.020, 1.020/)
642         ecoll(:,19)= (/0.040, 0.040, 0.035, 0.033, 0.040, 0.112, 0.450, &
643                        0.790, 1.010, 1.030, 1.040, 1.040, 1.040, 1.040, 1.040/)
644         ecoll(:,20)= (/0.033, 0.033, 0.033, 0.033, 0.033, 0.119, 0.470, &
645                        0.950, 1.300, 1.700, 2.300, 2.300, 2.300, 2.300, 2.300/)
646         ecoll(:,21)= (/0.027, 0.027, 0.027, 0.027, 0.027, 0.125, 0.520, &
647                        1.400, 2.300, 3.000, 4.000, 4.000, 4.000, 4.000, 4.000/)
648       ENDIF
649
650!
651!--    Calculate the radius class index of particles with respect to array r
652       ALLOCATE( ira(1:radius_classes) )
653       DO  j = 1, radius_classes
654          particle_radius = radclass(j) * 1.0E4   ! in microm
655          DO  k = 1, 15
656             IF ( particle_radius < r0(k) )  THEN
657                ira(j) = k
658                EXIT
659             ENDIF
660          ENDDO
661          IF ( particle_radius >= r0(15) )  ira(j) = 16
662       ENDDO
663
664!
665!--    Two-dimensional linear interpolation of the collision efficiency.
666!--    Radius has to be in µm
667       DO  j = 1, radius_classes
668          DO  i = 1, j
669
670             ir = ira(j)
671             rq = radclass(i) / radclass(j)
672             iq = INT( rq * 20 ) + 1
673             iq = MAX( iq , 2)
674
675             IF ( ir < 16 )  THEN
676                IF ( ir >= 2 )  THEN
677                   pp = ( ( radclass(j) * 1.0E04 ) - r0(ir-1) ) / &
678                        ( r0(ir) - r0(ir-1) )
679                   qq = ( rq- rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
680                   ec(j,i) = ( 1.0-pp ) * ( 1.0-qq ) * ecoll(ir-1,iq-1)  &
681                             + pp * ( 1.0-qq ) * ecoll(ir,iq-1)          &
682                             + qq * ( 1.0-pp ) * ecoll(ir-1,iq)          &
683                             + pp * qq * ecoll(ir,iq)
684                ELSE
685                   qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
686                   ec(j,i) = (1.0-qq) * ecoll(1,iq-1) + qq * ecoll(1,iq)
687                ENDIF
688             ELSE
689                qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
690                ek = ( 1.0 - qq ) * ecoll(15,iq-1) + qq * ecoll(15,iq)
691                ec(j,i) = MIN( ek, 1.0 )
692             ENDIF
693
694             ec(i,j) = ec(j,i)
695             IF ( ec(i,j) < 1.0E-20 )  ec(i,j) = 0.0
696
697          ENDDO
698       ENDDO
699
700       DEALLOCATE( ira )
701
702    END SUBROUTINE effic
703
704
705!------------------------------------------------------------------------------!
706! Calculation of enhancement factor for collision efficencies due to turbulence
707!------------------------------------------------------------------------------!
708    SUBROUTINE turb_enhance_eff
709
710       USE constants
711       USE cloud_parameters
712       USE particle_attributes
713       USE arrays_3d
714
715       IMPLICIT NONE
716
717       INTEGER :: i, ik, iq, ir, j, k, kk
718
719       INTEGER, DIMENSION(:), ALLOCATABLE ::  ira
720
721       REAL ::  particle_radius, pp, qq, rq, x1, x2, x3, y1, y2, y3
722
723       LOGICAL, SAVE ::  first = .TRUE.
724
725       REAL, DIMENSION(1:11), SAVE ::  rat
726       REAL, DIMENSION(1:7), SAVE  ::  r0
727       REAL, DIMENSION(1:7,1:11), SAVE ::  ecoll_100, ecoll_400
728
729!
730!--    Initial assignment of constants
731       IF ( first )  THEN
732
733          first = .FALSE.
734
735          r0  = (/ 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 100.0 /)
736          rat = (/ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 /)
737!
738!--       In 100 cm^2/s^3
739          ecoll_100(:,1) = (/1.74,  1.74,  1.773, 1.49,  1.207,  1.207,  1.0 /)
740          ecoll_100(:,2) = (/1.46,  1.46,  1.421, 1.245, 1.069,  1.069,  1.0 /)
741          ecoll_100(:,3) = (/1.32,  1.32,  1.245, 1.123, 1.000,  1.000,  1.0 /)
742          ecoll_100(:,4) = (/1.250, 1.250, 1.148, 1.087, 1.025,  1.025,  1.0 /)
743          ecoll_100(:,5) = (/1.186, 1.186, 1.066, 1.060, 1.056,  1.056,  1.0 /)
744          ecoll_100(:,6) = (/1.045, 1.045, 1.000, 1.014, 1.028,  1.028,  1.0 /)
745          ecoll_100(:,7) = (/1.070, 1.070, 1.030, 1.038, 1.046,  1.046,  1.0 /)
746          ecoll_100(:,8) = (/1.000, 1.000, 1.054, 1.042, 1.029,  1.029,  1.0 /)
747          ecoll_100(:,9) = (/1.223, 1.223, 1.117, 1.069, 1.021,  1.021,  1.0 /)
748          ecoll_100(:,10)= (/1.570, 1.570, 1.244, 1.166, 1.088,  1.088,  1.0 /)
749          ecoll_100(:,11)= (/20.3,  20.3,  14.6 , 8.61,  2.60,   2.60 ,  1.0 /)
750!
751!--       In 400 cm^2/s^3
752          ecoll_400(:,1) = (/4.976, 4.976,  3.593, 2.519, 1.445,  1.445,  1.0 /)
753          ecoll_400(:,2) = (/2.984, 2.984,  2.181, 1.691, 1.201,  1.201,  1.0 /)
754          ecoll_400(:,3) = (/1.988, 1.988,  1.475, 1.313, 1.150,  1.150,  1.0 /)
755          ecoll_400(:,4) = (/1.490, 1.490,  1.187, 1.156, 1.126,  1.126,  1.0 /)
756          ecoll_400(:,5) = (/1.249, 1.249,  1.088, 1.090, 1.092,  1.092,  1.0 /)
757          ecoll_400(:,6) = (/1.139, 1.139,  1.130, 1.091, 1.051,  1.051,  1.0 /)
758          ecoll_400(:,7) = (/1.220, 1.220,  1.190, 1.138, 1.086,  1.086,  1.0 /)
759          ecoll_400(:,8) = (/1.325, 1.325,  1.267, 1.165, 1.063,  1.063,  1.0 /)
760          ecoll_400(:,9) = (/1.716, 1.716,  1.345, 1.223, 1.100,  1.100,  1.0 /)
761          ecoll_400(:,10)= (/3.788, 3.788,  1.501, 1.311, 1.120,  1.120,  1.0 /)
762          ecoll_400(:,11)= (/36.52, 36.52,  19.16, 22.80,  26.0,   26.0,  1.0 /)
763
764       ENDIF
765
766!
767!--    Calculate the radius class index of particles with respect to array r0
768       ALLOCATE( ira(1:radius_classes) )
769
770       DO  j = 1, radius_classes
771          particle_radius = radclass(j) * 1.0E4    ! in microm
772          DO  k = 1, 7
773             IF ( particle_radius < r0(k) )  THEN
774                ira(j) = k
775                EXIT
776             ENDIF
777          ENDDO
778          IF ( particle_radius >= r0(7) )  ira(j) = 8
779       ENDDO
780
781!
782!--    Two-dimensional linear interpolation of the collision efficiencies
783       DO  j =  1, radius_classes
784          DO  i = 1, j
785
786             ir = ira(j)
787             rq = radclass(i) / radclass(j)
788
789             DO  kk = 2, 11
790                IF ( rq <= rat(kk) )  THEN
791                   iq = kk
792                   EXIT
793                ENDIF
794             ENDDO
795
796             y1 = 1.0      ! 0  cm2/s3
797!
798!--          100 cm2/s3, 400 cm2/s3
799             IF ( ir < 8 )  THEN
800                IF ( ir >= 2 )  THEN
801                   pp = ( radclass(j)*1.0E4 - r0(ir-1) ) / ( r0(ir) - r0(ir-1) )
802                   qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
803                   y2 = ( 1.0-pp ) * ( 1.0-qq ) * ecoll_100(ir-1,iq-1) +  &
804                                pp * ( 1.0-qq ) * ecoll_100(ir,iq-1)   +  &
805                                qq * ( 10.-pp ) * ecoll_100(ir-1,iq)   +  &
806                                pp * qq         * ecoll_100(ir,iq)
807                   y3 = ( 1.0-pp ) * ( 1.0-qq ) * ecoll_400(ir-1,iq-1) +  &
808                                pp * ( 1.0-qq ) * ecoll_400(ir,iq-1)   +  &
809                                qq * ( 1.0-pp ) * ecoll_400(ir-1,iq)   +  &
810                                pp * qq         * ecoll_400(ir,iq)
811                ELSE
812                   qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
813                   y2 = ( 1.0-qq ) * ecoll_100(1,iq-1) + qq * ecoll_100(1,iq)
814                   y3 = ( 1.0-qq ) * ecoll_400(1,iq-1) + qq * ecoll_400(1,iq)
815                ENDIF
816             ELSE
817                qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
818                y2 = ( 1.0-qq ) * ecoll_100(7,iq-1) + qq * ecoll_100(7,iq)
819                y3 = ( 1.0-qq ) * ecoll_400(7,iq-1) + qq * ecoll_400(7,iq)
820             ENDIF
821!
822!--          Linear interpolation of dissipation rate in cm2/s3
823             IF ( epsilon <= 100.0 )  THEN
824                ecf(j,i) = ( epsilon - 100.0 ) / (   0.0 - 100.0 ) * y1 &
825                         + ( epsilon -   0.0 ) / ( 100.0 -   0.0 ) * y2
826             ELSEIF ( epsilon <= 600.0 )  THEN
827                ecf(j,i) = ( epsilon - 400.0 ) / ( 100.0 - 400.0 ) * y2 &
828                         + ( epsilon - 100.0 ) / ( 400.0 - 100.0 ) * y3
829             ELSE
830                ecf(j,i) = (   600.0 - 400.0 ) / ( 100.0 - 400.0 ) * y2 &
831                         + (   600.0 - 100.0 ) / ( 400.0 - 100.0 ) * y3
832             ENDIF
833
834             IF ( ecf(j,i) < 1.0 )  ecf(j,i) = 1.0
835
836             ecf(i,j) = ecf(j,i)
837
838          ENDDO
839       ENDDO
840
841    END SUBROUTINE turb_enhance_eff
842
843 END MODULE lpm_collision_kernels_mod
Note: See TracBrowser for help on using the repository browser.