Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
dem_contact_manager.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2022-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_dem_contact_manager_h
5#define lethe_dem_contact_manager_h
6
7
13
14#include <array>
15
16using namespace DEM;
17
18/**
19 * @brief Manage the numerous of contact detection search operations in the DEM.
20 *
21 * This class mostly calls proper functions in regards the type of contacts for
22 * the contact detection and updates of data containers.
23 *
24 * @tparam dim An integer that denotes the number of spatial dimensions.
25 * @tparam PropertiesIndex Index of the properties used within the
26 * ParticleHandler.
27 */
28template <int dim, typename PropertiesIndex>
30{
31public:
32 /**
33 * @brief Execute functions to find the lists of cell neighbors of the active
34 * cells in the triangulation.
35 *
36 * For contacts of particles, the neighbor search excludes the repetitions of
37 * neighbors: B is neighbor of A but A will not be neighbor of B. For contacts
38 * of particles with floating meshes, the neighbor search includes all
39 * neighbors. These floating mesh contacts searches need all the particles
40 * located in all the neighbor cells of the main cell to detect
41 * collisions with the floating mesh.
42 *
43 * @param[in] triangulation The triangulation to access the information of the
44 * cells.
45 * @param[in] periodic_boundaries_cells_information Information of periodic
46 * cells used if periodic boundaries are enabled (next parameter).
47 */
48 void
50 const parallel::distributed::Triangulation<dim> &triangulation,
52 &periodic_boundaries_cells_information);
53
54 /**
55 * @brief Execute functions to clear and update the neighbor lists of all the
56 * active cells in the triangulation.
57 *
58 * @param[in] triangulation The triangulation to access the information of the
59 * cells.
60 * @param[in] periodic_boundaries_cells_information Information of periodic
61 * cells used if periodic boundaries are enabled (next parameter).
62 */
63 void
65 const parallel::distributed::Triangulation<dim> &triangulation,
67 &periodic_boundaries_cells_information)
68 {
74 total_neighbor_list.clear();
75
77 periodic_boundaries_cells_information);
78 }
79
80 /**
81 * @brief Execute functions to update the contact data containers with the new
82 * contact pairs.
83 *
84 * Call proper functions to remove contact repetitions and to add new contact
85 * pairs to the contact containers when particles are exchanged between
86 * processors after the fine search.
87 * Contact pairs are local particle-particle, ghost particle-particle,
88 * particle-wall, particle-floating wall contacts and particle-floating mesh
89 * contacts.
90 */
91 void
93
94 /**
95 * @brief Execute functions to update the particle iterators in local-local
96 * contact containers.
97 *
98 * This is essential since sort_particles_into_subdomains_and_cells() and
99 * exchange_ghost_particles() functions change the particle iterators
100 * everytime they are called.
101 *
102 * @param[in] particle_handler Storage of particles and their accessor
103 * functions.
104 */
105 void
107 const Particles::ParticleHandler<dim> &particle_handler);
108
109 /**
110 * @brief Execute the particle-particle broad searches with adaptive sparse
111 * contacts.
112 *
113 * Calls proper functions to find the candidates of local and ghost
114 * particle-particle contact pairs and the periodic particle-particle contacts
115 * if required. These contact pairs will be used in the fine search step to
116 * investigate if they are in contact.
117 * It checks if the adaptive sparse contacts is enabled and use proper
118 * functions.
119 *
120 * @param[in,out] particle_handler Storage of particles and their accessor
121 * functions.
122 * @param[in] sparse_particle_contact_object Allow to check the mobility
123 * status of cells.
124 */
125 void
127 dealii::Particles::ParticleHandler<dim> &particle_handler,
129 &sparse_particle_contact_object);
130
131 /**
132 * @brief Execute the particle-wall broad searches with adaptive sparse
133 * contacts.
134 *
135 * Calls proper functions to find the candidates of particle-wall contact
136 * pairs and the particle-floating wall or particle-floating mesh if required.
137 * These contact pairs will be used in the fine search step to investigate if
138 * they are in contact.
139 * It checks if the adaptive sparse contacts is enabled and use proper
140 * functions.
141 *
142 * @param[in] particle_handler Storage of particles and their accessor
143 * functions.
144 * @param[in] boundary_cell_object Information of the boundary cells and
145 * faces.
146 * @param[in] solid_surfaces_mesh_info Mapping of solid surfaces meshes.
147 * @param[in] floating_walls Properties of the floating walls.
148 * @param[in] simulation_time Current simulation time.
149 * @param[in] sparse_particle_contact_object Allow to check the mobility
150 * status of cells.
151 */
152 void
154 const Particles::ParticleHandler<dim> &particle_handler,
155 BoundaryCellsInformation<dim> &boundary_cell_object,
157 &solid_surfaces_mesh_info,
158 const Parameters::Lagrangian::FloatingWalls<dim> &floating_walls,
159 const double simulation_time,
161 &sparse_particle_contact_object);
162
163 /**
164 * @brief Execute the particle-particles fine searches.
165 *
166 * Executes functions that update the particle contacts pairs containers and
167 * compute the contact information of the collision pairs.
168 *
169 * @param[in] neighborhood_threshold Threshold value of contact detection.
170 */
171 void
172 execute_particle_particle_fine_search(const double neighborhood_threshold);
173
174 /**
175 * @brief Execute the particle-wall fine searches.
176 *
177 * Executes functions that update the particle-wall contacts pairs containers
178 * and compute the contact information of the collision particle-wall.
179 *
180 * @param[in] floating_walls Properties of the floating walls.
181 * @param[in] simulation_time Current simulation time.
182 * @param[in] neighborhood_threshold Threshold value of contact detection.
183 */
184 void
186 const Parameters::Lagrangian::FloatingWalls<dim> &floating_walls,
187 const double simulation_time,
188 const double neighborhood_threshold);
189
190 /**
191 * @brief Set the signed periodic offset for every direction.
192 *
193 * @param[in] offset_per_direction Signed periodic offsets of the domain along
194 * every direction, used for determining periodic contacts.
195 */
196 void
198 const std::array<double, dim> &offset_per_direction);
199
200 /**
201 * @brief Return the particle-floating mesh contact container.
202 */
203 inline typename dem_data_structures<
209
210 /**
211 * @brief Return the particle-floating wall contact container.
212 */
218
219 /**
220 * @brief Return the particle-wall contact container.
221 */
227
228 /**
229 * @brief Return the particle-line contact container.
230 */
236
237 /**
238 * @brief Return the particle-point contact container.
239 */
245
246 /**
247 * @brief Return the local-local particle contact container.
248 */
254
255 /**
256 * @brief Return the local-ghost particle contact container.
257 */
263
264 /**
265 * @brief Return the local-local periodic particle contact container.
266 */
272
273 /**
274 * @brief Return the local-ghost periodic particle contact container.
275 */
281
282 /**
283 * @brief Return the ghost-local periodic particle contact container.
284 */
290
291 /**
292 * @brief Return the local particle-particle contact candidates.
293 */
299
300 /**
301 * @brief Return the ghost particle-particle contact candidates.
302 */
308
309private:
310 // Container with the iterators to all local and ghost particles
313
314 // Container that shows the local/ghost neighbor cells of all local cells in
315 // the triangulation
328
329 // Container with all collision candidate particles within adjacent cells
352
353 // Container with all the contact information of the object in contact
354 // with a particle
355 typename dem_data_structures<
366
367
368 // Container with all the contact information of adjacent
369 // local/ghost-local for pairwise contact force calculation
380
381 // Containers with other information
383
384private:
385 /**
386 * @brief Signed periodic offset of the domain along every direction, used by
387 * the particle-particle fine search to find the nearest periodic image of a
388 * particle. Component d is 0 if direction d is not periodic.
389 */
390 std::array<double, dim> periodic_offset_per_direction{};
391};
392
393#endif
Mechanism that disables contacts computation through mobility status of cells based on granular tempe...
Finds all the boundary cells and faces in the triangulation, for each cell the boundary face is speci...
Manage the numerous of contact detection search operations in the DEM.
void update_contacts()
Execute functions to update the contact data containers with the new contact pairs.
dem_data_structures< dim >::adjacent_particle_pairs ghost_adjacent_particles
dem_data_structures< dim >::cells_neighbor_list cells_ghost_local_periodic_neighbor_list
dem_data_structures< dim >::particle_floating_mesh_potentially_in_contact particle_floating_mesh_potentially_in_contact
dem_data_structures< dim >::adjacent_particle_pairs & get_ghost_adjacent_particles()
Return the local-ghost particle contact container.
dem_data_structures< dim >::particle_floating_mesh_potentially_in_contact & get_particle_floating_mesh_potentially_in_contact()
Return the particle-floating mesh contact container.
dem_data_structures< dim >::particle_particle_candidates ghost_contact_pair_candidates
dem_data_structures< dim >::particle_particle_candidates & get_local_contact_pair_candidates()
Return the local particle-particle contact candidates.
dem_data_structures< dim >::particle_particle_candidates local_contact_pair_candidates
void execute_particle_particle_broad_search(dealii::Particles::ParticleHandler< dim > &particle_handler, const AdaptiveSparseContacts< dim, PropertiesIndex > &sparse_particle_contact_object)
Execute the particle-particle broad searches with adaptive sparse contacts.
dem_data_structures< dim >::particle_line_candidates particle_lines_in_contact
void set_periodic_offset_per_direction(const std::array< double, dim > &offset_per_direction)
Set the signed periodic offset for every direction.
dem_data_structures< dim >::periodic_adjacent_particle_pairs local_ghost_periodic_adjacent_particles
dem_data_structures< dim >::particle_wall_in_contact particle_wall_in_contact
dem_data_structures< dim >::periodic_adjacent_particle_pairs & get_local_local_periodic_adjacent_particles()
Return the local-local periodic particle contact container.
dem_data_structures< dim >::particle_wall_candidates particle_wall_candidates
dem_data_structures< dim >::particle_point_candidates particle_point_candidates
DEM::dem_data_structures< dim >::cell_vector periodic_cells_container
void update_cell_neighbors(const parallel::distributed::Triangulation< dim > &triangulation, const typename DEM::dem_data_structures< dim >::periodic_boundaries_cells_info &periodic_boundaries_cells_information)
Execute functions to clear and update the neighbor lists of all the active cells in the triangulation...
dem_data_structures< dim >::particle_point_candidates particle_points_in_contact
dem_data_structures< dim >::adjacent_particle_pairs & get_local_adjacent_particles()
Return the local-local particle contact container.
void execute_cell_neighbors_search(const parallel::distributed::Triangulation< dim > &triangulation, const typename DEM::dem_data_structures< dim >::periodic_boundaries_cells_info &periodic_boundaries_cells_information)
Execute functions to find the lists of cell neighbors of the active cells in the triangulation.
dem_data_structures< dim >::particle_point_candidates & get_particle_points_in_contact()
Return the particle-point contact container.
void execute_particle_wall_fine_search(const Parameters::Lagrangian::FloatingWalls< dim > &floating_walls, const double simulation_time, const double neighborhood_threshold)
Execute the particle-wall fine searches.
dem_data_structures< dim >::particle_index_iterator_map particle_container
dem_data_structures< dim >::particle_wall_in_contact particle_floating_wall_in_contact
dem_data_structures< dim >::particle_particle_candidates local_contact_pair_periodic_candidates
std::array< double, dim > periodic_offset_per_direction
Signed periodic offset of the domain along every direction, used by the particle-particle fine search...
dem_data_structures< dim >::periodic_adjacent_particle_pairs ghost_local_periodic_adjacent_particles
dem_data_structures< dim >::periodic_adjacent_particle_pairs & get_local_ghost_periodic_adjacent_particles()
Return the local-ghost periodic particle contact container.
dem_data_structures< dim >::cells_total_neighbor_list total_neighbor_list
dem_data_structures< dim >::cells_neighbor_list cells_local_periodic_neighbor_list
dem_data_structures< dim >::particle_line_candidates & get_particle_lines_in_contact()
Return the particle-line contact container.
void execute_particle_wall_broad_search(const Particles::ParticleHandler< dim > &particle_handler, BoundaryCellsInformation< dim > &boundary_cell_object, const typename dem_data_structures< dim >::solid_surfaces_mesh_information &solid_surfaces_mesh_info, const Parameters::Lagrangian::FloatingWalls< dim > &floating_walls, const double simulation_time, const AdaptiveSparseContacts< dim, PropertiesIndex > &sparse_particle_contact_object)
Execute the particle-wall broad searches with adaptive sparse contacts.
dem_data_structures< dim >::adjacent_particle_pairs local_adjacent_particles
dem_data_structures< dim >::particle_particle_candidates ghost_contact_pair_periodic_candidates
void update_local_particles_in_cells(const Particles::ParticleHandler< dim > &particle_handler)
Execute functions to update the particle iterators in local-local contact containers.
dem_data_structures< dim >::particle_line_candidates particle_line_candidates
dem_data_structures< dim >::periodic_adjacent_particle_pairs local_local_periodic_adjacent_particles
dem_data_structures< dim >::particle_wall_in_contact & get_particle_floating_wall_in_contact()
Return the particle-floating wall contact container.
dem_data_structures< dim >::periodic_adjacent_particle_pairs & get_ghost_local_periodic_adjacent_particles()
Return the ghost-local periodic particle contact container.
dem_data_structures< dim >::cells_neighbor_list cells_local_neighbor_list
dem_data_structures< dim >::particle_particle_candidates ghost_local_contact_pair_periodic_candidates
dem_data_structures< dim >::particle_floating_mesh_candidates particle_floating_mesh_candidates
dem_data_structures< dim >::particle_wall_in_contact & get_particle_wall_in_contact()
Return the particle-wall contact container.
void execute_particle_particle_fine_search(const double neighborhood_threshold)
Execute the particle-particles fine searches.
dem_data_structures< dim >::cells_neighbor_list cells_ghost_periodic_neighbor_list
dem_data_structures< dim >::particle_floating_wall_candidates particle_floating_wall_candidates
dem_data_structures< dim >::cells_neighbor_list cells_ghost_neighbor_list
dem_data_structures< dim >::particle_particle_candidates & get_ghost_contact_pair_candidates()
Return the ghost particle-particle contact candidates.
dem_data_structures< dim >::particle_particle_candidates ghost_local_contact_pair_candidates
Parameters for floating walls in DEM simulations.
This namespace defines all the data containers and required operations on these containers for the DE...
DEM data structure containers To improve readability of containers, there's a simple description abov...
ankerl::unordered_dense::map< types::particle_index, ankerl::unordered_dense::map< global_face_id, particle_wall_contact_info< dim > > > particle_wall_in_contact
ankerl::unordered_dense::map< types::particle_index, std::unordered_map< global_face_id, Particles::ParticleIterator< dim > > > particle_floating_wall_candidates
ankerl::unordered_dense::map< types::particle_index, Particles::ParticleIterator< dim > > particle_index_iterator_map
std::vector< std::vector< std::pair< typename Triangulation< dim >::active_cell_iterator, typename Triangulation< dim - 1, dim >::active_cell_iterator > > > solid_surfaces_mesh_information
ankerl::unordered_dense::map< types::particle_index, periodic_adjacent_particle_pairs_value > periodic_adjacent_particle_pairs
std::vector< std::vector< typename Triangulation< dim >::active_cell_iterator > > cells_neighbor_list
std::unordered_multimap< types::global_cell_index, periodic_boundaries_cells_info_struct< dim > > periodic_boundaries_cells_info
std::unordered_map< types::particle_index, particle_line_contact_info< dim > > particle_line_candidates
ankerl::unordered_dense::map< types::global_cell_index, std::vector< typename Triangulation< dim >::active_cell_iterator > > cells_total_neighbor_list
ankerl::unordered_dense::map< types::particle_index, std::vector< types::particle_index > > particle_particle_candidates
std::vector< particle_floating_wall_from_mesh_candidates > particle_floating_mesh_candidates
ankerl::unordered_dense::map< types::particle_index, ankerl::unordered_dense::map< global_face_id, std::tuple< Particles::ParticleIterator< dim >, Tensor< 1, dim >, Point< dim >, global_face_id > > > particle_wall_candidates
std::unordered_map< types::particle_index, particle_point_contact_info< dim > > particle_point_candidates
ankerl::unordered_dense::map< types::particle_index, adjacent_particle_pairs_value > adjacent_particle_pairs
std::vector< typename Triangulation< dim >::active_cell_iterator > cell_vector