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, CFD-DEM periodic boundary fix #1110

Merged
merged 6 commits into from
May 2, 2024
Merged

Conversation

OGaboriault
Copy link
Collaborator

Description of the problem

  • Periodic boundary conditions were not working when they were not declare as the last BC in the parameter file.
  • BC_type was changing value at every BC being parsed. "BC_type" was being checked later in the code (in dem.cc) to set "has_periodic_boundaries" to true or false. If the periodic BC was being declared before the an other BC, "BC_type" was not set to "BoundaryType::periodic", thus "has_periodic_boundaries = false".

Description of the solution

  • We store every BC type in a vector (BC_types).
  • We check each component of that vector, if it's equal to "BoundaryType::periodic", then "has_periodic_boundaries = true"

How Has This Been Tested?

  • Every test is passing.
  • I can modify one of our current test to add a dummy BC at the end of a parameter file, so that it check for this kind of problem.

Comments

  • Not gonna lie, it was not hard a bug spot in the code... wish I had spot this mistake earlier in my results....

@OGaboriault OGaboriault requested review from blaisb and acdaigneault May 2, 2024 02:40
@OGaboriault OGaboriault self-assigned this May 2, 2024
Copy link
Contributor

@blaisb blaisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tiny comments

Comment on lines +1245 to +1247
// NOTE This first vector should not be initialized this big.
outlet_boundaries.reserve(DEM_BC_number);
bc_types.reserve(DEM_BC_number);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but how big is DEM_BC_number? Here it is reserved and not initialized btw, so this is not really a big deal...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, DEM_BC_number is really small

source/dem/read_mesh.cc Outdated Show resolved Hide resolved
source/fem-dem/cfd_dem_coupling.cc Outdated Show resolved Hide resolved
@blaisb
Copy link
Contributor

blaisb commented May 2, 2024

@OGaboriault I think this needs a CHANGELOG entry

Copy link
Collaborator

@acdaigneault acdaigneault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is good, sorry about that haha.
Just change the log to specify that the bug was only related to PBC in DEM since there are PBC for fluid that were not affected by this bug.

CHANGELOG.md Outdated

### Fixed

- MAJOR Periodic boundary conditions were not working if they weren't the last boundary condition being declare in the parameter file. Now, every boundary condition work in which even order they are being declared. [#1110](https://github.com/chaos-polymtl/lethe/pull/1110)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify that this is related the periodic boundaries for DEM only


subsection boundary condition 0
subsection boundary condition 0
# Choices are fixed_wall|outlet|rotational|translational|periodic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is fixed_wall actually?
Also, maybe (in another pr) we should have a test also for rotational/translational and PBC (like a rotating drum with PBC on flat walls) and make sure all PB match well.

@OGaboriault OGaboriault requested a review from acdaigneault May 2, 2024 13:59
Copy link
Collaborator

@acdaigneault acdaigneault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, change the name of the PR haha

@OGaboriault OGaboriault changed the title Think it is fixed, test are still passing, need to make a new test DEM, CFD-DEM periodic boundary fix May 2, 2024
@blaisb blaisb merged commit 59526c4 into master May 2, 2024
8 checks passed
@blaisb blaisb deleted the dem_cfd_dem_fixing_periodic_bc branch May 2, 2024 17:40
yashuuzi pushed a commit that referenced this pull request May 6, 2024
Description of the problem
Periodic boundary conditions were not working when they were not declare as the last BC in the parameter file.
BC_type was changing value at every BC being parsed. "BC_type" was being checked later in the code (in dem.cc) to set "has_periodic_boundaries" to true or false. If the periodic BC was being declared before the an other BC, "BC_type" was not set to "BoundaryType::periodic", thus "has_periodic_boundaries = false".

Description of the solution
We store every BC type in a vector (BC_types).
We check each component of that vector, if it's equal to "BoundaryType::periodic", then "has_periodic_boundaries = true"

How Has This Been Tested?
Every test is passing.
I can modify one of our current test to add a dummy BC at the end of a parameter file, so that it check for this kind of problem.

Comments
Not gonna lie, it was not hard a bug spot in the code... wish I had spot this mistake earlier in my results....
M-Badri pushed a commit to M-Badri/lethe that referenced this pull request Sep 29, 2024
Description of the problem
Periodic boundary conditions were not working when they were not declare as the last BC in the parameter file.
BC_type was changing value at every BC being parsed. "BC_type" was being checked later in the code (in dem.cc) to set "has_periodic_boundaries" to true or false. If the periodic BC was being declared before the an other BC, "BC_type" was not set to "BoundaryType::periodic", thus "has_periodic_boundaries = false".

Description of the solution
We store every BC type in a vector (BC_types).
We check each component of that vector, if it's equal to "BoundaryType::periodic", then "has_periodic_boundaries = true"

How Has This Been Tested?
Every test is passing.
I can modify one of our current test to add a dummy BC at the end of a parameter file, so that it check for this kind of problem.

Comments
Not gonna lie, it was not hard a bug spot in the code... wish I had spot this mistake earlier in my results....

Former-commit-id: 59526c4
blaisb pushed a commit that referenced this pull request Sep 30, 2024
Description of the problem
Periodic boundary conditions were not working when they were not declare as the last BC in the parameter file.
BC_type was changing value at every BC being parsed. "BC_type" was being checked later in the code (in dem.cc) to set "has_periodic_boundaries" to true or false. If the periodic BC was being declared before the an other BC, "BC_type" was not set to "BoundaryType::periodic", thus "has_periodic_boundaries = false".

Description of the solution
We store every BC type in a vector (BC_types).
We check each component of that vector, if it's equal to "BoundaryType::periodic", then "has_periodic_boundaries = true"

How Has This Been Tested?
Every test is passing.
I can modify one of our current test to add a dummy BC at the end of a parameter file, so that it check for this kind of problem.

Comments
Not gonna lie, it was not hard a bug spot in the code... wish I had spot this mistake earlier in my results....

Former-commit-id: 59526c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants