Skip to content

Commit

Permalink
Introduce the DEM action manager (#1206)
Browse files Browse the repository at this point in the history
Description
Introducing singleton design pattern with the DEM action manager.
In DEM, we often check if an action has to be performed (insertion, load balancing, contact detection, etc), and those action result in resetting containers and/or do a particle contact search. The way it was handled was turning into a spaghetti code with the addition of new features.
Before, when an event was performed, a flag was set to true. And then a few places in the code was checking the flag to know if the current action has to be executed.
It was getting weird because some flags where nested into others if they triggered the same actions, but the flag has lost its meaning (ex: checkpoint in load balance flag, same for the solid object mapping).

In order to overcome this,, the action manager is introduced in the DEM and CFD-DEM to manage what event triggered what.
How does it works? Any event that needs some following actions are handled by the action manager. The event communicates to the action manager that it happened and the action manager will change the trigger flags to the actions to do. When this action is about to be performed, it checks with the action manager if it should be trigger.
Many events can triggered the same actions, but when the action is about to be performed, it only checks if it has to be performed, not what event have happened.

Many checks in the DEM and CFDDEM solvers were moved into the called function, even though the feature might not be implemented. The first thing in the function is a check with a return if so.

Co-authored-by: Bruno Blais <blais.bruno@gmail.com>
  • Loading branch information
acdaigneault and blaisb authored Jul 30, 2024
1 parent a091baf commit 63f64ab
Show file tree
Hide file tree
Showing 43 changed files with 2,719 additions and 2,369 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Volume-Averaged Fluid Dynamics
DEM
----
DEM contact search at dem step 0
DEM contact search at dem step 32
DEM contact search at dem step 33
DEM contact search at dem step 49
Finished 50 DEM iterations
---------------------------------------------------------------
Expand Down
Loading

0 comments on commit 63f64ab

Please sign in to comment.