Skip to content

[newchem-cpp] query inj path names#479

Merged
brittonsmith merged 19 commits into
grackle-project:newchem-cppfrom
mabruzzo:ncc/query_inj_path_names
Mar 31, 2026
Merged

[newchem-cpp] query inj path names#479
brittonsmith merged 19 commits into
grackle-project:newchem-cppfrom
mabruzzo:ncc/query_inj_path_names

Conversation

@mabruzzo

@mabruzzo mabruzzo commented Jan 1, 2026

Copy link
Copy Markdown
Collaborator

This should be reviewed after PR #477 and #478 has been reviewed and merged


The size of the PR grew a little more than I initially anticipated.

Overview

This PR exposes information about the injection-pathway data to users through injection pathway information. Specifically users can query:

  • "inject_model_names" to get the list of strings naming each injection pathway (in the order that is internally assumed)
  • "inject_path_gas_yield_frac.C", "inject_path_gas_yield_frac.O", "inject_path_gas_yield_frac.Mg", ... to get yields for each metal nuclide that is initially in the gas-phase. For concreteness, let's consider the array associated with "inject_path_gas_yield_frac.C". Element i of that array holds the fraction of all injected non-primordial material corresponding to Carbon nuclides in the gas phase molecules.
  • "inject_path_grain_yield_frac.MgSiO3_dust", "inject_path_grain_yield_frac.AC_dust", ... to get yields for each relevant grain species. For concreteness, let's consider the array associated with "inject_path_grain_yield_frac.AC_dust". Element i of that array holds the fraction of all injected non-primordial material initially corresponding to amorphous carbon dust.

All other changes are effectively consequences

C++ Testing

I needed to update a bunch of the C++ tests to make sure that they worked properly since "inject_model_names" is the very first queryable-key that corresponds to an array of strings.

I also added a handful of tests to explicitly test queries of these new keys. Some examples include:

  • testing that all of these arrays have the same length
  • checking that all yields have a value $ 0 \leq x \leq 1$
  • that the sum of all yields is less than or approximately equal to 1 (this is performed separately for different injection pathways)

I did a little refactoring to try to make this all work nicely

gracklepy changes

I updated FluidContainer (and the supporting functions) to explicitly query the list of injection pathways from Grackle, rather than hardcoding the names of all of the injection pathways

  • this isn't a significant change, but I very much consider this to be a sign of things to come (i.e. reducing duplication of logic between the core library and the gracklepy layer)

I also added some experimental methods to access the yields from gracklepy. I don't think these are necessarily optimal, but I think its a useful short-term solution. Eventually (but not in this PR), we probably want to reuse this information to improve tests of multi-grain-species dust model so that it appropriately uses this information

pytest changes

I added a simple check of the new gracklepy changes (I think it will be a useful diagnostic tool if we make changes and forget to fully propagate the changes throughout the gracklepy)

The payoff

A major payoff to all of this effort is actually coming in the next PR.

@mabruzzo mabruzzo added the refactor internal reorganization or code simplification with no behavior changes label Jan 1, 2026
@mabruzzo mabruzzo force-pushed the ncc/query_inj_path_names branch from c35f246 to 6b69e77 Compare January 1, 2026 23:15
@mabruzzo mabruzzo changed the title Ncc/query inj path names [newchem-cpp] query inj path names Jan 4, 2026
@brittonsmith brittonsmith changed the base branch from newchem-cpp to main March 19, 2026 13:13
@brittonsmith brittonsmith changed the base branch from main to newchem-cpp March 19, 2026 13:13
@brittonsmith brittonsmith changed the base branch from newchem-cpp to main March 31, 2026 08:43
@brittonsmith brittonsmith changed the base branch from main to newchem-cpp March 31, 2026 08:44

@brittonsmith brittonsmith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good and I'm keen to keep moving. It looks like the only failure is a clang tidy check. I'm going to merge rather than allowing it to commit.

@brittonsmith brittonsmith merged commit 2c11946 into grackle-project:newchem-cpp Mar 31, 2026
4 of 5 checks passed
@mabruzzo mabruzzo deleted the ncc/query_inj_path_names branch April 2, 2026 10:36
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