[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 | ! |
---|
[1310] | 16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[849] | 19 | ! Current revisions: |
---|
| 20 | ! ------------------ |
---|
[1682] | 21 | ! Code annotations made doxygen readable |
---|
[1360] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: lpm_droplet_condensation.f90 1682 2015-10-07 23:56:08Z knoop $ |
---|
| 26 | ! |
---|
[1360] | 27 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 28 | ! New particle structure integrated. |
---|
| 29 | ! Kind definition added to all floating point numbers. |
---|
| 30 | ! |
---|
[1347] | 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 | ! |
---|
[1323] | 35 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 36 | ! REAL constants defined as wp-kind |
---|
| 37 | ! |
---|
[1321] | 38 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 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 |
---|
[1072] | 44 | ! |
---|
[1319] | 45 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 46 | ! module interfaces removed |
---|
| 47 | ! |
---|
[1093] | 48 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 49 | ! unused variables removed |
---|
| 50 | ! |
---|
[1072] | 51 | ! 1071 2012-11-29 16:54:55Z franke |
---|
[1071] | 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 |
---|
[849] | 62 | ! |
---|
[1037] | 63 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 64 | ! code put under GPL (PALM 3.9) |
---|
| 65 | ! |
---|
[850] | 66 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 67 | ! initial revision (former part of advec_particles) |
---|
[849] | 68 | ! |
---|
[850] | 69 | ! |
---|
[849] | 70 | ! Description: |
---|
| 71 | ! ------------ |
---|
[1682] | 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). |
---|
[849] | 78 | !------------------------------------------------------------------------------! |
---|
[1682] | 79 | SUBROUTINE lpm_droplet_condensation (ip,jp,kp) |
---|
| 80 | |
---|
[849] | 81 | |
---|
[1320] | 82 | USE arrays_3d, & |
---|
| 83 | ONLY: hyp, pt, q, ql_c, ql_v, zu |
---|
[849] | 84 | |
---|
[1320] | 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 |
---|
[849] | 88 | |
---|
[1320] | 89 | USE constants, & |
---|
| 90 | ONLY: pi |
---|
[849] | 91 | |
---|
[1320] | 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 |
---|
[849] | 97 | |
---|
[1320] | 98 | USE grid_variables, & |
---|
| 99 | ONLY: dx, ddx, dy, ddy |
---|
[1071] | 100 | |
---|
[1320] | 101 | USE lpm_collision_kernels_mod, & |
---|
| 102 | ONLY: rclass_lbound, rclass_ubound |
---|
[849] | 103 | |
---|
[1320] | 104 | USE kinds |
---|
| 105 | |
---|
| 106 | USE particle_attributes, & |
---|
[1359] | 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 |
---|
[1320] | 110 | |
---|
| 111 | |
---|
| 112 | IMPLICIT NONE |
---|
| 113 | |
---|
[1682] | 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 !< |
---|
[1320] | 125 | |
---|
[1682] | 126 | INTEGER(iwp), PARAMETER :: maxtry = 40 !< |
---|
[1320] | 127 | |
---|
[1682] | 128 | INTEGER(iwp), DIMENSION(0:7) :: end_index !< |
---|
| 129 | INTEGER(iwp), DIMENSION(0:7) :: start_index !< |
---|
[1320] | 130 | |
---|
[1682] | 131 | LOGICAL :: repeat !< |
---|
[1359] | 132 | |
---|
[1682] | 133 | LOGICAL, DIMENSION(number_of_particles) :: flag_1 !< |
---|
[1359] | 134 | |
---|
[1682] | 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 !< |
---|
[1320] | 169 | |
---|
[849] | 170 | !-- Parameters for Rosenbrock method |
---|
[1682] | 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 !< |
---|
[849] | 194 | |
---|
[1682] | 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 !< |
---|
[849] | 206 | |
---|
[1320] | 207 | |
---|
[849] | 208 | CALL cpu_log( log_point_s(42), 'lpm_droplet_condens', 'start' ) |
---|
| 209 | |
---|
[1359] | 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) |
---|
[849] | 224 | ! |
---|
| 225 | !-- Interpolate temperature and humidity. |
---|
[1359] | 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 |
---|
[849] | 233 | |
---|
[1359] | 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 ) |
---|
[849] | 237 | |
---|
[1359] | 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 ) |
---|
[849] | 241 | |
---|
[1359] | 242 | pt_int = pt_int_l + ( particles(n)%z - zu(k) ) / dz * & |
---|
| 243 | ( pt_int_u - pt_int_l ) |
---|
[849] | 244 | |
---|
[1359] | 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 ) |
---|
[849] | 248 | |
---|
[1359] | 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 ) |
---|
[849] | 252 | |
---|
[1359] | 253 | q_int = q_int_l + ( zv(n) - zu(k) ) / dz * & |
---|
| 254 | ( q_int_u - q_int_l ) |
---|
[849] | 255 | |
---|
| 256 | ! |
---|
[1359] | 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 |
---|
[849] | 261 | |
---|
[1359] | 262 | e_s(n) = 611.0_wp * EXP( l_d_rv * ( 3.6609E-3_wp - 1.0_wp / & |
---|
| 263 | t_int(n) ) ) |
---|
[849] | 264 | |
---|
| 265 | ! |
---|
[1359] | 266 | !-- Current vapor pressure |
---|
| 267 | e_a(n) = q_int * p_int(n) / ( 0.378_wp * q_int + 0.622_wp ) |
---|
[849] | 268 | |
---|
[1359] | 269 | ENDDO |
---|
| 270 | ENDDO |
---|
| 271 | |
---|
| 272 | new_r = 0.0_wp |
---|
| 273 | flag_1 = .false. |
---|
| 274 | |
---|
| 275 | DO n = 1, number_of_particles |
---|
[849] | 276 | ! |
---|
| 277 | !-- Change in radius by condensation/evaporation |
---|
[1359] | 278 | IF ( particles(n)%radius >= 4.0E-5_wp .AND. & |
---|
| 279 | e_a(n)/e_s(n) < 1.0_wp ) THEN |
---|
[849] | 280 | ! |
---|
[1359] | 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 |
---|
[1071] | 287 | ! |
---|
[1359] | 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 ) |
---|
[1071] | 291 | ELSE |
---|
[1359] | 292 | afactor_v(n) = 1.0_wp + 0.09_wp * re_p |
---|
[1071] | 293 | ENDIF |
---|
[1359] | 294 | flag_1(n) = .TRUE. |
---|
| 295 | ELSEIF ( particles(n)%radius >= 1.0E-6_wp .OR. & |
---|
[1071] | 296 | .NOT. curvature_solution_effects ) THEN |
---|
| 297 | ! |
---|
[1359] | 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. |
---|
[849] | 302 | ENDIF |
---|
[1359] | 303 | ENDDO |
---|
[849] | 304 | |
---|
[1359] | 305 | DO n = 1, number_of_particles |
---|
[849] | 306 | ! |
---|
[1359] | 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 | ! |
---|
[849] | 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. |
---|
[1071] | 336 | |
---|
| 337 | ros_count = 0 |
---|
| 338 | repeat = .TRUE. |
---|
[849] | 339 | ! |
---|
[1071] | 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. |
---|
[1359] | 343 | !-- Unreasonable results may occur if the external conditions, especially |
---|
| 344 | !-- the supersaturation, has significantly changed compared to the last |
---|
| 345 | !-- PALM timestep. |
---|
[1071] | 346 | DO WHILE ( repeat ) |
---|
[849] | 347 | |
---|
[1071] | 348 | repeat = .FALSE. |
---|
| 349 | ! |
---|
[1359] | 350 | !-- Surface tension (Straka, 2009): |
---|
| 351 | sigma = 0.0761_wp - 0.000155_wp * ( t_int(n) - 273.15_wp ) |
---|
[849] | 352 | |
---|
[1071] | 353 | r_ros = particles(n)%radius |
---|
[1359] | 354 | dt_ros_sum = 0.0_wp ! internal integrated time (s) |
---|
[1071] | 355 | internal_timestep_count = 0 |
---|
[849] | 356 | |
---|
[1359] | 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 | ) |
---|
[1071] | 363 | |
---|
[1359] | 364 | afactor = 2.0_wp * sigma / ( rho_l * r_v * t_int(n) ) |
---|
[1071] | 365 | |
---|
[849] | 366 | ! |
---|
[1071] | 367 | !-- Take internal time step values from the end of last PALM time step |
---|
| 368 | dt_ros_next = particles(n)%rvar1 |
---|
| 369 | |
---|
[849] | 370 | ! |
---|
[1071] | 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 |
---|
[1359] | 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 |
---|
[1071] | 376 | ENDIF |
---|
[849] | 377 | ! |
---|
[1071] | 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 |
---|
[1359] | 382 | dt_ros_next = dt_ros_next - ( 0.2_wp * dt_ros_next ) |
---|
[1071] | 383 | ELSEIF ( ros_count > 5 ) THEN |
---|
[849] | 384 | ! |
---|
[1071] | 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 | |
---|
[849] | 391 | ! |
---|
[1071] | 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 ) |
---|
[849] | 397 | |
---|
[1071] | 398 | internal_timestep_count = internal_timestep_count + 1 |
---|
[849] | 399 | |
---|
| 400 | ! |
---|
[1071] | 401 | !-- Derivative at starting value |
---|
[1359] | 402 | drdt = ddenom / r_ros * ( e_a(n) / e_s(n) - 1.0_wp - afactor / & |
---|
| 403 | r_ros + bfactor / r_ros**3 ) |
---|
[1071] | 404 | drdt_ini = drdt |
---|
| 405 | dt_ros_sum_ini = dt_ros_sum |
---|
| 406 | r_ros_ini = r_ros |
---|
[849] | 407 | |
---|
| 408 | ! |
---|
[1071] | 409 | !-- Calculate radial derivative of dr/dt |
---|
[1359] | 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 ) |
---|
[849] | 413 | ! |
---|
[1071] | 414 | !-- Adjust stepsize unless required accuracy is reached |
---|
| 415 | DO jtry = 1, maxtry+1 |
---|
[849] | 416 | |
---|
[1071] | 417 | IF ( jtry == maxtry+1 ) THEN |
---|
| 418 | message_string = 'maxtry > 40 in Rosenbrock method' |
---|
[1359] | 419 | CALL message( 'lpm_droplet_condensation', 'PA0347', 2, & |
---|
| 420 | 2, 0, 6, 0 ) |
---|
[1071] | 421 | ENDIF |
---|
[849] | 422 | |
---|
[1359] | 423 | aa = 1.0_wp / ( gam * dt_ros ) - d2rdtdr |
---|
[1071] | 424 | g1 = drdt_ini / aa |
---|
| 425 | r_ros = r_ros_ini + a21 * g1 |
---|
[1359] | 426 | drdt = ddenom / r_ros * ( e_a(n) / e_s(n) - 1.0_wp - & |
---|
| 427 | afactor / r_ros + & |
---|
[1071] | 428 | bfactor / r_ros**3 ) |
---|
[849] | 429 | |
---|
[1071] | 430 | g2 = ( drdt + c21 * g1 / dt_ros )& |
---|
| 431 | / aa |
---|
| 432 | r_ros = r_ros_ini + a31 * g1 + a32 * g2 |
---|
[1359] | 433 | drdt = ddenom / r_ros * ( e_a(n) / e_s(n) - 1.0_wp - & |
---|
| 434 | afactor / r_ros + & |
---|
[1071] | 435 | bfactor / r_ros**3 ) |
---|
[849] | 436 | |
---|
[1071] | 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 |
---|
[849] | 442 | |
---|
[1071] | 443 | dt_ros_sum = dt_ros_sum_ini + dt_ros |
---|
[849] | 444 | |
---|
[1071] | 445 | IF ( dt_ros_sum == dt_ros_sum_ini ) THEN |
---|
| 446 | message_string = 'zero stepsize in Rosenbrock method' |
---|
[1359] | 447 | CALL message( 'lpm_droplet_condensation', 'PA0348', 2, & |
---|
| 448 | 2, 0, 6, 0 ) |
---|
[1071] | 449 | ENDIF |
---|
[849] | 450 | ! |
---|
[1071] | 451 | !-- Calculate error |
---|
[1359] | 452 | err_ros = e1 * g1 + e2 * g2 + e3 * g3 + e4 * g4 |
---|
| 453 | errmax = 0.0_wp |
---|
[1071] | 454 | errmax = MAX( errmax, ABS( err_ros / r_ros_ini ) ) / eps_ros |
---|
[849] | 455 | ! |
---|
[1071] | 456 | !-- Leave loop if accuracy is sufficient, otherwise try again |
---|
| 457 | !-- with a reduced stepsize |
---|
[1359] | 458 | IF ( errmax <= 1.0_wp ) THEN |
---|
[1071] | 459 | EXIT |
---|
| 460 | ELSE |
---|
[1359] | 461 | dt_ros = SIGN( MAX( ABS( 0.9_wp * dt_ros * & |
---|
| 462 | errmax**pshrnk ), & |
---|
| 463 | shrnk * ABS( dt_ros ) ), dt_ros ) |
---|
[1071] | 464 | ENDIF |
---|
| 465 | |
---|
| 466 | ENDDO ! loop for stepsize adjustment |
---|
| 467 | |
---|
| 468 | ! |
---|
| 469 | !-- Calculate next internal time step |
---|
| 470 | IF ( errmax > errcon ) THEN |
---|
[1359] | 471 | dt_ros_next = 0.9_wp * dt_ros * errmax**pgrow |
---|
[849] | 472 | ELSE |
---|
[1071] | 473 | dt_ros_next = grow * dt_ros |
---|
[849] | 474 | ENDIF |
---|
| 475 | |
---|
[1071] | 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 |
---|
[849] | 483 | |
---|
[1071] | 484 | ENDDO |
---|
[849] | 485 | ! |
---|
[1071] | 486 | !-- Store internal time step value for next PALM step |
---|
| 487 | particles(n)%rvar1 = dt_ros_next |
---|
[849] | 488 | |
---|
[1359] | 489 | new_r(n) = r_ros |
---|
[849] | 490 | ! |
---|
[1071] | 491 | !-- Radius should not fall below 1E-8 because Rosenbrock method may |
---|
| 492 | !-- lead to errors otherwise |
---|
[1359] | 493 | new_r(n) = MAX( new_r(n), 1.0E-8_wp ) |
---|
[1071] | 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 |
---|
[1359] | 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. |
---|
[1071] | 502 | !-- Limiting values are tested for droplets down to 1.0E-7 |
---|
[1359] | 503 | IF ( new_r(n) - particles(n)%radius >= 3.0E-7_wp .AND. & |
---|
| 504 | e_a(n)/e_s(n) < 0.97_wp ) THEN |
---|
[1071] | 505 | ros_count = ros_count + 1 |
---|
| 506 | repeat = .TRUE. |
---|
[849] | 507 | ENDIF |
---|
| 508 | |
---|
[1071] | 509 | ENDDO ! Rosenbrock method |
---|
[849] | 510 | |
---|
| 511 | ENDIF |
---|
| 512 | |
---|
[1359] | 513 | delta_r = new_r(n) - particles(n)%radius |
---|
[849] | 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) |
---|
[1359] | 519 | i = ip |
---|
| 520 | j = jp |
---|
| 521 | k = kp |
---|
[849] | 522 | ! only exact if equidistant |
---|
| 523 | |
---|
[1359] | 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 ) / & |
---|
[849] | 527 | ( rho_surface * dx * dy * dz ) |
---|
[1359] | 528 | IF ( ql_c(k,j,i) > 100.0_wp ) THEN |
---|
[849] | 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 |
---|
[1359] | 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, & |
---|
[849] | 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) |
---|
[1359] | 549 | ql_v(k,j,i) = ql_v(k,j,i) + particles(n)%weight_factor * new_r(n)**3 |
---|
[849] | 550 | |
---|
[1359] | 551 | particles(n)%radius = new_r(n) |
---|
[849] | 552 | |
---|
| 553 | ! |
---|
| 554 | !-- Determine radius class of the particle needed for collision |
---|
[1359] | 555 | IF ( ( hall_kernel .OR. wang_kernel ) .AND. use_kernel_tables ) & |
---|
[849] | 556 | THEN |
---|
[1359] | 557 | particles(n)%class = ( LOG( new_r(n) ) - rclass_lbound ) / & |
---|
| 558 | ( rclass_ubound - rclass_lbound ) * & |
---|
[849] | 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 |
---|