The aero_state_t structure and assocated subroutines. More...
Classes | |
struct | aero_state_t |
The current collection of aerosol particles. More... | |
Functions | |
subroutine | aero_state_alloc (n_bin, n_spec, aero_state) |
Initializes aerosol arrays to have zero particles in each bin. Do not call this more than once on a given aerosol, use aero_state_zero() instead to reset to zero. | |
subroutine | aero_state_free (aero_state) |
Deallocates a previously allocated aerosol. | |
subroutine | aero_state_copy (aero_state_from, aero_state_to) |
Copies aerosol to a destination that has already had aero_state_alloc() called on it. | |
integer | aero_state_total_particles (aero_state) |
Returns the total number of particles in an aerosol distribution. | |
subroutine | aero_state_zero (aero_state) |
Resets an aero_state to have zero particles per bin. This must already have had aero_state_alloc() called on it. This function can be called more than once on the same state. | |
subroutine | aero_state_add_particle (aero_state, i_bin, aero_particle) |
Add the given particle. | |
subroutine | aero_state_remove_particle (aero_state, i_bin, index) |
Remove the given particle. | |
subroutine | aero_state_add (aero_state, aero_state_delta) |
aero_state += aero_state_delta | |
subroutine | aero_state_add_disc_mode (bin_grid, aero_data, vol_frac, bin_n, aero_state) |
Makes particles from the given number distribution and appends them to the aero_statev array. | |
subroutine | aero_dist_to_state (bin_grid, aero_data, aero_dist, n_part, aero_state) |
Convert a continuous distribution into particles. | |
subroutine | aero_dist_sample (bin_grid, aero_data, aero_dist, sample_prop, aero_state) |
Generates a Poisson sample of an aero_dist, adding to aero_state. The sampled amount is sample_prop * aero_statecomp_vol. | |
subroutine | aero_state_rand_particle (aero_state, i_bin, i_part) |
Choose a random particle from the aero_state. | |
subroutine | aero_state_sample (aero_state_from, aero_state_to, sample_prop) |
Generates a Poisson sample by removing particles from aero_state_from and adding them to aero_state_to, which must be already allocated (and should have its comp_vol set). | |
subroutine | aero_state_sample_rough (aero_state_from, aero_state_to, sample_prop) |
Generates a rough bin-wise sample by removing particles from aero_state_from and adding them to aero_state_to, which must be already allocated (and should have its comp_vol set). | |
subroutine | aero_state_add_particles (aero_state, aero_state_delta) |
Adds aero_state_delta particles to aero_state. The number of particles added depends on the computational volume ratio, so either more or less particles might be added than are actually in aero_state_delta. | |
subroutine | aero_state_to_binned (bin_grid, aero_data, aero_state, aero_binned) |
Create the bin number and mass arrays from aero_statev. | |
subroutine | aero_state_double (aero_state) |
Doubles number of particles. | |
subroutine | aero_state_halve (aero_state, aero_binned, bin_grid) |
Remove approximately half of the particles in each bin. | |
subroutine | aero_state_resort (bin_grid, aero_state) |
Takes an aero_state_t where the particles might no longer be in the correct bins and resorts it so that every particle is in the correct bin. | |
subroutine | aero_state_mix_to (aero_state, mix_rate, dest, aero_binned, aero_data, bin_grid) |
Send a sample to the given process, and receive exactly one sample from an unspecified source. | |
subroutine | aero_state_mix (aero_state, mix_rate, aero_binned, aero_data, bin_grid) |
Mix the aero_states between all processes. Currently uses a simple periodic-1D diffusion. | |
subroutine | aero_state_check (bin_grid, aero_binned, aero_data, aero_state) |
Check that all particles are in the correct bins and that the bin numbers and masses are correct. This is for debugging only. | |
subroutine | inout_write_aero_state (file, aero_state) |
Write full state. | |
subroutine | inout_read_aero_state (file, aero_state) |
Read full state. | |
integer | pmc_mpi_pack_size_aero_state (val) |
Determines the number of bytes required to pack the given value. | |
subroutine | pmc_mpi_pack_aero_state (buffer, position, val) |
Packs the given value into the buffer, advancing position. | |
subroutine | pmc_mpi_unpack_aero_state (buffer, position, val) |
Unpacks the given value from the buffer, advancing position. |
The aero_state_t structure and assocated subroutines.
subroutine pmc_aero_state::aero_dist_sample | ( | type(bin_grid_t),intent(in) | bin_grid, | |
type(aero_data_t),intent(in) | aero_data, | |||
type(aero_dist_t),intent(in) | aero_dist, | |||
real*8,intent(in) | sample_prop, | |||
type(aero_state_t),intent(inout) | aero_state | |||
) |
Generates a Poisson sample of an aero_dist, adding to aero_state. The sampled amount is sample_prop * aero_statecomp_vol.
bin_grid | Bin grid. | |
aero_data | Aero data values. | |
aero_dist | Distribution to sample. | |
sample_prop | Volume fraction to sample. | |
aero_state | Aero state to add to. |
subroutine pmc_aero_state::aero_dist_to_state | ( | type(bin_grid_t),intent(in) | bin_grid, | |
type(aero_data_t),intent(in) | aero_data, | |||
type(aero_dist_t),intent(in) | aero_dist, | |||
integer,intent(in) | n_part, | |||
type(aero_state_t),intent(out) | aero_state | |||
) |
Convert a continuous distribution into particles.
bin_grid | Bin grid. | |
aero_data | Aero_data data. | |
aero_dist | Aerosol distribution. | |
n_part | Total number of particles. | |
aero_state | Aerosol distribution (will be allocated). |
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
aero_state | Aerosol state. | |
aero_state_delta | Increment. |
subroutine pmc_aero_state::aero_state_add_disc_mode | ( | type(bin_grid_t),intent(in) | bin_grid, | |
type(aero_data_t),intent(in) | aero_data, | |||
real*8,dimension(aero_data%n_spec),intent(in) | vol_frac, | |||
integer,dimension(bin_grid%n_bin),intent(in) | bin_n, | |||
type(aero_state_t),intent(inout) | aero_state | |||
) |
Makes particles from the given number distribution and appends them to the aero_statev array.
bin_grid | Bin grid. | |
aero_data | Aero_data data. | |
vol_frac | Composition of particles. | |
bin_n | Number in bins. | |
aero_state | Aerosol, must be. |
subroutine pmc_aero_state::aero_state_add_particle | ( | type(aero_state_t),intent(inout) | aero_state, | |
integer,intent(in) | i_bin, | |||
type(aero_particle_t),intent(in) | aero_particle | |||
) |
Add the given particle.
aero_state | Aerosol state. | |
i_bin | Bin number of particle to remove. | |
aero_particle | Particle to add. |
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 | |||
) |
Adds aero_state_delta particles to aero_state. The number of particles added depends on the computational volume ratio, so either more or less particles might be added than are actually in aero_state_delta.
aero_state | Base state. | |
aero_state_delta | State to add. |
subroutine pmc_aero_state::aero_state_alloc | ( | integer,intent(in) | n_bin, | |
integer,intent(in) | n_spec, | |||
type(aero_state_t),intent(inout) | aero_state | |||
) |
Initializes aerosol arrays to have zero particles in each bin. Do not call this more than once on a given aerosol, use aero_state_zero() instead to reset to zero.
n_bin | Number of bins. | |
n_spec | Number of species. | |
aero_state | Aerosol to initialize. |
subroutine pmc_aero_state::aero_state_check | ( | type(bin_grid_t),intent(in) | bin_grid, | |
type(aero_binned_t),intent(out) | aero_binned, | |||
type(aero_data_t),intent(in) | aero_data, | |||
type(aero_state_t),intent(inout) | aero_state | |||
) |
Check that all particles are in the correct bins and that the bin numbers and masses are correct. This is for debugging only.
bin_grid | Bin_grid. | |
aero_binned | Binned distributions. | |
aero_data | Aerosol data. | |
aero_state | Aerosol state. |
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_alloc() called on it.
aero_state_from | Reference aerosol. | |
aero_state_to | Already allocated. |
subroutine pmc_aero_state::aero_state_double | ( | type(aero_state_t),intent(inout) | aero_state | ) |
Doubles number of particles.
aero_state | Aerosol state. |
subroutine pmc_aero_state::aero_state_free | ( | type(aero_state_t),intent(inout) | aero_state | ) |
Deallocates a previously allocated aerosol.
aero_state | Aerosol to initialize. |
subroutine pmc_aero_state::aero_state_halve | ( | type(aero_state_t),intent(inout) | aero_state, | |
type(aero_binned_t),intent(inout) | aero_binned, | |||
type(bin_grid_t),intent(in) | bin_grid | |||
) |
Remove approximately half of the particles in each bin.
aero_state | Aerosol state. | |
aero_binned | Aero binned. | |
bin_grid | Bin grid. |
subroutine pmc_aero_state::aero_state_mix | ( | type(aero_state_t),intent(inout) | aero_state, | |
real*8,intent(in) | mix_rate, | |||
type(aero_binned_t),intent(inout) | aero_binned, | |||
type(aero_data_t),intent(in) | aero_data, | |||
type(bin_grid_t),intent(in) | bin_grid | |||
) |
Mix the aero_states between all processes. Currently uses a simple periodic-1D diffusion.
aero_state | Aerosol state. | |
mix_rate | Mixing rate (0 to 1). | |
aero_binned | Aero binned to update. | |
aero_data | Aero data values. | |
bin_grid | Bin grid. |
subroutine pmc_aero_state::aero_state_mix_to | ( | type(aero_state_t),intent(inout) | aero_state, | |
real*8,intent(in) | mix_rate, | |||
integer,intent(in) | dest, | |||
type(aero_binned_t),intent(inout) | aero_binned, | |||
type(aero_data_t),intent(in) | aero_data, | |||
type(bin_grid_t),intent(in) | bin_grid | |||
) |
Send a sample to the given process, and receive exactly one sample from an unspecified source.
aero_state | Aerosol state. | |
mix_rate | Mixing rate (0 to 1). | |
dest | Process to send to. | |
aero_binned | Aero binned to update. | |
aero_data | Aero data values. | |
bin_grid | Bin grid. |
subroutine pmc_aero_state::aero_state_rand_particle | ( | type(aero_state_t),intent(in) | aero_state, | |
integer,intent(out) | i_bin, | |||
integer,intent(out) | i_part | |||
) |
Choose a random particle from the aero_state.
aero_state | Original state. | |
i_bin | Bin number of particle. | |
i_part | Particle number within bin. |
subroutine pmc_aero_state::aero_state_remove_particle | ( | type(aero_state_t),intent(inout) | aero_state, | |
integer,intent(in) | i_bin, | |||
integer,intent(in) | index | |||
) |
Remove the given particle.
aero_state | Aerosol state. | |
i_bin | Bin number of particle to remove. | |
index | Index in bin of particle to remove. |
subroutine pmc_aero_state::aero_state_resort | ( | type(bin_grid_t),intent(in) | bin_grid, | |
type(aero_state_t),intent(inout) | aero_state | |||
) |
Takes an aero_state_t where the particles might no longer be in the correct bins and resorts it so that every particle is in the correct bin.
bin_grid | Bin_grid. | |
aero_state | Aerosol state. |
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*8,intent(in) | sample_prop | |||
) |
Generates a Poisson sample by removing particles from aero_state_from and adding them to aero_state_to, which must be already allocated (and should have its comp_vol set).
aero_state_from | Original state. | |
aero_state_to | Destination state. | |
sample_prop | Proportion to sample. |
subroutine pmc_aero_state::aero_state_sample_rough | ( | type(aero_state_t),intent(inout) | aero_state_from, | |
type(aero_state_t),intent(inout) | aero_state_to, | |||
real*8,intent(in) | sample_prop | |||
) |
Generates a rough bin-wise sample by removing particles from aero_state_from and adding them to aero_state_to, which must be already allocated (and should have its comp_vol set).
aero_state_from | Original state. | |
aero_state_to | Destination state. | |
sample_prop | Proportion to sample. |
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(out) | aero_binned | |||
) |
Create the bin number and mass arrays from aero_statev.
bin_grid | Bin grid. | |
aero_data | Aerosol data. | |
aero_state | Aerosol state. | |
aero_binned | Binned distributions. |
integer pmc_aero_state::aero_state_total_particles | ( | type(aero_state_t),intent(in) | aero_state | ) |
Returns the total number of particles in an aerosol distribution.
aero_state | Aerosol state. |
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_alloc() called on it. This function can be called more than once on the same state.
aero_state | State to zero. |
subroutine pmc_aero_state::inout_read_aero_state | ( | type(inout_file_t),intent(inout) | file, | |
type(aero_state_t),intent(out) | aero_state | |||
) |
Read full state.
file | File to write to. | |
aero_state | Aero_state to read. |
subroutine pmc_aero_state::inout_write_aero_state | ( | type(inout_file_t),intent(inout) | file, | |
type(aero_state_t),intent(in) | aero_state | |||
) |
Write full state.
file | File to write to. | |
aero_state | Aero_state to write. |
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.
buffer | Memory buffer. | |
position | Current buffer position. | |
val | Value to pack. |
integer 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.
val | Value to pack. |
subroutine pmc_aero_state::pmc_mpi_unpack_aero_state | ( | character,dimension(:),intent(inout) | buffer, | |
integer,intent(inout) | position, | |||
type(aero_state_t),intent(out) | val | |||
) |
Unpacks the given value from the buffer, advancing position.
buffer | Memory buffer. | |
position | Current buffer position. | |
val | Value to pack. |