Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
particle_particle_fine_search.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_particle_particle_fine_search_h
5#define lethe_particle_particle_fine_search_h
6
7#include <dem/contact_type.h>
9
10#include <array>
11
12using namespace dealii;
13
14/**
15 * @brief Selects adjacent_particle_pairs or periodic_adjacent_particle_pairs
16 * based on the contact_type
17 */
18template <int dim, ContactType contact_type>
19using adjacent_pairs_for_contact_t = std::conditional_t<
20 contact_type == local_periodic_particle_particle ||
21 contact_type == ghost_periodic_particle_particle ||
25
26
27/**
28 * @brief Iterates over a vector of maps (pairs_in_contact) to see if the
29 * particles which were in contact in the last time step, are still in contact
30 * or not. If they are still in contact it will update the collision info,
31 * including tangential displacement, based on new properties of the particle
32 * pair, if they are not in contact anymore it will delete the pair from the
33 * pairs_in_contact and also its information from pairs_in_contact_info.
34 * Then it iterates over the contact candidates from broad search to see if
35 * they already exist in the pairs_in_contact or not, if they are not in the
36 * pairs_in_contact and have an overlap, the pair will be added to the
37 * pairs_in_contact and its contact information will be stored in the
38 * corresponding element of the pairs_in_contact_info.
39 *
40 * @param particle_container A container that is used to obtain iterators to
41 * particles using their ids.
42 * @param adjacent_particles A map of maps which stores all the required
43 * information for calculation of the contact force of particle pairs. Can
44 * either be for non-periodic or periodic contact types.
45 * @param contact_pair_candidates The output of broad search which shows
46 * contact pair candidates.
47 * @param neighborhood_threshold A value which defines the neighbor particles.
48 * @param periodic_offset_per_direction An array whose component d holds the
49 * signed periodic offsets associated with each periodic directions. If the
50 * given d direction is not periodic, the signed distance is 0.
51 *
52 */
53template <int dim, ContactType contact_type>
54void
57 &particle_container,
60 &contact_pair_candidates,
61 const double neighborhood_threshold,
62 const std::array<double, dim> &periodic_offset_per_direction = {});
63
64
65/**
66 * @brief Find the translation that brings the nearest periodic image of
67 * particle two to particle one. Since periodic directions are axis-aligned
68 * and independent, this translation is found directly, one direction at a
69 * time.
70 *
71 * @param particle_one_location Location of particle one.
72 * @param particle_two_real_location Real (non-translated) location of
73 * particle two.
74 * @param periodic_offset_per_direction An array whose component d holds
75 * the signed periodic offset of the domain along direction d (0 if d is not
76 * periodic).
77 *
78 * @return The nearest translation, and whether any periodic direction
79 * required a nonzero translation. A pair whose nearest image requires no
80 * translation on any periodic direction is not a periodic contact (it is
81 * already handled by the non-periodic contact types).
82 */
83template <int dim>
84std::pair<Tensor<1, dim>, bool>
86 const Point<dim, double> &particle_one_location,
87 const Point<dim, double> &particle_two_real_location,
88 const std::array<double, dim> &periodic_offset_per_direction);
89
90#endif
@ ghost_periodic_particle_particle
@ ghost_local_periodic_particle_particle
@ local_periodic_particle_particle
std::conditional_t< contact_type==local_periodic_particle_particle|| contact_type==ghost_periodic_particle_particle|| contact_type==ghost_local_periodic_particle_particle, typename DEM::dem_data_structures< dim >::periodic_adjacent_particle_pairs, typename DEM::dem_data_structures< dim >::adjacent_particle_pairs > adjacent_pairs_for_contact_t
Selects adjacent_particle_pairs or periodic_adjacent_particle_pairs based on the contact_type.
void particle_particle_fine_search(const typename DEM::dem_data_structures< dim >::particle_index_iterator_map &particle_container, adjacent_pairs_for_contact_t< dim, contact_type > &adjacent_particles, const typename DEM::dem_data_structures< dim >::particle_particle_candidates &contact_pair_candidates, const double neighborhood_threshold, const std::array< double, dim > &periodic_offset_per_direction={})
Iterates over a vector of maps (pairs_in_contact) to see if the particles which were in contact in th...
std::pair< Tensor< 1, dim >, bool > nearest_periodic_translation(const Point< dim, double > &particle_one_location, const Point< dim, double > &particle_two_real_location, const std::array< double, dim > &periodic_offset_per_direction)
Find the translation that brings the nearest periodic image of particle two to particle one....
ankerl::unordered_dense::map< types::particle_index, Particles::ParticleIterator< dim > > particle_index_iterator_map
ankerl::unordered_dense::map< types::particle_index, periodic_adjacent_particle_pairs_value > periodic_adjacent_particle_pairs
ankerl::unordered_dense::map< types::particle_index, std::vector< types::particle_index > > particle_particle_candidates
ankerl::unordered_dense::map< types::particle_index, adjacent_particle_pairs_value > adjacent_particle_pairs