[SPH] Hutchison 2018 Multigrain#1616
Conversation
|
Thanks @tdavidcl for opening this PR! You can do multiple things directly here: Once the workflow completes a message will appear displaying informations related to the run. Also the PR gets automatically reviewed by gemini, you can: |
Summary of ChangesHello @tdavidcl, 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 integrates a new multigrain dust model into the SPH solver, specifically focusing on the MonofluidTVI configuration. It introduces new particle fields and implements the numerical calculation for the time evolution of a key dust-related variable, S_j, following the methodology outlined in the Hutchison 2018 paper. Additionally, it enhances the solver's configuration safety by restricting experimental dust features. Highlights
Changelog
Activity
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.
Code Review
This pull request introduces functionality for multigrain dust based on the Hutchison (2018) model. The changes span configuration and solver logic, adding new fields and a dedicated derivative update function. My review has identified a critical issue in the new derivative calculation where a key term is hardcoded to zero, which will lead to incorrect results. Additionally, there are several instances of unused variables and redundant code, likely from copy-pasting, which impact readability and performance. I've provided suggestions to clean this up and improve maintainability.
| Tscal rho_a_inv = 1. / rho_a; | ||
|
|
||
| Tscal s_j_a = s_j[gid]; | ||
| Tscal Ttilde_sj_a = 0; // TODO |
There was a problem hiding this comment.
The variable Ttilde_sj_a is hardcoded to 0 with a // TODO comment. Similarly, Ttilde_sj_b is 0 on line 1346. This causes Ts_weighted and consequently term1 in the calculation of ds_j_dt_a to be always zero, leading to an incorrect implementation of equation 51 from Hutchison (2018). This part of the model needs to be implemented for the feature to work correctly.
| auto axyz = buf_axyz.get_write_access(depends_list); | ||
| auto vxyz = buf_vxyz.get_read_access(depends_list); | ||
| auto hpart = buf_hpart.get_read_access(depends_list); | ||
| auto omega = buf_omega.get_read_access(depends_list); | ||
| auto pressure = buf_pressure.get_read_access(depends_list); | ||
| auto alpha_AV = buf_alpha_AV.get_read_access(depends_list); | ||
| auto cs = buf_cs.get_read_access(depends_list); |
There was a problem hiding this comment.
The kernel update_derivs_dust_monofluid_tvi_Sj appears to contain unused code, likely from being copied from another function. This increases complexity and can introduce performance overhead due to unnecessary data access.
Specifically, the following are acquired but not used:
- Accessors:
axyz,alpha_AV,cs. - Variables inside the kernel:
alpha_a,rho_a_sq,rho_a_inv,omega_a_rho_a_inv,force_pressure,tmpdU_pressure,alpha_b,cs_b.
Please remove all unused variables and buffer accesses to clean up the code.
| return bool(std::get_if<MonofluidTVI>(¤t_mode)) | ||
| || bool(std::get_if<MonofluidComplete>(¤t_mode)); |
There was a problem hiding this comment.
| bool is_not_none = bool(std::get_if<MonofluidTVI>(¤t_mode)) | ||
| || bool(std::get_if<MonofluidComplete>(¤t_mode)); | ||
| if (is_not_none) { |
There was a problem hiding this comment.
| constexpr Tscal Rker2 = Kernel::Rkern * Kernel::Rkern; | ||
|
|
||
| shambase::parallel_for( | ||
| cgh, pdat.get_obj_cnt() * ndust, "compute force CD10 AV", [=](u64 gid) { |
There was a problem hiding this comment.
The SYCL kernel name "compute force CD10 AV" appears to be a copy-paste artifact and is misleading for a function that computes dust variable derivatives. A more descriptive name, such as "compute ds_j_dt", would improve clarity and debuggability.
| cgh, pdat.get_obj_cnt() * ndust, "compute force CD10 AV", [=](u64 gid) { | |
| cgh, pdat.get_obj_cnt() * ndust, "compute ds_j_dt", [=](u64 gid) { |
Workflow reportworkflow report corresponding to commit 8676e83 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.