PartMC 2.1.1
Data Types | Functions/Subroutines | Variables
pmc_coagulation_dist Module Reference

Parallel aerosol particle coagulation with MPI. More...

Data Types

type  request_t
 A single outstanding request for a remote particle. More...

Functions/Subroutines

subroutine request_allocate (request)
subroutine request_deallocate (request)
 Deallocate a request object and set it to be invalid.
logical request_is_active (request)
 Whether the given reqest object is currectly active.
subroutine mc_coag_dist (coag_kernel_type, bin_grid, env_state, aero_data, aero_weight, aero_state, del_t, k_max, tot_n_samp, tot_n_coag)
 Do coagulation for time del_t.
subroutine coag_dist_recv (requests, bin_grid, env_state, aero_data, aero_weight, aero_state, accept_factors, coag_kernel_type, tot_n_coag, comp_vols, procs_done)
subroutine add_coagulation_requests (bin_grid, aero_state, requests, n_parts, local_bin, remote_bin, n_samps, samps_remaining)
logical any_requests_active (requests)
 Returns .true. if any of the requests are active, otherwise returns .false.
subroutine find_rand_remote_proc (bin_grid, n_parts, remote_bin, remote_proc)
subroutine update_n_samps (bin_grid, n_samps, local_bin, remote_bin, samps_remaining)
subroutine send_request_particle (remote_proc, remote_bin)
subroutine recv_request_particle (aero_state)
subroutine send_return_no_particle (dest_proc, i_bin)
subroutine recv_return_no_particle (requests, bin_grid, aero_data, aero_state)
subroutine send_return_req_particle (aero_particle, i_bin, dest_proc)
subroutine recv_return_req_particle (requests, bin_grid, env_state, aero_data, aero_weight, aero_state, accept_factors, coag_kernel_type, tot_n_coag, comp_vols)
subroutine send_return_unreq_particle (aero_particle, dest_proc)
subroutine recv_return_unreq_particle (aero_state, bin_grid)
subroutine send_done (dest_proc)
 Send a message saying that this process is finished with its coagulation.
subroutine recv_done (procs_done)
 Receive a done message.
subroutine sync_info (local_n_parts, local_comp_vol, global_n_parts, global_comp_vols)
 Do an allgather to exchange number of particles and computational volume information between all processes.
subroutine generate_n_samps (bin_grid, n_parts, comp_vols, del_t, k_max, n_samps, accept_factors)
 generate the number of samples to do per bin pair.
subroutine coagulate_dist (bin_grid, aero_data, aero_weight, aero_state, aero_particle_1, aero_particle_2, remote_proc, comp_vols, remove_1, remove_2)

Variables

integer, parameter COAG_DIST_OUTGOING_BUFFER_SIZE = 1000000
 Size of the outgoing buffer for bsend (bytes).
integer, parameter COAG_DIST_MAX_BUFFER_SIZE = 10000
 Size of send and receive buffer for each message (bytes).
integer, parameter COAG_DIST_MAX_REQUESTS = 1
integer, parameter COAG_DIST_TAG_REQUEST_PARTICLE = 5321
integer, parameter COAG_DIST_TAG_RETURN_REQ_PARTICLE = 5322
integer, parameter COAG_DIST_TAG_RETURN_UNREQ_PARTICLE = 5323
integer, parameter COAG_DIST_TAG_RETURN_NO_PARTICLE = 5324
integer, parameter COAG_DIST_TAG_DONE = 5325

Detailed Description

Parallel aerosol particle coagulation with MPI.


Function/Subroutine Documentation

subroutine pmc_coagulation_dist::add_coagulation_requests ( type(bin_grid_t),intent(in)  bin_grid,
type(aero_state_t),intent(inout)  aero_state,
type(request_t),dimension(coag_dist_max_requests),intent(inout)  requests,
integer,dimension(:,:),intent(in)  n_parts,
integer,intent(inout)  local_bin,
integer,intent(inout)  remote_bin,
integer,dimension(bin_grid%n_bin,bin_grid%n_bin),intent(inout)  n_samps,
logical,intent(inout)  samps_remaining 
)
Parameters:
bin_gridBin grid.
aero_stateAerosol state.
requestsArray of outstanding requests.
n_partsNumber of particles per bin per process.
local_binBin index of first particle we need to coagulate.
remote_binBin index of second particle we need to coagulate.
n_sampsNumber of samples remaining per bin pair
samps_remainingWhether there are still coagulation samples that need to be done.
logical pmc_coagulation_dist::any_requests_active ( type(request_t),dimension(coag_dist_max_requests),intent(inout)  requests)

Returns .true. if any of the requests are active, otherwise returns .false.

Parameters:
requestsArray of outstanding requests.
subroutine pmc_coagulation_dist::coag_dist_recv ( type(request_t),dimension(coag_dist_max_requests),intent(inout)  requests,
type(bin_grid_t),intent(in)  bin_grid,
type(env_state_t),intent(in)  env_state,
type(aero_data_t),intent(in)  aero_data,
type(aero_weight_t),intent(in)  aero_weight,
type(aero_state_t),intent(inout)  aero_state,
real(kind=dp),dimension(bin_grid%n_bin,bin_grid%n_bin),intent(out)  accept_factors,
integer,intent(in)  coag_kernel_type,
integer,intent(inout)  tot_n_coag,
real(kind=dp),dimension(:),intent(in)  comp_vols,
logical,dimension(:),intent(inout)  procs_done 
)
Parameters:
requestsArray of outstanding requests.
bin_gridBin grid.
env_stateEnvironment state.
aero_dataAerosol data.
aero_weightAerosol weight.
aero_stateAerosol state.
accept_factorsAccept scale factors per bin pair (1).
coag_kernel_typeCoagulation kernel type.
tot_n_coagNumber of coagulation events.
comp_volsComputational volumes on all processes.
procs_doneWhich processes are finished with coagulation.
subroutine pmc_coagulation_dist::coagulate_dist ( type(bin_grid_t),intent(in)  bin_grid,
type(aero_data_t),intent(in)  aero_data,
type(aero_weight_t),intent(in)  aero_weight,
type(aero_state_t),intent(inout)  aero_state,
type(aero_particle_t),intent(in)  aero_particle_1,
type(aero_particle_t),intent(in)  aero_particle_2,
integer,intent(in)  remote_proc,
real(kind=dp),dimension(:),intent(in)  comp_vols,
logical,intent(out)  remove_1,
logical,intent(out)  remove_2 
)
Parameters:
bin_gridBin grid.
aero_dataAerosol data.
aero_weightAerosol weight.
aero_stateAerosol state.
aero_particle_1First particle to coagulate.
aero_particle_2Second particle to coagulate.
remote_procRemote process that the particle came from.
comp_volsComputational volumes on all processes (m^3).
remove_1Whether to remove aero_particle_1 after the coagulation.
remove_2Whether to remove aero_particle_2 after the coagulation.
subroutine pmc_coagulation_dist::find_rand_remote_proc ( type(bin_grid_t),intent(in)  bin_grid,
integer,dimension(:,:),intent(in)  n_parts,
integer,intent(in)  remote_bin,
integer,intent(out)  remote_proc 
)
Parameters:
bin_gridBin grid.
n_partsNumber of particles per bin per process.
remote_binRemote bin number.
remote_procRemote process number chosen at random.
subroutine pmc_coagulation_dist::generate_n_samps ( type(bin_grid_t),intent(in)  bin_grid,
integer,dimension(:,:),intent(in)  n_parts,
real(kind=dp),dimension(:),intent(in)  comp_vols,
real(kind=dp),intent(in)  del_t,
real(kind=dp),dimension(bin_grid%n_bin,bin_grid%n_bin),intent(in)  k_max,
integer,dimension(bin_grid%n_bin,bin_grid%n_bin),intent(out)  n_samps,
real(kind=dp),dimension(bin_grid%n_bin,bin_grid%n_bin),intent(out)  accept_factors 
)

generate the number of samples to do per bin pair.

Parameters:
bin_gridBin grid.
n_partsNumber of particles per bin on all processes.
comp_volsComputational volumes on all processes..
del_tTimestep.
k_maxMaximum kernel.
n_sampsNumber of samples to do per bin pair.
accept_factorsAccept scale factors per bin pair (1).
subroutine pmc_coagulation_dist::mc_coag_dist ( integer,intent(in)  coag_kernel_type,
type(bin_grid_t),intent(in)  bin_grid,
type(env_state_t),intent(in)  env_state,
type(aero_data_t),intent(in)  aero_data,
type(aero_weight_t),intent(in)  aero_weight,
type(aero_state_t),intent(inout)  aero_state,
real(kind=dp),intent(in)  del_t,
real(kind=dp),dimension(bin_grid%n_bin,bin_grid%n_bin),intent(in)  k_max,
integer,intent(out)  tot_n_samp,
integer,intent(out)  tot_n_coag 
)

Do coagulation for time del_t.

Parameters:
coag_kernel_typeCoagulation kernel type.
bin_gridBin grid.
env_stateEnvironment state.
aero_dataAerosol data.
aero_weightAerosol weight.
aero_stateAerosol state.
del_tTimestep.
k_maxMaximum kernel.
tot_n_sampTotal number of samples tested.
tot_n_coagNumber of coagulation events.
subroutine pmc_coagulation_dist::recv_done ( logical,dimension(:),intent(inout)  procs_done)

Receive a done message.

Parameters:
procs_doneWhich processes are finished with coagulation.
subroutine pmc_coagulation_dist::recv_request_particle ( type(aero_state_t),intent(inout)  aero_state)
Parameters:
aero_stateAero state.
subroutine pmc_coagulation_dist::recv_return_no_particle ( type(request_t),dimension(coag_dist_max_requests),intent(inout)  requests,
type(bin_grid_t),intent(in)  bin_grid,
type(aero_data_t),intent(in)  aero_data,
type(aero_state_t),intent(inout)  aero_state 
)
Parameters:
requestsArray of outstanding requests.
bin_gridBin grid.
aero_dataAerosol data.
aero_stateAerosol state.
subroutine pmc_coagulation_dist::recv_return_req_particle ( type(request_t),dimension(coag_dist_max_requests),intent(inout)  requests,
type(bin_grid_t),intent(in)  bin_grid,
type(env_state_t),intent(in)  env_state,
type(aero_data_t),intent(in)  aero_data,
type(aero_weight_t),intent(in)  aero_weight,
type(aero_state_t),intent(inout)  aero_state,
real(kind=dp),dimension(bin_grid%n_bin,bin_grid%n_bin),intent(out)  accept_factors,
integer,intent(in)  coag_kernel_type,
integer,intent(inout)  tot_n_coag,
real(kind=dp),dimension(:),intent(in)  comp_vols 
)
Parameters:
requestsArray of outstanding requests.
bin_gridBin grid.
env_stateEnvironment state.
aero_dataAerosol data.
aero_weightAerosol weight.
aero_stateAerosol state.
accept_factorsAccept scale factors per bin pair (1).
coag_kernel_typeCoagulation kernel type.
tot_n_coagNumber of coagulation events.
comp_volsComputational volumes on all processes.
subroutine pmc_coagulation_dist::recv_return_unreq_particle ( type(aero_state_t),intent(inout)  aero_state,
type(bin_grid_t),intent(in)  bin_grid 
)
Parameters:
aero_stateAerosol state.
bin_gridBin grid.
subroutine pmc_coagulation_dist::request_allocate ( type(request_t),intent(out)  request)
Parameters:
requestRequest object to allocate.
subroutine pmc_coagulation_dist::request_deallocate ( type(request_t),intent(inout)  request)

Deallocate a request object and set it to be invalid.

Parameters:
requestRequest object to deallocate
logical pmc_coagulation_dist::request_is_active ( type(request_t),intent(in)  request)

Whether the given reqest object is currectly active.

Parameters:
requestRequest object to test for activeness.
subroutine pmc_coagulation_dist::send_done ( integer,intent(in)  dest_proc)

Send a message saying that this process is finished with its coagulation.

Parameters:
dest_procProcess to send the message to.
subroutine pmc_coagulation_dist::send_request_particle ( integer,intent(in)  remote_proc,
integer,intent(in)  remote_bin 
)
Parameters:
remote_procRemote process number.
remote_binRemote bin number.
subroutine pmc_coagulation_dist::send_return_no_particle ( integer,intent(in)  dest_proc,
integer,intent(in)  i_bin 
)
Parameters:
dest_procProcess number to send message to.
i_binBin number where there was no particle.
subroutine pmc_coagulation_dist::send_return_req_particle ( type(aero_particle_t),intent(in)  aero_particle,
integer,intent(in)  i_bin,
integer,intent(in)  dest_proc 
)
Parameters:
aero_particleAero particle to send.
i_binBin that the particle is in.
dest_procProcess number to send particle to.
subroutine pmc_coagulation_dist::send_return_unreq_particle ( type(aero_particle_t),intent(in)  aero_particle,
integer,intent(in)  dest_proc 
)
Parameters:
aero_particleAero particle to send.
dest_procProcess to send the particle to.
subroutine pmc_coagulation_dist::sync_info ( integer,dimension(:),intent(in)  local_n_parts,
real(kind=dp),intent(in)  local_comp_vol,
integer,dimension(:,:),intent(out)  global_n_parts,
real(kind=dp),dimension(:),intent(out)  global_comp_vols 
)

Do an allgather to exchange number of particles and computational volume information between all processes.

Parameters:
local_n_partsNumber of particles per bin on the local process.
local_comp_volComputational volume on the local process.
global_n_partsNumber of particles per bin on all processes.
global_comp_volsComputational volumes on all processes (m^3).
subroutine pmc_coagulation_dist::update_n_samps ( type(bin_grid_t),intent(in)  bin_grid,
integer,dimension(bin_grid%n_bin,bin_grid%n_bin),intent(inout)  n_samps,
integer,intent(inout)  local_bin,
integer,intent(inout)  remote_bin,
logical,intent(inout)  samps_remaining 
)
Parameters:
bin_gridBin grid.
n_sampsNumber of samples remaining per bin pair
local_binBin index of first particle we need to coagulate.
remote_binBin index of second particle we need to coagulate.
samps_remainingWhether there are still coagulation samples that need to be done.

Variable Documentation

Size of send and receive buffer for each message (bytes).

The biggest message type will be one of the particle-sending types, for which we need pmc_mpi_pack_size_aero_particle(), plus a couple of integers or something. At the moment this means something like (10 + n_spec) reals, (3 + 2) integers, which for n_spec = 20 gives a size of 260 bytes.

Size of the outgoing buffer for bsend (bytes).

FIXME: check that this size is big enough. It must be large enough to handle the required number of messages of the given sizes, plus MPI_BSEND_OVERHEAD per message, plus some extra room because it's only kind of a circular buffer --- the messages themselves aren't allowed to wrap around then end, so we might need extra space up to the size of the largest message type.

integer,parameter pmc_coagulation_dist::COAG_DIST_TAG_DONE = 5325