PartMC
2.3.0
|
The aero_state_t structure and assocated subroutines. More...
Data Types | |
type | aero_state_t |
The current collection of aerosol particles. More... | |
Public Member Functions | |
subroutine | aero_state_allocate (aero_state) |
Allocates aerosol arrays. More... | |
subroutine | aero_state_deallocate (aero_state) |
Deallocates a previously allocated aerosol. More... | |
subroutine | aero_state_reset (aero_state) |
Resets an aero_state to an empty state. More... | |
subroutine | aero_state_copy (aero_state_from, aero_state_to) |
Copies aerosol to a destination that has already had aero_state_allocate() called on it. 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. This must already have had aero_state_allocate() called on it. This function can be called more than once on the same state. More... | |
subroutine | aero_state_add_particle (aero_state, aero_particle, 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, 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) |
The number concentration of a single particle (m^{-3}). More... | |
subroutine | aero_state_num_conc_for_reweight (aero_state, reweight_num_conc) |
Save the correct number concentrations for later use by aero_state_reweight(). More... | |
subroutine | aero_state_reweight (aero_state, reweight_num_conc) |
Reweight all particles after their constituent volumes have been altered. More... | |
subroutine | aero_state_add (aero_state, aero_state_delta) |
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_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, 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, 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, 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%apa%n_part) | aero_state_ids (aero_state) |
Returns the IDs of all particles. More... | |
real(kind=dp) function, dimension(aero_state%apa%n_part) | aero_state_diameters (aero_state) |
Returns the diameters of all particles. More... | |
real(kind=dp) function, dimension(aero_state%apa%n_part) | aero_state_dry_diameters (aero_state, aero_data) |
Returns the dry diameters of all particles. More... | |
real(kind=dp) function, dimension(aero_state%apa%n_part) | aero_state_masses (aero_state, aero_data, include, exclude) |
Returns the masses of all particles. More... | |
real(kind=dp) function, dimension(aero_state%apa%n_part) | aero_state_num_concs (aero_state) |
Returns the number concentrations of all particles. More... | |
real(kind=dp) function | aero_state_total_num_conc (aero_state) |
Returns the total number concentration. More... | |
real(kind=dp) function, dimension(aero_state%apa%n_part) | aero_state_mass_entropies (aero_state, aero_data, include, exclude, group) |
Returns the mass-entropies of all particles. More... | |
real(kind=dp) function, dimension(aero_state%apa%n_part) | 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%apa%n_part) | 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, 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, 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, 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) |
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, bin_grid, all_procs_same) |
Sorts the particles if necessary. More... | |
subroutine | aero_state_check_sort (aero_state) |
Check that the sorted data is consistent. More... | |
Public Attributes | |
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... | |
The aero_state_t structure and assocated subroutines.
Definition at line 9 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_add | ( | type(aero_state_t), intent(inout) | aero_state, |
type(aero_state_t), intent(in) | aero_state_delta | ||
) |
aero_state += aero_state_delta
, including combining the weights, so the new concentration is the weighted average of the two concentrations.
[in,out] | aero_state | Aerosol state. |
[in] | aero_state_delta | Increment. |
Definition at line 611 of file aero_state.F90.
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.
[in,out] | aero_state | Aero state to add to. |
[in] | aero_data | Aero data values. |
[in] | aero_dist | Distribution to sample. |
[in] | sample_prop | Fraction to sample (1). |
[in] | create_time | Creation time for new particles (s). |
[in] | allow_doubling | Whether to allow doubling of the population. |
[in] | allow_halving | Whether to allow halving of the population. |
[out] | n_part_add | Number of particles added. |
Definition at line 694 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_add_particle | ( | type(aero_state_t), intent(inout) | aero_state, |
type(aero_particle_t), intent(in) | aero_particle, | ||
logical, intent(in), optional | allow_resort | ||
) |
Add the given particle.
[in,out] | aero_state | Aerosol state. |
[in] | aero_particle | Particle to add. |
[in] | allow_resort | Whether to allow a resort due to the add. |
Definition at line 330 of file aero_state.F90.
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 | ||
) |
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
.
[in,out] | aero_state | Aerosol state. |
[in] | aero_state_delta | Increment. |
Definition at line 628 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_allocate | ( | type(aero_state_t), intent(out) | aero_state | ) |
Allocates aerosol arrays.
[out] | aero_state | Aerosol to initialize. |
Definition at line 83 of file aero_state.F90.
real(kind=dp) function, dimension(aero_state%apa%n_part) 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).
[in] | aero_state | Aerosol state. |
[in] | aero_data | Aerosol data. |
[in] | env_state | Environment state. |
Return value.
Definition at line 1199 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state to average. |
[in] | bin_grid | Bin grid to average within. |
[in] | aero_data | Aerosol data. |
Definition at line 1644 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state to average. |
[in] | bin_grid | Bin grid to average within. |
[in] | aero_data | Aerosol data. |
[in] | bin_center | Whether to assign the bin center volume (rather than the average volume). |
[in] | preserve_number | Whether 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 1708 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_check_sort | ( | type(aero_state_t), intent(in) | aero_state | ) |
Check that the sorted data is consistent.
[in] | aero_state | Aerosol state to check. |
Definition at line 2723 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_copy | ( | type(aero_state_t), intent(in) | aero_state_from, |
type(aero_state_t), intent(inout) | aero_state_to | ||
) |
Copies aerosol to a destination that has already had aero_state_allocate() called on it.
[in] | aero_state_from | Reference aerosol. |
[in,out] | aero_state_to | Already allocated. |
Definition at line 131 of file aero_state.F90.
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
.
[in] | aero_state_from | Reference aerosol. |
[in,out] | aero_state_to | Already allocated. |
Definition at line 150 of file aero_state.F90.
real(kind=dp) function, dimension(aero_state%apa%n_part) 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).
[in] | aero_state | Aerosol state. |
[in] | aero_data | Aerosol data. |
[in] | env_state | Environment state. |
Return value.
Definition at line 1224 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_deallocate | ( | type(aero_state_t), intent(inout) | aero_state | ) |
Deallocates a previously allocated aerosol.
[in,out] | aero_state | Aerosol to deallocate. |
Definition at line 100 of file aero_state.F90.
real(kind=dp) function, dimension(aero_state%apa%n_part) pmc_aero_state::aero_state_diameters | ( | type(aero_state_t), intent(in) | aero_state | ) |
Returns the diameters of all particles.
[in] | aero_state | Aerosol state. |
Return diameters array (m).
Definition at line 976 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_double | ( | type(aero_state_t), intent(inout) | aero_state, |
integer, intent(in) | i_group, | ||
integer, intent(in) | i_class | ||
) |
Doubles number of particles in the given weight group.
[in,out] | aero_state | Aerosol state. |
[in] | i_group | Weight group to double. |
[in] | i_class | Weight class to double. |
Definition at line 1289 of file aero_state.F90.
real(kind=dp) function, dimension(aero_state%apa%n_part) 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.
[in] | aero_state | Aerosol state. |
[in] | aero_data | Aerosol data. |
Return value (m).
Definition at line 992 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_dup_particle | ( | type(aero_state_t), intent(inout) | aero_state, |
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
.
[in,out] | aero_state | Aerosol state. |
[in] | i_part | Particle number. |
[in] | n_part_mean | Mean number of resulting particles. |
[in] | random_weight_group | Whether particle copies should be placed in a randomly chosen weight group. |
Definition at line 450 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state. |
[in] | i_group | Weight group to halve. |
[in] | i_class | Weight class to halve. |
Definition at line 1321 of file aero_state.F90.
integer function, dimension(aero_state%apa%n_part) pmc_aero_state::aero_state_ids | ( | type(aero_state_t), intent(in) | aero_state | ) |
Returns the IDs of all particles.
[in] | aero_state | Aerosol state. |
Return value.
Definition at line 957 of file aero_state.F90.
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.
[in,out] | aero_state | aero_state to read. |
[in] | ncid | NetCDF file ID, in data mode. |
[in] | aero_data | aero_data structure. |
Definition at line 2510 of file aero_state.F90.
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).
[in,out] | aero_state | Aerosol state to make dry. |
[in] | aero_data | Aerosol data. |
Definition at line 1900 of file aero_state.F90.
real(kind=dp) function, dimension(aero_state%apa%n_part) 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 | ||
) |
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.
[in] | aero_state | Aerosol state. |
[in] | aero_data | Aerosol data. |
include | Species names to include in the mass. | |
exclude | Species names to exclude in the mass. | |
group | Species names to group together. |
Return value.
Definition at line 1121 of file aero_state.F90.
real(kind=dp) function, dimension(aero_state%apa%n_part) 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(:), optional | include, | ||
character(len=*), dimension(:), 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.
[in] | aero_state | Aerosol state. |
[in] | aero_data | Aerosol data. |
include | Species names to include in the mass. | |
exclude | Species names to exclude in the mass. |
Return masses array (kg).
Definition at line 1016 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state. |
[in] | del_t | Timestep (s). |
[in] | mix_timescale | Mixing timescale (s). |
[in] | aero_data | Aero data values. |
[in] | specify_prob_transfer | Transfer probability of each particle (0 means no mixing, 1 means total mixing). |
Definition at line 1483 of file aero_state.F90.
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.
[in] | send | Array of aero_states to send (one per process). |
[in,out] | recv | Array of aero_states to receives (one per process). |
Definition at line 1575 of file aero_state.F90.
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 | ||
) |
Gathers data from all processes into one aero_state on process 0.
[in] | aero_state | Local aero_state. |
[in,out] | aero_state_total | Centralized aero_state (only on process 0). |
Definition at line 2000 of file aero_state.F90.
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.
[in] | aero_state | aero_state structure. |
[in] | ncid | NetCDF file ID, in data mode. |
[out] | dimid_aero_particle | Dimid of the aero particle dimension. |
Definition at line 2073 of file aero_state.F90.
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.
[in] | aero_state | aero_state structure. |
[in] | ncid | NetCDF file ID, in data mode. |
[out] | dimid_aero_removed | Dimid of the aero removed dimension. |
Definition at line 2114 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_num_conc_for_reweight | ( | type(aero_state_t), intent(in) | aero_state, |
real(kind=dp), dimension(aero_state%apa%n_part), intent(out) | reweight_num_conc | ||
) |
Save the correct number concentrations for later use by aero_state_reweight().
[in] | aero_state | Aerosol state. |
[out] | reweight_num_conc | Number concentrations for later use by aero_state_reweight(). |
Definition at line 522 of file aero_state.F90.
real(kind=dp) function, dimension(aero_state%apa%n_part) pmc_aero_state::aero_state_num_concs | ( | type(aero_state_t), intent(in) | aero_state | ) |
Returns the number concentrations of all particles.
[in] | aero_state | Aerosol state. |
Return number concentrations array (m^{-3}).
Definition at line 1072 of file aero_state.F90.
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 | ||
) |
The number concentration of a single particle (m^{-3}).
[in] | aero_state | Aerosol state containing the particle. |
[in] | aero_particle | Aerosol particle. |
Definition at line 505 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_prepare_weight_for_add | ( | type(aero_state_t), intent(inout) | aero_state, |
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.
[in,out] | aero_state | Aero state to add to. |
[in] | i_group | Weight group number to add to. |
[in] | i_class | Weight class number to add to. |
[in] | n_add | Approximate number of particles to be added at current weighting. |
[in] | allow_doubling | Whether to allow doubling of the population. |
[in] | allow_halving | Whether to allow halving of the population. |
Definition at line 651 of file aero_state.F90.
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.
[in] | aero_state | Original state. |
[out] | i_part | Chosen random particle number. |
Definition at line 771 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_rebalance | ( | type(aero_state_t), intent(inout) | aero_state, |
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.
[in,out] | aero_state | Aerosol state. |
[in] | allow_doubling | Whether to allow doubling of the population. |
[in] | allow_halving | Whether to allow halving of the population. |
[in] | initial_state_warning | Whether to warn due to initial state doubling/halving. |
Definition at line 1356 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state. |
[in] | i_part | Index of particle to remove. |
[in] | record_removal | Whether to record the removal in the aero_info_array. |
[in] | aero_info | Removal info. |
Definition at line 389 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state. |
[in] | i_part | Index of particle to remove. |
Definition at line 351 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state. |
[in] | i_part | Index of particle to remove. |
[in] | aero_info | Removal info. |
Definition at line 370 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state. |
[in] | i_bin | Bin number to remove particle from. |
[in] | i_class | Weight class to remove particle from. |
[in,out] | aero_particle | Removed particle. |
Definition at line 414 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_reset | ( | type(aero_state_t), intent(inout) | aero_state | ) |
Resets an aero_state
to an empty state.
[in,out] | aero_state | Aerosol to reset. |
Definition at line 117 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_reweight | ( | type(aero_state_t), intent(inout) | aero_state, |
real(kind=dp), dimension(aero_state%apa%n_part), 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, reweight_num_conc) ... alter particle species volumes in aero_state ... call aero_state_reweight(aero_state, reweight_num_conc)
[in,out] | aero_state | Aerosol state. |
[in] | reweight_num_conc | Number concentrations previously computed by aero_state_num_conc_for_reweight(). |
Definition at line 550 of file aero_state.F90.
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, | ||
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().
[in,out] | aero_state_from | Original state. |
[in,out] | aero_state_to | Destination state (previous contents will be lost). |
[in] | sample_prob | Probability of sampling each particle. |
[in] | removal_action | Action for removal (see pmc_aero_info module for action parameters). Set to AERO_INFO_NONE to not log removal. |
Definition at line 866 of file aero_state.F90.
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, | ||
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().
[in,out] | aero_state_from | Original state. |
[in,out] | aero_state_to | Destination state. |
[in] | sample_prob | Probability of sampling each particle. |
[in] | removal_action | Action for removal (see pmc_aero_info module for action parameters). Set to AERO_INFO_NONE to not log removal. |
Definition at line 791 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_scale_weight | ( | type(aero_state_t), intent(inout) | aero_state, |
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.
[in,out] | aero_state | Aerosol state. |
[in] | i_group | Weight group number. |
[in] | i_class | Weight class number. |
[in] | weight_ratio | Ratio of new_weight / old_weight . |
[in] | allow_doubling | Whether to allow doubling of the population. |
[in] | allow_halving | Whether to allow halving of the population. |
Definition at line 1421 of file aero_state.F90.
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.
[in,out] | aero_state | Aerosol state (with aero_state%awa set). |
[in] | n_part | Ideal total number of particles. |
Definition at line 211 of file aero_state.F90.
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
.
[in,out] | aero_state | Aerosol to set the weights on. |
[in] | aero_data | Aerosol data. |
[in] | weight_type | Type of weighting scheme to use. |
[in] | exponent | Exponent for power-law weighting (only used if weight_type is AERO_STATE_WEIGHT_POWER ). |
Definition at line 164 of file aero_state.F90.
subroutine pmc_aero_state::aero_state_sort | ( | type(aero_state_t), intent(inout) | aero_state, |
type(bin_grid_t), intent(in), optional | bin_grid, | ||
logical, intent(in), optional | all_procs_same | ||
) |
Sorts the particles if necessary.
[in,out] | aero_state | Aerosol state to sort. |
[in] | bin_grid | Bin grid. |
[in] | all_procs_same | Whether all processors should use the same bin grid. |
Definition at line 2704 of file aero_state.F90.
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.
[in] | bin_grid | Bin grid. |
[in] | aero_data | Aerosol data. |
[in] | aero_state | Aerosol state. |
[in,out] | aero_binned | Binned distributions. |
Definition at line 917 of file aero_state.F90.
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.
[in] | bin_grid | Bin grid. |
[in] | aero_data | Aerosol data. |
[in] | aero_state | Aerosol state. |
[in,out] | aero_binned | Binned distributions. |
Definition at line 1248 of file aero_state.F90.
real(kind=dp) function pmc_aero_state::aero_state_total_num_conc | ( | type(aero_state_t), intent(in) | aero_state | ) |
Returns the total number concentration.
[in] | aero_state | Aerosol state. |
Definition at line 1093 of file aero_state.F90.
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.
[in] | aero_state | Aerosol state. |
[in] | i_group | Weight group. |
[in] | i_class | Weight class. |
Definition at line 255 of file aero_state.F90.
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.
[in] | aero_state | Aerosol state. |
[in] | i_group | Weight group. |
[in] | i_class | Weight class. |
Definition at line 293 of file aero_state.F90.
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.
[in] | aero_state | Aerosol state. |
[in] | source | Source to find the class for. |
Definition at line 231 of file aero_state.F90.
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. This must already have had aero_state_allocate() called on it. This function can be called more than once on the same state.
[in,out] | aero_state | State to zero. |
Definition at line 314 of file aero_state.F90.
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.
[in,out] | buffer | Memory buffer. |
[in,out] | position | Current buffer position. |
[in] | val | Value to pack. |
Definition at line 1947 of file aero_state.F90.
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.
[in] | val | Value to pack. |
Definition at line 1928 of file aero_state.F90.
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.
[in,out] | buffer | Memory buffer. |
[in,out] | position | Current buffer position. |
[in,out] | val | Value to pack. |
Definition at line 1973 of file aero_state.F90.
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.
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.
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.
integer, parameter pmc_aero_state::aero_state_weight_flat = 2 |
Single flat weighting scheme.
Definition at line 41 of file aero_state.F90.
integer, parameter pmc_aero_state::aero_state_weight_flat_source = 5 |
Flat weighting by source.
Definition at line 47 of file aero_state.F90.
integer, parameter pmc_aero_state::aero_state_weight_none = 1 |
Single flat weighting scheme.
Definition at line 39 of file aero_state.F90.
integer, parameter pmc_aero_state::aero_state_weight_nummass = 4 |
Coupled number/mass weighting scheme.
Definition at line 45 of file aero_state.F90.
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.
integer, parameter pmc_aero_state::aero_state_weight_power = 3 |
Power-law weighting scheme.
Definition at line 43 of file aero_state.F90.
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.