diff --git a/CHANGELOG.md b/CHANGELOG.md index 054988216b..94320e422f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). - MAJOR All the applications were renamed [#882](https://github.com/lethe-cfd/lethe/pull/882): `gls_navier_stokes` is now `lethe-fluid`, `gd_navier_stokes` is now `lethe-fluid-block`, `nitsche_navier_stokes` is now `lethe-fluid-nitsche`, `gls_sharp_navier_stokes` is now `lethe-fluid-sharp`, `gls_vans` is now `lethe-fluid-vans`, `mf_navier_stokes` is now `lethe-fluid-matrix-free`, `dem` is now `lethe-particles`, `cfd_dem_coupling` is now `lethe-fluid-particles`, `rpt3d` is now `lethe-rpt-3d`, `rpt_cell_reconstruction_3d` is now `lethe-rpt-cell-reconstruction-3d`, `rpt_fem_reconstruction_3d` is now `lethe-rpt-fem-reconstruction-3d`, and `rpt_l2_projection_3d` is now `lethe-rpt-l2-projection-3d`. + +## [Master] - 2023-10-30 + +- MINOR The rotational vector for the rotational boundary condition in the lethe-particles solver is now define with one line in the parameters file. [#920](https://github.com/lethe-cfd/lethe/pull/920) + ## [Sample] - YYYY/MM/DD ### Added @@ -49,3 +54,5 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ### Fixed - MAJOR/MINOR/PATCH Description (#PR). + + diff --git a/applications_tests/lethe-particles/perpendicular_rotation_to_wall.prm b/applications_tests/lethe-particles/perpendicular_rotation_to_wall.prm index 1562e662d0..de3955fc1e 100644 --- a/applications_tests/lethe-particles/perpendicular_rotation_to_wall.prm +++ b/applications_tests/lethe-particles/perpendicular_rotation_to_wall.prm @@ -119,30 +119,24 @@ end subsection DEM boundary conditions set number of boundary conditions = 3 subsection boundary condition 0 - set boundary id = 0 - set type = rotational - set rotational speed = 0.7 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 0 + set type = rotational + set rotational speed = 0.7 + set rotational vector = 1,0,0 end subsection boundary condition 1 - set boundary id = 1 - set type = rotational - set rotational speed = 0.7 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 1 + set type = rotational + set rotational speed = 0.7 + set rotational vector = 1,0,0 end subsection boundary condition 2 - set boundary id = 2 - set type = rotational - set rotational speed = 0.7 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 2 + set type = rotational + set rotational speed = 0.7 + set rotational vector = 1,0,0 set point on rotational vector = 0,0,0 end end diff --git a/applications_tests/lethe-particles/pp_jkr_equilibrium.prm b/applications_tests/lethe-particles/pp_jkr_equilibrium.prm index 169bdbb4bf..dad446c9ab 100644 --- a/applications_tests/lethe-particles/pp_jkr_equilibrium.prm +++ b/applications_tests/lethe-particles/pp_jkr_equilibrium.prm @@ -92,11 +92,9 @@ end subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 0 - set type = fixed_wall - set rotational speed = 0 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 0 + set type = fixed_wall + set rotational speed = 0 + set rotational vector = 1,0,0 end end \ No newline at end of file diff --git a/applications_tests/lethe-particles/pw_jkr_equilibrium.prm b/applications_tests/lethe-particles/pw_jkr_equilibrium.prm index af370d5f2f..c7284ca096 100644 --- a/applications_tests/lethe-particles/pw_jkr_equilibrium.prm +++ b/applications_tests/lethe-particles/pw_jkr_equilibrium.prm @@ -91,11 +91,9 @@ end subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 0 - set type = fixed_wall - set rotational speed = 0 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 0 + set type = fixed_wall + set rotational speed = 0 + set rotational vector = 1,0,0 end end \ No newline at end of file diff --git a/applications_tests/lethe-particles/rotating_in_ball.prm b/applications_tests/lethe-particles/rotating_in_ball.prm index 0dc6f0a864..3571e19a4a 100644 --- a/applications_tests/lethe-particles/rotating_in_ball.prm +++ b/applications_tests/lethe-particles/rotating_in_ball.prm @@ -109,11 +109,9 @@ subsection model parameters subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 0 - set type = rotational - set rotational speed = 2.5 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 0 + set type = rotational + set rotational speed = 2.5 + set rotational vector = 1,0,0 end end diff --git a/applications_tests/lethe-particles/rotating_in_circle.prm b/applications_tests/lethe-particles/rotating_in_circle.prm index 1fb9929cda..ae053bab48 100644 --- a/applications_tests/lethe-particles/rotating_in_circle.prm +++ b/applications_tests/lethe-particles/rotating_in_circle.prm @@ -106,11 +106,9 @@ end subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 0 - set type = rotational - set rotational speed = 0.2 - set rotational vector x = 0 - set rotational vector y = 0 - set rotational vector z = 1 + set boundary id = 0 + set type = rotational + set rotational speed = 0.2 + set rotational vector = 0,0,1 end end diff --git a/doc/source/examples/dem/rotating-drum/rotating-drum.rst b/doc/source/examples/dem/rotating-drum/rotating-drum.rst index 5ae7fee486..4bba9c6483 100644 --- a/doc/source/examples/dem/rotating-drum/rotating-drum.rst +++ b/doc/source/examples/dem/rotating-drum/rotating-drum.rst @@ -134,12 +134,10 @@ In this subsection, the boundary conditions of the DEM simulation are defined. F subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 0 - set type = rotational - set rotational speed = 11.6 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 0 + set type = rotational + set rotational speed = 11.6 + set rotational vector = 1, 0, 0 end end diff --git a/doc/source/examples/dem/small-scale-rotating-drum/small-scale-rotating-drum.rst b/doc/source/examples/dem/small-scale-rotating-drum/small-scale-rotating-drum.rst index 09e1caba31..e00b3cafd7 100644 --- a/doc/source/examples/dem/small-scale-rotating-drum/small-scale-rotating-drum.rst +++ b/doc/source/examples/dem/small-scale-rotating-drum/small-scale-rotating-drum.rst @@ -142,9 +142,7 @@ The rotation of the cylinder is applied using a rotational boundary condition wi set boundary id = 0 set type = rotational set rotational speed = 1 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set rotational vector = 1, 0, 0 end end diff --git a/doc/source/parameters/dem/boundary_conditions.rst b/doc/source/parameters/dem/boundary_conditions.rst index 9ee40c5920..f47b9d0118 100644 --- a/doc/source/parameters/dem/boundary_conditions.rst +++ b/doc/source/parameters/dem/boundary_conditions.rst @@ -25,9 +25,7 @@ In this subsection, the boundary conditions of the DEM simulation are defined. F set rotational speed = 2.5 # Rotational vector - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set rotational vector = 1, 0, 0 # Point on rotational vector set point on rotational vector = 0, 0, 0 diff --git a/examples/dem/3d-bouncing-particle/bouncing_particle_original.prm b/examples/dem/3d-bouncing-particle/bouncing_particle_original.prm index b2c4c59b36..51a1ca83a2 100644 --- a/examples/dem/3d-bouncing-particle/bouncing_particle_original.prm +++ b/examples/dem/3d-bouncing-particle/bouncing_particle_original.prm @@ -101,9 +101,5 @@ subsection DEM boundary conditions subsection boundary condition 0 set boundary id = 0 set type = fixed_wall - set rotational speed = 0 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 end end diff --git a/examples/dem/3d-rotating-drum-post-processing/rotating-drum-with-post-processing.prm b/examples/dem/3d-rotating-drum-post-processing/rotating-drum-with-post-processing.prm index c75d09884a..88ab94d141 100644 --- a/examples/dem/3d-rotating-drum-post-processing/rotating-drum-with-post-processing.prm +++ b/examples/dem/3d-rotating-drum-post-processing/rotating-drum-with-post-processing.prm @@ -97,12 +97,10 @@ end subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 4 - set type = rotational - set rotational speed = 11.6 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 4 + set type = rotational + set rotational speed = 11.6 + set rotational vector = 1,0,0 end end diff --git a/examples/dem/3d-rotating-drum/load-rotating-drum.prm b/examples/dem/3d-rotating-drum/load-rotating-drum.prm index 4e475eec65..cfee4a4916 100644 --- a/examples/dem/3d-rotating-drum/load-rotating-drum.prm +++ b/examples/dem/3d-rotating-drum/load-rotating-drum.prm @@ -109,11 +109,9 @@ end subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 1 - set type = rotational - set rotational speed = 11.6 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 1 + set type = rotational + set rotational speed = 11.6 + set rotational vector = 1,0,0 end end diff --git a/examples/dem/3d-rotating-drum/rotating-drum.prm b/examples/dem/3d-rotating-drum/rotating-drum.prm index 1322886368..0e9aa8200a 100644 --- a/examples/dem/3d-rotating-drum/rotating-drum.prm +++ b/examples/dem/3d-rotating-drum/rotating-drum.prm @@ -90,11 +90,9 @@ end subsection DEM boundary conditions set number of boundary conditions = 1 subsection boundary condition 0 - set boundary id = 0 - set type = rotational - set rotational speed = 11.6 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set boundary id = 0 + set type = rotational + set rotational speed = 11.6 + set rotational vector = 1,0,0 end end diff --git a/examples/dem/3d-small-scale-rotating-drum/small-rotating-drum-dem.prm b/examples/dem/3d-small-scale-rotating-drum/small-rotating-drum-dem.prm index b8cada307d..1c79b47fab 100644 --- a/examples/dem/3d-small-scale-rotating-drum/small-rotating-drum-dem.prm +++ b/examples/dem/3d-small-scale-rotating-drum/small-rotating-drum-dem.prm @@ -49,9 +49,7 @@ subsection DEM boundary conditions set boundary id = 0 set type = rotational set rotational speed = 1 - set rotational vector x = 1 - set rotational vector y = 0 - set rotational vector z = 0 + set rotational vector = 1,0,0 end end diff --git a/performance_analyses/dem/short_packing_10k_particles/time_case.sh b/performance_analyses/dem/short_packing_10k_particles/time_case.sh old mode 100644 new mode 100755 diff --git a/source/core/parameters_lagrangian.cc b/source/core/parameters_lagrangian.cc index c209321489..f42ee1da07 100644 --- a/source/core/parameters_lagrangian.cc +++ b/source/core/parameters_lagrangian.cc @@ -1143,18 +1143,12 @@ namespace Parameters "0.", Patterns::Double(), "Rotational boundary speed"); - prm.declare_entry("rotational vector x", - "0.", - Patterns::Double(), - "Rotational vector element in x direction"); - prm.declare_entry("rotational vector y", - "0.", - Patterns::Double(), - "Rotational vector element in y direction"); - prm.declare_entry("rotational vector z", - "0.", - Patterns::Double(), - "Rotational vector element in z direction"); + + prm.declare_entry("rotational vector", + "1.,0.,0.", + Patterns::List(Patterns::Double()), + "Rotational vector elements"); + prm.declare_entry("periodic id 0", "0", Patterns::Integer(), @@ -1199,15 +1193,24 @@ namespace Parameters } else if (boundary_type == "rotational") { - BC_type = BoundaryType::rotational; - double rotational_speed = prm.get_double("rotational speed"); - Tensor<1, 3> rotational_vector; - - rotational_vector[0] = prm.get_double("rotational vector x"); - rotational_vector[1] = prm.get_double("rotational vector y"); - rotational_vector[2] = prm.get_double("rotational vector z"); + BC_type = BoundaryType::rotational; + double rotational_speed = prm.get_double("rotational speed"); + // Read the rotational vector from a list of doubles + Tensor<1, 3> rotational_vector; + std::string rotational_vector_str = prm.get("rotational vector"); + std::vector rotational_vector_str_list( + Utilities::split_string_list(rotational_vector_str)); + std::vector rotational_vector_list = + Utilities::string_to_double(rotational_vector_str_list); + for (unsigned int i = 0; i < 3; ++i) + rotational_vector[i] = rotational_vector_list[i]; + if (rotational_vector.norm() == 0.) + { + throw(std::runtime_error( + "Invalid rotational vector. Its norm cannot be equal to zero.")); + } // Read the point from a list of doubles Tensor<1, 3> point_on_rotation_axis_tensor; @@ -1219,8 +1222,9 @@ namespace Parameters for (unsigned int i = 0; i < 3; ++i) point_on_rotation_axis_tensor[i] = point_on_vector_list[i]; - this->boundary_rotational_speed.at(boundary_id) = rotational_speed; - this->boundary_rotational_vector.at(boundary_id) = rotational_vector; + this->boundary_rotational_speed.at(boundary_id) = rotational_speed; + this->boundary_rotational_vector.at(boundary_id) = + rotational_vector / rotational_vector.norm(); this->point_on_rotation_axis.at(boundary_id) = point_on_rotation_axis_tensor; } diff --git a/source/dem/particle_wall_contact_force.cc b/source/dem/particle_wall_contact_force.cc index 7e306252b3..22953c4205 100644 --- a/source/dem/particle_wall_contact_force.cc +++ b/source/dem/particle_wall_contact_force.cc @@ -64,8 +64,7 @@ ParticleWallContactForce::update_contact_information( vector_to_rotating_axis = vector_to_rotating_axis - (vector_to_rotating_axis * this->boundary_rotational_vector[boundary_id]) * - this->boundary_rotational_vector[boundary_id] / - (this->boundary_rotational_vector[boundary_id].norm_square() + 1e-16); + this->boundary_rotational_vector[boundary_id]; // Tensor<1,3> vector_to_rotation_axis = this->boundary_rotational_speed_map