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