Skip to content

Conversation

@alisonkyoung1
Copy link
Contributor

Description:
This introduces tests for icooling=9 and ieos=24. First there's the test test_eos_stam.f90 that checks the read and interpolation of the EOS/opacity table. Second, there's a new Github workflow to run a collapsing sphere test and compare the evolution to a reference result.
Additionally, there's an improved table search in eos_stamatellos.f90.
(Lots of files have changed because I ran the bots and the year updated to 2026.)

Components modified:

  • [x ] Setup (src/setup)
  • Main code (src/main)
  • Moddump utilities (src/utils/moddump)
  • Analysis utilities (src/utils/analysis)
  • Test suite (src/tests)
  • Documentation (docs/)
  • Build/CI (build/ or github actions)

Type of change:

  • Bug fix
  • Physics improvements
  • Better initial conditions
  • Performance improvements
  • Documentation update
  • Better testing
  • Code cleanup / refactor
  • Other (please describe)

Testing:
Checked the results of the test.

Did you run the bots? yes

Did you update relevant documentation in the docs directory? no

Did you add comments such that the purpose of the code is understandable? yes

Is there a unit test that could be added for this feature/bug? n/a

alisonkyoung1 and others added 30 commits February 12, 2025 10:18
…re to save dudt_radiative, Warning- these changes make break reads for production runs: fix this
… and use epicyclic frequency in calculation of Q.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @alisonkyoung1, 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 testing infrastructure for the radiative cooling approximation (icooling=9) and a specific equation of state (ieos=24). It introduces a dedicated test for the EOS/opacity table interpolation and integrates a new GitHub workflow to validate the simulation's evolution against reference data for a collapsing sphere. These changes aim to improve the reliability and accuracy of the code's astrophysical models.

Highlights

  • New Test for Radiative Cooling Approximation: Introduced a new test (test_eos_stam.f90) specifically designed for icooling=9 and ieos=24, which checks the reading and interpolation of EOS/opacity tables.
  • Collapsing Sphere Test Workflow: Added a new GitHub Actions workflow to run a collapsing sphere test and compare its evolution against a reference result, enhancing continuous integration for this physics model.
  • Improved Table Search in EOS Module: The eos_stamatellos.f90 module now features a more robust and efficient table search mechanism for interpolation, improving the accuracy and performance of EOS calculations.
  • Copyright Year Update: The copyright year in numerous source files has been updated from 2025 to 2026, reflecting routine maintenance and project longevity.
  • New Setup for Radiative Cooling: A new setup, testcoolra, has been added to build/Makefile_setups to specifically configure simulations for star cluster formation using the radiative cooling approximation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/coolingra.yml
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
Contributor

@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 introduces tests for a new radiative cooling approximation, including a new test file, a GitHub workflow, and associated data files. It also includes a performance improvement in the table search logic within eos_stamatellos.f90 by replacing a linear search with a binary search. However, there are several issues that need to be addressed. The AUTHORS file contains merge conflicts that must be resolved. There are also critical bugs in src/setup/set_disc.f90 related to physical formula implementations. Additionally, the new test script check_masunaga_vs_maxvals.f90 has some inconsistencies that reduce its clarity and correctness. I've provided detailed comments and suggestions for these issues.

@alisonkyoung1
Copy link
Contributor Author

Running ./phantomsetup crashes and fails to write a dump for >10^6 particles.
The issue is readwrite_dumps.f90 line 227
call write_array(1,eos_vars(itemp,:),eos_vars_label(itemp),npart,k,ipass,idump,nums,nerr)
Is this something to do with a temporary array being created due to non-contiguous data and it being too big for memory?

@alisonkyoung1
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@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 introduces tests for the radiative cooling approximation, including a new test for EOS table interpolation and a GitHub workflow for a collapsing sphere test. The changes also include performance improvements in the table search algorithm. My review focuses on improving code clarity, robustness, and maintainability. I've identified some duplicate entries in the AUTHORS file, potential issues in a new test script, and opportunities for code refinement in the updated modules, such as removing magic numbers and commented-out code.

@alisonkyoung1
Copy link
Contributor Author

I can't figure out why these tests are failing with a divide by zero error...?

@alisonkyoung1
Copy link
Contributor Author

@danieljprice The files for running the radiative cooling approx test workflow are currently in /data/cooling/
The other workflows seem to download the setup files etc from elsewhere so I thought I'd wait and ask you where these should go.

@alisonkyoung1 alisonkyoung1 changed the title Tests for radiative cooling approximation Tests for radiative cooling approximation icooling=9 Jan 16, 2026
@alisonkyoung1 alisonkyoung1 marked this pull request as ready for review January 16, 2026 15:04
@danieljprice
Copy link
Owner

Hi @alisonkyoung1 how big are the files required for cooling? If more than a few hundred kb then they can/should be hosted on Zenodo. Are they already committed to the git repo though?

For the write_dump crash I think the issue is how the array is passed, it's better to use the syntax below where we send the whole array but give an argument for the index which should be written to the dump:

       if (eos_is_non_ideal(ieos) .or. (.not.store_dust_temperature .and. icooling > 0)) then
          call write_array(1,eos_vars,eos_vars_label,npart,k,ipass,idump,nums,nerr,index=itemp)
       endif

Divide by zero error is probably an uninitialised variable bug? With DEBUG=yes we initialise all reals and ints to NaN and then flag floating point exceptions to check where a variable is used without being set.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants