Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
particle_wall_broad_search.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2022, 2024-2025 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_particle_wall_broad_search_h
5#define lethe_particle_wall_broad_search_h
6
9#include <dem/contact_info.h>
10#include <dem/data_containers.h>
12
13#include <deal.II/particles/particle_handler.h>
14
15#include <map>
16
17using namespace dealii;
18
19/**
20 * @brief Finds unordered map of tuples (tuple of particle located in
21 * boundary cells, normal vector of the boundary face, a
22 * point on the face and the corresponding boundary cell) which shows the
23 * candidate particle-wall collision pairs. These collision candidates will be
24 * investigated in the fine search to check if they are in contact or not.
25 *
26 * @param boundary_cells_information Information of the boundary cells and
27 * faces. This is the output of the FindBoundaryCellsInformation class.
28 * @param particle_handler Particle handler of particles located in boundary
29 * cells.
30 * @param particle_wall_contact_candidates A two-layered unordered map of tuples. Each
31 * tuple contains a particle located near boundaries, the normal vector of
32 * the corresponding face boundary, a point on the boundary and the boundary
33 * cell. The contact pair is used in the fine search.
34 */
35template <int dim>
36void
38 const std::map<int, boundary_cells_info_struct<dim>>
39 &boundary_cells_information,
40 const Particles::ParticleHandler<dim> &particle_handler,
42 &particle_wall_contact_candidates);
43
44/**
45 * @brief Finds unordered map of tuples (tuple of particle located in
46 * boundary cells, normal vector of the boundary face, a
47 * point on the face and the corresponding boundary cell) which shows the
48 * candidate particle-wall collision pairs. These collision candidates will be
49 * investigated in the fine search to check if they are in contact or not.
50 *
51 * @tparam dim An integer that denotes the number of spatial dimensions.
52 * @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
53 *
54 * @param boundary_cells_information Information of the boundary cells and
55 * faces. This is the output of the FindBoundaryCellsInformation class.
56 * @param particle_handler Particle handler of particles located in boundary
57 * cells.
58 * @param particle_wall_contact_candidates A two-layered unordered map of tuples. Each
59 * tuple contains a particle located near boundaries, the normal vector of
60 * the corresponding face boundary, a point on the boundary and the boundary
61 * cell. The contact pair is used in the fine search.
62 * @param sparse_contacts_object The object that contains the
63 * information about the mobility status of cells
64 */
65template <int dim, typename PropertiesIndex>
66void
68 const std::map<int, boundary_cells_info_struct<dim>>
69 &boundary_cells_information,
70 const Particles::ParticleHandler<dim> &particle_handler,
72 &particle_wall_contact_candidates,
73 const AdaptiveSparseContacts<dim, PropertiesIndex> &sparse_contacts_object);
74
75/**
76 * @brief Find a two-layered unordered map of particle iterators which shows the
77 * candidate particle-floating wall collision candidates. These collision
78 * pairs will be investigated in the fine search to check if they are in
79 * contact or not
80 *
81 * @param boundary_cells_for_floating_walls Boundary cells located adjacent to
82 * floating walls
83 * @param particle_handler Particle handler of particles located in boundary
84 * cells
85 * @param floating_wall_properties Properties of the floating walls specified
86 * in the parameter handler file
87 * @param simulation_time Simulation time
88 * @param particle_floating_wall_candidates Output of particle-floating wall
89 * broad search which contains all the particle-floating wall collision
90 * candidates
91 */
92template <int dim>
93void
95 const std::unordered_map<
96 types::global_dof_index,
97 std::set<typename Triangulation<dim>::active_cell_iterator>>
98 &boundary_cells_for_floating_walls,
99 const Particles::ParticleHandler<dim> &particle_handler,
100 const Parameters::Lagrangian::FloatingWalls<dim> &floating_wall_properties,
101 const double simulation_time,
103 &particle_floating_wall_candidates);
104
105/**
106 * @brief Find a two-layered unordered map of particle iterators which shows the
107 * candidate particle-floating wall collision candidates. These collision
108 * pairs will be investigated in the fine search to check if they are in
109 * contact or not
110 *
111 * @tparam dim An integer that denotes the number of spatial dimensions.
112 * @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
113 *
114 * @param boundary_cells_for_floating_walls Boundary cells located adjacent to
115 * floating walls
116 * @param particle_handler Particle handler of particles located in boundary
117 * cells
118 * @param floating_wall_properties Properties of the floating walls specified
119 * in the parameter handler file
120 * @param simulation_time Simulation time
121 * @param particle_floating_wall_candidates Output of particle-floating wall
122 * broad search which contains all the particle-floating wall collision
123 * candidates
124 * @param sparse_contacts_object The object that contains the
125 * information about the mobility status of cells
126 */
127template <int dim, typename PropertiesIndex>
128void
130 const std::unordered_map<
131 types::global_dof_index,
132 std::set<typename Triangulation<dim>::active_cell_iterator>>
133 &boundary_cells_for_floating_walls,
134 const Particles::ParticleHandler<dim> &particle_handler,
135 const Parameters::Lagrangian::FloatingWalls<dim> &floating_wall_properties,
136 const double simulation_time,
138 &particle_floating_wall_candidates,
139 const AdaptiveSparseContacts<dim, PropertiesIndex> &sparse_contacts_object);
140
141/**
142 * @brief Find a two-layered unordered map
143 * (particle_floating_mesh_contact_candidates) of particle iterators that
144 * shows the candidate particle-floating mesh collision candidates. These
145 * collision pairs will be investigated in the fine search to check if they
146 * are in contact or not
147 *
148 * @param solid_surfaces_mesh_information Information of the solid surfaces mapped
149 * in the background triangulation.
150 * @param particle_handler
151 * @param particle_floating_mesh_contact_candidates Particle-floating mesh contact
152 * candidates.
153 * @param cells_total_neighbor_list A container in which all the neighbor cells
154 * of the local cells are stored.
155 */
156template <int dim>
157void
160 &solid_surfaces_mesh_information,
161 const Particles::ParticleHandler<dim> &particle_handler,
163 &particle_floating_mesh_contact_candidates,
165 &cells_total_neighbor_list);
166
167
168/**
169 * @brief Find a two-layered unordered map
170 * (particle_floating_mesh_contact_candidates) of particle iterators that
171 * shows the candidate particle-floating mesh collision candidates. These
172 * collision pairs will be investigated in the fine search to check if they
173 * are in contact or not
174 *
175 * @tparam dim An integer that denotes the number of spatial dimensions.
176 * @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
177 *
178 * @param solid_surfaces_mesh_information Information of the solid surfaces mapped
179 * in the background triangulation.
180 * @param particle_handler
181 * @param particle_floating_mesh_contact_candidates Particle-floating mesh contact
182 * candidates
183 * @param cells_total_neighbor_list A container in which all the neighbor cells
184 * of the local cells are stored
185 * @param sparse_contacts_object The object that contains the
186 * information about the mobility status of cells
187 */
188template <int dim, typename PropertiesIndex>
189void
192 &solid_surfaces_mesh_information,
193 const Particles::ParticleHandler<dim> &particle_handler,
195 &particle_floating_mesh_contact_candidates,
197 &cells_total_neighbor_list,
198 const AdaptiveSparseContacts<dim, PropertiesIndex> &sparse_contacts_object);
199
200
201/**
202 * @brief Store the candidate particle-wall contact pairs.
203 *
204 * @param particle_iterator The particle iterator to start boundary id.
205 * @param boundary_cells_content The info of the current boundary cell to
206 * store.
207 * @param contact_pair_candidates A map which will contain all the
208 * particle/wall pairs candidate.
209 */
210template <int dim>
211inline void
213 const typename Particles::ParticleHandler<
214 dim>::particle_iterator_range::iterator &particle_iterator,
215 const boundary_cells_info_struct<dim> &boundary_cells_content,
217 &contact_pair_candidates)
218{
219 // Find the contact candidate container of the particle
220 const types::particle_index particle_id = particle_iterator->get_id();
221 auto candidates_container_it = contact_pair_candidates.find(particle_id);
222
223 // Reserve arbitrary vector capacity and store if the particle does not have
224 // contact candidate yet
225 if (candidates_container_it == contact_pair_candidates.end())
226 {
227 auto pair_it_bool = contact_pair_candidates.emplace(
228 particle_id,
229 ankerl::unordered_dense::map<
231 std::tuple<Particles::ParticleIterator<dim>,
232 Tensor<1, dim>,
233 Point<dim>,
235
236 candidates_container_it = pair_it_bool.first;
237 }
238
239 // Store particle ids from the selected particle iterator
240 candidates_container_it->second.emplace(
241 boundary_cells_content.global_face_id,
242 std::make_tuple(particle_iterator,
243 boundary_cells_content.normal_vector,
244 boundary_cells_content.point_on_face,
245 boundary_cells_content.boundary_id));
246}
247
248/**
249 * @brief Store the candidate particle-floating wall contact pairs.
250 *
251 * @param particle_iterator The particle iterator to start boundary id.
252 * @param floating_wall_id The floating wall id.
253 * @param contact_pair_candidates A map which will contain all the
254 * particle/wall pairs candidate.
255 */
256template <int dim>
257inline void
259 const typename Particles::ParticleHandler<
260 dim>::particle_iterator_range::iterator &particle_iterator,
261 const DEM::global_face_id &floating_wall_id,
263 &contact_pair_candidates);
264
265#endif
Mechanism that disables contacts computation through mobility status of cells based on granular tempe...
Parameters for floating walls in DEM simulations.
unsigned int global_face_id
Defined global face id as a type to ensure that we know what the structures use as index....
void find_particle_wall_contact_pairs(const std::map< int, boundary_cells_info_struct< dim > > &boundary_cells_information, const Particles::ParticleHandler< dim > &particle_handler, typename DEM::dem_data_structures< dim >::particle_wall_candidates &particle_wall_contact_candidates)
Finds unordered map of tuples (tuple of particle located in boundary cells, normal vector of the boun...
void find_particle_floating_wall_contact_pairs(const std::unordered_map< types::global_dof_index, std::set< typename Triangulation< dim >::active_cell_iterator > > &boundary_cells_for_floating_walls, const Particles::ParticleHandler< dim > &particle_handler, const Parameters::Lagrangian::FloatingWalls< dim > &floating_wall_properties, const double simulation_time, typename DEM::dem_data_structures< dim >::particle_floating_wall_candidates &particle_floating_wall_candidates)
Find a two-layered unordered map of particle iterators which shows the candidate particle-floating wa...
void particle_solid_surfaces_contact_search(const typename DEM::dem_data_structures< dim >::solid_surfaces_mesh_information &solid_surfaces_mesh_information, const Particles::ParticleHandler< dim > &particle_handler, typename DEM::dem_data_structures< dim >::particle_floating_mesh_candidates &particle_floating_mesh_contact_candidates, typename DEM::dem_data_structures< dim >::cells_total_neighbor_list &cells_total_neighbor_list)
Find a two-layered unordered map (particle_floating_mesh_contact_candidates) of particle iterators th...
void store_candidates(const typename Particles::ParticleHandler< dim >::particle_iterator_range::iterator &particle_iterator, const boundary_cells_info_struct< dim > &boundary_cells_content, typename DEM::dem_data_structures< dim >::particle_wall_candidates &contact_pair_candidates)
Store the candidate particle-wall contact pairs.
ankerl::unordered_dense::map< types::particle_index, std::unordered_map< global_face_id, Particles::ParticleIterator< dim > > > particle_floating_wall_candidates
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::global_cell_index, std::vector< typename Triangulation< dim >::active_cell_iterator > > cells_total_neighbor_list
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
Handle the information related to the boundary cells which will be used for particle-wall contact det...