56 integer,
intent(in) :: coag_kernel_type
83 subroutine kernel(coag_kernel_type, aero_particle_1, aero_particle_2, &
84 aero_data, env_state, k)
87 integer,
intent(in) :: coag_kernel_type
97 real(kind=dp),
intent(out) :: k
100 call kernel_sedi(aero_particle_1, aero_particle_2, &
101 aero_data, env_state, k)
104 aero_data, env_state, k)
107 aero_data, env_state, k)
110 aero_data, env_state, k)
112 call kernel_zero(aero_particle_1, aero_particle_2, &
113 aero_data, env_state, k)
116 aero_data, env_state, k)
119 aero_data, env_state, k)
121 call die_msg(200724934,
"Unknown kernel type: " &
130 subroutine kernel_minmax(coag_kernel_type, v1, v2, aero_data, env_state, &
134 integer,
intent(in) :: coag_kernel_type
136 real(kind=dp),
intent(in) :: v1
138 real(kind=dp),
intent(in) :: v2
144 real(kind=dp),
intent(out) :: k_min
146 real(kind=dp),
intent(out) :: k_max
165 call die_msg(330498208,
"Unknown kernel type: " &
176 aero_particle_2, i_class, j_class, ij_class, aero_data, &
177 aero_weight_array, env_state, k)
180 integer,
intent(in) :: coag_kernel_type
186 integer,
intent(in) :: i_class
188 integer,
intent(in) :: j_class
190 integer,
intent(in) :: ij_class
198 real(kind=dp),
intent(out) :: k
200 real(kind=dp) :: unweighted_k, i_r, j_r
202 call kernel(coag_kernel_type, aero_particle_1, aero_particle_2, &
203 aero_data, env_state, unweighted_k)
207 i_r, j_r, i_class, j_class, ij_class)
216 subroutine bin_kernel(n_bin, bin_r, aero_data, coag_kernel_type, &
220 integer,
intent(in) :: n_bin
222 real(kind=dp),
intent(in) :: bin_r(n_bin)
226 integer,
intent(in) :: coag_kernel_type
230 real(kind=dp),
intent(out) :: k(n_bin,n_bin)
241 call kernel(coag_kernel_type, aero_particle_1, aero_particle_2, &
242 aero_data, env_state, k(i,j))
254 aero_data, env_state, k_min, k_max)
259 integer,
intent(in) :: coag_kernel_type
265 real(kind=dp),
intent(out) :: k_min(
bin_grid_size(bin_grid), &
266 bin_grid_size(bin_grid))
268 real(kind=dp),
intent(out) :: k_max(bin_grid_size(bin_grid), &
269 bin_grid_size(bin_grid))
273 do i = 1,bin_grid_size(bin_grid)
274 do j = 1,bin_grid_size(bin_grid)
276 i, j, aero_data, env_state, k_min(i,j), k_max(i,j))
287 b1, b2, aero_data, env_state, k_min, k_max)
292 integer,
intent(in) :: coag_kernel_type
294 integer,
intent(in) :: b1
296 integer,
intent(in) :: b2
302 real(kind=dp),
intent(out) :: k_min
304 real(kind=dp),
intent(out) :: k_max
307 integer,
parameter :: n_sample = 3
309 real(kind=dp),
parameter :: over_scale = 2d0
311 real(kind=dp) :: v1, v2, v1_high, v1_low, v2_high, v2_low
312 real(kind=dp) :: new_k_min, new_k_max
328 env_state, new_k_min, new_k_max)
329 if ((i == 1) .and. (j == 1))
then 333 k_min = min(k_min, new_k_min)
334 k_max = max(k_max, new_k_max)
339 k_max = k_max * over_scale
347 i_r, j_r, i_class, j_class, ij_class)
354 real(kind=dp),
intent(in) :: i_r
356 real(kind=dp),
intent(in) :: j_r
358 integer,
intent(in) :: i_class
360 integer,
intent(in) :: j_class
362 integer,
intent(in) :: ij_class
364 real(kind=dp) :: ij_r, i_nc, j_nc, ij_nc, nc_min
374 nc_min = min(i_nc, j_nc, ij_nc)
383 bin_grid, i_bin, j_bin, i_class, j_class)
392 integer,
intent(in) :: i_bin
394 integer,
intent(in) :: j_bin
396 integer,
intent(in) :: i_class
398 integer,
intent(in) :: j_class
400 real(kind=dp) :: i_r, j_r, ij_r, ij_nc_i, ij_nc_j
402 i_r = bin_grid%centers(i_bin)
403 j_r = bin_grid%centers(i_bin)
410 if (ij_nc_i < ij_nc_j)
then 423 bin_grid, i_bin, j_bin, i_class, j_class, ij_class, f_max)
432 integer,
intent(in) :: i_bin
434 integer,
intent(in) :: j_bin
436 integer,
intent(in) :: i_class
438 integer,
intent(in) :: j_class
440 integer,
intent(in) :: ij_class
442 real(kind=dp),
intent(out) :: f_max
444 integer,
parameter :: n_sample = 5
446 real(kind=dp) :: i_r_min, i_r_max, j_r_min, j_r_max, i_r, j_r, f
447 integer :: i_sample, j_sample
449 i_r_min = bin_grid%edges(i_bin)
450 i_r_max = bin_grid%edges(i_bin + 1)
451 j_r_min = bin_grid%edges(j_bin)
452 j_r_max = bin_grid%edges(j_bin + 1)
455 do i_sample = 1,n_sample
456 do j_sample = 1,n_sample
460 i_class, j_class, ij_class)
461 f_max = max(f_max, f)
471 subroutine spec_file_read_coag_kernel_type(file, coag_kernel_type)
476 integer,
intent(out) :: coag_kernel_type
478 character(len=SPEC_LINE_MAX_VAR_LEN) :: kernel_name
493 if (trim(kernel_name) ==
'sedi')
then 495 elseif (trim(kernel_name) ==
'additive')
then 497 elseif (trim(kernel_name) ==
'constant')
then 499 elseif (trim(kernel_name) ==
'brown')
then 501 elseif (trim(kernel_name) ==
'zero')
then 503 elseif (trim(kernel_name) ==
'brown_free')
then 505 elseif (trim(kernel_name) ==
'brown_cont')
then 509 "Unknown coagulation kernel type: " // trim(kernel_name))
512 end subroutine spec_file_read_coag_kernel_type
elemental real(kind=dp) function aero_particle_radius(aero_particle, aero_data)
Total radius of the particle (m).
An input file with extra data for printing messages.
integer, parameter coag_kernel_type_additive
Type code for an additive kernel.
subroutine kernel_zero(aero_particle_1, aero_particle_2, aero_data, env_state, k)
Zero coagulation kernel.
The aero_weight_array_t structure and associated subroutines.
integer, parameter coag_kernel_type_sedi
Type code for a sedimentation kernel.
subroutine kernel_sedi(aero_particle_1, aero_particle_2, aero_data, env_state, k)
Sedimentation coagulation kernel.
integer, parameter coag_kernel_type_brown
Type code for a Brownian kernel.
The bin_grid_t structure and associated subroutines.
real(kind=dp) elemental function aero_data_rad2vol(aero_data, r)
Convert geometric radius (m) to mass-equivalent volume (m^3).
integer, parameter coag_kernel_type_invalid
Type code for an undefined or invalid kernel.
subroutine kernel_brown_minmax(v1, v2, aero_data, env_state, k_min, k_max)
Compute the minimum and maximum Brownian coagulation kernel.
integer, parameter coag_kernel_type_len
Maximum length of a mode type.
The env_state_t structure and associated subroutines.
Constant kernel equal to zero.
Additive coagulation kernel.
Generic coagulation kernel.
The aero_particle_t structure and associated subroutines.
integer, parameter coag_kernel_type_brown_cont
Type code for a Brownian kernel in continuum regime from Vemury and Pratsinis [1995].
integer function coag_dest_class(aero_weight_array, aero_data, bin_grid, i_bin, j_bin, i_class, j_class)
Determine the weight class in which coagulated particles will be placed.
subroutine kernel_minmax(coag_kernel_type, v1, v2, aero_data, env_state, k_min, k_max)
Compute the minimum and maximum coagulation kernel.
real(kind=dp) function aero_weight_array_num_conc_at_radius(aero_weight_array, i_class, radius)
Compute the total number concentration at a given radius (m^3).
subroutine max_coag_num_conc_factor(aero_weight_array, aero_data, bin_grid, i_bin, j_bin, i_class, j_class, ij_class, f_max)
Determine the minimum and maximum number concentration factors for coagulation.
subroutine kernel_additive_minmax(v1, v2, aero_data, env_state, k_min, k_max)
Minimum and maximum values of the additive kernel.
integer, parameter coag_kernel_type_constant
Type code for a constant kernel.
subroutine kernel_constant_minmax(v1, v2, aero_data, env_state, k_min, k_max)
Minimum and maximum values of the constant coagulation kernel.
Current environment state.
subroutine kernel_additive(aero_particle_1, aero_particle_2, aero_data, env_state, k)
Additive coagulation kernel.
Brownian coagulation kernel in free molecular regime based on Vemury and Pratsinis [1995]...
An array of aerosol size distribution weighting functions.
subroutine die_msg(code, error_msg)
Error immediately.
subroutine est_k_minmax_for_bin_unweighted(bin_grid, coag_kernel_type, b1, b2, aero_data, env_state, k_min, k_max)
Samples within bins b1 and b2 to find the minimum and maximum value of the kernel between particles f...
character(len=coag_kernel_type_len) function coag_kernel_type_to_string(coag_kernel_type)
Return a string representation of a kernel type.
subroutine kernel_brown(aero_particle_1, aero_particle_2, aero_data, env_state, k)
Compute the Brownian coagulation kernel.
elemental integer function bin_grid_size(bin_grid)
Return the number of bins in the grid, or -1 if the bin grid is not allocated.
integer, parameter coag_kernel_type_brown_free
Type code for a Brownian kernel in free molecular regime from Vemury and Pratsinis [1995]...
subroutine kernel_brown_free(aero_particle_1, aero_particle_2, aero_data, env_state, k)
Compute the Brownian coagulation kernel in free molecular regime.
subroutine kernel_zero_minmax(v1, v2, aero_data, env_state, k_min, k_max)
Minimum and maximum of the zero coagulation kernel.
real(kind=dp) function coag_num_conc_factor(aero_weight_array, aero_data, i_r, j_r, i_class, j_class, ij_class)
Coagulation scale factor due to number concentrations.
subroutine spec_file_die_msg(code, file, msg)
Exit with an error message containing filename and line number.
subroutine kernel_constant(aero_particle_1, aero_particle_2, aero_data, env_state, k)
Constant coagulation kernel.
The aero_data_t structure and associated subroutines.
Constant coagulation kernel.
subroutine kernel_brown_cont_minmax(v1, v2, aero_data, env_state, k_min, k_max)
Compute the minimum and maximum Brownian coagulation kernel in continuum regime based on Vemury and P...
Single aerosol particle data structure.
1D grid, either logarithmic or linear.
Gravitational sedimentation coagulation kernel.
subroutine aero_particle_zero(aero_particle, aero_data)
Resets an aero_particle to be zero.
real(kind=dp) elemental function aero_data_vol2rad(aero_data, v)
Convert mass-equivalent volume (m^3) to geometric radius (m).
subroutine num_conc_weighted_kernel(coag_kernel_type, aero_particle_1, aero_particle_2, i_class, j_class, ij_class, aero_data, aero_weight_array, env_state, k)
Compute the kernel value with the given number concentration weighting.
subroutine kernel_brown_cont(aero_particle_1, aero_particle_2, aero_data, env_state, k)
Compute the Brownian coagulation kernel in continuum regime.
Brownian coagulation kernel in continuum regime based on Vemury and Pratsinis [1995].
subroutine spec_file_read_string(file, name, var)
Read a string from a spec file that must have a given name.
subroutine kernel_sedi_minmax(v1, v2, aero_data, env_state, k_min, k_max)
Minimum and maximum values of the sedimentation coagulation.
integer, parameter coag_kernel_type_zero
Type code for a zero kernel.
subroutine est_k_minmax_binned_unweighted(bin_grid, coag_kernel_type, aero_data, env_state, k_min, k_max)
Estimate an array of minimum and maximum kernel values. Given particles v1 in bin b1 and v2 in bin b2...
character(len=pmc_util_convert_string_len) function integer_to_string(val)
Convert an integer to a string format.
Aerosol material properties and associated data.
subroutine kernel_brown_free_minmax(v1, v2, aero_data, env_state, k_min, k_max)
Compute the minimum and maximum Brownian coagulation kernel in free molecular regime based on Vemury ...
subroutine kernel(coag_kernel_type, aero_particle_1, aero_particle_2, aero_data, env_state, k)
Evalulate a coagulation kernel function.
real(kind=dp) function interp_linear_disc(x_1, x_n, n, i)
Linear interpolation over discrete indices.
The aero_weight_t structure and associated subroutines.
Brownian coagulation kernel.
subroutine bin_kernel(n_bin, bin_r, aero_data, coag_kernel_type, env_state, k)
Computes an array of kernel values for each bin pair. k(i,j) is the kernel value at the centers of bi...