include/meltpooldg/particles/obstacle_field.hpp Source File

Developer Documentation: include/meltpooldg/particles/obstacle_field.hpp Source File
Developer Documentation
obstacle_field.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <deal.II/base/conditional_ostream.h>
4#include <deal.II/base/iterator_range.h>
5
6#include <deal.II/fe/mapping.h>
7
8#include <deal.II/grid/tria.h>
9#include <deal.II/grid/tria_accessor.h>
10
11#include <deal.II/particles/particle_accessor.h>
12#include <deal.II/particles/particle_handler.h>
13
23
24#include <ranges>
25#include <type_traits>
26#include <vector>
27
28namespace MeltPoolDG
29{
30 template <int dim, typename number, typename ObstacleType>
32 {
33 public:
49 const dealii::Triangulation<dim> &triangulation,
50 const dealii::Mapping<dim> &mapping);
51
66 const dealii::Triangulation<dim> &triangulation,
67 const dealii::Mapping<dim> &mapping,
68 const std::vector<dealii::Point<dim, number>> &obstacle_locations,
69 const std::vector<std::vector<number>> &obstacle_properties);
70
76 void
77 advance_time(const number time_step);
78
88 void
90
100 template <typename ObstacleLoadType>
101 requires(!std::is_lvalue_reference_v<ObstacleLoadType>) //
102 void
103 add_load_type(ObstacleLoadType &&obstacle_load)
104 {
105 loads.emplace_back(std::move(obstacle_load));
106 }
107
121 template <typename ObstacleContainer>
122 void
123 get_obstacles_in_cell(const dealii::TriaIterator<dealii::CellAccessor<dim>> &cell,
124 ObstacleContainer &particles);
125
145 boost::container::small_vector<DEMParticleAccessor<dim, number>, 3 * dim>
147 const number relative_tolerance);
148
157 void
158 compress();
159
165 void
166 print_accumulated_obstacle_force_norm(const dealii::ConditionalOStream pout) const;
167
174 void
175 deserialize();
176
186 template <class Archive>
187 void
188 serialize(Archive &ar, const unsigned int version);
189
196 void
198
212 std::vector<AMR::AMRRegion<dim, number>>
214
220 void
222
231 void
233
239 void
241
254 void
255 insert_obstacles(const dealii::Triangulation<dim> &triangulation,
256 const std::vector<dealii::Point<dim, number>> &obstacle_locations,
257 const std::vector<std::vector<number>> &obstacle_properties);
258
264 std::ranges::subrange<ParticleIterator<dim, number>>
266
272 std::ranges::subrange<ParticleIterator<dim, number>>
273 ghost_particle_range() const;
274
282 typename std::ranges::subrange<ParticleIterator<dim, number>>
283 particles_in_cell(typename dealii::Triangulation<dim>::active_cell_iterator cell) const;
284
289 unsigned int
290 n_global_particles() const;
291
299 void
301 std::function<
304 callback);
305
306 private:
309
311 std::vector<ObstacleLoad<dim, number, ObstacleType>> loads;
312
315
318 };
319
320 template <int dim, typename number, typename ObstacleType>
321 template <typename ObstacleContainer>
322 void
324 const dealii::TriaIterator<dealii::CellAccessor<dim>> &cell,
325 ObstacleContainer &particles)
326 {
327 obstacle_data_structure.get_obstacles_in_cell(cell, particles);
328 }
329
330 template <int dim, typename number, typename ObstacleType>
331 template <class Archive>
332 void
333 ObstacleField<dim, number, ObstacleType>::serialize(Archive &ar, const unsigned int version)
334 {
335 obstacle_data_structure.serialize(ar, version);
336 }
337} // namespace MeltPoolDG
Utilities for region-based adaptive mesh refinement (AMR).
Definition particle_accessor.hpp:20
Definition obstacle_field.hpp:32
void insert_obstacles(const dealii::Triangulation< dim > &triangulation, const std::vector< dealii::Point< dim, number > > &obstacle_locations, const std::vector< std::vector< number > > &obstacle_properties)
Insert obstacles into the particle handler based on provided locations and properties.
Definition obstacle_field.cpp:173
std::vector< ObstacleLoad< dim, number, ObstacleType > > loads
Vector of load objects representing all loads acting on the obstacles.
Definition obstacle_field.hpp:311
void add_load_type(ObstacleLoadType &&obstacle_load)
Adds a new obstacle load to the list of loads acting on obstacles.
Definition obstacle_field.hpp:103
void print_accumulated_obstacle_force_norm(const dealii::ConditionalOStream pout) const
Definition obstacle_field.cpp:124
CellListParticleHandler< dim, number, ObstacleType > obstacle_data_structure
Obstacle search utility for locating relevant obstacles within a given cell or batch.
Definition obstacle_field.hpp:314
void subscribe_to_data_structure(std::function< void(CellListParticleHandler< dim, number, ObstacleType > &, const typename CellListParticleHandler< dim, number, ObstacleType >::NotifyEvent &)> callback)
Definition obstacle_field.cpp:234
void advance_time(const number time_step)
Advances the state of all obstacles in time by a single time step.
Definition obstacle_field.cpp:51
void compress()
Definition obstacle_field.cpp:198
void serialize(Archive &ar, const unsigned int version)
Serializes the internal state of the class.
Definition obstacle_field.hpp:333
std::ranges::subrange< ParticleIterator< dim, number > > ghost_particle_range() const
Definition obstacle_field.cpp:212
void prepare_for_serialization()
Prepares this object for serialization.
Definition obstacle_field.cpp:62
void compute_loads_on_obstacles()
Computes and applies the total load acting on each obstacle in the field. This includes both forces a...
Definition obstacle_field.cpp:98
std::ranges::subrange< ParticleIterator< dim, number > > particles_in_cell(typename dealii::Triangulation< dim >::active_cell_iterator cell) const
Definition obstacle_field.cpp:219
void deserialize()
Performs the objects deserialization.
Definition obstacle_field.cpp:143
boost::container::small_vector< DEMParticleAccessor< dim, number >, 3 *dim > find_particles_in_neighborhood(const DEMParticleAccessor< dim, number > &particle, const number relative_tolerance)
Definition obstacle_field.cpp:188
std::ranges::subrange< ParticleIterator< dim, number > > locally_owned_particle_range() const
Definition obstacle_field.cpp:205
void get_obstacles_in_cell(const dealii::TriaIterator< dealii::CellAccessor< dim > > &cell, ObstacleContainer &particles)
Definition obstacle_field.hpp:323
void prepare_for_coarsening_and_refinement()
Definition obstacle_field.cpp:151
void register_particle_output(Postprocessor< dim, number > &postprocessor) const
Definition obstacle_field.cpp:165
unsigned int n_global_particles() const
Definition obstacle_field.cpp:227
std::vector< AMR::AMRRegion< dim, number > > get_refinement_regions() const
Return the AMR regions relevant for the obstacle field in region-based refinement.
Definition obstacle_field.cpp:69
const ObstacleData< number > & data
Struct holding configuration data for obstacles.
Definition obstacle_field.hpp:308
void unpack_after_coarsening_and_refinement()
Definition obstacle_field.cpp:158
MPI_Comm mpi_communicator
MPI communicator used for parallel operations on the obstacle field.
Definition obstacle_field.hpp:317
Definition postprocessor.hpp:32
Interface for a general preconditioner.
Definition boundary_condition_functions.hpp:17
Forward declaration of the CellListParticleHandler class template.
Definition obstacle_data_structure.hpp:210
NotifyEvent
Definition obstacle_data_structure.hpp:217
Definition obstacle_data.hpp:13