18 integer,
parameter :: NUCLEATE_TYPE_INVALID = 0
20 integer,
parameter :: NUCLEATE_TYPE_SULF_ACID = 1
23 character(len=AERO_SOURCE_NAME_LEN),
parameter :: NUCLEATE_SOURCE_NAME &
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
55 if (nucleate_type == nucleate_type_sulf_acid)
then
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
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
138 aero_state%awa%weight(i_group, i_class),
diam2rad(nucleate_diam))
140 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
155 env_state%elapsed_time)
156 aero_particle%vol(i_aero_so4) = so4_vol
165 h2so4_removed_conc = &
169 * aero_data%density(i_aero_so4) &
170 / aero_data%molec_weight(i_aero_so4) &
172 gas_state%mix_rat(i_gas_h2so4) = gas_state%mix_rat(i_gas_h2so4) &
174 if (gas_state%mix_rat(i_gas_h2so4) < 0d0)
then
175 gas_state%mix_rat(i_gas_h2so4) = 0d0
182 subroutine spec_file_read_nucleate_type(file, aero_data, nucleate_type, &
190 integer,
intent(out) :: nucleate_type
192 integer,
intent(out) :: nucleate_source
194 character(len=SPEC_LINE_MAX_VAR_LEN) :: nucleate_type_name
208 if (nucleate_type_name ==
'sulf_acid')
then
209 nucleate_type = nucleate_type_sulf_acid
211 nucleate_source_name)
214 // trim(nucleate_type_name))
217 end subroutine spec_file_read_nucleate_type
subroutine aero_particle_set_weight(aero_particle, i_group, i_class)
Sets the aerosol particle weight group.
real(kind=dp) function aero_weight_num_conc_at_radius(aero_weight, radius)
Compute the number concentration at a given radius (m^{-3}).
An input file with extra data for printing messages.
The aero_data_t structure and associated subroutines.
subroutine die_msg(code, error_msg)
Error immediately.
real(kind=dp) elemental function diam2vol(d)
Convert diameter (m) to volume (m^3).
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...
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 ...
subroutine aero_particle_deallocate(aero_particle)
Deallocates memory associated with an aero_particle_t.
The env_state_t structure and associated subroutines.
subroutine aero_particle_allocate_size(aero_particle, n_spec, n_source)
Allocates an aero_particle_t of the given size.
subroutine aero_particle_set_create_time(aero_particle, create_time)
Sets the creation times for the particle.
subroutine aero_state_add_particle(aero_state, aero_particle, allow_resort)
Add the given particle.
subroutine assert_msg(code, condition_ok, error_msg)
Errors unless condition_ok is true.
integer function aero_state_weight_class_for_source(aero_state, source)
Determine the appropriate weight class for a source.
The gas_data_t structure and associated subroutines.
real(kind=dp) elemental function diam2rad(d)
Convert diameter (m) to radius (m).
real(kind=dp) function env_state_conc_to_ppb(env_state, conc)
Convert (molecules m^{-3}) to (ppb).
Current environment state.
The aero_state_t structure and assocated subroutines.
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 spec_file_read_string(file, name, var)
Read a string from a spec file that must have a given name.
The gas_state_t structure and associated subroutines.
integer function rand_poisson(mean)
Generate a Poisson-distributed random number with the given mean.
character(len=pmc_util_convert_string_len) function integer_to_string(val)
Convert an integer to a string format.
The current collection of aerosol particles.
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...
Aerosol nucleation functions.
Single aerosol particle data structure.
subroutine aero_particle_new_id(aero_particle)
Assigns a globally-unique new ID number to the particle.
integer function aero_weight_array_n_group(aero_weight_array)
Return the number of weight groups.
subroutine spec_file_die_msg(code, file, msg)
Exit with an error message containing filename and line number.
Current state of the gas mixing ratios in the system.
real(kind=dp) function env_state_ppb_to_conc(env_state, ppb)
Convert (ppb) to (molecules m^{-3}).
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...
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.
subroutine aero_state_prepare_weight_for_add(aero_state, 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...