-
Notifications
You must be signed in to change notification settings - Fork 321
Tests for radiative cooling approximation #782
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: master
Are you sure you want to change the base?
Conversation
…re to save dudt_radiative, Warning- these changes make break reads for production runs: fix this
…t with writedump routine
… and use epicyclic frequency in calculation of Q.
… one) to analysis_disc_stresses
Summary of ChangesHello @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 ( Highlights
🧠 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
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 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.
| outind = leftind | ||
| return | ||
| endif | ||
| midind = floor((rightind - leftind) / 2.) + leftind |
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.
|
Running ./phantomsetup crashes and fails to write a dump for >10^6 particles. |
|
/gemini review |
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 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.
| Stephane Michoulier <[email protected]> | ||
| Simone Ceppi <[email protected]> | ||
| Alison Young <[email protected]> | ||
| Enrico Ragusa <[email protected]> |
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.
The author Enrico Ragusa <[email protected]> is already listed on line 13. Please remove this duplicate entry to keep the AUTHORS file clean.
| Davide Dionese <[email protected]> | ||
| Josh Calcino <[email protected]> | ||
| Timothée David--Cléris <[email protected]> | ||
| Chunliang Mu <[email protected].com> |
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.
The author Chunliang Mu <[email protected]> is already listed on line 51. Please remove this duplicate entry.
| real(dp),intent(out) :: x(MAXMASU), y(MAXMASU) | ||
| integer, intent(out) :: n | ||
| integer :: u, ios, i | ||
| character(len=40) :: line |
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.
The line buffer size is fixed to 40 characters. While this is sufficient for the current data in Masunaga_2000_collapse.csv, it's quite tight and could lead to truncation errors if the data format changes even slightly. It would be more robust to use a larger buffer, for example character(len=80) :: line.
character(len=80) :: line
| print *, "opening file", fname | ||
| open(newunit=u, file=fname, status='old', action='read', iostat=ios) | ||
| if (ios /= 0) then | ||
| print *, 'test_coolra','file not found:',fname |
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.
| close(u) | ||
|
|
||
| if (n < 1) then | ||
| print *, "test_coolra","ERROR: no valid rows in ",trim(fname) |
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.
| outind = leftind | ||
| return | ||
| endif | ||
| midind = floor((rightind - leftind) / 2.) + leftind |
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.
The use of floor here is redundant because Fortran's integer division already truncates the result. You can simplify this expression for clarity and minor performance improvement. A common and robust way to calculate the midpoint to avoid potential overflow with very large indices is midind = leftind + (rightind - leftind) / 2.
midind = (leftind + rightind) / 2
| use io, only:warning,id,master | ||
| use options, only:alpha,use_dustfrac,use_var_comp | ||
| use sphNGutils, only:itype_from_sphNG_iphase,isphNG_accreted | ||
| ! use cooling_radapprox,only:od_method |
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.
| omega = sqrt(G*star_m/r**3) | ||
| cs = cs_func(cs0,r,q_index) | ||
| if (lumdisc_setup) then | ||
| cs = get_cs_from_lum(L_lumdisc,r,Tbg_lumdisc,5./3.) |
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.
| real :: mu | ||
|
|
||
| mu = 2.381 !mean molecular mass |
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.
The value 2.381 for the mean molecular weight mu is a magic number. It's better practice to define it as a named constant using the parameter attribute. This improves readability and makes it easier to change if needed.
real,intent(in) :: L_star,r,T_bg,gamma
real, parameter :: mu = 2.381 !mean molecular mass
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:
Type of change:
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