4#ifndef lethe_force_chains_visualization_h
5#define lethe_force_chains_visualization_h
15#include <boost/range/adaptor/map.hpp>
31template <
int dim,
typename PropertiesIndex>
53 &local_adjacent_particles,
55 &ghost_adjacent_particles,
56 std::vector<Point<3>> &vertices,
57 std::vector<double> &normal_forces_vector) = 0;
82 const MPI_Comm mpi_communicator,
83 const std::string folder,
84 const unsigned int iter,
87 &local_adjacent_particles,
89 &ghost_adjacent_particles) = 0;
107 typename PropertiesIndex,
115 rolling_friction_model>
145 const MPI_Comm mpi_communicator,
146 const std::string folder,
147 const unsigned int iter,
150 &local_adjacent_particles,
152 &ghost_adjacent_particles)
override;
173 &local_adjacent_particles,
175 &ghost_adjacent_particles,
176 std::vector<Point<3>> &vertices,
177 std::vector<double> &normal_forces_vector)
override;
193 template <ContactType contact_type,
typename ContactInfoContainer>
196 std::vector<Point<3>> &vertices,
197 std::vector<double> &normal_forces_vector)
200 if (adjacent_particles_list.second_particles.empty())
203 const double force_calculation_threshold_distance =
207 Tensor<1, 3> normal_unit_vector;
208 Tensor<1, 3> normal_force;
209 Tensor<1, 3> tangential_force;
210 Tensor<1, 3> particle_one_tangential_torque;
211 Tensor<1, 3> particle_two_tangential_torque;
212 Tensor<1, 3> rolling_resistance_torque;
213 double normal_relative_velocity_value;
214 Tensor<1, 3> tangential_relative_velocity;
219 auto particle_one = adjacent_particles_list.particle_one;
220 auto particle_one_properties = particle_one->get_properties();
223 Point<3> particle_one_location = this->
get_location(particle_one);
225 for (
auto &&contact_info :
226 adjacent_particles_list.second_particles | boost::adaptors::map_values)
230 auto particle_two = contact_info.particle_two;
231 auto particle_two_properties = particle_two->get_properties();
237 if (particle_one->get_id() < particle_two->get_id())
242 Point<3> particle_two_location = this->
get_location(particle_two);
245 double normal_overlap =
246 0.5 * (particle_one_properties[PropertiesIndex::dp] +
247 particle_two_properties[PropertiesIndex::dp]) -
248 particle_one_location.distance(particle_two_location);
250 if (normal_overlap > force_calculation_threshold_distance)
253 normal_relative_velocity_value,
255 particle_one_properties,
256 particle_two_properties,
257 particle_one_location,
258 particle_two_location);
262 tangential_relative_velocity,
263 normal_relative_velocity_value,
267 particle_one_properties,
268 particle_two_properties,
271 particle_one_tangential_torque,
272 particle_two_tangential_torque,
273 rolling_resistance_torque);
275 vertices.push_back(particle_one_location);
276 vertices.push_back(particle_two_location);
277 normal_forces_vector.push_back(
278 scalar_product(normal_force, normal_unit_vector));
297 Tensor<1, 3> &tangential_relative_velocity,
298 double &normal_relative_velocity_value,
299 Tensor<1, 3> &normal_unit_vector,
300 const ArrayView<const double> &particle_one_properties,
301 const ArrayView<const double> &particle_two_properties,
302 const Point<3> &particle_one_location,
303 const Point<3> &particle_two_location)
306 Tensor<1, 3> contact_vector = particle_two_location - particle_one_location;
309 normal_unit_vector = contact_vector / contact_vector.norm();
313 Tensor<1, 3> particle_one_omega, particle_two_omega;
316 Tensor<1, 3> contact_relative_velocity;
319 contact_relative_velocity[0] =
320 particle_one_properties[PropertiesIndex::v_x] -
321 particle_two_properties[PropertiesIndex::v_x];
322 contact_relative_velocity[1] =
323 particle_one_properties[PropertiesIndex::v_y] -
324 particle_two_properties[PropertiesIndex::v_y];
325 contact_relative_velocity[2] =
326 particle_one_properties[PropertiesIndex::v_z] -
327 particle_two_properties[PropertiesIndex::v_z];
329 particle_one_omega[0] = particle_one_properties[PropertiesIndex::omega_x];
330 particle_one_omega[1] = particle_one_properties[PropertiesIndex::omega_y];
331 particle_one_omega[2] = particle_one_properties[PropertiesIndex::omega_z];
333 particle_two_omega[0] = particle_two_properties[PropertiesIndex::omega_x];
334 particle_two_omega[1] = particle_two_properties[PropertiesIndex::omega_y];
335 particle_two_omega[2] = particle_two_properties[PropertiesIndex::omega_z];
339 contact_relative_velocity += (cross_product_3d(
340 0.5 * (particle_one_properties[PropertiesIndex::dp] * particle_one_omega +
341 particle_two_properties[PropertiesIndex::dp] * particle_two_omega),
342 normal_unit_vector));
348 normal_relative_velocity_value =
349 contact_relative_velocity * normal_unit_vector;
353 tangential_relative_velocity =
354 contact_relative_velocity -
355 (normal_relative_velocity_value * normal_unit_vector);
368 const std::vector<Point<3>> &vertices);
Handles all the parameters declared in the parameter handler file.
The PVDHandler class manages the storage of the information required to write pvd file....
void calculate_contact(particle_particle_contact_info< dim > &contact_info, const Tensor< 1, 3 > &tangential_relative_velocity, const double normal_relative_velocity_value, const Tensor< 1, 3 > &normal_unit_vector, const double normal_overlap, const double dt, const ArrayView< const double > &particle_one_properties, const ArrayView< const double > &particle_two_properties, Tensor< 1, 3 > &normal_force, Tensor< 1, 3 > &tangential_force, Tensor< 1, 3 > &particle_one_tangential_torque, Tensor< 1, 3 > &particle_two_tangential_torque, Tensor< 1, 3 > &rolling_resistance_torque)
double get_force_calculation_threshold_distance()
Point< 3 > get_location(const Particles::ParticleIterator< dim > &particle) &
ParticleParticleContactForce(const DEMSolverParameters< dim > &dem_parameters)
Base class for the particles force chains contact force models. This class does not implement any of ...
virtual ~ParticlesForceChainsBase()=default
virtual void write_force_chains(const DEMSolverParameters< dim > &dem_parameters, PVDHandler &pvd_handler, const MPI_Comm mpi_communicator, const std::string folder, const unsigned int iter, const double time, typename dem_data_structures< dim >::adjacent_particle_pairs &local_adjacent_particles, typename dem_data_structures< dim >::adjacent_particle_pairs &ghost_adjacent_particles)=0
Output the force chains in VTU and PVTU files for each iteration and a PVD file.
virtual void calculate_force_chains(typename dem_data_structures< dim >::adjacent_particle_pairs &local_adjacent_particles, typename dem_data_structures< dim >::adjacent_particle_pairs &ghost_adjacent_particles, std::vector< Point< 3 > > &vertices, std::vector< double > &normal_forces_vector)=0
Use a ParticleParticleContactForce object to calculate normal forces between particles....
void update_contact_information(Tensor< 1, 3 > &tangential_relative_velocity, double &normal_relative_velocity_value, Tensor< 1, 3 > &normal_unit_vector, const ArrayView< const double > &particle_one_properties, const ArrayView< const double > &particle_two_properties, const Point< 3 > &particle_one_location, const Point< 3 > &particle_two_location)
Update the contact pair information for all contact force calculations.
void multi_general_cell(Triangulation< 1, 3 > &tria, const std::vector< Point< 3 > > &vertices)
Create a triangulation with a unique cell (represented by a line) for each normal force between two p...
virtual ~ParticlesForceChains()=default
void write_force_chains(const DEMSolverParameters< dim > &dem_parameters, PVDHandler &pvd_handler, const MPI_Comm mpi_communicator, const std::string folder, const unsigned int iter, const double time, typename dem_data_structures< dim >::adjacent_particle_pairs &local_adjacent_particles, typename dem_data_structures< dim >::adjacent_particle_pairs &ghost_adjacent_particles) override
Output the force chains in VTU and PVTU files for each iteration and a PVD file.
ParticlesForceChains(const DEMSolverParameters< dim > &dem_parameters)
void execute_contact_calculation(ContactInfoContainer &adjacent_particles_list, std::vector< Point< 3 > > &vertices, std::vector< double > &normal_forces_vector)
Execute the contact calculation step for the particle-particle contact only for local-local and local...
void calculate_force_chains(typename dem_data_structures< dim >::adjacent_particle_pairs &local_adjacent_particles, typename dem_data_structures< dim >::adjacent_particle_pairs &ghost_adjacent_particles, std::vector< Point< 3 > > &vertices, std::vector< double > &normal_forces_vector) override
Calculate normal forces between all touching particles with ParticleParticleContactForce class' metho...
This namespace defines all the data containers and required operations on these containers for the DE...
ParticleParticleContactForceModel
Contact force model for particle-particle interactions.
RollingResistanceMethod
Method used to compute the rolling resistance torque.
ankerl::unordered_dense::map< types::particle_index, adjacent_particle_pairs_value > adjacent_particle_pairs