Skip to content

[newchem-cpp] Introduce the GrainSpeciesInfo type#428

Merged
brittonsmith merged 12 commits into
grackle-project:newchem-cppfrom
mabruzzo:ncc/introduce-GrainSpeciesInfo
Dec 17, 2025
Merged

[newchem-cpp] Introduce the GrainSpeciesInfo type#428
brittonsmith merged 12 commits into
grackle-project:newchem-cppfrom
mabruzzo:ncc/introduce-GrainSpeciesInfo

Conversation

@mabruzzo

Copy link
Copy Markdown
Collaborator

This should be reviewed after #416 is merged


This introduces structures a bunch of GrainSpecies information that is used for computing sublimation, H2 formation rates, and grain growth rates into a standard format. The impetus for doing this was to finish cleaning up lookup_cool_rate1d and replace all the logic where we explicitly list out the various kinds of grain species with much simpler (and more maintainable for-loops). The ultimate goal is to let us entirely delete the OnlyGrainSpeciesLUT enumeration (we won't be able to do that until we finish transcription).

Originally, I was intended for this to be quick-and-dirty, but in the course of resolving a bug1 I ended up building out the infrastructure. Building out the logic made it easier to write some test-code. Plus I think we want all of this sooner or later.

Footnotes

  1. The bug was related to the order of enumerators (i.e. the named constants of an enumeration) within the OnlyGrainSpeciesLUT enumeration (the order didn't match the species order of enumerators in SpeciesLUT). This PR fixed the bug & adds a unit-test to ensure this isn't violated the future.

@mabruzzo mabruzzo changed the base branch from main to newchem-cpp September 26, 2025 15:47
@mabruzzo mabruzzo changed the title Introduce the GrainSpeciesInfo type [newchem-cpp] Introduce the GrainSpeciesInfo type Sep 26, 2025
@mabruzzo

Copy link
Copy Markdown
Collaborator Author

@brittonsmith, conflicts are addressed

…InfoEntry

This information will only be used after we transcribe
`calc_grain_size_increment_1d` (at which point we will remove the
corresponding constants from phys_constants.h and can entirely delete
the dust_const.def file
I moved them from initialize_dust_yields.cpp where the comments were out
of place to dust/grain_species_info.cpp
@mabruzzo mabruzzo added the refactor internal reorganization or code simplification with no behavior changes label Dec 17, 2025
@brittonsmith brittonsmith merged commit 9ce5140 into grackle-project:newchem-cpp Dec 17, 2025
5 checks passed
@mabruzzo mabruzzo deleted the ncc/introduce-GrainSpeciesInfo branch December 19, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor internal reorganization or code simplification with no behavior changes

Projects

Development

Successfully merging this pull request may close these issues.

2 participants