From a4ef38fc76e814df1200e3df26b6da7f909a11c2 Mon Sep 17 00:00:00 2001 From: Audrey Collard-Daigneault Date: Wed, 7 Aug 2024 19:49:00 -0400 Subject: [PATCH] Move all contact info struct in one file --- ...cle_wall_contact_info.h => contact_info.h} | 57 +++++++++++++++---- include/dem/data_containers.h | 4 +- include/dem/force_chains_visualization.h | 1 - include/dem/grid_motion.h | 2 +- include/dem/particle_particle_broad_search.h | 2 +- include/dem/particle_particle_contact_force.h | 2 +- include/dem/particle_particle_contact_info.h | 40 ------------- include/dem/particle_particle_fine_search.h | 7 --- .../dem/particle_point_line_broad_search.h | 1 + .../dem/particle_point_line_contact_force.h | 2 +- .../dem/particle_point_line_contact_info.h | 49 ---------------- include/dem/particle_point_line_fine_search.h | 8 --- include/dem/particle_wall_broad_search.h | 1 + include/dem/particle_wall_contact_force.h | 2 +- include/dem/particle_wall_dmt_force.h | 1 - include/dem/particle_wall_jkr_force.h | 1 - include/dem/particle_wall_linear_force.h | 1 - include/dem/particle_wall_nonlinear_force.h | 1 - include/dem/update_fine_search_candidates.h | 3 +- .../dem/update_local_particle_containers.h | 2 +- include/fem-dem/ib_particles_dem.h | 8 +-- source/dem/CMakeLists.txt | 4 +- source/dem/dem.cc | 4 +- source/dem/grid_motion.cc | 1 - source/dem/particle_particle_fine_search.cc | 7 +++ source/dem/particle_point_line_fine_search.cc | 3 + source/dem/particle_wall_fine_search.cc | 2 +- source/dem/update_fine_search_candidates.cc | 2 +- .../particle_particle_contact_force_linear.cc | 4 -- ...rticle_particle_contact_force_nonlinear.cc | 4 -- tests/dem/particle_particle_fine_search.cc | 2 +- tests/dem/particle_point_contact.cc | 3 +- tests/dem/particle_wall_fine_search.cc | 1 - 33 files changed, 77 insertions(+), 155 deletions(-) rename include/dem/{particle_wall_contact_info.h => contact_info.h} (67%) delete mode 100644 include/dem/particle_particle_contact_info.h delete mode 100644 include/dem/particle_point_line_contact_info.h diff --git a/include/dem/particle_wall_contact_info.h b/include/dem/contact_info.h similarity index 67% rename from include/dem/particle_wall_contact_info.h rename to include/dem/contact_info.h index 8a5a8d3aaa..323a7285b2 100644 --- a/include/dem/particle_wall_contact_info.h +++ b/include/dem/contact_info.h @@ -14,20 +14,29 @@ * --------------------------------------------------------------------- */ -#ifndef lethe_particle_wall_contact_info_h -#define lethe_particle_wall_contact_info_h +#ifndef lethe_contact_info_h +#define lethe_contact_info_h #include #include #include +using namespace dealii; + /** - * @brief This struct handles the information related to the calculation of the - * particle-wall contact force + * @brief Handle the information related to the calculation of the + * particle-particle contact force. Notably it is responsible for storing + * information that has to be preserved over multiple iterations of a contact, + * namely everything related to tangential overlaps */ - -using namespace dealii; +template +struct particle_particle_contact_info +{ + Particles::ParticleIterator particle_one; + Particles::ParticleIterator particle_two; + Tensor<1, 3> tangential_overlap; +}; template class particle_wall_contact_info @@ -39,13 +48,16 @@ class particle_wall_contact_info * boundary id. This is the commonly used constructor since it houses all the * information required to perform the contact calculation. * - * @param particle The iterator to the particle in contact with the wall - * @param normal_vector The outward pointing normal vector on the wall - * @param point_on_boundary A point that lies on the face - * @param boundary_id The boundary id. This id corresponds to the number attributed to the boundary condition. + * @param particle The iterator to the particle in contact with the wall. + * @param normal_vector The outward pointing normal vector on the wall. + * @param point_on_boundary A point that lies on the face. + * @param boundary_id The boundary id. This id corresponds to the number + * attributed to the boundary condition. * + * TODO: This should be a struct and normal_overlap, normal_relative_velocity + * and tangential_relative_velocity should be removed and be calculated on the + * fly as done for pp forces with particle_particle_contact_info */ - particle_wall_contact_info(const Particles::ParticleIterator &particle, const Tensor<1, 3> &normal_vector, const Point<3> &point_on_boundary, @@ -89,4 +101,27 @@ class particle_wall_contact_info Tensor<1, 3> tangential_relative_velocity; }; +/** + * @brief Handle information related to the calculation of the particle-line + * contact forces. + */ +template +struct particle_line_contact_info +{ + Particles::ParticleIterator particle; + Point<3> point_one; + Point<3> point_two; +}; + +/** + * @brief Handle information related to the calculation of the particle-point + * contact forces. + */ +template +struct particle_point_contact_info +{ + Particles::ParticleIterator particle; + Point<3> point; +}; + #endif diff --git a/include/dem/data_containers.h b/include/dem/data_containers.h index 88c6bc8b7d..0d7e720e46 100644 --- a/include/dem/data_containers.h +++ b/include/dem/data_containers.h @@ -18,9 +18,7 @@ #define lethe_data_containers_h #include -#include -#include -#include +#include #include diff --git a/include/dem/force_chains_visualization.h b/include/dem/force_chains_visualization.h index 278a3cb9bf..fe88bca021 100644 --- a/include/dem/force_chains_visualization.h +++ b/include/dem/force_chains_visualization.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/include/dem/grid_motion.h b/include/dem/grid_motion.h index 4bb1b70c2e..ce8f1a30ac 100644 --- a/include/dem/grid_motion.h +++ b/include/dem/grid_motion.h @@ -17,9 +17,9 @@ #ifndef lethe_grid_motion_h #define lethe_grid_motion_h +#include #include #include -#include #include diff --git a/include/dem/particle_particle_broad_search.h b/include/dem/particle_particle_broad_search.h index 222c92ef1f..90a1ac83aa 100644 --- a/include/dem/particle_particle_broad_search.h +++ b/include/dem/particle_particle_broad_search.h @@ -18,9 +18,9 @@ #define lethe_particle_particle_broad_search_h #include +#include #include #include -#include #include diff --git a/include/dem/particle_particle_contact_force.h b/include/dem/particle_particle_contact_force.h index 35fa57239e..c34f212b94 100644 --- a/include/dem/particle_particle_contact_force.h +++ b/include/dem/particle_particle_contact_force.h @@ -20,10 +20,10 @@ #include #include +#include #include #include #include -#include #include #include diff --git a/include/dem/particle_particle_contact_info.h b/include/dem/particle_particle_contact_info.h deleted file mode 100644 index 31f4beb50e..0000000000 --- a/include/dem/particle_particle_contact_info.h +++ /dev/null @@ -1,40 +0,0 @@ -/* --------------------------------------------------------------------- - * - * Copyright (C) 2019 - 2024 by the Lethe authors - * - * This file is part of the Lethe library - * - * The Lethe library is free software; you can use it, redistribute - * it, and/or modify it under the terms of the GNU Lesser General - * Public License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * The full text of the license can be found in the file LICENSE at - * the top level of the Lethe distribution. - * - * --------------------------------------------------------------------- - */ - -#ifndef lethe_particle_particle_contact_info_struct_h -#define lethe_particle_particle_contact_info_struct_h - -#include - -#include - -using namespace dealii; - -/** - * @brief Handle the information related to the calculation of the - * particle-particle contact force. Notably it is responsible for storing - * information that has to be preserved over multiple iterations of a contact, - * namely everything related to tangential overlaps - */ -template -struct particle_particle_contact_info -{ - Particles::ParticleIterator particle_one; - Particles::ParticleIterator particle_two; - Tensor<1, 3> tangential_overlap; -}; - -#endif diff --git a/include/dem/particle_particle_fine_search.h b/include/dem/particle_particle_fine_search.h index e4ecd5793a..78378b04ce 100644 --- a/include/dem/particle_particle_fine_search.h +++ b/include/dem/particle_particle_fine_search.h @@ -17,17 +17,10 @@ #ifndef lethe_particle_particle_fine_search_h #define lethe_particle_particle_fine_search_h -#include - #include -#include #include -#include -#include - -#include template class DEMContactManager; diff --git a/include/dem/particle_point_line_broad_search.h b/include/dem/particle_point_line_broad_search.h index 69bc7c9a7e..ff67260047 100644 --- a/include/dem/particle_point_line_broad_search.h +++ b/include/dem/particle_point_line_broad_search.h @@ -18,6 +18,7 @@ #define lethe_particle_point_line_broad_search_h #include +#include #include #include diff --git a/include/dem/particle_point_line_contact_force.h b/include/dem/particle_point_line_contact_force.h index e2c522ffa5..bfe0b5837e 100644 --- a/include/dem/particle_point_line_contact_force.h +++ b/include/dem/particle_point_line_contact_force.h @@ -19,9 +19,9 @@ #include +#include #include #include -#include #include #include diff --git a/include/dem/particle_point_line_contact_info.h b/include/dem/particle_point_line_contact_info.h deleted file mode 100644 index 9971af53e2..0000000000 --- a/include/dem/particle_point_line_contact_info.h +++ /dev/null @@ -1,49 +0,0 @@ -/* --------------------------------------------------------------------- - * - * Copyright (C) 2019 - 2024 by the Lethe authors - * - * This file is part of the Lethe library - * - * The Lethe library is free software; you can use it, redistribute - * it, and/or modify it under the terms of the GNU Lesser General - * Public License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * The full text of the license can be found in the file LICENSE at - * the top level of the Lethe distribution. - * - * --------------------------------------------------------------------- - */ - -#ifndef lethe_particle_point_line_contact_info_struct_h -#define lethe_particle_point_line_contact_info_struct_h - -#include -#include - -#include -using namespace dealii; - -/** - * @brief Handle information related to the calculation of the particle-line contact forces. - */ - -template -struct particle_line_contact_info -{ - Particles::ParticleIterator particle; - Point<3> point_one; - Point<3> point_two; -}; - -/** - * @brief Handle information related to the calculation of the particle-point - * contact forces. - */ -template -struct particle_point_contact_info -{ - Particles::ParticleIterator particle; - Point<3> point; -}; - -#endif diff --git a/include/dem/particle_point_line_fine_search.h b/include/dem/particle_point_line_fine_search.h index 0fc87137a9..a33fe79e5b 100644 --- a/include/dem/particle_point_line_fine_search.h +++ b/include/dem/particle_point_line_fine_search.h @@ -17,15 +17,7 @@ #ifndef lethe_particle_point_line_fine_search_h #define lethe_particle_point_line_fine_search_h -#include - #include -#include - -#include - -#include -#include using namespace dealii; diff --git a/include/dem/particle_wall_broad_search.h b/include/dem/particle_wall_broad_search.h index 399ead8cae..54f0c0fb5d 100644 --- a/include/dem/particle_wall_broad_search.h +++ b/include/dem/particle_wall_broad_search.h @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/include/dem/particle_wall_contact_force.h b/include/dem/particle_wall_contact_force.h index fefddd6da6..550905246e 100644 --- a/include/dem/particle_wall_contact_force.h +++ b/include/dem/particle_wall_contact_force.h @@ -21,9 +21,9 @@ #include #include +#include #include #include -#include #include #include diff --git a/include/dem/particle_wall_dmt_force.h b/include/dem/particle_wall_dmt_force.h index 36a46fe04f..32eacfe309 100644 --- a/include/dem/particle_wall_dmt_force.h +++ b/include/dem/particle_wall_dmt_force.h @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/include/dem/particle_wall_jkr_force.h b/include/dem/particle_wall_jkr_force.h index 20b6113154..1ef9c9c63f 100644 --- a/include/dem/particle_wall_jkr_force.h +++ b/include/dem/particle_wall_jkr_force.h @@ -21,7 +21,6 @@ #include #include -#include #include diff --git a/include/dem/particle_wall_linear_force.h b/include/dem/particle_wall_linear_force.h index 2ddcbe6269..1244eaed39 100644 --- a/include/dem/particle_wall_linear_force.h +++ b/include/dem/particle_wall_linear_force.h @@ -21,7 +21,6 @@ #include #include -#include #include diff --git a/include/dem/particle_wall_nonlinear_force.h b/include/dem/particle_wall_nonlinear_force.h index 5493367b4a..11909fd76b 100644 --- a/include/dem/particle_wall_nonlinear_force.h +++ b/include/dem/particle_wall_nonlinear_force.h @@ -21,7 +21,6 @@ #include #include -#include #include diff --git a/include/dem/update_fine_search_candidates.h b/include/dem/update_fine_search_candidates.h index c9a69fbc75..7d511297bd 100644 --- a/include/dem/update_fine_search_candidates.h +++ b/include/dem/update_fine_search_candidates.h @@ -19,8 +19,7 @@ #include #include -#include -#include + /** * @brief Manage removing repetitions and adding new contact pairs to the diff --git a/include/dem/update_local_particle_containers.h b/include/dem/update_local_particle_containers.h index b533e66aa3..3407c09070 100644 --- a/include/dem/update_local_particle_containers.h +++ b/include/dem/update_local_particle_containers.h @@ -17,9 +17,9 @@ #ifndef lethe_update_local_particle_containers_h #define lethe_update_local_particle_containers_h +#include #include #include -#include #include diff --git a/include/fem-dem/ib_particles_dem.h b/include/fem-dem/ib_particles_dem.h index f86be06a46..51f88e838a 100644 --- a/include/fem-dem/ib_particles_dem.h +++ b/include/fem-dem/ib_particles_dem.h @@ -15,23 +15,21 @@ * */ +#ifndef lethe_ib_particles_dem_h +#define lethe_ib_particles_dem_h + #include #include #include #include -#include #include -#include #include #include #include -#ifndef lethe_ib_particles_dem_h -# define lethe_ib_particles_dem_h - using namespace dealii; /** diff --git a/source/dem/CMakeLists.txt b/source/dem/CMakeLists.txt index 2d770223f9..5a0e9b33e4 100644 --- a/source/dem/CMakeLists.txt +++ b/source/dem/CMakeLists.txt @@ -50,6 +50,7 @@ add_library(lethe-dem # Headers ../../include/dem/adaptive_sparse_contacts.h ../../include/dem/boundary_cells_info_struct.h + ../../include/dem/contact_info.h ../../include/dem/contact_type.h ../../include/dem/data_containers.h ../../include/dem/dem.h @@ -76,15 +77,12 @@ add_library(lethe-dem ../../include/dem/output_force_torque_calculation.h ../../include/dem/particle_particle_broad_search.h ../../include/dem/particle_particle_contact_force.h - ../../include/dem/particle_particle_contact_info.h ../../include/dem/particle_particle_fine_search.h ../../include/dem/particle_point_line_broad_search.h ../../include/dem/particle_point_line_contact_force.h - ../../include/dem/particle_point_line_contact_info.h ../../include/dem/particle_point_line_fine_search.h ../../include/dem/particle_wall_broad_search.h ../../include/dem/particle_wall_contact_force.h - ../../include/dem/particle_wall_contact_info.h ../../include/dem/particle_wall_dmt_force.h ../../include/dem/particle_wall_fine_search.h ../../include/dem/particle_wall_jkr_force.h diff --git a/source/dem/dem.cc b/source/dem/dem.cc index 170d15fe36..326db22513 100644 --- a/source/dem/dem.cc +++ b/source/dem/dem.cc @@ -55,8 +55,8 @@ DEMSolver::DEMSolver(DEMSolverParameters dem_parameters) template void DEMSolver::setup_parameters() -{ // Print simulation starting information - +{ + // Print simulation starting information pcout << std::endl; std::stringstream ss; ss << "Running on " << n_mpi_processes << " rank(s)"; diff --git a/source/dem/grid_motion.cc b/source/dem/grid_motion.cc index 3d6789946b..4d460f5828 100644 --- a/source/dem/grid_motion.cc +++ b/source/dem/grid_motion.cc @@ -3,7 +3,6 @@ #include -#include #include using namespace dealii; diff --git a/source/dem/particle_particle_fine_search.cc b/source/dem/particle_particle_fine_search.cc index 60ad06da5d..97db12a26b 100644 --- a/source/dem/particle_particle_fine_search.cc +++ b/source/dem/particle_particle_fine_search.cc @@ -1,6 +1,13 @@ +#include + +#include #include #include +#include + +#include + using namespace dealii; template diff --git a/source/dem/particle_point_line_fine_search.cc b/source/dem/particle_point_line_fine_search.cc index 397f629753..9a916d7a81 100644 --- a/source/dem/particle_point_line_fine_search.cc +++ b/source/dem/particle_point_line_fine_search.cc @@ -1,7 +1,10 @@ +#include #include +#include #include +#include using namespace dealii; // In this function, the output of particle-point broad search is investigated diff --git a/source/dem/particle_wall_fine_search.cc b/source/dem/particle_wall_fine_search.cc index b4b7ce1838..38d153007a 100644 --- a/source/dem/particle_wall_fine_search.cc +++ b/source/dem/particle_wall_fine_search.cc @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/source/dem/update_fine_search_candidates.cc b/source/dem/update_fine_search_candidates.cc index e31eb99ae4..a7687d760b 100644 --- a/source/dem/update_fine_search_candidates.cc +++ b/source/dem/update_fine_search_candidates.cc @@ -1,4 +1,4 @@ -#include +#include #include using namespace dealii; diff --git a/tests/dem/particle_particle_contact_force_linear.cc b/tests/dem/particle_particle_contact_force_linear.cc index d264d66433..3f7373b762 100644 --- a/tests/dem/particle_particle_contact_force_linear.cc +++ b/tests/dem/particle_particle_contact_force_linear.cc @@ -36,11 +36,7 @@ #include #include -#include -#include -#include #include -#include // Tests (with common definitions) diff --git a/tests/dem/particle_particle_contact_force_nonlinear.cc b/tests/dem/particle_particle_contact_force_nonlinear.cc index 00c0d36fdc..17aa7322ab 100644 --- a/tests/dem/particle_particle_contact_force_nonlinear.cc +++ b/tests/dem/particle_particle_contact_force_nonlinear.cc @@ -36,11 +36,7 @@ #include #include -#include -#include -#include #include -#include // Tests (with common definitions) #include <../tests/tests.h> diff --git a/tests/dem/particle_particle_fine_search.cc b/tests/dem/particle_particle_fine_search.cc index b24f87c125..214220d307 100644 --- a/tests/dem/particle_particle_fine_search.cc +++ b/tests/dem/particle_particle_fine_search.cc @@ -33,10 +33,10 @@ #include // Lethe +#include #include #include #include -#include #include // Tests (with common definitions) diff --git a/tests/dem/particle_point_contact.cc b/tests/dem/particle_point_contact.cc index 59ac773d56..0684d7a441 100644 --- a/tests/dem/particle_point_contact.cc +++ b/tests/dem/particle_point_contact.cc @@ -36,6 +36,7 @@ // Lethe #include +#include #include #include #include @@ -128,7 +129,7 @@ test() contact_candidates; // Particle-point fine search - std::unordered_map> + std::unordered_map> contact_information; ParticlePointLineForce force_object; diff --git a/tests/dem/particle_wall_fine_search.cc b/tests/dem/particle_wall_fine_search.cc index 5b663d4286..478bef66b5 100644 --- a/tests/dem/particle_wall_fine_search.cc +++ b/tests/dem/particle_wall_fine_search.cc @@ -36,7 +36,6 @@ // Lethe #include #include -#include #include // Tests (with common definitions)