![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <load_balancing.h>
Public Member Functions | |
| LagrangianLoadBalancing () | |
| void | set_parameters (const Parameters::Lagrangian::ModelParameters< dim > &model_parameters) |
| void | copy_references (std::shared_ptr< SimulationControl > &simulation_control, parallel::distributed::Triangulation< dim > &triangulation, Particles::ParticleHandler< dim > &particle_handler, AdaptiveSparseContacts< dim, PropertiesIndex > &adaptive_sparse_contacts) |
| void | check_load_balance_iteration () const |
| std::function< void()> | set_iteration_check_function () |
| void | check_load_balance_once () const |
| void | check_load_balance_frequent () const |
| void | check_load_balance_dynamic () |
| void | check_load_balance_with_sparse_contacts () |
| void | connect_weight_signals () |
| void | connect_mobility_status_weight_signals () |
Private Member Functions | |
| unsigned int | calculate_total_cell_weight (const typename parallel::distributed::Triangulation< dim >::cell_iterator &cell, const CellStatus status) const |
| unsigned int | calculate_total_cell_weight_with_mobility_status (const typename parallel::distributed::Triangulation< dim >::cell_iterator &cell, const CellStatus status) const |
Private Attributes | |
| Parameters::Lagrangian::ModelParameters< dim >::LoadBalanceMethod | load_balance_method |
| std::function< void()> | iteration_check_function |
| const unsigned int | cell_weight = 1000 |
| std::shared_ptr< Function< dim > > | cell_weight_function |
| unsigned int | particle_weight |
| double | inactive_status_factor |
| double | active_status_factor |
| unsigned int | load_balance_step |
| unsigned int | load_balance_frequency |
| unsigned int | dynamic_check_frequency |
| double | load_threshold |
| MPI_Comm | mpi_communicator |
| const unsigned int | n_mpi_processes |
| const unsigned int | this_mpi_process |
| std::shared_ptr< SimulationControl > | simulation_control |
| parallel::distributed::Triangulation< dim > * | triangulation |
| Particles::ParticleHandler< dim > * | particle_handler |
| AdaptiveSparseContacts< dim, PropertiesIndex > * | adaptive_sparse_contacts |
Manages the load balancing (repartitioning), of the domain according to the computational load of the cells and the particles. It is used by the DEM and the coupling CFD-DEM solvers.
| dim | An integer that denotes the number of spatial dimensions. |
| PropertiesIndex | Index of the properties used within the ParticleHandler. |
Definition at line 25 of file load_balancing.h.
| LagrangianLoadBalancing< dim, PropertiesIndex >::LagrangianLoadBalancing | ( | ) |
Definition at line 11 of file load_balancing.cc.
References mpi_communicator, n_mpi_processes, and this_mpi_process.
|
private |
Indicates to the triangulation how much computational work is expected to happen on this cell, and consequently how the domain needs to be partitioned.
Every MPI rank receives a roughly equal amount of work (potentially not an equal number of cells). While the function is called from the outside, it is connected to the corresponding signal from inside this class, therefore it can be private. This function is the key component that allows dynamically balance the computational load. The function attributes a weight to every cell that represents the computational work on this cell. Here the majority of work is expected to happen on the particles, therefore the return value of this function is calculated based on the number of particles in the current cell. The function is connected to the cell_weight() signal inside the triangulation, and will be called once per cell, whenever the triangulation repartition the domain between ranks.
| [in] | cell | The cell for which the load is calculated. |
| [in] | status | The status of the cell related to the coarsening level. |
TODO: Remove preprocessor directives after deal.ii v.9.6 release
Definition at line 140 of file load_balancing.cc.
|
private |
Indicates to the triangulation how much computational work is expected to happen on this cell, and consequently how the domain needs to be partitioned. Only used with the Adaptive Sparse Contacts mechanism.
Similar to the calculate_total_cell_weight(), this function is used when the cell weight is adapted to the mobility status. For instance, if the cell is inactive, its computational load will be significantly lower than if it is a mobile cell since there is no force calculation and no velocity integration for the particles that lie within it. The weight of the cells must thus be adapted to the status of the cell.
total cell weight = cell weight + load balancing factor * n particles * particle weight
| [in] | cell | The cell for which the load is calculated |
| [in] | status | The status of the cell related to the coarsening level |
Definition at line 183 of file load_balancing.cc.
References active_status_factor, adaptive_sparse_contacts, AdaptiveSparseContacts< dim, PropertiesIndex >::advected, AdaptiveSparseContacts< dim, PropertiesIndex >::advected_active, AdaptiveSparseContacts< dim, PropertiesIndex >::inactive, inactive_status_factor, particle_handler, particle_weight, and AdaptiveSparseContacts< dim, PropertiesIndex >::static_active.
|
inline |
Determines whether the present iteration is the load balance step when load balance method is dynamic.
Definition at line 37 of file load_balancing.cc.
References dynamic_check_frequency, DEMActionManager::get_action_manager(), DEMActionManager::load_balance_step(), load_threshold, mpi_communicator, n_mpi_processes, particle_handler, and simulation_control.
|
inline |
Determines whether the present iteration is the load balance step when load balance method is frequent.
Definition at line 27 of file load_balancing.cc.
|
inline |
Checks if the current iteration is a load balance iteration.
Definition at line 94 of file load_balancing.h.
References iteration_check_function.
|
inline |
Determines whether the present iteration is the load balance step when load balance method is once.
Definition at line 19 of file load_balancing.cc.
References DEMActionManager::get_action_manager(), DEMActionManager::load_balance_step(), load_balance_step, and simulation_control.
|
inline |
Determines whether the present is the load balance step when load balance method is dynamic_with_sparse_contacts. It used the same method as dynamic but with the addition of factors according to the cell mobility status of the sparse contacts mechanism.
Definition at line 60 of file load_balancing.cc.
References active_status_factor, adaptive_sparse_contacts, AdaptiveSparseContacts< dim, PropertiesIndex >::advected, cell_weight_function, connect_mobility_status_weight_signals(), dynamic_check_frequency, DEMActionManager::get_action_manager(), inactive_status_factor, DEMActionManager::load_balance_step(), load_threshold, mpi_communicator, n_mpi_processes, particle_handler, particle_weight, simulation_control, and triangulation.
|
inline |
Connects the weight signals of the cells to the triangulation with the mobility status. Cells are reconnected when load balancing is checked with the new mobility status.
Definition at line 209 of file load_balancing.h.
References calculate_total_cell_weight_with_mobility_status(), cell_weight, and triangulation.
|
inline |
Connects the weight signals of the cells to the triangulation.
In order to consider the particles when repartitioning the triangulation the algorithm needs to know three things:
Definition at line 187 of file load_balancing.h.
References calculate_total_cell_weight(), cell_weight_function, and triangulation.
|
inline |
Copies the references to the simulation control, triangulation, particle handler and adaptive sparse contacts (enabled or disabled). This is necessary to access the data structures and functions of these during the load balancing check.
| [in] | simulation_control | The simulation control object (accesses to the time step) |
| [in] | triangulation | The triangulation object (for dynamics connexion of signals with ASC) |
| [in] | particle_handler | The particle handler object (accesses to the particles in cells) |
| [in] | adaptive_sparse_contacts | The adaptive sparse contacts object (accesses to the mobility status of the cells) |
Definition at line 76 of file load_balancing.h.
References adaptive_sparse_contacts, particle_handler, simulation_control, and triangulation.
|
inline |
Sets the load balancing iteration check function according to the chosen load balancing method. During the setup of the parameters, the validation of the method is already checked, so the default value is when the method is none.
Definition at line 109 of file load_balancing.h.
References check_load_balance_dynamic(), check_load_balance_frequent(), check_load_balance_once(), check_load_balance_with_sparse_contacts(), Parameters::Lagrangian::ModelParameters< dim >::dynamic, Parameters::Lagrangian::ModelParameters< dim >::frequent, load_balance_method, and Parameters::Lagrangian::ModelParameters< dim >::once.
|
inline |
Sets the parameters for the load balancing method given by the model parameters. It also initializes the iteration load balancing check method.
| [in] | model_parameters | The model parameter of DEM including the load balancing parameters. |
Definition at line 39 of file load_balancing.h.
References Parameters::Lagrangian::ModelParameters< dim >::active_load_balancing_factor, active_status_factor, cell_weight_function, Parameters::Lagrangian::ModelParameters< dim >::cell_weight_function, dynamic_check_frequency, Parameters::Lagrangian::ModelParameters< dim >::dynamic_load_balance_check_frequency, Parameters::Lagrangian::ModelParameters< dim >::inactive_load_balancing_factor, inactive_status_factor, iteration_check_function, load_balance_frequency, Parameters::Lagrangian::ModelParameters< dim >::load_balance_frequency, load_balance_method, Parameters::Lagrangian::ModelParameters< dim >::load_balance_method, Parameters::Lagrangian::ModelParameters< dim >::load_balance_particle_weight, load_balance_step, Parameters::Lagrangian::ModelParameters< dim >::load_balance_step, Parameters::Lagrangian::ModelParameters< dim >::load_balance_threshold, load_threshold, particle_weight, and set_iteration_check_function().
|
private |
Load weight factor of particle weight in a cell with an active mobility status (only with ASC).
Definition at line 321 of file load_balancing.h.
|
private |
Pointer to the adaptive sparse contacts object.
Definition at line 385 of file load_balancing.h.
|
private |
Default hard-coded load weight of a cell.
Definition at line 302 of file load_balancing.h.
|
private |
Definition at line 304 of file load_balancing.h.
|
private |
Frequency of check for the load balancing execution, only when method is dynamic.
Definition at line 339 of file load_balancing.h.
|
private |
Load weight factor of particle weight in a cell with an inactive mobility status (only with ASC).
Definition at line 315 of file load_balancing.h.
|
private |
The load balancing iteration check function according to the load balancing method.
Definition at line 297 of file load_balancing.h.
|
private |
Frequency of load balancing execution, only when method is frequent.
Definition at line 333 of file load_balancing.h.
|
private |
The load balancing method chosen by the user.
Definition at line 291 of file load_balancing.h.
|
private |
Iteration number for load balancing execution, only when method is once.
Definition at line 327 of file load_balancing.h.
|
private |
Threshold (\beta) for the check load balancing execution, only when method is dynamic.
Load balancing will be done when the computational load amongst core is too uneven. If L_{max} - L_{min} > \beta \bar{L}, where L_{max}, L_{min}, and \bar{L} are the maximum, minimum, and the average load, the load balancing will be executed.
Definition at line 350 of file load_balancing.h.
|
private |
MPI communicator.
Definition at line 355 of file load_balancing.h.
|
private |
Number of MPI processes.
Definition at line 360 of file load_balancing.h.
|
private |
Pointer to the particle handler object.
Definition at line 380 of file load_balancing.h.
|
private |
Load weight of a particle, the default parameters is 10000.
Definition at line 309 of file load_balancing.h.
|
private |
Pointer to the simulation control object.
Definition at line 370 of file load_balancing.h.
|
private |
Rank of the current MPI process.
Definition at line 365 of file load_balancing.h.
|
private |
Pointer to the triangulation object.
Definition at line 375 of file load_balancing.h.