feat(MultiscalePartitioningEngineView): added *much* more robust qse group identifiction and solving
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include "gridfire/engine/views/engine_adaptive.h"
|
||||
#include "gridfire/partition/partition_types.h"
|
||||
#include "gridfire/engine/views/engine_defined.h"
|
||||
#include "gridfire/engine/views/engine_multiscale.h"
|
||||
#include "gridfire/engine/procedures/priming.h"
|
||||
#include "gridfire/io/network_file.h"
|
||||
|
||||
#include "gridfire/solver/solver.h"
|
||||
@@ -58,17 +60,25 @@ void quill_terminate_handler()
|
||||
int main() {
|
||||
g_previousHandler = std::set_terminate(quill_terminate_handler);
|
||||
quill::Logger* logger = fourdst::logging::LogManager::getInstance().getLogger("log");
|
||||
logger->set_log_level(quill::LogLevel::TraceL2);
|
||||
logger->set_log_level(quill::LogLevel::TraceL1);
|
||||
LOG_DEBUG(logger, "Starting Adaptive Engine View Example...");
|
||||
|
||||
using namespace gridfire;
|
||||
const std::vector<double> comp = {0.708, 0.0, 2.94e-5, 0.276, 0.003, 0.0011, 9.62e-3, 1.62e-3, 5.16e-4};
|
||||
const std::vector<std::string> symbols = {"H-1", "H-2", "He-3", "He-4", "C-12", "N-14", "O-16", "Ne-20", "Mg-24"};
|
||||
|
||||
|
||||
fourdst::composition::Composition composition;
|
||||
composition.registerSymbol(symbols, true);
|
||||
composition.setMassFraction(symbols, comp);
|
||||
composition.finalize(true);
|
||||
using partition::BasePartitionType;
|
||||
const auto partitionFunction = partition::CompositePartitionFunction({
|
||||
BasePartitionType::RauscherThielemann,
|
||||
BasePartitionType::GroundState
|
||||
});
|
||||
GraphEngine ReaclibEngine(composition, partitionFunction);
|
||||
|
||||
|
||||
|
||||
NetIn netIn;
|
||||
@@ -77,38 +87,30 @@ int main() {
|
||||
netIn.density = 1e2;
|
||||
netIn.energy = 0.0;
|
||||
|
||||
netIn.tMax = 3.1536e17;
|
||||
netIn.tMax = 1; // 1 year in seconds
|
||||
netIn.dt0 = 1e12;
|
||||
|
||||
NetOut netOut;
|
||||
|
||||
// netIn.dt0 = 1e12;
|
||||
// approx8::Approx8Network approx8Network;
|
||||
// measure_execution_time([&]() {
|
||||
// netOut = approx8Network.evaluate(netIn);
|
||||
// }, "Approx8 Network Initialization");
|
||||
// std::cout << "Approx8 Network H-1: " << netOut.composition.getMassFraction("H-1") << " in " << netOut.num_steps << " steps." << std::endl;
|
||||
|
||||
using partition::BasePartitionType;
|
||||
const auto partitionFunction = partition::CompositePartitionFunction({
|
||||
BasePartitionType::RauscherThielemann,
|
||||
BasePartitionType::GroundState
|
||||
});
|
||||
std::cout << "Partition Function for Mg-24: " << partitionFunction.evaluate(12, 24, 8) << std::endl;
|
||||
std::cout << "Partition Function for F-23: " << partitionFunction.evaluate(9, 23, 8) << std::endl;
|
||||
std::cout << "Partition Function for O-13: " << partitionFunction.evaluate(8, 13, 8) << std::endl;
|
||||
|
||||
netIn.dt0 = 1e-15;
|
||||
|
||||
GraphEngine ReaclibEngine(composition, partitionFunction);
|
||||
std::cout << ReaclibEngine.getPartitionFunction().type() << std::endl;
|
||||
const auto primedComposition = primeNetwork(netIn, ReaclibEngine);
|
||||
netIn.composition = primedComposition;
|
||||
netIn.composition.finalize(true);
|
||||
MultiscalePartitioningEngineView multiscaleEngine(ReaclibEngine);
|
||||
multiscaleEngine.equilibrateNetwork(netIn, 1e12);
|
||||
|
||||
|
||||
// // std::cout << ReaclibEngine.getPartitionFunction().type() << std::endl;
|
||||
// ReaclibEngine.setPrecomputation(true);
|
||||
// // AdaptiveEngineView adaptiveEngine(ReaclibEngine);
|
||||
// ReaclibEngine.setUseReverseReactions(false);
|
||||
// // // AdaptiveEngineView adaptiveEngine(ReaclibEngine);
|
||||
// io::SimpleReactionListFileParser parser{};
|
||||
// FileDefinedEngineView approx8EngineView(ReaclibEngine, "approx8.net", parser);
|
||||
// approx8EngineView.setScreeningModel(screening::ScreeningType::WEAK);
|
||||
// solver::QSENetworkSolver solver(approx8EngineView);
|
||||
// solver::DirectNetworkSolver solver(approx8EngineView);
|
||||
// netOut = solver.evaluate(netIn);
|
||||
// std::cout << netOut.composition << std::endl;
|
||||
|
||||
|
||||
// measure_execution_time([&]() {
|
||||
// netOut = solver.evaluate(netIn);
|
||||
|
||||
Reference in New Issue
Block a user