Skip to content

Conversation

@JotaRata
Copy link

Type of PR:
Bug fix

Description:
Fixes #146

Testing:
I haven't tested it yet

Did you run the botscheck that the code and comments follow the code of conduct? no

Did you update relevant documentation in the docs directory? no

@gemini-code-assist
Copy link

Summary of Changes

Hello @JotaRata, 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 primarily introduces the calculation of the stellar accretion rate (Mdot) within the read_phantom.f90 file, specifically for scenarios with fixed stellar parameters, aiming to resolve a reported bug. Additionally, it refines the .gitignore file to prevent the tracking of certain data and utility files.

Highlights

  • Mdot Calculation: Implemented the calculation of Mdot (accretion rate) for stellar parameters within the phantom_2_mcfost subroutine in src/read_phantom.f90. This specifically uses the 16th element of xyzmh_ptmass for the Mdot value, converting it to Msun/year.
  • Gitignore Update: Updated the .gitignore file to exclude .dat files and the utils/ directory from version control, helping to keep the repository clean of generated or temporary files.
  • Bug Fix Intent: This pull request is intended as a bug fix, addressing issue Mdot not being passed from Phantom to MCFOST when lfix_star is set to True #146, though specific details of the bug are not provided in the description.
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 the update of the stellar accretion rate (Mdot) when using fixed stellar parameters. The change in src/read_phantom.f90 correctly uses xyzmh_ptmass(16,...) to get the accretion rate from the phantom file. However, it is missing a check for the force_Mdot flag, which is present in the other code path. The TODO comment indicates this was intended but not implemented. I've suggested adding this check for consistency and to respect manually forced accretion rates. The changes to .gitignore seem reasonable.

Comment on lines +1125 to +1126
! TODO: Add conditions for forced Mdot
etoile(i_etoile)%Mdot = xyzmh_ptmass(16,i_etoile) * usolarmass / utime_scaled * year_to_s ! Accretion rate is in Msun/year

Choose a reason for hiding this comment

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

high

It's great that you're adding the Mdot update for the lfix_star case. As your TODO comment indicates, the condition to check for force_Mdot is missing. To maintain consistency with the else block (lines 1164-1166) and to ensure that manually set accretion rates are not overwritten, you should wrap this assignment in a check for etoile(i_etoile)%force_Mdot.

I've also noticed a minor indentation inconsistency. The new code is indented with 10 spaces, while surrounding assignments use 9. My suggestion corrects this for consistency.

         if (.not.etoile(i_etoile)%force_Mdot) then
            etoile(i_etoile)%Mdot = xyzmh_ptmass(16,i_etoile) * usolarmass / utime_scaled * year_to_s ! Accretion rate is in Msun/year
         endif

@cpinte
Copy link
Owner

cpinte commented Jan 17, 2026

Hi Jorge,
I am trying to clean up the backlog of PRs. Could you please address Gemini's point ?
and do a few tests to make it behaves as expected ?
Many thanks,
C.

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.

Mdot not being passed from Phantom to MCFOST when lfix_star is set to True

2 participants