Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
find_boundary_cells_information.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_find_boundary_cells_information_h
5#define lethe_find_boundary_cells_information_h
6
8#include <dem/contact_info.h>
11
12#include <deal.II/distributed/tria.h>
13
14#include <deal.II/grid/grid_tools.h>
15
16#include <set>
17#include <vector>
18
19using namespace dealii;
20
21/**
22 * @brief Finds all the boundary cells and faces in the triangulation, for each
23 * cell the boundary face is specified and the normal vector as well as a point
24 * on the boundary face are obtained.
25 */
26
27template <int dim>
29{
30public:
32
33 /**
34 * @brief The build function builds all the boundary cell information
35 * structure that finds which cell has a boundary face, boundary line or a
36 * boundary point. Additionally, it identifies which cells are located in the
37 * vicinity (controlled by the max cell diameter) of floating walls.
38 *
39 * @param triangulation Triangulation to access the information of the cells
40 * @param floating_wall_properties Properties of floating walls specified in
41 * the parameter handler file
42 * @param outlet_boundaries A set which contains the outlet boundary IDs
43 * @param check_diamond_cells If true, the diamond shaped cells are found
44 * and added to the particle-wall contact search cells
45 * @param expand_particle_wall_contact_search If true, expands the
46 * particle-wall contact search by adding the contact search between
47 * particles in the boundary cells with the boundary neighbors of these
48 * boundary cells
49 * @param pcout
50 */
51 void
52 build(
53 const parallel::distributed::Triangulation<dim> &triangulation,
54 const Parameters::Lagrangian::FloatingWalls<dim> &floating_wall_properties,
55 const std::set<types::boundary_id> &outlet_boundaries,
56 const bool &check_diamond_cells,
57 const bool &expand_particle_wall_contact_search,
58 const ConditionalOStream &pcout);
59
60 void
61 build(const parallel::distributed::Triangulation<dim> &triangulation,
62 const std::set<types::boundary_id> &outlet_boundaries,
63 const bool &check_diamond_cells,
64 const ConditionalOStream &pcout);
65
66 std::map<int, boundary_cells_info_struct<dim>> &
71
72 std::unordered_map<std::string, cell_point_info<dim>> &
77
78 std::unordered_map<std::string, cell_line_info<dim>> &
83
84 std::unordered_map<
85 types::particle_index,
86 std::set<typename Triangulation<dim>::active_cell_iterator>> &
91
92 /**
93 * Carries out updating the boundary information (point on boundary face and
94 * its normal vector) after moving the grid.
95 *
96 * @param new_boundary_points_and_normal_vectors Normal vector and a point
97 * on the boundary faces which are updated after motion of the grid
98 */
99 void
102 &new_boundary_points_and_normal_vectors);
103
104private:
105 /**
106 * Loops over all the cells to find boundary cells, find the boundary faces of
107 * boundary cells and for the boundary faces the normal vector and a point
108 * locating on the face are obtained
109 *
110 * @param triangulation Triangulation to access the information of the cells
111 * @param outlet_boundaries A set which contains the outlet boundary IDs
112 */
113 void
115 const parallel::distributed::Triangulation<dim> &triangulation,
116 const std::set<types::boundary_id> &outlet_boundaries);
117
118 /**
119 * Loops over all the cells to find boundary cells, find the global boundary
120 * cells with faces. Note that the boundary_cells_with_faces container only
121 * stores the local boundary cells, while global_boundary_cells_with_faces
122 * stores all the boundary cells with faces.
123 *
124 * @param triangulation Triangulation to access the information of the cells
125 * @param outlet_boundaries A set which contains the outlet boundary IDs
126 */
127 void
129 const parallel::distributed::Triangulation<dim> &triangulation,
130 const std::set<types::boundary_id> &outlet_boundaries);
131
132 /**
133 * Loops over all the cells to find cells which should be searched for
134 * particle-line contact, boundary lines and a point locating on each line are
135 * obtained
136 *
137 * @param triangulation Triangulation to access the information of the cells
138 */
139 void
141 const parallel::distributed::Triangulation<dim> &triangulation);
142
143 /**
144 * Adds the cells with boundary lines to the boundary cells information
145 * (boundary_cells_information). First , it loops through the
146 * boundary_cells_with_lines vector, then it loops through the neighbors of
147 * boundary_cells_with_lines; if a neighbor is a member of
148 * boundary_cells_with_faces, then it adds the neighbor cell to the
149 * boundary_cells_information with the normal vector and point of the neighbor
150 * cell.
151 *
152 * @param triangulation Triangulation to access the information of the cells
153 * @param outlet_boundaries A set which contains the outlet boundary IDs
154 * @param check_diamond_cells If true, the diamond shaped cells are found and added to the particle-wall contact search cells
155 * @param pcout
156 */
157 void
159 const parallel::distributed::Triangulation<dim> &triangulation,
160 const std::set<types::boundary_id> &outlet_boundaries,
161 const bool &check_diamond_cells,
162 const ConditionalOStream &pcout);
163
164 /**
165 * Loops over all the cells to find cells which should be searched for
166 * particle-floating wall contact, normal vector of each cell is also obtained
167 *
168 * @param triangulation Triangulation to access the information of the cells
169 * @param floating_wall_properties Properties of floating walls specified in
170 * the parameter handler file
171 * @param maximum_cell_diameter Maximum cell length in the triangulation
172 */
173 void
175 const parallel::distributed::Triangulation<dim> &triangulation,
176 const Parameters::Lagrangian::FloatingWalls<dim> &floating_wall_properties,
177 const double maximum_cell_diameter);
178
179 /**
180 * Carries out adding new elements with the boundary cells (cells with
181 * boundary faces) and information (point and normal vector) of their neighbor
182 * boundary cells to the boundary_cells_information. By adding these
183 * elements, the broad and fine searches will search for potential contacts
184 * of the particles in each boundary cell with the boundary neighbors of these
185 * cells. This function is used to solve the problem of late contact detection
186 * in triangulations with curved boundaries.
187 *
188 * @param triangulation Triangulation used in the DEM simulation
189 * @param boundary_cells_information A container that contains the information
190 * of all the boundary cells with boundary faces
191 * @param outlet_boundaries A set which contains the outlet boundary IDs
192 * @param global_boundary_cells_information A map that contains the geometrical
193 * information of all (global) boundary cells
194 */
195 void
197 const parallel::distributed::Triangulation<dim> &triangulation,
198 const std::set<types::boundary_id> &outlet_boundaries,
200 const std::map<int, boundary_cells_info_struct<dim>>
202
203 // Structure that contains the necessary information for boundaries
204 std::map<int, boundary_cells_info_struct<dim>> boundary_cells_information;
205
206 // A structure that contains the geometrical information of all (global)
207 // boundary cells. This structure is used in the
208 // add_cells_with_boundary_lines_to_boundary_cells function
209 std::map<int, boundary_cells_info_struct<dim>>
211
212 // Structure that contains the boundary cells which have a line
213 std::unordered_map<std::string, cell_line_info<dim>>
215
216 // A vector of all the local cells with boundary lines. This vector is used in
217 // add_cells_with_boundary_lines_to_boundary_cells function.
218 std::vector<typename Triangulation<dim>::active_cell_iterator>
220
221 // Structure that contains the boundary cells which have a point
222 std::unordered_map<std::string, cell_point_info<dim>>
224
225 // Structure that contains the boundary cells with floating walls
226 std::unordered_map<
227 types::global_dof_index,
228 std::set<typename Triangulation<dim>::active_cell_iterator>>
230
231 // Structure that contains the local boundary cells with faces
232 std::vector<typename Triangulation<dim>::active_cell_iterator>
234
235 // Structure that contains the global boundary cells with faces
236 std::vector<typename Triangulation<dim>::active_cell_iterator>
238
239 // A map that contains updated points on boundaries and normal vectors of the
240 // boundary faces. This container is used when the grid is moving. We use this
241 // vector to update the boundary points and normal vectors in particle-wall
242 // contact list.
243 std::map<unsigned int, std::pair<Tensor<1, dim>, Point<dim>>>
245
246 // Boolean variables used for printing a warning only once
249};
250
251#endif
std::vector< typename Triangulation< dim >::active_cell_iterator > local_cells_with_boundary_lines
std::vector< typename Triangulation< dim >::active_cell_iterator > boundary_cells_with_faces
std::unordered_map< types::global_dof_index, std::set< typename Triangulation< dim >::active_cell_iterator > > boundary_cells_for_floating_walls
void find_boundary_cells_information(const parallel::distributed::Triangulation< dim > &triangulation, const std::set< types::boundary_id > &outlet_boundaries)
void update_boundary_info_after_grid_motion(typename DEM::dem_data_structures< dim >::boundary_points_and_normal_vectors &new_boundary_points_and_normal_vectors)
std::unordered_map< std::string, cell_point_info< dim > > boundary_cells_with_points
std::vector< typename Triangulation< dim >::active_cell_iterator > global_boundary_cells_with_faces
std::map< int, boundary_cells_info_struct< dim > > & get_boundary_cells_information()
void build(const parallel::distributed::Triangulation< dim > &triangulation, const Parameters::Lagrangian::FloatingWalls< dim > &floating_wall_properties, const std::set< types::boundary_id > &outlet_boundaries, const bool &check_diamond_cells, const bool &expand_particle_wall_contact_search, const ConditionalOStream &pcout)
The build function builds all the boundary cell information structure that finds which cell has a bou...
std::unordered_map< std::string, cell_line_info< dim > > & get_boundary_cells_with_lines()
void add_cells_with_boundary_lines_to_boundary_cells(const parallel::distributed::Triangulation< dim > &triangulation, const std::set< types::boundary_id > &outlet_boundaries, const bool &check_diamond_cells, const ConditionalOStream &pcout)
std::unordered_map< std::string, cell_point_info< dim > > & get_boundary_cells_with_points()
std::unordered_map< std::string, cell_line_info< dim > > boundary_cells_with_lines
void add_boundary_neighbors_of_boundary_cells(const parallel::distributed::Triangulation< dim > &triangulation, const std::set< types::boundary_id > &outlet_boundaries, std::map< int, boundary_cells_info_struct< dim > > &boundary_cells_information, const std::map< int, boundary_cells_info_struct< dim > > &global_boundary_cells_information)
void find_global_boundary_cells_with_faces(const parallel::distributed::Triangulation< dim > &triangulation, const std::set< types::boundary_id > &outlet_boundaries)
std::map< int, boundary_cells_info_struct< dim > > global_boundary_cells_information
std::unordered_map< types::particle_index, std::set< typename Triangulation< dim >::active_cell_iterator > > & get_boundary_cells_with_floating_walls()
void find_particle_point_and_line_contact_cells(const parallel::distributed::Triangulation< dim > &triangulation)
void find_boundary_cells_for_floating_walls(const parallel::distributed::Triangulation< dim > &triangulation, const Parameters::Lagrangian::FloatingWalls< dim > &floating_wall_properties, const double maximum_cell_diameter)
std::map< unsigned int, std::pair< Tensor< 1, dim >, Point< dim > > > updated_boundary_points_and_normal_vectors
std::map< int, boundary_cells_info_struct< dim > > boundary_cells_information
Parameters for floating walls in DEM simulations.
ankerl::unordered_dense::map< global_face_id, std::pair< Tensor< 1, 3 >, Point< 3 > > > boundary_points_and_normal_vectors
Handle the information related to the boundary cells which will be used for particle-wall contact det...