Research Article

Load Balancing for Parallel Multiphase Flow Simulation

Algorithm 1

Pseudocode for subfront processes emphasizing bubble distribution and load balancing.
!Subfront initialization functions
...
! Initialize Zoltan library
Zoltan_Initialize()
Zoltan_handle=Zoltan_Create(Subfront_Comm)
Zoltan_Set_Param(Zoltan_handle,"LB_METHOD", "RCB")
! Initialize bubbles as per fixed-mapping strategy
Initial_Bubble_Distribution()
! Zoltan RCB bubble partitioning, it returns
! Number of bubbles to import/export and their IDs,
! process IDs for import/export, boolean flag showing
! whether partition was updated
Zoltan_LB_Partition(...)
! Initial bubble redistribution and load balancing
do  for each bubble to be exported
Deallocate bubble memory and data structures
end  do
do  for each bubble to be imported
Allocate bubble memory and initialize data structures
end  do
! Subfront main loop
do  for each timestep
! Subfront calculations
...
! Dynamic load balancing and bubble redistribution
if  iteration==load balancing iteration
Zoltan_LB_Partition(...)
if  partition updated
do  for each bubble to be exported
Send bubble to the appropriate process
Deallocate bubble memory and data structures
end  do
do  for each bubble to be imported
Allocate bubble memory
Receive bubble from appropriate process
Initialize bubble data structures
end  do
end  if
end  if
end  do