PartMC  2.6.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. More...
 
logical function request_is_active (request)
 Whether the given reqest object is currectly active. More...
 
subroutine mc_coag_dist (coag_kernel_type, env_state, aero_data, aero_state, del_t, tot_n_samp, tot_n_coag)
 Do coagulation for time del_t. More...
 
subroutine coag_dist_recv (requests, env_state, aero_weight_total, aero_data, aero_state, accept_factors, coag_kernel_type, tot_n_coag, magnitudes, procs_done)
 
subroutine add_coagulation_requests (aero_state, requests, n_parts, local_bin, remote_bin, n_samps, samps_remaining)
 
logical function any_requests_active (requests)
 Returns .true. if any of the requests are active, otherwise returns .false. More...
 
subroutine find_rand_remote_proc (n_parts, remote_bin, remote_proc)
 
subroutine update_n_samps (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, aero_data, aero_state)
 
subroutine send_return_req_particle (aero_particle, i_bin, dest_proc)
 
subroutine recv_return_req_particle (requests, env_state, aero_weight_total, aero_data, aero_state, accept_factors, coag_kernel_type, tot_n_coag, magnitudes)
 
subroutine send_return_unreq_particle (aero_particle, dest_proc)
 
subroutine recv_return_unreq_particle (aero_state, aero_data)
 
subroutine send_done (dest_proc)
 Send a message saying that this process is finished with its coagulation. More...
 
subroutine recv_done (procs_done)
 Receive a done message. More...
 
subroutine generate_n_samps (n_parts, del_t, bin_grid, aero_weight_array, k_max, n_samps, accept_factors)
 generate the number of samples to do per bin pair. More...
 
subroutine coagulate_dist (aero_data, aero_state, aero_particle_1, aero_particle_2, remote_proc, aero_weight_total, magnitudes, remove_1, remove_2)
 

Variables

integer, parameter coag_dist_outgoing_buffer_size = 1000000
 Size of the outgoing buffer for bsend (bytes). More...
 
integer, parameter coag_dist_max_buffer_size = 10000
 Size of send and receive buffer for each message (bytes). More...
 
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

◆ add_coagulation_requests()

subroutine pmc_coagulation_dist::add_coagulation_requests ( 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(:,:), intent(inout)  n_samps,
logical, intent(inout)  samps_remaining 
)
Parameters
[in,out]aero_stateAerosol state.
[in,out]requestsArray of outstanding requests.
[in]n_partsNumber of particles per bin per process.
[in,out]local_binBin index of first particle we need to coagulate.
[in,out]remote_binBin index of second particle we need to coagulate.
[in,out]n_sampsNumber of samples remaining per bin pair
[in,out]samps_remainingWhether there are still coagulation samples that need to be done.

Definition at line 298 of file coagulation_dist.F90.

◆ any_requests_active()

logical function 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
[in,out]requestsArray of outstanding requests.

Definition at line 354 of file coagulation_dist.F90.

◆ coag_dist_recv()

subroutine pmc_coagulation_dist::coag_dist_recv ( type(request_t), dimension(coag_dist_max_requests), intent(inout)  requests,
type(env_state_t), intent(in)  env_state,
type(aero_weight_array_t), intent(in)  aero_weight_total,
type(aero_data_t), intent(in)  aero_data,
type(aero_state_t), intent(inout)  aero_state,
real(kind=dp), dimension(:,:), intent(in)  accept_factors,
integer, intent(in)  coag_kernel_type,
integer, intent(inout)  tot_n_coag,
real(kind=dp), dimension(:,:), intent(in)  magnitudes,
logical, dimension(:), intent(inout)  procs_done 
)
Parameters
[in,out]requestsArray of outstanding requests.
[in]env_stateEnvironment state.
[in]aero_weight_totalTotal weighting functions.
[in]aero_dataAerosol data.
[in,out]aero_stateAerosol state.
[in]accept_factorsAccept scale factors per bin pair (1).
[in]coag_kernel_typeCoagulation kernel type.
[in,out]tot_n_coagNumber of coagulation events.
[in]magnitudesComputational volumes on all processes.
[in,out]procs_doneWhich processes are finished with coagulation.

Definition at line 245 of file coagulation_dist.F90.

◆ coagulate_dist()

subroutine pmc_coagulation_dist::coagulate_dist ( type(aero_data_t), intent(in)  aero_data,
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,
type(aero_weight_array_t), intent(in)  aero_weight_total,
real(kind=dp), dimension(:,:), intent(in)  magnitudes,
logical, intent(out)  remove_1,
logical, intent(out)  remove_2 
)
Parameters
[in]aero_dataAerosol data.
[in,out]aero_stateAerosol state.
[in]aero_particle_1First particle to coagulate.
[in]aero_particle_2Second particle to coagulate.
[in]remote_procRemote process that the particle came from.
[in]aero_weight_totalTotal weight across all processes.
[in]magnitudesComputational volumes on all processes (m^3).
[out]remove_1Whether to remove aero_particle_1 after the coagulation.
[out]remove_2Whether to remove aero_particle_2 after the coagulation.

Definition at line 880 of file coagulation_dist.F90.

◆ find_rand_remote_proc()

subroutine pmc_coagulation_dist::find_rand_remote_proc ( integer, dimension(:,:), intent(in)  n_parts,
integer, intent(in)  remote_bin,
integer, intent(out)  remote_proc 
)
Parameters
[in]n_partsNumber of particles per bin per process.
[in]remote_binRemote bin number.
[out]remote_procRemote process number chosen at random.

Definition at line 373 of file coagulation_dist.F90.

◆ generate_n_samps()

subroutine pmc_coagulation_dist::generate_n_samps ( integer, dimension(:,:), intent(in)  n_parts,
real(kind=dp), intent(in)  del_t,
type(bin_grid_t), intent(in)  bin_grid,
type(aero_weight_array_t), intent(in)  aero_weight_array,
real(kind=dp), dimension(:,:), intent(in)  k_max,
integer, dimension(:,:), intent(out)  n_samps,
real(kind=dp), dimension(:,:), intent(out)  accept_factors 
)

generate the number of samples to do per bin pair.

Parameters
[in]n_partsNumber of particles per bin on all processes.
[in]del_tTimestep.
[in]bin_gridBin grid.
[in]aero_weight_arrayWeighting function array.
[in]k_maxMaximum kernel.
[out]n_sampsNumber of samples to do per bin pair.
[out]accept_factorsAccept scale factors per bin pair (1).

Definition at line 841 of file coagulation_dist.F90.

◆ mc_coag_dist()

subroutine pmc_coagulation_dist::mc_coag_dist ( integer, intent(in)  coag_kernel_type,
type(env_state_t), intent(in)  env_state,
type(aero_data_t), intent(in)  aero_data,
type(aero_state_t), intent(inout)  aero_state,
real(kind=dp), intent(in)  del_t,
integer, intent(out)  tot_n_samp,
integer, intent(out)  tot_n_coag 
)

Do coagulation for time del_t.

Parameters
[in]coag_kernel_typeCoagulation kernel type.
[in]env_stateEnvironment state.
[in]aero_dataAerosol data.
[in,out]aero_stateAerosol state.
[in]del_tTimestep.
[out]tot_n_sampTotal number of samples tested.
[out]tot_n_coagNumber of coagulation events.

Definition at line 104 of file coagulation_dist.F90.

◆ recv_done()

subroutine pmc_coagulation_dist::recv_done ( logical, dimension(:), intent(inout)  procs_done)

Receive a done message.

Parameters
[in,out]procs_doneWhich processes are finished with coagulation.

Definition at line 810 of file coagulation_dist.F90.

◆ recv_request_particle()

subroutine pmc_coagulation_dist::recv_request_particle ( type(aero_state_t), intent(inout)  aero_state)
Parameters
[in,out]aero_stateAero state.

Definition at line 455 of file coagulation_dist.F90.

◆ recv_return_no_particle()

subroutine pmc_coagulation_dist::recv_return_no_particle ( type(request_t), dimension(coag_dist_max_requests), intent(inout)  requests,
type(aero_data_t), intent(in)  aero_data,
type(aero_state_t), intent(inout)  aero_state 
)
Parameters
[in,out]requestsArray of outstanding requests.
[in]aero_dataAerosol data.
[in,out]aero_stateAerosol state.

Definition at line 530 of file coagulation_dist.F90.

◆ recv_return_req_particle()

subroutine pmc_coagulation_dist::recv_return_req_particle ( type(request_t), dimension(coag_dist_max_requests), intent(inout)  requests,
type(env_state_t), intent(in)  env_state,
type(aero_weight_array_t), intent(in)  aero_weight_total,
type(aero_data_t), intent(in)  aero_data,
type(aero_state_t), intent(inout)  aero_state,
real(kind=dp), dimension(:,:), intent(in)  accept_factors,
integer, intent(in)  coag_kernel_type,
integer, intent(inout)  tot_n_coag,
real(kind=dp), dimension(:,:), intent(in)  magnitudes 
)
Parameters
[in,out]requestsArray of outstanding requests.
[in]env_stateEnvironment state.
[in]aero_weight_totalTotal weighting array.
[in]aero_dataAerosol data.
[in,out]aero_stateAerosol state.
[in]accept_factorsAccept scale factors per bin pair (1).
[in]coag_kernel_typeCoagulation kernel type.
[in,out]tot_n_coagNumber of coagulation events.
[in]magnitudesComputational volumes on all processes.

Definition at line 619 of file coagulation_dist.F90.

◆ recv_return_unreq_particle()

subroutine pmc_coagulation_dist::recv_return_unreq_particle ( type(aero_state_t), intent(inout)  aero_state,
type(aero_data_t), intent(in)  aero_data 
)
Parameters
[in,out]aero_stateAerosol state.
[in]aero_dataAerosol data.

Definition at line 748 of file coagulation_dist.F90.

◆ request_allocate()

subroutine pmc_coagulation_dist::request_allocate ( type(request_t), intent(out)  request)
Parameters
[out]requestRequest object to allocate.

Definition at line 68 of file coagulation_dist.F90.

◆ request_deallocate()

subroutine pmc_coagulation_dist::request_deallocate ( type(request_t), intent(inout)  request)

Deallocate a request object and set it to be invalid.

Parameters
[in,out]requestRequest object to deallocate

Definition at line 80 of file coagulation_dist.F90.

◆ request_is_active()

logical function pmc_coagulation_dist::request_is_active ( type(request_t), intent(in)  request)

Whether the given reqest object is currectly active.

Parameters
[in]requestRequest object to test for activeness.

Definition at line 92 of file coagulation_dist.F90.

◆ send_done()

subroutine pmc_coagulation_dist::send_done ( integer, intent(in)  dest_proc)

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

Parameters
[in]dest_procProcess to send the message to.

Definition at line 790 of file coagulation_dist.F90.

◆ send_request_particle()

subroutine pmc_coagulation_dist::send_request_particle ( integer, intent(in)  remote_proc,
integer, intent(in)  remote_bin 
)
Parameters
[in]remote_procRemote process number.
[in]remote_binRemote bin number.

Definition at line 428 of file coagulation_dist.F90.

◆ send_return_no_particle()

subroutine pmc_coagulation_dist::send_return_no_particle ( integer, intent(in)  dest_proc,
integer, intent(in)  i_bin 
)
Parameters
[in]dest_procProcess number to send message to.
[in]i_binBin number where there was no particle.

Definition at line 503 of file coagulation_dist.F90.

◆ send_return_req_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
[in]aero_particleAero particle to send.
[in]i_binBin that the particle is in.
[in]dest_procProcess number to send particle to.

Definition at line 587 of file coagulation_dist.F90.

◆ send_return_unreq_particle()

subroutine pmc_coagulation_dist::send_return_unreq_particle ( type(aero_particle_t), intent(in)  aero_particle,
integer, intent(in)  dest_proc 
)
Parameters
[in]aero_particleAero particle to send.
[in]dest_procProcess to send the particle to.

Definition at line 720 of file coagulation_dist.F90.

◆ update_n_samps()

subroutine pmc_coagulation_dist::update_n_samps ( integer, dimension(:,:), intent(inout)  n_samps,
integer, intent(inout)  local_bin,
integer, intent(inout)  remote_bin,
logical, intent(inout)  samps_remaining 
)
Parameters
[in,out]n_sampsNumber of samples remaining per bin pair
[in,out]local_binBin index of first particle we need to coagulate.
[in,out]remote_binBin index of second particle we need to coagulate.
[in,out]samps_remainingWhether there are still coagulation samples that need to be done.

Definition at line 391 of file coagulation_dist.F90.

Variable Documentation

◆ coag_dist_max_buffer_size

integer, parameter pmc_coagulation_dist::coag_dist_max_buffer_size = 10000

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.

Definition at line 39 of file coagulation_dist.F90.

◆ coag_dist_max_requests

integer, parameter pmc_coagulation_dist::coag_dist_max_requests = 1

Definition at line 40 of file coagulation_dist.F90.

◆ coag_dist_outgoing_buffer_size

integer, parameter pmc_coagulation_dist::coag_dist_outgoing_buffer_size = 1000000

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.

Definition at line 31 of file coagulation_dist.F90.

◆ coag_dist_tag_done

integer, parameter pmc_coagulation_dist::coag_dist_tag_done = 5325

Definition at line 45 of file coagulation_dist.F90.

◆ coag_dist_tag_request_particle

integer, parameter pmc_coagulation_dist::coag_dist_tag_request_particle = 5321

Definition at line 41 of file coagulation_dist.F90.

◆ coag_dist_tag_return_no_particle

integer, parameter pmc_coagulation_dist::coag_dist_tag_return_no_particle = 5324

Definition at line 44 of file coagulation_dist.F90.

◆ coag_dist_tag_return_req_particle

integer, parameter pmc_coagulation_dist::coag_dist_tag_return_req_particle = 5322

Definition at line 42 of file coagulation_dist.F90.

◆ coag_dist_tag_return_unreq_particle

integer, parameter pmc_coagulation_dist::coag_dist_tag_return_unreq_particle = 5323

Definition at line 43 of file coagulation_dist.F90.