source: palm/trunk/SOURCE/lpm_droplet_condensation.f90 @ 1682

Last change on this file since 1682 was 1682, checked in by knoop, 9 years ago

Code annotations made doxygen readable

  • Property svn:keywords set to Id
File size: 23.9 KB
Line 
1!> @file lpm_droplet_condensation.f90
2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2014 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------!
18!
19! Current revisions:
20! ------------------
21! Code annotations made doxygen readable
22!
23! Former revisions:
24! -----------------
25! $Id: lpm_droplet_condensation.f90 1682 2015-10-07 23:56:08Z knoop $
26!
27! 1359 2014-04-11 17:15:14Z hoffmann
28! New particle structure integrated.
29! Kind definition added to all floating point numbers.
30!
31! 1346 2014-03-27 13:18:20Z heinze
32! Bugfix: REAL constants provided with KIND-attribute especially in call of
33! intrinsic function like MAX, MIN, SIGN
34!
35! 1322 2014-03-20 16:38:49Z raasch
36! REAL constants defined as wp-kind
37!
38! 1320 2014-03-20 08:40:49Z raasch
39! ONLY-attribute added to USE-statements,
40! kind-parameters added to all INTEGER and REAL declaration statements,
41! kinds are defined in new module kinds,
42! comment fields (!:) to be used for variable explanations added to
43! all variable declaration statements
44!
45! 1318 2014-03-17 13:35:16Z raasch
46! module interfaces removed
47!
48! 1092 2013-02-02 11:24:22Z raasch
49! unused variables removed
50!
51! 1071 2012-11-29 16:54:55Z franke
52! Ventilation effect for evaporation of large droplets included
53! Check for unreasonable results included in calculation of Rosenbrock method
54! since physically unlikely results were observed and for the same
55! reason the first internal time step in Rosenbrock method should be < 1.0E02 in
56! case of evaporation
57! Unnecessary calculation of ql_int removed
58! Unnecessary calculations in Rosenbrock method (d2rdt2, drdt_m, dt_ros_last)
59! removed
60! Bugfix: factor in calculation of surface tension changed from 0.00155 to
61! 0.000155
62!
63! 1036 2012-10-22 13:43:42Z raasch
64! code put under GPL (PALM 3.9)
65!
66! 849 2012-03-15 10:35:09Z raasch
67! initial revision (former part of advec_particles)
68!
69!
70! Description:
71! ------------
72!> Calculates change in droplet radius by condensation/evaporation, using
73!> either an analytic formula or by numerically integrating the radius growth
74!> equation including curvature and solution effects using Rosenbrocks method
75!> (see Numerical recipes in FORTRAN, 2nd edition, p. 731).
76!> The analytical formula and growth equation follow those given in
77!> Rogers and Yau (A short course in cloud physics, 3rd edition, p. 102/103).
78!------------------------------------------------------------------------------!
79 SUBROUTINE lpm_droplet_condensation (ip,jp,kp)
80 
81
82    USE arrays_3d,                                                             &
83        ONLY:  hyp, pt, q,  ql_c, ql_v, zu
84
85    USE cloud_parameters,                                                      &
86        ONLY:  bfactor, curvature_solution_effects, diff_coeff_l,              &
87               eps_ros, l_d_rv, l_v, rho_l,  r_v, thermal_conductivity_l
88
89    USE constants,                                                             &
90        ONLY:  pi
91
92    USE control_parameters,                                                    &
93        ONLY:  atmos_ocean_sign, dt_3d, dz, message_string,                    &
94               molecular_viscosity, rho_surface
95    USE cpulog,                                                                &
96        ONLY:  cpu_log, log_point_s
97
98    USE grid_variables,                                                        &
99        ONLY:  dx, ddx, dy, ddy
100
101    USE lpm_collision_kernels_mod,                                             &
102        ONLY:  rclass_lbound, rclass_ubound
103
104    USE kinds
105
106    USE particle_attributes,                                                   &
107        ONLY:  block_offset, grid_particles, hall_kernel, number_of_particles, &
108               offset_ocean_nzt, offset_ocean_nzt_m1, particles,               &
109               radius_classes, use_kernel_tables, wang_kernel
110
111
112    IMPLICIT NONE
113
114    INTEGER(iwp) :: i                          !<
115    INTEGER(iwp) :: ip                         !<
116    INTEGER(iwp) :: internal_timestep_count    !<
117    INTEGER(iwp) :: j                          !<
118    INTEGER(iwp) :: jp                         !<
119    INTEGER(iwp) :: jtry                       !<
120    INTEGER(iwp) :: k                          !<
121    INTEGER(iwp) :: kp                         !<
122    INTEGER(iwp) :: n                          !<
123    INTEGER(iwp) :: nb                         !<
124    INTEGER(iwp) :: ros_count                  !<
125 
126    INTEGER(iwp), PARAMETER ::  maxtry = 40      !<
127
128    INTEGER(iwp), DIMENSION(0:7) ::  end_index   !<
129    INTEGER(iwp), DIMENSION(0:7) ::  start_index !<
130
131    LOGICAL ::  repeat                           !<
132
133    LOGICAL, DIMENSION(number_of_particles) ::  flag_1 !<
134
135    REAL(wp) ::  aa                            !<
136    REAL(wp) ::  afactor                       !<
137    REAL(wp) ::  arg                           !<
138    REAL(wp) ::  bb                            !<
139    REAL(wp) ::  cc                            !<
140    REAL(wp) ::  dd                            !<
141    REAL(wp) ::  ddenom                        !<
142    REAL(wp) ::  delta_r                       !<
143    REAL(wp) ::  drdt                          !<
144    REAL(wp) ::  drdt_ini                      !<
145    REAL(wp) ::  dt_ros                        !<
146    REAL(wp) ::  dt_ros_next                   !<
147    REAL(wp) ::  dt_ros_sum                    !<
148    REAL(wp) ::  dt_ros_sum_ini                !<
149    REAL(wp) ::  d2rdtdr                       !<
150    REAL(wp) ::  errmax                        !<
151    REAL(wp) ::  err_ros                       !<
152    REAL(wp) ::  g1                            !<
153    REAL(wp) ::  g2                            !<
154    REAL(wp) ::  g3                            !<
155    REAL(wp) ::  g4                            !<
156    REAL(wp) ::  gg                            !<
157    REAL(wp) ::  pt_int                        !<
158    REAL(wp) ::  pt_int_l                      !<
159    REAL(wp) ::  pt_int_u                      !<
160    REAL(wp) ::  q_int                         !<
161    REAL(wp) ::  q_int_l                       !<
162    REAL(wp) ::  q_int_u                       !<
163    REAL(wp) ::  r_ros                         !<
164    REAL(wp) ::  r_ros_ini                     !<
165    REAL(wp) ::  sigma                         !<
166    REAL(wp) ::  x                             !<
167    REAL(wp) ::  y                             !<
168    REAL(wp) ::  re_p                          !<
169 
170!-- Parameters for Rosenbrock method
171    REAL(wp), PARAMETER ::  a21 = 2.0_wp               !<
172    REAL(wp), PARAMETER ::  a31 = 48.0_wp / 25.0_wp    !<
173    REAL(wp), PARAMETER ::  a32 = 6.0_wp / 25.0_wp     !<
174    REAL(wp), PARAMETER ::  b1 = 19.0_wp / 9.0_wp      !<
175    REAL(wp), PARAMETER ::  b2 = 0.5_wp                !<
176    REAL(wp), PARAMETER ::  b3 = 25.0_wp / 108.0_wp    !<
177    REAL(wp), PARAMETER ::  b4 = 125.0_wp / 108.0_wp   !<
178    REAL(wp), PARAMETER ::  c21 = -8.0_wp              !<
179    REAL(wp), PARAMETER ::  c31 = 372.0_wp / 25.0_wp   !<
180    REAL(wp), PARAMETER ::  c32 = 12.0_wp / 5.0_wp     !<
181    REAL(wp), PARAMETER ::  c41 = -112.0_wp / 125.0_wp !<
182    REAL(wp), PARAMETER ::  c42 = -54.0_wp / 125.0_wp  !<
183    REAL(wp), PARAMETER ::  c43 = -2.0_wp / 5.0_wp     !<
184    REAL(wp), PARAMETER ::  errcon = 0.1296_wp         !<
185    REAL(wp), PARAMETER ::  e1 = 17.0_wp / 54.0_wp     !<
186    REAL(wp), PARAMETER ::  e2 = 7.0_wp / 36.0_wp      !<
187    REAL(wp), PARAMETER ::  e3 = 0.0_wp                !<
188    REAL(wp), PARAMETER ::  e4 = 125.0_wp / 108.0_wp   !<
189    REAL(wp), PARAMETER ::  gam = 0.5_wp               !<
190    REAL(wp), PARAMETER ::  grow = 1.5_wp              !<
191    REAL(wp), PARAMETER ::  pgrow = -0.25_wp           !<
192    REAL(wp), PARAMETER ::  pshrnk = -1.0_wp /3.0_wp   !<
193    REAL(wp), PARAMETER ::  shrnk = 0.5_wp             !<
194
195    REAL(wp), DIMENSION(number_of_particles) ::  afactor_v              !<
196    REAL(wp), DIMENSION(number_of_particles) ::  diff_coeff_v           !<
197    REAL(wp), DIMENSION(number_of_particles) ::  e_s                    !<
198    REAL(wp), DIMENSION(number_of_particles) ::  e_a                    !<
199    REAL(wp), DIMENSION(number_of_particles) ::  new_r                  !<
200    REAL(wp), DIMENSION(number_of_particles) ::  p_int                  !<
201    REAL(wp), DIMENSION(number_of_particles) ::  thermal_conductivity_v !<
202    REAL(wp), DIMENSION(number_of_particles) ::  t_int                  !<
203    REAL(wp), DIMENSION(number_of_particles) ::  xv                     !<
204    REAL(wp), DIMENSION(number_of_particles) ::  yv                     !<
205    REAL(wp), DIMENSION(number_of_particles) ::  zv                     !<
206
207
208    CALL cpu_log( log_point_s(42), 'lpm_droplet_condens', 'start' )
209
210    start_index = grid_particles(kp,jp,ip)%start_index
211    end_index   = grid_particles(kp,jp,ip)%end_index
212
213    xv = particles(1:number_of_particles)%x
214    yv = particles(1:number_of_particles)%y
215    zv = particles(1:number_of_particles)%z
216
217    DO  nb = 0,7
218
219       i = ip + block_offset(nb)%i_off
220       j = jp + block_offset(nb)%j_off
221       k = kp + block_offset(nb)%k_off
222
223       DO  n = start_index(nb), end_index(nb)
224!
225!--    Interpolate temperature and humidity.
226          x  = xv(n) - i * dx
227          y  = yv(n) - j * dy
228          aa = x**2          + y**2
229          bb = ( dx - x )**2 + y**2
230          cc = x**2          + ( dy - y )**2
231          dd = ( dx - x )**2 + ( dy - y )**2
232          gg = aa + bb + cc + dd
233
234          pt_int_l = ( ( gg - aa ) * pt(k,j,i)   + ( gg - bb ) * pt(k,j,i+1)   &
235                     + ( gg - cc ) * pt(k,j+1,i) + ( gg - dd ) * pt(k,j+1,i+1) &
236                     ) / ( 3.0_wp * gg )
237
238          pt_int_u = ( ( gg-aa ) * pt(k+1,j,i)   + ( gg-bb ) * pt(k+1,j,i+1)   &
239                     + ( gg-cc ) * pt(k+1,j+1,i) + ( gg-dd ) * pt(k+1,j+1,i+1) &
240                     ) / ( 3.0_wp * gg )
241
242          pt_int = pt_int_l + ( particles(n)%z - zu(k) ) / dz *                &
243                              ( pt_int_u - pt_int_l )
244
245          q_int_l = ( ( gg - aa ) * q(k,j,i)     + ( gg - bb ) * q(k,j,i+1)    &
246                    + ( gg - cc ) * q(k,j+1,i)   + ( gg - dd ) * q(k,j+1,i+1)  &
247                    ) / ( 3.0_wp * gg )
248
249          q_int_u = ( ( gg-aa ) * q(k+1,j,i)   + ( gg-bb ) * q(k+1,j,i+1)      &
250                    + ( gg-cc ) * q(k+1,j+1,i) + ( gg-dd ) * q(k+1,j+1,i+1)    &
251                    ) / ( 3.0_wp * gg )
252
253          q_int = q_int_l + ( zv(n) - zu(k) ) / dz *                           &
254                            ( q_int_u - q_int_l )
255
256!
257!--       Calculate real temperature and saturation vapor pressure
258          p_int(n) = hyp(k) + ( particles(n)%z - zu(k) ) / dz *                &
259                              ( hyp(k+1)-hyp(k) )
260          t_int(n) = pt_int * ( p_int(n) / 100000.0_wp )**0.286_wp
261
262          e_s(n) = 611.0_wp * EXP( l_d_rv * ( 3.6609E-3_wp - 1.0_wp /          &
263                                   t_int(n) ) )
264
265!
266!--       Current vapor pressure
267          e_a(n) = q_int * p_int(n) / ( 0.378_wp * q_int + 0.622_wp )
268
269       ENDDO
270    ENDDO
271
272    new_r = 0.0_wp
273    flag_1 = .false.
274
275    DO  n = 1, number_of_particles
276!
277!--    Change in radius by condensation/evaporation
278       IF ( particles(n)%radius >= 4.0E-5_wp  .AND.                            &
279            e_a(n)/e_s(n) < 1.0_wp )  THEN
280!
281!--    Approximation for large radii, where curvature and solution effects
282!--    can be neglected but ventilation effect has to be included in case of
283!--    evaporation.
284!--    First calculate the droplet's Reynolds number
285          re_p = 2.0_wp * particles(n)%radius * ABS( particles(n)%speed_z ) /  &
286                                                     molecular_viscosity
287!
288!--       Ventilation coefficient (Rogers and Yau, 1989):
289          IF ( re_p > 2.5_wp )  THEN
290             afactor_v(n) = 0.78_wp + 0.28_wp * SQRT( re_p )
291          ELSE
292             afactor_v(n) = 1.0_wp + 0.09_wp * re_p
293          ENDIF
294          flag_1(n) = .TRUE.
295       ELSEIF ( particles(n)%radius >= 1.0E-6_wp  .OR.                         &
296                .NOT. curvature_solution_effects )  THEN
297!
298!--    Approximation for larger radii in case that curvature and solution
299!--    effects are neglected and ventilation effects does not play a role
300          afactor_v(n) = 1.0_wp
301          flag_1(n) = .TRUE.
302       ENDIF
303    ENDDO
304
305    DO  n = 1, number_of_particles
306!
307!--    Thermal conductivity for water (from Rogers and Yau, Table 7.1),
308!--    diffusivity for water vapor (after Hall und Pruppacher, 1976)
309       thermal_conductivity_v(n) = 7.94048E-05_wp * t_int(n) + 0.00227011_wp
310       diff_coeff_v(n)           = 0.211E-4_wp *                               &
311                   ( t_int(n) / 273.15_wp )**1.94_wp * ( 101325.0_wp / p_int(n))
312
313       IF(flag_1(n)) then
314          arg = particles(n)%radius**2 + 2.0_wp * dt_3d * afactor_v(n) *       &
315                  ( e_a(n) / e_s(n) - 1.0_wp ) /                               &
316                  ( ( l_d_rv / t_int(n) - 1.0_wp ) * l_v * rho_l / t_int(n) /  &
317                  thermal_conductivity_v(n) +                                  &
318                  rho_l * r_v * t_int(n) / diff_coeff_v(n) / e_s(n) )
319
320          arg = MAX( arg, 1.0E-16_wp )
321          new_r(n) = SQRT( arg )
322        ENDIF
323    ENDDO
324
325    DO  n = 1, number_of_particles
326       IF ( curvature_solution_effects  .AND.                                  &
327            ( ( particles(n)%radius < 1.0E-6_wp )  .OR.                        &
328              ( new_r(n) < 1.0E-6_wp ) ) )  THEN
329!
330!--       Curvature and solutions effects are included in growth equation.
331!--       Change in Radius is calculated with 4th-order Rosenbrock method
332!--       for stiff o.d.e's with monitoring local truncation error to adjust
333!--       stepsize (see Numerical recipes in FORTRAN, 2nd edition, p. 731).
334!--       For larger radii the simple analytic method (see ELSE) gives
335!--       almost the same results.
336
337          ros_count = 0
338          repeat = .TRUE.
339!
340!--       Carry out the Rosenbrock algorithm. In case of unreasonable results
341!--       the switch "repeat" will be set true and the algorithm will be carried
342!--       out again with the internal time step set to its initial (small) value.
343!--       Unreasonable results may occur if the external conditions, especially
344!--       the supersaturation, has significantly changed compared to the last
345!--       PALM timestep.
346          DO WHILE ( repeat )
347
348             repeat = .FALSE.
349!
350!--          Surface tension (Straka, 2009):
351             sigma = 0.0761_wp - 0.000155_wp * ( t_int(n) - 273.15_wp )
352
353             r_ros = particles(n)%radius
354             dt_ros_sum  = 0.0_wp      ! internal integrated time (s)
355             internal_timestep_count = 0
356
357             ddenom  = 1.0_wp / ( rho_l * r_v * t_int(n) / ( e_s(n) *          &
358                                  diff_coeff_v(n) ) + ( l_v /                  &
359                                  ( r_v * t_int(n) ) - 1.0_wp ) *              &
360                                  rho_l * l_v / ( thermal_conductivity_v(n) *  &
361                                  t_int(n) )                                   &
362                                )
363
364             afactor = 2.0_wp * sigma / ( rho_l * r_v * t_int(n) )
365
366!
367!--          Take internal time step values from the end of last PALM time step
368             dt_ros_next = particles(n)%rvar1
369
370!
371!--          Internal time step should not be > 1.0E-2 in case of evaporation
372!--          because larger values may lead to secondary solutions which are
373!--          physically unlikely
374             IF ( dt_ros_next > 1.0E-2_wp  .AND.  e_a(n)/e_s(n) < 1.0_wp )  THEN
375                dt_ros_next = 1.0E-3_wp
376             ENDIF
377!
378!--          If calculation of Rosenbrock method is repeated due to unreasonalble
379!--          results during previous try the initial internal time step has to be
380!--          reduced
381             IF ( ros_count > 1 )  THEN
382                dt_ros_next = dt_ros_next - ( 0.2_wp * dt_ros_next )
383             ELSEIF ( ros_count > 5 )  THEN
384!
385!--             Prevent creation of infinite loop
386                message_string = 'ros_count > 5 in Rosenbrock method'
387                CALL message( 'lpm_droplet_condensation', 'PA0018', 2, 2, &
388                               0, 6, 0 )
389             ENDIF
390
391!
392!--          Internal time step must not be larger than PALM time step
393             dt_ros = MIN( dt_ros_next, dt_3d )
394!
395!--          Integrate growth equation in time unless PALM time step is reached
396             DO WHILE ( dt_ros_sum < dt_3d )
397
398                internal_timestep_count = internal_timestep_count + 1
399
400!
401!--             Derivative at starting value
402                drdt = ddenom / r_ros * ( e_a(n) / e_s(n) - 1.0_wp - afactor / &
403                                          r_ros + bfactor / r_ros**3 )
404                drdt_ini       = drdt
405                dt_ros_sum_ini = dt_ros_sum
406                r_ros_ini      = r_ros
407
408!
409!--             Calculate radial derivative of dr/dt
410                d2rdtdr = ddenom * ( ( 1.0_wp - e_a(n)/e_s(n) ) / r_ros**2 +   &
411                                     2.0_wp * afactor / r_ros**3 -             &
412                                     4.0_wp * bfactor / r_ros**5 )
413!
414!--             Adjust stepsize unless required accuracy is reached
415                DO  jtry = 1, maxtry+1
416
417                   IF ( jtry == maxtry+1 )  THEN
418                      message_string = 'maxtry > 40 in Rosenbrock method'
419                      CALL message( 'lpm_droplet_condensation', 'PA0347', 2,   &
420                                    2, 0, 6, 0 )
421                   ENDIF
422
423                   aa    = 1.0_wp / ( gam * dt_ros ) - d2rdtdr
424                   g1    = drdt_ini / aa
425                   r_ros = r_ros_ini + a21 * g1
426                   drdt  = ddenom / r_ros * ( e_a(n) / e_s(n) - 1.0_wp -       &
427                                              afactor / r_ros +                &
428                                              bfactor / r_ros**3 )
429
430                   g2    = ( drdt + c21 * g1 / dt_ros )&
431                           / aa
432                   r_ros = r_ros_ini + a31 * g1 + a32 * g2
433                   drdt  = ddenom / r_ros * ( e_a(n) / e_s(n) - 1.0_wp -       &
434                                              afactor / r_ros +                &
435                                              bfactor / r_ros**3 )
436
437                   g3    = ( drdt +  &
438                             ( c31 * g1 + c32 * g2 ) / dt_ros ) / aa
439                   g4    = ( drdt +  &
440                             ( c41 * g1 + c42 * g2 + c43 * g3 ) / dt_ros ) / aa
441                   r_ros = r_ros_ini + b1 * g1 + b2 * g2 + b3 * g3 + b4 * g4
442
443                   dt_ros_sum = dt_ros_sum_ini + dt_ros
444
445                   IF ( dt_ros_sum == dt_ros_sum_ini )  THEN
446                      message_string = 'zero stepsize in Rosenbrock method'
447                      CALL message( 'lpm_droplet_condensation', 'PA0348', 2,   &
448                                    2, 0, 6, 0 )
449                   ENDIF
450!
451!--                Calculate error
452                   err_ros = e1 * g1 + e2 * g2 + e3 * g3 + e4 * g4
453                   errmax  = 0.0_wp
454                   errmax  = MAX( errmax, ABS( err_ros / r_ros_ini ) ) / eps_ros
455!
456!--                Leave loop if accuracy is sufficient, otherwise try again
457!--                with a reduced stepsize
458                   IF ( errmax <= 1.0_wp )  THEN
459                      EXIT
460                   ELSE
461                      dt_ros = SIGN( MAX( ABS( 0.9_wp * dt_ros *               &
462                                               errmax**pshrnk ),               &
463                                               shrnk * ABS( dt_ros ) ), dt_ros )
464                   ENDIF
465
466                ENDDO  ! loop for stepsize adjustment
467
468!
469!--             Calculate next internal time step
470                IF ( errmax > errcon )  THEN
471                   dt_ros_next = 0.9_wp * dt_ros * errmax**pgrow
472                ELSE
473                   dt_ros_next = grow * dt_ros
474                ENDIF
475
476!
477!--             Estimated time step is reduced if the PALM time step is exceeded
478                IF ( ( dt_ros_next + dt_ros_sum ) >= dt_3d )  THEN
479                   dt_ros = dt_3d - dt_ros_sum
480                ELSE
481                   dt_ros = dt_ros_next
482                ENDIF
483
484             ENDDO
485!
486!--          Store internal time step value for next PALM step
487             particles(n)%rvar1 = dt_ros_next
488
489             new_r(n) = r_ros
490!
491!--          Radius should not fall below 1E-8 because Rosenbrock method may
492!--          lead to errors otherwise
493             new_r(n) = MAX( new_r(n), 1.0E-8_wp )
494!
495!--          Check if calculated droplet radius change is reasonable since in
496!--          case of droplet evaporation the Rosenbrock method may lead to
497!--          secondary solutions which are physically unlikely.
498!--          Due to the solution effect the droplets may grow for relative
499!--          humidities below 100%, but change of radius should not be too
500!--          large. In case of unreasonable droplet growth the Rosenbrock
501!--          method is recalculated using a smaller initial time step.
502!--          Limiting values are tested for droplets down to 1.0E-7
503             IF ( new_r(n) - particles(n)%radius >= 3.0E-7_wp  .AND.  &
504                  e_a(n)/e_s(n) < 0.97_wp )  THEN
505                ros_count = ros_count + 1
506                repeat = .TRUE.
507             ENDIF
508
509          ENDDO    ! Rosenbrock method
510
511       ENDIF
512
513       delta_r = new_r(n) - particles(n)%radius
514
515!
516!--    Sum up the change in volume of liquid water for the respective grid
517!--    volume (this is needed later in lpm_calc_liquid_water_content for
518!--    calculating the release of latent heat)
519       i = ip
520       j = jp
521       k = kp
522           ! only exact if equidistant
523
524       ql_c(k,j,i) = ql_c(k,j,i) + particles(n)%weight_factor *                &
525                                   rho_l * 1.33333333_wp * pi *                &
526                                   ( new_r(n)**3 - particles(n)%radius**3 ) /  &
527                                   ( rho_surface * dx * dy * dz )
528       IF ( ql_c(k,j,i) > 100.0_wp )  THEN
529          WRITE( message_string, * ) 'k=',k,' j=',j,' i=',i,      &
530                       ' ql_c=',ql_c(k,j,i), ' &part(',n,')%wf=', &
531                       particles(n)%weight_factor,' delta_r=',delta_r
532          CALL message( 'lpm_droplet_condensation', 'PA0143', 2, 2, -1, 6, 1 )
533       ENDIF
534
535!
536!--    Change the droplet radius
537       IF ( ( new_r(n) - particles(n)%radius ) < 0.0_wp  .AND.                 &
538            new_r(n) < 0.0_wp )  THEN
539          WRITE( message_string, * ) '#1 k=',k,' j=',j,' i=',i,                &
540                       ' e_s=',e_s(n), ' e_a=',e_a(n),' t_int=',t_int(n),      &
541                       ' &delta_r=',delta_r,                                   &
542                       ' particle_radius=',particles(n)%radius
543          CALL message( 'lpm_droplet_condensation', 'PA0144', 2, 2, -1, 6, 1 )
544       ENDIF
545
546!
547!--    Sum up the total volume of liquid water (needed below for
548!--    re-calculating the weighting factors)
549       ql_v(k,j,i) = ql_v(k,j,i) + particles(n)%weight_factor * new_r(n)**3
550
551       particles(n)%radius = new_r(n)
552
553!
554!--    Determine radius class of the particle needed for collision
555       IF ( ( hall_kernel  .OR.  wang_kernel )  .AND.  use_kernel_tables )     &
556       THEN
557          particles(n)%class = ( LOG( new_r(n) ) - rclass_lbound ) /           &
558                               ( rclass_ubound - rclass_lbound ) *             &
559                               radius_classes
560          particles(n)%class = MIN( particles(n)%class, radius_classes )
561          particles(n)%class = MAX( particles(n)%class, 1 )
562       ENDIF
563
564    ENDDO
565
566    CALL cpu_log( log_point_s(42), 'lpm_droplet_condens', 'stop' )
567
568
569 END SUBROUTINE lpm_droplet_condensation
Note: See TracBrowser for help on using the repository browser.