PartMC  2.6.1
Data Types | Functions/Subroutines | Variables
pmc_aero_state Module Reference

The aero_state_t structure and assocated subroutines. More...

Data Types

type  aero_state_t
 The current collection of aerosol particles. More...
 

Functions/Subroutines

elemental integer function aero_state_n_part (aero_state)
 Return the current number of particles. More...
 
subroutine aero_state_copy_weight (aero_state_from, aero_state_to)
 Copies weighting information for an aero_state. More...
 
subroutine aero_state_set_weight (aero_state, aero_data, weight_type, exponent)
 Sets the weighting functions for an aero_state. More...
 
subroutine aero_state_set_n_part_ideal (aero_state, n_part)
 Set the ideal number of particles to the given value. The aero_state%awa must be already set correctly. More...
 
integer function aero_state_weight_class_for_source (aero_state, source)
 Determine the appropriate weight class for a source. More...
 
integer function aero_state_total_particles (aero_state, i_group, i_class)
 Returns the total number of particles in an aerosol distribution. More...
 
integer function aero_state_total_particles_all_procs (aero_state, i_group, i_class)
 Returns the total number of particles across all processes. More...
 
subroutine aero_state_zero (aero_state)
 Resets an aero_state to have zero particles per bin. More...
 
subroutine aero_state_add_particle (aero_state, aero_particle, aero_data, allow_resort)
 Add the given particle. More...
 
subroutine aero_state_remove_particle_no_info (aero_state, i_part)
 Remove the given particle without recording it. More...
 
subroutine aero_state_remove_particle_with_info (aero_state, i_part, aero_info)
 Remove the given particle and record the removal. More...
 
subroutine aero_state_remove_particle (aero_state, i_part, record_removal, aero_info)
 Remove the given particle and possibly record the removal. More...
 
subroutine aero_state_remove_rand_particle_from_bin (aero_state, i_bin, i_class, aero_particle)
 Remove a randomly chosen particle from the given bin and return it. More...
 
subroutine aero_state_dup_particle (aero_state, aero_data, i_part, n_part_mean, random_weight_group)
 Add copies or remove a particle, with a given mean number of resulting particles. More...
 
real(kind=dp) function aero_state_particle_num_conc (aero_state, aero_particle, aero_data)
 The number concentration of a single particle (m^{-3}). More...
 
subroutine aero_state_num_conc_for_reweight (aero_state, aero_data, reweight_num_conc)
 Save the correct number concentrations for later use by aero_state_reweight(). More...
 
subroutine aero_state_reweight (aero_state, aero_data, reweight_num_conc)
 Reweight all particles after their constituent volumes have been altered. More...
 
subroutine aero_state_add (aero_state, aero_state_delta, aero_data)
 aero_state += aero_state_delta, including combining the weights, so the new concentration is the weighted average of the two concentrations. More...
 
subroutine aero_state_add_particles (aero_state, aero_state_delta, aero_data)
 aero_state += aero_state_delta, with the weight of aero_state left unchanged, so the new concentration is the sum of the two concentrations, computed with aero_state%awa. More...
 
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 will give the correct final particle number. More...
 
subroutine aero_state_add_aero_dist_sample (aero_state, aero_data, aero_dist, sample_prop, create_time, allow_doubling, allow_halving, n_part_add)
 Generates a Poisson sample of an aero_dist, adding to aero_state, with the given sample proportion. More...
 
subroutine aero_state_rand_particle (aero_state, i_part)
 Choose a random particle from the aero_state. More...
 
subroutine aero_state_sample_particles (aero_state_from, aero_state_to, aero_data, sample_prob, removal_action)
 Generates a random sample by removing particles from aero_state_from and adding them to aero_state_to, which must be already allocated (and should have its weight set). More...
 
subroutine aero_state_sample (aero_state_from, aero_state_to, aero_data, sample_prob, removal_action)
 Generates a random sample by removing particles from aero_state_from and adding them to aero_state_to, transfering weight as well. This is the equivalent of aero_state_add(). More...
 
subroutine aero_state_to_binned (bin_grid, aero_data, aero_state, aero_binned)
 Create binned number and mass arrays. More...
 
integer function, dimension(aero_state_n_part(aero_state)) aero_state_ids (aero_state)
 Returns the IDs of all particles. More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_diameters (aero_state, aero_data, include, exclude)
 Returns the diameters of all particles. More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_dry_diameters (aero_state, aero_data)
 Returns the dry diameters of all particles. More...
 
real(kind=dp) function, dimension( aero_state_n_part(aero_state)) aero_state_mobility_diameters (aero_state, aero_data, env_state)
 Returns the mobility diameters of all particles. More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_volumes (aero_state, aero_data, include, exclude)
 Returns the volumes of all particles. More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_masses (aero_state, aero_data, include, exclude)
 Returns the masses of all particles. More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_num_concs (aero_state, aero_data)
 Returns the number concentrations of all particles. More...
 
real(kind=dp) function aero_state_total_num_conc (aero_state, aero_data)
 Returns the total number concentration. More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_mass_entropies (aero_state, aero_data, include, exclude, group, groups)
 Returns the mass-entropies of all particles. More...
 
subroutine aero_state_mixing_state_metrics (aero_state, aero_data, d_alpha, d_gamma, chi, include, exclude, group, groups)
 Returns the mixing state metrics of the population. More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_approx_crit_rel_humids (aero_state, aero_data, env_state)
 Returns the approximate critical relative humidity for all particles (1). More...
 
real(kind=dp) function, dimension(aero_state_n_part(aero_state)) aero_state_crit_rel_humids (aero_state, aero_data, env_state)
 Returns the critical relative humidity for all particles (1). More...
 
subroutine aero_state_to_binned_dry (bin_grid, aero_data, aero_state, aero_binned)
 Does the same thing as aero_state_to_bin() but based on dry radius. More...
 
subroutine aero_state_double (aero_state, aero_data, i_group, i_class)
 Doubles number of particles in the given weight group. More...
 
subroutine aero_state_halve (aero_state, i_group, i_class)
 Remove approximately half of the particles in the given weight group. More...
 
subroutine aero_state_rebalance (aero_state, aero_data, allow_doubling, allow_halving, initial_state_warning)
 Double or halve the particle population in each weight group to maintain close to n_part_ideal particles per process, allocated equally amongst the weight groups. More...
 
subroutine aero_state_scale_weight (aero_state, aero_data, i_group, i_class, weight_ratio, allow_doubling, allow_halving)
 Scale the weighting of the given group/class by the given ratio, altering particle number as necessary to preserve the number concentration. More...
 
subroutine aero_state_mix (aero_state, del_t, mix_timescale, aero_data, specify_prob_transfer)
 Mix the aero_states between all processes. Currently uses a simple all-to-all diffusion. More...
 
subroutine aero_state_mpi_alltoall (send, recv)
 Do an MPI all-to-all transfer of aerosol states. More...
 
subroutine aero_state_bin_average_comp (aero_state, bin_grid, aero_data)
 Set each aerosol particle to have its original total volume, but species volume ratios given by the total species volume ratio within each bin. This preserves the (weighted) total species volume per bin as well as per-particle total volumes. More...
 
subroutine aero_state_bin_average_size (aero_state, bin_grid, aero_data, bin_center, preserve_number)
 Set each aerosol particle to have its original species ratios, but total volume given by the average volume of all particles within each bin. More...
 
subroutine aero_state_make_dry (aero_state, aero_data)
 Make all particles dry (water set to zero). More...
 
integer function pmc_mpi_pack_size_aero_state (val)
 Determines the number of bytes required to pack the given value. More...
 
subroutine pmc_mpi_pack_aero_state (buffer, position, val)
 Packs the given value into the buffer, advancing position. More...
 
subroutine pmc_mpi_unpack_aero_state (buffer, position, val)
 Unpacks the given value from the buffer, advancing position. More...
 
subroutine aero_state_mpi_gather (aero_state, aero_state_total, aero_data)
 Gathers data from all processes into one aero_state on process 0. More...
 
subroutine aero_state_netcdf_dim_aero_particle (aero_state, ncid, dimid_aero_particle)
 Write the aero particle dimension to the given NetCDF file if it is not already present and in any case return the associated dimid. More...
 
subroutine aero_state_netcdf_dim_aero_removed (aero_state, ncid, dimid_aero_removed)
 Write the aero removed dimension to the given NetCDF file if it is not already present and in any case return the associated dimid. More...
 
subroutine aero_state_input_netcdf (aero_state, ncid, aero_data)
 Read full state. More...
 
subroutine aero_state_sort (aero_state, aero_data, bin_grid, all_procs_same)
 Sorts the particles if necessary. More...
 
subroutine aero_state_check (aero_state, aero_data)
 Check that aerosol state data is consistent. More...
 
subroutine aero_state_initialize (aero_state, aero_data, camp_core)
 Initialize the aero_state_t variable with camp chem data. More...
 

Variables

integer, parameter aero_state_tag_mix = 4987
 MPI tag for mixing particles between processes. More...
 
integer, parameter aero_state_tag_gather = 4988
 MPI tag for gathering between processes. More...
 
integer, parameter aero_state_tag_scatter = 4989
 MPI tag for scattering between processes. More...
 
integer, parameter aero_state_weight_none = 1
 Single flat weighting scheme. More...
 
integer, parameter aero_state_weight_flat = 2
 Single flat weighting scheme. More...
 
integer, parameter aero_state_weight_power = 3
 Power-law weighting scheme. More...
 
integer, parameter aero_state_weight_nummass = 4
 Coupled number/mass weighting scheme. More...
 
integer, parameter aero_state_weight_flat_source = 5
 Flat weighting by source. More...
 
integer, parameter aero_state_weight_power_source = 6
 Power-law weighting by source. More...
 
integer, parameter aero_state_weight_nummass_source = 7
 Coupled number/mass weighting by source. More...
 

Detailed Description

The aero_state_t structure and assocated subroutines.

Function/Subroutine Documentation

◆ aero_state_add()

subroutine pmc_aero_state::aero_state_add ( type(aero_state_t), intent(inout)  aero_state,
type(aero_state_t), intent(in)  aero_state_delta,
type(aero_data_t), intent(in)  aero_data 
)

aero_state += aero_state_delta, including combining the weights, so the new concentration is the weighted average of the two concentrations.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_state_deltaIncrement.
[in]aero_dataAerosol data.

Definition at line 625 of file aero_state.F90.

◆ aero_state_add_aero_dist_sample()

subroutine pmc_aero_state::aero_state_add_aero_dist_sample ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
type(aero_dist_t), intent(in)  aero_dist,
real(kind=dp), intent(in)  sample_prop,
real(kind=dp), intent(in)  create_time,
logical, intent(in)  allow_doubling,
logical, intent(in)  allow_halving,
integer, intent(out), optional  n_part_add 
)

Generates a Poisson sample of an aero_dist, adding to aero_state, with the given sample proportion.

Parameters
[in,out]aero_stateAero state to add to.
[in]aero_dataAero data values.
[in]aero_distDistribution to sample.
[in]sample_propFraction to sample (1).
[in]create_timeCreation time for new particles (s).
[in]allow_doublingWhether to allow doubling of the population.
[in]allow_halvingWhether to allow halving of the population.
[out]n_part_addNumber of particles added.

Definition at line 714 of file aero_state.F90.

◆ aero_state_add_particle()

subroutine pmc_aero_state::aero_state_add_particle ( type(aero_state_t), intent(inout)  aero_state,
type(aero_particle_t), intent(in)  aero_particle,
type(aero_data_t), intent(in)  aero_data,
logical, intent(in), optional  allow_resort 
)

Add the given particle.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_particleParticle to add.
[in]aero_dataAerosol data.
[in]allow_resortWhether to allow a resort due to the add.

Definition at line 336 of file aero_state.F90.

◆ aero_state_add_particles()

subroutine pmc_aero_state::aero_state_add_particles ( type(aero_state_t), intent(inout)  aero_state,
type(aero_state_t), intent(in)  aero_state_delta,
type(aero_data_t), intent(in)  aero_data 
)

aero_state += aero_state_delta, with the weight of aero_state left unchanged, so the new concentration is the sum of the two concentrations, computed with aero_state%awa.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_state_deltaIncrement.
[in]aero_dataAerosol data.

Definition at line 644 of file aero_state.F90.

◆ aero_state_approx_crit_rel_humids()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_approx_crit_rel_humids ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
type(env_state_t), intent(in)  env_state 
)

Returns the approximate critical relative humidity for all particles (1).

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]env_stateEnvironment state.
Returns
Return value.

Definition at line 1456 of file aero_state.F90.

◆ aero_state_bin_average_comp()

subroutine pmc_aero_state::aero_state_bin_average_comp ( type(aero_state_t), intent(inout)  aero_state,
type(bin_grid_t), intent(in)  bin_grid,
type(aero_data_t), intent(in)  aero_data 
)

Set each aerosol particle to have its original total volume, but species volume ratios given by the total species volume ratio within each bin. This preserves the (weighted) total species volume per bin as well as per-particle total volumes.

Parameters
[in,out]aero_stateAerosol state to average.
[in]bin_gridBin grid to average within.
[in]aero_dataAerosol data.

Definition at line 1895 of file aero_state.F90.

◆ aero_state_bin_average_size()

subroutine pmc_aero_state::aero_state_bin_average_size ( type(aero_state_t), intent(inout)  aero_state,
type(bin_grid_t), intent(in)  bin_grid,
type(aero_data_t), intent(in)  aero_data,
logical, intent(in)  bin_center,
logical, intent(in)  preserve_number 
)

Set each aerosol particle to have its original species ratios, but total volume given by the average volume of all particles within each bin.

This does not preserve the total species volume per bin. If the bin_center parameter is .true. then the particles in each bin are set to have the bin center volume, rather than the average volume of the particles in that bin.

If the weighting function is not constant (AERO_WEIGHT_TYPE_NONE) then the averaging can be performed in either a number-preserving way or in a volume-preserving way. The volume-preserving way does not preserve species volume ratios in gernal, but will do so if the particle population has already been composition-averaged.

Parameters
[in,out]aero_stateAerosol state to average.
[in]bin_gridBin grid to average within.
[in]aero_dataAerosol data.
[in]bin_centerWhether to assign the bin center volume (rather than the average volume).
[in]preserve_numberWhether to use the number-preserving scheme (otherwise will use the volume-preserving scheme). This parameter has no effect if bin_center is .true.

Definition at line 1958 of file aero_state.F90.

◆ aero_state_check()

subroutine pmc_aero_state::aero_state_check ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data 
)

Check that aerosol state data is consistent.

Parameters
[in]aero_stateAerosol state to check.
[in]aero_dataAerosol data.

Definition at line 2959 of file aero_state.F90.

◆ aero_state_copy_weight()

subroutine pmc_aero_state::aero_state_copy_weight ( type(aero_state_t), intent(in)  aero_state_from,
type(aero_state_t), intent(inout)  aero_state_to 
)

Copies weighting information for an aero_state.

Parameters
[in]aero_state_fromReference aerosol.
[in,out]aero_state_toAlready allocated.

Definition at line 157 of file aero_state.F90.

◆ aero_state_crit_rel_humids()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_crit_rel_humids ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
type(env_state_t), intent(in)  env_state 
)

Returns the critical relative humidity for all particles (1).

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]env_stateEnvironment state.
Returns
Return value.

Definition at line 1482 of file aero_state.F90.

◆ aero_state_diameters()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_diameters ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
character(len=*), dimension(:), intent(in), optional  include,
character(len=*), dimension(:), intent(in), optional  exclude 
)

Returns the diameters of all particles.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]includeSpecies names to include in the diameter.
[in]excludeSpecies names to exclude in the diameter.
Returns
Return diameters array (m).

Per-particle volume of included components

Definition at line 992 of file aero_state.F90.

◆ aero_state_double()

subroutine pmc_aero_state::aero_state_double ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
integer, intent(in)  i_group,
integer, intent(in)  i_class 
)

Doubles number of particles in the given weight group.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]i_groupWeight group to double.
[in]i_classWeight class to double.

Definition at line 1547 of file aero_state.F90.

◆ aero_state_dry_diameters()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_dry_diameters ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data 
)

Returns the dry diameters of all particles.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
Returns
Return value (m).

Definition at line 1017 of file aero_state.F90.

◆ aero_state_dup_particle()

subroutine pmc_aero_state::aero_state_dup_particle ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
integer, intent(in)  i_part,
real(kind=dp), intent(in)  n_part_mean,
logical, intent(in), optional  random_weight_group 
)

Add copies or remove a particle, with a given mean number of resulting particles.

The particle number i_part is either removed, or zero or more copies are added, with a random number of copies with the given mean n_part_mean. The final number of particles is either floor(n_part_mean) or ceiling(n_part_mean), chosen randomly so the mean is n_part_mean.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]i_partParticle number.
[in]n_part_meanMean number of resulting particles.
[in]random_weight_groupWhether particle copies should be placed in a randomly chosen weight group.

Definition at line 459 of file aero_state.F90.

◆ aero_state_halve()

subroutine pmc_aero_state::aero_state_halve ( type(aero_state_t), intent(inout)  aero_state,
integer, intent(in)  i_group,
integer, intent(in)  i_class 
)

Remove approximately half of the particles in the given weight group.

Parameters
[in,out]aero_stateAerosol state.
[in]i_groupWeight group to halve.
[in]i_classWeight class to halve.

Definition at line 1578 of file aero_state.F90.

◆ aero_state_ids()

integer function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_ids ( type(aero_state_t), intent(in)  aero_state)

Returns the IDs of all particles.

Parameters
[in]aero_stateAerosol state.
Returns
Return value.

Definition at line 973 of file aero_state.F90.

◆ aero_state_initialize()

subroutine pmc_aero_state::aero_state_initialize ( type(aero_state_t), intent(inout)  aero_state,
class(aero_data_t), intent(in)  aero_data,
type(camp_core_t), intent(in)  camp_core 
)

Initialize the aero_state_t variable with camp chem data.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]camp_coreCAMP core.

Definition at line 2982 of file aero_state.F90.

◆ aero_state_input_netcdf()

subroutine pmc_aero_state::aero_state_input_netcdf ( type(aero_state_t), intent(inout)  aero_state,
integer, intent(in)  ncid,
type(aero_data_t), intent(in)  aero_data 
)

Read full state.

Parameters
[in,out]aero_stateaero_state to read.
[in]ncidNetCDF file ID, in data mode.
[in]aero_dataaero_data structure.

Definition at line 2782 of file aero_state.F90.

◆ aero_state_make_dry()

subroutine pmc_aero_state::aero_state_make_dry ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data 
)

Make all particles dry (water set to zero).

Parameters
[in,out]aero_stateAerosol state to make dry.
[in]aero_dataAerosol data.

Definition at line 2156 of file aero_state.F90.

◆ aero_state_mass_entropies()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_mass_entropies ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
character(len=*), dimension(:), optional  include,
character(len=*), dimension(:), optional  exclude,
character(len=*), dimension(:), optional  group,
character(len=*), dimension(:,:), optional  groups 
)

Returns the mass-entropies of all particles.

If include is specified then only those species are included in computing the entropy. If exclude is specified then all species except those species are included. If both include and exclude arguments are specified then only those species in include but not in exclude are included. If group is specified then the species are divided into two sets, given by those in the group and those not in the group. The entropy is then computed using the total mass of each set. Alternatively groups can be specified, which lists several groups of species.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
includeSpecies names to include in the mass.
excludeSpecies names to exclude in the mass.
groupSpecies names to group together.
groupsSets of species names to group together.
Returns
Return value.

Definition at line 1243 of file aero_state.F90.

◆ aero_state_masses()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_masses ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
character(len=*), dimension(:), intent(in), optional  include,
character(len=*), dimension(:), intent(in), optional  exclude 
)

Returns the masses of all particles.

If include is specified then only those species are included in computing the masses. If exclude is specified then all species except those species are included. If both include and exclude arguments are specified then only those species in include but not in exclude are included.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]includeSpecies names to include in the mass.
[in]excludeSpecies names to exclude in the mass.
Returns
Return masses array (kg).

Definition at line 1132 of file aero_state.F90.

◆ aero_state_mix()

subroutine pmc_aero_state::aero_state_mix ( type(aero_state_t), intent(inout)  aero_state,
real(kind=dp), intent(in)  del_t,
real(kind=dp), intent(in)  mix_timescale,
type(aero_data_t), intent(in)  aero_data,
real(kind=dp), intent(in), optional  specify_prob_transfer 
)

Mix the aero_states between all processes. Currently uses a simple all-to-all diffusion.

Parameters
[in,out]aero_stateAerosol state.
[in]del_tTimestep (s).
[in]mix_timescaleMixing timescale (s).
[in]aero_dataAero data values.
[in]specify_prob_transferTransfer probability of each particle (0 means no mixing, 1 means total mixing).

Definition at line 1741 of file aero_state.F90.

◆ aero_state_mixing_state_metrics()

subroutine pmc_aero_state::aero_state_mixing_state_metrics ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
real(kind=dp), intent(out)  d_alpha,
real(kind=dp), intent(out)  d_gamma,
real(kind=dp), intent(out)  chi,
character(len=*), dimension(:), optional  include,
character(len=*), dimension(:), optional  exclude,
character(len=*), dimension(:), optional  group,
character(len=*), dimension(:,:), optional  groups 
)

Returns the mixing state metrics of the population.

If include is specified then only those species are included in computing the entropies. If exclude is specified then all species except those species are included. If both include and exclude arguments are specified then only those species in include but not in exclude are included. If group is specified then the species are divided into two sets, given by those in the group and those not in the group. The entropies are then computed using the total mass of each set. Alternatively groups can be specified, which lists several groups of species. If groups is provided, only species explicitly listed will be included.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[out]d_alphaAverage particle diversity.
[out]d_gammaBulk diversity.
[out]chiMixing state index.
includeSpecies names to include in the mass.
excludeSpecies names to exclude in the mass.
groupSpecies names to group together.
groupsSets of species names to group together.

Definition at line 1377 of file aero_state.F90.

◆ aero_state_mobility_diameters()

real(kind=dp) function, dimension( aero_state_n_part(aero_state)) pmc_aero_state::aero_state_mobility_diameters ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
type(env_state_t), intent(in)  env_state 
)

Returns the mobility diameters of all particles.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]env_stateEnvironment state.
Returns
Return value (m).

Definition at line 1035 of file aero_state.F90.

◆ aero_state_mpi_alltoall()

subroutine pmc_aero_state::aero_state_mpi_alltoall ( type(aero_state_t), dimension(:), intent(in)  send,
type(aero_state_t), dimension(size(send)), intent(inout)  recv 
)

Do an MPI all-to-all transfer of aerosol states.

States without particles are not sent.

Parameters
[in]sendArray of aero_states to send (one per process).
[in,out]recvArray of aero_states to receives (one per process).

Definition at line 1826 of file aero_state.F90.

◆ aero_state_mpi_gather()

subroutine pmc_aero_state::aero_state_mpi_gather ( type(aero_state_t), intent(in)  aero_state,
type(aero_state_t), intent(inout)  aero_state_total,
type(aero_data_t), intent(in)  aero_data 
)

Gathers data from all processes into one aero_state on process 0.

Parameters
[in]aero_stateLocal aero_state.
[in,out]aero_state_totalCentralized aero_state (only on process 0).
[in]aero_dataAero data values.

Definition at line 2257 of file aero_state.F90.

◆ aero_state_n_part()

elemental integer function pmc_aero_state::aero_state_n_part ( type(aero_state_t), intent(in)  aero_state)

Return the current number of particles.

Parameters
[in]aero_stateAerosol state.

Definition at line 87 of file aero_state.F90.

◆ aero_state_netcdf_dim_aero_particle()

subroutine pmc_aero_state::aero_state_netcdf_dim_aero_particle ( type(aero_state_t), intent(in)  aero_state,
integer, intent(in)  ncid,
integer, intent(out)  dimid_aero_particle 
)

Write the aero particle dimension to the given NetCDF file if it is not already present and in any case return the associated dimid.

Parameters
[in]aero_stateaero_state structure.
[in]ncidNetCDF file ID, in data mode.
[out]dimid_aero_particleDimid of the aero particle dimension.

Definition at line 2330 of file aero_state.F90.

◆ aero_state_netcdf_dim_aero_removed()

subroutine pmc_aero_state::aero_state_netcdf_dim_aero_removed ( type(aero_state_t), intent(in)  aero_state,
integer, intent(in)  ncid,
integer, intent(out)  dimid_aero_removed 
)

Write the aero removed dimension to the given NetCDF file if it is not already present and in any case return the associated dimid.

Parameters
[in]aero_stateaero_state structure.
[in]ncidNetCDF file ID, in data mode.
[out]dimid_aero_removedDimid of the aero removed dimension.

Definition at line 2371 of file aero_state.F90.

◆ aero_state_num_conc_for_reweight()

subroutine pmc_aero_state::aero_state_num_conc_for_reweight ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data,
real(kind=dp), dimension(aero_state_n_part(aero_state)), intent(out)  reweight_num_conc 
)

Save the correct number concentrations for later use by aero_state_reweight().

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[out]reweight_num_concNumber concentrations for later use by aero_state_reweight().

Definition at line 529 of file aero_state.F90.

◆ aero_state_num_concs()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_num_concs ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data 
)

Returns the number concentrations of all particles.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
Returns
Return number concentrations array (m^{-3}).

Definition at line 1189 of file aero_state.F90.

◆ aero_state_particle_num_conc()

real(kind=dp) function pmc_aero_state::aero_state_particle_num_conc ( type(aero_state_t), intent(in)  aero_state,
type(aero_particle_t), intent(in)  aero_particle,
type(aero_data_t), intent(in)  aero_data 
)

The number concentration of a single particle (m^{-3}).

Parameters
[in]aero_stateAerosol state containing the particle.
[in]aero_particleAerosol particle.
[in]aero_dataAerosol data.

Definition at line 509 of file aero_state.F90.

◆ aero_state_prepare_weight_for_add()

subroutine pmc_aero_state::aero_state_prepare_weight_for_add ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
integer, intent(in)  i_group,
integer, intent(in)  i_class,
real(kind=dp), intent(in)  n_add,
logical, intent(in)  allow_doubling,
logical, intent(in)  allow_halving 
)

Change the weight if necessary to ensure that the addition of about n_add computational particles will give the correct final particle number.

Parameters
[in,out]aero_stateAero state to add to.
[in]aero_dataAerosol data.
[in]i_groupWeight group number to add to.
[in]i_classWeight class number to add to.
[in]n_addApproximate number of particles to be added at current weighting.
[in]allow_doublingWhether to allow doubling of the population.
[in]allow_halvingWhether to allow halving of the population.

Definition at line 669 of file aero_state.F90.

◆ aero_state_rand_particle()

subroutine pmc_aero_state::aero_state_rand_particle ( type(aero_state_t), intent(in)  aero_state,
integer, intent(out)  i_part 
)

Choose a random particle from the aero_state.

Parameters
[in]aero_stateOriginal state.
[out]i_partChosen random particle number.

Definition at line 787 of file aero_state.F90.

◆ aero_state_rebalance()

subroutine pmc_aero_state::aero_state_rebalance ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
logical, intent(in)  allow_doubling,
logical, intent(in)  allow_halving,
logical, intent(in)  initial_state_warning 
)

Double or halve the particle population in each weight group to maintain close to n_part_ideal particles per process, allocated equally amongst the weight groups.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]allow_doublingWhether to allow doubling of the population.
[in]allow_halvingWhether to allow halving of the population.
[in]initial_state_warningWhether to warn due to initial state doubling/halving.

Definition at line 1611 of file aero_state.F90.

◆ aero_state_remove_particle()

subroutine pmc_aero_state::aero_state_remove_particle ( type(aero_state_t), intent(inout)  aero_state,
integer, intent(in)  i_part,
logical, intent(in)  record_removal,
type(aero_info_t), intent(in)  aero_info 
)

Remove the given particle and possibly record the removal.

Parameters
[in,out]aero_stateAerosol state.
[in]i_partIndex of particle to remove.
[in]record_removalWhether to record the removal in the aero_info_array.
[in]aero_infoRemoval info.

Definition at line 398 of file aero_state.F90.

◆ aero_state_remove_particle_no_info()

subroutine pmc_aero_state::aero_state_remove_particle_no_info ( type(aero_state_t), intent(inout)  aero_state,
integer, intent(in)  i_part 
)

Remove the given particle without recording it.

Parameters
[in,out]aero_stateAerosol state.
[in]i_partIndex of particle to remove.

Definition at line 360 of file aero_state.F90.

◆ aero_state_remove_particle_with_info()

subroutine pmc_aero_state::aero_state_remove_particle_with_info ( type(aero_state_t), intent(inout)  aero_state,
integer, intent(in)  i_part,
type(aero_info_t), intent(in)  aero_info 
)

Remove the given particle and record the removal.

Parameters
[in,out]aero_stateAerosol state.
[in]i_partIndex of particle to remove.
[in]aero_infoRemoval info.

Definition at line 379 of file aero_state.F90.

◆ aero_state_remove_rand_particle_from_bin()

subroutine pmc_aero_state::aero_state_remove_rand_particle_from_bin ( type(aero_state_t), intent(inout)  aero_state,
integer, intent(in)  i_bin,
integer, intent(in)  i_class,
type(aero_particle_t), intent(inout)  aero_particle 
)

Remove a randomly chosen particle from the given bin and return it.

Parameters
[in,out]aero_stateAerosol state.
[in]i_binBin number to remove particle from.
[in]i_classWeight class to remove particle from.
[in,out]aero_particleRemoved particle.

Definition at line 423 of file aero_state.F90.

◆ aero_state_reweight()

subroutine pmc_aero_state::aero_state_reweight ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
real(kind=dp), dimension(aero_state_n_part(aero_state)), intent(in)  reweight_num_conc 
)

Reweight all particles after their constituent volumes have been altered.

The pattern for use should be like:

 call aero_state_num_conc_for_reweight(aero_state, aero_data,
      reweight_num_conc)
 ... alter particle species volumes in aero_state ...
 call aero_state_reweight(aero_state, aero_data, reweight_num_conc)
 
Parameters
[in,out]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]reweight_num_concNumber concentrations previously computed by aero_state_num_conc_for_reweight().

Definition at line 562 of file aero_state.F90.

◆ aero_state_sample()

subroutine pmc_aero_state::aero_state_sample ( type(aero_state_t), intent(inout)  aero_state_from,
type(aero_state_t), intent(inout)  aero_state_to,
type(aero_data_t), intent(in)  aero_data,
real(kind=dp), intent(in)  sample_prob,
integer, intent(in)  removal_action 
)

Generates a random sample by removing particles from aero_state_from and adding them to aero_state_to, transfering weight as well. This is the equivalent of aero_state_add().

Parameters
[in,out]aero_state_fromOriginal state.
[in,out]aero_state_toDestination state (previous contents will be lost).
[in]aero_dataAerosol data.
[in]sample_probProbability of sampling each particle.
[in]removal_actionAction for removal (see pmc_aero_info module for action parameters). Set to AERO_INFO_NONE to not log removal.

Definition at line 882 of file aero_state.F90.

◆ aero_state_sample_particles()

subroutine pmc_aero_state::aero_state_sample_particles ( type(aero_state_t), intent(inout)  aero_state_from,
type(aero_state_t), intent(inout)  aero_state_to,
type(aero_data_t), intent(in)  aero_data,
real(kind=dp), intent(in)  sample_prob,
integer, intent(in)  removal_action 
)

Generates a random sample by removing particles from aero_state_from and adding them to aero_state_to, which must be already allocated (and should have its weight set).

None of the weights are altered by this sampling, making this the equivalent of aero_state_add_particles().

Parameters
[in,out]aero_state_fromOriginal state.
[in,out]aero_state_toDestination state.
[in]aero_dataAerosol data.
[in]sample_probProbability of sampling each particle.
[in]removal_actionAction for removal (see pmc_aero_info module for action parameters). Set to AERO_INFO_NONE to not log removal.

Definition at line 807 of file aero_state.F90.

◆ aero_state_scale_weight()

subroutine pmc_aero_state::aero_state_scale_weight ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
integer, intent(in)  i_group,
integer, intent(in)  i_class,
real(kind=dp), intent(in)  weight_ratio,
logical, intent(in)  allow_doubling,
logical, intent(in)  allow_halving 
)

Scale the weighting of the given group/class by the given ratio, altering particle number as necessary to preserve the number concentration.

Parameters
[in,out]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]i_groupWeight group number.
[in]i_classWeight class number.
[in]weight_ratioRatio of new_weight / old_weight.
[in]allow_doublingWhether to allow doubling of the population.
[in]allow_halvingWhether to allow halving of the population.

Definition at line 1678 of file aero_state.F90.

◆ aero_state_set_n_part_ideal()

subroutine pmc_aero_state::aero_state_set_n_part_ideal ( type(aero_state_t), intent(inout)  aero_state,
real(kind=dp), intent(in)  n_part 
)

Set the ideal number of particles to the given value. The aero_state%awa must be already set correctly.

Parameters
[in,out]aero_stateAerosol state (with aero_state%awa set).
[in]n_partIdeal total number of particles.

Definition at line 217 of file aero_state.F90.

◆ aero_state_set_weight()

subroutine pmc_aero_state::aero_state_set_weight ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
integer, intent(in)  weight_type,
real(kind=dp), intent(in), optional  exponent 
)

Sets the weighting functions for an aero_state.

Parameters
[in,out]aero_stateAerosol to set the weights on.
[in]aero_dataAerosol data.
[in]weight_typeType of weighting scheme to use.
[in]exponentExponent for power-law weighting (only used if weight_type is AERO_STATE_WEIGHT_POWER).

Definition at line 171 of file aero_state.F90.

◆ aero_state_sort()

subroutine pmc_aero_state::aero_state_sort ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data,
type(bin_grid_t), intent(in), optional  bin_grid,
logical, intent(in), optional  all_procs_same 
)

Sorts the particles if necessary.

Parameters
[in,out]aero_stateAerosol state to sort.
[in]aero_dataAerosol data.
[in]bin_gridBin grid.
[in]all_procs_sameWhether all processors should use the same bin grid.

Definition at line 2938 of file aero_state.F90.

◆ aero_state_to_binned()

subroutine pmc_aero_state::aero_state_to_binned ( type(bin_grid_t), intent(in)  bin_grid,
type(aero_data_t), intent(in)  aero_data,
type(aero_state_t), intent(in)  aero_state,
type(aero_binned_t), intent(inout)  aero_binned 
)

Create binned number and mass arrays.

Parameters
[in]bin_gridBin grid.
[in]aero_dataAerosol data.
[in]aero_stateAerosol state.
[in,out]aero_binnedBinned distributions.

Definition at line 933 of file aero_state.F90.

◆ aero_state_to_binned_dry()

subroutine pmc_aero_state::aero_state_to_binned_dry ( type(bin_grid_t), intent(in)  bin_grid,
type(aero_data_t), intent(in)  aero_data,
type(aero_state_t), intent(in)  aero_state,
type(aero_binned_t), intent(inout)  aero_binned 
)

Does the same thing as aero_state_to_bin() but based on dry radius.

Parameters
[in]bin_gridBin grid.
[in]aero_dataAerosol data.
[in]aero_stateAerosol state.
[in,out]aero_binnedBinned distributions.

Definition at line 1506 of file aero_state.F90.

◆ aero_state_total_num_conc()

real(kind=dp) function pmc_aero_state::aero_state_total_num_conc ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in)  aero_data 
)

Returns the total number concentration.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.

Definition at line 1212 of file aero_state.F90.

◆ aero_state_total_particles()

integer function pmc_aero_state::aero_state_total_particles ( type(aero_state_t), intent(in)  aero_state,
integer, intent(in), optional  i_group,
integer, intent(in), optional  i_class 
)

Returns the total number of particles in an aerosol distribution.

Parameters
[in]aero_stateAerosol state.
[in]i_groupWeight group.
[in]i_classWeight class.

Definition at line 263 of file aero_state.F90.

◆ aero_state_total_particles_all_procs()

integer function pmc_aero_state::aero_state_total_particles_all_procs ( type(aero_state_t), intent(in)  aero_state,
integer, intent(in), optional  i_group,
integer, intent(in), optional  i_class 
)

Returns the total number of particles across all processes.

Parameters
[in]aero_stateAerosol state.
[in]i_groupWeight group.
[in]i_classWeight class.

Definition at line 301 of file aero_state.F90.

◆ aero_state_volumes()

real(kind=dp) function, dimension(aero_state_n_part(aero_state)) pmc_aero_state::aero_state_volumes ( type(aero_state_t), intent(in)  aero_state,
type(aero_data_t), intent(in), optional  aero_data,
character(len=*), dimension(:), intent(in), optional  include,
character(len=*), dimension(:), intent(in), optional  exclude 
)

Returns the volumes of all particles.

If include is specified then only those species are included in computing the volumes. If exclude is specified then all species except those species are included. If both include and exclude arguments are specified then only those species in include but not in exclude are included.

Parameters
[in]aero_stateAerosol state.
[in]aero_dataAerosol data.
[in]includeSpecies names to include in the mass.
[in]excludeSpecies names to exclude in the mass.
Returns
Return volumes array (m^3).

Definition at line 1067 of file aero_state.F90.

◆ aero_state_weight_class_for_source()

integer function pmc_aero_state::aero_state_weight_class_for_source ( type(aero_state_t), intent(in)  aero_state,
integer, intent(in)  source 
)

Determine the appropriate weight class for a source.

Parameters
[in]aero_stateAerosol state.
[in]sourceSource to find the class for.

Definition at line 239 of file aero_state.F90.

◆ aero_state_zero()

subroutine pmc_aero_state::aero_state_zero ( type(aero_state_t), intent(inout)  aero_state)

Resets an aero_state to have zero particles per bin.

Parameters
[in,out]aero_stateState to zero.

Definition at line 320 of file aero_state.F90.

◆ pmc_mpi_pack_aero_state()

subroutine pmc_aero_state::pmc_mpi_pack_aero_state ( character, dimension(:), intent(inout)  buffer,
integer, intent(inout)  position,
type(aero_state_t), intent(in)  val 
)

Packs the given value into the buffer, advancing position.

Parameters
[in,out]bufferMemory buffer.
[in,out]positionCurrent buffer position.
[in]valValue to pack.

Definition at line 2204 of file aero_state.F90.

◆ pmc_mpi_pack_size_aero_state()

integer function pmc_aero_state::pmc_mpi_pack_size_aero_state ( type(aero_state_t), intent(in)  val)

Determines the number of bytes required to pack the given value.

Parameters
[in]valValue to pack.

Definition at line 2185 of file aero_state.F90.

◆ pmc_mpi_unpack_aero_state()

subroutine pmc_aero_state::pmc_mpi_unpack_aero_state ( character, dimension(:), intent(inout)  buffer,
integer, intent(inout)  position,
type(aero_state_t), intent(inout)  val 
)

Unpacks the given value from the buffer, advancing position.

Parameters
[in,out]bufferMemory buffer.
[in,out]positionCurrent buffer position.
[in,out]valValue to pack.

Definition at line 2230 of file aero_state.F90.

Variable Documentation

◆ aero_state_tag_gather

integer, parameter pmc_aero_state::aero_state_tag_gather = 4988

MPI tag for gathering between processes.

Definition at line 34 of file aero_state.F90.

◆ aero_state_tag_mix

integer, parameter pmc_aero_state::aero_state_tag_mix = 4987

MPI tag for mixing particles between processes.

Definition at line 32 of file aero_state.F90.

◆ aero_state_tag_scatter

integer, parameter pmc_aero_state::aero_state_tag_scatter = 4989

MPI tag for scattering between processes.

Definition at line 36 of file aero_state.F90.

◆ aero_state_weight_flat

integer, parameter pmc_aero_state::aero_state_weight_flat = 2

Single flat weighting scheme.

Definition at line 41 of file aero_state.F90.

◆ aero_state_weight_flat_source

integer, parameter pmc_aero_state::aero_state_weight_flat_source = 5

Flat weighting by source.

Definition at line 47 of file aero_state.F90.

◆ aero_state_weight_none

integer, parameter pmc_aero_state::aero_state_weight_none = 1

Single flat weighting scheme.

Definition at line 39 of file aero_state.F90.

◆ aero_state_weight_nummass

integer, parameter pmc_aero_state::aero_state_weight_nummass = 4

Coupled number/mass weighting scheme.

Definition at line 45 of file aero_state.F90.

◆ aero_state_weight_nummass_source

integer, parameter pmc_aero_state::aero_state_weight_nummass_source = 7

Coupled number/mass weighting by source.

Definition at line 51 of file aero_state.F90.

◆ aero_state_weight_power

integer, parameter pmc_aero_state::aero_state_weight_power = 3

Power-law weighting scheme.

Definition at line 43 of file aero_state.F90.

◆ aero_state_weight_power_source

integer, parameter pmc_aero_state::aero_state_weight_power_source = 6

Power-law weighting by source.

Definition at line 49 of file aero_state.F90.