Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
particle_point_line_broad_search.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2021, 2023-2025 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
5
7
8using namespace dealii;
9using namespace DEM;
10
11// This function finds all the particle-point contact candidates
12template <int dim>
13void
15 const Particles::ParticleHandler<dim> &particle_handler,
16 const std::unordered_map<std::string, cell_point_info<dim>>
17 &boundary_cells_with_points,
19 &particle_point_contact_candidates)
20{
21 // Clear the candidate map
22 particle_point_contact_candidates.clear();
23
24 // Defining and resetting a local particle-point candidate counter. This is
25 // used as a key to the output map
26 int contact_candidate_counter = 0;
27
28 // Iterating over the boundary_cells_with_points which is the output of
29 // the find_boundary_cells_information class.
30 // This vector contains all the required information of the boundary
31 // cells with points. In this loop we find the particles located in each of
32 // these boundary cells with points
33 for (auto map_iterator = boundary_cells_with_points.begin();
34 map_iterator != boundary_cells_with_points.end();
35 ++map_iterator)
36 {
37 const cell_point_info<dim> &cells_with_boundary_points_information =
38 map_iterator->second;
39
40 // Finding particles located in the corresponding cell
41 typename Particles::ParticleHandler<dim>::particle_iterator_range
42 particles_in_cell = particle_handler.particles_in_cell(
43 cells_with_boundary_points_information.cell);
44
45 for (typename Particles::ParticleHandler<dim>::particle_iterator_range::
46 iterator particles_in_cell_iterator = particles_in_cell.begin();
47 particles_in_cell_iterator != particles_in_cell.end();
48 ++particles_in_cell_iterator)
49 {
50 // Making the pair and adding it to the
51 // particle_point_contact_candidates map. This map is the output of
52 // this function
53 particle_point_contact_candidates.emplace(
54 contact_candidate_counter,
56 particles_in_cell_iterator,
57 cells_with_boundary_points_information.point});
58 ++contact_candidate_counter;
59 }
60 }
61}
62
63template <int dim, typename PropertiesIndex>
64void
66 const Particles::ParticleHandler<dim> &particle_handler,
67 const std::unordered_map<std::string, cell_point_info<dim>>
68 &boundary_cells_with_points,
70 &particle_point_contact_candidates,
71 const AdaptiveSparseContacts<dim, PropertiesIndex> &sparse_contacts_object)
72{
73 // Clear the candidate map
74 particle_point_contact_candidates.clear();
75
76 // Defining and resetting a local particle-point candidate counter. This is
77 // used as a key to the output map
78 int contact_candidate_counter = 0;
79
80 // Iterating over the boundary_cells_with_points which is the output of
81 // the find_boundary_cells_information class.
82 // This vector contains all the required information of the boundary
83 // cells with points. In this loop we find the particles located in each of
84 // these boundary cells with points
85 for (auto map_iterator = boundary_cells_with_points.begin();
86 map_iterator != boundary_cells_with_points.end();
87 ++map_iterator)
88 {
89 const cell_point_info<dim> &cells_with_boundary_points_information =
90 map_iterator->second;
91
92 // If main cell has status other than mobile, skip to next cell
93 unsigned int main_cell_mobility_status =
94 sparse_contacts_object.check_cell_mobility(
95 cells_with_boundary_points_information.cell);
96 if (main_cell_mobility_status !=
98 continue;
99
100 // Finding particles located in the corresponding cell
101 typename Particles::ParticleHandler<dim>::particle_iterator_range
102 particles_in_cell = particle_handler.particles_in_cell(
103 cells_with_boundary_points_information.cell);
104
105 for (typename Particles::ParticleHandler<dim>::particle_iterator_range::
106 iterator particles_in_cell_iterator = particles_in_cell.begin();
107 particles_in_cell_iterator != particles_in_cell.end();
108 ++particles_in_cell_iterator)
109 {
110 // Making the pair and adding it to the
111 // particle_point_contact_candidates map. This map is the output of
112 // this function
113 particle_point_contact_candidates.emplace(
114 contact_candidate_counter,
116 particles_in_cell_iterator,
117 cells_with_boundary_points_information.point});
118 ++contact_candidate_counter;
119 }
120 }
121}
122
123// This function finds all the particle-line contact candidates
124template <int dim>
125void
127 const Particles::ParticleHandler<dim> &particle_handler,
128 const std::unordered_map<std::string, cell_line_info<dim>>
129 &boundary_cells_with_lines,
131 &particle_line_contact_candidates)
132{
133 // Clear the candidates map
134 particle_line_contact_candidates.clear();
135
136 // Defining and resetting a local particle-line candidate counter. This is
137 // used as a key to the output map
138 unsigned int contact_candidate_counter = 0;
139
140 // Iterating over the boundary_cells_with_lines which is the output of
141 // the find_boundary_cells_information class.
142 // This vector contains all the required information of the boundary
143 // cells with lines. In this loop we find the particles located in each of
144 // these boundary cells with lines
145 for (auto map_iterator = boundary_cells_with_lines.begin();
146 map_iterator != boundary_cells_with_lines.end();
147 ++map_iterator)
148 {
149 const cell_line_info<dim> &cells_with_boundary_lines_info =
150 map_iterator->second;
151
152 // Finding particles located in the corresponding cell
153 typename Particles::ParticleHandler<dim>::particle_iterator_range
154 particles_in_cell = particle_handler.particles_in_cell(
155 cells_with_boundary_lines_info.cell);
156
157 for (auto particles_in_cell_iterator = particles_in_cell.begin();
158 particles_in_cell_iterator != particles_in_cell.end();
159 ++particles_in_cell_iterator)
160 {
161 // Adding the particle line contact info to the
162 // particle_line_contact_candidates map.
163 particle_line_contact_candidates.emplace(
164 contact_candidate_counter,
166 particles_in_cell_iterator,
167 cells_with_boundary_lines_info.point_one,
168 cells_with_boundary_lines_info.point_two});
169 ++contact_candidate_counter;
170 }
171 }
172}
173
174template <int dim, typename PropertiesIndex>
175void
177 const Particles::ParticleHandler<dim> &particle_handler,
178 const std::unordered_map<std::string, cell_line_info<dim>>
179 &boundary_cells_with_lines,
181 &particle_line_contact_candidates,
182 const AdaptiveSparseContacts<dim, PropertiesIndex> &sparse_contacts_object)
183{
184 // Clear the candidates map
185 particle_line_contact_candidates.clear();
186
187 // Defining and resetting a local particle-line candidate counter. This is
188 // used as a key to the output map
189 unsigned int contact_candidate_counter = 0;
190
191 // Iterating over the boundary_cells_with_lines which is the output of
192 // the find_boundary_cells_information class.
193 // This vector contains all the required information of the boundary
194 // cells with lines. In this loop we find the particles located in each of
195 // these boundary cells with lines
196 for (auto map_iterator = boundary_cells_with_lines.begin();
197 map_iterator != boundary_cells_with_lines.end();
198 ++map_iterator)
199 {
200 const cell_line_info<dim> &cells_with_boundary_lines_info =
201 map_iterator->second;
202
203 // If main cell has status other than mobile, skip to next cell
204 unsigned int main_cell_mobility_status =
205 sparse_contacts_object.check_cell_mobility(
206 cells_with_boundary_lines_info.cell);
207 if (main_cell_mobility_status !=
209 continue;
210
211 // Finding particles located in the corresponding cell
212 typename Particles::ParticleHandler<dim>::particle_iterator_range
213 particles_in_cell = particle_handler.particles_in_cell(
214 cells_with_boundary_lines_info.cell);
215
216 for (auto particles_in_cell_iterator = particles_in_cell.begin();
217 particles_in_cell_iterator != particles_in_cell.end();
218 ++particles_in_cell_iterator)
219 {
220 // Adding the particle line contact info to the
221 // particle_line_contact_candidates map.
222 particle_line_contact_candidates.emplace(
223 contact_candidate_counter,
225 particles_in_cell_iterator,
226 cells_with_boundary_lines_info.point_one,
227 cells_with_boundary_lines_info.point_two});
228 ++contact_candidate_counter;
229 }
230 }
231}
232
233template void
235 const Particles::ParticleHandler<2> &particle_handler,
236 const std::unordered_map<std::string, cell_line_info<2>>
237 &boundary_cells_with_lines,
239 &particle_line_contact_candidates);
240
241template void
243 const Particles::ParticleHandler<3> &particle_handler,
244 const std::unordered_map<std::string, cell_line_info<3>>
245 &boundary_cells_with_lines,
247 &particle_line_contact_candidates);
248
249template void
251 const Particles::ParticleHandler<2> &particle_handler,
252 const std::unordered_map<std::string, cell_line_info<2>>
253 &boundary_cells_with_lines,
255 &particle_line_contact_candidates,
257 &sparse_contacts_object);
258
259template void
261 const Particles::ParticleHandler<3> &particle_handler,
262 const std::unordered_map<std::string, cell_line_info<3>>
263 &boundary_cells_with_lines,
265 &particle_line_contact_candidates,
267 &sparse_contacts_object);
268
269template void
271 const Particles::ParticleHandler<2> &particle_handler,
272 const std::unordered_map<std::string, cell_line_info<2>>
273 &boundary_cells_with_lines,
275 &particle_line_contact_candidates,
277 &sparse_contacts_object);
278
279template void
281 const Particles::ParticleHandler<3> &particle_handler,
282 const std::unordered_map<std::string, cell_line_info<3>>
283 &boundary_cells_with_lines,
285 &particle_line_contact_candidates,
287 &sparse_contacts_object);
288
289template void
291 const Particles::ParticleHandler<2> &particle_handler,
292 const std::unordered_map<std::string, cell_line_info<2>>
293 &boundary_cells_with_lines,
295 &particle_line_contact_candidates,
297 &sparse_contacts_object);
298
299template void
301 const Particles::ParticleHandler<2> &particle_handler,
302 const std::unordered_map<std::string, cell_line_info<2>>
303 &boundary_cells_with_lines,
305 &particle_line_contact_candidates,
307 &sparse_contacts_object);
308
309template void
311 const Particles::ParticleHandler<3> &particle_handler,
312 const std::unordered_map<std::string, cell_line_info<3>>
313 &boundary_cells_with_lines,
315 &particle_line_contact_candidates,
317 &sparse_contacts_object);
318
319template void
321 const Particles::ParticleHandler<3> &particle_handler,
322 const std::unordered_map<std::string, cell_line_info<3>>
323 &boundary_cells_with_lines,
325 &particle_line_contact_candidates,
327 &sparse_contacts_object);
328
329template void
331 const Particles::ParticleHandler<2> &particle_handler,
332 const std::unordered_map<std::string, cell_point_info<2>>
333 &boundary_cells_with_points,
335 &particle_point_contact_candidates);
336
337template void
339 const Particles::ParticleHandler<3> &particle_handler,
340 const std::unordered_map<std::string, cell_point_info<3>>
341 &boundary_cells_with_points,
343 &particle_point_contact_candidates);
344
345template void
347 const Particles::ParticleHandler<2> &particle_handler,
348 const std::unordered_map<std::string, cell_point_info<2>>
349 &boundary_cells_with_points,
351 &particle_point_contact_candidates,
353 &sparse_contacts_object);
354
355template void
357 const Particles::ParticleHandler<3> &particle_handler,
358 const std::unordered_map<std::string, cell_point_info<3>>
359 &boundary_cells_with_points,
361 &particle_point_contact_candidates,
363 &sparse_contacts_object);
364
365template void
367 const Particles::ParticleHandler<2> &particle_handler,
368 const std::unordered_map<std::string, cell_point_info<2>>
369 &boundary_cells_with_points,
371 &particle_point_contact_candidates,
373 &sparse_contacts_object);
374
375template void
377 const Particles::ParticleHandler<3> &particle_handler,
378 const std::unordered_map<std::string, cell_point_info<3>>
379 &boundary_cells_with_points,
381 &particle_point_contact_candidates,
383 &sparse_contacts_object);
384
385template void
387 const Particles::ParticleHandler<2> &particle_handler,
388 const std::unordered_map<std::string, cell_point_info<2>>
389 &boundary_cells_with_points,
391 &particle_point_contact_candidates,
393 &sparse_contacts_object);
394
395template void
397 const Particles::ParticleHandler<2> &particle_handler,
398 const std::unordered_map<std::string, cell_point_info<2>>
399 &boundary_cells_with_points,
401 &particle_point_contact_candidates,
403 &sparse_contacts_object);
404
405template void
407 const Particles::ParticleHandler<3> &particle_handler,
408 const std::unordered_map<std::string, cell_point_info<3>>
409 &boundary_cells_with_points,
411 &particle_point_contact_candidates,
413 &sparse_contacts_object);
414
415template void
417 const Particles::ParticleHandler<3> &particle_handler,
418 const std::unordered_map<std::string, cell_point_info<3>>
419 &boundary_cells_with_points,
421 &particle_point_contact_candidates,
423 &sparse_contacts_object);
Mechanism that disables contacts computation through mobility status of cells based on granular tempe...
unsigned int check_cell_mobility(const typename Triangulation< dim >::active_cell_iterator &cell) const
Find the mobility status of a cell.
DEM particle property definitions and output name management.
This namespace defines all the data containers and required operations on these containers for the DE...
template void find_particle_line_contact_pairs< 3, DEM::DEMMPProperties::PropertiesIndex >(const Particles::ParticleHandler< 3 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 3 > > &boundary_cells_with_lines, DEM::dem_data_structures< 3 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 3, DEM::DEMMPProperties::PropertiesIndex > &sparse_contacts_object)
template void find_particle_line_contact_pairs< 2, DEM::CFDDEMProperties::PropertiesIndex >(const Particles::ParticleHandler< 2 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 2 > > &boundary_cells_with_lines, DEM::dem_data_structures< 2 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 2, DEM::CFDDEMProperties::PropertiesIndex > &sparse_contacts_object)
void find_particle_line_contact_pairs(const Particles::ParticleHandler< dim > &particle_handler, const std::unordered_map< std::string, cell_line_info< dim > > &boundary_cells_with_lines, typename DEM::dem_data_structures< dim >::particle_line_candidates &particle_line_contact_candidates)
Find a map of tuples (tuple of particle and the locations of beginning and ending vertices of the bou...
void find_particle_point_contact_pairs(const Particles::ParticleHandler< dim > &particle_handler, const std::unordered_map< std::string, cell_point_info< dim > > &boundary_cells_with_points, typename DEM::dem_data_structures< dim >::particle_point_candidates &particle_point_contact_candidates)
Find a map of pairs (pair of particle and the boundary vertex location) which shows the candidate par...
template void find_particle_line_contact_pairs< 2, DEM::CFDDEMMPProperties::PropertiesIndex >(const Particles::ParticleHandler< 2 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 2 > > &boundary_cells_with_lines, DEM::dem_data_structures< 2 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 2, DEM::CFDDEMMPProperties::PropertiesIndex > &sparse_contacts_object)
template void find_particle_point_contact_pairs< 3 >(const Particles::ParticleHandler< 3 > &particle_handler, const std::unordered_map< std::string, cell_point_info< 3 > > &boundary_cells_with_points, DEM::dem_data_structures< 3 >::particle_point_candidates &particle_point_contact_candidates)
template void find_particle_line_contact_pairs< 3, DEM::DEMProperties::PropertiesIndex >(const Particles::ParticleHandler< 3 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 3 > > &boundary_cells_with_lines, DEM::dem_data_structures< 3 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 3, DEM::DEMProperties::PropertiesIndex > &sparse_contacts_object)
template void find_particle_line_contact_pairs< 3, DEM::CFDDEMMPProperties::PropertiesIndex >(const Particles::ParticleHandler< 3 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 3 > > &boundary_cells_with_lines, DEM::dem_data_structures< 3 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 3, DEM::CFDDEMMPProperties::PropertiesIndex > &sparse_contacts_object)
template void find_particle_line_contact_pairs< 2, DEM::DEMMPProperties::PropertiesIndex >(const Particles::ParticleHandler< 2 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 2 > > &boundary_cells_with_lines, DEM::dem_data_structures< 2 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 2, DEM::DEMMPProperties::PropertiesIndex > &sparse_contacts_object)
template void find_particle_line_contact_pairs< 2, DEM::DEMProperties::PropertiesIndex >(const Particles::ParticleHandler< 2 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 2 > > &boundary_cells_with_lines, DEM::dem_data_structures< 2 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 2, DEM::DEMProperties::PropertiesIndex > &sparse_contacts_object)
template void find_particle_line_contact_pairs< 2 >(const Particles::ParticleHandler< 2 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 2 > > &boundary_cells_with_lines, DEM::dem_data_structures< 2 >::particle_line_candidates &particle_line_contact_candidates)
template void find_particle_point_contact_pairs< 2 >(const Particles::ParticleHandler< 2 > &particle_handler, const std::unordered_map< std::string, cell_point_info< 2 > > &boundary_cells_with_points, DEM::dem_data_structures< 2 >::particle_point_candidates &particle_point_contact_candidates)
template void find_particle_line_contact_pairs< 3, DEM::CFDDEMProperties::PropertiesIndex >(const Particles::ParticleHandler< 3 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 3 > > &boundary_cells_with_lines, DEM::dem_data_structures< 3 >::particle_line_candidates &particle_line_contact_candidates, const AdaptiveSparseContacts< 3, DEM::CFDDEMProperties::PropertiesIndex > &sparse_contacts_object)
template void find_particle_line_contact_pairs< 3 >(const Particles::ParticleHandler< 3 > &particle_handler, const std::unordered_map< std::string, cell_line_info< 3 > > &boundary_cells_with_lines, DEM::dem_data_structures< 3 >::particle_line_candidates &particle_line_contact_candidates)
std::unordered_map< types::particle_index, particle_line_contact_info< dim > > particle_line_candidates
std::unordered_map< types::particle_index, particle_point_contact_info< dim > > particle_point_candidates
Handle information related to the cell-line matching.
Triangulation< dim >::active_cell_iterator cell
Point< 3 > point_one
Point< 3 > point_two
Handle information related to the cell-point matching.
Point< 3 > point
Triangulation< dim >::active_cell_iterator cell
Handle information related to the calculation of the particle-line contact forces.
Handle information related to the calculation of the particle-point contact forces.