From f7fbc6c1da03076f779c20d78d9b969accb38295 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Wed, 19 Nov 2025 07:42:10 -0500 Subject: [PATCH] refactor(src): small changes --- .../strategies/CVODE_solver_strategy.cpp | 6 +----- tests/graphnet_sandbox/main.cpp | 18 ++++++++++-------- tests/meson.build | 1 - 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/lib/solver/strategies/CVODE_solver_strategy.cpp b/src/lib/solver/strategies/CVODE_solver_strategy.cpp index 16d45967..ff0d6093 100644 --- a/src/lib/solver/strategies/CVODE_solver_strategy.cpp +++ b/src/lib/solver/strategies/CVODE_solver_strategy.cpp @@ -156,7 +156,7 @@ namespace gridfire::solver { ) { LOG_TRACE_L1(m_logger, "Starting solver evaluation with T9: {} and rho: {}", netIn.temperature/1e9, netIn.density); LOG_TRACE_L1(m_logger, "Building engine update trigger...."); - auto trigger = trigger::solver::CVODE::makeEnginePartitioningTrigger(1e12, 1e10, 0.01, 10); + auto trigger = trigger::solver::CVODE::makeEnginePartitioningTrigger(1e12, 1e10, 1e-6, 10); LOG_TRACE_L1(m_logger, "Engine update trigger built!"); @@ -454,10 +454,6 @@ namespace gridfire::solver { initialize_cvode_integration_resources(N, numSpecies, current_time, currentComposition, absTol, relTol, accumulated_energy); check_cvode_flag(CVodeReInit(m_cvode_mem, current_time, m_Y), "CVodeReInit"); - - std::cerr << "Aborting for debug purposes\n"; - exit(0); - } } diff --git a/tests/graphnet_sandbox/main.cpp b/tests/graphnet_sandbox/main.cpp index ef2ca0a3..1b340381 100644 --- a/tests/graphnet_sandbox/main.cpp +++ b/tests/graphnet_sandbox/main.cpp @@ -38,7 +38,6 @@ static bool s_wrote_abundance_history = false; static bool s_wrote_reaction_history = false; void quill_terminate_handler(); - inline std::unique_ptr build_partition_function() { using gridfire::partition::BasePartitionType; const auto partitionFunction = gridfire::partition::CompositePartitionFunction({ @@ -246,15 +245,15 @@ void save_callback_data(const std::string_view filename) { csvFile.close(); } -void log_callback_data() { +void log_callback_data(const double temp) { if (s_wrote_abundance_history) { std::cout << "Saving abundance history to abundance_history.csv" << std::endl; - save_callback_data("abundance_history.csv"); + save_callback_data("abundance_history_" + std::to_string(temp) + ".csv"); } if (s_wrote_reaction_history) { std::cout << "Saving reaction history to reaction_contribution_history.json" << std::endl; - std::ofstream jsonFile("reaction_contribution_history.json", std::ios::out); + std::ofstream jsonFile("reaction_contribution_history_" + std::to_string(temp) + ".json", std::ios::out); jsonFile << boost::json::serialize(g_reaction_contribution_history); jsonFile.close(); } @@ -262,7 +261,7 @@ void log_callback_data() { void quill_terminate_handler() { - log_callback_data(); + log_callback_data(1.5e7); quill::Backend::stop(); if (g_previousHandler) g_previousHandler(); @@ -277,7 +276,9 @@ void callback_main(const gridfire::solver::CVODESolverStrategy::TimestepContext& int main() { using namespace gridfire; - const NetIn netIn = init(1.5e7); + + constexpr double temp = 1.5e7; // 15 MK + const NetIn netIn = init(temp); policy::MainSequencePolicy stellarPolicy(netIn.composition); stellarPolicy.construct(); @@ -285,7 +286,8 @@ int main() { solver::CVODESolverStrategy solver(engine); solver.set_callback(solver::CVODESolverStrategy::TimestepCallback(callback_main)); - const NetOut netOut = solver.evaluate(netIn); + + const NetOut netOut = solver.evaluate(netIn, true); log_results(netOut, netIn); - log_callback_data(); + log_callback_data(temp); } \ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build index 720bd28e..6914a261 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -4,5 +4,4 @@ gtest_main = dependency('gtest_main', required: true) gtest_nomain_dep = dependency('gtest', main: false, required : true) # Subdirectories for unit and integration tests -subdir('network') subdir('graphnet_sandbox')