Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dem rotating boundary parsing #920

Merged
merged 7 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,3 +54,5 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
### Fixed

- MAJOR/MINOR/PATCH Description (#PR).


Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions applications_tests/lethe-particles/pp_jkr_equilibrium.prm
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions applications_tests/lethe-particles/pw_jkr_equilibrium.prm
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions applications_tests/lethe-particles/rotating_in_ball.prm
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions applications_tests/lethe-particles/rotating_in_circle.prm
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions doc/source/examples/dem/rotating-drum/rotating-drum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions doc/source/parameters/dem/boundary_conditions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 4 additions & 6 deletions examples/dem/3d-rotating-drum/load-rotating-drum.prm
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions examples/dem/3d-rotating-drum/rotating-drum.prm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Empty file.
46 changes: 25 additions & 21 deletions source/core/parameters_lagrangian.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
OGaboriault marked this conversation as resolved.
Show resolved Hide resolved
Tensor<1, 3> rotational_vector;

std::string rotational_vector_str = prm.get("rotational vector");
std::vector<std::string> rotational_vector_str_list(
Utilities::split_string_list(rotational_vector_str));
std::vector<double> 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;

Expand All @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions source/dem/particle_wall_contact_force.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ ParticleWallContactForce<dim>::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

Expand Down
Loading