Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
insertion_plane.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2023-2025 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_insertion_plane_h
5#define lethe_insertion_plane_h
6
7#include <dem/insertion.h>
8
9/**
10 * @brief Insertion of particles using cells cut by a plane.
11 * Particle insertion using cells cut by a plane. Locally owned cells that are
12 * cut by the plane are flagged. From those flagged cells, we insert a particle
13 * at their centroids if they are individually empty (contain no particle). This
14 * way, no significant overlap is occurring on the insertion of new particle
15 * which can occur with other insertion method.
16 */
17template <int dim, typename PropertiesIndex>
18class InsertionPlane : public Insertion<dim, PropertiesIndex>
19{
20public:
21 /**
22 * The plane insertion class insert particles using a plane
23 * define by a point and a normal vector. This method of insertion can be
24 * useful when dealing with a domain close to be fully filled with particle.
25 * In this situation, other insertion method have a high risk to create a big
26 * overlap between particles on insertion. The plane insertion method mitigate
27 * this risk by insertion at the center of empty cells.
28 *
29 * @param size_distribution_object_container Contains all distribution for each
30 * particle type
31 * @param triangulation Triangulation to access the cells in which the
32 * particles are inserted
33 * @param dem_parameters DEM parameters declared in the .prm file
34 */
35 InsertionPlane(const std::vector<std::shared_ptr<Distribution>>
36 &size_distribution_object_container,
37 const parallel::distributed::Triangulation<dim> &triangulation,
38 const DEMSolverParameters<dim> &dem_parameters);
39
40 /**
41 * Carries out the insertion of particles.
42 * @param particle_handler The particle handler of particles which are being
43 * inserted.
44 * @param triangulation Triangulation to access the cells in which the
45 * particles are inserted.
46 * @param dem_parameters DEM parameters declared in the .prm file.
47 */
48 virtual void
49 insert(Particles::ParticleHandler<dim> &particle_handler,
50 const parallel::distributed::Triangulation<dim> &triangulation,
51 const DEMSolverParameters<dim> &dem_parameters) override;
52
53
54 /**
55 * @brief Serialize the plane insertion object to an output archive.
56 *
57 * @param ar Output archive where the attributes are stored.
58 */
59 virtual void
60 serialize(boost::archive::text_oarchive &ar) override
61 {
63 }
64
65 /**
66 * @brief Deserialize an input archive to the plane insertion object.
67 *
68 * @param ar Input archive where the attributes are stored.
69 *
70 */
71 virtual void
72 deserialize(boost::archive::text_iarchive &ar) override
73 {
75 }
76
77private:
78 /**
79 * @brief Store the cells that are cut by the plane.
80 *
81 * @param triangulation Triangulation to access the cells in which the
82 * particles are inserted
83 * @param plane_point Point which define the plane
84 * @param plane_normal_vector Vector which define the normal direction of
85 * the plane.
86 */
87 void
89 const parallel::distributed::Triangulation<dim> &triangulation,
90 const Point<3> &plane_point,
91 const Tensor<1, 3> &plane_normal_vector);
92
93 /**
94 * @brief Store the location of the centers of all the cells that are in the plane
95 */
96 void
98
99
100 std::set<typename Triangulation<dim>::active_cell_iterator>
105 std::unordered_map<unsigned int, Point<dim>> cells_centers;
106};
107
108#endif
Handles all the parameters declared in the parameter handler file.
std::unordered_map< unsigned int, Point< dim > > cells_centers
unsigned int current_inserting_particle_type
virtual void deserialize(boost::archive::text_iarchive &ar) override
Deserialize an input archive to the plane insertion object.
InsertionPlane(const std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container, const parallel::distributed::Triangulation< dim > &triangulation, const DEMSolverParameters< dim > &dem_parameters)
virtual void insert(Particles::ParticleHandler< dim > &particle_handler, const parallel::distributed::Triangulation< dim > &triangulation, const DEMSolverParameters< dim > &dem_parameters) override
void find_centers_of_inplane_cells()
Store the location of the centers of all the cells that are in the plane.
std::set< typename Triangulation< dim >::active_cell_iterator > plane_cells_for_insertion
void find_inplane_cells(const parallel::distributed::Triangulation< dim > &triangulation, const Point< 3 > &plane_point, const Tensor< 1, 3 > &plane_normal_vector)
Store the cells that are cut by the plane.
double maximum_range_for_randomness
virtual void serialize(boost::archive::text_oarchive &ar) override
Serialize the plane insertion object to an output archive.
int particles_of_each_type_remaining
Insertion(const std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container, const parallel::distributed::Triangulation< dim > &triangulation, const DEMSolverParameters< dim > &dem_parameters)
Carries out the insertion of particles. This is the base class of volume_insertion,...
Definition insertion.cc:10