Skip to content

Added element input to eos helmholtz with default being C/O 50,50. #822

Merged
danieljprice merged 4 commits into
danieljprice:mainfrom
AliPourmand:helmholtz_abundance_input
Jun 4, 2026
Merged

Added element input to eos helmholtz with default being C/O 50,50. #822
danieljprice merged 4 commits into
danieljprice:mainfrom
AliPourmand:helmholtz_abundance_input

Conversation

@AliPourmand
Copy link
Copy Markdown
Contributor

Description:
The element abundance in EOS helmholtz was hardcoded before; now elements H,He,C,O,Ne,Mg can be added as a runtime parameter in .in files when eos is helmholtz

Components modified:

  • Setup (src/setup)
  • [ x] 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:

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

Testing:
setting the total elements to more than 1 and seeing if it gives errors

Did you run the bots? no

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

…w it should be added as a runtime parameter in .in files when eos is helmholtz
Copy link
Copy Markdown
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 updates the Helmholtz Equation of State (EOS) module to allow runtime configuration of species mass fractions (hydrogen, helium, carbon, oxygen, neon, and magnesium) instead of using hard-coded values. Feedback on these changes highlights a critical issue where using tiny(xmass) as a tolerance for the mass fraction sum check will fail due to floating-point precision limits; using epsilon or a reasonable tolerance is recommended. Additionally, the new configuration parameters should include default values in read_inopt to maintain backward compatibility with existing input files, and commented-out dead code should be cleaned up.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/main/eos_helmholtz.f90
Comment thread src/main/eos_helmholtz.f90 Outdated
Comment thread src/main/eos_helmholtz.f90 Outdated
Comment thread src/main/eos_helmholtz.f90 Outdated
@danieljprice
Copy link
Copy Markdown
Owner

the test failure is the same one we had on Antoine's pull request, seems a bit stochastic but likely related to previous changes. I suspect the temp(:) array we added needs to be at least allocated/initialised to zero for the non-Helmholtz cases

@AliPourmand
Copy link
Copy Markdown
Contributor Author

I added a line in read_star_profile after allocation to set temp=0 for all non-file based profiles, would that be a good fix?

 allocate(r(ng_max),den(ng_max),pres(ng_max),temp(ng_max),en(ng_max),mtab(ng_max))
 temp = 0.  ! Initialize temperature array for non-file-based profiles

@danieljprice danieljprice merged commit b974552 into danieljprice:main Jun 4, 2026
269 checks passed
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