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

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

Merged
merged 12 commits into from
Jun 14, 2024

Conversation

acdaigneault
Copy link
Collaborator

@acdaigneault acdaigneault commented Jun 12, 2024

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:

  • All in-code documentation related to this PR is up to date (Doxygen format)
  • Lethe documentation is up to date
  • The branch is rebased onto master
  • Code is indented with indent-all and .prm files (examples and tests) with prm-indent

Pull request related list:

  • No other PR is open related to this refactoring
  • Labels are applied
  • There are at least 2 reviewers (or 1 if small feature) excluding the responsible for the merge
  • If this PR closes an issue or is related to a project, it is linked in the "Projects" or "Development" section
  • If any future works is planed, an issue is opened
  • The PR description is cleaned and ready for merge

@acdaigneault acdaigneault added Maintenance Ready for review Refactoring This PR is only refactoring or clean up Help wanted Extra attention is needed and removed Ready for review labels Jun 12, 2024
@acdaigneault acdaigneault removed the Help wanted Extra attention is needed label Jun 13, 2024
@acdaigneault acdaigneault changed the title Handle the depreciated parameters of individual entries to a list entry Handle the deprecated parameters of individual entries to a list entry Jun 13, 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 two small things where a g conversion is missing, otherwise very good. Love this. Maybe a good idea to add a changelog entry?

@@ -0,0 +1,65 @@
Warning in file <depreciated_parameters.prm>: You are using the deprecated spelling <gx> of the parameter <g>.
Copy link
Contributor

Choose a reason for hiding this comment

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

God this is fucking nice

Copy link
Collaborator

@voferreira voferreira left a comment

Choose a reason for hiding this comment

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

Amazing way to handle deprecated parameters. Good job! I added some tiny comments here and there, and I believe you are aware of the "deprecated" instead of "depreciated". Apart from that, good to go for me.

set gx = 0.0
set gy = -1
set gz = 0.0
set g = 0.0, -1, 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Weird value for the gravity haha

set gx = 0.0
set gy = -1
set gz = 0.0
set g = 0.0, -1, 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this gravity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Values of test don't need to be realistic. Sometime, (let's speak for myself) we need to tuned parameter in order to reproduce a specific bug or to reduce simulation time

# Gravitational acceleration in z direction
set gz = -9.81
# Gravitational acceleration vector
set g = 0.0, 0.0, 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you change the default value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No it was always set to 0.0 for all directions in the code, the doc was wrong

@acdaigneault
Copy link
Collaborator Author

@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
Copy link
Contributor

blaisb commented Jun 13, 2024

@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.

@acdaigneault acdaigneault force-pushed the dem_modify-g-parameter branch from fdc3f94 to ac2c23f Compare June 13, 2024 16:03
@acdaigneault acdaigneault requested a review from OGaboriault June 13, 2024 17:37
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.

All good to go for me. Just add the flag reviewed and ready to merge once @OGaboriault is fine with the PR.

@blaisb blaisb merged commit 6c4a9d0 into master Jun 14, 2024
8 checks passed
@blaisb blaisb deleted the dem_modify-g-parameter branch June 14, 2024 12:05
cleodeletre pushed a commit that referenced this pull request Jun 19, 2024
#1171)

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.
M-Badri pushed a commit to M-Badri/lethe that referenced this pull request Sep 29, 2024
chaos-polymtl#1171)

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.

Former-commit-id: 6c4a9d0
blaisb pushed a commit that referenced this pull request Sep 30, 2024
#1171)

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.

Former-commit-id: 6c4a9d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Refactoring This PR is only refactoring or clean up Reviewed and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants