Skip to content

Conversation

@tdavidcl
Copy link
Member

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 significantly enhances the simulation framework by adding comprehensive support for the Machida 2006 Equation of State. The changes involve defining the new EOS configuration, seamlessly integrating it into the existing EOS management system, and implementing its specific pressure and sound speed calculations within the SPH solver. Additionally, the new EOS is fully supported for JSON serialization/deserialization and is accessible via Python bindings, providing users with an expanded set of physical models for their simulations.

Highlights

  • New Machida 2006 EOS: Introduced a new Equation of State (EOS) based on the Machida 2006 model, including its configuration structure and equality operator.
  • EOS Configuration Integration: Integrated the new Machida 2006 EOS into the existing EOSConfig variant, allowing it to be selected and configured alongside other EOS types.
  • Serialization and Deserialization Support: Added logic to handle JSON serialization and deserialization for the Machida 2006 EOS, ensuring its parameters can be saved and loaded.
  • SPH Solver Implementation: Implemented the core computation of pressure and sound speed for the Machida 2006 EOS within the SPH solver's ComputeEos module.
  • Python Bindings: Exposed the Machida 2006 EOS configuration to Python users, enabling its setup and use through the pySPHModel interface.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 adds support for the Machida 2006 equation of state, with changes spanning configuration, serialization, computation, and Python bindings. The implementation is largely well-structured and follows the existing patterns in the codebase. I have identified a couple of minor areas for improvement: an unprofessional error message that should be updated for clarity, and some unused variables in a lambda function that can be removed to enhance code quality and readability. Overall, this is a solid contribution.

j.at("mh").get<Tscal>(),
j.at("kb").get<Tscal>()};
} else {
shambase::throw_unimplemented("wtf !");

Choose a reason for hiding this comment

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

medium

The error message "wtf !" is unprofessional and not descriptive. It should be replaced with a message that clearly explains the error, for example, indicating that an unknown or unsupported eos_type was encountered during deserialization.

Suggested change
shambase::throw_unimplemented("wtf !");
shambase::throw_unimplemented("Unknown or unsupported eos_type for deserialization.");

Comment on lines +427 to +433
[rho_c1, rho_c2, rho_c3, cs0 = cs, mu, mh, kb](
u32 i,
auto rho,
const Tscal *__restrict U,
const Tvec *__restrict xyz,
Tscal *__restrict P,
Tscal *__restrict cs) {

Choose a reason for hiding this comment

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

medium

The lambda captures mu, mh, and kb, but these variables are not used within the lambda's body. This can be misleading and adds unnecessary overhead. Additionally, the parameters U and xyz are also unused. It's good practice to indicate this by removing their names. Please apply the suggested changes to improve code clarity.

                [rho_c1, rho_c2, rho_c3, cs0 = cs](
                    u32 i,
                    auto rho,
                    const Tscal *__restrict /*U*/,
                    const Tvec *__restrict /*xyz*/,
                    Tscal *__restrict P,
                    Tscal *__restrict cs) {

@github-actions
Copy link

Workflow report

workflow report corresponding to commit 86f6972
Commiter email is timothee.davidcleris@proton.me

Light CI is enabled. This will only run the basic tests and not the full tests.
Merging a PR require the job "on PR / all" to pass which is disabled in this case.

Pre-commit check report

Pre-commit check: ✅

trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check for merge conflicts................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check for broken symlinks................................................Passed
check yaml...............................................................Passed
detect private key.......................................................Passed
No-tabs checker..........................................................Passed
Tabs remover.............................................................Passed
Validate GitHub Workflows................................................Passed
clang-format.............................................................Passed
black....................................................................Passed
ruff check...............................................................Passed
Check doxygen headers....................................................Passed
Check license headers....................................................Passed
Check #pragma once.......................................................Passed
Check SYCL #include......................................................Passed
No ssh in git submodules remote..........................................Passed

Test pipeline can run.

Doxygen diff with main

Removed warnings : 24
New warnings : 31
Warnings count : 7435 → 7442 (0.1%)

Detailed changes :
+ src/shammodels/common/include/shammodels/common/EOSConfig.hpp:102: warning: The following parameter of shammodels::EOSConfig::set_polytropic(Tscal K, Tscal gamma) is not documented:
- src/shammodels/common/include/shammodels/common/EOSConfig.hpp:122: warning: Member set_locally_isothermalFA2014(Tscal h_over_r) (function) of struct shammodels::EOSConfig is not documented.
+ src/shammodels/common/include/shammodels/common/EOSConfig.hpp:126: warning: Member set_locally_isothermalFA2014(Tscal h_over_r) (function) of struct shammodels::EOSConfig is not documented.
- src/shammodels/common/include/shammodels/common/EOSConfig.hpp:98: warning: The following parameter of shammodels::EOSConfig::set_polytropic(Tscal K, Tscal gamma) is not documented:
- src/shammodels/common/src/EOSConfig.cpp:160: warning: Member to_json< f64_3 >(nlohmann::json &j, const EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
- src/shammodels/common/src/EOSConfig.cpp:160: warning: Member to_json< f64_3 >(nlohmann::json &j, const EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
- src/shammodels/common/src/EOSConfig.cpp:161: warning: Member from_json< f64_3 >(const nlohmann::json &j, EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
- src/shammodels/common/src/EOSConfig.cpp:161: warning: Member from_json< f64_3 >(const nlohmann::json &j, EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
+ src/shammodels/common/src/EOSConfig.cpp:180: warning: Member to_json< f64_3 >(nlohmann::json &j, const EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
+ src/shammodels/common/src/EOSConfig.cpp:180: warning: Member to_json< f64_3 >(nlohmann::json &j, const EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
+ src/shammodels/common/src/EOSConfig.cpp:181: warning: Member from_json< f64_3 >(const nlohmann::json &j, EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
+ src/shammodels/common/src/EOSConfig.cpp:181: warning: Member from_json< f64_3 >(const nlohmann::json &j, EOSConfig< f64_3 > &p) (function) of namespace shammodels is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:821: warning: Member check_config() (function) of struct shammodels::sph::SolverConfig is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:837: warning: Member check_config() (function) of struct shammodels::sph::SolverConfig is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:845: warning: Member set_layout(shamrock::patch::PatchDataLayerLayout &pdl) (function) of struct shammodels::sph::SolverConfig is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:846: warning: Member set_ghost_layout(shamrock::patch::PatchDataLayerLayout &ghost_layout) (function) of struct shammodels::sph::SolverConfig is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:861: warning: Member set_layout(shamrock::patch::PatchDataLayerLayout &pdl) (function) of struct shammodels::sph::SolverConfig is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:862: warning: Member set_ghost_layout(shamrock::patch::PatchDataLayerLayout &ghost_layout) (function) of struct shammodels::sph::SolverConfig is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:915: warning: Member to_json(nlohmann::json &j, const ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:915: warning: Member to_json(nlohmann::json &j, const ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:928: warning: Member from_json(const nlohmann::json &j, ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:928: warning: Member from_json(const nlohmann::json &j, ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:931: warning: Member to_json(nlohmann::json &j, const ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:931: warning: Member to_json(nlohmann::json &j, const ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:943: warning: Member to_json(nlohmann::json &j, const SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:943: warning: Member to_json(nlohmann::json &j, const SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:944: warning: Member from_json(const nlohmann::json &j, ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:944: warning: Member from_json(const nlohmann::json &j, ParticleKillingConfig< Tvec > &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:959: warning: Member to_json(nlohmann::json &j, const SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:959: warning: Member to_json(nlohmann::json &j, const SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:963: warning: Member from_json(const nlohmann::json &j, SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:963: warning: Member from_json(const nlohmann::json &j, SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:979: warning: Member from_json(const nlohmann::json &j, SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:979: warning: Member from_json(const nlohmann::json &j, SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:1010: warning: Member add_analysisEnergyPotential_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:1014: warning: Member add_analysisEnergyKinetic_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:1026: warning: Member add_analysisTotalMomentum_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:1030: warning: Member add_analysisEnergyPotential_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:1044: warning: Member analysis_impl(shammodels::sph::Model< Tvec, SPHKernel > &model) -> Analysis (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:1046: warning: Member add_analysisTotalMomentum_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:1049: warning: Member register_analysis_impl_for_each_kernel(py::module &msph, const char *name_class) (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:1064: warning: Member analysis_impl(shammodels::sph::Model< Tvec, SPHKernel > &model) -> Analysis (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:1069: warning: Member register_analysis_impl_for_each_kernel(py::module &msph, const char *name_class) (function) of file pySPHModel.cpp is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:1110: warning: Member Register_pymod(pysphmodel) (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:1130: warning: Member Register_pymod(pysphmodel) (function) of file pySPHModel.cpp is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:976: warning: Member add_analysisBarycenter_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:994: warning: Member add_analysisEnergyKinetic_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:996: warning: Member add_analysisBarycenter_instance(py::module &m, std::string name_model) (function) of file pySPHModel.cpp is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:197: warning: Member rho_c1 (variable) of struct shamphys::EOS_Config_Machida06 is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:198: warning: Member rho_c2 (variable) of struct shamphys::EOS_Config_Machida06 is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:199: warning: Member rho_c3 (variable) of struct shamphys::EOS_Config_Machida06 is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:200: warning: Member cs (variable) of struct shamphys::EOS_Config_Machida06 is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:201: warning: Member mu (variable) of struct shamphys::EOS_Config_Machida06 is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:202: warning: Member mh (variable) of struct shamphys::EOS_Config_Machida06 is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:203: warning: Member kb (variable) of struct shamphys::EOS_Config_Machida06 is not documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant