Skip to content

Conversation

@DavidFang03
Copy link
Collaborator

@DavidFang03 DavidFang03 commented Dec 8, 2025

Fermi gas:
image
Usage:

cfg.set_eos_fermi(mu_e)

where mu_e is the molecular weight

However I need to get the constants with the right units, how can I do that in eos.hpp ?

@gemini-code-assist
Copy link

Summary of Changes

Hello @DavidFang03, 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 expands the simulation capabilities by adding a Fermi gas Equation of State. This new EoS is fully integrated into the system's configuration and computation modules, providing a robust framework for its use. The changes ensure that the new EoS can be selected, configured, and used in calculations, enhancing the model's physical accuracy for relevant scenarios.

Highlights

  • New Fermi Gas Equation of State (EoS): A new Fermi gas EoS has been introduced, allowing for more diverse astrophysical simulations.
  • Integration into EOS Configuration: The Fermi EoS has been integrated into the EOSConfig and SolverConfig classes, enabling its selection and parameterization alongside existing EoS types.
  • Core Physics Implementation: The shamphys/eos.hpp file now includes the mathematical models for calculating pressure and sound speed for the Fermi EoS, utilizing fundamental physical constants.
  • Python Bindings: Python bindings have been added, allowing users to easily set the Fermi EoS configuration via cfg.set_eos_fermi(mu_e).
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 successfully adds the Fermi gas equation of state. The implementation is spread across several files to integrate the new EoS into the existing framework, including configuration, JSON serialization, Python bindings, and the core computation kernel.

I've made a few suggestions to improve code clarity, documentation, and performance. Notably, there's an opportunity to optimize the EOS_Fermi calculation by computing pressure and sound speed together to avoid redundant calculations. I also found a misleading comment in eos_config.hpp that should be corrected.

Regarding your question about units, your usage of shamunits::Constants<T>::Si::... in eos.hpp is the correct approach for this codebase to get physical constants in the right unit system.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Workflow report

workflow report corresponding to commit 954edd8
Commiter email is david.fang@ikmail.com

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 : 31
New warnings : 35
Warnings count : 7624 → 7628 (0.1%)

Detailed changes :
+ src/shammodels/common/include/shammodels/common/EOSConfig.hpp:103: 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:127: 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:54: warning: Member Polytropic (typedef) 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:166: 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:166: 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:167: 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:167: 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:529: warning: The following parameter of shammodels::sph::SolverConfig::set_eos_polytropic(Tscal K, Tscal gamma) is not documented:
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:535: warning: The following parameter of shammodels::sph::SolverConfig::set_eos_polytropic(Tscal K, Tscal gamma) is not documented:
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:553: warning: The following parameter of shammodels::sph::SolverConfig::set_eos_locally_isothermalFA2014(Tscal h_over_r) is not documented:
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:553: warning: argument 'cs0' of command @param is not found in the argument list of shammodels::sph::SolverConfig< Tvec, SPHKernel >::set_eos_locally_isothermalFA2014(Tscal h_over_r)
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:553: warning: argument 'q' of command @param is not found in the argument list of shammodels::sph::SolverConfig< Tvec, SPHKernel >::set_eos_locally_isothermalFA2014(Tscal h_over_r)
- src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:553: warning: argument 'r0' of command @param is not found in the argument list of shammodels::sph::SolverConfig< Tvec, SPHKernel >::set_eos_locally_isothermalFA2014(Tscal h_over_r)
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:559: warning: The following parameter of shammodels::sph::SolverConfig::set_eos_locally_isothermalFA2014(Tscal h_over_r) is not documented:
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:559: warning: argument 'cs0' of command @param is not found in the argument list of shammodels::sph::SolverConfig< Tvec, SPHKernel >::set_eos_locally_isothermalFA2014(Tscal h_over_r)
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:559: warning: argument 'q' of command @param is not found in the argument list of shammodels::sph::SolverConfig< Tvec, SPHKernel >::set_eos_locally_isothermalFA2014(Tscal h_over_r)
+ src/shammodels/sph/include/shammodels/sph/SolverConfig.hpp:559: warning: argument 'r0' of command @param is not found in the argument list of shammodels::sph::SolverConfig< Tvec, SPHKernel >::set_eos_locally_isothermalFA2014(Tscal h_over_r)
- 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:834: 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:858: 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:859: 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:928: 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 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:941: 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:941: 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: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:956: 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:956: 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:976: 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:976: warning: Member from_json(const nlohmann::json &j, SmoothingLengthConfig &p) (function) of namespace shammodels::sph is not documented.
- src/shammodels/sph/src/pySPHModel.cpp:1040: 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:1047: 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:1058: 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:1065: 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:1074: 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:1081: 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:1090: 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:1097: 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:1108: 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:1113: 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:1115: 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:1120: 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:1174: warning: Member Register_pymod(pysphmodel) (function) of file pySPHModel.cpp is not documented.
+ src/shammodels/sph/src/pySPHModel.cpp:1181: warning: Member Register_pymod(pysphmodel) (function) of file pySPHModel.cpp is not documented.
+ src/shamphys/include/shamphys/eos.hpp:163: warning: Compound shamphys::PressureAndCs is not documented.
+ src/shamphys/include/shamphys/eos.hpp:164: warning: Member pressure (variable) of struct shamphys::PressureAndCs is not documented.
+ src/shamphys/include/shamphys/eos.hpp:165: warning: Member soundspeed (variable) of struct shamphys::PressureAndCs is not documented.
+ src/shamphys/include/shamphys/eos.hpp:195: warning: Member pressure_and_soundspeed(T mu_e, T rho) (function) of struct shamphys::EOS_Fermi is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:111: warning: Member mu_e (variable) of struct shamphys::EOS_Config_Fermi is not documented.
- src/shamphys/include/shamphys/eos_config.hpp:168: warning: Member h_over_r (variable) of struct shamphys::EOS_Config_LocallyIsothermalDisc_Farris2014 is not documented.
+ src/shamphys/include/shamphys/eos_config.hpp:185: warning: Member h_over_r (variable) of struct shamphys::EOS_Config_LocallyIsothermalDisc_Farris2014 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.

2 participants