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

Last change on this file since 3045 was 3045, checked in by Giersch, 6 years ago

Code adjusted according to coding standards, renamed namelists, error messages revised until PA0347, output CASE 108 disabled

  • Property svn:keywords set to Id
File size: 17.7 KB
RevLine 
[1682]1!> @file lpm_droplet_condensation.f90
[2000]2!------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]4!
[2000]5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
[1036]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!
[2718]17! Copyright 1997-2018 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[849]20! Current revisions:
21! ------------------
[2375]22!
23!
[1891]24! Former revisions:
25! -----------------
26! $Id: lpm_droplet_condensation.f90 3045 2018-05-28 07:55:41Z Giersch $
[3045]27! Error messages revised
28!
29! 3039 2018-05-24 13:13:11Z schwenkel
[3039]30! bugfix for lcm with grid stretching
31!
32! 2718 2018-01-02 08:49:38Z maronga
[2716]33! Corrected "Former revisions" section
34!
35! 2696 2017-12-14 17:12:51Z kanani
36! Change in file header (GPL part)
37!
38! 2608 2017-11-13 14:04:26Z schwenkel
[2608]39! Calculation of magnus equation in external module (diagnostic_quantities_mod).
40!
41! 2375 2017-08-29 14:10:28Z schwenkel
[2375]42! Changed ONLY-dependencies
43!
44! 2312 2017-07-14 20:26:51Z hoffmann
[2312]45! Rosenbrock scheme improved. Gas-kinetic effect added.
[1891]46!
[2001]47! 2000 2016-08-20 18:09:15Z knoop
48! Forced header and separation lines into 80 columns
[2312]49!
[1891]50! 1890 2016-04-22 08:52:11Z hoffmann
[1890]51! Some improvements of the Rosenbrock method. If the Rosenbrock method needs more
52! than 40 iterations to find a sufficient time setp, the model is not aborted.
[2312]53! This might lead to small erros. But they can be assumend as negligible, since
54! the maximum timesetp of the Rosenbrock method after 40 iterations will be
55! smaller than 10^-16 s.
56!
[1872]57! 1871 2016-04-15 11:46:09Z hoffmann
58! Initialization of aerosols added.
59!
[1851]60! 1849 2016-04-08 11:33:18Z hoffmann
[1852]61! Interpolation of supersaturation has been removed because it is not in
62! accordance with the release/depletion of latent heat/water vapor in
[1849]63! interaction_droplets_ptq.
64! Calculation of particle Reynolds number has been corrected.
[1852]65! eps_ros added from modules.
[1849]66!
[1832]67! 1831 2016-04-07 13:15:51Z hoffmann
68! curvature_solution_effects moved to particle_attributes
69!
[1823]70! 1822 2016-04-07 07:49:42Z hoffmann
71! Unused variables removed.
72!
[1683]73! 1682 2015-10-07 23:56:08Z knoop
[2312]74! Code annotations made doxygen readable
75!
[1360]76! 1359 2014-04-11 17:15:14Z hoffmann
[2312]77! New particle structure integrated.
[1360]78! Kind definition added to all floating point numbers.
79!
[1347]80! 1346 2014-03-27 13:18:20Z heinze
[2312]81! Bugfix: REAL constants provided with KIND-attribute especially in call of
[1347]82! intrinsic function like MAX, MIN, SIGN
83!
[1323]84! 1322 2014-03-20 16:38:49Z raasch
85! REAL constants defined as wp-kind
86!
[1321]87! 1320 2014-03-20 08:40:49Z raasch
[1320]88! ONLY-attribute added to USE-statements,
89! kind-parameters added to all INTEGER and REAL declaration statements,
90! kinds are defined in new module kinds,
91! comment fields (!:) to be used for variable explanations added to
92! all variable declaration statements
[1072]93!
[1319]94! 1318 2014-03-17 13:35:16Z raasch
95! module interfaces removed
96!
[1093]97! 1092 2013-02-02 11:24:22Z raasch
98! unused variables removed
99!
[1072]100! 1071 2012-11-29 16:54:55Z franke
[1071]101! Ventilation effect for evaporation of large droplets included
102! Check for unreasonable results included in calculation of Rosenbrock method
103! since physically unlikely results were observed and for the same
104! reason the first internal time step in Rosenbrock method should be < 1.0E02 in
105! case of evaporation
106! Unnecessary calculation of ql_int removed
107! Unnecessary calculations in Rosenbrock method (d2rdt2, drdt_m, dt_ros_last)
108! removed
109! Bugfix: factor in calculation of surface tension changed from 0.00155 to
110! 0.000155
[849]111!
[1037]112! 1036 2012-10-22 13:43:42Z raasch
113! code put under GPL (PALM 3.9)
114!
[850]115! 849 2012-03-15 10:35:09Z raasch
116! initial revision (former part of advec_particles)
[849]117!
[850]118!
[849]119! Description:
120! ------------
[1682]121!> Calculates change in droplet radius by condensation/evaporation, using
122!> either an analytic formula or by numerically integrating the radius growth
123!> equation including curvature and solution effects using Rosenbrocks method
124!> (see Numerical recipes in FORTRAN, 2nd edition, p. 731).
125!> The analytical formula and growth equation follow those given in
126!> Rogers and Yau (A short course in cloud physics, 3rd edition, p. 102/103).
[849]127!------------------------------------------------------------------------------!
[1682]128 SUBROUTINE lpm_droplet_condensation (ip,jp,kp)
[849]129
[2312]130
[1320]131    USE arrays_3d,                                                             &
[3039]132        ONLY:  dzw, hyp, pt, q, ql_c, ql_v
[849]133
[1320]134    USE cloud_parameters,                                                      &
[2375]135        ONLY:  l_d_rv, l_v, molecular_weight_of_solute,                        &
136               molecular_weight_of_water, rho_l, rho_s, r_v, vanthoff
[849]137
[1320]138    USE constants,                                                             &
139        ONLY:  pi
[849]140
[1320]141    USE control_parameters,                                                    &
[1822]142        ONLY:  dt_3d, dz, message_string, molecular_viscosity, rho_surface
143
[1320]144    USE cpulog,                                                                &
145        ONLY:  cpu_log, log_point_s
[849]146
[2608]147    USE diagnostic_quantities_mod,                                             &
148        ONLY:  magnus
149
[1320]150    USE grid_variables,                                                        &
[1822]151        ONLY:  dx, dy
[1071]152
[1320]153    USE lpm_collision_kernels_mod,                                             &
154        ONLY:  rclass_lbound, rclass_ubound
[849]155
[1320]156    USE kinds
157
158    USE particle_attributes,                                                   &
[2375]159        ONLY:  curvature_solution_effects, hall_kernel, number_of_particles,   &
160               particles, radius_classes, use_kernel_tables, wang_kernel
[1320]161
162    IMPLICIT NONE
163
[1682]164    INTEGER(iwp) :: ip                         !<
165    INTEGER(iwp) :: jp                         !<
166    INTEGER(iwp) :: kp                         !<
167    INTEGER(iwp) :: n                          !<
[1320]168
[1849]169    REAL(wp) ::  afactor                       !< curvature effects
[1682]170    REAL(wp) ::  arg                           !<
[1849]171    REAL(wp) ::  bfactor                       !< solute effects
[1682]172    REAL(wp) ::  ddenom                        !<
173    REAL(wp) ::  delta_r                       !<
[1849]174    REAL(wp) ::  diameter                      !< diameter of cloud droplets
[2312]175    REAL(wp) ::  diff_coeff                    !< diffusivity for water vapor
[1682]176    REAL(wp) ::  drdt                          !<
177    REAL(wp) ::  dt_ros                        !<
178    REAL(wp) ::  dt_ros_sum                    !<
179    REAL(wp) ::  d2rdtdr                       !<
[1849]180    REAL(wp) ::  e_a                           !< current vapor pressure
181    REAL(wp) ::  e_s                           !< current saturation vapor pressure
[2312]182    REAL(wp) ::  error                         !< local truncation error in Rosenbrock
183    REAL(wp) ::  k1                            !<
184    REAL(wp) ::  k2                            !<
185    REAL(wp) ::  r_err                         !< First order estimate of Rosenbrock radius
186    REAL(wp) ::  r_ros                         !< Rosenbrock radius
187    REAL(wp) ::  r_ros_ini                     !< initial Rosenbrock radius
188    REAL(wp) ::  r0                            !< gas-kinetic lengthscale
189    REAL(wp) ::  sigma                         !< surface tension of water
190    REAL(wp) ::  thermal_conductivity          !< thermal conductivity for water
[1849]191    REAL(wp) ::  t_int                         !< temperature
192    REAL(wp) ::  w_s                           !< terminal velocity of droplets
[2312]193    REAL(wp) ::  re_p                          !< particle Reynolds number
[1849]194!
[2312]195!-- Parameters for Rosenbrock method (see Verwer et al., 1999)
196    REAL(wp), PARAMETER :: prec = 1.0E-3_wp     !< precision of Rosenbrock solution
197    REAL(wp), PARAMETER :: q_increase = 1.5_wp  !< increase factor in timestep
198    REAL(wp), PARAMETER :: q_decrease = 0.9_wp  !< decrease factor in timestep
199    REAL(wp), PARAMETER :: gamma = 0.292893218814_wp !< = 1.0 - 1.0 / SQRT(2.0)
[849]200!
[1849]201!-- Parameters for terminal velocity
202    REAL(wp), PARAMETER ::  a_rog = 9.65_wp      !< parameter for fall velocity
203    REAL(wp), PARAMETER ::  b_rog = 10.43_wp     !< parameter for fall velocity
204    REAL(wp), PARAMETER ::  c_rog = 0.6_wp       !< parameter for fall velocity
205    REAL(wp), PARAMETER ::  k_cap_rog = 4.0_wp   !< parameter for fall velocity
206    REAL(wp), PARAMETER ::  k_low_rog = 12.0_wp  !< parameter for fall velocity
207    REAL(wp), PARAMETER ::  d0_rog = 0.745_wp    !< separation diameter
[849]208
[1849]209    REAL(wp), DIMENSION(number_of_particles) ::  ventilation_effect     !<
210    REAL(wp), DIMENSION(number_of_particles) ::  new_r                  !<
[849]211
[1849]212    CALL cpu_log( log_point_s(42), 'lpm_droplet_condens', 'start' )
[849]213
214!
[2312]215!-- Absolute temperature
[1849]216    t_int = pt(kp,jp,ip) * ( hyp(kp) / 100000.0_wp )**0.286_wp
[849]217!
[2312]218!-- Saturation vapor pressure (Eq. 10 in Bolton, 1980)
[2608]219    e_s = magnus( t_int )
[1849]220!
[2312]221!-- Current vapor pressure
222    e_a = q(kp,jp,ip) * hyp(kp) / ( q(kp,jp,ip) + 0.622_wp )
223!
224!-- Thermal conductivity for water (from Rogers and Yau, Table 7.1)
225    thermal_conductivity = 7.94048E-05_wp * t_int + 0.00227011_wp
226!
227!-- Moldecular diffusivity of water vapor in air (Hall und Pruppacher, 1976)
228    diff_coeff           = 0.211E-4_wp * ( t_int / 273.15_wp )**1.94_wp * &
229                           ( 101325.0_wp / hyp(kp) )
230!
231!-- Lengthscale for gas-kinetic effects (from Mordy, 1959, p. 23):
232    r0 = diff_coeff / 0.036_wp * SQRT( 2.0_wp * pi / ( r_v * t_int ) )
233!
234!-- Calculate effects of heat conductivity and diffusion of water vapor on the
235!-- diffusional growth process (usually known as 1.0 / (F_k + F_d) )
236    ddenom  = 1.0_wp / ( rho_l * r_v * t_int / ( e_s * diff_coeff ) +          &
[1849]237                         ( l_v / ( r_v * t_int ) - 1.0_wp ) * rho_l *          &
[2312]238                         l_v / ( thermal_conductivity * t_int )                &
[1849]239                       )
[1359]240    new_r = 0.0_wp
[1849]241!
242!-- Determine ventilation effect on evaporation of large drops
[1359]243    DO  n = 1, number_of_particles
[1849]244
245       IF ( particles(n)%radius >= 4.0E-5_wp  .AND.  e_a / e_s < 1.0_wp )  THEN
[849]246!
[1849]247!--       Terminal velocity is computed for vertical direction (Rogers et al.,
248!--       1993, J. Appl. Meteorol.)
249          diameter = particles(n)%radius * 2000.0_wp !diameter in mm
250          IF ( diameter <= d0_rog )  THEN
251             w_s = k_cap_rog * diameter * ( 1.0_wp - EXP( -k_low_rog * diameter ) )
252          ELSE
253             w_s = a_rog - b_rog * EXP( -c_rog * diameter )
254          ENDIF
[849]255!
[2312]256!--       Calculate droplet's Reynolds number
[1849]257          re_p = 2.0_wp * particles(n)%radius * w_s / molecular_viscosity
[1071]258!
[1359]259!--       Ventilation coefficient (Rogers and Yau, 1989):
260          IF ( re_p > 2.5_wp )  THEN
[1849]261             ventilation_effect(n) = 0.78_wp + 0.28_wp * SQRT( re_p )
[1071]262          ELSE
[1849]263             ventilation_effect(n) = 1.0_wp + 0.09_wp * re_p
[1071]264          ENDIF
[1849]265       ELSE
[1071]266!
[2312]267!--       For small droplets or in supersaturated environments, the ventilation
[1849]268!--       effect does not play a role
269          ventilation_effect(n) = 1.0_wp
[849]270       ENDIF
[1359]271    ENDDO
[849]272
[2312]273    IF( .NOT. curvature_solution_effects ) then
[849]274!
[2312]275!--    Use analytic model for diffusional growth including gas-kinetic
276!--    effects (Mordy, 1959) but without the impact of aerosols.
[1849]277       DO  n = 1, number_of_particles
[2312]278          arg      = ( particles(n)%radius + r0 )**2 + 2.0_wp * dt_3d * ddenom * &
279                                                       ventilation_effect(n) *   &
280                                                       ( e_a / e_s - 1.0_wp )
281          arg      = MAX( arg, ( 0.01E-6 + r0 )**2 )
282          new_r(n) = SQRT( arg ) - r0
[1849]283       ENDDO
[1359]284
[2312]285    ELSE
[1849]286!
[2312]287!--    Integrate the diffusional growth including gas-kinetic (Mordy, 1959),
288!--    as well as curvature and solute effects (e.g., Köhler, 1936).
[849]289!
[2312]290!--    Curvature effect (afactor) with surface tension (sigma) by Straka (2009)
291       sigma = 0.0761_wp - 0.000155_wp * ( t_int - 273.15_wp )
[1071]292!
[2312]293!--    Solute effect (afactor)
294       afactor = 2.0_wp * sigma / ( rho_l * r_v * t_int )
[849]295
[2312]296       DO  n = 1, number_of_particles
[849]297!
[2312]298!--       Solute effect (bfactor)
299          bfactor = vanthoff * rho_s * particles(n)%aux1**3 *                    &
300                    molecular_weight_of_water / ( rho_l * molecular_weight_of_solute )
[1071]301
[2312]302          dt_ros     = particles(n)%aux2  ! use previously stored Rosenbrock timestep
303          dt_ros_sum = 0.0_wp
[1871]304
[2312]305          r_ros     = particles(n)%radius  ! initialize Rosenbrock particle radius
306          r_ros_ini = r_ros
[849]307!
[2312]308!--       Integrate growth equation using a 2nd-order Rosenbrock method
309!--       (see Verwer et al., 1999, Eq. (3.2)). The Rosenbrock method adjusts
310!--       its with internal timestep to minimize the local truncation error.
311          DO WHILE ( dt_ros_sum < dt_3d )
[1071]312
[2312]313             dt_ros = MIN( dt_ros, dt_3d - dt_ros_sum )
[1871]314
[2312]315             DO
[849]316
[2312]317                drdt = ddenom * ventilation_effect(n) * ( e_a / e_s - 1.0 -    &
[1849]318                                                          afactor / r_ros +    &
319                                                          bfactor / r_ros**3   &
[2312]320                                                        ) / ( r_ros + r0 )
[1849]321
[2312]322                d2rdtdr = -ddenom * ventilation_effect(n) * (                  &
323                                                (e_a / e_s - 1.0) * r_ros**4 - &
324                                                afactor * r0 * r_ros**2 -      &
325                                                2.0 * afactor * r_ros**3 +     &
326                                                3.0 * bfactor * r0 +           &
327                                                4.0 * bfactor * r_ros          &
328                                                            )                  &
329                          / ( r_ros**4 * ( r_ros + r0 )**2 )
[849]330
[2312]331                k1    = drdt / ( 1.0 - gamma * dt_ros * d2rdtdr )
[849]332
[2312]333                r_ros = MAX(r_ros_ini + k1 * dt_ros, particles(n)%aux1)
334                r_err = r_ros
[849]335
[2312]336                drdt  = ddenom * ventilation_effect(n) * ( e_a / e_s - 1.0 -   &
337                                                           afactor / r_ros +   &
338                                                           bfactor / r_ros**3  &
339                                                         ) / ( r_ros + r0 )
[849]340
[2312]341                k2 = ( drdt - dt_ros * 2.0 * gamma * d2rdtdr * k1 ) / &
342                     ( 1.0 - dt_ros * gamma * d2rdtdr )
[849]343
[2312]344                r_ros = MAX(r_ros_ini + dt_ros * ( 1.5 * k1 + 0.5 * k2), particles(n)%aux1)
345   !
346   !--          Check error of the solution, and reduce dt_ros if necessary.
347                error = ABS(r_err - r_ros) / r_ros
348                IF ( error .GT. prec )  THEN
349                   dt_ros = SQRT( q_decrease * prec / error ) * dt_ros
350                   r_ros  = r_ros_ini
[849]351                ELSE
[2312]352                   dt_ros_sum = dt_ros_sum + dt_ros
353                   dt_ros     = q_increase * dt_ros
354                   r_ros_ini  = r_ros
355                   EXIT
[849]356                ENDIF
357
[2312]358             END DO
[849]359
[2312]360          END DO !Rosenbrock loop
[849]361!
[2312]362!--       Store new particle radius
363          new_r(n) = r_ros
[849]364!
[2312]365!--       Store internal time step value for next PALM step
366          particles(n)%aux2 = dt_ros
[849]367
[2312]368       ENDDO !Particle loop
[849]369
[2312]370    ENDIF
[849]371
[2312]372    DO  n = 1, number_of_particles
[849]373!
[2312]374!--    Sum up the change in liquid water for the respective grid
375!--    box for the computation of the release/depletion of water vapor
376!--    and heat.
[1890]377       ql_c(kp,jp,ip) = ql_c(kp,jp,ip) + particles(n)%weight_factor *          &
[1359]378                                   rho_l * 1.33333333_wp * pi *                &
379                                   ( new_r(n)**3 - particles(n)%radius**3 ) /  &
[3039]380                                   ( rho_surface * dx * dy * dzw(kp) )
[2312]381!
382!--    Check if the increase in liqid water is not too big. If this is the case,
383!--    the model timestep might be too long.
[1890]384       IF ( ql_c(kp,jp,ip) > 100.0_wp )  THEN
[3045]385          WRITE( message_string, * ) 'k=',kp,' j=',jp,' i=',ip,                &
386                       ' ql_c=',ql_c(kp,jp,ip), ' part(',n,')%wf=',            &
[849]387                       particles(n)%weight_factor,' delta_r=',delta_r
388          CALL message( 'lpm_droplet_condensation', 'PA0143', 2, 2, -1, 6, 1 )
389       ENDIF
390!
[2312]391!--    Check if the change in the droplet radius is not too big. If this is the
392!--    case, the model timestep might be too long.
393       delta_r = new_r(n) - particles(n)%radius
394       IF ( delta_r < 0.0_wp  .AND. new_r(n) < 0.0_wp )  THEN
[3045]395          WRITE( message_string, * ) '#1 k=',kp,' j=',jp,' i=',ip,             &
396                       ' e_s=',e_s, ' e_a=',e_a,' t_int=',t_int,               &
397                       ' delta_r=',delta_r,                                    &
[849]398                       ' particle_radius=',particles(n)%radius
399          CALL message( 'lpm_droplet_condensation', 'PA0144', 2, 2, -1, 6, 1 )
400       ENDIF
401!
402!--    Sum up the total volume of liquid water (needed below for
403!--    re-calculating the weighting factors)
[1890]404       ql_v(kp,jp,ip) = ql_v(kp,jp,ip) + particles(n)%weight_factor * new_r(n)**3
[849]405!
406!--    Determine radius class of the particle needed for collision
[2312]407       IF ( use_kernel_tables )  THEN
[1359]408          particles(n)%class = ( LOG( new_r(n) ) - rclass_lbound ) /           &
409                               ( rclass_ubound - rclass_lbound ) *             &
[849]410                               radius_classes
411          particles(n)%class = MIN( particles(n)%class, radius_classes )
412          particles(n)%class = MAX( particles(n)%class, 1 )
413       ENDIF
[2312]414 !
415 !--   Store new radius to particle features
416       particles(n)%radius = new_r(n)
[849]417
418    ENDDO
419
420    CALL cpu_log( log_point_s(42), 'lpm_droplet_condens', 'stop' )
421
422
423 END SUBROUTINE lpm_droplet_condensation
Note: See TracBrowser for help on using the repository browser.