202 std::vector<Tensor<1, 3>> &contact_force,
203 std::vector<Tensor<1, 3>> &contact_torque)
205 using dealii::numbers::PI;
209 std::set<unsigned int>::iterator particle_contact_candidates_id;
210 for (particle_contact_candidates_id =
212 particle_contact_candidates_id !=
214 ++particle_contact_candidates_id)
216 const unsigned int particle_contact_id =
217 *particle_contact_candidates_id;
220 if (particle_one.particle_id < particle_two.particle_id)
229 [particle_two.particle_id];
233 for (
int d = 0; d < dim; ++d)
239 [particle_two.particle_id] = contact_info;
243 double normal_overlap;
244 Point<dim> contact_point;
245 Tensor<1, dim> normal;
246 std::vector<Point<dim>> contact_points_candidate;
250 particle_two.particle_id);
254 contact_points_candidate.push_back(iterator->second);
258 contact_points_candidate.push_back(
259 particle_one.position +
260 (particle_two.position - particle_one.position) *
261 (particle_one.radius /
262 (particle_one.radius + particle_two.radius)));
265 if (
typeid(*particle_one.shape) ==
typeid(
Sphere<dim>) &&
266 typeid(*particle_two.shape) ==
typeid(
Sphere<dim>))
268 auto contact_state = particle_one.shape->distance_to_shape(
269 *particle_two.shape, contact_points_candidate);
270 normal_overlap = -std::get<double>(contact_state);
271 contact_point = std::get<Point<dim>>(contact_state);
272 normal = std::get<Tensor<1, dim>>(contact_state);
274 else if (
typeid(*particle_one.shape) ==
typeid(
Sphere<dim>) &&
275 typeid(*particle_two.shape) !=
typeid(
Sphere<dim>))
277 auto contact_state = particle_one.shape->distance_to_shape(
278 *particle_two.shape, contact_points_candidate);
279 normal_overlap = -std::get<double>(contact_state);
280 contact_point = std::get<Point<dim>>(contact_state);
281 normal = std::get<Tensor<1, dim>>(contact_state);
283 else if (
typeid(*particle_one.shape) !=
typeid(
Sphere<dim>) &&
284 typeid(*particle_two.shape) ==
typeid(
Sphere<dim>))
286 auto contact_state = particle_two.shape->distance_to_shape(
287 *particle_one.shape, contact_points_candidate);
288 normal_overlap = -std::get<double>(contact_state);
289 contact_point = std::get<Point<dim>>(contact_state);
290 normal = -std::get<Tensor<1, dim>>(
296 auto contact_state = particle_one.shape->distance_to_shape(
297 *particle_two.shape, contact_points_candidate);
298 normal_overlap = -std::get<double>(contact_state);
299 contact_point = std::get<Point<dim>>(contact_state);
300 normal = std::get<Tensor<1, dim>>(contact_state);
303 [particle_two.particle_id] =
309 if (normal_overlap > 0)
312 double contact_radius_particle_one;
313 double contact_radius_particle_two;
314 if (
parameters->approximate_radius_for_contact)
316 contact_radius_particle_one = particle_one.radius;
317 contact_radius_particle_two = particle_two.radius;
321 contact_radius_particle_one =
322 particle_one.shape->local_curvature_radius(
324 contact_radius_particle_two =
325 particle_two.shape->local_curvature_radius(
328 Tensor<1, 3> normal_force;
329 Tensor<1, 3> tangential_force;
330 Tensor<1, 3> particle_one_tangential_torque;
331 Tensor<1, 3> particle_two_tangential_torque;
332 Tensor<1, 3> rolling_resistance_torque;
333 Tensor<1, 3> particle_one_velocity_3d =
335 Tensor<1, 3> particle_two_velocity_3d =
340 particle_one.friction_coefficient;
341 particle_one_properties.
object_mass = particle_one.mass;
343 particle_one.poisson_ratio;
345 contact_radius_particle_one;
347 particle_one.restitution_coefficient;
349 particle_one.rolling_friction_coefficient;
351 particle_one.youngs_modulus;
354 particle_two.friction_coefficient;
355 particle_two_properties.
object_mass = particle_two.mass;
357 particle_two.poisson_ratio;
359 contact_radius_particle_two;
361 particle_two.restitution_coefficient;
363 particle_two.rolling_friction_coefficient;
365 particle_two.youngs_modulus;
373 rolling_resistance_torque,
374 particle_one.position,
375 particle_one_velocity_3d,
377 particle_one_properties,
378 particle_two.position,
379 particle_two_velocity_3d,
381 particle_two_properties,
384 contact_force[particle_one.particle_id] -=
385 (normal_force + tangential_force);
386 contact_force[particle_two.particle_id] +=
387 (normal_force + tangential_force);
389 contact_torque[particle_one.particle_id] =
390 contact_torque[particle_one.particle_id] -
391 particle_one_tangential_torque + rolling_resistance_torque +
392 cross_product_3d((contact_point_3d -
394 -(normal_force + tangential_force));
395 contact_torque[particle_two.particle_id] =
396 contact_torque[particle_two.particle_id] -
397 particle_two_tangential_torque - rolling_resistance_torque +
398 cross_product_3d((contact_point_3d -
400 (normal_force + tangential_force));
406 for (
int d = 0; d < dim; ++d)
412 particle_two.particle_id);
606 std::vector<Tensor<1, 3>> &contact_force,
607 std::vector<Tensor<1, 3>> &contact_torque)
616 parameters->wall_rolling_friction_coefficient;
619 using dealii::numbers::PI;
624 if (particle.integrate_motion)
627 std::map<types::boundary_id, DefaultDBL_MAX> best_dist;
628 std::map<types::boundary_id, BoundaryCellsInfo> best_cells;
631 for (
auto boundary_cell_iter =
634 boundary_cell_iter++)
638 double dist = particle.get_levelset(
639 boundary_cell_iter->second.point_on_boundary);
646 best_dist[boundary_cell_iter->second.boundary_index].value)
648 best_dist[boundary_cell_iter->second.boundary_index].value =
650 best_cells[boundary_cell_iter->second.boundary_index] =
651 boundary_cell_iter->second;
662 for (
unsigned int i = 0;
674 ->floating_walls_normal_vectors[i];
678 floating_wall_cell_info;
685 for (
auto best_index_of_face = best_cells.begin();
686 best_index_of_face != best_cells.end();
687 ++best_index_of_face)
689 auto &boundary_cell = best_index_of_face->second;
691 auto boundary_cell_information = boundary_cell;
700 [boundary_cell.boundary_index];
704 for (
int d = 0; d < dim; ++d)
714 [boundary_cell.boundary_index] = contact_info;
717 Tensor<1, 3> normal =
719 auto point_on_boundary =
720 boundary_cell_information.point_on_boundary;
722 Point<3> particle_position_3d =
point_nd_to_3d(particle.position);
723 Tensor<1, 3> particle_velocity_3d =
734 Tensor<1, 3> rotation_axis;
736 if constexpr (dim == 2)
738 rotation_axis[2] = 1;
739 angle = std::atan2(-normal[0], normal[1]);
744 std::acos(scalar_product(Tensor<1, 3>({0, 0, 1}), normal) /
746 if (abs(scalar_product(Tensor<1, 3>({0, 0, 1}), normal)) !=
750 cross_product_3d(Tensor<1, 3>({0, 0, 1}), normal);
751 rotation_axis = rotation_axis / rotation_axis.norm();
755 rotation_axis = Tensor<1, 3>({0, 1, 0});
758 Tensor<2, 3> rotation_matrix =
759 Physics::Transformations::Rotations::rotation_matrix_3d(
760 rotation_axis, angle);
761 Tensor<1, 3> orientation =
762 particle.shape->rotation_matrix_to_xyz_angles(rotation_matrix);
764 std::shared_ptr<Shape<dim>> contact_plane =
765 std::make_shared<Plane<dim>>(point_on_boundary, orientation);
766 contact_plane->set_position(point_on_boundary);
767 contact_plane->set_orientation(orientation);
770 std::vector<Point<dim>> contact_point_candidate;
773 boundary_cell.boundary_index);
777 contact_point_candidate.push_back(iterator->second);
781 contact_point_candidate.push_back(point_on_boundary);
787 particle.shape->distance_to_shape(*contact_plane,
788 contact_point_candidate);
789 double normal_overlap = -2 * std::get<double>(contact_state);
790 Point<3> contact_point =
795 Tensor<1, 3> contact_normal = -normal;
801 [boundary_cell.boundary_index] =
802 std::get<Point<dim>>(contact_state);
804 if (normal_overlap > 0)
808 double contact_radius_particle_one;
810 if (
parameters->approximate_radius_for_contact)
812 contact_radius_particle_one = particle.radius;
816 contact_radius_particle_one =
817 particle.shape->local_curvature_radius(
818 std::get<Point<dim>>(contact_state));
824 Tensor<1, 3> normal_force;
825 Tensor<1, 3> tangential_force;
826 Tensor<1, 3> tangential_torque;
827 Tensor<1, 3> rolling_resistance_torque;
828 Tensor<1, 3> wall_velocity;
829 Tensor<1, 3> wall_angular_velocity;
830 Point<dim> wall_rotation_axis_point;
835 wall_angular_velocity,
836 wall_rotation_axis_point);
839 [boundary_cell.boundary_index]
840 .normal_overlap = normal_overlap;
842 [boundary_cell.boundary_index]
843 .normal_vector = normal;
847 particle.friction_coefficient;
850 particle.poisson_ratio;
852 contact_radius_particle_one;
854 particle.restitution_coefficient;
856 particle.rolling_friction_coefficient;
858 particle.youngs_modulus;
873 rolling_resistance_torque,
875 particle_velocity_3d,
878 wall_rotation_axis_point,
880 wall_angular_velocity,
885 contact_force[particle.particle_id] -=
886 (normal_force + tangential_force);
888 contact_torque[particle.particle_id] +=
889 tangential_torque + rolling_resistance_torque +
890 cross_product_3d((contact_point - particle_position_3d),
891 -(normal_force + tangential_force));
897 for (
int d = 0; d < dim; ++d)
914 std::vector<Tensor<1, 3>> &lubrication_force,
915 std::vector<Tensor<1, 3>> & )
917 using dealii::numbers::PI;
922 if (particle.integrate_motion)
925 std::map<types::boundary_id, DefaultDBL_MAX> best_dist;
926 std::map<types::boundary_id, BoundaryCellsInfo> best_cells;
929 for (
auto boundary_cell_iter =
932 boundary_cell_iter++)
937 double dist = particle.get_levelset(
938 boundary_cell_iter->second.point_on_boundary);
945 best_dist[boundary_cell_iter->second.boundary_index].value)
947 best_dist[boundary_cell_iter->second.boundary_index].value =
949 best_cells[boundary_cell_iter->second.boundary_index] =
950 boundary_cell_iter->second;
961 for (
unsigned int i = 0;
973 ->floating_walls_normal_vectors[i];
977 floating_wall_cell_info;
984 for (
auto best_index_of_face = best_cells.begin();
985 best_index_of_face != best_cells.end();
986 ++best_index_of_face)
988 auto &boundary_cell = best_index_of_face->second;
990 auto boundary_cell_information = boundary_cell;
991 Tensor<1, 3> normal =
993 auto point_on_boundary =
994 boundary_cell_information.point_on_boundary;
995 Tensor<1, 3> wall_velocity;
996 Tensor<1, 3> wall_angular_velocity;
997 Point<dim> wall_rotation_axis_point;
1002 wall_angular_velocity,
1003 wall_rotation_axis_point);
1004 Tensor<1, 3> wall_velocity_at_point =
1006 cross_product_3d(wall_angular_velocity,
1011 Point<3> particle_position_3d =
point_nd_to_3d(particle.position);
1012 Point<3> point_on_boundary_3d =
point_nd_to_3d(point_on_boundary);
1014 Tensor<1, 3> point_to_particle_vector =
1015 particle_position_3d - point_on_boundary_3d;
1021 Tensor<1, 3> projected_vector =
1022 ((point_to_particle_vector * normal) / (normal.norm_square())) *
1025 double gap = (projected_vector.norm()) - particle.radius;
1027 Tensor<1, 3> radial_vector;
1028 double radial_velocity;
1031 radial_vector = projected_vector;
1032 if (gap > 0 and gap < h_max)
1043 scalar_product(-radial_vector,
1044 particle.velocity - wall_velocity_at_point);
1045 f_lub = 3. / 2. * PI * mu * (particle.radius) *
1046 (particle.radius) / gap * radial_velocity *
1047 radial_vector / radial_vector.norm() -
1048 3. / 2. * PI * mu * (particle.radius) *
1049 (particle.radius) / h_max * radial_velocity *
1050 radial_vector / radial_vector.norm();
1054 lubrication_force[particle.particle_id] += f_lub;
1065 const double normal_overlap,
1067 Point<3> &contact_point,
1068 Tensor<1, 3> &contact_normal,
1069 Tensor<1, 3> &normal_force,
1070 Tensor<1, 3> &tangential_force,
1071 Tensor<1, 3> &rolling_resistance_torque,
1072 Point<dim> &particle_one_position,
1073 Tensor<1, 3> &particle_one_velocity,
1074 Tensor<1, 3> &particle_one_omega,
1076 Point<dim> &particle_two_position,
1077 Tensor<1, 3> &particle_two_velocity,
1078 Tensor<1, 3> &particle_two_omega,
1082 double effective_youngs_modulus;
1083 double effective_shear_modulus;
1084 double effective_coefficient_of_restitution;
1085 double effective_coefficient_of_friction;
1086 double effective_coefficient_of_rolling_friction;
1087 double model_parameter_beta;
1093 Tensor<1, 3> normal_unit_vector;
1094 double normal_relative_velocity_value;
1095 Tensor<1, 3> tangential_relative_velocity;
1104 effective_youngs_modulus =
1115 effective_shear_modulus =
1126 effective_coefficient_of_restitution =
1129 effective_coefficient_of_friction =
1132 effective_coefficient_of_rolling_friction =
1136 const double restitution_coefficient_particle_log =
1137 std::log(effective_coefficient_of_restitution);
1139 model_parameter_beta = restitution_coefficient_particle_log /
1140 sqrt(restitution_coefficient_particle_log *
1141 restitution_coefficient_particle_log +
1151 normal_unit_vector = contact_normal;
1154 Tensor<1, 3> contact_relative_velocity;
1157 Tensor<1, 3> velocity_of_particle_one_at_contact_point =
1158 particle_one_velocity +
1159 cross_product_3d(particle_one_omega,
1162 Tensor<1, 3> velocity_of_particle_two_at_contact_point =
1163 particle_two_velocity +
1164 cross_product_3d(particle_two_omega,
1166 contact_relative_velocity = (velocity_of_particle_one_at_contact_point -
1167 velocity_of_particle_two_at_contact_point);
1173 normal_relative_velocity_value =
1174 contact_relative_velocity * normal_unit_vector;
1178 tangential_relative_velocity =
1179 contact_relative_velocity -
1180 (normal_relative_velocity_value * normal_unit_vector);
1191 tangential_relative_velocity);
1196 double effective_mass =
1200 double effective_radius = (particle_one_properties.
object_radius *
1205 const double radius_times_overlap_sqrt =
1206 sqrt(effective_radius * normal_overlap);
1207 const double model_parameter_sn =
1208 2 * effective_youngs_modulus * radius_times_overlap_sqrt;
1212 double normal_spring_constant = 0.66665 * model_parameter_sn;
1213 double normal_damping_constant =
1214 -1.8257 * model_parameter_beta * sqrt(model_parameter_sn * effective_mass);
1215 double tangential_spring_constant =
1216 8.0 * effective_shear_modulus * radius_times_overlap_sqrt + DBL_MIN;
1220 ((normal_spring_constant * normal_overlap) * normal_unit_vector) +
1221 ((normal_damping_constant * normal_relative_velocity_value) *
1222 normal_unit_vector);
1230 double coulomb_threshold =
1231 effective_coefficient_of_friction * normal_force.norm();
1234 if (tangential_force.norm() > coulomb_threshold)
1240 (tangential_force / (tangential_force.norm() + DBL_MIN));
1245 Tensor<1, 3> omega_ij = particle_one_omega - particle_two_omega;
1246 Tensor<1, 3> omega_ij_direction = omega_ij / (omega_ij.norm() + DBL_MIN);
1249 rolling_resistance_torque =
1250 (-effective_coefficient_of_rolling_friction * effective_radius *
1251 normal_force.norm() * omega_ij_direction);
1263 using dealii::numbers::PI;
1264 double dt_dem = dt /
parameters->coupling_frequency;
1266 std::vector<Tensor<1, 3>> contact_force(
dem_particles.size());
1267 std::vector<Tensor<1, 3>> contact_wall_force(
dem_particles.size());
1268 std::vector<Tensor<1, 3>> contact_torque(
dem_particles.size());
1269 std::vector<Tensor<1, 3>> contact_wall_torque(
dem_particles.size());
1270 std::vector<Tensor<1, 3>> current_fluid_force(
dem_particles.size());
1271 std::vector<Tensor<1, 3>> current_fluid_torque(
dem_particles.size());
1272 std::vector<Tensor<1, 3>> lubrication_force(
dem_particles.size());
1273 std::vector<Tensor<1, 3>> lubrication_torque(
dem_particles.size());
1274 std::vector<Tensor<1, 3>> lubrication_wall_force(
dem_particles.size());
1275 std::vector<Tensor<1, 3>> lubrication_wall_torque(
dem_particles.size());
1286 Tensor<1, 3> gravity;
1292 for (
unsigned int p_i = 0; p_i <
dem_particles.size(); ++p_i)
1316 while (t + 0.5 * dt_dem < dt)
1319 std::vector<Tensor<1, 3>> last_velocity;
1320 std::vector<Point<dim>> last_position;
1321 std::vector<Tensor<1, 3>> last_omega;
1322 std::vector<Tensor<2, 3>> last_orientation_matrix;
1326 last_velocity = std::vector<Tensor<1, 3>>(
dem_particles.size());
1327 last_position = std::vector<Point<dim>>(
dem_particles.size());
1328 last_omega = std::vector<Tensor<1, 3>>(
dem_particles.size());
1329 last_orientation_matrix = std::vector<Tensor<2, 3>>(
dem_particles.size());
1331 std::vector<std::vector<Tensor<1, 3>>> k_velocity =
1332 std::vector<std::vector<Tensor<1, 3>>>(
dem_particles.size(),
1333 std::vector<Tensor<1, 3>>(4));
1334 std::vector<std::vector<Tensor<1, dim>>> k_position =
1335 std::vector<std::vector<Tensor<1, dim>>>(
1337 std::vector<std::vector<Tensor<1, 3>>> k_omega =
1338 std::vector<std::vector<Tensor<1, 3>>>(
dem_particles.size(),
1339 std::vector<Tensor<1, 3>>(4));
1340 std::vector<std::vector<Tensor<1, 3>>> k_orientation =
1341 std::vector<std::vector<Tensor<1, 3>>>(
dem_particles.size(),
1342 std::vector<Tensor<1, 3>>(4));
1343 std::vector<std::vector<Tensor<1, 3>>> k_impulsion =
1344 std::vector<std::vector<Tensor<1, 3>>>(
dem_particles.size(),
1345 std::vector<Tensor<1, 3>>(4));
1346 std::vector<std::vector<Tensor<1, 3>>> k_omega_impulsion =
1347 std::vector<std::vector<Tensor<1, 3>>>(
dem_particles.size(),
1348 std::vector<Tensor<1, 3>>(4));
1349 std::vector<std::vector<Tensor<1, 3>>> k_contact_impulsion =
1350 std::vector<std::vector<Tensor<1, 3>>>(
dem_particles.size(),
1351 std::vector<Tensor<1, 3>>(4));
1352 std::vector<std::vector<Tensor<1, 3>>> k_omega_contact_impulsion =
1353 std::vector<std::vector<Tensor<1, 3>>>(
dem_particles.size(),
1354 std::vector<Tensor<1, 3>>(4));
1357 for (
unsigned int step = 0; step < 4; ++step)
1359 std::ranges::fill(current_fluid_force, 0);
1360 std::ranges::fill(current_fluid_torque, 0);
1361 std::ranges::fill(contact_torque, 0);
1362 std::ranges::fill(contact_force, 0);
1363 std::ranges::fill(contact_wall_force, 0);
1364 std::ranges::fill(contact_wall_torque, 0);
1365 std::ranges::fill(lubrication_force, 0);
1366 std::ranges::fill(lubrication_torque, 0);
1367 std::ranges::fill(lubrication_wall_force, 0);
1368 std::ranges::fill(lubrication_wall_torque, 0);
1372 const double contact_dt = (step == 3) ? dt_dem : 0.5 * dt_dem;
1377 const double next_stage_dt = (step < 2) ? 0.5 * dt_dem : dt_dem;
1384 contact_wall_torque);
1393 lubrication_torque);
1398 lubrication_wall_force,
1399 lubrication_wall_torque);
1402 for (
unsigned int p_i = 0; p_i <
dem_particles.size(); ++p_i)
1411 last_orientation_matrix[p_i] =
1422 current_fluid_torque[p_i] =
dem_particles[p_i].fluid_torque;
1426 k_velocity[p_i][step] =
1427 (current_fluid_force[p_i] + contact_force[p_i] +
1428 contact_wall_force[p_i] + gravity +
1429 lubrication_force[p_i] + lubrication_wall_force[p_i]) /
1432 for (
int d = 0; d < dim; ++d)
1436 k_impulsion[p_i][step] =
1437 current_fluid_force[p_i] + gravity +
1438 contact_wall_force[p_i] + contact_force[p_i] +
1439 lubrication_force[p_i] + lubrication_wall_force[p_i];
1441 k_contact_impulsion[p_i][step] =
1442 contact_wall_force[p_i] + contact_force[p_i] +
1443 lubrication_force[p_i] + lubrication_wall_force[p_i];
1446 last_velocity[p_i] + k_velocity[p_i][step] * next_stage_dt;
1448 for (
int d = 0; d < dim; ++d)
1451 last_position[p_i][d] +
1452 k_position[p_i][step][d] * next_stage_dt;
1457 Tensor<1, 3> total_torque =
1459 (current_fluid_torque[p_i] + contact_torque[p_i] +
1460 contact_wall_torque[p_i]);
1463 Tensor<1, 3> angular_velocity_in_particle_frame =
1466 Tensor<1, 3> angular_acceleration_in_particle_frame;
1467 angular_acceleration_in_particle_frame[0] =
1471 angular_velocity_in_particle_frame[2] *
1472 angular_velocity_in_particle_frame[1]) /
1474 angular_acceleration_in_particle_frame[1] =
1478 angular_velocity_in_particle_frame[2] *
1479 angular_velocity_in_particle_frame[0]) /
1481 angular_acceleration_in_particle_frame[2] =
1485 angular_velocity_in_particle_frame[0] *
1486 angular_velocity_in_particle_frame[1]) /
1489 k_omega[p_i][step] =
1491 angular_acceleration_in_particle_frame;
1494 k_omega_impulsion[p_i][step] = current_fluid_torque[p_i] +
1495 contact_torque[p_i] +
1496 contact_wall_torque[p_i];
1498 k_omega_contact_impulsion[p_i][step] =
1499 contact_torque[p_i] + contact_wall_torque[p_i];
1507 last_omega[p_i] + k_omega[p_i][step] * next_stage_dt;
1508 Tensor<2, 3> new_rotation_matrix;
1509 if (k_orientation[p_i][step].norm() > 0)
1511 new_rotation_matrix =
1512 Physics::Transformations::Rotations::rotation_matrix_3d(
1513 k_orientation[p_i][step] /
1514 k_orientation[p_i][step].norm(),
1515 k_orientation[p_i][step].norm() * next_stage_dt) *
1516 last_orientation_matrix[p_i];
1519 new_rotation_matrix);
1528 if (
parameters->load_particles_from_file ==
false)
1585 const double elapsed_time = t + next_stage_dt;
1586 for (
int d = 0; d < dim; ++d)
1605 unsigned int particle_id = it->first;
1606 for (
auto it2 = it->second.begin(); it2 != it->second.end();
1609 unsigned int wall_id = it2->first;
1610 auto contact_info = it2->second;
1615 if (last_pw_contact_info.find(particle_id) !=
1616 last_pw_contact_info.end())
1618 auto previous_contact_info_iterator =
1619 last_pw_contact_info.find(particle_id)
1620 ->second.find(wall_id);
1621 if (previous_contact_info_iterator !=
1622 last_pw_contact_info.find(particle_id)->second.end())
1624 contact_info.tangential_displacement =
1625 previous_contact_info_iterator->second
1626 .tangential_displacement;
1630 contact_info.tangential_displacement = 0;
1636 contact_info.tangential_displacement = 0;
1644 unsigned int particle_one_id = it->first;
1645 for (
auto it2 = it->second.begin(); it2 != it->second.end();
1648 unsigned int particle_two_id = it2->first;
1649 auto contact_info = it2->second;
1654 if (last_pp_contact_info.find(particle_one_id) !=
1655 last_pp_contact_info.end())
1657 auto previous_contact_info_iterator =
1658 last_pp_contact_info.find(particle_one_id)
1659 ->second.find(particle_two_id);
1660 if (previous_contact_info_iterator !=
1661 last_pp_contact_info.find(particle_one_id)
1664 contact_info.tangential_displacement =
1665 previous_contact_info_iterator->second
1666 .tangential_displacement;
1670 contact_info.tangential_displacement = 0;
1675 contact_info.tangential_displacement = 0;
1681 for (
unsigned int p_i = 0; p_i <
dem_particles.size(); ++p_i)
1687 last_velocity[p_i] +
1689 (k_velocity[p_i][0] + 2 * k_velocity[p_i][1] +
1690 2 * k_velocity[p_i][2] + k_velocity[p_i][3]) /
1693 for (
int d = 0; d < dim; ++d)
1696 last_position[p_i][d] +
1698 (k_position[p_i][0][d] + 2 * k_position[p_i][1][d] +
1699 2 * k_position[p_i][2][d] + k_position[p_i][3][d]) /
1704 last_omega[p_i] + dt_dem *
1705 (k_omega[p_i][0] + 2 * k_omega[p_i][1] +
1706 2 * k_omega[p_i][2] + k_omega[p_i][3]) /
1708 Tensor<1, 3> angle_update_vector =
1709 (k_orientation[p_i][0] + 2 * k_orientation[p_i][1] +
1710 2 * k_orientation[p_i][2] + k_orientation[p_i][3]) /
1713 Tensor<2, 3> new_rotation_matrix;
1714 if (angle_update_vector.norm() > 0)
1716 new_rotation_matrix =
1717 Physics::Transformations::Rotations::rotation_matrix_3d(
1718 angle_update_vector / angle_update_vector.norm(),
1719 angle_update_vector.norm() * dt_dem) *
1720 last_orientation_matrix[p_i];
1723 new_rotation_matrix);
1731 (k_impulsion[p_i][0] + 2 * k_impulsion[p_i][1] +
1732 2 * k_impulsion[p_i][2] + k_impulsion[p_i][3]) /
1737 (k_contact_impulsion[p_i][0] + 2 * k_contact_impulsion[p_i][1] +
1738 2 * k_contact_impulsion[p_i][2] +
1739 k_contact_impulsion[p_i][3]) /
1744 (k_omega_impulsion[p_i][0] + 2 * k_omega_impulsion[p_i][1] +
1745 2 * k_omega_impulsion[p_i][2] + k_omega_impulsion[p_i][3]) /
1750 (k_omega_contact_impulsion[p_i][0] +
1751 2 * k_omega_contact_impulsion[p_i][1] +
1752 2 * k_omega_contact_impulsion[p_i][2] +
1753 k_omega_contact_impulsion[p_i][3]) /
1766 unsigned int particle_id = it->first;
1767 for (
auto it2 = it->second.begin(); it2 != it->second.end(); it2++)
1769 unsigned int wall_id = it2->first;
1770 auto contact_info = it2->second;
1775 Tensor<1, 3> previous_tangential_displacement;
1776 if (last_pw_contact_info.find(particle_id) !=
1777 last_pw_contact_info.end())
1779 auto previous_contact_info_iterator =
1780 last_pw_contact_info.find(particle_id)
1781 ->second.find(wall_id);
1782 if (previous_contact_info_iterator !=
1783 last_pw_contact_info.find(particle_id)->second.end())
1785 previous_tangential_displacement =
1786 previous_contact_info_iterator->second
1787 .tangential_displacement;
1792 previous_tangential_displacement = 0;
1794 if (contact_info.tangential_relative_velocity.size() == 4)
1796 contact_info.tangential_displacement =
1797 previous_tangential_displacement +
1799 (contact_info.tangential_relative_velocity[0] +
1800 2 * contact_info.tangential_relative_velocity[1] +
1801 2 * contact_info.tangential_relative_velocity[2] +
1802 contact_info.tangential_relative_velocity[3]);
1804 else if (contact_info.tangential_relative_velocity.size() > 0)
1806 contact_info.tangential_displacement =
1807 previous_tangential_displacement +
1809 contact_info.tangential_relative_velocity
1810 [contact_info.tangential_relative_velocity.size()];
1814 contact_info.tangential_displacement = 0;
1818 contact_info.tangential_relative_velocity.clear();
1824 unsigned int particle_one_id = it->first;
1825 for (
auto it2 = it->second.begin(); it2 != it->second.end(); it2++)
1827 unsigned int particle_two_id = it2->first;
1828 auto contact_info = it2->second;
1833 Tensor<1, 3> previous_tangential_displacement;
1834 if (last_pp_contact_info.find(particle_one_id) !=
1835 last_pp_contact_info.end())
1837 auto previous_contact_info_iterator =
1838 last_pp_contact_info.find(particle_one_id)
1839 ->second.find(particle_two_id);
1840 if (previous_contact_info_iterator !=
1841 last_pp_contact_info.find(particle_one_id)->second.end())
1843 previous_tangential_displacement =
1844 previous_contact_info_iterator->second
1845 .tangential_displacement;
1850 previous_tangential_displacement = 0;
1852 if (contact_info.tangential_relative_velocity.size() == 4)
1854 contact_info.tangential_displacement =
1855 previous_tangential_displacement +
1857 (contact_info.tangential_relative_velocity[0] +
1858 2 * contact_info.tangential_relative_velocity[1] +
1859 2 * contact_info.tangential_relative_velocity[2] +
1860 contact_info.tangential_relative_velocity[3]);
1862 else if (contact_info.tangential_relative_velocity.size() > 0)
1864 contact_info.tangential_displacement =
1865 previous_tangential_displacement +
1867 contact_info.tangential_relative_velocity
1868 [contact_info.tangential_relative_velocity.size()];
1872 contact_info.tangential_displacement = 0;
1875 contact_info.tangential_relative_velocity.clear();