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

Last change on this file since 1346 was 1346, checked in by heinze, 10 years ago

Bugfix: REAL constants provided with KIND-attribute especially in call of intrinsic function like MAX, MIN, SIGN

  • Property svn:keywords set to Id
File size: 41.1 KB
Line 
1 MODULE lpm_collision_kernels_mod
2
3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later 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-2014 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22! Bugfix: REAL constants provided with KIND-attribute especially in call of
23! intrinsic function like MAX, MIN, SIGN
24!
25! Former revisions:
26! -----------------
27! $Id: lpm_collision_kernels.f90 1346 2014-03-27 13:18:20Z heinze $
28!
29! 1322 2014-03-20 16:38:49Z raasch
30! REAL constants defined as wp_kind
31!
32! 1320 2014-03-20 08:40:49Z
33! ONLY-attribute added to USE-statements,
34! kind-parameters added to all INTEGER and REAL declaration statements,
35! kinds are defined in new module kinds,
36! revision history before 2012 removed,
37! comment fields (!:) to be used for variable explanations added to
38! all variable declaration statements
39!
40! 1092 2013-02-02 11:24:22Z raasch
41! unused variables removed
42!
43! 1071 2012-11-29 16:54:55Z franke
44! Bugfix: collision efficiencies for Hall kernel should not be < 1.0E-20
45!
46! 1036 2012-10-22 13:43:42Z raasch
47! code put under GPL (PALM 3.9)
48!
49! 1007 2012-09-19 14:30:36Z franke
50! converted all units to SI units and replaced some parameters by corresponding
51! PALM parameters
52! Bugfix: factor in calculation of enhancement factor for collision efficencies
53! changed from 10. to 1.0
54!
55! 849 2012-03-15 10:35:09Z raasch
56! routine collision_efficiency_rogers added (moved from former advec_particles
57! to here)
58!
59! 835 2012-02-22 11:21:19Z raasch $
60! Bugfix: array diss can be used only in case of Wang kernel
61!
62! 828 2012-02-21 12:00:36Z raasch
63! code has been completely reformatted, routine colker renamed
64! recalculate_kernel,
65! routine init_kernels added, radius is now communicated to the collision
66! routines by array radclass
67!
68! Bugfix: transformation factor for dissipation changed from 1E5 to 1E4
69!
70! 825 2012-02-19 03:03:44Z raasch
71! routine renamed from wang_kernel to lpm_collision_kernels,
72! turbulence_effects on collision replaced by wang_kernel
73!
74! 790 2011-11-29 03:11:20Z raasch
75! initial revision
76!
77! Description:
78! ------------
79! This module calculates collision efficiencies either due to pure gravitational
80! effects (Hall kernel, see Hall, 1980: J. Atmos. Sci., 2486-2507) or
81! including the effects of (SGS) turbulence (Wang kernel, see Wang and
82! Grabowski, 2009: Atmos. Sci. Lett., 10, 1-8). The original code has been
83! provided by L.-P. Wang but is substantially reformatted and speed optimized
84! here.
85!
86! ATTENTION:
87! Physical quantities (like g, densities, etc.) used in this module still
88! have to be adjusted to those values used in the main PALM code.
89! Also, quantities in CGS-units should be converted to SI-units eventually.
90!------------------------------------------------------------------------------!
91
92    USE constants,                                                             &
93        ONLY:  pi
94       
95    USE kinds
96
97    USE particle_attributes,                                                   &
98        ONLY:  collision_kernel, dissipation_classes, particles, radius_classes
99
100    USE pegrid
101
102
103    IMPLICIT NONE
104
105    PRIVATE
106
107    PUBLIC  ckernel, collision_efficiency_rogers, init_kernels, &
108            rclass_lbound, rclass_ubound, recalculate_kernel
109
110    REAL(wp) ::  epsilon       !:
111    REAL(wp) ::  eps2          !:
112    REAL(wp) ::  rclass_lbound !:
113    REAL(wp) ::  rclass_ubound !:
114    REAL(wp) ::  urms          !:
115    REAL(wp) ::  urms2         !:
116
117    REAL(wp), DIMENSION(:),   ALLOCATABLE ::  epsclass !:
118    REAL(wp), DIMENSION(:),   ALLOCATABLE ::  radclass !:
119    REAL(wp), DIMENSION(:),   ALLOCATABLE ::  winf     !:
120   
121    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ec       !:
122    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ecf      !:
123    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  gck      !:
124    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  hkernel  !:
125    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  hwratio  !:
126   
127    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  ckernel !:
128
129    SAVE
130
131!
132!-- Public interfaces
133    INTERFACE collision_efficiency_rogers
134       MODULE PROCEDURE collision_efficiency_rogers
135    END INTERFACE collision_efficiency_rogers
136
137    INTERFACE init_kernels
138       MODULE PROCEDURE init_kernels
139    END INTERFACE init_kernels
140
141    INTERFACE recalculate_kernel
142       MODULE PROCEDURE recalculate_kernel
143    END INTERFACE recalculate_kernel
144
145
146    CONTAINS
147
148
149    SUBROUTINE init_kernels
150!------------------------------------------------------------------------------!
151! Initialization of the collision efficiency matrix with fixed radius and
152! dissipation classes, calculated at simulation start only.
153!------------------------------------------------------------------------------!
154
155       IMPLICIT NONE
156
157       INTEGER(iwp) ::  i !:
158       INTEGER(iwp) ::  j !:
159       INTEGER(iwp) ::  k !:
160
161
162!
163!--    Calculate collision efficiencies for fixed radius- and dissipation
164!--    classes
165       IF ( collision_kernel(6:9) == 'fast' )  THEN
166
167          ALLOCATE( ckernel(1:radius_classes,1:radius_classes,               &
168                    0:dissipation_classes), epsclass(1:dissipation_classes), &
169                    radclass(1:radius_classes) )
170
171!
172!--       Calculate the radius class bounds with logarithmic distances
173!--       in the interval [1.0E-6, 2.0E-4] m
174          rclass_lbound = LOG( 1.0E-6_wp )
175          rclass_ubound = LOG( 2.0E-4_wp )
176          radclass(1)   = 1.0E-6
177          DO  i = 2, radius_classes
178             radclass(i) = EXP( rclass_lbound +                                &
179                                ( rclass_ubound - rclass_lbound ) * ( i-1.0 ) /&
180                                ( radius_classes - 1.0 ) )
181!             IF ( myid == 0 )  THEN
182!                PRINT*, 'i=', i, ' r = ', radclass(i)*1.0E6
183!             ENDIF
184          ENDDO
185
186!
187!--       Set the class bounds for dissipation in interval [0.0, 0.1] m**2/s**3
188          DO  i = 1, dissipation_classes
189             epsclass(i) = 0.1 * REAL( i, KIND=wp ) / dissipation_classes
190!             IF ( myid == 0 )  THEN
191!                PRINT*, 'i=', i, ' eps = ', epsclass(i)
192!             ENDIF
193          ENDDO
194!
195!--       Calculate collision efficiencies of the Wang/ayala kernel
196          ALLOCATE( ec(1:radius_classes,1:radius_classes),  &
197                    ecf(1:radius_classes,1:radius_classes), &
198                    gck(1:radius_classes,1:radius_classes), &
199                    winf(1:radius_classes) )
200
201          DO  k = 1, dissipation_classes
202
203             epsilon = epsclass(k)
204             urms    = 2.02 * ( epsilon / 0.04_wp )**( 1.0_wp / 3.0_wp )
205
206             CALL turbsd
207             CALL turb_enhance_eff
208             CALL effic
209
210             DO  j = 1, radius_classes
211                DO  i = 1, radius_classes
212                   ckernel(i,j,k) = ec(i,j) * gck(i,j) * ecf(i,j)
213                ENDDO
214             ENDDO
215
216          ENDDO
217
218!
219!--       Calculate collision efficiencies of the Hall kernel
220          ALLOCATE( hkernel(1:radius_classes,1:radius_classes), &
221                    hwratio(1:radius_classes,1:radius_classes) )
222
223          CALL fallg
224          CALL effic
225
226          DO  j = 1, radius_classes
227             DO  i =  1, radius_classes
228                hkernel(i,j) = pi * ( radclass(j) + radclass(i) )**2 &
229                                  * ec(i,j) * ABS( winf(j) - winf(i) )
230                ckernel(i,j,0) = hkernel(i,j)  ! hall kernel stored on index 0
231              ENDDO
232          ENDDO
233
234!
235!--       Test output of efficiencies
236          IF ( j == -1 )  THEN
237
238             PRINT*, '*** Hall kernel'
239             WRITE ( *,'(5X,20(F4.0,1X))' ) ( radclass(i)*1.0E6, &
240                                              i = 1,radius_classes )
241             DO  j = 1, radius_classes
242                WRITE ( *,'(F4.0,1X,20(F8.4,1X))' ) radclass(j),  &
243                                          ( hkernel(i,j), i = 1,radius_classes )
244             ENDDO
245
246             DO  k = 1, dissipation_classes
247                DO  i = 1, radius_classes
248                   DO  j = 1, radius_classes
249                      IF ( hkernel(i,j) == 0.0 )  THEN
250                         hwratio(i,j) = 9999999.9
251                      ELSE
252                         hwratio(i,j) = ckernel(i,j,k) / hkernel(i,j)
253                      ENDIF
254                   ENDDO
255                ENDDO
256
257                PRINT*, '*** epsilon = ', epsclass(k)
258                WRITE ( *,'(5X,20(F4.0,1X))' ) ( radclass(i)*1.0E6, &
259                                                 i = 1,radius_classes )
260                DO  j = 1, radius_classes
261!                   WRITE ( *,'(F4.0,1X,20(F4.2,1X))' ) radclass(j)*1.0E6, &
262!                                       ( ckernel(i,j,k), i = 1,radius_classes )
263                   WRITE ( *,'(F4.0,1X,20(F8.4,1X))' ) radclass(j)*1.0E6, &
264                                          ( hwratio(i,j), i = 1,radius_classes )
265                ENDDO
266             ENDDO
267
268          ENDIF
269
270          DEALLOCATE( ec, ecf, epsclass, gck, hkernel, winf )
271
272       ELSEIF( collision_kernel == 'hall'  .OR.  collision_kernel == 'wang' ) &
273       THEN
274!
275!--       Initial settings for Hall- and Wang-Kernel
276!--       To be done: move here parts from turbsd, fallg, ecoll, etc.
277       ENDIF
278
279    END SUBROUTINE init_kernels
280
281
282!------------------------------------------------------------------------------!
283! Calculation of collision kernels during each timestep and for each grid box
284!------------------------------------------------------------------------------!
285    SUBROUTINE recalculate_kernel( i1, j1, k1 )
286
287       USE arrays_3d,                                                          &
288           ONLY:  diss
289
290       USE particle_attributes,                                                &
291           ONLY:  prt_count, prt_start_index, radius_classes, wang_kernel
292
293       IMPLICIT NONE
294
295       INTEGER(iwp) ::  i      !:
296       INTEGER(iwp) ::  i1     !:
297       INTEGER(iwp) ::  j      !:
298       INTEGER(iwp) ::  j1     !:
299       INTEGER(iwp) ::  k1     !:
300       INTEGER(iwp) ::  pend   !:
301       INTEGER(iwp) ::  pstart !:
302
303
304       pstart = prt_start_index(k1,j1,i1)
305       pend   = prt_start_index(k1,j1,i1) + prt_count(k1,j1,i1) - 1
306       radius_classes = prt_count(k1,j1,i1)
307
308       ALLOCATE( ec(1:radius_classes,1:radius_classes), &
309                 radclass(1:radius_classes), winf(1:radius_classes) )
310
311!
312!--    Store particle radii on the radclass array
313       radclass(1:radius_classes) = particles(pstart:pend)%radius
314
315       IF ( wang_kernel )  THEN
316          epsilon = diss(k1,j1,i1)   ! dissipation rate in m**2/s**3
317       ELSE
318          epsilon = 0.0
319       ENDIF
320       urms    = 2.02 * ( epsilon / 0.04_wp )**( 0.33333333333_wp )
321
322       IF ( wang_kernel  .AND.  epsilon > 1.0E-7 )  THEN
323!
324!--       Call routines to calculate efficiencies for the Wang kernel
325          ALLOCATE( gck(1:radius_classes,1:radius_classes), &
326                    ecf(1:radius_classes,1:radius_classes) )
327
328          CALL turbsd
329          CALL turb_enhance_eff
330          CALL effic
331
332          DO  j = 1, radius_classes
333             DO  i =  1, radius_classes
334                ckernel(pstart+i-1,pstart+j-1,1) = ec(i,j) * gck(i,j) * ecf(i,j)
335             ENDDO
336          ENDDO
337
338          DEALLOCATE( gck, ecf )
339
340       ELSE
341!
342!--       Call routines to calculate efficiencies for the Hall kernel
343          CALL fallg
344          CALL effic
345
346          DO  j = 1, radius_classes
347             DO  i =  1, radius_classes
348                ckernel(pstart+i-1,pstart+j-1,1) = pi *                       &
349                                          ( radclass(j) + radclass(i) )**2    &
350                                          * ec(i,j) * ABS( winf(j) - winf(i) )
351             ENDDO
352          ENDDO
353
354       ENDIF
355
356       DEALLOCATE( ec, radclass, winf )
357
358    END SUBROUTINE recalculate_kernel
359
360
361!------------------------------------------------------------------------------!
362! Calculation of gck
363! This is from Aayala 2008b, page 37ff.
364! Necessary input parameters: water density, radii of droplets, air density,
365! air viscosity, turbulent dissipation rate, taylor microscale reynolds number,
366! gravitational acceleration  --> to be replaced by PALM parameters
367!------------------------------------------------------------------------------!
368    SUBROUTINE turbsd
369
370       USE control_parameters,                                                 &
371           ONLY:  g, molecular_viscosity
372   
373       USE particle_attributes,                                                &
374           ONLY:  radius_classes
375
376       IMPLICIT NONE
377       
378       LOGICAL, SAVE ::  first = .TRUE. !:
379
380       INTEGER(iwp) ::  i     !:
381       INTEGER(iwp) ::  j     !:
382
383       REAL(wp) ::  ao        !:
384       REAL(wp) ::  ao_gr     !:
385       REAL(wp) ::  bbb       !:
386       REAL(wp) ::  be        !:
387       REAL(wp) ::  b1        !:
388       REAL(wp) ::  b2        !:
389       REAL(wp) ::  ccc       !:
390       REAL(wp) ::  c1        !:
391       REAL(wp) ::  c1_gr     !:
392       REAL(wp) ::  c2        !:
393       REAL(wp) ::  d1        !:
394       REAL(wp) ::  d2        !:
395       REAL(wp) ::  eta       !:
396       REAL(wp) ::  e1        !:
397       REAL(wp) ::  e2        !:
398       REAL(wp) ::  fao_gr    !:
399       REAL(wp) ::  fr        !:
400       REAL(wp) ::  grfin     !:
401       REAL(wp) ::  lambda    !:
402       REAL(wp) ::  lambda_re !:
403       REAL(wp) ::  lf        !:
404       REAL(wp) ::  rc        !:
405       REAL(wp) ::  rrp       !:
406       REAL(wp) ::  sst       !:
407       REAL(wp) ::  tauk      !:
408       REAL(wp) ::  tl        !:
409       REAL(wp) ::  t2        !:
410       REAL(wp) ::  tt        !:
411       REAL(wp) ::  t1        !:
412       REAL(wp) ::  vk        !:
413       REAL(wp) ::  vrms1xy   !:
414       REAL(wp) ::  vrms2xy   !:
415       REAL(wp) ::  v1        !:
416       REAL(wp) ::  v1v2xy    !:
417       REAL(wp) ::  v1xysq    !:
418       REAL(wp) ::  v2        !:
419       REAL(wp) ::  v2xysq    !:
420       REAL(wp) ::  wrfin     !:
421       REAL(wp) ::  wrgrav2   !:
422       REAL(wp) ::  wrtur2xy  !:
423       REAL(wp) ::  xx        !:
424       REAL(wp) ::  yy        !:
425       REAL(wp) ::  z         !:
426
427       REAL(wp), DIMENSION(1:radius_classes) ::  st  !:
428       REAL(wp), DIMENSION(1:radius_classes) ::  tau !:
429       
430!
431!--    Initial assignment of constants
432       IF ( first )  THEN
433
434          first = .FALSE.
435
436       ENDIF
437
438       lambda    = urms * SQRT( 15.0_wp * molecular_viscosity / epsilon ) ! in m
439       lambda_re = urms**2 * SQRT( 15.0_wp / epsilon / molecular_viscosity )
440       tl        = urms**2 / epsilon                       ! in s
441       lf        = 0.5 * urms**3 / epsilon                 ! in m
442       tauk      = SQRT( molecular_viscosity / epsilon )                  ! in s
443       eta       = ( molecular_viscosity**3 / epsilon )**0.25_wp          ! in m
444       vk        = eta / tauk
445
446       ao = ( 11.0 + 7.0 * lambda_re ) / ( 205.0 + lambda_re )
447       tt = SQRT( 2.0 * lambda_re / ( SQRT( 15.0_wp ) * ao ) ) * tauk   ! in s
448
449       CALL fallg    ! gives winf in m/s
450
451       DO  i = 1, radius_classes
452          tau(i) = winf(i) / g    ! in s
453          st(i)  = tau(i) / tauk
454       ENDDO
455
456!
457!--    Calculate wr (from Aayala 2008b, page 38f)
458       z   = tt / tl
459       be  = SQRT( 2.0_wp ) * lambda / lf
460       bbb = SQRT( 1.0 - 2.0 * be**2 )
461       d1  = ( 1.0 + bbb ) / ( 2.0 * bbb )
462       e1  = lf * ( 1.0 + bbb ) * 0.5   ! in m
463       d2  = ( 1.0 - bbb ) * 0.5 / bbb
464       e2  = lf * ( 1.0 - bbb ) * 0.5   ! in m
465       ccc = SQRT( 1.0 - 2.0 * z**2 )
466       b1  = ( 1.0 + ccc ) * 0.5 / ccc
467       c1  = tl * ( 1.0 + ccc ) * 0.5   ! in s
468       b2  = ( 1.0 - ccc ) * 0.5 / ccc
469       c2  = tl * ( 1.0 - ccc ) * 0.5   ! in s
470
471       DO  i = 1, radius_classes
472
473          v1 = winf(i)        ! in m/s
474          t1 = tau(i)         ! in s
475
476          DO  j = 1, i
477             rrp = radclass(i) + radclass(j)
478             v2  = winf(j)                                 ! in m/s
479             t2  = tau(j)                                  ! in s
480
481             v1xysq  = b1 * d1 * phi_w(c1,e1,v1,t1) - b1 * d2 * phi_w(c1,e2,v1,t1) &
482                     - b2 * d1 * phi_w(c2,e1,v1,t1) + b2 * d2 * phi_w(c2,e2,v1,t1)
483             v1xysq  = v1xysq * urms**2 / t1                ! in m**2/s**2
484             vrms1xy = SQRT( v1xysq )                       ! in m/s
485
486             v2xysq  = b1 * d1 * phi_w(c1,e1,v2,t2) - b1 * d2 * phi_w(c1,e2,v2,t2) &
487                     - b2 * d1 * phi_w(c2,e1,v2,t2) + b2 * d2 * phi_w(c2,e2,v2,t2)
488             v2xysq  = v2xysq * urms**2 / t2                ! in m**2/s**2
489             vrms2xy = SQRT( v2xysq )                       ! in m/s
490
491             IF ( winf(i) >= winf(j) )  THEN
492                v1 = winf(i)
493                t1 = tau(i)
494                v2 = winf(j)
495                t2 = tau(j)
496             ELSE
497                v1 = winf(j)
498                t1 = tau(j)
499                v2 = winf(i)
500                t2 = tau(i)
501             ENDIF
502
503             v1v2xy   =  b1 * d1 * zhi(c1,e1,v1,t1,v2,t2) - &
504                         b1 * d2 * zhi(c1,e2,v1,t1,v2,t2) - &
505                         b2 * d1 * zhi(c2,e1,v1,t1,v2,t2) + &
506                         b2 * d2* zhi(c2,e2,v1,t1,v2,t2)
507             fr       = d1 * EXP( -rrp / e1 ) - d2 * EXP( -rrp / e2 )
508             v1v2xy   = v1v2xy * fr * urms**2 / tau(i) / tau(j)  ! in m**2/s**2
509             wrtur2xy = vrms1xy**2 + vrms2xy**2 - 2.0 * v1v2xy   ! in m**2/s**2
510             IF ( wrtur2xy < 0.0 )  wrtur2xy = 0.0
511             wrgrav2  = pi / 8.0_wp * ( winf(j) - winf(i) )**2
512             wrfin    = SQRT( ( 2.0_wp / pi ) * ( wrtur2xy + wrgrav2) ) ! in m/s
513
514!
515!--          Calculate gr
516             IF ( st(j) > st(i) )  THEN
517                sst = st(j)
518             ELSE
519                sst = st(i)
520             ENDIF
521
522             xx = -0.1988 * sst**4 + 1.5275 * sst**3 - 4.2942 * sst**2 + &
523                   5.3406 * sst
524             IF ( xx < 0.0 )  xx = 0.0
525             yy = 0.1886 * EXP( 20.306_wp / lambda_re )
526
527             c1_gr  =  xx / ( g / vk * tauk )**yy
528
529             ao_gr  = ao + ( pi / 8.0_wp) * ( g / vk * tauk )**2
530             fao_gr = 20.115 * SQRT( ao_gr / lambda_re )
531             rc     = SQRT( fao_gr * ABS( st(j) - st(i) ) ) * eta   ! in cm
532
533             grfin  = ( ( eta**2 + rc**2 ) / ( rrp**2 + rc**2) )**( c1_gr*0.5 )
534             IF ( grfin < 1.0 )  grfin = 1.0
535
536             gck(i,j) = 2.0 * pi * rrp**2 * wrfin * grfin           ! in cm**3/s
537             gck(j,i) = gck(i,j)
538
539          ENDDO
540       ENDDO
541
542    END SUBROUTINE turbsd
543
544
545!------------------------------------------------------------------------------!
546! phi_w as a function
547!------------------------------------------------------------------------------!
548    REAL(wp) FUNCTION phi_w( a, b, vsett, tau0 )
549
550       IMPLICIT NONE
551
552       REAL(wp) ::  a     !:
553       REAL(wp) ::  aa1   !:
554       REAL(wp) ::  b     !:
555       REAL(wp) ::  tau0  !:
556       REAL(wp) ::  vsett !:
557
558       aa1 = 1.0 / tau0 + 1.0 / a + vsett / b
559       phi_w = 1.0 / aa1  - 0.5 * vsett / b / aa1**2  ! in s
560
561    END FUNCTION phi_w
562
563
564!------------------------------------------------------------------------------!
565! zhi as a function
566!------------------------------------------------------------------------------!
567    REAL(wp) FUNCTION zhi( a, b, vsett1, tau1, vsett2, tau2 )
568
569       IMPLICIT NONE
570
571       REAL(wp) ::  a      !:
572       REAL(wp) ::  aa1    !:
573       REAL(wp) ::  aa2    !:
574       REAL(wp) ::  aa3    !:
575       REAL(wp) ::  aa4    !:
576       REAL(wp) ::  aa5    !:
577       REAL(wp) ::  aa6    !:
578       REAL(wp) ::  b      !:
579       REAL(wp) ::  tau1   !:
580       REAL(wp) ::  tau2   !:
581       REAL(wp) ::  vsett1 !:
582       REAL(wp) ::  vsett2 !:
583
584       aa1 = vsett2 / b - 1.0 / tau2 - 1.0 / a
585       aa2 = vsett1 / b + 1.0 / tau1 + 1.0 / a
586       aa3 = ( vsett1 - vsett2 ) / b + 1.0 / tau1 + 1.0 / tau2
587       aa4 = ( vsett2 / b )**2 - ( 1.0 / tau2 + 1.0 / a )**2
588       aa5 = vsett2 / b + 1.0 / tau2 + 1.0 / a
589       aa6 = 1.0 / tau1 - 1.0 / a + ( 1.0 / tau2 + 1.0 / a) * vsett1 / vsett2
590       zhi = (1.0 / aa1 - 1.0 / aa2 ) * ( vsett1 - vsett2 ) * 0.5 / b / aa3**2 &
591           + (4.0 / aa4 - 1.0 / aa5**2 - 1.0 / aa1**2 ) * vsett2 * 0.5 / b /aa6&
592           + (2.0 * ( b / aa2 - b / aa1 ) - vsett1 / aa2**2 + vsett2 / aa1**2 )&
593           * 0.5 / b / aa3      ! in s**2
594
595    END FUNCTION zhi
596
597
598!------------------------------------------------------------------------------!
599! Calculation of terminal velocity winf following Equations 10-138 to 10-145
600! from (Pruppacher and Klett, 1997)
601!------------------------------------------------------------------------------!
602    SUBROUTINE fallg
603 
604       USE cloud_parameters,                                                   &
605           ONLY:  rho_l
606   
607       USE control_parameters,                                                 &
608           ONLY:  g
609
610       USE particle_attributes,                                                &
611           ONLY:  radius_classes
612
613
614       IMPLICIT NONE
615
616       INTEGER(iwp) ::  i !:
617       INTEGER(iwp) ::  j !:
618
619       LOGICAL, SAVE ::  first = .TRUE. !:
620
621       REAL(wp), SAVE ::  cunh  !:
622       REAL(wp), SAVE ::  eta   !:
623       REAL(wp), SAVE ::  phy   !:
624       REAL(wp), SAVE ::  py    !:
625       REAL(wp), SAVE ::  rho_a !:
626       REAL(wp), SAVE ::  sigma !:
627       REAL(wp), SAVE ::  stb   !:
628       REAL(wp), SAVE ::  stok  !:
629       REAL(wp), SAVE ::  xlamb !:
630
631       REAL(wp) ::  bond        !:
632       REAL(wp) ::  x           !:
633       REAL(wp) ::  xrey        !:
634       REAL(wp) ::  y           !:
635
636       REAL(wp), DIMENSION(1:7), SAVE  ::  b !:
637       REAL(wp), DIMENSION(1:6), SAVE  ::  c !:
638
639!
640!--    Initial assignment of constants
641       IF ( first )  THEN
642
643          first = .FALSE.
644          b = (/  -0.318657E1,  0.992696E0, -0.153193E-2, -0.987059E-3, &
645                 -0.578878E-3, 0.855176E-4, -0.327815E-5 /)
646          c = (/  -0.500015E1,  0.523778E1,  -0.204914E1,   0.475294E0, &
647                 -0.542819E-1, 0.238449E-2 /)
648
649!
650!--       Parameter values for p = 1013,25 hPa and T = 293,15 K
651          eta   = 1.818E-5         ! in kg/(m s)
652          xlamb = 6.6E-8           ! in m
653          rho_a = 1.204            ! in kg/m**3
654          cunh  = 1.26 * xlamb     ! in m
655          sigma = 0.07363          ! in kg/s**2
656          stok  = 2.0  * g * ( rho_l - rho_a ) / ( 9.0 * eta ) ! in 1/(m s)
657          stb   = 32.0 * rho_a * ( rho_l - rho_a) * g / (3.0 * eta * eta)
658          phy   = sigma**3 * rho_a**2 / ( eta**4 * g * ( rho_l - rho_a ) )
659          py    = phy**( 1.0_wp / 6.0_wp )
660
661       ENDIF
662
663       DO  j = 1, radius_classes
664
665          IF ( radclass(j) <= 1.0E-5 ) THEN
666
667             winf(j) = stok * ( radclass(j)**2 + cunh * radclass(j) )
668
669          ELSEIF ( radclass(j) > 1.0E-5  .AND.  radclass(j) <= 5.35E-4 )  THEN
670
671             x = LOG( stb * radclass(j)**3 )
672             y = 0.0
673
674             DO  i = 1, 7
675                y = y + b(i) * x**(i-1)
676             ENDDO
677!
678!--          Note: this Eq. is wrong in (Pruppacher and Klett, 1997, p. 418)
679!--          for correct version see (Beard, 1976)
680             xrey = ( 1.0 + cunh / radclass(j) ) * EXP( y ) 
681
682             winf(j) = xrey * eta / ( 2.0 * rho_a * radclass(j) )
683
684          ELSEIF ( radclass(j) > 5.35E-4 )  THEN
685
686             IF ( radclass(j) > 0.0035 )  THEN
687                bond = g * ( rho_l - rho_a ) * 0.0035**2 / sigma
688             ELSE
689               bond = g * ( rho_l - rho_a ) * radclass(j)**2 / sigma
690             ENDIF
691
692             x = LOG( 16.0 * bond * py / 3.0_wp )
693             y = 0.0
694
695             DO  i = 1, 6
696                y = y + c(i) * x**(i-1)
697             ENDDO
698
699             xrey = py * EXP( y )
700
701             IF ( radclass(j) > 0.0035 )  THEN
702                winf(j) = xrey * eta / ( 2.0 * rho_a * 0.0035_wp )
703             ELSE
704                winf(j) = xrey * eta / ( 2.0 * rho_a * radclass(j) )
705             ENDIF
706
707          ENDIF
708
709       ENDDO
710
711    END SUBROUTINE fallg
712
713
714!------------------------------------------------------------------------------!
715! Calculation of collision efficiencies for the Hall kernel
716!------------------------------------------------------------------------------!
717    SUBROUTINE effic
718 
719       USE particle_attributes,                                                &
720           ONLY:  radius_classes
721
722       IMPLICIT NONE
723
724       INTEGER(iwp) ::  i  !:
725       INTEGER(iwp) ::  iq !:
726       INTEGER(iwp) ::  ir !:
727       INTEGER(iwp) ::  j  !:
728       INTEGER(iwp) ::  k  !:
729
730       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ira !:
731
732       LOGICAL, SAVE ::  first = .TRUE. !:
733
734       REAL(wp) ::  ek              !:
735       REAL(wp) ::  particle_radius !:
736       REAL(wp) ::  pp              !:
737       REAL(wp) ::  qq              !:
738       REAL(wp) ::  rq              !:
739
740       REAL(wp), DIMENSION(1:21), SAVE ::  rat        !:
741       
742       REAL(wp), DIMENSION(1:15), SAVE ::  r0         !:
743       
744       REAL(wp), DIMENSION(1:15,1:21), SAVE ::  ecoll !:
745
746!
747!--    Initial assignment of constants
748       IF ( first )  THEN
749
750         first = .FALSE.
751         r0  = (/ 6.0, 8.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60., &
752                  70.0, 100.0, 150.0, 200.0, 300.0 /)
753         rat = (/ 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, &
754                  0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, &
755                  1.00 /)
756
757         ecoll(:,1) = (/0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, &
758                        0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001/)
759         ecoll(:,2) = (/0.003, 0.003, 0.003, 0.004, 0.005, 0.005, 0.005, &
760                        0.010, 0.100, 0.050, 0.200, 0.500, 0.770, 0.870, 0.970/)
761         ecoll(:,3) = (/0.007, 0.007, 0.007, 0.008, 0.009, 0.010, 0.010, &
762                        0.070, 0.400, 0.430, 0.580, 0.790, 0.930, 0.960, 1.000/)
763         ecoll(:,4) = (/0.009, 0.009, 0.009, 0.012, 0.015, 0.010, 0.020, &
764                        0.280, 0.600, 0.640, 0.750, 0.910, 0.970, 0.980, 1.000/)
765         ecoll(:,5) = (/0.014, 0.014, 0.014, 0.015, 0.016, 0.030, 0.060, &
766                        0.500, 0.700, 0.770, 0.840, 0.950, 0.970, 1.000, 1.000/)
767         ecoll(:,6) = (/0.017, 0.017, 0.017, 0.020, 0.022, 0.060, 0.100, &
768                        0.620, 0.780, 0.840, 0.880, 0.950, 1.000, 1.000, 1.000/)
769         ecoll(:,7) = (/0.030, 0.030, 0.024, 0.022, 0.032, 0.062, 0.200, &
770                        0.680, 0.830, 0.870, 0.900, 0.950, 1.000, 1.000, 1.000/)
771         ecoll(:,8) = (/0.025, 0.025, 0.025, 0.036, 0.043, 0.130, 0.270, &
772                        0.740, 0.860, 0.890, 0.920, 1.000, 1.000, 1.000, 1.000/)
773         ecoll(:,9) = (/0.027, 0.027, 0.027, 0.040, 0.052, 0.200, 0.400, &
774                        0.780, 0.880, 0.900, 0.940, 1.000, 1.000, 1.000, 1.000/)
775         ecoll(:,10)= (/0.030, 0.030, 0.030, 0.047, 0.064, 0.250, 0.500, &
776                        0.800, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
777         ecoll(:,11)= (/0.040, 0.040, 0.033, 0.037, 0.068, 0.240, 0.550, &
778                        0.800, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
779         ecoll(:,12)= (/0.035, 0.035, 0.035, 0.055, 0.079, 0.290, 0.580, &
780                        0.800, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
781         ecoll(:,13)= (/0.037, 0.037, 0.037, 0.062, 0.082, 0.290, 0.590, &
782                        0.780, 0.900, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
783         ecoll(:,14)= (/0.037, 0.037, 0.037, 0.060, 0.080, 0.290, 0.580, &
784                        0.770, 0.890, 0.910, 0.950, 1.000, 1.000, 1.000, 1.000/)
785         ecoll(:,15)= (/0.037, 0.037, 0.037, 0.041, 0.075, 0.250, 0.540, &
786                        0.760, 0.880, 0.920, 0.950, 1.000, 1.000, 1.000, 1.000/)
787         ecoll(:,16)= (/0.037, 0.037, 0.037, 0.052, 0.067, 0.250, 0.510, &
788                        0.770, 0.880, 0.930, 0.970, 1.000, 1.000, 1.000, 1.000/)
789         ecoll(:,17)= (/0.037, 0.037, 0.037, 0.047, 0.057, 0.250, 0.490, &
790                        0.770, 0.890, 0.950, 1.000, 1.000, 1.000, 1.000, 1.000/)
791         ecoll(:,18)= (/0.036, 0.036, 0.036, 0.042, 0.048, 0.230, 0.470, &
792                        0.780, 0.920, 1.000, 1.020, 1.020, 1.020, 1.020, 1.020/)
793         ecoll(:,19)= (/0.040, 0.040, 0.035, 0.033, 0.040, 0.112, 0.450, &
794                        0.790, 1.010, 1.030, 1.040, 1.040, 1.040, 1.040, 1.040/)
795         ecoll(:,20)= (/0.033, 0.033, 0.033, 0.033, 0.033, 0.119, 0.470, &
796                        0.950, 1.300, 1.700, 2.300, 2.300, 2.300, 2.300, 2.300/)
797         ecoll(:,21)= (/0.027, 0.027, 0.027, 0.027, 0.027, 0.125, 0.520, &
798                        1.400, 2.300, 3.000, 4.000, 4.000, 4.000, 4.000, 4.000/)
799       ENDIF
800
801!
802!--    Calculate the radius class index of particles with respect to array r
803!--    Radius has to be in µm
804       ALLOCATE( ira(1:radius_classes) )
805       DO  j = 1, radius_classes
806          particle_radius = radclass(j) * 1.0E6_wp
807          DO  k = 1, 15
808             IF ( particle_radius < r0(k) )  THEN
809                ira(j) = k
810                EXIT
811             ENDIF
812          ENDDO
813          IF ( particle_radius >= r0(15) )  ira(j) = 16
814       ENDDO
815
816!
817!--    Two-dimensional linear interpolation of the collision efficiency.
818!--    Radius has to be in µm
819       DO  j = 1, radius_classes
820          DO  i = 1, j
821
822             ir = ira(j)
823             rq = radclass(i) / radclass(j)
824             iq = INT( rq * 20 ) + 1
825             iq = MAX( iq , 2)
826
827             IF ( ir < 16 )  THEN
828                IF ( ir >= 2 )  THEN
829                   pp = ( ( radclass(j) * 1.0E06_wp ) - r0(ir-1) ) / &
830                        ( r0(ir) - r0(ir-1) )
831                   qq = ( rq- rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
832                   ec(j,i) = ( 1.0-pp ) * ( 1.0-qq ) * ecoll(ir-1,iq-1)  &
833                             + pp * ( 1.0-qq ) * ecoll(ir,iq-1)          &
834                             + qq * ( 1.0-pp ) * ecoll(ir-1,iq)          &
835                             + pp * qq * ecoll(ir,iq)
836                ELSE
837                   qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
838                   ec(j,i) = (1.0-qq) * ecoll(1,iq-1) + qq * ecoll(1,iq)
839                ENDIF
840             ELSE
841                qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
842                ek = ( 1.0 - qq ) * ecoll(15,iq-1) + qq * ecoll(15,iq)
843                ec(j,i) = MIN( ek, 1.0_wp )
844             ENDIF
845
846             IF ( ec(j,i) < 1.0E-20 )  ec(j,i) = 0.0
847
848             ec(i,j) = ec(j,i)
849
850          ENDDO
851       ENDDO
852
853       DEALLOCATE( ira )
854
855    END SUBROUTINE effic
856
857
858!------------------------------------------------------------------------------!
859! Calculation of enhancement factor for collision efficencies due to turbulence
860!------------------------------------------------------------------------------!
861    SUBROUTINE turb_enhance_eff
862
863       USE particle_attributes,                                                &
864           ONLY:  radius_classes
865
866       IMPLICIT NONE
867
868       INTEGER(iwp) :: i  !:
869       INTEGER(iwp) :: iq !:
870       INTEGER(iwp) :: ir !:
871       INTEGER(iwp) :: j  !:
872       INTEGER(iwp) :: k  !:
873       INTEGER(iwp) :: kk !:
874
875       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ira !:
876       
877       LOGICAL, SAVE ::  first = .TRUE. !:
878
879       REAL(wp) ::  particle_radius !:
880       REAL(wp) ::  pp              !:
881       REAL(wp) ::  qq              !:
882       REAL(wp) ::  rq              !:
883       REAL(wp) ::  y1              !:
884       REAL(wp) ::  y2              !:
885       REAL(wp) ::  y3              !:
886
887       REAL(wp), DIMENSION(1:11), SAVE ::  rat           !:
888       
889       REAL(wp), DIMENSION(1:7), SAVE  ::  r0            !:
890       
891       REAL(wp), DIMENSION(1:7,1:11), SAVE ::  ecoll_100 !:
892       REAL(wp), DIMENSION(1:7,1:11), SAVE ::  ecoll_400 !:
893
894!
895!--    Initial assignment of constants
896       IF ( first )  THEN
897
898          first = .FALSE.
899
900          r0  = (/ 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 100.0 /)
901          rat = (/ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 /)
902!
903!--       for 100 cm**2/s**3
904          ecoll_100(:,1) = (/1.74,  1.74,  1.773, 1.49,  1.207,  1.207,  1.0 /)
905          ecoll_100(:,2) = (/1.46,  1.46,  1.421, 1.245, 1.069,  1.069,  1.0 /)
906          ecoll_100(:,3) = (/1.32,  1.32,  1.245, 1.123, 1.000,  1.000,  1.0 /)
907          ecoll_100(:,4) = (/1.250, 1.250, 1.148, 1.087, 1.025,  1.025,  1.0 /)
908          ecoll_100(:,5) = (/1.186, 1.186, 1.066, 1.060, 1.056,  1.056,  1.0 /)
909          ecoll_100(:,6) = (/1.045, 1.045, 1.000, 1.014, 1.028,  1.028,  1.0 /)
910          ecoll_100(:,7) = (/1.070, 1.070, 1.030, 1.038, 1.046,  1.046,  1.0 /)
911          ecoll_100(:,8) = (/1.000, 1.000, 1.054, 1.042, 1.029,  1.029,  1.0 /)
912          ecoll_100(:,9) = (/1.223, 1.223, 1.117, 1.069, 1.021,  1.021,  1.0 /)
913          ecoll_100(:,10)= (/1.570, 1.570, 1.244, 1.166, 1.088,  1.088,  1.0 /)
914          ecoll_100(:,11)= (/20.3,  20.3,  14.6 , 8.61,  2.60,   2.60 ,  1.0 /)
915!
916!--       for 400 cm**2/s**3
917          ecoll_400(:,1) = (/4.976, 4.976,  3.593, 2.519, 1.445,  1.445,  1.0 /)
918          ecoll_400(:,2) = (/2.984, 2.984,  2.181, 1.691, 1.201,  1.201,  1.0 /)
919          ecoll_400(:,3) = (/1.988, 1.988,  1.475, 1.313, 1.150,  1.150,  1.0 /)
920          ecoll_400(:,4) = (/1.490, 1.490,  1.187, 1.156, 1.126,  1.126,  1.0 /)
921          ecoll_400(:,5) = (/1.249, 1.249,  1.088, 1.090, 1.092,  1.092,  1.0 /)
922          ecoll_400(:,6) = (/1.139, 1.139,  1.130, 1.091, 1.051,  1.051,  1.0 /)
923          ecoll_400(:,7) = (/1.220, 1.220,  1.190, 1.138, 1.086,  1.086,  1.0 /)
924          ecoll_400(:,8) = (/1.325, 1.325,  1.267, 1.165, 1.063,  1.063,  1.0 /)
925          ecoll_400(:,9) = (/1.716, 1.716,  1.345, 1.223, 1.100,  1.100,  1.0 /)
926          ecoll_400(:,10)= (/3.788, 3.788,  1.501, 1.311, 1.120,  1.120,  1.0 /)
927          ecoll_400(:,11)= (/36.52, 36.52,  19.16, 22.80,  26.0,   26.0,  1.0 /)
928
929       ENDIF
930
931!
932!--    Calculate the radius class index of particles with respect to array r0
933!--    Radius has to be in µm
934       ALLOCATE( ira(1:radius_classes) )
935
936       DO  j = 1, radius_classes
937          particle_radius = radclass(j) * 1.0E6_wp
938          DO  k = 1, 7
939             IF ( particle_radius < r0(k) )  THEN
940                ira(j) = k
941                EXIT
942             ENDIF
943          ENDDO
944          IF ( particle_radius >= r0(7) )  ira(j) = 8
945       ENDDO
946
947!
948!--    Two-dimensional linear interpolation of the collision efficiencies
949!--    Radius has to be in µm
950       DO  j =  1, radius_classes
951          DO  i = 1, j
952
953             ir = ira(j)
954             rq = radclass(i) / radclass(j)
955
956             DO  kk = 2, 11
957                IF ( rq <= rat(kk) )  THEN
958                   iq = kk
959                   EXIT
960                ENDIF
961             ENDDO
962
963             y1 = 0.0001      ! for 0 m**2/s**3
964
965             IF ( ir < 8 )  THEN
966                IF ( ir >= 2 )  THEN
967                   pp = ( radclass(j)*1.0E6 - r0(ir-1) ) / ( r0(ir) - r0(ir-1) )
968                   qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
969                   y2 = ( 1.0-pp ) * ( 1.0-qq ) * ecoll_100(ir-1,iq-1) +  &
970                                pp * ( 1.0-qq ) * ecoll_100(ir,iq-1)   +  &
971                                qq * ( 1.0-pp ) * ecoll_100(ir-1,iq)   +  &
972                                pp * qq         * ecoll_100(ir,iq)
973                   y3 = ( 1.0-pp ) * ( 1.0-qq ) * ecoll_400(ir-1,iq-1) +  &
974                                pp * ( 1.0-qq ) * ecoll_400(ir,iq-1)   +  &
975                                qq * ( 1.0-pp ) * ecoll_400(ir-1,iq)   +  &
976                                pp * qq         * ecoll_400(ir,iq)
977                ELSE
978                   qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
979                   y2 = ( 1.0-qq ) * ecoll_100(1,iq-1) + qq * ecoll_100(1,iq)
980                   y3 = ( 1.0-qq ) * ecoll_400(1,iq-1) + qq * ecoll_400(1,iq)
981                ENDIF
982             ELSE
983                qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
984                y2 = ( 1.0-qq ) * ecoll_100(7,iq-1) + qq * ecoll_100(7,iq)
985                y3 = ( 1.0-qq ) * ecoll_400(7,iq-1) + qq * ecoll_400(7,iq)
986             ENDIF
987!
988!--          Linear interpolation of dissipation rate in m**2/s**3
989             IF ( epsilon <= 0.01 )  THEN
990                ecf(j,i) = ( epsilon - 0.01 ) / (   0.0 - 0.01 ) * y1 &
991                         + ( epsilon -   0.0 ) / ( 0.01 -   0.0 ) * y2
992             ELSEIF ( epsilon <= 0.06 )  THEN
993                ecf(j,i) = ( epsilon - 0.04 ) / ( 0.01 - 0.04 ) * y2 &
994                         + ( epsilon - 0.01 ) / ( 0.04 - 0.01 ) * y3
995             ELSE
996                ecf(j,i) = (   0.06 - 0.04 ) / ( 0.01 - 0.04 ) * y2 &
997                         + (   0.06 - 0.01 ) / ( 0.04 - 0.01 ) * y3
998             ENDIF
999
1000             IF ( ecf(j,i) < 1.0 )  ecf(j,i) = 1.0
1001
1002             ecf(i,j) = ecf(j,i)
1003
1004          ENDDO
1005       ENDDO
1006
1007    END SUBROUTINE turb_enhance_eff
1008
1009
1010
1011    SUBROUTINE collision_efficiency_rogers( mean_r, r, e)
1012!------------------------------------------------------------------------------!
1013! Collision efficiencies from table 8.2 in Rogers and Yau (1989, 3rd edition).
1014! Values are calculated from table by bilinear interpolation.
1015!------------------------------------------------------------------------------!
1016
1017       IMPLICIT NONE
1018
1019       INTEGER(iwp)  ::  i !:
1020       INTEGER(iwp)  ::  j !:
1021       INTEGER(iwp)  ::  k !:
1022
1023       LOGICAL, SAVE ::  first = .TRUE. !:
1024
1025       REAL(wp)      ::  aa      !:
1026       REAL(wp)      ::  bb      !:
1027       REAL(wp)      ::  cc      !:
1028       REAL(wp)      ::  dd      !:
1029       REAL(wp)      ::  dx      !:
1030       REAL(wp)      ::  dy      !:
1031       REAL(wp)      ::  e       !:
1032       REAL(wp)      ::  gg      !:
1033       REAL(wp)      ::  mean_r  !:
1034       REAL(wp)      ::  mean_rm !:
1035       REAL(wp)      ::  r       !:
1036       REAL(wp)      ::  rm      !:
1037       REAL(wp)      ::  x       !:
1038       REAL(wp)      ::  y       !:
1039 
1040       REAL(wp), DIMENSION(1:9), SAVE      ::  collected_r = 0.0 !:
1041       
1042       REAL(wp), DIMENSION(1:19), SAVE     ::  collector_r = 0.0 !:
1043       
1044       REAL(wp), DIMENSION(1:9,1:19), SAVE ::  ef = 0.0          !:
1045
1046       mean_rm = mean_r * 1.0E06_wp
1047       rm      = r      * 1.0E06_wp
1048
1049       IF ( first )  THEN
1050
1051          collected_r = (/ 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 15.0, 20.0, 25.0 /)
1052          collector_r = (/ 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 80.0, 100.0,  &
1053                           150.0, 200.0, 300.0, 400.0, 500.0, 600.0, 1000.0, &
1054                           1400.0, 1800.0, 2400.0, 3000.0 /)
1055
1056          ef(:,1) = (/0.017, 0.027, 0.037, 0.052, 0.052, 0.052, 0.052, 0.0, &
1057                      0.0 /)
1058          ef(:,2) = (/0.001, 0.016, 0.027, 0.060, 0.12, 0.17, 0.17, 0.17, 0.0 /)
1059          ef(:,3) = (/0.001, 0.001, 0.02,  0.13,  0.28, 0.37, 0.54, 0.55, 0.47/)
1060          ef(:,4) = (/0.001, 0.001, 0.02,  0.23,  0.4,  0.55, 0.7,  0.75, 0.75/)
1061          ef(:,5) = (/0.01,  0.01,  0.03,  0.3,   0.4,  0.58, 0.73, 0.75, 0.79/)
1062          ef(:,6) = (/0.01,  0.01,  0.13,  0.38,  0.57, 0.68, 0.80, 0.86, 0.91/)
1063          ef(:,7) = (/0.01,  0.085, 0.23,  0.52,  0.68, 0.76, 0.86, 0.92, 0.95/)
1064          ef(:,8) = (/0.01,  0.14,  0.32,  0.60,  0.73, 0.81, 0.90, 0.94, 0.96/)
1065          ef(:,9) = (/0.025, 0.25,  0.43,  0.66,  0.78, 0.83, 0.92, 0.95, 0.96/)
1066          ef(:,10)= (/0.039, 0.3,   0.46,  0.69,  0.81, 0.87, 0.93, 0.95, 0.96/)
1067          ef(:,11)= (/0.095, 0.33,  0.51,  0.72,  0.82, 0.87, 0.93, 0.96, 0.97/)
1068          ef(:,12)= (/0.098, 0.36,  0.51,  0.73,  0.83, 0.88, 0.93, 0.96, 0.97/)
1069          ef(:,13)= (/0.1,   0.36,  0.52,  0.74,  0.83, 0.88, 0.93, 0.96, 0.97/)
1070          ef(:,14)= (/0.17,  0.4,   0.54,  0.72,  0.83, 0.88, 0.94, 0.98, 1.0 /)
1071          ef(:,15)= (/0.15,  0.37,  0.52,  0.74,  0.82, 0.88, 0.94, 0.98, 1.0 /)
1072          ef(:,16)= (/0.11,  0.34,  0.49,  0.71,  0.83, 0.88, 0.94, 0.95, 1.0 /)
1073          ef(:,17)= (/0.08,  0.29,  0.45,  0.68,  0.8,  0.86, 0.96, 0.94, 1.0 /)
1074          ef(:,18)= (/0.04,  0.22,  0.39,  0.62,  0.75, 0.83, 0.92, 0.96, 1.0 /)
1075          ef(:,19)= (/0.02,  0.16,  0.33,  0.55,  0.71, 0.81, 0.90, 0.94, 1.0 /)
1076
1077       ENDIF
1078
1079       DO  k = 1, 8
1080          IF ( collected_r(k) <= mean_rm )  i = k
1081       ENDDO
1082
1083       DO  k = 1, 18
1084          IF ( collector_r(k) <= rm )  j = k
1085       ENDDO
1086
1087       IF ( rm < 10.0 )  THEN
1088          e = 0.0
1089       ELSEIF ( mean_rm < 2.0 )  THEN
1090          e = 0.001
1091       ELSEIF ( mean_rm >= 25.0 )  THEN
1092          IF( j <= 2 )  e = 0.0
1093          IF( j == 3 )  e = 0.47
1094          IF( j == 4 )  e = 0.8
1095          IF( j == 5 )  e = 0.9
1096          IF( j >=6  )  e = 1.0
1097       ELSEIF ( rm >= 3000.0 )  THEN
1098          IF( i == 1 )  e = 0.02
1099          IF( i == 2 )  e = 0.16
1100          IF( i == 3 )  e = 0.33
1101          IF( i == 4 )  e = 0.55
1102          IF( i == 5 )  e = 0.71
1103          IF( i == 6 )  e = 0.81
1104          IF( i == 7 )  e = 0.90
1105          IF( i >= 8 )  e = 0.94
1106       ELSE
1107          x  = mean_rm - collected_r(i)
1108          y  = rm - collector_r(j)
1109          dx = collected_r(i+1) - collected_r(i)
1110          dy = collector_r(j+1) - collector_r(j)
1111          aa = x**2 + y**2
1112          bb = ( dx - x )**2 + y**2
1113          cc = x**2 + ( dy - y )**2
1114          dd = ( dx - x )**2 + ( dy - y )**2
1115          gg = aa + bb + cc + dd
1116
1117          e = ( (gg-aa)*ef(i,j) + (gg-bb)*ef(i+1,j) + (gg-cc)*ef(i,j+1) + &
1118                (gg-dd)*ef(i+1,j+1) ) / (3.0*gg)
1119       ENDIF
1120
1121    END SUBROUTINE collision_efficiency_rogers
1122
1123 END MODULE lpm_collision_kernels_mod
Note: See TracBrowser for help on using the repository browser.