4#ifndef lethe_load_balancing_h
5#define lethe_load_balancing_h
12#include <deal.II/distributed/tria.h>
24template <
int dim,
typename PropertiesIndex>
108 inline std::function<void()>
122 dim>::LoadBalanceMethod::dynamic_with_sparse_contacts:
125 return [&]() {
return; };
190 [&](
const typename Triangulation<dim>::cell_iterator &cell,
191 const CellStatus) ->
unsigned int {
196 [&](
const typename parallel::distributed::Triangulation<
197 dim>::cell_iterator &cell,
198 const CellStatus status) ->
unsigned int {
216 [&](
const typename Triangulation<dim>::cell_iterator &,
217 const CellStatus) ->
unsigned int {
return cell_weight; });
220 [&](
const typename parallel::distributed::Triangulation<
221 dim>::cell_iterator &cell,
222 const CellStatus status) ->
unsigned int {
256 const typename parallel::distributed::Triangulation<dim>::cell_iterator
258 const CellStatus status)
const;
283 const typename parallel::distributed::Triangulation<dim>::cell_iterator
285 const CellStatus status)
const;
Parameters::Lagrangian::ModelParameters< dim >::LoadBalanceMethod load_balance_method
The load balancing method chosen by the user.
Particles::ParticleHandler< dim > * particle_handler
Pointer to the particle handler object.
AdaptiveSparseContacts< dim, PropertiesIndex > * adaptive_sparse_contacts
Pointer to the adaptive sparse contacts object.
void connect_mobility_status_weight_signals()
Connects the weight signals of the cells to the triangulation with the mobility status....
const unsigned int this_mpi_process
Rank of the current MPI process.
std::shared_ptr< SimulationControl > simulation_control
Pointer to the simulation control object.
void check_load_balance_iteration() const
Checks if the current iteration is a load balance iteration.
double active_status_factor
Load weight factor of particle weight in a cell with an active mobility status (only with ASC).
const unsigned int n_mpi_processes
Number of MPI processes.
unsigned int load_balance_step
Iteration number for load balancing execution, only when method is once.
parallel::distributed::Triangulation< dim > * triangulation
Pointer to the triangulation object.
double inactive_status_factor
Load weight factor of particle weight in a cell with an inactive mobility status (only with ASC).
const unsigned int cell_weight
Default hard-coded load weight of a cell.
std::shared_ptr< Function< dim > > cell_weight_function
unsigned int load_balance_frequency
Frequency of load balancing execution, only when method is frequent.
void check_load_balance_once() const
Determines whether the present iteration is the load balance step when load balance method is once.
unsigned int dynamic_check_frequency
Frequency of check for the load balancing execution, only when method is dynamic.
unsigned int particle_weight
Load weight of a particle, the default parameters is 10000.
std::function< void()> iteration_check_function
The load balancing iteration check function according to the load balancing method.
void check_load_balance_with_sparse_contacts()
Determines whether the present is the load balance step when load balance method is dynamic_with_spar...
unsigned int calculate_total_cell_weight(const typename parallel::distributed::Triangulation< dim >::cell_iterator &cell, const CellStatus status) const
Indicates to the triangulation how much computational work is expected to happen on this cell,...
void connect_weight_signals()
Connects the weight signals of the cells to the triangulation.
double load_threshold
Threshold (\beta) for the check load balancing execution, only when method is dynamic.
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)
Copies the references to the simulation control, triangulation, particle handler and adaptive sparse ...
unsigned int calculate_total_cell_weight_with_mobility_status(const typename parallel::distributed::Triangulation< dim >::cell_iterator &cell, const CellStatus status) const
Indicates to the triangulation how much computational work is expected to happen on this cell,...
LagrangianLoadBalancing()
std::function< void()> set_iteration_check_function()
Sets the load balancing iteration check function according to the chosen load balancing method....
void check_load_balance_dynamic()
Determines whether the present iteration is the load balance step when load balance method is dynamic...
MPI_Comm mpi_communicator
MPI communicator.
void set_parameters(const Parameters::Lagrangian::ModelParameters< dim > &model_parameters)
Sets the parameters for the load balancing method given by the model parameters. It also initializes ...
void check_load_balance_frequent() const
Determines whether the present iteration is the load balance step when load balance method is frequen...
Numerical model parameters for DEM simulations.
unsigned int dynamic_load_balance_check_frequency
Check frequency for dynamic load balancing.
std::shared_ptr< Function< dim > > cell_weight_function
LoadBalanceMethod
Load balancing strategy for parallel DEM simulations.
@ frequent
Perform load-balancing at a given frequency.
@ once
Perform load-balancing once.
double active_load_balancing_factor
unsigned int load_balance_particle_weight
Particle weight used for load balancing.
enum Parameters::Lagrangian::ModelParameters::LoadBalanceMethod load_balance_method
double inactive_load_balancing_factor
unsigned int load_balance_frequency
Load balance frequency (in time steps).
double load_balance_threshold
Load balance threshold (for dynamic load balancing).
unsigned int load_balance_step
Load balance step (for single-step load balancing).
Parameter structures for Lagrangian (DEM) particle simulations.
Simulation control classes for managing time-stepping and iteration control in Lethe.