4#ifndef lethe_particle_wall_contact_force_templates_h
5#define lethe_particle_wall_contact_force_templates_h
34 rolling_friction_model>::
48 typename PropertiesIndex,
55 rolling_friction_model>::
56 calculate_particle_wall_contact(
58 &particle_wall_pairs_in_contact,
64 const double force_calculation_threshold_distance =
68 for (
auto &&pairs_in_contact_content :
69 particle_wall_pairs_in_contact | boost::adaptors::map_values)
73 for (
auto &&contact_info :
74 pairs_in_contact_content | boost::adaptors::map_values)
78 auto particle = contact_info.particle;
79 auto particle_properties = particle->get_properties();
80 Point<3> point_on_boundary = contact_info.point_on_boundary;
82 Tensor<1, 3> normal_vector = contact_info.normal_vector;
89 Tensor<1, 3> point_to_particle_vector =
90 particle_location_3d - point_on_boundary;
93 Tensor<1, 3> projected_vector =
97 double normal_overlap =
98 ((particle_properties[PropertiesIndex::dp]) * 0.5) -
99 (projected_vector.norm());
101 if (normal_overlap > force_calculation_threshold_distance)
103 Tensor<1, 3> tangential_relative_velocity;
104 double normal_relative_velocity_value;
105 Tensor<1, 3> normal_force;
106 Tensor<1, 3> tangential_force;
107 Tensor<1, 3> tangential_torque;
108 Tensor<1, 3> rolling_resistance_torque;
112 tangential_relative_velocity,
113 normal_relative_velocity_value,
114 particle_location_3d,
120 tangential_relative_velocity,
121 normal_relative_velocity_value,
128 rolling_resistance_torque);
131 types::particle_index particle_index =
132 particle->get_local_index();
133 Tensor<1, 3> &particle_torque =
134 contact_outcome.
torque[particle_index];
135 Tensor<1, 3> &particle_force =
136 contact_outcome.
force[particle_index];
141 rolling_resistance_torque,
149 thermal_boundary_type =
152 if ((thermal_boundary_type !=
155 (normal_overlap > 0))
157 const unsigned int particle_type =
158 static_cast<unsigned int>(
159 particle_properties[PropertiesIndex::type]);
160 const double temperature_particle =
161 particle_properties[PropertiesIndex::T];
162 double &particle_heat_transfer_rate =
165 double thermal_conductance;
169 0.5 * particle_properties[PropertiesIndex::dp],
182 thermal_conductance);
187 const Point<3> contact_point =
188 particle_location_3d - projected_vector;
189 const double temperature_wall =
195 temperature_particle,
198 particle_heat_transfer_rate);
205 contact_info.tangential_displacement.clear();
206 contact_info.rolling_resistance_spring_torque.clear();
214 typename PropertiesIndex,
221 rolling_friction_model>::
222 calculate_particle_solid_object_contact(
224 dim>::particle_floating_mesh_potentially_in_contact
225 &particle_floating_mesh_potentially_in_contact,
233 const double force_calculation_threshold_distance =
246 for (
unsigned int solid_counter = 0; solid_counter < solids.size();
250 const auto &[this_solid_es_neighbors, this_solid_vs_neighbors] =
251 solids[solid_counter]->get_neighbors_maps();
264 contact_record.clear();
267 dim>::particle_triangle_cell_from_mesh_potentially_in_contact
268 &particle_floating_mesh_potential_contact_pair =
269 particle_floating_mesh_potentially_in_contact[solid_counter];
276 std::size_t total_candidate_count = 0;
277 for (
const auto &triangle_entry :
278 particle_floating_mesh_potential_contact_pair)
279 total_candidate_count += triangle_entry.second.size();
280 contact_record.reserve(total_candidate_count);
283 for (
auto &[triangle_cell_iterator, map_info] :
284 particle_floating_mesh_potential_contact_pair)
286 if (map_info.empty())
292 triangle[vertex] = triangle_cell_iterator->vertex(vertex);
297 const auto triangle_data =
301 for (
auto &&contact_info : map_info | boost::adaptors::map_values)
305 auto &particle = contact_info.particle;
306 auto particle_properties = particle->get_properties();
307 const double particle_radius =
308 0.5 * particle_properties[PropertiesIndex::dp];
309 const Point<dim> particle_location = particle->get_location();
315 auto particle_triangle_information =
319 particle_radius - force_calculation_threshold_distance);
324 const auto &[pass_distance_check,
327 contact_indicator] = particle_triangle_information;
331 if (!pass_distance_check)
337 const double particle_triangle_distance =
341 const double normal_overlap =
342 particle_radius - particle_triangle_distance;
346 if (normal_overlap > force_calculation_threshold_distance)
349 contact_info.normal_vector = normal_vector;
350 contact_info.point_on_boundary = projection_point;
351 contact_info.boundary_id = solid_counter;
353 contact_record[particle->get_local_index()].emplace_back(
354 triangle_cell_iterator,
369 for (
auto &[particle_index, this_contact_record] : contact_record)
374 for (
auto C1 = this_contact_record.begin();
375 this_contact_record.size() > 1 &&
376 C1 != this_contact_record.end();)
379 auto T1_cell = C1->triangle_cell;
380 auto contact_indicator_C1 = C1->contact_indicator;
385 const auto &T1_es_neighbors = this_solid_es_neighbors.at(T1_cell);
386 const auto &T1_vs_neighbors = this_solid_vs_neighbors.at(T1_cell);
390 bool erase_contact_1 =
false;
391 auto C2 = std::next(C1);
392 while (C2 != this_contact_record.end())
395 auto T2_cell = C2->triangle_cell;
396 auto contact_indicator_C2 = C2->contact_indicator;
403 if (std::ranges::find(T1_es_neighbors, T2_cell) ==
404 T1_es_neighbors.end() &&
405 std::ranges::find(T1_vs_neighbors, T2_cell) ==
406 T1_vs_neighbors.end())
414 if (contact_indicator_C1 ==
421 if (contact_indicator_C2 ==
429 if (contact_indicator_C2 ==
436 if (std::ranges::find(T1_vs_neighbors, T2_cell) !=
437 T1_vs_neighbors.end())
445 C2 = this_contact_record.erase(C2);
453 C2 = this_contact_record.erase(C2);
458 if (contact_indicator_C1 ==
463 if (contact_indicator_C2 ==
473 erase_contact_1 =
true;
477 if (contact_indicator_C2 ==
485 if (std::ranges::find(T1_es_neighbors, T2_cell) !=
486 T1_es_neighbors.end())
489 C2 = this_contact_record.erase(C2);
504 if (contact_indicator_C1 ==
509 if (contact_indicator_C2 ==
519 erase_contact_1 =
true;
524 if (contact_indicator_C2 ==
533 if (std::ranges::find(T1_vs_neighbors, T2_cell) !=
534 T1_vs_neighbors.end())
536 erase_contact_1 =
true;
544 if (contact_indicator_C2 ==
550 C2 = this_contact_record.erase(C2);
561 C1 = this_contact_record.erase(C1);
572 const Tensor<1, 3> translational_velocity =
573 solids[solid_counter]->get_translational_velocity();
574 const Tensor<1, 3> angular_velocity =
575 solids[solid_counter]->get_angular_velocity();
576 const Point<3> center_of_rotation =
577 solids[solid_counter]->get_center_of_rotation();
581 thermal_boundary_type =
582 solids[solid_counter]->get_thermal_boundary_type();
584 for (
auto contact = this_contact_record.begin();
585 contact != this_contact_record.end();
589 auto normal_overlap = contact->normal_overlap;
591 *contact->contact_info;
595 auto &particle = contact_info.
particle;
596 auto particle_properties = particle->get_properties();
598 Tensor<1, 3> normal_force;
599 Tensor<1, 3> tangential_force;
600 Tensor<1, 3> tangential_torque;
601 Tensor<1, 3> rolling_resistance_torque;
602 double normal_relative_velocity_value;
603 Tensor<1, 3> tangential_relative_velocity;
608 tangential_relative_velocity,
609 normal_relative_velocity_value,
612 translational_velocity,
614 center_of_rotation.distance(particle_location_3d));
618 tangential_relative_velocity,
619 normal_relative_velocity_value,
626 rolling_resistance_torque);
633 rolling_resistance_torque,
634 contact_outcome.
torque[particle_index],
635 contact_outcome.
force[particle_index]);
638 if ((thermal_boundary_type !=
640 (normal_overlap > 0))
642 const unsigned int particle_type =
643 static_cast<unsigned int>(
644 particle_properties[PropertiesIndex::type]);
645 const double temperature_particle =
646 particle_properties[PropertiesIndex::T];
647 double &particle_heat_transfer_rate =
650 double thermal_conductance;
654 0.5 * particle_properties[PropertiesIndex::dp],
667 thermal_conductance);
669 const double temperature_wall =
670 solids[solid_counter]->get_temperature();
674 temperature_particle,
677 particle_heat_transfer_rate);
688 typename PropertiesIndex,
695 rolling_friction_model>::
723 const double wall_youngs_modulus = properties.youngs_modulus_wall;
724 const double wall_poisson_ratio = properties.poisson_ratio_wall;
725 const double wall_restitution_coefficient =
726 properties.restitution_coefficient_wall;
727 const double wall_friction_coefficient = properties.friction_coefficient_wall;
728 const double wall_rolling_friction_coefficient =
729 properties.rolling_friction_wall;
730 const double wall_rolling_viscous_damping =
731 properties.rolling_viscous_damping_wall;
732 const double wall_surface_energy = properties.surface_energy_wall;
733 const double wall_hamaker_constant = properties.hamaker_constant_wall;
738 const double particle_youngs_modulus =
739 properties.youngs_modulus_particle.at(i);
740 const double particle_poisson_ratio =
741 properties.poisson_ratio_particle.at(i);
742 const double particle_restitution_coefficient =
743 properties.restitution_coefficient_particle.at(i);
744 const double particle_friction_coefficient =
745 properties.friction_coefficient_particle.at(i);
746 const double particle_rolling_friction_coefficient =
747 properties.rolling_friction_coefficient_particle.at(i);
748 const double particle_rolling_viscous_damping_coefficient =
749 properties.rolling_viscous_damping_coefficient_particle.at(i);
750 const double particle_surface_energy =
751 properties.surface_energy_particle.at(i);
752 const double particle_hamaker_constant =
753 properties.hamaker_constant_particle.at(i);
757 (particle_youngs_modulus * wall_youngs_modulus) /
758 (wall_youngs_modulus *
759 (1. - particle_poisson_ratio * particle_poisson_ratio) +
760 particle_youngs_modulus *
761 (1. - wall_poisson_ratio * wall_poisson_ratio) +
765 (particle_youngs_modulus * wall_youngs_modulus) /
766 ((2. * wall_youngs_modulus * (2. - particle_poisson_ratio) *
767 (1. + particle_poisson_ratio)) +
768 (2. * particle_youngs_modulus * (2. - wall_poisson_ratio) *
769 (1. + wall_poisson_ratio)) +
774 wall_restitution_coefficient);
777 harmonic_mean(particle_friction_coefficient, wall_friction_coefficient);
781 wall_rolling_friction_coefficient);
785 wall_rolling_viscous_damping);
788 particle_surface_energy + wall_surface_energy -
789 std::pow(std::sqrt(particle_surface_energy) -
790 std::sqrt(wall_surface_energy),
794 0.5 * (particle_hamaker_constant + wall_hamaker_constant);
796 const double log_coeff_restitution =
799 log_coeff_restitution /
800 sqrt((log_coeff_restitution * log_coeff_restitution) + 9.8696);
806 typename PropertiesIndex,
813 rolling_friction_model>::
828 const double wall_real_youngs_modulus = properties.real_youngs_modulus_wall;
829 const double wall_poisson_ratio = properties.poisson_ratio_wall;
830 const double wall_surface_roughness = properties.surface_roughness_wall;
831 const double wall_surface_slope = properties.surface_slope_wall;
832 const double wall_microhardness = properties.microhardness_wall;
833 const double wall_thermal_accommodation =
834 properties.thermal_accommodation_wall;
840 const double particle_real_youngs_modulus =
841 properties.real_youngs_modulus_particle.at(i);
842 const double particle_poisson_ratio =
843 properties.poisson_ratio_particle.at(i);
844 const double particle_surface_roughness =
845 properties.surface_roughness_particle.at(i);
846 const double particle_surface_slope =
847 properties.surface_slope_particle.at(i);
848 const double particle_microhardness =
849 properties.microhardness_particle.at(i);
850 const double particle_thermal_accommodation =
851 properties.thermal_accommodation_particle.at(i);
853 properties.thermal_conductivity_particle.at(i);
857 (particle_real_youngs_modulus * wall_real_youngs_modulus) /
858 (wall_real_youngs_modulus *
859 (1. - particle_poisson_ratio * particle_poisson_ratio) +
860 particle_real_youngs_modulus *
861 (1. - wall_poisson_ratio * wall_poisson_ratio) +
864 sqrt(particle_surface_roughness * particle_surface_roughness +
865 wall_surface_roughness * wall_surface_roughness);
867 sqrt(particle_surface_slope * particle_surface_slope +
868 wall_surface_slope * wall_surface_slope);
872 ((2. - particle_thermal_accommodation) /
873 particle_thermal_accommodation +
874 (2. - wall_thermal_accommodation) / wall_thermal_accommodation) *
875 (2. * properties.specific_heats_ratio_gas) /
876 (1. + properties.specific_heats_ratio_gas) *
877 properties.molecular_mean_free_path_gas /
878 (properties.dynamic_viscosity_gas * properties.specific_heat_gas /
879 properties.thermal_conductivity_gas);
double harmonic_mean(const double &value_one, const double &value_two)
Handles all the parameters declared in the parameter handler file.
Parameters::Lagrangian::LagrangianPhysicalProperties lagrangian_physical_properties
Parameters::Lagrangian::BCDEM boundary_conditions
Parameters::Lagrangian::ForceTorqueOnWall< dim > forces_torques
Class where the outcomes of particle-particle interactions are stored.
std::vector< double > heat_transfer_rate
std::vector< Tensor< 1, 3 > > force
std::vector< Tensor< 1, 3 > > torque
Execute calculation of particle-wall contacts.
double gas_thermal_conductivity
std::vector< double > effective_coefficient_of_rolling_viscous_damping
std::map< types::boundary_id, Point< 3 > > point_on_rotation_vector
std::vector< double > equivalent_surface_slope
std::map< types::boundary_id, Parameters::Lagrangian::WallThermalBoundaryType > boundary_thermal_type_map
std::vector< particle_triangle_contact_record > solid_contact_records
Every solid-object is associated with a contact record. This container is index for each solid object...
std::vector< double > gas_parameter_m
void set_effective_properties(const DEMSolverParameters< dim > &dem_parameters)
Set every container needed to carry the particle-wall force calculation.
const double dmt_cut_off_threshold
void update_contact_information(particle_wall_contact_info< dim > &contact_info, Tensor< 1, 3 > &tangential_relative_velocity, double &normal_relative_velocity_value, const Point< 3 > &particle_location, const ArrayView< const double > &particle_properties, const double dt)
Update the contact pair information for contact calculations.
std::vector< double > effective_surface_energy
std::map< types::boundary_id, std::shared_ptr< Function< 3 > > > boundary_temperature_function
void update_particle_solid_object_contact_information(particle_wall_contact_info< dim > &contact_info, Tensor< 1, 3 > &tangential_relative_velocity, double &normal_relative_velocity_value, const ArrayView< const double > &particle_properties, const double dt, const Tensor< 1, 3 > &cut_cell_translational_velocity, const Tensor< 1, 3 > &cut_cell_rotational_velocity, const double center_of_rotation_particle_distance)
Update the contact pair information for particle-solid object contacts.
void calculate_contact(particle_wall_contact_info< dim > &contact_info, const Tensor< 1, 3 > &tangential_relative_velocity, const double normal_relative_velocity_value, const double normal_overlap, const double dt, const ArrayView< const double > &particle_properties, Tensor< 1, 3 > &normal_force, Tensor< 1, 3 > &tangential_force, Tensor< 1, 3 > &tangential_torque, Tensor< 1, 3 > &rolling_resistance_torque)
Calculate the particle-wall contact force and torque according to the contact model.
void apply_force_and_torque(const Tensor< 1, 3 > &normal_force, const Tensor< 1, 3 > &tangential_force, const Tensor< 1, 3 > &tangential_torque, const Tensor< 1, 3 > &rolling_resistance_torque, Tensor< 1, 3 > &particle_torque, Tensor< 1, 3 > &particle_force)
Apply the calculated force and torque on the particle in contact.
double get_boundary_temperature(const types::boundary_id boundary_id, const Point< 3 > &point) const
Return the temperature at a given point of a wall of the background triangulation....
ankerl::unordered_dense::map< types::particle_index, particle_triangle_contact_description > particle_triangle_contact_record
Contact record for one solid object, mapping the local index of every particle with at least one cont...
std::map< types::boundary_id, double > boundary_rotational_speed_map
std::vector< double > effective_youngs_modulus
std::vector< double > model_parameter_beta
std::vector< double > effective_coefficient_of_friction
double get_force_calculation_threshold_distance()
Calculate the minimum overlap at which particle-wall forces are computed. This function is useful for...
const unsigned int vertices_per_triangle
std::vector< double > effective_hamaker_constant
void set_multiphysic_properties(const DEMSolverParameters< dim > &dem_parameters)
Set every containers needed to carry the heat transfer rate calculation.
std::vector< double > effective_microhardness
double wall_thermal_conductivity
std::map< types::boundary_id, Tensor< 1, 3 > > boundary_translational_velocity_map
std::vector< double > equivalent_surface_roughness
unsigned int n_particle_types
std::vector< double > effective_real_youngs_modulus
std::vector< double > effective_shear_modulus
Parameters::Lagrangian::WallThermalBoundaryType get_thermal_boundary_type(const types::boundary_id boundary_id) const
Return the thermal boundary type of a wall of the background triangulation. The walls without a therm...
std::vector< double > effective_coefficient_of_restitution
std::vector< double > effective_coefficient_of_rolling_friction
const double f_coefficient_epsd
std::map< types::boundary_id, Tensor< 1, 3 > > boundary_rotational_vector
Point< 3 > center_mass_container
std::vector< double > particle_thermal_conductivity
static void clear_contact_info(particle_wall_contact_info< dim > &contact_info)
Clears the tangential displacement and rolling resistance spring torque from a contact info structure...
Tensor< 1, 3 > find_projection(const Tensor< 1, 3 > &vector_a, const Tensor< 1, 3 > &vector_b)
This function is used to find the projection of vector_a on vector_b.
Point< 3 > get_location(const Particles::ParticleIterator< dim > &particle)
Get the 3d location of the particle.
PropertiesIndex
Particle property indices for pure DEM simulations.
constexpr bool has_thermal_properties
Whether a properties index set carries thermal properties.
WallThermalBoundaryType
Thermal boundary type of the grid in multiphysic DEM. It is used to define the thermal boundary condi...
ParticleWallContactForceModel
Contact force model for particle-wall interactions.
RollingResistanceMethod
Method used to compute the rolling resistance torque.
SolidObjectThermalBoundaryType
Thermal boundary condition type applied on a solid object surface.
@ adiabatic
No heat flux through the solid boundary.
void calculate_contact_thermal_conductance(const double radius_one, const double radius_two, const double effective_youngs_modulus, const double effective_real_youngs_modulus, const double equivalent_surface_roughness, const double equivalent_surface_slope, const double effective_microhardness, const double thermal_conductivity_one, const double thermal_conductivity_two, const double thermal_conductivity_gas, const double gas_parameter_m, const double normal_overlap, const double normal_force_norm, double &thermal_conductance)
Calculate the total thermal conductance for particle-particle or particle-wall contacts.
void apply_heat_transfer_on_single_local_particle(const double temperature_one, const double temperature_two, const double thermal_conductance, double &particle_one_heat_transfer_rate)
Apply the heat transfer to a local particle. This function is used for local-ghost particle pairs or ...
DEM data structure containers To improve readability of containers, there's a simple description abov...
ankerl::unordered_dense::map< types::particle_index, ankerl::unordered_dense::map< global_face_id, particle_wall_contact_info< dim > > > particle_wall_in_contact
std::map< types::boundary_id, double > boundary_rotational_speed
std::map< types::boundary_id, Tensor< 1, 3 > > boundary_translational_velocity
std::map< types::boundary_id, std::shared_ptr< Function< 3 > > > boundary_temperature
std::map< types::boundary_id, WallThermalBoundaryType > thermal_boundary_type
std::map< types::boundary_id, Tensor< 1, 3 > > boundary_rotational_vector
std::map< types::boundary_id, Point< 3 > > point_on_rotation_axis
Handle the information related to the calculation of the particle-wall contact forces.
Particles::ParticleIterator< dim > particle