ObstacleField< dim, number, ObstacleType > Class Template Reference
|
Developer Documentation
|
#include <obstacle_field.hpp>
Public Member Functions | |
| ObstacleField (const ObstacleData< number > &data, const dealii::Triangulation< dim > &triangulation, const dealii::Mapping< dim > &mapping) | |
| Constructor. Initializes the obstacle field and supporting data structures. | |
| ObstacleField (const ObstacleData< number > &data, const dealii::Triangulation< dim > &triangulation, const dealii::Mapping< dim > &mapping, const std::vector< dealii::Point< dim, number > > &obstacle_locations, const std::vector< std::vector< number > > &obstacle_properties) | |
| Constructor. Initializes the obstacle field and supporting data structures. | |
| void | advance_time (const number time_step) |
| Advances the state of all obstacles in time by a single time step. | |
| void | compute_loads_on_obstacles () |
| Computes and applies the total load acting on each obstacle in the field. This includes both forces and torques. | |
| template<typename ObstacleLoadType > requires (!std::is_lvalue_reference_v<ObstacleLoadType>) | |
| void | add_load_type (ObstacleLoadType &&obstacle_load) |
| Adds a new obstacle load to the list of loads acting on obstacles. | |
| template<typename ObstacleContainer > | |
| void | get_obstacles_in_cell (const dealii::TriaIterator< dealii::CellAccessor< dim > > &cell, ObstacleContainer &particles) |
| boost::container::small_vector< DEMParticleAccessor< dim, number >, 3 *dim > | find_particles_in_neighborhood (const DEMParticleAccessor< dim, number > &particle, const number relative_tolerance) |
| void | compress () |
| void | print_accumulated_particle_quantities (const dealii::ConditionalOStream &pout) const |
| void | deserialize () |
| Performs the objects deserialization. | |
| template<class Archive > | |
| void | serialize (Archive &ar, const unsigned int version) |
| Serializes the internal state of the class. | |
| void | prepare_for_serialization () |
| Prepares this object for serialization. | |
| std::vector< AMR::AMRRegion< dim, number > > | get_refinement_regions () const |
| Return the AMR regions relevant for the obstacle field in region-based refinement. | |
| void | prepare_for_coarsening_and_refinement () |
| void | unpack_after_coarsening_and_refinement () |
| void | register_particle_output (Postprocessor< dim, number > &postprocessor) const |
| 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. | |
| std::ranges::subrange< ParticleIterator< dim, number > > | locally_owned_particle_range () const |
| std::ranges::subrange< ParticleIterator< dim, number > > | ghost_particle_range () const |
| std::ranges::subrange< ParticleIterator< dim, number > > | particles_in_cell (typename dealii::Triangulation< dim >::active_cell_iterator cell) const |
| unsigned int | n_global_particles () const |
| unsigned int | n_locally_owned_particles () const |
| unsigned int | n_ghost_particles () const |
| const dealii::Triangulation< dim > & | get_triangulation () const |
| MPI_Comm | get_mpi_communicator () const |
| number | compute_rayleigh_time_step () const |
| Computes the Rayleigh time step, scaled by a safety factor. | |
| void | subscribe_to_data_structure (std::function< void(CellListParticleHandler< dim, number, ObstacleType > &, const typename CellListParticleHandler< dim, number, ObstacleType >::NotifyEvent &)> callback) |
Private Attributes | |
| const ObstacleData< number > & | data |
| Struct holding configuration data for obstacles. | |
| std::vector< ObstacleLoad< dim, number, ObstacleType > > | loads |
| Vector of load objects representing all loads acting on the obstacles. | |
| CellListParticleHandler< dim, number, ObstacleType > | obstacle_data_structure |
| Obstacle search utility for locating relevant obstacles within a given cell or batch. | |
| MPI_Comm | mpi_communicator |
| MPI communicator used for parallel operations on the obstacle field. | |
Constructor & Destructor Documentation
◆ ObstacleField() [1/2]
| MeltPoolDG::ObstacleField< dim, number, ObstacleType >::ObstacleField | ( | const ObstacleData< number > & | data, |
| const dealii::Triangulation< dim > & | triangulation, | ||
| const dealii::Mapping< dim > & | mapping | ||
| ) |
Constructor. Initializes the obstacle field and supporting data structures.
This constructor reads obstacle input from file, initializes the internal particle handler, and prepares the obstacle field for simulation. After construction, the obstacle field is ready for further computations.
- Note
- Currently, only stationary obstacles are supported. A runtime assertion checks this condition.
- Parameters
-
data Obstacle-related configuration data. triangulation The triangulation on which the obstacles are placed. mapping Mapping used to interpret geometry on the given triangulation.
◆ ObstacleField() [2/2]
| MeltPoolDG::ObstacleField< dim, number, ObstacleType >::ObstacleField | ( | const ObstacleData< number > & | data, |
| const dealii::Triangulation< dim > & | triangulation, | ||
| const dealii::Mapping< dim > & | mapping, | ||
| const std::vector< dealii::Point< dim, number > > & | obstacle_locations, | ||
| const std::vector< std::vector< number > > & | obstacle_properties | ||
| ) |
Constructor. Initializes the obstacle field and supporting data structures.
This constructor initializes the internal particle handler with the provided obstacle locations and properties, preparing the obstacle field for simulation. After construction, the obstacle field is ready for further computations.
- Parameters
-
data Obstacle-related configuration data. triangulation The triangulation on which the obstacles are placed. mapping Mapping used to interpret geometry on the given triangulation. obstacle_locations Vector of obstacle center locations. obstacle_properties Vector of obstacle properties corresponding to each location.
Member Function Documentation
◆ add_load_type()
requires (!std::is_lvalue_reference_v<ObstacleLoadType>)
|
inline |
Adds a new obstacle load to the list of loads acting on obstacles.
This method appends the given load object to the internal list of load that are applied when computing the total load on an obstacle – this includes forces and torques.
- Parameters
-
obstacle_load The load object to be added. It is forwarded and stored via type erasure.
◆ advance_time()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::advance_time | ( | const number | time_step | ) |
Advances the state of all obstacles in time by a single time step.
- Parameters
-
time_step The size of the time step to advance.
◆ compress()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::compress | ( | ) |
This function compresses the forces and torques of the ghost particles by sending them to the owning rank of the particles and summing them up there.
- Note
- After a call to this function, the compressed value is exclusively available on the owning rank of the particle. The force and torque values on the ghost particles are not updated and should be considered invalid.
◆ compute_loads_on_obstacles()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::compute_loads_on_obstacles | ( | ) |
Computes and applies the total load acting on each obstacle in the field. This includes both forces and torques.
This method iterates over all registered loads in the loads vector and computes the cumulative load for each obstacle by summing the contributions of all individual load models. The resulting total load (force and torque) is then stored in the obstacle’s properties using the appropriate setter defined by ObstacleType.
◆ compute_rayleigh_time_step()
| number MeltPoolDG::ObstacleField< dim, number, ObstacleType >::compute_rayleigh_time_step | ( | ) | const |
Computes the Rayleigh time step, scaled by a safety factor.
The time step is derived from the average particle radius and density of the obstacles in the field, together with the Young's modulus and Poisson's ratio.
- Note
- If particle densities differ, the minimum density across all obstacles is used.
- Returns
- The estimated Rayleigh time step, scaled by a safety factor.
◆ deserialize()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::deserialize | ( | ) |
Performs the objects deserialization.
This function forwards the call to dealii::ParticleHandler::deserialize(). See the documentation of that function for further details.
◆ find_particles_in_neighborhood()
| boost::container::small_vector< MeltPoolDG::DEMParticleAccessor< dim, number >, 3 *dim > MeltPoolDG::ObstacleField< dim, number, ObstacleType >::find_particles_in_neighborhood | ( | const DEMParticleAccessor< dim, number > & | particle, |
| const number | relative_tolerance | ||
| ) |
This functions returns a vector of particles that are located within the influence area of a given particle. The neighborhood radius is defined as:
r_neighborhood = particle.radius() * (1 + relative_tolerance)
This captures two categories of neighbors:
- Contact neighbors: particles whose surfaces overlap or touch.
- Influence neighbors: particles close enough to exert non-contact interactions (e.g. van der Waals or lubrication forces).
- Parameters
-
particle The particle around which the neighborhood is constructed. relative_tolerance A non-negative scaling factor applied to the particle's radius to define the neighborhood extent. A value of 0 restricts the search to overlapping (contact) particles only.
- Returns
- All particles within the influence neighborhood of
particle, excludingparticleitself.
◆ get_mpi_communicator()
| MPI_Comm MeltPoolDG::ObstacleField< dim, number, ObstacleType >::get_mpi_communicator | ( | ) | const |
Return the MPI communicator used throughout the obstacle field.
◆ get_obstacles_in_cell()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::get_obstacles_in_cell | ( | const dealii::TriaIterator< dealii::CellAccessor< dim > > & | cell, |
| ObstacleContainer & | particles | ||
| ) |
Identify obstacles that likely at least partially occupy the specified cell. Note, that the returned particles are not guaranteed to be located within the cell, but they are guaranteed to include all particles that are located within the cell.
- Parameters
-
cell The cell of interest. The iterator must point to a cell within the triangulation that was used to initialize this object. particles Destination container where the properties of the identified obstacles will be added. If the container already contains particles, the function will append new particles to it, ensuring that no duplicates are added.
- Returns
- Vector containing the handles of the newly registered obstacles in
dst.
◆ get_refinement_regions()
| std::vector< MeltPoolDG::AMR::AMRRegion< dim, number > > MeltPoolDG::ObstacleField< dim, number, ObstacleType >::get_refinement_regions | ( | ) | const |
Return the AMR regions relevant for the obstacle field in region-based refinement.
This function computes and returns a vector of AMR regions corresponding to all particles in the obstacle field. Each particle contributes a spherical shell region, with the shell size determined by the parameters stored in the obstacle data structure associated with the object's obstacle field.
- Returns
- A vector of AMR regions for all particles in the field.
- Note
- The returned vector contains regions for all global particles, not just those local to the current process or subdomain.
◆ get_triangulation()
| const dealii::Triangulation< dim > & MeltPoolDG::ObstacleField< dim, number, ObstacleType >::get_triangulation | ( | ) | const |
Return the background triangulation on which the obstacles are placed.
◆ ghost_particle_range()
| std::ranges::subrange< MeltPoolDG::ParticleIterator< dim, number > > MeltPoolDG::ObstacleField< dim, number, ObstacleType >::ghost_particle_range | ( | ) | const |
Returns a range over all ghost obstacle particles on the current MPI process.
- Returns
- An iterable subrange representing all ghost particles.
◆ insert_obstacles()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::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.
This function takes a set of obstacle locations and their corresponding properties, and inserts them into the internal particle handler. It ensures that the obstacles are properly initialized and ready for simulation.
- Parameters
-
triangulation The triangulation on which the obstacles are placed. obstacle_locations A vector of points representing the locations of the obstacles. obstacle_properties A vector of vectors, where each inner vector contains the properties associated with the corresponding obstacle location.
◆ locally_owned_particle_range()
| std::ranges::subrange< MeltPoolDG::ParticleIterator< dim, number > > MeltPoolDG::ObstacleField< dim, number, ObstacleType >::locally_owned_particle_range | ( | ) | const |
Returns a subrange for iterating over particles that are owned locally.
- Returns
- An iterable subrange representing the local particles.
◆ n_ghost_particles()
| unsigned int MeltPoolDG::ObstacleField< dim, number, ObstacleType >::n_ghost_particles | ( | ) | const |
Return the number of ghost particles which are present on the current MPI rank.
◆ n_global_particles()
| unsigned int MeltPoolDG::ObstacleField< dim, number, ObstacleType >::n_global_particles | ( | ) | const |
Return the number of global particles, i.e., the total number of particles across all MPI ranks.
◆ n_locally_owned_particles()
| unsigned int MeltPoolDG::ObstacleField< dim, number, ObstacleType >::n_locally_owned_particles | ( | ) | const |
Return the number of particles owned by the current MPI rank.
◆ particles_in_cell()
| std::ranges::subrange< MeltPoolDG::ParticleIterator< dim, number > > MeltPoolDG::ObstacleField< dim, number, ObstacleType >::particles_in_cell | ( | typename dealii::Triangulation< dim >::active_cell_iterator | cell | ) | const |
Returns a subrange for iterating over particles for which the particle center location is contained in the specified active cell.
- Parameters
-
cell The active cell for which to retrieve particles.
- Returns
- An iterable subrange representing the particles in the cell.
◆ prepare_for_coarsening_and_refinement()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::prepare_for_coarsening_and_refinement | ( | ) |
Prepares the obstacle data structure for coarsening and refinement of the underlying triangulation. This call is necessary to ensure that the obstacle data structure remains consistent with the mesh after coarsening and refinement operations.
◆ prepare_for_serialization()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::prepare_for_serialization | ( | ) |
Prepares this object for serialization.
This function forwards the call to dealii::ParticleHandler::prepare_for_serialization(). See the documentation of that function for further details.
◆ print_accumulated_particle_quantities()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::print_accumulated_particle_quantities | ( | const dealii::ConditionalOStream & | pout | ) | const |
Computes the sum of the norms of the forces, linear velocities, and angular velocities of all particles and prints them to the given output stream.
- Parameters
-
pout The output stream to which the norms are printed.
- Note
- This function is intended to be used for testing purposes.
-
This is a collective operation and must be called on all MPI ranks in the MPI communicator of the obstacle field, also on those on which
poutis inactive.
◆ register_particle_output()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::register_particle_output | ( | Postprocessor< dim, number > & | postprocessor | ) | const |
Registers the obstacle handler for particle output.
- Parameters
-
postprocessor The postprocessor to which the particles are registered for output.
◆ serialize()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::serialize | ( | Archive & | ar, |
| const unsigned int | version | ||
| ) |
Serializes the internal state of the class.
This function forwards the call to dealii::ParticleHandler::serialize(). See the documentation of that function for further details.
- Parameters
-
ar The archive used for serialization or deserialization. version The serialization version.
◆ subscribe_to_data_structure()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::subscribe_to_data_structure | ( | std::function< void(CellListParticleHandler< dim, number, ObstacleType > &, const typename CellListParticleHandler< dim, number, ObstacleType >::NotifyEvent &)> | callback | ) |
Registers a callback function to be notified whenever the obstacle data structure is updated.
- Parameters
-
callback A callable that takes a reference to the obstacle data structure and the event type that triggered the update. The callable will be invoked whenever the obstacle data structure is updated, allowing the subscriber to react accordingly.
◆ unpack_after_coarsening_and_refinement()
| void MeltPoolDG::ObstacleField< dim, number, ObstacleType >::unpack_after_coarsening_and_refinement | ( | ) |
Unpacks the obstacle data structure after coarsening and refinement operations. This call is necessary to ensure that the obstacle data structure remains consistent with the mesh after coarsening and refinement operations.
- Note
- It is required that prepare_for_coarsening_and_refinement() has been called before the triangulation was coarsened and refined.
Member Data Documentation
◆ data
|
private |
Struct holding configuration data for obstacles.
◆ loads
|
private |
Vector of load objects representing all loads acting on the obstacles.
◆ mpi_communicator
|
private |
MPI communicator used for parallel operations on the obstacle field.
◆ obstacle_data_structure
|
private |
Obstacle search utility for locating relevant obstacles within a given cell or batch.
The documentation for this class was generated from the following files:
- include/meltpooldg/particles/obstacle_field.hpp
- source/particles/obstacle_field.cpp
Generated by