Go to the documentation of this file.
31 subroutine nucleate(nucleate_type, nucleate_source, env_state, gas_data, &
32 aero_data, aero_state, gas_state, del_t, allow_doubling, allow_halving)
35 integer,
intent(in) :: nucleate_type
37 integer,
intent(in) :: nucleate_source
49 real(kind=
dp),
intent(in) :: del_t
51 logical,
intent(in) :: allow_doubling
53 logical,
intent(in) :: allow_halving
57 aero_data, aero_state, gas_state, del_t, allow_doubling, &
61 "unknown nucleation type: " &
84 aero_data, aero_state, gas_state, del_t, allow_doubling, allow_halving)
87 integer,
intent(in) :: nucleate_source
99 real(kind=
dp),
intent(in) :: del_t
101 logical,
intent(in) :: allow_doubling
103 logical,
intent(in) :: allow_halving
105 real(kind=
dp),
parameter :: nucleate_coeff = 1d-18
106 real(kind=
dp),
parameter :: nucleate_diam = 1d-9
109 integer :: i_gas_h2so4, i_aero_so4, n_samp, i_samp, i_bin, i_group, n_group
111 real(kind=
dp) :: sulf_acid_conc, nucleate_rate, n_samp_avg
112 real(kind=
dp) :: total_so4_vol, so4_vol, h2so4_removed_conc
113 type(aero_particle_t) :: aero_particle
118 "nucleate_sulf_acid requires H2SO4 as a gas species")
121 "nucleate_sulf_acid requires SO4 as an aerosol species")
125 gas_state%mix_rat(i_gas_h2so4))
128 nucleate_rate = nucleate_coeff * sulf_acid_conc**2
135 do i_group = 1,aero_weight_array_n_group(aero_state%awa)
138 aero_state%awa%weight(i_group, i_class),
diam2rad(nucleate_diam))
140 i_group, i_class, n_samp_avg, allow_doubling, allow_halving)
144 aero_state%awa%weight(i_group, i_class),
diam2rad(nucleate_diam))
150 total_so4_vol = total_so4_vol + so4_vol
152 call aero_particle_zero(aero_particle, aero_data)
153 call aero_particle_set_create_time(aero_particle, &
154 env_state%elapsed_time)
155 aero_particle%vol(i_aero_so4) = so4_vol
156 call aero_particle_new_id(aero_particle)
157 call aero_particle_set_weight(aero_particle, i_group, i_class)
163 h2so4_removed_conc = &
165 * aero_weight_array_num_conc_at_radius(aero_state%awa, i_class, &
167 * aero_data%density(i_aero_so4) &
168 / aero_data%molec_weight(i_aero_so4) &
170 gas_state%mix_rat(i_gas_h2so4) = gas_state%mix_rat(i_gas_h2so4) &
172 if (gas_state%mix_rat(i_gas_h2so4) < 0d0)
then
173 gas_state%mix_rat(i_gas_h2so4) = 0d0
180 subroutine spec_file_read_nucleate_type(file, aero_data, nucleate_type, &
188 integer,
intent(out) :: nucleate_type
190 integer,
intent(out) :: nucleate_source
192 character(len=SPEC_LINE_MAX_VAR_LEN) :: nucleate_type_name
206 if (nucleate_type_name ==
'sulf_acid')
then
212 // trim(nucleate_type_name))
215 end subroutine spec_file_read_nucleate_type
character(len=aero_source_name_len), parameter nucleate_source_name
Source name for nucleated particles.
Aerosol nucleation functions.
integer function aero_data_source_by_name(aero_data, name)
Returns the number of the source in aero_data with the given name, or adds the source if it doesn't e...
The gas_data_t structure and associated subroutines.
integer function rand_poisson(mean)
Generate a Poisson-distributed random number with the given mean.
subroutine die_msg(code, error_msg)
Error immediately.
integer, parameter dp
Kind of a double precision real number.
subroutine aero_state_add_particle(aero_state, aero_particle, aero_data, allow_resort)
Add the given particle.
Current environment state.
The aero_state_t structure and assocated subroutines.
real(kind=dp) function env_state_conc_to_ppb(env_state, conc)
Convert (molecules m^{-3}) to (ppb).
An input file with extra data for printing messages.
integer, parameter nucleate_type_sulf_acid
Type code for H2SO4 to SO4 nucleation with quadratic rate.
The gas_state_t structure and associated subroutines.
character(len=pmc_util_convert_string_len) function integer_to_string(val)
Convert an integer to a string format.
subroutine assert_msg(code, condition_ok, error_msg)
Errors unless condition_ok is true.
real(kind=dp) elemental function diam2rad(d)
Convert diameter (m) to radius (m).
integer function aero_state_weight_class_for_source(aero_state, source)
Determine the appropriate weight class for a source.
real(kind=dp) function aero_weight_num_conc_at_radius(aero_weight, radius)
Compute the number concentration at a given radius (m^{-3}).
type(const_t), save const
Fixed variable for accessing the constant's values.
The env_state_t structure and associated subroutines.
Current state of the gas mixing ratios in the system.
subroutine nucleate(nucleate_type, nucleate_source, env_state, gas_data, aero_data, aero_state, gas_state, del_t, allow_doubling, allow_halving)
Do nucleation of the type given by the first argument.
Aerosol material properties and associated data.
integer function gas_data_spec_by_name(gas_data, name)
Returns the number of the species in gas with the given name, or returns 0 if there is no such specie...
subroutine spec_file_die_msg(code, file, msg)
Exit with an error message containing filename and line number.
subroutine spec_file_read_string(file, name, var)
Read a string from a spec file that must have a given name.
subroutine nucleate_sulf_acid(nucleate_source, env_state, gas_data, aero_data, aero_state, gas_state, del_t, allow_doubling, allow_halving)
Nucleate sulfuric acid into aerosol particles, using a power-law dependence, for time del_t.
The aero_data_t structure and associated subroutines.
subroutine aero_state_prepare_weight_for_add(aero_state, aero_data, i_group, i_class, n_add, allow_doubling, allow_halving)
Change the weight if necessary to ensure that the addition of about n_add computational particles wil...
real(kind=dp) function env_state_ppb_to_conc(env_state, ppb)
Convert (ppb) to (molecules m^{-3}).
integer, parameter nucleate_type_invalid
Type code for unknown or invalid nucleation type.
The current collection of aerosol particles.
integer function aero_data_spec_by_name(aero_data, name)
Returns the number of the species in aero_data with the given name, or returns 0 if there is no such ...
real(kind=dp) elemental function aero_data_diam2vol(aero_data, d)
Convert geometric diameter (m) to mass-equivalent volume (m^3).