From e704d5a1a7bede9d4749329c7195eda06381432c Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 20 Apr 2026 12:42:23 -0400 Subject: [PATCH] feat(GridFire): updated --- .gitignore | 1 + tools/gf_bbn/main.cpp | 2 +- utils/reaclib/gen_rates.py | 20 ++++++++++++++++++++ utils/reaclib/readme.md | 12 ++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 utils/reaclib/gen_rates.py diff --git a/.gitignore b/.gitignore index 8d949810..76274f0b 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,5 @@ cross/python_includes *.pdf *pynuc.txt +*.dat *pynucastro_network.py diff --git a/tools/gf_bbn/main.cpp b/tools/gf_bbn/main.cpp index d2e2669a..19242b92 100644 --- a/tools/gf_bbn/main.cpp +++ b/tools/gf_bbn/main.cpp @@ -226,7 +226,7 @@ int main(int argc, char** argv) { solver::PointSolverContext solver_ctx(*blob); solver::PointSolver solver(engine); - solver_ctx.stdout_logging=false; + solver_ctx.stdout_logging=true; double current_time = 180; nlohmann::json j; diff --git a/utils/reaclib/gen_rates.py b/utils/reaclib/gen_rates.py new file mode 100644 index 00000000..d770ddaf --- /dev/null +++ b/utils/reaclib/gen_rates.py @@ -0,0 +1,20 @@ +import pynucastro as pyna + +def main(): + lib = pyna.ReacLibLibrary() + + filtered_rates = [] + + for rate in lib.get_rates(): + if all(nuc.Z <= 26 for nuc in rate.reactants): + filtered_rates.append(rate) + + out_file = "reaclib_pynucastro_latest_Z26.dat" + + with open(out_file, "w") as f: + for rate in filtered_rates: + rate.write_to_file(f) + + +if __name__ == "__main__": + main() diff --git a/utils/reaclib/readme.md b/utils/reaclib/readme.md index 941cf91e..d5a3873d 100644 --- a/utils/reaclib/readme.md +++ b/utils/reaclib/readme.md @@ -58,6 +58,18 @@ those changes get upstreamed into this utility script. It is a key development g that all of our tools are well documented and easy for non `SERiF` developers to use. +## Pynucastro rates +If you have pynucastro installed you may use the `gen_rates.py` function to generate +a rate file dump. Currently this file filters by Z but you can update this with +arbitrary internal logic. After generating this file run it through format.py with -f bin and -o reactions.bin +and then the bin to header script. + +```bash +python ../bin_to_header.py reactions.bin reactions_data.h raw_reaction_data +``` + +then copy the reactions_data.h files to `GridFire/src/include/gridfire/reactions` + ## Citations REACLIB: - Rauscher, T., Heger, A., Hoffman, R. D., & Woosley, S. E. 2010, ApJS, 189, 240.