-
Notifications
You must be signed in to change notification settings - Fork 61
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
Refactor the way the DEM PropertiesIndex are managed using templates #1399
Conversation
…to generate new restart files
d91af1a
to
77f2797
Compare
41cc022
to
15c4663
Compare
|
||
### Changed | ||
|
||
- MAJOR The index of properties in the DEM and CFD-DEM simulations are now indexed using a template (PropertiesIndex) instead of using an hardcoded enum. This enables the different solvers to have different number of properties and different properties index. For large simulations, this gives minor performance gain for DEM simulations (e.g. around 5-10%), but this makes the solver significantly more flexible. This is a major change since it breaks DEM and CFD-DEM restart files from previous versions. [#1399](https://github.com/chaos-polymtl/lethe/pull/1399) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add something regarding the potential bug you found along the way regarding the particle handler and vans solver?
@@ -53,6 +53,10 @@ In this subsection, contact detection, force models, time integration, load bala | |||
set granular temperature threshold = 1e-4 | |||
set solid fraction threshold = 0.4 | |||
end | |||
|
|||
# Solver type | |||
# Choices are dem|cfd_dem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm the one who wrote this, but I'm not sure if the cfd_dem should be written in the choices since it should always be set at dem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is all clear. It is nice to have a separate particle property handler for the CFD-DEM. Nice refactoring :)
@@ -31,7 +31,7 @@ end | |||
#--------------------------------------------------- | |||
|
|||
subsection restart | |||
set checkpoint = false # = true to generate the restart files. | |||
set checkpoint = false # = true to generate the restart files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little spacebar here.
with open(output_file_name, 'w') as file: | ||
# Write content to the file | ||
file.write( | ||
"p_x; p_y; p_z; v_x ; v_y; v_z; w_x; w_y; w_z; diameters; fem_force_x; fem_force_y; fem_force_z; " | ||
"fem_torque_x; fem_torque_y; fem_torque_z \n") | ||
"p_x; p_y; p_z; v_x ; v_y; v_z; w_x; w_y; w_z; diameters; \n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"p_x; p_y; p_z; v_x ; v_y; v_z; w_x; w_y; w_z; diameters; \n") | |
"p_x; p_y; p_z; v_x ; v_y; v_z; w_x; w_y; w_z; diameters; \n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would change test files, so I am not sure it is worth changing such a small typo :)
omega_z = 7, | ||
mass = 8, | ||
n_properties = 9, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include/fem-dem/vans_assemblers.h
Outdated
@@ -178,8 +178,8 @@ class VANSAssemblerBDF : public NavierStokesAssemblerBase<dim> | |||
-(3.7 - 0.65 * exp(-pow((1.5 - log10(re)), 2) / 2))) | |||
* and the momentum exchange coefficient | |||
* beta =(0.5 * c_d * M_PI * | |||
pow(particle_properties[DEM::PropertiesIndex::dp], 2) / 4) * | |||
relative_velocity.norm() | |||
pow(particle_properties[DEM::PropertiesIndex<DEM::SolverType::cfd_dem>::dp], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, but could this be "DEM::CFDDEMProperties::PropertiesIndex::dp" instead? (Same for the other modifications in this file)
Co-authored-by: Victor Oliveira Ferreira <[email protected]>
Co-authored-by: Victor Oliveira Ferreira <[email protected]>
Description
The deal.II ParticleHandler class supports storing a number of properties as double within the a PropertyPool. The issue is that this PropertyPool is nothing more than an array of double and associating the elements of that array to a physical meaning (e.g. knowing that property 8 is the diameter) can be challenging. To alleviate this issue, we have always used an enum of type int to do the link between the properties and their index. This is convenient, but it also hardcodes at compile time the properties. This has forced us to have the same number of properties in DEM and CFD-DEM. This is wasteful, because all of the hydrodynamic forces and torques, which are just zero in DEM, have the be stored anyway in a DEM simulation.
This PR changes this issue by templating ALL of the DEM classes that use the properties of the particle with a typename that is an enum. This typename PropertiesIndex is then used within the class to do the calculation with the adequate properties index. This essentially enable the contact models, the integrators, or whatever you actually want, to be reused with ParticleHandler that have a different amount of properties.
Some of the planned usage for this are notably heat transfer within particles, but also the addition of more properties on the particle within CFD-DEM (e.g. previous particle velocity like we discussed with @voferreira ). This PR opens all of these possibilities.
This is a major change because it changes everything in the code everywhere, but does not change the logic. The DEM results are unchanged, but the CFD-DEM results are changed.
This is because, now CFD-DEM requires translating a DEM ParticleHandler to a CFD-DEM ParticleHandler. To achieve this, I read the ParticleHandler from the DEM simulation and transform it into a CFD-DEM ParticleHandler using a new conversion function I wrote.
This essentially opens-up the possibility of reading particles that were created on a different mesh and converting it on a new one. This is what i will do in the next PR and this will essentially disconnect the mesh used for DEM and for CFD-DEM. Enabling us to change the CFD-DEM mesh without redoing a DEM insertion (which is cool). @voferreira this feature will be useful for your mesh convergence work
Testing
The CFD-DEM test results have changed because of the aforementioned issue
Documentation
This does not modify the documentation except for a minor parameter that was added.
Miscellaneous (will be removed when merged)
Checklist (will be removed when merged)
See this page for more information about the pull request process.
Code related list:
Pull request related list: