chaos-polymtl / lethe

Repository for the open-source lethe CFD/DEM/CFD-DEM project
https://chaos-polymtl.github.io/lethe/index.html
Apache License 2.0
271 stars 60 forks source link

Handle the deprecated parameters of individual entries to a list entry #1171

Closed acdaigneault closed 3 months ago

acdaigneault commented 3 months ago

Description

Parameters are often changed as refactoring in the DEM solver, but it causes issues when running simulation with old parameter files. Those files get incompatible with the latest version of the code and need to be updated by the user. There is a function in deal.II (called declare_alias()) that allows to still use old parameters as alias, but need to be the same type so the parsing stays the same. Also, it can give a warning about the deprecated file. We started, and we are planning, to convert some old individual parameter entries to one parameter that is a list of values. It means 3 parameters of double will be changed to one parameter of a list of double. In order to avoid the above, this refactoring aims to handles those old parameters. The only issue with the current implementation is there is no way to assert if the new parameter is set as a double. Also, this PR applies those changes to the gravity force in DEM.

Testing

New test deprecated_parameter uses the old gx, gy, gz parameters. The old parameters (in 2d or 3d) were tested and it works well and gives a warning for the deprecated parameter.

Documentation

The parameters gx, gy and gz are now g.

Miscellaneous (will be removed when merged)

I suggest we update the same test if we use other deprecated parameters I changed the g parameter because I wanted to add a function version for my example, but I realised that it won't be very effective. So I drop this idea, but kept the list parameter. I added a way to use deprecated parameters because the gravity parameter is in every DEM prm file and the change may annoyed people (meeee the first!)

Checklist (will be removed when merged)

See this page for more information about the pull request process.

Code related list:

Pull request related list:

acdaigneault commented 3 months ago

@blaisb Above the change log entry, I will update the PR template. Do you prefer I do it in this PR or in another very small PR, let's say without other reviewers?

blaisb commented 3 months ago

@blaisb Above the change log entry, I will update the PR template. Do you prefer I do it in this PR or in another very small PR, let's say without other reviewers?

Whatever you think is best, both for me are OK. I generally prefer seperated PRs, but if its really minor, go ahead and do it in this one.