-
Notifications
You must be signed in to change notification settings - Fork 18
[Ramses][AMR] More user-defined AMR mode #1427
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
base: main
Are you sure you want to change the base?
[Ramses][AMR] More user-defined AMR mode #1427
Conversation
Summary of ChangesHello @Akos299, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Adaptive Mesh Refinement (AMR) functionality within the Ramses model by integrating several new user-configurable refinement criteria. These additions provide greater flexibility in defining how the simulation mesh adapts, enabling more precise control over resolution in various physical scenarios. The changes span both the core C++ configuration and its Python interface, making these new capabilities accessible to users. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request extends the AMR capabilities by adding several new user-defined modes, which is a valuable addition. The implementation is solid, introducing new configuration structs and corresponding Python bindings. My review focuses on improving naming consistency between the C++ code and the Python API to enhance clarity and maintainability. Specifically, I've pointed out a typo in one of the Python function names and suggested aligning parameter names for some of the new AMR modes with the established conventions in the codebase.
| py::arg("error_min"), | ||
| py::arg("error_max")) | ||
| .def( | ||
| "set_amr_mode_pseudo_second_gradient_based", |
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.
There's a typo in the Python binding function name. It's named set_amr_mode_pseudo_second_gradient_based, which seems to be a copy-paste error from the pseudo_gradient_based mode. To accurately reflect that it configures the second derivative-based AMR mode, it should be renamed to set_amr_mode_second_derivative_based.
| "set_amr_mode_pseudo_second_gradient_based", | |
| "set_amr_mode_second_derivative_based", |
| struct SlopeBased { | ||
| Tscal smooth_detector_threshold; | ||
| }; |
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.
| struct ShocksBased { | ||
| Tscal pressure_threshold; | ||
| Tscal energy_threshold; | ||
| }; |
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.
For consistency with other AMR criteria (e.g., crit_mass) and the Python binding arguments (crit_pressure, crit_energy), it's recommended to rename pressure_threshold to crit_pressure and energy_threshold to crit_energy.
| struct ShocksBased { | |
| Tscal pressure_threshold; | |
| Tscal energy_threshold; | |
| }; | |
| struct ShocksBased { | |
| Tscal crit_pressure; | |
| Tscal crit_energy; | |
| }; |
| void set_refine_slope_based(Tscal smooth_detector_threshold) { | ||
| config = SlopeBased{smooth_detector_threshold}; | ||
| } |
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.
To align with the suggested change in the SlopeBased struct, the parameter smooth_detector_threshold should be renamed to crit_smooth here as well.
| void set_refine_slope_based(Tscal smooth_detector_threshold) { | |
| config = SlopeBased{smooth_detector_threshold}; | |
| } | |
| void set_refine_slope_based(Tscal crit_smooth) { | |
| config = SlopeBased{crit_smooth}; | |
| } |
| void set_refine_shocks_based(Tscal pressure_threshold, Tscal energy_threshold) { | ||
| config = ShocksBased{pressure_threshold, energy_threshold}; | ||
| } |
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.
To align with the suggested changes in the ShocksBased struct, the parameters of this setter function should be renamed to crit_pressure and crit_energy.
| void set_refine_shocks_based(Tscal pressure_threshold, Tscal energy_threshold) { | |
| config = ShocksBased{pressure_threshold, energy_threshold}; | |
| } | |
| void set_refine_shocks_based(Tscal crit_pressure, Tscal crit_energy) { | |
| config = ShocksBased{crit_pressure, crit_energy}; | |
| } |
Workflow reportworkflow report corresponding to commit b35f7fb Light CI is enabled. This will only run the basic tests and not the full tests. Pre-commit check reportPre-commit check: ✅ Test pipeline can run. Doxygen diff with
|
No description provided.