Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
insertion_file.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2024-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_insertion_file_h
5#define lethe_insertion_file_h
6
7#include <dem/insertion.h>
8
9template <int dim, typename PropertiesIndex>
10class InsertionFile : public Insertion<dim, PropertiesIndex>
11{
12public:
13 /**
14 * @brief The InsertionFile class inserts particles using data stored in a file.
15 * This allows the insertion of any number of particles at a well-controlled
16 * location with any diameter value, translation, angular velocity and
17 * temperature.
18 *
19 * @param size_distribution_object_container Contains all distribution for each
20 * particle type
21 * @param triangulation Triangulation to access the cells in which the
22 * particles are inserted
23 * @param dem_parameters DEM parameters declared in the .prm file
24 */
25 InsertionFile(const std::vector<std::shared_ptr<Distribution>>
26 &size_distribution_object_container,
27 const parallel::distributed::Triangulation<dim> &triangulation,
28 const DEMSolverParameters<dim> &dem_parameters);
29
30 /**
31 * @brief The InsertionFile class inserts particles using data stored in a file.
32 * This allows the insertion of any number of particles at a well-controlled
33 * location with any diameter value, translation, angular velocity and
34 * temperature.
35 *
36 * @param particle_handler The particle handler of particles which are being
37 * inserted
38 * @param triangulation Triangulation to access the cells in which the
39 * particles are inserted
40 * @param dem_parameters DEM parameters declared in the .prm file
41 */
42 virtual void
43 insert(Particles::ParticleHandler<dim> &particle_handler,
44 const parallel::distributed::Triangulation<dim> &triangulation,
45 const DEMSolverParameters<dim> &dem_parameters) override;
46
47
48 /**
49 * @brief Carries out assigning the properties of inserted particles specifically
50 * for the file insertion method. In this method, the initial translation
51 * and angular velocities, the temperature and the diameter of each particles
52 * is set.
53 *
54 * @param dem_parameters DEM parameters declared in the .prm file
55 *
56 * @param inserted_this_step_this_proc Number of particles that are inserted
57 * at each insertion step on each processor. This value can change in the last
58 * insertion step to reach the desired number of particles
59 *
60 * @param particles_data Contains the particles
61 *
62 * @param particle_properties Properties of all inserted particles at each insertion step
63 */
64 void
66 const DEMSolverParameters<dim> &dem_parameters,
67 const unsigned int &inserted_this_step_this_proc,
68 std::map<std::string, std::vector<double>> &particles_data,
69 std::vector<std::vector<double>> &particle_properties);
70
71
72
73 /**
74 * @brief Serialize the file insertion object to an output archive.
75 *
76 * @param ar Output archive where the attributes are stored.
77 */
78 virtual void
79 serialize(boost::archive::text_oarchive &ar) override
80 {
83 }
84
85 /**
86 * @brief Deserialize an input archive to the file insertion object.
87 *
88 * @param ar Input archive where the attributes are stored.
89 *
90 */
91 virtual void
92 deserialize(boost::archive::text_iarchive &ar) override
93 {
96 }
97
98 // Number of remaining particles of each type that should be inserted in the
99 // upcoming insertion steps
102
103 // File id iterator
104 unsigned int current_file_id;
105 const unsigned int number_of_files;
106
107 // Files where the particles properties are stored.
108 const std::vector<std::string> insertion_files;
109};
110
111#endif /* lethe_insertion_file_h */
Handles all the parameters declared in the parameter handler file.
unsigned int current_inserting_particle_type
virtual void serialize(boost::archive::text_oarchive &ar) override
Serialize the file insertion object to an output archive.
void assign_particle_properties_for_file_insertion(const DEMSolverParameters< dim > &dem_parameters, const unsigned int &inserted_this_step_this_proc, std::map< std::string, std::vector< double > > &particles_data, std::vector< std::vector< double > > &particle_properties)
Carries out assigning the properties of inserted particles specifically for the file insertion method...
unsigned int current_file_id
virtual void insert(Particles::ParticleHandler< dim > &particle_handler, const parallel::distributed::Triangulation< dim > &triangulation, const DEMSolverParameters< dim > &dem_parameters) override
The InsertionFile class inserts particles using data stored in a file. This allows the insertion of a...
InsertionFile(const std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container, const parallel::distributed::Triangulation< dim > &triangulation, const DEMSolverParameters< dim > &dem_parameters)
The InsertionFile class inserts particles using data stored in a file. This allows the insertion of a...
const unsigned int number_of_files
virtual void deserialize(boost::archive::text_iarchive &ar) override
Deserialize an input archive to the file insertion object.
const std::vector< std::string > insertion_files
unsigned int remaining_particles_of_each_type
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