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

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

last commit documented

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