feat(tests): comparing to approx8

This commit is contained in:
2025-07-01 11:41:14 -04:00
parent 0a639be836
commit 4ee6f816d0
2 changed files with 40 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
# Reaction network definition for the approx8 network.
# This file lists the reactions to be included for a direct
# comparison with the hard-coded approx8 network.
# --- PP Chain ---
p(p,e+)d
d(p,g)he3
he3(he3,2p)he4
# --- CNO Cycle ---
# Note: approx8 simplifies the CNO cycle using branching fractions,
# but these are the primary gateway reactions.
c12(p,g)n13
n14(p,g)o15
n14(a,g)f18
o16(p,g)f17
# --- Alpha Captures & Triple Alpha ---
c12(a,g)o16
n14(a,g)f18
o16(a,g)ne20
ne20(a,g)mg24
# --- Carbon & Oxygen Burning ---
c12(c12,a)ne20
o16(c12,a)mg24

View File

@@ -3,7 +3,9 @@
#include "gridfire/engine/engine_graph.h" #include "gridfire/engine/engine_graph.h"
#include "gridfire/engine/engine_approx8.h" #include "gridfire/engine/engine_approx8.h"
#include "gridfire/engine/engine_adaptive.h" #include "gridfire/engine/views/engine_adaptive.h"
#include "gridfire/engine/views/engine_defined.h"
#include "gridfire/io/network_file.h"
#include "gridfire/solver/solver.h" #include "gridfire/solver/solver.h"
@@ -39,7 +41,7 @@ void quill_terminate_handler()
int main() { int main() {
g_previousHandler = std::set_terminate(quill_terminate_handler); g_previousHandler = std::set_terminate(quill_terminate_handler);
quill::Logger* logger = fourdst::logging::LogManager::getInstance().getLogger("log"); quill::Logger* logger = fourdst::logging::LogManager::getInstance().getLogger("log");
logger->set_log_level(quill::LogLevel::TraceL1); logger->set_log_level(quill::LogLevel::Debug);
LOG_DEBUG(logger, "Starting Adaptive Engine View Example..."); LOG_DEBUG(logger, "Starting Adaptive Engine View Example...");
using namespace gridfire; using namespace gridfire;
@@ -62,16 +64,22 @@ int main() {
netIn.dt0 = 1e12; netIn.dt0 = 1e12;
NetOut netOut; NetOut netOut;
netIn.dt0 = 1e12;
// approx8::Approx8Network approx8Network; // approx8::Approx8Network approx8Network;
// netOut = approx8Network.evaluate(netIn); // netOut = approx8Network.evaluate(netIn);
// std::cout << "Approx8 Network Output: " << netOut << std::endl; // std::cout << "Approx8 Network H-1: " << netOut.composition.getMassFraction("H-1") << " in " << netOut.num_steps << " steps." << std::endl;
netIn.dt0 = 1e-15; netIn.dt0 = 1e-15;
GraphEngine ReaclibEngine(composition); GraphEngine ReaclibEngine(composition);
AdaptiveEngineView adaptiveEngine(ReaclibEngine); // AdaptiveEngineView adaptiveEngine(ReaclibEngine);
solver::QSENetworkSolver solver(adaptiveEngine); io::SimpleReactionListFileParser parser{};
FileDefinedEngineView approx8EngineView(ReaclibEngine, "approx8.net", parser);
approx8EngineView.setScreeningModel(screening::ScreeningType::WEAK);
solver::QSENetworkSolver solver(approx8EngineView);
netOut = solver.evaluate(netIn); netOut = solver.evaluate(netIn);
std::cout << "QSE Graph Network Output: " << netOut << std::endl; std::cout << "QSE Graph Network H-1: " << netOut.composition.getMassFraction("H-1") << " in " << netOut.num_steps << " steps." << std::endl;
} }