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