diff --git a/.gitignore b/.gitignore index dc8bc042..18a83eff 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,6 @@ build/ *.out # Doxygen -html/ latex/ xml/ man/ diff --git a/docs/html/annotated.html b/docs/html/annotated.html index 630452a1..c831d6ce 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -110,37 +110,47 @@ $(function(){initNavTree('annotated.html',''); initResizable(true); });  CApprox8NetworkClass for the Approx8 nuclear reaction network  CJacobianFunctor to calculate the Jacobian matrix for implicit solvers  CODEFunctor to calculate the derivatives for the ODE solver - Nreaclib - CReactionRecord - Nreaction - CLogicalReactionRepresents a "logical" reaction that aggregates rates from multiple sources - CLogicalReactionSetA collection of LogicalReaction objects - CRateCoefficientSetHolds the seven coefficients for the REACLIB rate equation - CReactionRepresents a single nuclear reaction from a specific data source - CReactionSetA collection of Reaction objects - Nsolver - CDirectNetworkSolverA network solver that directly integrates the reaction network ODEs - CJacobianFunctorFunctor for calculating the Jacobian matrix - CRHSFunctorFunctor for calculating the right-hand side of the ODEs - CdynamicQSESpeciesIndicesStructure to hold indices of dynamic and QSE species - CNetworkSolverStrategyAbstract base class for network solver strategies - CQSENetworkSolverA network solver that uses a Quasi-Steady-State Equilibrium (QSE) approach - CEigenFunctorFunctor for calculating the residual and Jacobian for the QSE species using Eigen - CJacobianFunctorFunctor for calculating the Jacobian matrix of the ODEs for the dynamic species - CRHSFunctorFunctor for calculating the right-hand side of the ODEs for the dynamic species - CAdaptiveEngineViewAn engine view that dynamically adapts the reaction network based on runtime conditions - CReactionFlowA struct to hold a reaction and its flow rate - CDynamicEngineAbstract class for engines supporting Jacobian and stoichiometry operations - CEngineAbstract base class for a reaction network engine - CEngineViewAbstract base class for a "view" of a reaction network engine - CGraphEngineA reaction network engine that uses a graph-based representation - CNetIn - CNetOut - CNetwork - CStepDerivativesStructure holding derivatives and energy generation for a network step - NstdSTL namespace - Chash< gridfire::reaction::Reaction > - Chash< gridfire::reaction::ReactionSet > + Nio + CMESANetworkFileParser + CNetworkFileParser + CParsedNetworkData + CSimpleReactionListFileParser + Nreaclib + CReactionRecord + Nreaction + CLogicalReactionRepresents a "logical" reaction that aggregates rates from multiple sources + CRateCoefficientSetHolds the seven coefficients for the REACLIB rate equation + CReactionRepresents a single nuclear reaction from a specific data source + CTemplatedReactionSet + Nscreening + CBareScreeningModel + CScreeningModel + CWeakScreeningModel + Nsolver + CDirectNetworkSolverA network solver that directly integrates the reaction network ODEs + CJacobianFunctorFunctor for calculating the Jacobian matrix + CRHSFunctorFunctor for calculating the right-hand side of the ODEs + CdynamicQSESpeciesIndicesStructure to hold indices of dynamic and QSE species + CNetworkSolverStrategyAbstract base class for network solver strategies + CQSENetworkSolverA network solver that uses a Quasi-Steady-State Equilibrium (QSE) approach + CEigenFunctorFunctor for calculating the residual and Jacobian for the QSE species using Eigen + CJacobianFunctorFunctor for calculating the Jacobian matrix of the ODEs for the dynamic species + CRHSFunctorFunctor for calculating the right-hand side of the ODEs for the dynamic species + CAdaptiveEngineViewAn engine view that dynamically adapts the reaction network based on runtime conditions + CReactionFlowA struct to hold a reaction and its flow rate + CDynamicEngineAbstract class for engines supporting Jacobian and stoichiometry operations + CEngineAbstract base class for a reaction network engine + CEngineViewAbstract base class for a "view" of a reaction network engine + CFileDefinedEngineView + CGraphEngineA reaction network engine that uses a graph-based representation + CNetIn + CNetOut + CNetwork + CStepDerivativesStructure holding derivatives and energy generation for a network step + NstdSTL namespace + Chash< gridfire::reaction::LogicalReactionSet > + Chash< gridfire::reaction::Reaction > + Chash< gridfire::reaction::ReactionSet > diff --git a/docs/html/annotated_dup.js b/docs/html/annotated_dup.js index 4880ffb8..ab311020 100644 --- a/docs/html/annotated_dup.js +++ b/docs/html/annotated_dup.js @@ -7,15 +7,25 @@ var annotated_dup = [ "Jacobian", "structgridfire_1_1approx8_1_1_jacobian.html", "structgridfire_1_1approx8_1_1_jacobian" ], [ "ODE", "structgridfire_1_1approx8_1_1_o_d_e.html", "structgridfire_1_1approx8_1_1_o_d_e" ] ] ], + [ "io", "namespacegridfire_1_1io.html", [ + [ "MESANetworkFileParser", "classgridfire_1_1io_1_1_m_e_s_a_network_file_parser.html", "classgridfire_1_1io_1_1_m_e_s_a_network_file_parser" ], + [ "NetworkFileParser", "classgridfire_1_1io_1_1_network_file_parser.html", "classgridfire_1_1io_1_1_network_file_parser" ], + [ "ParsedNetworkData", "structgridfire_1_1io_1_1_parsed_network_data.html", "structgridfire_1_1io_1_1_parsed_network_data" ], + [ "SimpleReactionListFileParser", "classgridfire_1_1io_1_1_simple_reaction_list_file_parser.html", "classgridfire_1_1io_1_1_simple_reaction_list_file_parser" ] + ] ], [ "reaclib", "namespacegridfire_1_1reaclib.html", [ [ "ReactionRecord", "structgridfire_1_1reaclib_1_1_reaction_record.html", "structgridfire_1_1reaclib_1_1_reaction_record" ] ] ], [ "reaction", "namespacegridfire_1_1reaction.html", [ [ "LogicalReaction", "classgridfire_1_1reaction_1_1_logical_reaction.html", "classgridfire_1_1reaction_1_1_logical_reaction" ], - [ "LogicalReactionSet", "classgridfire_1_1reaction_1_1_logical_reaction_set.html", "classgridfire_1_1reaction_1_1_logical_reaction_set" ], [ "RateCoefficientSet", "structgridfire_1_1reaction_1_1_rate_coefficient_set.html", "structgridfire_1_1reaction_1_1_rate_coefficient_set" ], [ "Reaction", "classgridfire_1_1reaction_1_1_reaction.html", "classgridfire_1_1reaction_1_1_reaction" ], - [ "ReactionSet", "classgridfire_1_1reaction_1_1_reaction_set.html", "classgridfire_1_1reaction_1_1_reaction_set" ] + [ "TemplatedReactionSet", "classgridfire_1_1reaction_1_1_templated_reaction_set.html", "classgridfire_1_1reaction_1_1_templated_reaction_set" ] + ] ], + [ "screening", "namespacegridfire_1_1screening.html", [ + [ "BareScreeningModel", "classgridfire_1_1screening_1_1_bare_screening_model.html", "classgridfire_1_1screening_1_1_bare_screening_model" ], + [ "ScreeningModel", "classgridfire_1_1screening_1_1_screening_model.html", "classgridfire_1_1screening_1_1_screening_model" ], + [ "WeakScreeningModel", "classgridfire_1_1screening_1_1_weak_screening_model.html", "classgridfire_1_1screening_1_1_weak_screening_model" ] ] ], [ "solver", "namespacegridfire_1_1solver.html", [ [ "DirectNetworkSolver", "classgridfire_1_1solver_1_1_direct_network_solver.html", "classgridfire_1_1solver_1_1_direct_network_solver" ], @@ -27,6 +37,7 @@ var annotated_dup = [ "DynamicEngine", "classgridfire_1_1_dynamic_engine.html", "classgridfire_1_1_dynamic_engine" ], [ "Engine", "classgridfire_1_1_engine.html", "classgridfire_1_1_engine" ], [ "EngineView", "classgridfire_1_1_engine_view.html", "classgridfire_1_1_engine_view" ], + [ "FileDefinedEngineView", "classgridfire_1_1_file_defined_engine_view.html", "classgridfire_1_1_file_defined_engine_view" ], [ "GraphEngine", "classgridfire_1_1_graph_engine.html", "classgridfire_1_1_graph_engine" ], [ "NetIn", "structgridfire_1_1_net_in.html", "structgridfire_1_1_net_in" ], [ "NetOut", "structgridfire_1_1_net_out.html", "structgridfire_1_1_net_out" ], @@ -34,6 +45,7 @@ var annotated_dup = [ "StepDerivatives", "structgridfire_1_1_step_derivatives.html", "structgridfire_1_1_step_derivatives" ] ] ], [ "std", "namespacestd.html", [ + [ "hash< gridfire::reaction::LogicalReactionSet >", "structstd_1_1hash_3_01gridfire_1_1reaction_1_1_logical_reaction_set_01_4.html", "structstd_1_1hash_3_01gridfire_1_1reaction_1_1_logical_reaction_set_01_4" ], [ "hash< gridfire::reaction::Reaction >", "structstd_1_1hash_3_01gridfire_1_1reaction_1_1_reaction_01_4.html", "structstd_1_1hash_3_01gridfire_1_1reaction_1_1_reaction_01_4" ], [ "hash< gridfire::reaction::ReactionSet >", "structstd_1_1hash_3_01gridfire_1_1reaction_1_1_reaction_set_01_4.html", "structstd_1_1hash_3_01gridfire_1_1reaction_1_1_reaction_set_01_4" ] ] ] diff --git a/docs/html/classes.html b/docs/html/classes.html index 80da70d3..2758ec18 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -102,44 +102,62 @@ $(function(){initNavTree('classes.html',''); initResizable(true); });
Class Index
-
A | D | E | G | H | J | L | N | O | Q | R | S
+
A | B | D | E | F | G | H | J | L | M | N | O | P | Q | R | S | T | W
A
AdaptiveEngineView (gridfire)
Approx8Net (gridfire::approx8)
Approx8Network (gridfire::approx8)
+
B
+
BareScreeningModel (gridfire::screening)
+
D
DirectNetworkSolver (gridfire::solver)
DynamicEngine (gridfire)
dynamicQSESpeciesIndices (gridfire::solver)
-
+
E
QSENetworkSolver::EigenFunctor (gridfire::solver)
Engine (gridfire)
EngineView (gridfire)
+
+
F
+
FileDefinedEngineView (gridfire)
G
GraphEngine (gridfire)
H
-
hash< gridfire::reaction::Reaction > (std)
hash< gridfire::reaction::ReactionSet > (std)
+
hash< gridfire::reaction::LogicalReactionSet > (std)
hash< gridfire::reaction::Reaction > (std)
hash< gridfire::reaction::ReactionSet > (std)
J
Jacobian (gridfire::approx8)
DirectNetworkSolver::JacobianFunctor (gridfire::solver)
QSENetworkSolver::JacobianFunctor (gridfire::solver)
L
-
LogicalReaction (gridfire::reaction)
LogicalReactionSet (gridfire::reaction)
+
LogicalReaction (gridfire::reaction)
-
N
-
NetIn (gridfire)
NetOut (gridfire)
Network (gridfire)
NetworkSolverStrategy (gridfire::solver)
+
M
+
MESANetworkFileParser (gridfire::io)
+
N
+
NetIn (gridfire)
NetOut (gridfire)
Network (gridfire)
NetworkFileParser (gridfire::io)
NetworkSolverStrategy (gridfire::solver)
+
O
ODE (gridfire::approx8)
+
+
P
+
ParsedNetworkData (gridfire::io)
Q
QSENetworkSolver (gridfire::solver)
R
-
RateCoefficientSet (gridfire::reaction)
Reaction (gridfire::reaction)
AdaptiveEngineView::ReactionFlow (gridfire)
ReactionRecord (gridfire::reaclib)
ReactionSet (gridfire::reaction)
DirectNetworkSolver::RHSFunctor (gridfire::solver)
QSENetworkSolver::RHSFunctor (gridfire::solver)
+
RateCoefficientSet (gridfire::reaction)
Reaction (gridfire::reaction)
AdaptiveEngineView::ReactionFlow (gridfire)
ReactionRecord (gridfire::reaclib)
DirectNetworkSolver::RHSFunctor (gridfire::solver)
QSENetworkSolver::RHSFunctor (gridfire::solver)
S
-
StepDerivatives (gridfire)
+
ScreeningModel (gridfire::screening)
SimpleReactionListFileParser (gridfire::io)
StepDerivatives (gridfire)
+
+
T
+
TemplatedReactionSet (gridfire::reaction)
+
+
W
+
WeakScreeningModel (gridfire::screening)
diff --git a/docs/html/classgridfire_1_1_adaptive_engine_view-members.html b/docs/html/classgridfire_1_1_adaptive_engine_view-members.html index 54193376..f7a50cb1 100644 --- a/docs/html/classgridfire_1_1_adaptive_engine_view-members.html +++ b/docs/html/classgridfire_1_1_adaptive_engine_view-members.html @@ -106,33 +106,39 @@ $(function(){initNavTree('classgridfire_1_1_adaptive_engine_view.html',''); init

This is the complete list of members for gridfire::AdaptiveEngineView, including all inherited members.

- - - - - + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/docs/html/classgridfire_1_1_adaptive_engine_view.html b/docs/html/classgridfire_1_1_adaptive_engine_view.html index c3949565..8fa5ce2e 100644 --- a/docs/html/classgridfire_1_1_adaptive_engine_view.html +++ b/docs/html/classgridfire_1_1_adaptive_engine_view.html @@ -137,9 +137,9 @@ Public Member Functions - - - + + + @@ -161,7 +161,7 @@ Public Member Functions - + @@ -170,6 +170,10 @@ Public Member Functions + + + + @@ -209,6 +213,14 @@ Private Member Functions + + + + + + + +
AdaptiveEngineView(DynamicEngine &baseEngine)gridfire::AdaptiveEngineViewexplicit
calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y_culled, double T9, double rho) const overridegridfire::AdaptiveEngineViewvirtual
calculateRHSAndEnergy(const std::vector< double > &Y_culled, const double T9, const double rho) const overridegridfire::AdaptiveEngineViewvirtual
Config typedefgridfire::AdaptiveEngineViewprivate
constructReactionIndexMap() constgridfire::AdaptiveEngineViewprivate
constructSpeciesIndexMap() constgridfire::AdaptiveEngineViewprivate
calculateAllReactionFlows(const NetIn &netIn, std::vector< double > &out_Y_Full) constgridfire::AdaptiveEngineViewprivate
calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y_culled, double T9, double rho) const overridegridfire::AdaptiveEngineViewvirtual
calculateRHSAndEnergy(const std::vector< double > &Y_culled, const double T9, const double rho) const overridegridfire::AdaptiveEngineViewvirtual
Config typedefgridfire::AdaptiveEngineViewprivate
constructReactionIndexMap() constgridfire::AdaptiveEngineViewprivate
constructSpeciesIndexMap() constgridfire::AdaptiveEngineViewprivate
cullReactionsByFlow(const std::vector< ReactionFlow > &allFlows, const std::unordered_set< fourdst::atomic::Species > &reachableSpecies, const std::vector< double > &Y_full, double maxFlow) constgridfire::AdaptiveEngineViewprivate
finalizeActiveSet(const std::vector< const reaction::LogicalReaction * > &finalReactions)gridfire::AdaptiveEngineViewprivate
findReachableSpecies(const NetIn &netIn) constgridfire::AdaptiveEngineViewprivate
generateJacobianMatrix(const std::vector< double > &Y_culled, const double T9, const double rho) overridegridfire::AdaptiveEngineViewvirtual
generateStoichiometryMatrix() overridegridfire::AdaptiveEngineViewvirtual
getBaseEngine() const overridegridfire::AdaptiveEngineViewinlinevirtual
getJacobianMatrixEntry(const int i_culled, const int j_culled) const overridegridfire::AdaptiveEngineViewvirtual
getNetworkReactions() const overridegridfire::AdaptiveEngineViewvirtual
getNetworkSpecies() const overridegridfire::AdaptiveEngineViewvirtual
getSpeciesTimescales(const std::vector< double > &Y_culled, double T9, double rho) const overridegridfire::AdaptiveEngineViewvirtual
getStoichiometryMatrixEntry(const int speciesIndex_culled, const int reactionIndex_culled) const overridegridfire::AdaptiveEngineViewvirtual
LogManager typedefgridfire::AdaptiveEngineViewprivate
m_activeReactionsgridfire::AdaptiveEngineViewprivate
m_activeSpeciesgridfire::AdaptiveEngineViewprivate
m_baseEnginegridfire::AdaptiveEngineViewprivate
m_configgridfire::AdaptiveEngineViewprivate
m_isStalegridfire::AdaptiveEngineViewprivate
m_loggergridfire::AdaptiveEngineViewprivate
m_reactionIndexMapgridfire::AdaptiveEngineViewprivate
m_speciesIndexMapgridfire::AdaptiveEngineViewprivate
mapCulledToFull(const std::vector< double > &culled) constgridfire::AdaptiveEngineViewprivate
mapCulledToFullReactionIndex(size_t culledReactionIndex) constgridfire::AdaptiveEngineViewprivate
mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) constgridfire::AdaptiveEngineViewprivate
mapFullToCulled(const std::vector< double > &full) constgridfire::AdaptiveEngineViewprivate
update(const NetIn &netIn)gridfire::AdaptiveEngineView
getScreeningModel() const overridegridfire::AdaptiveEngineViewvirtual
getSpeciesTimescales(const std::vector< double > &Y_culled, double T9, double rho) const overridegridfire::AdaptiveEngineViewvirtual
getStoichiometryMatrixEntry(const int speciesIndex_culled, const int reactionIndex_culled) const overridegridfire::AdaptiveEngineViewvirtual
LogManager typedefgridfire::AdaptiveEngineViewprivate
m_activeReactionsgridfire::AdaptiveEngineViewprivate
m_activeSpeciesgridfire::AdaptiveEngineViewprivate
m_baseEnginegridfire::AdaptiveEngineViewprivate
m_configgridfire::AdaptiveEngineViewprivate
m_isStalegridfire::AdaptiveEngineViewprivate
m_loggergridfire::AdaptiveEngineViewprivate
m_reactionIndexMapgridfire::AdaptiveEngineViewprivate
m_speciesIndexMapgridfire::AdaptiveEngineViewprivate
mapCulledToFull(const std::vector< double > &culled) constgridfire::AdaptiveEngineViewprivate
mapCulledToFullReactionIndex(size_t culledReactionIndex) constgridfire::AdaptiveEngineViewprivate
mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) constgridfire::AdaptiveEngineViewprivate
mapFullToCulled(const std::vector< double > &full) constgridfire::AdaptiveEngineViewprivate
setScreeningModel(screening::ScreeningType model) overridegridfire::AdaptiveEngineViewvirtual
update(const NetIn &netIn) overridegridfire::AdaptiveEngineViewvirtual
validateState() constgridfire::AdaptiveEngineViewprivate
~Engine()=defaultgridfire::Enginevirtual
~EngineView()=defaultgridfire::EngineView< DynamicEngine >virtual
 AdaptiveEngineView (DynamicEngine &baseEngine)
 Constructs an AdaptiveEngineView.
 
void update (const NetIn &netIn)
 Updates the active species and reactions based on the current conditions.
 
void update (const NetIn &netIn) override
 Updates the active species and reactions based on the current conditions.
 
const std::vector< fourdst::atomic::Species > & getNetworkSpecies () const override
 Gets the list of active species in the network.
 
double calculateMolarReactionFlow (const reaction::Reaction &reaction, const std::vector< double > &Y_culled, double T9, double rho) const override
 Calculates the molar reaction flow for a given reaction in the active network.
 
const reaction::LogicalReactionSetgetNetworkReactions () const override
const reaction::LogicalReactionSetgetNetworkReactions () const override
 Gets the set of active logical reactions in the network.
 
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales (const std::vector< double > &Y_culled, double T9, double rho) const override
const DynamicEnginegetBaseEngine () const override
 Gets the base engine.
 
void setScreeningModel (screening::ScreeningType model) override
 
screening::ScreeningType getScreeningModel () const override
 
- Public Member Functions inherited from gridfire::Engine
virtual ~Engine ()=default
 Virtual destructor.
void validateState () const
 Validates that the AdaptiveEngineView is not stale.
 
std::vector< ReactionFlowcalculateAllReactionFlows (const NetIn &netIn, std::vector< double > &out_Y_Full) const
 
std::unordered_set< fourdst::atomic::Species > findReachableSpecies (const NetIn &netIn) const
 
std::vector< const reaction::LogicalReaction * > cullReactionsByFlow (const std::vector< ReactionFlow > &allFlows, const std::unordered_set< fourdst::atomic::Species > &reachableSpecies, const std::vector< double > &Y_full, double maxFlow) const
 
void finalizeActiveSet (const std::vector< const reaction::LogicalReaction * > &finalReactions)
 
@@ -220,7 +232,7 @@ Private Attributes - + @@ -233,7 +245,7 @@ Private Attributes

An engine view that dynamically adapts the reaction network based on runtime conditions.

This class implements an EngineView that dynamically culls species and reactions from the full reaction network based on their reaction flow rates and connectivity. This allows for efficient simulation of reaction networks by focusing computational effort on the most important species and reactions.

The AdaptiveEngineView maintains a subset of "active" species and reactions, and maps between the full network indices and the active subset indices. This allows the base engine to operate on the full network data, while the AdaptiveEngineView provides a reduced view for external clients.

-

The adaptation process is driven by the update() method, which performs the following steps:

    +

    The adaptation process is driven by the update() method, which performs the following steps:

    1. Reaction Flow Calculation: Calculates the molar reaction flow rate for each reaction in the full network based on the current temperature, density, and composition.
    2. Reaction Culling: Culls reactions with flow rates below a threshold, determined by a relative culling threshold multiplied by the maximum flow rate.
    3. Connectivity Analysis: Performs a connectivity analysis to identify species that are reachable from the initial fuel species through the culled reaction network.
    4. @@ -245,9 +257,9 @@ Private Attributes
      engine_view_abstract.h
      -AdaptiveEngineView::update()
      +AdaptiveEngineView::update() -

      Definition at line 45 of file engine_adaptive.h.

      +

      Definition at line 47 of file engine_adaptive.h.

Member Typedef Documentation

◆ Config

@@ -269,7 +281,7 @@ Private Attributes

Private Attributes

 
std::vector< fourdst::atomic::Species > m_activeSpecies
 
reaction::LogicalReactionSet m_activeReactions
reaction::LogicalReactionSet m_activeReactions
 
std::vector< size_t > m_speciesIndexMap
 
-

Definition at line 226 of file engine_adaptive.h.

+

Definition at line 232 of file engine_adaptive.h.

@@ -293,7 +305,7 @@ Private Attributes
-

Definition at line 227 of file engine_adaptive.h.

+

Definition at line 233 of file engine_adaptive.h.

@@ -335,6 +347,37 @@ Private Attributes

Member Function Documentation

+ +

◆ calculateAllReactionFlows()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
std::vector< AdaptiveEngineView::ReactionFlow > gridfire::AdaptiveEngineView::calculateAllReactionFlows (const NetIn & netIn,
std::vector< double > & out_Y_Full ) const
+
+private
+
+ +

Definition at line 268 of file engine_adaptive.cpp.

+ +
+

◆ calculateMolarReactionFlow()

@@ -367,7 +410,7 @@ Private Attributes -overridevirtual +nodiscardoverridevirtual
@@ -386,7 +429,7 @@ Private Attributes

This method maps the culled abundances to the full network abundances and calls the base engine to calculate the molar reaction flow.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the reaction is not part of the active reactions in the adaptive engine view.
@@ -394,7 +437,7 @@ Private Attributes

Implements gridfire::DynamicEngine.

-

Definition at line 278 of file engine_adaptive.cpp.

+

Definition at line 175 of file engine_adaptive.cpp.

@@ -425,7 +468,7 @@ Private Attributes -overridevirtual +nodiscardoverridevirtual
@@ -443,15 +486,15 @@ Private Attributes

This method maps the culled abundances to the full network abundances, calls the base engine to calculate the RHS and energy generation, and then maps the full network derivatives back to the culled derivatives.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
-
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()

Implements gridfire::Engine.

-

Definition at line 223 of file engine_adaptive.cpp.

+

Definition at line 120 of file engine_adaptive.cpp.

@@ -473,7 +516,7 @@ Private Attributes -private +nodiscardprivate
@@ -481,7 +524,7 @@ Private Attributes

Constructs the reaction index map.

Returns
A vector mapping culled reaction indices to full reaction indices.

This method creates a map from the indices of the active reactions to the indices of the corresponding reactions in the full network.

-
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()

Definition at line 53 of file engine_adaptive.cpp.

@@ -505,7 +548,7 @@ Private Attributes -private +nodiscardprivate
@@ -513,10 +556,105 @@ Private Attributes

Constructs the species index map.

Returns
A vector mapping culled species indices to full species indices.

This method creates a map from the indices of the active species to the indices of the corresponding species in the full network.

-
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()

Definition at line 24 of file engine_adaptive.cpp.

+
+ + +

◆ cullReactionsByFlow()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
std::vector< const reaction::LogicalReaction * > gridfire::AdaptiveEngineView::cullReactionsByFlow (const std::vector< ReactionFlow > & allFlows,
const std::unordered_set< fourdst::atomic::Species > & reachableSpecies,
const std::vector< double > & Y_full,
double maxFlow ) const
+
+nodiscardprivate
+
+ +

Definition at line 342 of file engine_adaptive.cpp.

+ +
+
+ +

◆ finalizeActiveSet()

+ +
+
+ + + + + +
+ + + + + + + +
void gridfire::AdaptiveEngineView::finalizeActiveSet (const std::vector< const reaction::LogicalReaction * > & finalReactions)
+
+private
+
+ +

Definition at line 385 of file engine_adaptive.cpp.

+ +
+
+ +

◆ findReachableSpecies()

+ +
+
+ + + + + +
+ + + + + + + +
std::unordered_set< Species > gridfire::AdaptiveEngineView::findReachableSpecies (const NetIn & netIn) const
+
+nodiscardprivate
+
+ +

Definition at line 299 of file engine_adaptive.cpp.

+
@@ -563,15 +701,15 @@ Private Attributes

This method maps the culled abundances to the full network abundances and calls the base engine to generate the Jacobian matrix.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
-
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()

Implements gridfire::DynamicEngine.

-

Definition at line 241 of file engine_adaptive.cpp.

+

Definition at line 138 of file engine_adaptive.cpp.

@@ -602,7 +740,7 @@ Private Attributes

This method calls the base engine to generate the stoichiometry matrix.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
@@ -610,7 +748,7 @@ Private Attributes

Implements gridfire::DynamicEngine.

-

Definition at line 263 of file engine_adaptive.cpp.

+

Definition at line 160 of file engine_adaptive.cpp.

@@ -632,7 +770,7 @@ Private Attributes -inlineoverridevirtual +inlinenodiscardoverridevirtual
@@ -642,7 +780,7 @@ Private Attributes

Implements gridfire::EngineView< DynamicEngine >.

-

Definition at line 224 of file engine_adaptive.h.

+

Definition at line 226 of file engine_adaptive.h.

@@ -668,7 +806,7 @@ Private Attributes -overridevirtual +nodiscardoverridevirtual
@@ -685,16 +823,16 @@ Private Attributes

This method maps the culled indices to the full network indices and calls the base engine to get the Jacobian matrix entry.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::out_of_rangeIf the culled index is out of bounds for the species index map.
-
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()

Implements gridfire::DynamicEngine.

-

Definition at line 252 of file engine_adaptive.cpp.

+

Definition at line 149 of file engine_adaptive.cpp.

@@ -708,7 +846,7 @@ Private Attributes - + @@ -716,7 +854,7 @@ Private Attributes
const reaction::LogicalReactionSet & gridfire::AdaptiveEngineView::getNetworkReactions const reaction::LogicalReactionSet & gridfire::AdaptiveEngineView::getNetworkReactions ( ) const
-overridevirtual +nodiscardoverridevirtual
@@ -726,7 +864,7 @@ Private Attributes

Implements gridfire::DynamicEngine.

-

Definition at line 295 of file engine_adaptive.cpp.

+

Definition at line 192 of file engine_adaptive.cpp.

@@ -748,7 +886,7 @@ Private Attributes -overridevirtual +nodiscardoverridevirtual
@@ -758,7 +896,36 @@ Private Attributes

Implements gridfire::Engine.

-

Definition at line 219 of file engine_adaptive.cpp.

+

Definition at line 116 of file engine_adaptive.cpp.

+ +
+ + +

◆ getScreeningModel()

+ +
+
+ + + + + +
+ + + + + + + +
screening::ScreeningType gridfire::AdaptiveEngineView::getScreeningModel () const
+
+nodiscardoverridevirtual
+
+ +

Implements gridfire::DynamicEngine.

+ +

Definition at line 220 of file engine_adaptive.cpp.

@@ -789,7 +956,7 @@ Private Attributes -overridevirtual +nodiscardoverridevirtual
@@ -807,14 +974,14 @@ Private Attributes

This method maps the culled abundances to the full network abundances and calls the base engine to compute the species timescales.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).

Implements gridfire::DynamicEngine.

-

Definition at line 299 of file engine_adaptive.cpp.

+

Definition at line 196 of file engine_adaptive.cpp.

@@ -840,7 +1007,7 @@ Private Attributes -overridevirtual +nodiscardoverridevirtual
@@ -857,16 +1024,16 @@ Private Attributes

This method maps the culled indices to the full network indices and calls the base engine to get the stoichiometry matrix entry.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::out_of_rangeIf the culled index is out of bounds for the species or reaction index map.
-
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()

Implements gridfire::DynamicEngine.

-

Definition at line 268 of file engine_adaptive.cpp.

+

Definition at line 165 of file engine_adaptive.cpp.

@@ -888,7 +1055,7 @@ Private Attributes -private +nodiscardprivate
@@ -902,7 +1069,7 @@ Private Attributes
Returns
A vector of abundances for the full network, with the abundances of the active species copied from the culled vector.
-

Definition at line 319 of file engine_adaptive.cpp.

+

Definition at line 224 of file engine_adaptive.cpp.

@@ -924,7 +1091,7 @@ Private Attributes -private +nodiscardprivate
@@ -944,7 +1111,7 @@ Private Attributes -

Definition at line 346 of file engine_adaptive.cpp.

+

Definition at line 251 of file engine_adaptive.cpp.

@@ -966,7 +1133,7 @@ Private Attributes -private +nodiscardprivate
@@ -986,7 +1153,7 @@ Private Attributes -

Definition at line 337 of file engine_adaptive.cpp.

+

Definition at line 242 of file engine_adaptive.cpp.

@@ -1008,7 +1175,7 @@ Private Attributes -private +nodiscardprivate
@@ -1022,15 +1189,47 @@ Private Attributes
Returns
A vector of abundances for the active species, with the abundances of the active species copied from the full vector.
-

Definition at line 328 of file engine_adaptive.cpp.

+

Definition at line 233 of file engine_adaptive.cpp.

- -

◆ update()

+ +

◆ setScreeningModel()

+ + + + + +
+ + + + + + + +
void gridfire::AdaptiveEngineView::setScreeningModel (screening::ScreeningType model)
+
+overridevirtual
+
+ +

Implements gridfire::DynamicEngine.

+ +

Definition at line 216 of file engine_adaptive.cpp.

+ +
+
+ +

◆ update()

+ +
+
+ + + + + +
@@ -1039,6 +1238,11 @@ Private Attributes
void gridfire::AdaptiveEngineView::update
+
+overridevirtual

Updates the active species and reactions based on the current conditions.

@@ -1065,6 +1269,8 @@ Private Attributes
AdaptiveEngineView::constructReactionIndexMap()
+

Implements gridfire::DynamicEngine.

+

Definition at line 85 of file engine_adaptive.cpp.

@@ -1095,12 +1301,12 @@ Private Attributes

Validates that the AdaptiveEngineView is not stale.

Exceptions
- +
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
std::runtime_errorIf the AdaptiveEngineView is stale (i.e., update() has not been called).
-

Definition at line 355 of file engine_adaptive.cpp.

+

Definition at line 260 of file engine_adaptive.cpp.

@@ -1115,7 +1321,7 @@ Private Attributes - +
reaction::LogicalReactionSet gridfire::AdaptiveEngineView::m_activeReactionsreaction::LogicalReactionSet gridfire::AdaptiveEngineView::m_activeReactions
@@ -1125,7 +1331,7 @@ Private Attributes
-

Definition at line 234 of file engine_adaptive.h.

+

Definition at line 240 of file engine_adaptive.h.

@@ -1149,7 +1355,7 @@ Private Attributes
-

Definition at line 233 of file engine_adaptive.h.

+

Definition at line 239 of file engine_adaptive.h.

@@ -1173,7 +1379,7 @@ Private Attributes
-

Definition at line 231 of file engine_adaptive.h.

+

Definition at line 237 of file engine_adaptive.h.

@@ -1197,7 +1403,7 @@ Private Attributes
-

Definition at line 228 of file engine_adaptive.h.

+

Definition at line 234 of file engine_adaptive.h.

@@ -1221,7 +1427,7 @@ Private Attributes
-

Definition at line 239 of file engine_adaptive.h.

+

Definition at line 245 of file engine_adaptive.h.

@@ -1245,7 +1451,7 @@ Private Attributes
-

Definition at line 229 of file engine_adaptive.h.

+

Definition at line 235 of file engine_adaptive.h.

@@ -1269,7 +1475,7 @@ Private Attributes
-

Definition at line 237 of file engine_adaptive.h.

+

Definition at line 243 of file engine_adaptive.h.

@@ -1293,13 +1499,13 @@ Private Attributes
-

Definition at line 236 of file engine_adaptive.h.

+

Definition at line 242 of file engine_adaptive.h.


The documentation for this class was generated from the following files: diff --git a/docs/html/classgridfire_1_1_adaptive_engine_view.js b/docs/html/classgridfire_1_1_adaptive_engine_view.js index 5d48e9ac..665cba33 100644 --- a/docs/html/classgridfire_1_1_adaptive_engine_view.js +++ b/docs/html/classgridfire_1_1_adaptive_engine_view.js @@ -4,23 +4,29 @@ var classgridfire_1_1_adaptive_engine_view = [ "Config", "classgridfire_1_1_adaptive_engine_view.html#afec39b2faa34ea65c5488dd8e11ba3c3", null ], [ "LogManager", "classgridfire_1_1_adaptive_engine_view.html#a5eaf7c3a4e28cd3a4f34979b88a80103", null ], [ "AdaptiveEngineView", "classgridfire_1_1_adaptive_engine_view.html#ad599363cdd457e72e2e2937b0222c455", null ], + [ "calculateAllReactionFlows", "classgridfire_1_1_adaptive_engine_view.html#abdbaf4b87629efe43ac1255dad424c0c", null ], [ "calculateMolarReactionFlow", "classgridfire_1_1_adaptive_engine_view.html#a048d4b1d41ecb4125a558d1b9ed7cb31", null ], [ "calculateRHSAndEnergy", "classgridfire_1_1_adaptive_engine_view.html#a7b276b7210be588263395bdb0497fc6d", null ], [ "constructReactionIndexMap", "classgridfire_1_1_adaptive_engine_view.html#a89614f4a48f60c4170a0197f45303e7c", null ], [ "constructSpeciesIndexMap", "classgridfire_1_1_adaptive_engine_view.html#a896d29325b4233e83d9298850b617a2d", null ], + [ "cullReactionsByFlow", "classgridfire_1_1_adaptive_engine_view.html#a42417e96fe9fd623458af109401daf08", null ], + [ "finalizeActiveSet", "classgridfire_1_1_adaptive_engine_view.html#aa79fb382c98461b02a2c30668491e6c5", null ], + [ "findReachableSpecies", "classgridfire_1_1_adaptive_engine_view.html#a0ed21f7e7c1034fc87b40d4116c4221b", null ], [ "generateJacobianMatrix", "classgridfire_1_1_adaptive_engine_view.html#ac9aab6f60e80a9228b2b19b1b10449ef", null ], [ "generateStoichiometryMatrix", "classgridfire_1_1_adaptive_engine_view.html#a231193a61ba5a31e8eb92b0d4ce69111", null ], [ "getBaseEngine", "classgridfire_1_1_adaptive_engine_view.html#aee095b30a9dce5fcb5ae2fa1d2aa192c", null ], [ "getJacobianMatrixEntry", "classgridfire_1_1_adaptive_engine_view.html#a4710d218c8a0fd161e994ecd60b48e58", null ], [ "getNetworkReactions", "classgridfire_1_1_adaptive_engine_view.html#a12cc2f352678fba9688363ba1876ab9c", null ], [ "getNetworkSpecies", "classgridfire_1_1_adaptive_engine_view.html#ac83a8efe25c0e5b9bf7756ac3a500bb1", null ], + [ "getScreeningModel", "classgridfire_1_1_adaptive_engine_view.html#a0ab1199f900a58f309c3c36532c9164f", null ], [ "getSpeciesTimescales", "classgridfire_1_1_adaptive_engine_view.html#a93b38d0fdc4647f6f7340172dae17872", null ], [ "getStoichiometryMatrixEntry", "classgridfire_1_1_adaptive_engine_view.html#a67b4ea8cad115394bb4a42cc39d696f9", null ], [ "mapCulledToFull", "classgridfire_1_1_adaptive_engine_view.html#a68695f056b660e91285b7e5a931612e1", null ], [ "mapCulledToFullReactionIndex", "classgridfire_1_1_adaptive_engine_view.html#a91e742642d8a8d9ec0620779927e5101", null ], [ "mapCulledToFullSpeciesIndex", "classgridfire_1_1_adaptive_engine_view.html#a256d14a333f9401039b826cc889761a8", null ], [ "mapFullToCulled", "classgridfire_1_1_adaptive_engine_view.html#a3d9d8e862d1c2f0a8ba460c57f6a7f44", null ], - [ "update", "classgridfire_1_1_adaptive_engine_view.html#a44c4fb7568ddbb20a08f328c2fbf1fdf", null ], + [ "setScreeningModel", "classgridfire_1_1_adaptive_engine_view.html#aae4ddbef1c4e2202fd236221a4bf376b", null ], + [ "update", "classgridfire_1_1_adaptive_engine_view.html#a7d61e73f5158f1574cda3edc90c51f7e", null ], [ "validateState", "classgridfire_1_1_adaptive_engine_view.html#aedc0dedb51c81e03f253cc409a5d5c40", null ], [ "m_activeReactions", "classgridfire_1_1_adaptive_engine_view.html#a19fc7e02e216b797aa643fa35e429800", null ], [ "m_activeSpecies", "classgridfire_1_1_adaptive_engine_view.html#af4bc9fc6e4afcd6a53c49ca6e2a95940", null ], diff --git a/docs/html/classgridfire_1_1_dynamic_engine-members.html b/docs/html/classgridfire_1_1_dynamic_engine-members.html index 0595ad44..9ee89443 100644 --- a/docs/html/classgridfire_1_1_dynamic_engine-members.html +++ b/docs/html/classgridfire_1_1_dynamic_engine-members.html @@ -112,9 +112,12 @@ $(function(){initNavTree('classgridfire_1_1_dynamic_engine.html',''); initResiza getJacobianMatrixEntry(int i, int j) const =0gridfire::DynamicEnginepure virtual getNetworkReactions() const =0gridfire::DynamicEnginepure virtual getNetworkSpecies() const =0gridfire::Enginepure virtual - getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const =0gridfire::DynamicEnginepure virtual - getStoichiometryMatrixEntry(int speciesIndex, int reactionIndex) const =0gridfire::DynamicEnginepure virtual - ~Engine()=defaultgridfire::Enginevirtual + getScreeningModel() const =0gridfire::DynamicEnginepure virtual + getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const =0gridfire::DynamicEnginepure virtual + getStoichiometryMatrixEntry(int speciesIndex, int reactionIndex) const =0gridfire::DynamicEnginepure virtual + setScreeningModel(screening::ScreeningType model)=0gridfire::DynamicEnginepure virtual + update(const NetIn &netIn)=0gridfire::DynamicEnginepure virtual + ~Engine()=defaultgridfire::Enginevirtual diff --git a/docs/html/classgridfire_1_1_dynamic_engine.html b/docs/html/classgridfire_1_1_dynamic_engine.html index 0028313b..7735e60f 100644 --- a/docs/html/classgridfire_1_1_dynamic_engine.html +++ b/docs/html/classgridfire_1_1_dynamic_engine.html @@ -116,9 +116,10 @@ Inheritance diagram for gridfire::DynamicEngine:
-gridfire::Engine -gridfire::AdaptiveEngineView -gridfire::GraphEngine +gridfire::Engine +gridfire::AdaptiveEngineView +gridfire::FileDefinedEngineView +gridfire::GraphEngine
@@ -139,12 +140,18 @@ Public Member Functions - + + + + + + + @@ -167,7 +174,7 @@ Public Member Functions

Intended usage: Derive from this class to implement engines that support advanced solver features such as implicit integration, sensitivity analysis, QSE (Quasi-Steady-State Equilibrium) handling, and more.

-

Definition at line 118 of file engine_abstract.h.

+

Definition at line 121 of file engine_abstract.h.

Member Function Documentation

◆ calculateMolarReactionFlow()

@@ -201,7 +208,7 @@ Public Member Functions
virtual double calculateMolarReactionFlow (const reaction::Reaction &reaction, const std::vector< double > &Y, double T9, double rho) const =0
 Calculate the molar reaction flow for a given reaction.
 
virtual const reaction::LogicalReactionSetgetNetworkReactions () const =0
virtual const reaction::LogicalReactionSetgetNetworkReactions () const =0
 Get the set of logical reactions in the network.
 
virtual std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales (const std::vector< double > &Y, double T9, double rho) const =0
 Compute timescales for all species in the network.
 
virtual void update (const NetIn &netIn)=0
 
virtual void setScreeningModel (screening::ScreeningType model)=0
 
virtual screening::ScreeningType getScreeningModel () const =0
 
- Public Member Functions inherited from gridfire::Engine
virtual ~Engine ()=default
 Virtual destructor.
-pure virtual +nodiscardpure virtual
@@ -219,7 +226,7 @@ Public Member Functions
Returns
Molar flow rate for the reaction (e.g., mol/g/s).

This method computes the net rate at which the given reaction proceeds under the current state.

-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

@@ -266,7 +273,7 @@ Public Member Functions

This method must compute and store the Jacobian matrix (∂(dY/dt)_i/∂Y_j) for the current state. The matrix can then be accessed via getJacobianMatrixEntry().

-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

@@ -296,7 +303,7 @@ Public Member Functions

Generate the stoichiometry matrix for the network.

This method must compute and store the stoichiometry matrix, which encodes the net change of each species in each reaction.

-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

@@ -322,7 +329,7 @@ Public Member Functions -pure virtual +nodiscardpure virtual
@@ -338,7 +345,7 @@ Public Member Functions
Returns
Value of the Jacobian matrix at (i, j).

The Jacobian must have been generated by generateJacobianMatrix() before calling this.

-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

@@ -352,7 +359,7 @@ Public Member Functions - + @@ -360,7 +367,7 @@ Public Member Functions
virtual const reaction::LogicalReactionSet & gridfire::DynamicEngine::getNetworkReactions virtual const reaction::LogicalReactionSet & gridfire::DynamicEngine::getNetworkReactions ( ) const
-pure virtual +nodiscardpure virtual
@@ -368,7 +375,34 @@ Public Member Functions

Get the set of logical reactions in the network.

Returns
Reference to the LogicalReactionSet containing all reactions.
-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

+ +
+ + +

◆ getScreeningModel()

+ +
+
+ + + + + +
+ + + + + + + +
virtual screening::ScreeningType gridfire::DynamicEngine::getScreeningModel () const
+
+nodiscardpure virtual
+
+ +

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

@@ -399,7 +433,7 @@ Public Member Functions -pure virtual +nodiscardpure virtual
@@ -416,7 +450,7 @@ Public Member Functions
Returns
Map from Species to their characteristic timescales (s).

This method estimates the timescale for abundance change of each species, which can be used for timestep control, diagnostics, and reaction network culling.

-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

@@ -442,7 +476,7 @@ Public Member Functions -pure virtual +nodiscardpure virtual
@@ -458,7 +492,61 @@ Public Member Functions
Returns
Stoichiometric coefficient for the species in the reaction.

The stoichiometry matrix must have been generated by generateStoichiometryMatrix().

-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

+ +
+ + +

◆ setScreeningModel()

+ +
+
+ + + + + +
+ + + + + + + +
virtual void gridfire::DynamicEngine::setScreeningModel (screening::ScreeningType model)
+
+pure virtual
+
+ +

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

+ +
+
+ +

◆ update()

+ +
+
+ + + + + +
+ + + + + + + +
virtual void gridfire::DynamicEngine::update (const NetIn & netIn)
+
+pure virtual
+
+ +

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

diff --git a/docs/html/classgridfire_1_1_dynamic_engine.js b/docs/html/classgridfire_1_1_dynamic_engine.js index ef5fade2..f5f5c6be 100644 --- a/docs/html/classgridfire_1_1_dynamic_engine.js +++ b/docs/html/classgridfire_1_1_dynamic_engine.js @@ -5,6 +5,9 @@ var classgridfire_1_1_dynamic_engine = [ "generateStoichiometryMatrix", "classgridfire_1_1_dynamic_engine.html#aeae6d84ef74d88fd2cdf07b82e98a16f", null ], [ "getJacobianMatrixEntry", "classgridfire_1_1_dynamic_engine.html#a05d15ff35a6bc06a2fa7eda19838bd07", null ], [ "getNetworkReactions", "classgridfire_1_1_dynamic_engine.html#ad2a82099edbb374bbb2c9509ccdb1037", null ], + [ "getScreeningModel", "classgridfire_1_1_dynamic_engine.html#a7a203f8e0f3a6744ddc912dfbcfdbcc0", null ], [ "getSpeciesTimescales", "classgridfire_1_1_dynamic_engine.html#a5d8ba98b230d2849035ee2507728fa15", null ], - [ "getStoichiometryMatrixEntry", "classgridfire_1_1_dynamic_engine.html#afa108dd5227dbb1045e90d7b3bd8b84f", null ] + [ "getStoichiometryMatrixEntry", "classgridfire_1_1_dynamic_engine.html#afa108dd5227dbb1045e90d7b3bd8b84f", null ], + [ "setScreeningModel", "classgridfire_1_1_dynamic_engine.html#a3fb44b6f55563a2f590f31916528f2bd", null ], + [ "update", "classgridfire_1_1_dynamic_engine.html#acd500e1cd788df1dc105d28a20dc5f4f", null ] ]; \ No newline at end of file diff --git a/docs/html/classgridfire_1_1_dynamic_engine.png b/docs/html/classgridfire_1_1_dynamic_engine.png index 544615e1..ac05ae00 100644 Binary files a/docs/html/classgridfire_1_1_dynamic_engine.png and b/docs/html/classgridfire_1_1_dynamic_engine.png differ diff --git a/docs/html/classgridfire_1_1_engine.html b/docs/html/classgridfire_1_1_engine.html index b2578164..7ccdc6c3 100644 --- a/docs/html/classgridfire_1_1_engine.html +++ b/docs/html/classgridfire_1_1_engine.html @@ -116,9 +116,10 @@ Inheritance diagram for gridfire::Engine:
-gridfire::DynamicEngine -gridfire::AdaptiveEngineView -gridfire::GraphEngine +gridfire::DynamicEngine +gridfire::AdaptiveEngineView +gridfire::FileDefinedEngineView +gridfire::GraphEngine
@@ -141,9 +142,9 @@ Public Member Functions

Example:

class MyEngine : public gridfire::Engine {
// Implement required methods...
};
-
Abstract base class for a reaction network engine.
+
Abstract base class for a reaction network engine.
-

Definition at line 72 of file engine_abstract.h.

+

Definition at line 75 of file engine_abstract.h.

Constructor & Destructor Documentation

◆ ~Engine()

@@ -200,7 +201,7 @@ Public Member Functions
-pure virtual +nodiscardpure virtual
@@ -217,7 +218,7 @@ Public Member Functions
Returns
StepDerivatives<double> containing dY/dt and energy generation rate.

This function must be implemented by derived classes to compute the time derivatives of all species and the specific nuclear energy generation rate for the current state.

-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

@@ -239,7 +240,7 @@ Public Member Functions -pure virtual +nodiscardpure virtual
@@ -247,7 +248,7 @@ Public Member Functions

Get the list of species in the network.

Returns
Vector of Species objects representing all network species.
-

Implemented in gridfire::AdaptiveEngineView, and gridfire::GraphEngine.

+

Implemented in gridfire::AdaptiveEngineView, gridfire::FileDefinedEngineView, and gridfire::GraphEngine.

diff --git a/docs/html/classgridfire_1_1_engine.png b/docs/html/classgridfire_1_1_engine.png index 7db1ce25..d7302e72 100644 Binary files a/docs/html/classgridfire_1_1_engine.png and b/docs/html/classgridfire_1_1_engine.png differ diff --git a/docs/html/classgridfire_1_1_engine_view.html b/docs/html/classgridfire_1_1_engine_view.html index 05580e56..59ecd06a 100644 --- a/docs/html/classgridfire_1_1_engine_view.html +++ b/docs/html/classgridfire_1_1_engine_view.html @@ -139,7 +139,7 @@ class gridfire::EngineView< EngineT >

Abstract base class for a "v

private:
DynamicEngine& engine_;
};
-
gridfire::DynamicEngine
Abstract class for engines supporting Jacobian and stoichiometry operations.
Definition engine_abstract.h:118
+
gridfire::DynamicEngine
Abstract class for engines supporting Jacobian and stoichiometry operations.
Definition engine_abstract.h:121
gridfire::EngineView
Abstract base class for a "view" of a reaction network engine.
Definition engine_view_abstract.h:74
gridfire::EngineView::getBaseEngine
virtual const EngineT & getBaseEngine() const =0
Access the underlying engine instance.
See also
gridfire::AdaptiveEngineView for a concrete example of dynamic culling.
@@ -206,12 +206,12 @@ template<EngineType EngineT>

This method must be implemented by derived classes to provide access to the base engine. The returned reference should remain valid for the lifetime of the EngineView.

Example:

const DynamicEngine& engine = myView.getBaseEngine();
-

Implemented in gridfire::AdaptiveEngineView.

+

Implemented in gridfire::AdaptiveEngineView, and gridfire::FileDefinedEngineView.


The documentation for this class was generated from the following file: diff --git a/docs/html/classgridfire_1_1_graph_engine-members.html b/docs/html/classgridfire_1_1_graph_engine-members.html index 9f38dacb..06acbadd 100644 --- a/docs/html/classgridfire_1_1_graph_engine-members.html +++ b/docs/html/classgridfire_1_1_graph_engine-members.html @@ -120,30 +120,35 @@ $(function(){initNavTree('classgridfire_1_1_graph_engine.html',''); initResizabl getNetReactionStoichiometry(const reaction::Reaction &reaction)gridfire::GraphEnginestatic getNetworkReactions() const overridegridfire::GraphEnginevirtual getNetworkSpecies() const overridegridfire::GraphEnginevirtual - getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const overridegridfire::GraphEnginevirtual - getStoichiometryMatrixEntry(const int speciesIndex, const int reactionIndex) const overridegridfire::GraphEnginevirtual - GraphEngine(const fourdst::composition::Composition &composition)gridfire::GraphEngineexplicit - GraphEngine(reaction::LogicalReactionSet reactions)gridfire::GraphEngineexplicit - involvesSpecies(const fourdst::atomic::Species &species) constgridfire::GraphEngine - m_configgridfire::GraphEngineprivate - m_constantsgridfire::GraphEngineprivate - m_jacobianMatrixgridfire::GraphEngineprivate - m_loggergridfire::GraphEngineprivate - m_networkSpeciesgridfire::GraphEngineprivate - m_networkSpeciesMapgridfire::GraphEngineprivate - m_reactionIDMapgridfire::GraphEngineprivate - m_reactionsgridfire::GraphEngineprivate - m_rhsADFungridfire::GraphEngineprivate - m_speciesToIndexMapgridfire::GraphEngineprivate - m_stoichiometryMatrixgridfire::GraphEngineprivate - populateReactionIDMap()gridfire::GraphEngineprivate - populateSpeciesToIndexMap()gridfire::GraphEngineprivate - recordADTape()gridfire::GraphEngineprivate - reserveJacobianMatrix()gridfire::GraphEngineprivate + getScreeningModel() const overridegridfire::GraphEnginevirtual + getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const overridegridfire::GraphEnginevirtual + getStoichiometryMatrixEntry(const int speciesIndex, const int reactionIndex) const overridegridfire::GraphEnginevirtual + GraphEngine(const fourdst::composition::Composition &composition)gridfire::GraphEngineexplicit + GraphEngine(reaction::LogicalReactionSet reactions)gridfire::GraphEngineexplicit + involvesSpecies(const fourdst::atomic::Species &species) constgridfire::GraphEngine + m_configgridfire::GraphEngineprivate + m_constantsgridfire::GraphEngineprivate + m_jacobianMatrixgridfire::GraphEngineprivate + m_loggergridfire::GraphEngineprivate + m_networkSpeciesgridfire::GraphEngineprivate + m_networkSpeciesMapgridfire::GraphEngineprivate + m_reactionIDMapgridfire::GraphEngineprivate + m_reactionsgridfire::GraphEngineprivate + m_rhsADFungridfire::GraphEngineprivate + m_screeningModelgridfire::GraphEngineprivate + m_screeningTypegridfire::GraphEngineprivate + m_speciesToIndexMapgridfire::GraphEngineprivate + m_stoichiometryMatrixgridfire::GraphEngineprivate + populateReactionIDMap()gridfire::GraphEngineprivate + populateSpeciesToIndexMap()gridfire::GraphEngineprivate + recordADTape()gridfire::GraphEngineprivate + reserveJacobianMatrix()gridfire::GraphEngineprivate + setScreeningModel(screening::ScreeningType) overridegridfire::GraphEnginevirtual syncInternalMaps()gridfire::GraphEngineprivate - validateComposition(const fourdst::composition::Composition &composition, double culling, double T9)gridfire::GraphEngineprivate - validateConservation() constgridfire::GraphEngineprivate - ~Engine()=defaultgridfire::Enginevirtual + update(const NetIn &netIn) overridegridfire::GraphEnginevirtual + validateComposition(const fourdst::composition::Composition &composition, double culling, double T9)gridfire::GraphEngineprivate + validateConservation() constgridfire::GraphEngineprivate + ~Engine()=defaultgridfire::Enginevirtual diff --git a/docs/html/classgridfire_1_1_graph_engine.html b/docs/html/classgridfire_1_1_graph_engine.html index 94d3df50..5a23c816 100644 --- a/docs/html/classgridfire_1_1_graph_engine.html +++ b/docs/html/classgridfire_1_1_graph_engine.html @@ -129,7 +129,7 @@ Public Member Functions  GraphEngine (const fourdst::composition::Composition &composition)  Constructs a GraphEngine from a composition.
  - GraphEngine (reaction::LogicalReactionSet reactions) + GraphEngine (reaction::LogicalReactionSet reactions)  Constructs a GraphEngine from a set of reactions.
  StepDerivatives< double > calculateRHSAndEnergy (const std::vector< double > &Y, const double T9, const double rho) const override @@ -147,7 +147,7 @@ Public Member Functions const std::vector< fourdst::atomic::Species > & getNetworkSpecies () const override  Gets the list of species in the network.
  -const reaction::LogicalReactionSetgetNetworkReactions () const override +const reaction::LogicalReactionSetgetNetworkReactions () const override  Gets the set of logical reactions in the network.
  double getJacobianMatrixEntry (const int i, const int j) const override @@ -159,6 +159,8 @@ Public Member Functions std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales (const std::vector< double > &Y, double T9, double rho) const override  Computes timescales for all species in the network.
  +void update (const NetIn &netIn) override +  bool involvesSpecies (const fourdst::atomic::Species &species) const  Checks if a given species is involved in the network.
  @@ -168,6 +170,10 @@ Public Member Functions void exportToCSV (const std::string &filename) const  Exports the network to a CSV file for analysis.
  +void setScreeningModel (screening::ScreeningType) override +  +screening::ScreeningType getScreeningModel () const override +  - Public Member Functions inherited from gridfire::Engine virtual ~Engine ()=default  Virtual destructor.
@@ -222,7 +228,7 @@ Private Member Functions - + @@ -246,6 +252,11 @@ Private Attributes + + + + + @@ -268,7 +279,7 @@ Private Attributes
See also
engine_abstract.h
-

Definition at line 86 of file engine_graph.h.

+

Definition at line 89 of file engine_graph.h.

Constructor & Destructor Documentation

◆ GraphEngine() [1/2]

@@ -303,7 +314,7 @@ Private Attributes

This constructor builds the reaction network from the given composition using the build_reaclib_nuclear_network function.

See also
build_reaclib_nuclear_network
-

Definition at line 25 of file engine_graph.cpp.

+

Definition at line 26 of file engine_graph.cpp.

@@ -319,7 +330,7 @@ Private Attributes - +

Private Attributes

reaction::LogicalReactionSet m_reactions
reaction::LogicalReactionSet m_reactions
 Set of REACLIB reactions in the network.
 
std::unordered_map< std::string_view, reaction::Reaction * > m_reactionIDMap
CppAD::ADFun< double > m_rhsADFun
 CppAD function for the right-hand side of the ODE.
 
screening::ScreeningType m_screeningType = screening::ScreeningType::BARE
 Screening type for the reaction network. Default to no screening.
 
std::unique_ptr< screening::ScreeningModelm_screeningModel = screening::selectScreeningModel(m_screeningType)
 
Config & m_config = Config::getInstance()
 
Constants & m_constants = Constants::getInstance()
gridfire::GraphEngine::GraphEngine (reaction::LogicalReactionSet reactions)reaction::LogicalReactionSet reactions)
@@ -339,7 +350,7 @@ Private Attributes

This constructor uses the given set of reactions to construct the reaction network.

-

Definition at line 32 of file engine_graph.cpp.

+

Definition at line 33 of file engine_graph.cpp.

@@ -371,7 +382,7 @@ Private Attributes -private +nodiscardprivate
@@ -388,7 +399,7 @@ Private Attributes
Returns
StepDerivatives<ADDouble> containing dY/dt and energy generation rate.

This method calculates the time derivatives of all species and the specific nuclear energy generation rate for the current state using automatic differentiation.

-

Definition at line 257 of file engine_graph.cpp.

+

Definition at line 258 of file engine_graph.cpp.

@@ -419,7 +430,7 @@ Private Attributes -private +nodiscardprivate
@@ -436,7 +447,7 @@ Private Attributes
Returns
StepDerivatives<double> containing dY/dt and energy generation rate.

This method calculates the time derivatives of all species and the specific nuclear energy generation rate for the current state using double precision arithmetic.

-

Definition at line 249 of file engine_graph.cpp.

+

Definition at line 250 of file engine_graph.cpp.

@@ -469,7 +480,7 @@ template<IsArithmeticOrAD T> -private +nodiscardprivate
@@ -492,7 +503,7 @@ template<IsArithmeticOrAD T>
Returns
StepDerivatives<T> containing dY/dt and energy generation rate.

This method calculates the time derivatives of all species and the specific nuclear energy generation rate for the current state.

-

Definition at line 475 of file engine_graph.h.

+

Definition at line 487 of file engine_graph.h.

@@ -528,7 +539,7 @@ template<IsArithmeticOrAD T> -overridevirtual +nodiscardoverridevirtual
@@ -548,7 +559,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::DynamicEngine.

-

Definition at line 265 of file engine_graph.cpp.

+

Definition at line 275 of file engine_graph.cpp.

@@ -610,7 +621,7 @@ template<IsArithmeticOrAD T>
Returns
Molar flow rate for the reaction (e.g., mol/g/s).

This method computes the net rate at which the given reaction proceeds under the current state.

-

Definition at line 536 of file engine_graph.h.

+

Definition at line 555 of file engine_graph.h.

@@ -641,7 +652,7 @@ template<IsArithmeticOrAD T> -overridevirtual +nodiscardoverridevirtual
@@ -661,7 +672,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::Engine.

-

Definition at line 37 of file engine_graph.cpp.

+

Definition at line 38 of file engine_graph.cpp.

@@ -691,7 +702,7 @@ template<IsArithmeticOrAD T>

Collects the unique species in the network.

This method collects the unique species in the network from the reactants and products of all reactions.

-

Definition at line 56 of file engine_graph.cpp.

+

Definition at line 57 of file engine_graph.cpp.

@@ -726,7 +737,7 @@ template<IsArithmeticOrAD T>

Example usage:

engine.exportToCSV("network.csv");
-

Definition at line 372 of file engine_graph.cpp.

+

Definition at line 382 of file engine_graph.cpp.

@@ -761,7 +772,7 @@ template<IsArithmeticOrAD T>

Example usage:

engine.exportToDot("network.dot");
-

Definition at line 324 of file engine_graph.cpp.

+

Definition at line 334 of file engine_graph.cpp.

@@ -811,7 +822,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::DynamicEngine.

-

Definition at line 274 of file engine_graph.cpp.

+

Definition at line 284 of file engine_graph.cpp.

@@ -843,7 +854,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::DynamicEngine.

-

Definition at line 208 of file engine_graph.cpp.

+

Definition at line 209 of file engine_graph.cpp.

@@ -888,7 +899,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::DynamicEngine.

-

Definition at line 307 of file engine_graph.cpp.

+

Definition at line 317 of file engine_graph.cpp.

@@ -924,7 +935,7 @@ template<IsArithmeticOrAD T>
Returns
Map of species to their stoichiometric coefficients.
-

Definition at line 311 of file engine_graph.cpp.

+

Definition at line 321 of file engine_graph.cpp.

@@ -938,7 +949,7 @@ template<IsArithmeticOrAD T> - + @@ -956,7 +967,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::DynamicEngine.

-

Definition at line 118 of file engine_graph.cpp.

+

Definition at line 119 of file engine_graph.cpp.

@@ -988,7 +999,36 @@ template<IsArithmeticOrAD T>

Implements gridfire::Engine.

-

Definition at line 112 of file engine_graph.cpp.

+

Definition at line 113 of file engine_graph.cpp.

+ + + + +

◆ getScreeningModel()

+ +
+
+
const reaction::LogicalReactionSet & gridfire::GraphEngine::getNetworkReactions const reaction::LogicalReactionSet & gridfire::GraphEngine::getNetworkReactions ( ) const
+ + + + +
+ + + + + + + +
screening::ScreeningType gridfire::GraphEngine::getScreeningModel () const
+
+nodiscardoverridevirtual
+
+ +

Implements gridfire::DynamicEngine.

+ +

Definition at line 271 of file engine_graph.cpp.

@@ -1038,7 +1078,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::DynamicEngine.

-

Definition at line 426 of file engine_graph.cpp.

+

Definition at line 436 of file engine_graph.cpp.

@@ -1083,7 +1123,7 @@ template<IsArithmeticOrAD T>

Implements gridfire::DynamicEngine.

-

Definition at line 317 of file engine_graph.cpp.

+

Definition at line 327 of file engine_graph.cpp.

@@ -1119,7 +1159,7 @@ template<IsArithmeticOrAD T>
Returns
True if the species is involved in the network, false otherwise.
-

Definition at line 124 of file engine_graph.cpp.

+

Definition at line 125 of file engine_graph.cpp.

@@ -1149,7 +1189,7 @@ template<IsArithmeticOrAD T>

Populates the reaction ID map.

This method populates the reaction ID map, which maps reaction IDs to REACLIBReaction objects.

-

Definition at line 85 of file engine_graph.cpp.

+

Definition at line 86 of file engine_graph.cpp.

@@ -1179,7 +1219,7 @@ template<IsArithmeticOrAD T>

Populates the species-to-index map.

This method populates the species-to-index map, which maps species to their index in the stoichiometry matrix.

-

Definition at line 94 of file engine_graph.cpp.

+

Definition at line 95 of file engine_graph.cpp.

@@ -1215,7 +1255,7 @@ template<IsArithmeticOrAD T> -

Definition at line 442 of file engine_graph.cpp.

+

Definition at line 456 of file engine_graph.cpp.

@@ -1245,7 +1285,36 @@ template<IsArithmeticOrAD T>

Reserves space for the Jacobian matrix.

This method reserves space for the Jacobian matrix, which is used to store the partial derivatives of the right-hand side of the ODE with respect to the species abundances.

-

Definition at line 101 of file engine_graph.cpp.

+

Definition at line 102 of file engine_graph.cpp.

+ + + + +

◆ setScreeningModel()

+ +
+
+ + + + + +
+ + + + + + + +
void gridfire::GraphEngine::setScreeningModel (screening::ScreeningType model)
+
+overridevirtual
+
+ +

Implements gridfire::DynamicEngine.

+ +

Definition at line 266 of file engine_graph.cpp.

@@ -1275,7 +1344,36 @@ template<IsArithmeticOrAD T>

Synchronizes the internal maps.

This method synchronizes the internal maps used by the engine, including the species map, reaction ID map, and species-to-index map. It also generates the stoichiometry matrix and records the AD tape.

-

Definition at line 46 of file engine_graph.cpp.

+

Definition at line 47 of file engine_graph.cpp.

+ + + + +

◆ update()

+ +
+
+ + + + + +
+ + + + + + + +
void gridfire::GraphEngine::update (const NetIn & netIn)
+
+overridevirtual
+
+ +

Implements gridfire::DynamicEngine.

+ +

Definition at line 452 of file engine_graph.cpp.

@@ -1322,7 +1420,7 @@ template<IsArithmeticOrAD T>

This method validates the composition against the current reaction set. If the composition is not compatible with the reaction set, the reaction set is rebuilt from the composition.

-

Definition at line 187 of file engine_graph.cpp.

+

Definition at line 188 of file engine_graph.cpp.

@@ -1353,7 +1451,7 @@ template<IsArithmeticOrAD T>
Returns
True if all reactions conserve mass and charge, false otherwise.

This method checks that all reactions in the network conserve mass and charge. If any reaction does not conserve mass or charge, an error message is logged and false is returned.

-

Definition at line 132 of file engine_graph.cpp.

+

Definition at line 133 of file engine_graph.cpp.

@@ -1378,7 +1476,7 @@ template<IsArithmeticOrAD T>
-

Definition at line 310 of file engine_graph.h.

+

Definition at line 322 of file engine_graph.h.

@@ -1404,7 +1502,7 @@ template<IsArithmeticOrAD T>

Access to physical constants.

-

Definition at line 311 of file engine_graph.h.

+

Definition at line 323 of file engine_graph.h.

@@ -1430,7 +1528,7 @@ template<IsArithmeticOrAD T>

Jacobian matrix (species x species).

-

Definition at line 306 of file engine_graph.h.

+

Definition at line 315 of file engine_graph.h.

@@ -1454,7 +1552,7 @@ template<IsArithmeticOrAD T>
-

Definition at line 312 of file engine_graph.h.

+

Definition at line 324 of file engine_graph.h.

@@ -1480,7 +1578,7 @@ template<IsArithmeticOrAD T>

Vector of unique species in the network.

-

Definition at line 301 of file engine_graph.h.

+

Definition at line 310 of file engine_graph.h.

@@ -1506,7 +1604,7 @@ template<IsArithmeticOrAD T>

Map from species name to Species object.

-

Definition at line 302 of file engine_graph.h.

+

Definition at line 311 of file engine_graph.h.

@@ -1532,7 +1630,7 @@ template<IsArithmeticOrAD T>

Map from reaction ID to REACLIBReaction. //PERF: This makes copies of REACLIBReaction and could be a performance bottleneck.

-

Definition at line 299 of file engine_graph.h.

+

Definition at line 308 of file engine_graph.h.

@@ -1546,7 +1644,7 @@ template<IsArithmeticOrAD T> - +
reaction::LogicalReactionSet gridfire::GraphEngine::m_reactionsreaction::LogicalReactionSet gridfire::GraphEngine::m_reactions
@@ -1558,7 +1656,7 @@ template<IsArithmeticOrAD T>

Set of REACLIB reactions in the network.

-

Definition at line 298 of file engine_graph.h.

+

Definition at line 307 of file engine_graph.h.

@@ -1584,7 +1682,57 @@ template<IsArithmeticOrAD T>

CppAD function for the right-hand side of the ODE.

-

Definition at line 308 of file engine_graph.h.

+

Definition at line 317 of file engine_graph.h.

+ + + + +

◆ m_screeningModel

+ +
+
+ + + + + +
+ + + + +
std::unique_ptr<screening::ScreeningModel> gridfire::GraphEngine::m_screeningModel = screening::selectScreeningModel(m_screeningType)
+
+private
+
+ +

Definition at line 320 of file engine_graph.h.

+ +
+
+ +

◆ m_screeningType

+ +
+
+ + + + + +
+ + + + +
screening::ScreeningType gridfire::GraphEngine::m_screeningType = screening::ScreeningType::BARE
+
+private
+
+ +

Screening type for the reaction network. Default to no screening.

+ +

Definition at line 319 of file engine_graph.h.

@@ -1610,7 +1758,7 @@ template<IsArithmeticOrAD T>

Map from species to their index in the stoichiometry matrix.

-

Definition at line 303 of file engine_graph.h.

+

Definition at line 312 of file engine_graph.h.

@@ -1636,7 +1784,7 @@ template<IsArithmeticOrAD T>

Stoichiometry matrix (species x reactions).

-

Definition at line 305 of file engine_graph.h.

+

Definition at line 314 of file engine_graph.h.

diff --git a/docs/html/classgridfire_1_1_graph_engine.js b/docs/html/classgridfire_1_1_graph_engine.js index 160d006a..7fa2aea4 100644 --- a/docs/html/classgridfire_1_1_graph_engine.js +++ b/docs/html/classgridfire_1_1_graph_engine.js @@ -17,6 +17,7 @@ var classgridfire_1_1_graph_engine = [ "getNetReactionStoichiometry", "classgridfire_1_1_graph_engine.html#a8c29d8bbde407e913be5eb77efb2c0c9", null ], [ "getNetworkReactions", "classgridfire_1_1_graph_engine.html#ad45650d10fc5dff1673ae3f806d067da", null ], [ "getNetworkSpecies", "classgridfire_1_1_graph_engine.html#a0ed390f3e598ebba4e245ac90bb78767", null ], + [ "getScreeningModel", "classgridfire_1_1_graph_engine.html#a697f2004e0d02c59e83c7890742d7c9a", null ], [ "getSpeciesTimescales", "classgridfire_1_1_graph_engine.html#a26215593544c3a52597194602e4e25dd", null ], [ "getStoichiometryMatrixEntry", "classgridfire_1_1_graph_engine.html#a6b5feaf788bade212b7c8df7ac8c8152", null ], [ "involvesSpecies", "classgridfire_1_1_graph_engine.html#aa6202cee0c3c481eda77cc9a91bc126b", null ], @@ -24,7 +25,9 @@ var classgridfire_1_1_graph_engine = [ "populateSpeciesToIndexMap", "classgridfire_1_1_graph_engine.html#a47202c43342b96480070874bffce1391", null ], [ "recordADTape", "classgridfire_1_1_graph_engine.html#a95563f6bc86007d9ee053a0f1e15b889", null ], [ "reserveJacobianMatrix", "classgridfire_1_1_graph_engine.html#a5a5458ed01923124f2d7e1f04f32f138", null ], + [ "setScreeningModel", "classgridfire_1_1_graph_engine.html#a8110e687844f921438bb517e1d8ce62f", null ], [ "syncInternalMaps", "classgridfire_1_1_graph_engine.html#acdce8d87e23a2cd1504bc9472e538c0f", null ], + [ "update", "classgridfire_1_1_graph_engine.html#a51b4cedf9b00de79fb6eef243631b04d", null ], [ "validateComposition", "classgridfire_1_1_graph_engine.html#aeeafeab40a5f4dbfae78bdc87e25e93f", null ], [ "validateConservation", "classgridfire_1_1_graph_engine.html#acf4cfccea20f5cb31c9886bf233a28be", null ], [ "m_config", "classgridfire_1_1_graph_engine.html#a3b17102b143435ddfdc015d7a50c4b18", null ], @@ -36,6 +39,8 @@ var classgridfire_1_1_graph_engine = [ "m_reactionIDMap", "classgridfire_1_1_graph_engine.html#a5d6cc63b99b467c2a976d1fbaaa1dfa3", null ], [ "m_reactions", "classgridfire_1_1_graph_engine.html#acb7c4f5108b0efeae48ad15598e808c3", null ], [ "m_rhsADFun", "classgridfire_1_1_graph_engine.html#a2e22b111f6d00ecc9e3804a71f1ce876", null ], + [ "m_screeningModel", "classgridfire_1_1_graph_engine.html#af17cf3762abac3efcab9a8e87c961210", null ], + [ "m_screeningType", "classgridfire_1_1_graph_engine.html#a52edc3e88f1e8fc497e1e63972d63c80", null ], [ "m_speciesToIndexMap", "classgridfire_1_1_graph_engine.html#ad8237c252145a75092202d00f5e1ddf7", null ], [ "m_stoichiometryMatrix", "classgridfire_1_1_graph_engine.html#ad1cb5fd32efc37668e2d9ecf0c72ad24", null ] ]; \ No newline at end of file diff --git a/docs/html/classgridfire_1_1reaction_1_1_logical_reaction-members.html b/docs/html/classgridfire_1_1reaction_1_1_logical_reaction-members.html index 4dbd7b4e..33f5c534 100644 --- a/docs/html/classgridfire_1_1reaction_1_1_logical_reaction-members.html +++ b/docs/html/classgridfire_1_1reaction_1_1_logical_reaction-members.html @@ -137,21 +137,22 @@ $(function(){initNavTree('classgridfire_1_1reaction_1_1_logical_reaction.html',' m_sourcesgridfire::reaction::LogicalReactionprivate num_species() constgridfire::reaction::Reaction operator!=(const Reaction &other) constgridfire::reaction::Reactioninline - operator==(const Reaction &other) constgridfire::reaction::Reactioninline - peName() constgridfire::reaction::Reactioninlinevirtual - product_species() constgridfire::reaction::Reaction - products() constgridfire::reaction::Reactioninline - qValue() constgridfire::reaction::Reactioninline - rateCoefficients() constgridfire::reaction::Reactioninline - reactant_species() constgridfire::reaction::Reaction - reactants() constgridfire::reaction::Reactioninline - Reaction(const std::string_view id, const std::string_view peName, const int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, const double qValue, const std::string_view label, const RateCoefficientSet &sets, const bool reverse=false)gridfire::reaction::Reaction - size() constgridfire::reaction::LogicalReactioninline - sourceLabel() constgridfire::reaction::Reactioninline - sources() constgridfire::reaction::LogicalReactioninline - stoichiometry(const fourdst::atomic::Species &species) constgridfire::reaction::Reaction - stoichiometry() constgridfire::reaction::Reaction - ~Reaction()=defaultgridfire::reaction::Reactionvirtual + operator<<(std::ostream &os, const LogicalReaction &r)gridfire::reaction::LogicalReactionfriend + operator==(const Reaction &other) constgridfire::reaction::Reactioninline + peName() constgridfire::reaction::Reactioninlinevirtual + product_species() constgridfire::reaction::Reaction + products() constgridfire::reaction::Reactioninline + qValue() constgridfire::reaction::Reactioninline + rateCoefficients() constgridfire::reaction::Reactioninline + reactant_species() constgridfire::reaction::Reaction + reactants() constgridfire::reaction::Reactioninline + Reaction(const std::string_view id, const std::string_view peName, const int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, const double qValue, const std::string_view label, const RateCoefficientSet &sets, const bool reverse=false)gridfire::reaction::Reaction + size() constgridfire::reaction::LogicalReactioninline + sourceLabel() constgridfire::reaction::Reactioninline + sources() constgridfire::reaction::LogicalReactioninline + stoichiometry(const fourdst::atomic::Species &species) constgridfire::reaction::Reaction + stoichiometry() constgridfire::reaction::Reaction + ~Reaction()=defaultgridfire::reaction::Reactionvirtual diff --git a/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.html b/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.html index 61bc2c6f..d11b538e 100644 --- a/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.html +++ b/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.html @@ -103,6 +103,7 @@ $(function(){initNavTree('classgridfire_1_1reaction_1_1_logical_reaction.html',' Public Member Functions | Private Member Functions | Private Attributes | +Friends | List of all members
gridfire::reaction::LogicalReaction Class Referencefinal
@@ -243,6 +244,11 @@ Private Attributes  List of rate coefficient sets from each source.
  + + + +

+Friends

std::ostream & operator<< (std::ostream &os, const LogicalReaction &r)
 
@@ -280,7 +286,7 @@ Additional Inherited Members

Represents a "logical" reaction that aggregates rates from multiple sources.

A LogicalReaction shares the same reactants and products but combines rates from different evaluations (e.g., "wc12" and "st08" for the same physical reaction). The total rate is the sum of the individual rates. It inherits from Reaction, using the properties of the first provided reaction as its base properties (reactants, products, Q-value, etc.).

-

Definition at line 459 of file reaction.h.

+

Definition at line 308 of file reaction.h.

Constructor & Destructor Documentation

◆ LogicalReaction()

@@ -319,7 +325,7 @@ Additional Inherited Members -

Definition at line 288 of file reaction.cpp.

+

Definition at line 142 of file reaction.cpp.

@@ -353,7 +359,7 @@ Additional Inherited Members -

Definition at line 317 of file reaction.cpp.

+

Definition at line 171 of file reaction.cpp.

@@ -380,7 +386,7 @@ Additional Inherited Members

Additional Inherited Members

- Protected Attributes inherited from gridfire::reaction::Reaction
-

Definition at line 506 of file reaction.h.

+

Definition at line 355 of file reaction.h.

@@ -407,7 +413,7 @@ Additional Inherited Members
-

Definition at line 507 of file reaction.h.

+

Definition at line 356 of file reaction.h.

@@ -445,7 +451,7 @@ Additional Inherited Members

Reimplemented from gridfire::reaction::Reaction.

-

Definition at line 343 of file reaction.cpp.

+

Definition at line 197 of file reaction.cpp.

@@ -483,7 +489,7 @@ Additional Inherited Members

Reimplemented from gridfire::reaction::Reaction.

-

Definition at line 339 of file reaction.cpp.

+

Definition at line 193 of file reaction.cpp.

@@ -528,7 +534,7 @@ template<typename T>
Returns
The total calculated reaction rate.

This method iterates through all stored RateCoefficientSets, calculates the rate for each, and returns their sum.

-

Definition at line 526 of file reaction.h.

+

Definition at line 381 of file reaction.h.

@@ -555,7 +561,7 @@ template<typename T>
-

Definition at line 508 of file reaction.h.

+

Definition at line 357 of file reaction.h.

@@ -582,7 +588,7 @@ template<typename T>
-

Definition at line 509 of file reaction.h.

+

Definition at line 358 of file reaction.h.

@@ -612,7 +618,7 @@ template<typename T>

Gets the number of source rates contributing to this logical reaction.

Returns
The number of aggregated rates.
-

Definition at line 480 of file reaction.h.

+

Definition at line 329 of file reaction.h.

@@ -642,7 +648,39 @@ template<typename T>

Gets the list of source labels for the aggregated rates.

Returns
A vector of source label strings.
-

Definition at line 486 of file reaction.h.

+

Definition at line 335 of file reaction.h.

+ + + +

Friends And Related Symbol Documentation

+ +

◆ operator<<

+ +
+
+ + + + + +
+ + + + + + + + + + + +
std::ostream & operator<< (std::ostream & os,
const LogicalReaction & r )
+
+friend
+
+ +

Definition at line 362 of file reaction.h.

@@ -669,7 +707,7 @@ template<typename T>

List of rate coefficient sets from each source.

-

Definition at line 514 of file reaction.h.

+

Definition at line 369 of file reaction.h.

@@ -695,7 +733,7 @@ template<typename T>

List of source labels.

-

Definition at line 513 of file reaction.h.

+

Definition at line 368 of file reaction.h.

diff --git a/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.js b/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.js index 2c671f87..b4ebf8bd 100644 --- a/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.js +++ b/docs/html/classgridfire_1_1reaction_1_1_logical_reaction.js @@ -11,6 +11,7 @@ var classgridfire_1_1reaction_1_1_logical_reaction = [ "end", "classgridfire_1_1reaction_1_1_logical_reaction.html#a054994f733b44293b4d79f3a9b207560", null ], [ "size", "classgridfire_1_1reaction_1_1_logical_reaction.html#afa41050855b842c63db16c94d2e9b897", null ], [ "sources", "classgridfire_1_1reaction_1_1_logical_reaction.html#add094eda0e71126f8443698d7f3317f4", null ], + [ "operator<<", "classgridfire_1_1reaction_1_1_logical_reaction.html#a10cbea11653524dae2f7eafb5c22c90f", null ], [ "m_rates", "classgridfire_1_1reaction_1_1_logical_reaction.html#a81f75f0085f8a5a45169f0b7240c809d", null ], [ "m_sources", "classgridfire_1_1reaction_1_1_logical_reaction.html#a7fe91d24e20ebc76d612f6ad742f476f", null ] ]; \ No newline at end of file diff --git a/docs/html/classgridfire_1_1reaction_1_1_reaction-members.html b/docs/html/classgridfire_1_1reaction_1_1_reaction-members.html index 287aae4b..17779530 100644 --- a/docs/html/classgridfire_1_1reaction_1_1_reaction-members.html +++ b/docs/html/classgridfire_1_1reaction_1_1_reaction-members.html @@ -129,19 +129,20 @@ $(function(){initNavTree('classgridfire_1_1reaction_1_1_reaction.html',''); init m_sourceLabelgridfire::reaction::Reactionprotected num_species() constgridfire::reaction::Reaction operator!=(const Reaction &other) constgridfire::reaction::Reactioninline - operator==(const Reaction &other) constgridfire::reaction::Reactioninline - peName() constgridfire::reaction::Reactioninlinevirtual - product_species() constgridfire::reaction::Reaction - products() constgridfire::reaction::Reactioninline - qValue() constgridfire::reaction::Reactioninline - rateCoefficients() constgridfire::reaction::Reactioninline - reactant_species() constgridfire::reaction::Reaction - reactants() constgridfire::reaction::Reactioninline - Reaction(const std::string_view id, const std::string_view peName, const int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, const double qValue, const std::string_view label, const RateCoefficientSet &sets, const bool reverse=false)gridfire::reaction::Reaction - sourceLabel() constgridfire::reaction::Reactioninline - stoichiometry(const fourdst::atomic::Species &species) constgridfire::reaction::Reaction - stoichiometry() constgridfire::reaction::Reaction - ~Reaction()=defaultgridfire::reaction::Reactionvirtual + operator<<(std::ostream &os, const Reaction &r)gridfire::reaction::Reactionfriend + operator==(const Reaction &other) constgridfire::reaction::Reactioninline + peName() constgridfire::reaction::Reactioninlinevirtual + product_species() constgridfire::reaction::Reaction + products() constgridfire::reaction::Reactioninline + qValue() constgridfire::reaction::Reactioninline + rateCoefficients() constgridfire::reaction::Reactioninline + reactant_species() constgridfire::reaction::Reaction + reactants() constgridfire::reaction::Reactioninline + Reaction(const std::string_view id, const std::string_view peName, const int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, const double qValue, const std::string_view label, const RateCoefficientSet &sets, const bool reverse=false)gridfire::reaction::Reaction + sourceLabel() constgridfire::reaction::Reactioninline + stoichiometry(const fourdst::atomic::Species &species) constgridfire::reaction::Reaction + stoichiometry() constgridfire::reaction::Reaction + ~Reaction()=defaultgridfire::reaction::Reactionvirtual diff --git a/docs/html/classgridfire_1_1reaction_1_1_reaction.html b/docs/html/classgridfire_1_1reaction_1_1_reaction.html index eb2c0b84..7fab4165 100644 --- a/docs/html/classgridfire_1_1reaction_1_1_reaction.html +++ b/docs/html/classgridfire_1_1reaction_1_1_reaction.html @@ -103,6 +103,7 @@ $(function(){initNavTree('classgridfire_1_1reaction_1_1_reaction.html',''); init Public Member Functions | Protected Attributes | Private Member Functions | +Friends | List of all members
gridfire::reaction::Reaction Class Reference
@@ -241,6 +242,11 @@ Private Member Functions T calculate_rate (const T T9) const  Template implementation for calculating the reaction rate.
  + + + +

+Friends

std::ostream & operator<< (std::ostream &os, const Reaction &r)
 

Detailed Description

Represents a single nuclear reaction from a specific data source.

@@ -252,7 +258,7 @@ Private Member Functions
double rate = p_gamma_d.calculate_rate(0.1); // T9 = 0.1
Reaction(const std::string_view id, const std::string_view peName, const int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, const double qValue, const std::string_view label, const RateCoefficientSet &sets, const bool reverse=false)
Constructs a Reaction object.
Definition reaction.cpp:19
-

Definition at line 71 of file reaction.h.

+

Definition at line 72 of file reaction.h.

Constructor & Destructor Documentation

◆ ~Reaction()

@@ -503,7 +509,7 @@ template<typename T>
Returns
The calculated reaction rate.

The rate is calculated using the standard REACLIB formula: rate = exp(a0 + a1/T9 + a2/T9^(1/3) + a3*T9^(1/3) + a4*T9 + a5*T9^(5/3) + a6*ln(T9))

-

Definition at line 276 of file reaction.h.

+

Definition at line 281 of file reaction.h.

@@ -533,7 +539,7 @@ template<typename T>

Gets the REACLIB chapter number.

Returns
The chapter number.
-

Definition at line 125 of file reaction.h.

+

Definition at line 126 of file reaction.h.

@@ -738,7 +744,7 @@ template<typename T>

Gets the unique identifier of the reaction.

Returns
The reaction ID.
-

Definition at line 201 of file reaction.h.

+

Definition at line 202 of file reaction.h.

@@ -768,7 +774,7 @@ template<typename T>

Checks if this is a reverse reaction rate.

Returns
True if it is a reverse rate, false otherwise.
-

Definition at line 225 of file reaction.h.

+

Definition at line 226 of file reaction.h.

@@ -834,7 +840,7 @@ template<typename T>
Returns
True if the reactions are not equal.
-

Definition at line 245 of file reaction.h.

+

Definition at line 246 of file reaction.h.

@@ -870,7 +876,7 @@ template<typename T>
Returns
True if the reaction IDs are the same.
-

Definition at line 238 of file reaction.h.

+

Definition at line 239 of file reaction.h.

@@ -900,7 +906,7 @@ template<typename T>

Gets the reaction name in (projectile, ejectile) notation.

Returns
The reaction name (e.g., "p(p,g)d").
-

Definition at line 119 of file reaction.h.

+

Definition at line 120 of file reaction.h.

@@ -960,7 +966,7 @@ template<typename T>

Gets the vector of product species.

Returns
A const reference to the vector of products.
-

Definition at line 219 of file reaction.h.

+

Definition at line 220 of file reaction.h.

@@ -990,7 +996,7 @@ template<typename T>

Gets the Q-value of the reaction.

Returns
The Q-value in whatever units the reaction was defined in (usually MeV).
-

Definition at line 207 of file reaction.h.

+

Definition at line 208 of file reaction.h.

@@ -1020,7 +1026,7 @@ template<typename T>

Gets the set of rate coefficients.

Returns
A const reference to the RateCoefficientSet.
-

Definition at line 137 of file reaction.h.

+

Definition at line 138 of file reaction.h.

@@ -1080,7 +1086,7 @@ template<typename T>

Gets the vector of reactant species.

Returns
A const reference to the vector of reactants.
-

Definition at line 213 of file reaction.h.

+

Definition at line 214 of file reaction.h.

@@ -1110,7 +1116,7 @@ template<typename T>

Gets the source label for the rate data.

Returns
The source label (e.g., "wc12w", "st08").
-

Definition at line 131 of file reaction.h.

+

Definition at line 132 of file reaction.h.

@@ -1176,6 +1182,38 @@ template<typename T>
Returns
The stoichiometric coefficient (negative for reactants, positive for products).
+ + +

Friends And Related Symbol Documentation

+ +

◆ operator<<

+ +
+
+ + + + + +
+ + + + + + + + + + + +
std::ostream & operator<< (std::ostream & os,
const Reaction & r )
+
+friend
+
+ +

Definition at line 256 of file reaction.h.

+

Member Data Documentation

@@ -1201,7 +1239,7 @@ template<typename T>

Chapter number from the REACLIB database, defining the reaction structure.

-

Definition at line 259 of file reaction.h.

+

Definition at line 264 of file reaction.h.

@@ -1227,7 +1265,7 @@ template<typename T>

Unique identifier for the reaction (e.g., "h1+h1=>h2+e+nu").

-

Definition at line 257 of file reaction.h.

+

Definition at line 262 of file reaction.h.

@@ -1251,7 +1289,7 @@ template<typename T>
-

Definition at line 256 of file reaction.h.

+

Definition at line 261 of file reaction.h.

@@ -1277,7 +1315,7 @@ template<typename T>

Name of the reaction in (projectile, ejectile) notation (e.g. "p(p,g)d").

-

Definition at line 258 of file reaction.h.

+

Definition at line 263 of file reaction.h.

@@ -1303,7 +1341,7 @@ template<typename T>

Products of the reaction.

-

Definition at line 262 of file reaction.h.

+

Definition at line 267 of file reaction.h.

@@ -1329,7 +1367,7 @@ template<typename T>

Q-value of the reaction in MeV.

-

Definition at line 260 of file reaction.h.

+

Definition at line 265 of file reaction.h.

@@ -1355,7 +1393,7 @@ template<typename T>

The seven rate coefficients.

-

Definition at line 264 of file reaction.h.

+

Definition at line 269 of file reaction.h.

@@ -1381,7 +1419,7 @@ template<typename T>

Reactants of the reaction.

-

Definition at line 261 of file reaction.h.

+

Definition at line 266 of file reaction.h.

@@ -1407,7 +1445,7 @@ template<typename T>

Flag indicating if this is a reverse reaction rate.

-

Definition at line 265 of file reaction.h.

+

Definition at line 270 of file reaction.h.

@@ -1433,7 +1471,7 @@ template<typename T>

Source label for the rate data (e.g., "wc12w", "st08").

-

Definition at line 263 of file reaction.h.

+

Definition at line 268 of file reaction.h.

diff --git a/docs/html/classgridfire_1_1reaction_1_1_reaction.js b/docs/html/classgridfire_1_1reaction_1_1_reaction.js index 4e56f524..310bb969 100644 --- a/docs/html/classgridfire_1_1reaction_1_1_reaction.js +++ b/docs/html/classgridfire_1_1reaction_1_1_reaction.js @@ -27,6 +27,7 @@ var classgridfire_1_1reaction_1_1_reaction = [ "sourceLabel", "classgridfire_1_1reaction_1_1_reaction.html#a410e2ab0784ad751f82bbe55be603db0", null ], [ "stoichiometry", "classgridfire_1_1reaction_1_1_reaction.html#ad359c06d7196c1a7a955a7b66a51dbe3", null ], [ "stoichiometry", "classgridfire_1_1reaction_1_1_reaction.html#aaf0c94db6536b4a9ac1ec08a5c8f01ac", null ], + [ "operator<<", "classgridfire_1_1reaction_1_1_reaction.html#a2b05ab608187216fc751bd2e42e8b7d8", null ], [ "m_chapter", "classgridfire_1_1reaction_1_1_reaction.html#a16f9cbb6269817099d3dc07d4e63da7b", null ], [ "m_id", "classgridfire_1_1reaction_1_1_reaction.html#a5c685e5a736b51799e5b9f6746c4126b", null ], [ "m_logger", "classgridfire_1_1reaction_1_1_reaction.html#a7044d0a1d59d85502ce554e4ec2167e4", null ], diff --git a/docs/html/classgridfire_1_1solver_1_1_direct_network_solver.html b/docs/html/classgridfire_1_1solver_1_1_direct_network_solver.html index 51d86cf4..6bb7f528 100644 --- a/docs/html/classgridfire_1_1solver_1_1_direct_network_solver.html +++ b/docs/html/classgridfire_1_1solver_1_1_direct_network_solver.html @@ -173,7 +173,7 @@ Additional Inherited Members

A network solver that directly integrates the reaction network ODEs.

This solver uses a Runge-Kutta method to directly integrate the reaction network ODEs. It is simpler than the QSENetworkSolver, but it can be less efficient for stiff networks with disparate timescales.

-

Definition at line 379 of file solver.h.

+

Definition at line 386 of file solver.h.

Member Function Documentation

◆ evaluate()

@@ -209,7 +209,7 @@ Additional Inherited Members

Implements gridfire::solver::NetworkSolverStrategy< DynamicEngine >.

-

Definition at line 308 of file solver.cpp.

+

Definition at line 375 of file solver.cpp.

@@ -236,7 +236,7 @@ Additional Inherited Members

Configuration instance.

-

Definition at line 484 of file solver.h.

+

Definition at line 492 of file solver.h.

@@ -262,7 +262,7 @@ Additional Inherited Members

Logger instance.

-

Definition at line 483 of file solver.h.

+

Definition at line 491 of file solver.h.

diff --git a/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver-members.html b/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver-members.html index 9f503335..9e230db5 100644 --- a/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver-members.html +++ b/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver-members.html @@ -109,17 +109,17 @@ $(function(){initNavTree('classgridfire_1_1solver_1_1_q_s_e_network_solver.html' evaluate(const NetIn &netIn) overridegridfire::solver::QSENetworkSolvervirtual initializeNetworkWithShortIgnition(const NetIn &netIn) constgridfire::solver::QSENetworkSolverprivate m_configgridfire::solver::QSENetworkSolverprivate - m_enginegridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >protected - m_enginegridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >protected + m_enginegridfire::solver::NetworkSolverStrategy< DynamicEngine >protected + m_enginegridfire::solver::NetworkSolverStrategy< DynamicEngine >protected m_isViewInitializedgridfire::solver::QSENetworkSolverprivate m_lastSeenConditionsgridfire::solver::QSENetworkSolverprivate m_loggergridfire::solver::QSENetworkSolverprivate - NetworkSolverStrategy(AdaptiveEngineView &engine)gridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >inlineexplicit - NetworkSolverStrategy(AdaptiveEngineView &engine)gridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >inlineexplicit + NetworkSolverStrategy(DynamicEngine &engine)gridfire::solver::NetworkSolverStrategy< DynamicEngine >inlineexplicit + NetworkSolverStrategy(DynamicEngine &engine)gridfire::solver::NetworkSolverStrategy< DynamicEngine >inlineexplicit packSpeciesTypeIndexVectors(const std::vector< double > &Y, const double T9, const double rho) constgridfire::solver::QSENetworkSolverprivate shouldUpdateView(const NetIn &conditions) constgridfire::solver::QSENetworkSolverprivate - ~NetworkSolverStrategy()=defaultgridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >virtual - ~NetworkSolverStrategy()=defaultgridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >virtual + ~NetworkSolverStrategy()=defaultgridfire::solver::NetworkSolverStrategy< DynamicEngine >virtual + ~NetworkSolverStrategy()=defaultgridfire::solver::NetworkSolverStrategy< DynamicEngine >virtual diff --git a/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.html b/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.html index c529224a..4a9fb195 100644 --- a/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.html +++ b/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.html @@ -119,7 +119,7 @@ Inheritance diagram for gridfire::solver::QSENetworkSolver:
-gridfire::solver::NetworkSolverStrategy< AdaptiveEngineView > +gridfire::solver::NetworkSolverStrategy< DynamicEngine >
@@ -140,14 +140,14 @@ Public Member Functions - - + + - + @@ -186,11 +186,11 @@ Private Attributes
NetOut evaluate (const NetIn &netIn) override
 Evaluates the network for a given timestep using the QSE approach.
 
- Public Member Functions inherited from gridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >
 NetworkSolverStrategy (AdaptiveEngineView &engine)
- Public Member Functions inherited from gridfire::solver::NetworkSolverStrategy< DynamicEngine >
 NetworkSolverStrategy (DynamicEngine &engine)
 Constructor for the NetworkSolverStrategy.
 
virtual ~NetworkSolverStrategy ()=default
 Virtual destructor.
 
 NetworkSolverStrategy (AdaptiveEngineView &engine)
 NetworkSolverStrategy (DynamicEngine &engine)
 Constructor for the NetworkSolverStrategy.
 
virtual ~NetworkSolverStrategy ()=default
- - + + - +

Additional Inherited Members

- Protected Attributes inherited from gridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >
AdaptiveEngineViewm_engine
- Protected Attributes inherited from gridfire::solver::NetworkSolverStrategy< DynamicEngine >
DynamicEnginem_engine
 The engine used by this solver strategy.
 
AdaptiveEngineViewm_engine
DynamicEnginem_engine
 The engine used by this solver strategy.
 
@@ -260,7 +260,7 @@ Additional Inherited Members -

Definition at line 187 of file solver.cpp.

+

Definition at line 205 of file solver.cpp.

@@ -308,15 +308,15 @@ Additional Inherited Members -
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()
packSpeciesTypeIndexVectors()
calculateSteadyStateAbundances()
-

Implements gridfire::solver::NetworkSolverStrategy< AdaptiveEngineView >.

+

Implements gridfire::solver::NetworkSolverStrategy< DynamicEngine >.

-

Definition at line 23 of file solver.cpp.

+

Definition at line 26 of file solver.cpp.

@@ -354,7 +354,7 @@ Additional Inherited Members

This method performs a short integration of the network at a high temperature and density to ignite the network and bring it closer to equilibrium. This can improve the convergence of the QSE solver.

See also
DirectNetworkSolver::evaluate()
-

Definition at line 202 of file solver.cpp.

+

Definition at line 264 of file solver.cpp.

@@ -403,7 +403,7 @@ Additional Inherited Members

This method determines whether each species should be treated dynamically or as being in QSE based on its timescale and abundance. Species with short timescales or low abundances are assumed to be in QSE.

See also
DynamicEngine::getSpeciesTimescales()
-

Definition at line 119 of file solver.cpp.

+

Definition at line 137 of file solver.cpp.

@@ -439,9 +439,9 @@ Additional Inherited Members
Returns
True if the view should be updated, false otherwise.

This method implements a policy for determining when the adaptive engine view should be updated. The view is updated if the temperature or density has changed significantly, or if a primary fuel source has been depleted.

-
See also
AdaptiveEngineView::update()
+
See also
AdaptiveEngineView::update()
-

Definition at line 241 of file solver.cpp.

+

Definition at line 308 of file solver.cpp.

@@ -468,7 +468,7 @@ Additional Inherited Members

Configuration instance.

-

Definition at line 363 of file solver.h.

+

Definition at line 370 of file solver.h.

@@ -494,7 +494,7 @@ Additional Inherited Members

Flag indicating whether the adaptive engine view has been initialized.

-

Definition at line 365 of file solver.h.

+

Definition at line 372 of file solver.h.

@@ -520,7 +520,7 @@ Additional Inherited Members

The last seen input conditions.

-

Definition at line 366 of file solver.h.

+

Definition at line 373 of file solver.h.

@@ -546,7 +546,7 @@ Additional Inherited Members

Logger instance.

-

Definition at line 362 of file solver.h.

+

Definition at line 369 of file solver.h.

diff --git a/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.png b/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.png index ff8303d5..018c107b 100644 Binary files a/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.png and b/docs/html/classgridfire_1_1solver_1_1_q_s_e_network_solver.png differ diff --git a/docs/html/conceptgridfire_1_1_is_arithmetic_or_a_d.html b/docs/html/conceptgridfire_1_1_is_arithmetic_or_a_d.html index 4e1751dc..46787a54 100644 --- a/docs/html/conceptgridfire_1_1_is_arithmetic_or_a_d.html +++ b/docs/html/conceptgridfire_1_1_is_arithmetic_or_a_d.html @@ -110,12 +110,12 @@ $(function(){initNavTree('conceptgridfire_1_1_is_arithmetic_or_a_d.html',''); in

Concept definition

template<typename T>
concept gridfire::IsArithmeticOrAD = std::is_same_v<T, double> || std::is_same_v<T, CppAD::AD<double>>
-
Concept for types allowed in engine calculations.
+
Concept for types allowed in engine calculations.

Detailed Description

Concept for types allowed in engine calculations.

This concept restricts template parameters to either double or CppAD::AD<double>, enabling both standard and automatic differentiation types.

-

Definition at line 30 of file engine_abstract.h.

+

Definition at line 33 of file engine_abstract.h.

diff --git a/docs/html/dir_1cdf727c700d393da216e23f923be8b4.html b/docs/html/dir_1cdf727c700d393da216e23f923be8b4.html index c8cc38c1..bd036dc1 100644 --- a/docs/html/dir_1cdf727c700d393da216e23f923be8b4.html +++ b/docs/html/dir_1cdf727c700d393da216e23f923be8b4.html @@ -103,10 +103,13 @@ $(function(){initNavTree('dir_1cdf727c700d393da216e23f923be8b4.html',''); initRe
+ + + +

+Directories

 views
 
- - diff --git a/docs/html/dir_1cdf727c700d393da216e23f923be8b4.js b/docs/html/dir_1cdf727c700d393da216e23f923be8b4.js index 7239d9b0..fd65fad2 100644 --- a/docs/html/dir_1cdf727c700d393da216e23f923be8b4.js +++ b/docs/html/dir_1cdf727c700d393da216e23f923be8b4.js @@ -1,6 +1,6 @@ var dir_1cdf727c700d393da216e23f923be8b4 = [ - [ "engine_adaptive.cpp", "engine__adaptive_8cpp.html", null ], + [ "views", "dir_ae72e87b2c96ef2ff3f9c3faf556f8b7.html", "dir_ae72e87b2c96ef2ff3f9c3faf556f8b7" ], [ "engine_approx8.cpp", "engine__approx8_8cpp.html", "engine__approx8_8cpp" ], [ "engine_graph.cpp", "engine__graph_8cpp.html", null ] ]; \ No newline at end of file diff --git a/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.html b/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.html index 5f18f64f..9308d728 100644 --- a/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.html +++ b/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.html @@ -107,10 +107,16 @@ $(function(){initNavTree('dir_2a1262ef5950eb718393488a3eb5aa9f.html',''); initRe Directories + + + + + +

Files

 engine_adaptive.cpp
 
 engine_approx8.cpp
 
 engine_graph.cpp
 engine
 
 io
 
 reaction
 
 screening
 
 solver
 
 utils
 
diff --git a/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.js b/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.js index acbcd55d..d126989b 100644 --- a/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.js +++ b/docs/html/dir_2a1262ef5950eb718393488a3eb5aa9f.js @@ -1,7 +1,10 @@ var dir_2a1262ef5950eb718393488a3eb5aa9f = [ [ "engine", "dir_6b2e1e22dfdea3280d50981209bf7529.html", "dir_6b2e1e22dfdea3280d50981209bf7529" ], + [ "io", "dir_41ae00bf8f9a98ba9c6aece2e6262882.html", "dir_41ae00bf8f9a98ba9c6aece2e6262882" ], [ "reaction", "dir_3c60707488650cd3ec07ac1739eb797f.html", "dir_3c60707488650cd3ec07ac1739eb797f" ], + [ "screening", "dir_a1a1065684fbb5b386566d81dc65d72d.html", "dir_a1a1065684fbb5b386566d81dc65d72d" ], [ "solver", "dir_aa1cdef39099aefa25ac81305b9dae77.html", "dir_aa1cdef39099aefa25ac81305b9dae77" ], + [ "utils", "dir_0cbec3bc536a3e05d15a7545c8625ac1.html", "dir_0cbec3bc536a3e05d15a7545c8625ac1" ], [ "network.h", "network_8h.html", "network_8h" ] ]; \ No newline at end of file diff --git a/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.html b/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.html index 03c77121..086c55c2 100644 --- a/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.html +++ b/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.html @@ -103,20 +103,20 @@ $(function(){initNavTree('dir_6b2e1e22dfdea3280d50981209bf7529.html',''); initRe

Files

+ + + +

+Directories

 views
 
- - - - -

Files

 engine_abstract.h
 Abstract interfaces for reaction network engines in GridFire.
 
 engine_adaptive.h
 
 engine_approx8.h
 
 engine_graph.h
 
 engine_view_abstract.h
 Abstract interfaces for engine "views" in GridFire.
 
diff --git a/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.js b/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.js index 436d0c86..3ab705f2 100644 --- a/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.js +++ b/docs/html/dir_6b2e1e22dfdea3280d50981209bf7529.js @@ -1,8 +1,7 @@ var dir_6b2e1e22dfdea3280d50981209bf7529 = [ + [ "views", "dir_fb341b7e674a7e4701415d4572cba12f.html", "dir_fb341b7e674a7e4701415d4572cba12f" ], [ "engine_abstract.h", "engine__abstract_8h.html", "engine__abstract_8h" ], - [ "engine_adaptive.h", "engine__adaptive_8h.html", "engine__adaptive_8h" ], [ "engine_approx8.h", "engine__approx8_8h.html", "engine__approx8_8h" ], - [ "engine_graph.h", "engine__graph_8h.html", "engine__graph_8h" ], - [ "engine_view_abstract.h", "engine__view__abstract_8h.html", "engine__view__abstract_8h" ] + [ "engine_graph.h", "engine__graph_8h.html", "engine__graph_8h" ] ]; \ No newline at end of file diff --git a/docs/html/dir_a7655658c851688eff9381235a9676f0.html b/docs/html/dir_a7655658c851688eff9381235a9676f0.html index 18b0306f..626870ea 100644 --- a/docs/html/dir_a7655658c851688eff9381235a9676f0.html +++ b/docs/html/dir_a7655658c851688eff9381235a9676f0.html @@ -107,10 +107,16 @@ $(function(){initNavTree('dir_a7655658c851688eff9381235a9676f0.html',''); initRe Directories  engine   + io reaction   + screening solver   + utils +  diff --git a/docs/html/dir_a7655658c851688eff9381235a9676f0.js b/docs/html/dir_a7655658c851688eff9381235a9676f0.js index e0260f75..16f564ca 100644 --- a/docs/html/dir_a7655658c851688eff9381235a9676f0.js +++ b/docs/html/dir_a7655658c851688eff9381235a9676f0.js @@ -1,7 +1,10 @@ var dir_a7655658c851688eff9381235a9676f0 = [ [ "engine", "dir_1cdf727c700d393da216e23f923be8b4.html", "dir_1cdf727c700d393da216e23f923be8b4" ], + [ "io", "dir_2d53942b5372593aa67f4b74882cd581.html", "dir_2d53942b5372593aa67f4b74882cd581" ], [ "reaction", "dir_d5f908f1a3b7d6921d55b8696a8e83bc.html", "dir_d5f908f1a3b7d6921d55b8696a8e83bc" ], + [ "screening", "dir_52d70f305d86d4a2338c5425f7bc4d9c.html", "dir_52d70f305d86d4a2338c5425f7bc4d9c" ], [ "solver", "dir_93d547a749bb04fb4b43758550ab11b5.html", "dir_93d547a749bb04fb4b43758550ab11b5" ], + [ "utils", "dir_d95b5b8e5cbbc1b508cb3c0cf16f7ce7.html", "dir_d95b5b8e5cbbc1b508cb3c0cf16f7ce7" ], [ "network.cpp", "network_8cpp.html", "network_8cpp" ] ]; \ No newline at end of file diff --git a/docs/html/doxygen_crawl.html b/docs/html/doxygen_crawl.html index b5b1664b..4946b70b 100644 --- a/docs/html/doxygen_crawl.html +++ b/docs/html/doxygen_crawl.html @@ -14,6 +14,8 @@ + + @@ -21,7 +23,7 @@ - + @@ -30,10 +32,14 @@ + + + + @@ -46,8 +52,11 @@ + + + @@ -60,6 +69,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -73,11 +119,15 @@ + + + + @@ -99,6 +149,7 @@ + @@ -126,10 +177,32 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -141,20 +214,6 @@ - - - - - - - - - - - - - - @@ -165,6 +224,7 @@ + @@ -194,34 +254,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -247,18 +326,26 @@ + + + + + + + + @@ -271,6 +358,10 @@ + + + + @@ -284,8 +375,30 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -321,6 +434,10 @@ + + + + @@ -358,6 +475,7 @@ + @@ -366,10 +484,21 @@ + + + + + + + + + + + @@ -382,6 +511,10 @@ + + + + @@ -396,14 +529,28 @@ + + + + + + + + + + + + + + + - @@ -447,6 +594,9 @@ + + + @@ -481,22 +631,27 @@ + + + + + + + - + + - - - @@ -521,6 +676,9 @@ + + + diff --git a/docs/html/engine__abstract_8h.html b/docs/html/engine__abstract_8h.html index 42932499..14907a69 100644 --- a/docs/html/engine__abstract_8h.html +++ b/docs/html/engine__abstract_8h.html @@ -110,6 +110,9 @@ $(function(){initNavTree('engine__abstract_8h.html',''); initResizable(true); })

Abstract interfaces for reaction network engines in GridFire. More...

#include "gridfire/reaction/reaction.h"
+#include "gridfire/network.h"
+#include "gridfire/screening/screening_abstract.h"
+#include "gridfire/screening/screening_types.h"
#include <vector>
#include <unordered_map>
diff --git a/docs/html/engine__abstract_8h_source.html b/docs/html/engine__abstract_8h_source.html index 5d1e205a..ccb7b343 100644 --- a/docs/html/engine__abstract_8h_source.html +++ b/docs/html/engine__abstract_8h_source.html @@ -105,99 +105,116 @@ $(function(){initNavTree('engine__abstract_8h_source.html',''); initResizable(tr Go to the documentation of this file.
1#pragma once
2
3#include "gridfire/reaction/reaction.h"
-
4
-
5#include <vector>
-
6#include <unordered_map>
-
7
-
20
-
-
21namespace gridfire {
-
22
-
29 template<typename T>
-
30 concept IsArithmeticOrAD = std::is_same_v<T, double> || std::is_same_v<T, CppAD::AD<double>>;
-
31
-
49 template <IsArithmeticOrAD T>
-
- -
51 std::vector<T> dydt;
- -
53 };
+
4#include "gridfire/network.h"
+ + +
7
+
8#include <vector>
+
9#include <unordered_map>
+
10
+
23
+
+
24namespace gridfire {
+
25
+
32 template<typename T>
+
33 concept IsArithmeticOrAD = std::is_same_v<T, double> || std::is_same_v<T, CppAD::AD<double>>;
+
34
+
52 template <IsArithmeticOrAD T>
+
+ +
54 std::vector<T> dydt;
+ +
56 };
-
54
-
-
72 class Engine {
-
73 public:
-
77 virtual ~Engine() = default;
-
78
-
83 virtual const std::vector<fourdst::atomic::Species>& getNetworkSpecies() const = 0;
-
84
- -
98 const std::vector<double>& Y,
-
99 double T9,
-
100 double rho
-
101 ) const = 0;
-
102 };
+
57
+
+
75 class Engine {
+
76 public:
+
80 virtual ~Engine() = default;
+
81
+
86 [[nodiscard]] virtual const std::vector<fourdst::atomic::Species>& getNetworkSpecies() const = 0;
+
87
+ +
101 const std::vector<double>& Y,
+
102 double T9,
+
103 double rho
+
104 ) const = 0;
+
105 };
-
103
-
-
118 class DynamicEngine : public Engine {
-
119 public:
- -
131 const std::vector<double>& Y,
-
132 double T9, double rho
-
133 ) = 0;
-
134
- -
145 int i,
-
146 int j
-
147 ) const = 0;
-
148
-
155 virtual void generateStoichiometryMatrix() = 0;
-
156
- -
167 int speciesIndex,
-
168 int reactionIndex
-
169 ) const = 0;
-
170
- - -
185 const std::vector<double>& Y,
-
186 double T9,
-
187 double rho
-
188 ) const = 0;
-
189
- -
196
-
208 virtual std::unordered_map<fourdst::atomic::Species, double> getSpeciesTimescales(
-
209 const std::vector<double>& Y,
-
210 double T9,
-
211 double rho
-
212 ) const = 0;
-
213 };
+
106
+
+
121 class DynamicEngine : public Engine {
+
122 public:
+ +
134 const std::vector<double>& Y,
+
135 double T9, double rho
+
136 ) = 0;
+
137
+
147 [[nodiscard]] virtual double getJacobianMatrixEntry(
+
148 int i,
+
149 int j
+
150 ) const = 0;
+
151
+
158 virtual void generateStoichiometryMatrix() = 0;
+
159
+
169 [[nodiscard]] virtual int getStoichiometryMatrixEntry(
+
170 int speciesIndex,
+
171 int reactionIndex
+
172 ) const = 0;
+
173
+
186 [[nodiscard]] virtual double calculateMolarReactionFlow(
+ +
188 const std::vector<double>& Y,
+
189 double T9,
+
190 double rho
+
191 ) const = 0;
+
192
+
198 [[nodiscard]] virtual const reaction::LogicalReactionSet& getNetworkReactions() const = 0;
+
199
+
211 [[nodiscard]] virtual std::unordered_map<fourdst::atomic::Species, double> getSpeciesTimescales(
+
212 const std::vector<double>& Y,
+
213 double T9,
+
214 double rho
+
215 ) const = 0;
+
216
+
217 virtual void update(const NetIn& netIn) = 0;
+
218
+ +
220
+
221 [[nodiscard]] virtual screening::ScreeningType getScreeningModel() const = 0;
+
222 };
-
214}
+
223}
-
Abstract class for engines supporting Jacobian and stoichiometry operations.
+
Abstract class for engines supporting Jacobian and stoichiometry operations.
virtual double getJacobianMatrixEntry(int i, int j) const =0
Get an entry from the previously generated Jacobian matrix.
virtual void generateJacobianMatrix(const std::vector< double > &Y, double T9, double rho)=0
Generate the Jacobian matrix for the current state.
+
virtual void setScreeningModel(screening::ScreeningType model)=0
virtual std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const =0
Compute timescales for all species in the network.
virtual double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y, double T9, double rho) const =0
Calculate the molar reaction flow for a given reaction.
+
virtual screening::ScreeningType getScreeningModel() const =0
+
virtual void update(const NetIn &netIn)=0
virtual const reaction::LogicalReactionSet & getNetworkReactions() const =0
Get the set of logical reactions in the network.
virtual void generateStoichiometryMatrix()=0
Generate the stoichiometry matrix for the network.
virtual int getStoichiometryMatrixEntry(int speciesIndex, int reactionIndex) const =0
Get an entry from the stoichiometry matrix.
-
Abstract base class for a reaction network engine.
+
Abstract base class for a reaction network engine.
virtual const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const =0
Get the list of species in the network.
virtual ~Engine()=default
Virtual destructor.
virtual StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y, double T9, double rho) const =0
Calculate the right-hand side (dY/dt) and energy generation.
-
A collection of LogicalReaction objects.
Definition reaction.h:554
-
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:71
-
Concept for types allowed in engine calculations.
- - +
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:72
+
Concept for types allowed in engine calculations.
+ +
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
Definition reaction.h:557
+ + +
Defines classes for representing and managing nuclear reactions.
-
Structure holding derivatives and energy generation for a network step.
-
T nuclearEnergyGenerationRate
Specific energy generation rate (e.g., erg/g/s).
-
std::vector< T > dydt
Derivatives of abundances (dY/dt for each species).
+ + + +
Structure holding derivatives and energy generation for a network step.
+
T nuclearEnergyGenerationRate
Specific energy generation rate (e.g., erg/g/s).
+
std::vector< T > dydt
Derivatives of abundances (dY/dt for each species).
diff --git a/docs/html/engine__adaptive_8cpp.html b/docs/html/engine__adaptive_8cpp.html index b93b8d75..21bff045 100644 --- a/docs/html/engine__adaptive_8cpp.html +++ b/docs/html/engine__adaptive_8cpp.html @@ -5,7 +5,7 @@ -GridFire: src/network/lib/engine/engine_adaptive.cpp File Reference +GridFire: src/network/lib/engine/views/engine_adaptive.cpp File Reference @@ -104,7 +104,7 @@ $(function(){initNavTree('engine__adaptive_8cpp.html',''); initResizable(true);
engine_adaptive.cpp File Reference
-
#include "gridfire/engine/engine_adaptive.h"
+
#include "../../../include/gridfire/engine/views/engine_adaptive.h"
#include <ranges>
#include <queue>
#include "gridfire/network.h"
@@ -123,7 +123,7 @@ Namespaces diff --git a/docs/html/engine__adaptive_8cpp_source.html b/docs/html/engine__adaptive_8cpp_source.html index 3ec95fe5..d878d22c 100644 --- a/docs/html/engine__adaptive_8cpp_source.html +++ b/docs/html/engine__adaptive_8cpp_source.html @@ -5,7 +5,7 @@ -GridFire: src/network/lib/engine/engine_adaptive.cpp Source File +GridFire: src/network/lib/engine/views/engine_adaptive.cpp Source File @@ -102,7 +102,7 @@ $(function(){initNavTree('engine__adaptive_8cpp_source.html',''); initResizable(
engine_adaptive.cpp
-Go to the documentation of this file.
+Go to the documentation of this file.
2
3#include <ranges>
4#include <queue>
@@ -193,360 +193,422 @@ $(function(){initNavTree('engine__adaptive_8cpp_source.html',''); initResizable(
84
-
85 void AdaptiveEngineView::update(const NetIn& netIn) {
-
86 LOG_TRACE_L1(m_logger, "Updating adaptive engine view...");
+
85 void AdaptiveEngineView::update(const NetIn& netIn) {
+
86 LOG_TRACE_L1(m_logger, "Updating AdaptiveEngineView with new network input...");
87
-
88 const auto& fullSpeciesList = m_baseEngine.getNetworkSpecies();
-
89 std::vector<double>Y_full;
-
90 Y_full.reserve(fullSpeciesList.size());
-
91
-
92 for (const auto& species : fullSpeciesList) {
-
93 if (netIn.composition.contains(species)) {
-
94 Y_full.push_back(netIn.composition.getMolarAbundance(std::string(species.name())));
-
95 } else {
-
96 LOG_TRACE_L2(m_logger, "Species '{}' not found in composition. Setting abundance to 0.0.", species.name());
-
97 Y_full.push_back(0.0);
-
98 }
-
99 }
-
100
-
101 const double T9 = netIn.temperature / 1e9; // Convert temperature from Kelvin to T9 (T9 = T / 1e9)
-
102 const double rho = netIn.density; // Density in g/cm^3
-
103
+
88 std::vector<double> Y_Full;
+
89 std::vector<ReactionFlow> allFlows = calculateAllReactionFlows(netIn, Y_Full);
+
90
+
91 double maxFlow = 0.0;
+
92
+
93 for (const auto&[reactionPtr, flowRate]: allFlows) {
+
94 if (flowRate > maxFlow) {
+
95 maxFlow = flowRate;
+
96 }
+
97 }
+
98 LOG_DEBUG(m_logger, "Maximum reaction flow rate in adaptive engine view: {:0.3E} [mol/s]", maxFlow);
+
99
+
100 const std::unordered_set<Species> reachableSpecies = findReachableSpecies(netIn);
+
101 LOG_DEBUG(m_logger, "Found {} reachable species in adaptive engine view.", reachableSpecies.size());
+
102
+
103 const std::vector<const reaction::LogicalReaction*> finalReactions = cullReactionsByFlow(allFlows, reachableSpecies, Y_Full, maxFlow);
104
-
105 std::vector<ReactionFlow> reactionFlows;
-
106 const auto& fullReactionSet = m_baseEngine.getNetworkReactions();
-
107 reactionFlows.reserve(fullReactionSet.size());
-
108
-
109 for (const auto& reactionPtr : fullReactionSet) {
-
110 const double flow = m_baseEngine.calculateMolarReactionFlow(reactionPtr, Y_full, T9, rho);
-
111 reactionFlows.push_back({&reactionPtr, flow});
-
112 }
-
113
-
114 double max_flow = 0.0;
-
115 double min_flow = std::numeric_limits<double>::max();
-
116 double flowSum = 0.0;
-
117 for (const auto&[reactionPtr, flowRate] : reactionFlows) {
-
118 if (flowRate > max_flow) {
-
119 max_flow = flowRate;
-
120 } else if (flowRate < min_flow) {
-
121 min_flow = flowRate;
-
122 }
-
123 flowSum += flowRate;
-
124 LOG_TRACE_L2(m_logger, "Reaction '{}' has flow rate: {:0.3E} [mol/s]", reactionPtr->id(), flowRate);
-
125 }
-
126 flowSum /= reactionFlows.size();
-
127
-
128 LOG_DEBUG(m_logger, "Maximum reaction flow rate in adaptive engine view: {:0.3E} [mol/s]", max_flow);
-
129 LOG_DEBUG(m_logger, "Minimum reaction flow rate in adaptive engine view: {:0.3E} [mol/s]", min_flow);
-
130 LOG_DEBUG(m_logger, "Average reaction flow rate in adaptive engine view: {:0.3E} [mol/s]", flowSum);
-
131
-
132 const double relative_culling_threshold = m_config.get<double>("gridfire:AdaptiveEngineView:RelativeCullingThreshold", 1e-75);
-
133
-
134 double absoluteCullingThreshold = relative_culling_threshold * max_flow;
-
135 LOG_DEBUG(m_logger, "Relative culling threshold: {:0.3E} ({})", relative_culling_threshold, absoluteCullingThreshold);
-
136
-
137 // --- Reaction Culling ---
-
138 LOG_TRACE_L1(m_logger, "Culling reactions based on reaction flow rates...");
-
139 std::vector<const reaction::Reaction*> flowCulledReactions;
-
140 for (const auto&[reactionPtr, flowRate] : reactionFlows) {
-
141 if (flowRate > absoluteCullingThreshold) {
-
142 LOG_TRACE_L2(m_logger, "Maintaining reaction '{}' with relative (abs) flow rate: {:0.3E} ({:0.3E} [mol/s])", reactionPtr->id(), flowRate/max_flow, flowRate);
-
143 flowCulledReactions.push_back(reactionPtr);
-
144 }
-
145 }
-
146 LOG_DEBUG(m_logger, "Selected {} (total: {}, culled: {}) reactions based on flow rates.", flowCulledReactions.size(), fullReactionSet.size(), fullReactionSet.size() - flowCulledReactions.size());
-
147
-
148 // --- Connectivity Analysis ---
-
149 std::queue<Species> species_to_visit;
-
150 std::unordered_set<Species> reachable_species;
-
151
-
152 constexpr double ABUNDANCE_FLOOR = 1e-12; // Abundance floor for a species to be considered part of the initial fuel
-
153 for (const auto& species : fullSpeciesList) {
-
154 if (netIn.composition.contains(species) && netIn.composition.getMassFraction(std::string(species.name())) > ABUNDANCE_FLOOR) {
-
155 species_to_visit.push(species);
-
156 reachable_species.insert(species);
-
157 LOG_TRACE_L2(m_logger, "Species '{}' is part of the initial fuel.", species.name());
-
158 }
-
159 }
-
160 std::unordered_map<Species, std::vector<const reaction::Reaction*>> reactant_to_reactions_map;
-
161 for (const auto* reaction_ptr : flowCulledReactions) {
-
162 for (const auto& reactant : reaction_ptr->reactants()) {
-
163 reactant_to_reactions_map[reactant].push_back(reaction_ptr);
-
164 }
-
165 }
-
166
-
167 while (!species_to_visit.empty()) {
-
168 Species currentSpecies = species_to_visit.front();
-
169 species_to_visit.pop();
-
170
-
171 auto it = reactant_to_reactions_map.find(currentSpecies);
-
172 if (it == reactant_to_reactions_map.end()) {
-
173 continue; // The species does not initiate any further reactions
-
174 }
-
175
-
176 const auto& reactions = it->second;
-
177 for (const auto* reaction_ptr : reactions) {
-
178 for (const auto& product : reaction_ptr->products()) {
-
179 if (!reachable_species.contains(product)) {
-
180 reachable_species.insert(product);
-
181 species_to_visit.push(product);
-
182 LOG_TRACE_L2(m_logger, "Species '{}' is reachable via reaction '{}'.", product.name(), reaction_ptr->id());
-
183 }
-
184 }
-
185 }
+
105 finalizeActiveSet(finalReactions);
+
106
+
107
+ + +
110
+
111 m_isStale = false;
+
112
+
113 LOG_INFO(m_logger, "AdaptiveEngineView updated successfully with {} active species and {} active reactions.", m_activeSpecies.size(), m_activeReactions.size());
+
114 }
+
+
115
+
+
116 const std::vector<Species> & AdaptiveEngineView::getNetworkSpecies() const {
+
117 return m_activeSpecies;
+
118 }
+
+
119
+
+ +
121 const std::vector<double> &Y_culled,
+
122 const double T9,
+
123 const double rho
+
124 ) const {
+ +
126
+
127 const auto Y_full = mapCulledToFull(Y_culled);
+
128
+
129 const auto [dydt, nuclearEnergyGenerationRate] = m_baseEngine.calculateRHSAndEnergy(Y_full, T9, rho);
+
130
+
131 StepDerivatives<double> culledResults;
+
132 culledResults.nuclearEnergyGenerationRate = nuclearEnergyGenerationRate;
+
133 culledResults.dydt = mapFullToCulled(dydt);
+
134
+
135 return culledResults;
+
136 }
+
+
137
+
+ +
139 const std::vector<double> &Y_culled,
+
140 const double T9,
+
141 const double rho
+
142 ) {
+ +
144 const auto Y_full = mapCulledToFull(Y_culled);
+
145
+
146 m_baseEngine.generateJacobianMatrix(Y_full, T9, rho);
+
147 }
+
+
148
+
+ +
150 const int i_culled,
+
151 const int j_culled
+
152 ) const {
+ +
154 const size_t i_full = mapCulledToFullSpeciesIndex(i_culled);
+
155 const size_t j_full = mapCulledToFullSpeciesIndex(j_culled);
+
156
+
157 return m_baseEngine.getJacobianMatrixEntry(i_full, j_full);
+
158 }
+
+
159
+
+ + +
162 m_baseEngine.generateStoichiometryMatrix();
+
163 }
+
+
164
+
+ +
166 const int speciesIndex_culled,
+
167 const int reactionIndex_culled
+
168 ) const {
+ +
170 const size_t speciesIndex_full = mapCulledToFullSpeciesIndex(speciesIndex_culled);
+
171 const size_t reactionIndex_full = mapCulledToFullReactionIndex(reactionIndex_culled);
+
172 return m_baseEngine.getStoichiometryMatrixEntry(speciesIndex_full, reactionIndex_full);
+
173 }
+
+
174
+
+ + +
177 const std::vector<double> &Y_culled,
+
178 const double T9,
+
179 const double rho
+
180 ) const {
+ +
182 if (!m_activeReactions.contains(reaction)) {
+
183 LOG_ERROR(m_logger, "Reaction '{}' is not part of the active reactions in the adaptive engine view.", reaction.id());
+
184 m_logger -> flush_log();
+
185 throw std::runtime_error("Reaction not found in active reactions: " + std::string(reaction.id()));
186 }
-
187 LOG_DEBUG(m_logger, "Reachable species count: {}", reachable_species.size());
+
187 const auto Y = mapCulledToFull(Y_culled);
188
-
189 m_activeSpecies.assign(reachable_species.begin(), reachable_species.end());
-
190 std::ranges::sort(m_activeSpecies,
-
191 [](const Species &a, const Species &b) { return a.mass() < b.mass(); });
-
192
-
193 m_activeReactions.clear();
-
194 for (const auto* reaction_ptr : flowCulledReactions) {
-
195 bool all_reactants_present = true;
-
196 for (const auto& reactant : reaction_ptr->reactants()) {
-
197 if (!reachable_species.contains(reactant)) {
-
198 all_reactants_present = false;
-
199 break;
-
200 }
-
201 }
-
202
-
203 if (all_reactants_present) {
-
204 m_activeReactions.add_reaction(*reaction_ptr);
-
205 LOG_TRACE_L2(m_logger, "Maintaining reaction '{}' with all reactants present.", reaction_ptr->id());
-
206 } else {
-
207 LOG_TRACE_L1(m_logger, "Culling reaction '{}' due to missing reactants.", reaction_ptr->id());
-
208 }
-
209 }
-
210 LOG_DEBUG(m_logger, "Active reactions count: {} (total: {}, culled: {}, culled due to connectivity: {})", m_activeReactions.size(),
-
211 fullReactionSet.size(), fullReactionSet.size() - m_activeReactions.size(), flowCulledReactions.size() - m_activeReactions.size());
-
212
- - +
189 return m_baseEngine.calculateMolarReactionFlow(reaction, Y, T9, rho);
+
190 }
+
+
191
+ +
195
+
+
196 std::unordered_map<Species, double> AdaptiveEngineView::getSpeciesTimescales(
+
197 const std::vector<double> &Y_culled,
+
198 const double T9,
+
199 const double rho
+
200 ) const {
+ +
202 const auto Y_full = mapCulledToFull(Y_culled);
+
203 const auto fullTimescales = m_baseEngine.getSpeciesTimescales(Y_full, T9, rho);
+
204
+
205 std::unordered_map<Species, double> culledTimescales;
+
206 culledTimescales.reserve(m_activeSpecies.size());
+
207 for (const auto& active_species : m_activeSpecies) {
+
208 if (fullTimescales.contains(active_species)) {
+
209 culledTimescales[active_species] = fullTimescales.at(active_species);
+
210 }
+
211 }
+
212 return culledTimescales;
+
213
+
214 }
+
215
-
216 m_isStale = false;
-
217 }
+
+ +
217 m_baseEngine.setScreeningModel(model);
+
218 }
-
218
-
-
219 const std::vector<Species> & AdaptiveEngineView::getNetworkSpecies() const {
-
220 return m_activeSpecies;
-
221 }
+
219
+
+ +
221 return m_baseEngine.getScreeningModel();
+
222 }
-
222
-
- -
224 const std::vector<double> &Y_culled,
-
225 const double T9,
-
226 const double rho
-
227 ) const {
- -
229
-
230 const auto Y_full = mapCulledToFull(Y_culled);
-
231
-
232 const auto [dydt, nuclearEnergyGenerationRate] = m_baseEngine.calculateRHSAndEnergy(Y_full, T9, rho);
-
233
-
234 StepDerivatives<double> culledResults;
-
235 culledResults.nuclearEnergyGenerationRate = nuclearEnergyGenerationRate;
-
236 culledResults.dydt = mapFullToCulled(dydt);
-
237
-
238 return culledResults;
-
239 }
+
223
+
+
224 std::vector<double> AdaptiveEngineView::mapCulledToFull(const std::vector<double>& culled) const {
+
225 std::vector<double> full(m_baseEngine.getNetworkSpecies().size(), 0.0);
+
226 for (size_t i_culled = 0; i_culled < culled.size(); ++i_culled) {
+
227 const size_t i_full = m_speciesIndexMap[i_culled];
+
228 full[i_full] += culled[i_culled];
+
229 }
+
230 return full;
+
231 }
-
240
-
- -
242 const std::vector<double> &Y_culled,
-
243 const double T9,
-
244 const double rho
-
245 ) {
- -
247 const auto Y_full = mapCulledToFull(Y_culled);
-
248
-
249 m_baseEngine.generateJacobianMatrix(Y_full, T9, rho);
-
250 }
+
232
+
+
233 std::vector<double> AdaptiveEngineView::mapFullToCulled(const std::vector<double>& full) const {
+
234 std::vector<double> culled(m_activeSpecies.size(), 0.0);
+
235 for (size_t i_culled = 0; i_culled < m_activeSpecies.size(); ++i_culled) {
+
236 const size_t i_full = m_speciesIndexMap[i_culled];
+
237 culled[i_culled] = full[i_full];
+
238 }
+
239 return culled;
+
240 }
+
+
241
+
+
242 size_t AdaptiveEngineView::mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const {
+
243 if (culledSpeciesIndex < 0 || culledSpeciesIndex >= static_cast<int>(m_speciesIndexMap.size())) {
+
244 LOG_ERROR(m_logger, "Culled index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
+
245 m_logger->flush_log();
+
246 throw std::out_of_range("Culled index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
+
247 }
+
248 return m_speciesIndexMap[culledSpeciesIndex];
+
249 }
+
+
250
+
+
251 size_t AdaptiveEngineView::mapCulledToFullReactionIndex(size_t culledReactionIndex) const {
+
252 if (culledReactionIndex < 0 || culledReactionIndex >= static_cast<int>(m_reactionIndexMap.size())) {
+
253 LOG_ERROR(m_logger, "Culled index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
+
254 m_logger->flush_log();
+
255 throw std::out_of_range("Culled index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");
+
256 }
+
257 return m_reactionIndexMap[culledReactionIndex];
+
258 }
-
251
-
- -
253 const int i_culled,
-
254 const int j_culled
-
255 ) const {
- -
257 const size_t i_full = mapCulledToFullSpeciesIndex(i_culled);
-
258 const size_t j_full = mapCulledToFullSpeciesIndex(j_culled);
259
-
260 return m_baseEngine.getJacobianMatrixEntry(i_full, j_full);
-
261 }
-
-
262
-
- - -
265 m_baseEngine.generateStoichiometryMatrix();
+
+ +
261 if (m_isStale) {
+
262 LOG_ERROR(m_logger, "AdaptiveEngineView is stale. Please call update() before calculating RHS and energy.");
+
263 m_logger->flush_log();
+
264 throw std::runtime_error("AdaptiveEngineView is stale. Please call update() before calculating RHS and energy.");
+
265 }
266 }
267
- -
269 const int speciesIndex_culled,
-
270 const int reactionIndex_culled
+
268 std::vector<AdaptiveEngineView::ReactionFlow> AdaptiveEngineView::calculateAllReactionFlows(
+
269 const NetIn &netIn,
+
270 std::vector<double> &out_Y_Full
271 ) const {
- -
273 const size_t speciesIndex_full = mapCulledToFullSpeciesIndex(speciesIndex_culled);
-
274 const size_t reactionIndex_full = mapCulledToFullReactionIndex(reactionIndex_culled);
-
275 return m_baseEngine.getStoichiometryMatrixEntry(speciesIndex_full, reactionIndex_full);
-
276 }
-
-
277
-
- - -
280 const std::vector<double> &Y_culled,
-
281 const double T9,
-
282 const double rho
-
283 ) const {
- -
285 if (!m_activeReactions.contains(reaction)) {
-
286 LOG_ERROR(m_logger, "Reaction '{}' is not part of the active reactions in the adaptive engine view.", reaction.id());
-
287 m_logger -> flush_log();
-
288 throw std::runtime_error("Reaction not found in active reactions: " + std::string(reaction.id()));
-
289 }
-
290 const auto Y = mapCulledToFull(Y_culled);
-
291
-
292 return m_baseEngine.calculateMolarReactionFlow(reaction, Y, T9, rho);
-
293 }
-
-
294
-
- -
296 return m_activeReactions;
+
272 const auto& fullSpeciesList = m_baseEngine.getNetworkSpecies();
+
273 out_Y_Full.clear();
+
274 out_Y_Full.reserve(fullSpeciesList.size());
+
275
+
276 for (const auto& species: fullSpeciesList) {
+
277 if (netIn.composition.contains(species)) {
+
278 out_Y_Full.push_back(netIn.composition.getMolarAbundance(std::string(species.name())));
+
279 } else {
+
280 LOG_TRACE_L2(m_logger, "Species '{}' not found in composition. Setting abundance to 0.0.", species.name());
+
281 out_Y_Full.push_back(0.0);
+
282 }
+
283 }
+
284
+
285 const double T9 = netIn.temperature / 1e9; // Convert temperature from Kelvin to T9 (T9 = T / 1e9)
+
286 const double rho = netIn.density; // Density in g/cm^3
+
287
+
288 std::vector<ReactionFlow> reactionFlows;
+
289 const auto& fullReactionSet = m_baseEngine.getNetworkReactions();
+
290 reactionFlows.reserve(fullReactionSet.size());
+
291 for (const auto& reaction : fullReactionSet) {
+
292 const double flow = m_baseEngine.calculateMolarReactionFlow(reaction, out_Y_Full, T9, rho);
+
293 reactionFlows.push_back({&reaction, flow});
+
294 LOG_TRACE_L2(m_logger, "Reaction '{}' has flow rate: {:0.3E} [mol/s]", reaction.id(), flow);
+
295 }
+
296 return reactionFlows;
297 }
298
-
299 std::unordered_map<Species, double> AdaptiveEngineView::getSpeciesTimescales(
-
300 const std::vector<double> &Y_culled,
-
301 const double T9,
-
302 const double rho
-
303 ) const {
- -
305 const auto Y_full = mapCulledToFull(Y_culled);
-
306 const auto fullTimescales = m_baseEngine.getSpeciesTimescales(Y_full, T9, rho);
-
307
-
308 std::unordered_map<Species, double> culledTimescales;
-
309 culledTimescales.reserve(m_activeSpecies.size());
-
310 for (const auto& active_species : m_activeSpecies) {
-
311 if (fullTimescales.contains(active_species)) {
-
312 culledTimescales[active_species] = fullTimescales.at(active_species);
+
299 std::unordered_set<Species> AdaptiveEngineView::findReachableSpecies(
+
300 const NetIn &netIn
+
301 ) const {
+
302 std::unordered_set<Species> reachable;
+
303 std::queue<Species> to_vist;
+
304
+
305 constexpr double ABUNDANCE_FLOOR = 1e-12; // Abundance floor for a species to be considered part of the initial fuel
+
306 for (const auto& species: m_baseEngine.getNetworkSpecies()) {
+
307 if (netIn.composition.contains(species) && netIn.composition.getMassFraction(std::string(species.name())) > ABUNDANCE_FLOOR) {
+
308 if (!reachable.contains(species)) {
+
309 to_vist.push(species);
+
310 reachable.insert(species);
+
311 LOG_TRACE_L2(m_logger, "Network Connectivity Analysis: Species '{}' is part of the initial fuel.", species.name());
+
312 }
313 }
314 }
-
315 return culledTimescales;
-
316
-
317 }
+
315
+
316 bool new_species_found_in_pass = true;
+
317 while (new_species_found_in_pass) {
+
318 new_species_found_in_pass = false;
+
319 for (const auto& reaction: m_baseEngine.getNetworkReactions()) {
+
320 bool all_reactants_reachable = true;
+
321 for (const auto& reactant: reaction.reactants()) {
+
322 if (!reachable.contains(reactant)) {
+
323 all_reactants_reachable = false;
+
324 break;
+
325 }
+
326 }
+
327 if (all_reactants_reachable) {
+
328 for (const auto& product: reaction.products()) {
+
329 if (!reachable.contains(product)) {
+
330 reachable.insert(product);
+
331 new_species_found_in_pass = true;
+
332 LOG_TRACE_L2(m_logger, "Network Connectivity Analysis: Species '{}' is reachable via reaction '{}'.", product.name(), reaction.id());
+
333 }
+
334 }
+
335 }
+
336 }
+
337 }
+
338
+
339 return reachable;
+
340 }
-
318
-
-
319 std::vector<double> AdaptiveEngineView::mapCulledToFull(const std::vector<double>& culled) const {
-
320 std::vector<double> full(m_baseEngine.getNetworkSpecies().size(), 0.0);
-
321 for (size_t i_culled = 0; i_culled < culled.size(); ++i_culled) {
-
322 const size_t i_full = m_speciesIndexMap[i_culled];
-
323 full[i_full] += culled[i_culled];
-
324 }
-
325 return full;
-
326 }
+
341
+
+
342 std::vector<const reaction::LogicalReaction *> AdaptiveEngineView::cullReactionsByFlow(
+
343 const std::vector<ReactionFlow> &allFlows,
+
344 const std::unordered_set<fourdst::atomic::Species> &reachableSpecies,
+
345 const std::vector<double> &Y_full,
+
346 const double maxFlow
+
347 ) const {
+
348 LOG_TRACE_L1(m_logger, "Culling reactions based on flow rates...");
+
349 const auto relative_culling_threshold = m_config.get<double>("gridfire:AdaptiveEngineView:RelativeCullingThreshold", 1e-75);
+
350 double absoluteCullingThreshold = relative_culling_threshold * maxFlow;
+
351 LOG_DEBUG(m_logger, "Relative culling threshold: {:0.3E} ({})", relative_culling_threshold, absoluteCullingThreshold);
+
352 std::vector<const reaction::LogicalReaction*> culledReactions;
+
353 for (const auto& [reactionPtr, flowRate]: allFlows) {
+
354 bool keepReaction = false;
+
355 if (flowRate > absoluteCullingThreshold) {
+
356 LOG_TRACE_L2(m_logger, "Maintaining reaction '{}' with relative (abs) flow rate: {:0.3E} ({:0.3E} [mol/s])", reactionPtr->id(), flowRate/maxFlow, flowRate);
+
357 keepReaction = true;
+
358 } else {
+
359 bool zero_flow_due_to_reachable_reactants = false;
+
360 if (flowRate < 1e-99) {
+
361 for (const auto& reactant: reactionPtr->reactants()) {
+
362 const auto it = std::ranges::find(m_baseEngine.getNetworkSpecies(), reactant);
+
363 const size_t index = std::distance(m_baseEngine.getNetworkSpecies().begin(), it);
+
364 if (Y_full[index] < 1e-99 && reachableSpecies.contains(reactant)) {
+
365 LOG_TRACE_L2(m_logger, "Maintaining reaction '{}' with zero flow due to reachable reactant '{}'.", reactionPtr->id(), reactant.name());
+
366 zero_flow_due_to_reachable_reactants = true;
+
367 break;
+
368 }
+
369 }
+
370 }
+
371 if (zero_flow_due_to_reachable_reactants) {
+
372 keepReaction = true;
+
373 }
+
374 }
+
375 if (keepReaction) {
+
376 culledReactions.push_back(reactionPtr);
+
377 } else {
+
378 LOG_TRACE_L1(m_logger, "Culling reaction '{}' due to low flow rate or lack of connectivity.", reactionPtr->id());
+
379 }
+
380 }
+
381 LOG_DEBUG(m_logger, "Selected {} (total: {}, culled: {}) reactions based on flow rates.", culledReactions.size(), allFlows.size(), allFlows.size() - culledReactions.size());
+
382 return culledReactions;
+
383 }
-
327
-
-
328 std::vector<double> AdaptiveEngineView::mapFullToCulled(const std::vector<double>& full) const {
-
329 std::vector<double> culled(m_activeSpecies.size(), 0.0);
-
330 for (size_t i_culled = 0; i_culled < m_activeSpecies.size(); ++i_culled) {
-
331 const size_t i_full = m_speciesIndexMap[i_culled];
-
332 culled[i_culled] = full[i_full];
-
333 }
-
334 return culled;
-
335 }
+
384
+
+ +
386 const std::vector<const reaction::LogicalReaction *> &finalReactions
+
387 ) {
+
388 std::unordered_set<Species>finalSpeciesSet;
+
389 m_activeReactions.clear();
+
390 for (const auto* reactionPtr: finalReactions) {
+
391 m_activeReactions.add_reaction(*reactionPtr);
+
392 for (const auto& reactant : reactionPtr->reactants()) {
+
393 finalSpeciesSet.insert(reactant);
+
394 }
+
395 for (const auto& product : reactionPtr->products()) {
+
396 finalSpeciesSet.insert(product);
+
397 }
+
398 }
+
399 m_activeSpecies.assign(finalSpeciesSet.begin(), finalSpeciesSet.end());
+
400 std::ranges::sort(
+ +
402 [](const Species &a, const Species &b) { return a.mass() < b.mass(); }
+
403 );
+
404 }
-
336
-
-
337 size_t AdaptiveEngineView::mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const {
-
338 if (culledSpeciesIndex < 0 || culledSpeciesIndex >= static_cast<int>(m_speciesIndexMap.size())) {
-
339 LOG_ERROR(m_logger, "Culled index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
-
340 m_logger->flush_log();
-
341 throw std::out_of_range("Culled index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
-
342 }
-
343 return m_speciesIndexMap[culledSpeciesIndex];
-
344 }
-
-
345
-
-
346 size_t AdaptiveEngineView::mapCulledToFullReactionIndex(size_t culledReactionIndex) const {
-
347 if (culledReactionIndex < 0 || culledReactionIndex >= static_cast<int>(m_reactionIndexMap.size())) {
-
348 LOG_ERROR(m_logger, "Culled index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
-
349 m_logger->flush_log();
-
350 throw std::out_of_range("Culled index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");
-
351 }
-
352 return m_reactionIndexMap[culledReactionIndex];
-
353 }
-
-
354
-
- -
356 if (m_isStale) {
-
357 LOG_ERROR(m_logger, "AdaptiveEngineView is stale. Please call update() before calculating RHS and energy.");
-
358 m_logger->flush_log();
-
359 throw std::runtime_error("AdaptiveEngineView is stale. Please call update() before calculating RHS and energy.");
-
360 }
-
361 }
-
-
362}
-
363
-
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y_culled, double T9, double rho) const override
Calculates the molar reaction flow for a given reaction in the active network.
-
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of active logical reactions in the network.
- -
reaction::LogicalReactionSet m_activeReactions
-
std::vector< size_t > m_reactionIndexMap
-
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the active reactions and species.
-
size_t mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const
Maps a culled species index to a full species index.
-
std::vector< double > mapFullToCulled(const std::vector< double > &full) const
Maps a vector of full abundances to a vector of culled abundances.
-
void update(const NetIn &netIn)
Updates the active species and reactions based on the current conditions.
-
double getJacobianMatrixEntry(const int i_culled, const int j_culled) const override
Gets an entry from the Jacobian matrix for the active species.
- -
std::vector< size_t > m_speciesIndexMap
- -
int getStoichiometryMatrixEntry(const int speciesIndex_culled, const int reactionIndex_culled) const override
Gets an entry from the stoichiometry matrix for the active species and reactions.
-
std::vector< double > mapCulledToFull(const std::vector< double > &culled) const
Maps a vector of culled abundances to a vector of full abundances.
-
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y_culled, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation for the active species.
+
405}
+
406
+
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y_culled, double T9, double rho) const override
Calculates the molar reaction flow for a given reaction in the active network.
+
screening::ScreeningType getScreeningModel() const override
+
std::unordered_set< fourdst::atomic::Species > findReachableSpecies(const NetIn &netIn) const
+
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of active logical reactions in the network.
+ +
reaction::LogicalReactionSet m_activeReactions
+
std::vector< size_t > m_reactionIndexMap
+
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the active reactions and species.
+
size_t mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const
Maps a culled species index to a full species index.
+
std::vector< double > mapFullToCulled(const std::vector< double > &full) const
Maps a vector of full abundances to a vector of culled abundances.
+
std::vector< const reaction::LogicalReaction * > cullReactionsByFlow(const std::vector< ReactionFlow > &allFlows, const std::unordered_set< fourdst::atomic::Species > &reachableSpecies, const std::vector< double > &Y_full, double maxFlow) const
+
double getJacobianMatrixEntry(const int i_culled, const int j_culled) const override
Gets an entry from the Jacobian matrix for the active species.
+ +
std::vector< size_t > m_speciesIndexMap
+ +
int getStoichiometryMatrixEntry(const int speciesIndex_culled, const int reactionIndex_culled) const override
Gets an entry from the stoichiometry matrix for the active species and reactions.
+
std::vector< double > mapCulledToFull(const std::vector< double > &culled) const
Maps a vector of culled abundances to a vector of full abundances.
+
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y_culled, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation for the active species.
+
void update(const NetIn &netIn) override
Updates the active species and reactions based on the current conditions.
std::vector< size_t > constructReactionIndexMap() const
Constructs the reaction index map.
std::vector< size_t > constructSpeciesIndexMap() const
Constructs the species index map.
-
size_t mapCulledToFullReactionIndex(size_t culledReactionIndex) const
Maps a culled reaction index to a full reaction index.
-
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y_culled, double T9, double rho) const override
Computes timescales for all active species in the network.
- -
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of active species in the network.
-
void generateJacobianMatrix(const std::vector< double > &Y_culled, const double T9, const double rho) override
Generates the Jacobian matrix for the active species.
+
size_t mapCulledToFullReactionIndex(size_t culledReactionIndex) const
Maps a culled reaction index to a full reaction index.
+
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y_culled, double T9, double rho) const override
Computes timescales for all active species in the network.
+
void finalizeActiveSet(const std::vector< const reaction::LogicalReaction * > &finalReactions)
+
void setScreeningModel(screening::ScreeningType model) override
+
std::vector< ReactionFlow > calculateAllReactionFlows(const NetIn &netIn, std::vector< double > &out_Y_Full) const
+ +
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of active species in the network.
+
void generateJacobianMatrix(const std::vector< double > &Y_culled, const double T9, const double rho) override
Generates the Jacobian matrix for the active species.
AdaptiveEngineView(DynamicEngine &baseEngine)
Constructs an AdaptiveEngineView.
-
void validateState() const
Validates that the AdaptiveEngineView is not stale.
-
std::vector< fourdst::atomic::Species > m_activeSpecies
-
Abstract class for engines supporting Jacobian and stoichiometry operations.
-
A collection of LogicalReaction objects.
Definition reaction.h:554
-
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:71
+
void validateState() const
Validates that the AdaptiveEngineView is not stale.
+
std::vector< fourdst::atomic::Species > m_activeSpecies
+
Abstract class for engines supporting Jacobian and stoichiometry operations.
+
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:72
- - + +
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
Definition reaction.h:557
+ +
double density
Density in g/cm^3.
Definition network.h:58
fourdst::composition::Composition composition
Composition of the network.
Definition network.h:54
double temperature
Temperature in Kelvin.
Definition network.h:57
-
Structure holding derivatives and energy generation for a network step.
-
T nuclearEnergyGenerationRate
Specific energy generation rate (e.g., erg/g/s).
-
std::vector< T > dydt
Derivatives of abundances (dY/dt for each species).
+
Structure holding derivatives and energy generation for a network step.
+
T nuclearEnergyGenerationRate
Specific energy generation rate (e.g., erg/g/s).
+
std::vector< T > dydt
Derivatives of abundances (dY/dt for each species).
diff --git a/docs/html/engine__adaptive_8h.html b/docs/html/engine__adaptive_8h.html index 0f1ad599..fca7517d 100644 --- a/docs/html/engine__adaptive_8h.html +++ b/docs/html/engine__adaptive_8h.html @@ -5,7 +5,7 @@ -GridFire: src/network/include/gridfire/engine/engine_adaptive.h File Reference +GridFire: src/network/include/gridfire/engine/views/engine_adaptive.h File Reference @@ -106,7 +106,9 @@ $(function(){initNavTree('engine__adaptive_8h.html',''); initResizable(true); })
#include "gridfire/engine/engine_abstract.h"
-#include "gridfire/engine/engine_view_abstract.h"
+#include "gridfire/engine/views/engine_view_abstract.h"
+#include "gridfire/screening/screening_abstract.h"
+#include "gridfire/screening/screening_types.h"
#include "gridfire/network.h"
#include "fourdst/composition/atomicSpecies.h"
#include "fourdst/config/config.h"
@@ -134,7 +136,7 @@ Namespaces diff --git a/docs/html/engine__adaptive_8h_source.html b/docs/html/engine__adaptive_8h_source.html index 33672e87..6c1e5d54 100644 --- a/docs/html/engine__adaptive_8h_source.html +++ b/docs/html/engine__adaptive_8h_source.html @@ -5,7 +5,7 @@ -GridFire: src/network/include/gridfire/engine/engine_adaptive.h Source File +GridFire: src/network/include/gridfire/engine/views/engine_adaptive.h Source File @@ -104,154 +104,187 @@ $(function(){initNavTree('engine__adaptive_8h_source.html',''); initResizable(tr
Go to the documentation of this file.
1#pragma once
- -
4#include "gridfire/network.h"
-
5
-
6#include "fourdst/composition/atomicSpecies.h"
-
7#include "fourdst/config/config.h"
-
8#include "fourdst/logging/logging.h"
-
9
-
10#include "quill/Logger.h"
+ + + +
6#include "gridfire/network.h"
+
7
+
8#include "fourdst/composition/atomicSpecies.h"
+
9#include "fourdst/config/config.h"
+
10#include "fourdst/logging/logging.h"
11
-
12namespace gridfire {
-
-
45 class AdaptiveEngineView final : public DynamicEngine, public EngineView<DynamicEngine> {
-
46 public:
-
55 explicit AdaptiveEngineView(DynamicEngine& baseEngine);
-
56
-
74 void update(const NetIn& netIn);
-
75
-
80 const std::vector<fourdst::atomic::Species>& getNetworkSpecies() const override;
-
81
- -
99 const std::vector<double> &Y_culled,
-
100 const double T9,
-
101 const double rho
-
102 ) const override;
-
103
- -
118 const std::vector<double> &Y_culled,
-
119 const double T9,
-
120 const double rho
-
121 ) override;
-
122
- -
138 const int i_culled,
-
139 const int j_culled
-
140 ) const override;
-
141
-
151 void generateStoichiometryMatrix() override;
-
152
- -
168 const int speciesIndex_culled,
-
169 const int reactionIndex_culled
-
170 ) const override;
-
171
- - -
189 const std::vector<double> &Y_culled,
-
190 double T9,
-
191 double rho
-
192 ) const override;
-
193
- -
200
-
214 std::unordered_map<fourdst::atomic::Species, double> getSpeciesTimescales(
-
215 const std::vector<double> &Y_culled,
-
216 double T9,
-
217 double rho
-
218 ) const override;
-
219
-
224 const DynamicEngine& getBaseEngine() const override { return m_baseEngine; }
-
225 private:
-
226 using Config = fourdst::config::Config;
-
227 using LogManager = fourdst::logging::LogManager;
-
228 Config& m_config = Config::getInstance();
-
229 quill::Logger* m_logger = LogManager::getInstance().getLogger("log");
-
230
- -
232
-
233 std::vector<fourdst::atomic::Species> m_activeSpecies;
- -
235
-
236 std::vector<size_t> m_speciesIndexMap;
-
237 std::vector<size_t> m_reactionIndexMap;
+
12#include "quill/Logger.h"
+
13
+
14namespace gridfire {
+
+
47 class AdaptiveEngineView final : public DynamicEngine, public EngineView<DynamicEngine> {
+
48 public:
+
57 explicit AdaptiveEngineView(DynamicEngine& baseEngine);
+
58
+
76 void update(const NetIn& netIn) override;
+
77
+
82 [[nodiscard]] const std::vector<fourdst::atomic::Species>& getNetworkSpecies() const override;
+
83
+ +
101 const std::vector<double> &Y_culled,
+
102 const double T9,
+
103 const double rho
+
104 ) const override;
+
105
+ +
120 const std::vector<double> &Y_culled,
+
121 const double T9,
+
122 const double rho
+
123 ) override;
+
124
+
139 [[nodiscard]] double getJacobianMatrixEntry(
+
140 const int i_culled,
+
141 const int j_culled
+
142 ) const override;
+
143
+
153 void generateStoichiometryMatrix() override;
+
154
+
169 [[nodiscard]] int getStoichiometryMatrixEntry(
+
170 const int speciesIndex_culled,
+
171 const int reactionIndex_culled
+
172 ) const override;
+
173
+
189 [[nodiscard]] double calculateMolarReactionFlow(
+ +
191 const std::vector<double> &Y_culled,
+
192 double T9,
+
193 double rho
+
194 ) const override;
+
195
+
201 [[nodiscard]] const reaction::LogicalReactionSet& getNetworkReactions() const override;
+
202
+
216 [[nodiscard]] std::unordered_map<fourdst::atomic::Species, double> getSpeciesTimescales(
+
217 const std::vector<double> &Y_culled,
+
218 double T9,
+
219 double rho
+
220 ) const override;
+
221
+
226 [[nodiscard]] const DynamicEngine& getBaseEngine() const override { return m_baseEngine; }
+
227
+
228 void setScreeningModel(screening::ScreeningType model) override;
+
229
+
230 [[nodiscard]] screening::ScreeningType getScreeningModel() const override;
+
231 private:
+
232 using Config = fourdst::config::Config;
+
233 using LogManager = fourdst::logging::LogManager;
+
234 Config& m_config = Config::getInstance();
+
235 quill::Logger* m_logger = LogManager::getInstance().getLogger("log");
+
236
+
238
-
239 bool m_isStale = true;
-
240
-
241 private:
-
252 std::vector<size_t> constructSpeciesIndexMap() const;
-
253
-
264 std::vector<size_t> constructReactionIndexMap() const;
-
265
-
273 std::vector<double> mapCulledToFull(const std::vector<double>& culled) const;
-
274
-
282 std::vector<double> mapFullToCulled(const std::vector<double>& full) const;
-
283
-
292 size_t mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const;
-
293
-
302 size_t mapCulledToFullReactionIndex(size_t culledReactionIndex) const;
-
303
-
309 void validateState() const;
-
310 private:
-
- - -
316 double flowRate;
-
317 };
+
239 std::vector<fourdst::atomic::Species> m_activeSpecies;
+ +
241
+
242 std::vector<size_t> m_speciesIndexMap;
+
243 std::vector<size_t> m_reactionIndexMap;
+
244
+
245 bool m_isStale = true;
+
246
+
247 private:
+ -
318 };
+
255 private:
+
266 [[nodiscard]] std::vector<size_t> constructSpeciesIndexMap() const;
+
267
+
278 [[nodiscard]] std::vector<size_t> constructReactionIndexMap() const;
+
279
+
287 [[nodiscard]] std::vector<double> mapCulledToFull(const std::vector<double>& culled) const;
+
288
+
296 [[nodiscard]] std::vector<double> mapFullToCulled(const std::vector<double>& full) const;
+
297
+
306 [[nodiscard]] size_t mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const;
+
307
+
316 [[nodiscard]] size_t mapCulledToFullReactionIndex(size_t culledReactionIndex) const;
+
317
+
323 void validateState() const;
+
324
+
325 std::vector<ReactionFlow> calculateAllReactionFlows(
+
326 const NetIn& netIn,
+
327 std::vector<double>& out_Y_Full
+
328 ) const;
+
329 [[nodiscard]] std::unordered_set<fourdst::atomic::Species> findReachableSpecies(
+
330 const NetIn& netIn
+
331 ) const;
+
332 [[nodiscard]] std::vector<const reaction::LogicalReaction*> cullReactionsByFlow(
+
333 const std::vector<ReactionFlow>& allFlows,
+
334 const std::unordered_set<fourdst::atomic::Species>& reachableSpecies,
+
335 const std::vector<double>& Y_full,
+
336 double maxFlow
+
337 ) const;
+ +
339 const std::vector<const reaction::LogicalReaction*>& finalReactions
+
340 );
+
341 };
-
319}
-
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y_culled, double T9, double rho) const override
Calculates the molar reaction flow for a given reaction in the active network.
-
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of active logical reactions in the network.
- -
reaction::LogicalReactionSet m_activeReactions
-
std::vector< size_t > m_reactionIndexMap
-
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the active reactions and species.
-
size_t mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const
Maps a culled species index to a full species index.
-
std::vector< double > mapFullToCulled(const std::vector< double > &full) const
Maps a vector of full abundances to a vector of culled abundances.
-
void update(const NetIn &netIn)
Updates the active species and reactions based on the current conditions.
-
double getJacobianMatrixEntry(const int i_culled, const int j_culled) const override
Gets an entry from the Jacobian matrix for the active species.
- -
fourdst::logging::LogManager LogManager
-
std::vector< size_t > m_speciesIndexMap
- -
int getStoichiometryMatrixEntry(const int speciesIndex_culled, const int reactionIndex_culled) const override
Gets an entry from the stoichiometry matrix for the active species and reactions.
-
std::vector< double > mapCulledToFull(const std::vector< double > &culled) const
Maps a vector of culled abundances to a vector of full abundances.
-
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y_culled, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation for the active species.
+
342}
+
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y_culled, double T9, double rho) const override
Calculates the molar reaction flow for a given reaction in the active network.
+
screening::ScreeningType getScreeningModel() const override
+
std::unordered_set< fourdst::atomic::Species > findReachableSpecies(const NetIn &netIn) const
+
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of active logical reactions in the network.
+ +
reaction::LogicalReactionSet m_activeReactions
+
std::vector< size_t > m_reactionIndexMap
+
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the active reactions and species.
+
size_t mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const
Maps a culled species index to a full species index.
+
std::vector< double > mapFullToCulled(const std::vector< double > &full) const
Maps a vector of full abundances to a vector of culled abundances.
+
std::vector< const reaction::LogicalReaction * > cullReactionsByFlow(const std::vector< ReactionFlow > &allFlows, const std::unordered_set< fourdst::atomic::Species > &reachableSpecies, const std::vector< double > &Y_full, double maxFlow) const
+
double getJacobianMatrixEntry(const int i_culled, const int j_culled) const override
Gets an entry from the Jacobian matrix for the active species.
+ +
fourdst::logging::LogManager LogManager
+
std::vector< size_t > m_speciesIndexMap
+ +
int getStoichiometryMatrixEntry(const int speciesIndex_culled, const int reactionIndex_culled) const override
Gets an entry from the stoichiometry matrix for the active species and reactions.
+
std::vector< double > mapCulledToFull(const std::vector< double > &culled) const
Maps a vector of culled abundances to a vector of full abundances.
+
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y_culled, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation for the active species.
+
void update(const NetIn &netIn) override
Updates the active species and reactions based on the current conditions.
std::vector< size_t > constructReactionIndexMap() const
Constructs the reaction index map.
std::vector< size_t > constructSpeciesIndexMap() const
Constructs the species index map.
-
size_t mapCulledToFullReactionIndex(size_t culledReactionIndex) const
Maps a culled reaction index to a full reaction index.
-
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y_culled, double T9, double rho) const override
Computes timescales for all active species in the network.
- -
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of active species in the network.
-
void generateJacobianMatrix(const std::vector< double > &Y_culled, const double T9, const double rho) override
Generates the Jacobian matrix for the active species.
+
size_t mapCulledToFullReactionIndex(size_t culledReactionIndex) const
Maps a culled reaction index to a full reaction index.
+
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y_culled, double T9, double rho) const override
Computes timescales for all active species in the network.
+
void finalizeActiveSet(const std::vector< const reaction::LogicalReaction * > &finalReactions)
+
void setScreeningModel(screening::ScreeningType model) override
+
std::vector< ReactionFlow > calculateAllReactionFlows(const NetIn &netIn, std::vector< double > &out_Y_Full) const
+ +
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of active species in the network.
+
void generateJacobianMatrix(const std::vector< double > &Y_culled, const double T9, const double rho) override
Generates the Jacobian matrix for the active species.
AdaptiveEngineView(DynamicEngine &baseEngine)
Constructs an AdaptiveEngineView.
-
void validateState() const
Validates that the AdaptiveEngineView is not stale.
-
const DynamicEngine & getBaseEngine() const override
Gets the base engine.
-
std::vector< fourdst::atomic::Species > m_activeSpecies
-
fourdst::config::Config Config
-
Abstract class for engines supporting Jacobian and stoichiometry operations.
+
void validateState() const
Validates that the AdaptiveEngineView is not stale.
+
const DynamicEngine & getBaseEngine() const override
Gets the base engine.
+
std::vector< fourdst::atomic::Species > m_activeSpecies
+
fourdst::config::Config Config
+
Abstract class for engines supporting Jacobian and stoichiometry operations.
Abstract base class for a "view" of a reaction network engine.
-
A collection of LogicalReaction objects.
Definition reaction.h:554
-
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:71
+
Represents a "logical" reaction that aggregates rates from multiple sources.
Definition reaction.h:308
+
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:72
Abstract interfaces for reaction network engines in GridFire.
Abstract interfaces for engine "views" in GridFire.
- - + +
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
Definition reaction.h:557
+ + -
A struct to hold a reaction and its flow rate.
- - + + +
A struct to hold a reaction and its flow rate.
+
const reaction::LogicalReaction * reactionPtr
+ -
Structure holding derivatives and energy generation for a network step.
+
Structure holding derivatives and energy generation for a network step.
diff --git a/docs/html/engine__approx8_8cpp_source.html b/docs/html/engine__approx8_8cpp_source.html index 6d5cc65d..1c08eba4 100644 --- a/docs/html/engine__approx8_8cpp_source.html +++ b/docs/html/engine__approx8_8cpp_source.html @@ -662,26 +662,25 @@ $(function(){initNavTree('engine__approx8_8cpp_source.html',''); initResizable(t
511 y[Approx8Net::ih1] = netIn.composition.getNumberFraction("H-1");
-
512 std::cout << "Approx8::convert_netIn -> H-1 fraction: " << y[Approx8Net::ih1] << std::endl;
-
513 y[Approx8Net::ihe3] = netIn.composition.getNumberFraction("He-3");
-
514 y[Approx8Net::ihe4] = netIn.composition.getNumberFraction("He-4");
-
515 y[Approx8Net::ic12] = netIn.composition.getNumberFraction("C-12");
-
516 y[Approx8Net::in14] = netIn.composition.getNumberFraction("N-14");
-
517 y[Approx8Net::io16] = netIn.composition.getNumberFraction("O-16");
-
518 y[Approx8Net::ine20] = netIn.composition.getNumberFraction("Ne-20");
-
519 y[Approx8Net::img24] = netIn.composition.getNumberFraction("Mg-24");
- -
521 y[Approx8Net::iDensity] = netIn.density;
-
522 y[Approx8Net::iEnergy] = netIn.energy;
-
523
-
524 return y;
-
525 }
+
512 y[Approx8Net::ihe3] = netIn.composition.getNumberFraction("He-3");
+
513 y[Approx8Net::ihe4] = netIn.composition.getNumberFraction("He-4");
+
514 y[Approx8Net::ic12] = netIn.composition.getNumberFraction("C-12");
+
515 y[Approx8Net::in14] = netIn.composition.getNumberFraction("N-14");
+
516 y[Approx8Net::io16] = netIn.composition.getNumberFraction("O-16");
+
517 y[Approx8Net::ine20] = netIn.composition.getNumberFraction("Ne-20");
+
518 y[Approx8Net::img24] = netIn.composition.getNumberFraction("Mg-24");
+ +
520 y[Approx8Net::iDensity] = netIn.density;
+
521 y[Approx8Net::iEnergy] = netIn.energy;
+
522
+
523 return y;
+
524 }
-
526};
+
525};
+
526
527
-
528
-
529// main program
-
530
+
528// main program
+
529
Network(const NetworkFormat format=NetworkFormat::APPROX8)
Definition network.cpp:41
quill::Logger * m_logger
Logger instance.
Definition network.h:98
fourdst::config::Config & m_config
Configuration instance.
Definition network.h:96
diff --git a/docs/html/engine__graph_8cpp.html b/docs/html/engine__graph_8cpp.html index 4edabcb1..6aaa09f1 100644 --- a/docs/html/engine__graph_8cpp.html +++ b/docs/html/engine__graph_8cpp.html @@ -107,6 +107,7 @@ $(function(){initNavTree('engine__graph_8cpp.html',''); initResizable(true); });
#include "gridfire/engine/engine_graph.h"
#include "gridfire/reaction/reaction.h"
#include "gridfire/network.h"
+#include "gridfire/screening/screening_types.h"
#include "fourdst/composition/species.h"
#include "fourdst/composition/atomicSpecies.h"
#include "quill/LogMacros.h"
diff --git a/docs/html/engine__graph_8cpp_source.html b/docs/html/engine__graph_8cpp_source.html index 5006f9f7..b3f2cfbc 100644 --- a/docs/html/engine__graph_8cpp_source.html +++ b/docs/html/engine__graph_8cpp_source.html @@ -105,583 +105,612 @@ $(function(){initNavTree('engine__graph_8cpp_source.html',''); initResizable(tru Go to the documentation of this file.
3#include "gridfire/network.h"
-
4
-
5#include "fourdst/composition/species.h"
-
6#include "fourdst/composition/atomicSpecies.h"
-
7
-
8#include "quill/LogMacros.h"
-
9
-
10#include <cstdint>
-
11#include <iostream>
-
12#include <set>
-
13#include <stdexcept>
-
14#include <string>
-
15#include <string_view>
-
16#include <unordered_map>
-
17#include <utility>
-
18#include <vector>
-
19#include <fstream>
-
20
-
21#include <boost/numeric/odeint.hpp>
-
22
+ +
5
+
6#include "fourdst/composition/species.h"
+
7#include "fourdst/composition/atomicSpecies.h"
+
8
+
9#include "quill/LogMacros.h"
+
10
+
11#include <cstdint>
+
12#include <iostream>
+
13#include <set>
+
14#include <stdexcept>
+
15#include <string>
+
16#include <string_view>
+
17#include <unordered_map>
+
18#include <utility>
+
19#include <vector>
+
20#include <fstream>
+
21
+
22#include <boost/numeric/odeint.hpp>
23
-
24namespace gridfire {
-
- -
26 const fourdst::composition::Composition &composition
-
27 ):
-
28 m_reactions(build_reaclib_nuclear_network(composition, false)) {
- -
30 }
+
24
+
25namespace gridfire {
+
+ +
27 const fourdst::composition::Composition &composition
+
28 ):
+
29 m_reactions(build_reaclib_nuclear_network(composition, false)) {
+ +
31 }
-
31
-
- -
33 m_reactions(std::move(reactions)) {
- -
35 }
+
32
+
+ +
34 m_reactions(std::move(reactions)) {
+ +
36 }
-
36
-
- -
38 const std::vector<double> &Y,
-
39 const double T9,
-
40 const double rho
-
41 ) const {
-
42 return calculateAllDerivatives<double>(Y, T9, rho);
-
43 }
+
37
+
+ +
39 const std::vector<double> &Y,
+
40 const double T9,
+
41 const double rho
+
42 ) const {
+
43 return calculateAllDerivatives<double>(Y, T9, rho);
+
44 }
-
44
45
-
- - - - - - - -
53 }
+
46
+ -
54
-
55 // --- Network Graph Construction Methods ---
-
- -
57 m_networkSpecies.clear();
-
58 m_networkSpeciesMap.clear();
-
59
-
60 std::set<std::string_view> uniqueSpeciesNames;
-
61
-
62 for (const auto& reaction: m_reactions) {
-
63 for (const auto& reactant: reaction.reactants()) {
-
64 uniqueSpeciesNames.insert(reactant.name());
-
65 }
-
66 for (const auto& product: reaction.products()) {
-
67 uniqueSpeciesNames.insert(product.name());
-
68 }
-
69 }
-
70
-
71 for (const auto& name: uniqueSpeciesNames) {
-
72 auto it = fourdst::atomic::species.find(std::string(name));
-
73 if (it != fourdst::atomic::species.end()) {
-
74 m_networkSpecies.push_back(it->second);
-
75 m_networkSpeciesMap.insert({name, it->second});
-
76 } else {
-
77 LOG_ERROR(m_logger, "Species '{}' not found in global atomic species database.", name);
-
78 m_logger->flush_log();
-
79 throw std::runtime_error("Species not found in global atomic species database: " + std::string(name));
-
80 }
-
81 }
-
82
-
83 }
+
55
+
56 // --- Network Graph Construction Methods ---
+
+ +
58 m_networkSpecies.clear();
+
59 m_networkSpeciesMap.clear();
+
60
+
61 std::set<std::string_view> uniqueSpeciesNames;
+
62
+
63 for (const auto& reaction: m_reactions) {
+
64 for (const auto& reactant: reaction.reactants()) {
+
65 uniqueSpeciesNames.insert(reactant.name());
+
66 }
+
67 for (const auto& product: reaction.products()) {
+
68 uniqueSpeciesNames.insert(product.name());
+
69 }
+
70 }
+
71
+
72 for (const auto& name: uniqueSpeciesNames) {
+
73 auto it = fourdst::atomic::species.find(std::string(name));
+
74 if (it != fourdst::atomic::species.end()) {
+
75 m_networkSpecies.push_back(it->second);
+
76 m_networkSpeciesMap.insert({name, it->second});
+
77 } else {
+
78 LOG_ERROR(m_logger, "Species '{}' not found in global atomic species database.", name);
+
79 m_logger->flush_log();
+
80 throw std::runtime_error("Species not found in global atomic species database: " + std::string(name));
+
81 }
+
82 }
+
83
+
84 }
-
84
-
- -
86 LOG_TRACE_L1(m_logger, "Populating reaction ID map for REACLIB graph network (serif::network::GraphNetwork)...");
-
87 m_reactionIDMap.clear();
-
88 for (auto& reaction: m_reactions) {
-
89 m_reactionIDMap.emplace(reaction.id(), &reaction);
-
90 }
-
91 LOG_TRACE_L1(m_logger, "Populated {} reactions in the reaction ID map.", m_reactionIDMap.size());
-
92 }
+
85
+
+ +
87 LOG_TRACE_L1(m_logger, "Populating reaction ID map for REACLIB graph network (serif::network::GraphNetwork)...");
+
88 m_reactionIDMap.clear();
+
89 for (auto& reaction: m_reactions) {
+
90 m_reactionIDMap.emplace(reaction.id(), &reaction);
+
91 }
+
92 LOG_TRACE_L1(m_logger, "Populated {} reactions in the reaction ID map.", m_reactionIDMap.size());
+
93 }
-
93
-
- -
95 m_speciesToIndexMap.clear();
-
96 for (size_t i = 0; i < m_networkSpecies.size(); ++i) {
- -
98 }
-
99 }
+
94
+
+ +
96 m_speciesToIndexMap.clear();
+
97 for (size_t i = 0; i < m_networkSpecies.size(); ++i) {
+ +
99 }
+
100 }
-
100
-
- -
102 // The implementation of this function (and others) constrains this nuclear network to a constant temperature and density during
-
103 // each evaluation.
-
104 size_t numSpecies = m_networkSpecies.size();
-
105 m_jacobianMatrix.clear();
-
106 m_jacobianMatrix.resize(numSpecies, numSpecies, false); // Sparse matrix, no initial values
-
107 LOG_TRACE_L2(m_logger, "Jacobian matrix resized to {} rows and {} columns.",
-
108 m_jacobianMatrix.size1(), m_jacobianMatrix.size2());
-
109 }
+
101
+
+ +
103 // The implementation of this function (and others) constrains this nuclear network to a constant temperature and density during
+
104 // each evaluation.
+
105 size_t numSpecies = m_networkSpecies.size();
+
106 m_jacobianMatrix.clear();
+
107 m_jacobianMatrix.resize(numSpecies, numSpecies, false); // Sparse matrix, no initial values
+
108 LOG_TRACE_L2(m_logger, "Jacobian matrix resized to {} rows and {} columns.",
+
109 m_jacobianMatrix.size1(), m_jacobianMatrix.size2());
+
110 }
-
110
-
111 // --- Basic Accessors and Queries ---
-
-
112 const std::vector<fourdst::atomic::Species>& GraphEngine::getNetworkSpecies() const {
-
113 // Returns a constant reference to the vector of unique species in the network.
-
114 LOG_TRACE_L3(m_logger, "Providing access to network species vector. Size: {}.", m_networkSpecies.size());
-
115 return m_networkSpecies;
-
116 }
+
111
+
112 // --- Basic Accessors and Queries ---
+
+
113 const std::vector<fourdst::atomic::Species>& GraphEngine::getNetworkSpecies() const {
+
114 // Returns a constant reference to the vector of unique species in the network.
+
115 LOG_TRACE_L3(m_logger, "Providing access to network species vector. Size: {}.", m_networkSpecies.size());
+
116 return m_networkSpecies;
+
117 }
-
117
-
- -
119 // Returns a constant reference to the set of reactions in the network.
-
120 LOG_TRACE_L3(m_logger, "Providing access to network reactions set. Size: {}.", m_reactions.size());
-
121 return m_reactions;
-
122 }
+
118
+
+ +
120 // Returns a constant reference to the set of reactions in the network.
+
121 LOG_TRACE_L3(m_logger, "Providing access to network reactions set. Size: {}.", m_reactions.size());
+
122 return m_reactions;
+
123 }
-
123
-
-
124 bool GraphEngine::involvesSpecies(const fourdst::atomic::Species& species) const {
-
125 // Checks if a given species is present in the network's species map for efficient lookup.
-
126 const bool found = m_networkSpeciesMap.contains(species.name());
-
127 LOG_DEBUG(m_logger, "Checking if species '{}' is involved in the network: {}.", species.name(), found ? "Yes" : "No");
-
128 return found;
-
129 }
+
124
+
+
125 bool GraphEngine::involvesSpecies(const fourdst::atomic::Species& species) const {
+
126 // Checks if a given species is present in the network's species map for efficient lookup.
+
127 const bool found = m_networkSpeciesMap.contains(species.name());
+
128 LOG_DEBUG(m_logger, "Checking if species '{}' is involved in the network: {}.", species.name(), found ? "Yes" : "No");
+
129 return found;
+
130 }
-
130
-
131 // --- Validation Methods ---
-
- -
133 LOG_TRACE_L1(m_logger, "Validating mass (A) and charge (Z) conservation across all reactions in the network.");
-
134
-
135 for (const auto& reaction : m_reactions) {
-
136 uint64_t totalReactantA = 0;
-
137 uint64_t totalReactantZ = 0;
-
138 uint64_t totalProductA = 0;
-
139 uint64_t totalProductZ = 0;
-
140
-
141 // Calculate total A and Z for reactants
-
142 for (const auto& reactant : reaction.reactants()) {
-
143 auto it = m_networkSpeciesMap.find(reactant.name());
-
144 if (it != m_networkSpeciesMap.end()) {
-
145 totalReactantA += it->second.a();
-
146 totalReactantZ += it->second.z();
-
147 } else {
-
148 // This scenario indicates a severe data integrity issue:
-
149 // a reactant is part of a reaction but not in the network's species map.
-
150 LOG_ERROR(m_logger, "CRITICAL ERROR: Reactant species '{}' in reaction '{}' not found in network species map during conservation validation.",
-
151 reactant.name(), reaction.id());
-
152 return false;
-
153 }
-
154 }
-
155
-
156 // Calculate total A and Z for products
-
157 for (const auto& product : reaction.products()) {
-
158 auto it = m_networkSpeciesMap.find(product.name());
-
159 if (it != m_networkSpeciesMap.end()) {
-
160 totalProductA += it->second.a();
-
161 totalProductZ += it->second.z();
-
162 } else {
-
163 // Similar critical error for product species
-
164 LOG_ERROR(m_logger, "CRITICAL ERROR: Product species '{}' in reaction '{}' not found in network species map during conservation validation.",
-
165 product.name(), reaction.id());
-
166 return false;
-
167 }
-
168 }
-
169
-
170 // Compare totals for conservation
-
171 if (totalReactantA != totalProductA) {
-
172 LOG_ERROR(m_logger, "Mass number (A) not conserved for reaction '{}': Reactants A={} vs Products A={}.",
-
173 reaction.id(), totalReactantA, totalProductA);
-
174 return false;
-
175 }
-
176 if (totalReactantZ != totalProductZ) {
-
177 LOG_ERROR(m_logger, "Atomic number (Z) not conserved for reaction '{}': Reactants Z={} vs Products Z={}.",
-
178 reaction.id(), totalReactantZ, totalProductZ);
-
179 return false;
-
180 }
-
181 }
-
182
-
183 LOG_TRACE_L1(m_logger, "Mass (A) and charge (Z) conservation validated successfully for all reactions.");
-
184 return true; // All reactions passed the conservation check
-
185 }
+
131
+
132 // --- Validation Methods ---
+
+ +
134 LOG_TRACE_L1(m_logger, "Validating mass (A) and charge (Z) conservation across all reactions in the network.");
+
135
+
136 for (const auto& reaction : m_reactions) {
+
137 uint64_t totalReactantA = 0;
+
138 uint64_t totalReactantZ = 0;
+
139 uint64_t totalProductA = 0;
+
140 uint64_t totalProductZ = 0;
+
141
+
142 // Calculate total A and Z for reactants
+
143 for (const auto& reactant : reaction.reactants()) {
+
144 auto it = m_networkSpeciesMap.find(reactant.name());
+
145 if (it != m_networkSpeciesMap.end()) {
+
146 totalReactantA += it->second.a();
+
147 totalReactantZ += it->second.z();
+
148 } else {
+
149 // This scenario indicates a severe data integrity issue:
+
150 // a reactant is part of a reaction but not in the network's species map.
+
151 LOG_ERROR(m_logger, "CRITICAL ERROR: Reactant species '{}' in reaction '{}' not found in network species map during conservation validation.",
+
152 reactant.name(), reaction.id());
+
153 return false;
+
154 }
+
155 }
+
156
+
157 // Calculate total A and Z for products
+
158 for (const auto& product : reaction.products()) {
+
159 auto it = m_networkSpeciesMap.find(product.name());
+
160 if (it != m_networkSpeciesMap.end()) {
+
161 totalProductA += it->second.a();
+
162 totalProductZ += it->second.z();
+
163 } else {
+
164 // Similar critical error for product species
+
165 LOG_ERROR(m_logger, "CRITICAL ERROR: Product species '{}' in reaction '{}' not found in network species map during conservation validation.",
+
166 product.name(), reaction.id());
+
167 return false;
+
168 }
+
169 }
+
170
+
171 // Compare totals for conservation
+
172 if (totalReactantA != totalProductA) {
+
173 LOG_ERROR(m_logger, "Mass number (A) not conserved for reaction '{}': Reactants A={} vs Products A={}.",
+
174 reaction.id(), totalReactantA, totalProductA);
+
175 return false;
+
176 }
+
177 if (totalReactantZ != totalProductZ) {
+
178 LOG_ERROR(m_logger, "Atomic number (Z) not conserved for reaction '{}': Reactants Z={} vs Products Z={}.",
+
179 reaction.id(), totalReactantZ, totalProductZ);
+
180 return false;
+
181 }
+
182 }
+
183
+
184 LOG_TRACE_L1(m_logger, "Mass (A) and charge (Z) conservation validated successfully for all reactions.");
+
185 return true; // All reactions passed the conservation check
+
186 }
-
186
-
-
187 void GraphEngine::validateComposition(const fourdst::composition::Composition &composition, double culling, double T9) {
-
188 // Check if the requested network has already been cached.
-
189 // PERF: Rebuilding this should be pretty fast but it may be a good point of optimization in the future.
-
190 const reaction::LogicalReactionSet validationReactionSet = build_reaclib_nuclear_network(composition, false);
-
191 // TODO: need some more robust method here to
-
192 // A. Build the basic network from the composition's species with non zero mass fractions.
-
193 // B. rebuild a new composition from the reaction set's reactants + products (with the mass fractions from the things that are only products set to 0)
-
194 // C. Rebuild the reaction set from the new composition
-
195 // D. Cull reactions where all reactants have mass fractions below the culling threshold.
-
196 // E. Be careful about maintaining caching through all of this
-
197
+
187
+
+
188 void GraphEngine::validateComposition(const fourdst::composition::Composition &composition, double culling, double T9) {
+
189 // Check if the requested network has already been cached.
+
190 // PERF: Rebuilding this should be pretty fast but it may be a good point of optimization in the future.
+
191 const reaction::LogicalReactionSet validationReactionSet = build_reaclib_nuclear_network(composition, false);
+
192 // TODO: need some more robust method here to
+
193 // A. Build the basic network from the composition's species with non zero mass fractions.
+
194 // B. rebuild a new composition from the reaction set's reactants + products (with the mass fractions from the things that are only products set to 0)
+
195 // C. Rebuild the reaction set from the new composition
+
196 // D. Cull reactions where all reactants have mass fractions below the culling threshold.
+
197 // E. Be careful about maintaining caching through all of this
198
-
199 // This allows for dynamic network modification while retaining caching for networks which are very similar.
-
200 if (validationReactionSet != m_reactions) {
-
201 LOG_DEBUG(m_logger, "Reaction set not cached. Rebuilding the reaction set for T9={} and culling={}.", T9, culling);
-
202 m_reactions = std::move(validationReactionSet);
-
203 syncInternalMaps(); // Re-sync internal maps after updating reactions. Note this will also retrace the AD tape.
-
204 }
-
205 }
+
199
+
200 // This allows for dynamic network modification while retaining caching for networks which are very similar.
+
201 if (validationReactionSet != m_reactions) {
+
202 LOG_DEBUG(m_logger, "Reaction set not cached. Rebuilding the reaction set for T9={} and culling={}.", T9, culling);
+
203 m_reactions = std::move(validationReactionSet);
+
204 syncInternalMaps(); // Re-sync internal maps after updating reactions. Note this will also retrace the AD tape.
+
205 }
+
206 }
-
206
-
207 // --- Generate Stoichiometry Matrix ---
-
- -
209 LOG_TRACE_L1(m_logger, "Generating stoichiometry matrix...");
-
210
-
211 // Task 1: Set dimensions and initialize the matrix
-
212 size_t numSpecies = m_networkSpecies.size();
-
213 size_t numReactions = m_reactions.size();
-
214 m_stoichiometryMatrix.resize(numSpecies, numReactions, false);
-
215
-
216 LOG_TRACE_L1(m_logger, "Stoichiometry matrix initialized with dimensions: {} rows (species) x {} columns (reactions).",
-
217 numSpecies, numReactions);
-
218
-
219 // Task 2: Populate the stoichiometry matrix
-
220 // Iterate through all reactions, assign them a column index, and fill in their stoichiometric coefficients.
-
221 size_t reactionColumnIndex = 0;
-
222 for (const auto& reaction : m_reactions) {
-
223 // Get the net stoichiometry for the current reaction
-
224 std::unordered_map<fourdst::atomic::Species, int> netStoichiometry = reaction.stoichiometry();
-
225
-
226 // Iterate through the species and their coefficients in the stoichiometry map
-
227 for (const auto& [species, coefficient] : netStoichiometry) {
-
228 // Find the row index for this species
-
229 auto it = m_speciesToIndexMap.find(species);
-
230 if (it != m_speciesToIndexMap.end()) {
-
231 const size_t speciesRowIndex = it->second;
-
232 // Set the matrix element. Boost.uBLAS handles sparse insertion.
-
233 m_stoichiometryMatrix(speciesRowIndex, reactionColumnIndex) = coefficient;
-
234 } else {
-
235 // This scenario should ideally not happen if m_networkSpeciesMap and m_speciesToIndexMap are correctly synced
-
236 LOG_ERROR(m_logger, "CRITICAL ERROR: Species '{}' from reaction '{}' stoichiometry not found in species to index map.",
-
237 species.name(), reaction.id());
-
238 m_logger -> flush_log();
-
239 throw std::runtime_error("Species not found in species to index map: " + std::string(species.name()));
-
240 }
-
241 }
-
242 reactionColumnIndex++; // Move to the next column for the next reaction
-
243 }
-
244
-
245 LOG_TRACE_L1(m_logger, "Stoichiometry matrix population complete. Number of non-zero elements: {}.",
-
246 m_stoichiometryMatrix.nnz()); // Assuming nnz() exists for compressed_matrix
-
247 }
+
207
+
208 // --- Generate Stoichiometry Matrix ---
+
+ +
210 LOG_TRACE_L1(m_logger, "Generating stoichiometry matrix...");
+
211
+
212 // Task 1: Set dimensions and initialize the matrix
+
213 size_t numSpecies = m_networkSpecies.size();
+
214 size_t numReactions = m_reactions.size();
+
215 m_stoichiometryMatrix.resize(numSpecies, numReactions, false);
+
216
+
217 LOG_TRACE_L1(m_logger, "Stoichiometry matrix initialized with dimensions: {} rows (species) x {} columns (reactions).",
+
218 numSpecies, numReactions);
+
219
+
220 // Task 2: Populate the stoichiometry matrix
+
221 // Iterate through all reactions, assign them a column index, and fill in their stoichiometric coefficients.
+
222 size_t reactionColumnIndex = 0;
+
223 for (const auto& reaction : m_reactions) {
+
224 // Get the net stoichiometry for the current reaction
+
225 std::unordered_map<fourdst::atomic::Species, int> netStoichiometry = reaction.stoichiometry();
+
226
+
227 // Iterate through the species and their coefficients in the stoichiometry map
+
228 for (const auto& [species, coefficient] : netStoichiometry) {
+
229 // Find the row index for this species
+
230 auto it = m_speciesToIndexMap.find(species);
+
231 if (it != m_speciesToIndexMap.end()) {
+
232 const size_t speciesRowIndex = it->second;
+
233 // Set the matrix element. Boost.uBLAS handles sparse insertion.
+
234 m_stoichiometryMatrix(speciesRowIndex, reactionColumnIndex) = coefficient;
+
235 } else {
+
236 // This scenario should ideally not happen if m_networkSpeciesMap and m_speciesToIndexMap are correctly synced
+
237 LOG_ERROR(m_logger, "CRITICAL ERROR: Species '{}' from reaction '{}' stoichiometry not found in species to index map.",
+
238 species.name(), reaction.id());
+
239 m_logger -> flush_log();
+
240 throw std::runtime_error("Species not found in species to index map: " + std::string(species.name()));
+
241 }
+
242 }
+
243 reactionColumnIndex++; // Move to the next column for the next reaction
+
244 }
+
245
+
246 LOG_TRACE_L1(m_logger, "Stoichiometry matrix population complete. Number of non-zero elements: {}.",
+
247 m_stoichiometryMatrix.nnz()); // Assuming nnz() exists for compressed_matrix
+
248 }
-
248
-
- -
250 const std::vector<double> &Y_in,
-
251 const double T9,
-
252 const double rho
-
253 ) const {
-
254 return calculateAllDerivatives<double>(Y_in, T9, rho);
-
255 }
+
249
+
+ +
251 const std::vector<double> &Y_in,
+
252 const double T9,
+
253 const double rho
+
254 ) const {
+
255 return calculateAllDerivatives<double>(Y_in, T9, rho);
+
256 }
-
256
-
- -
258 const std::vector<ADDouble> &Y_in,
-
259 const ADDouble &T9,
-
260 const ADDouble &rho
-
261 ) const {
-
262 return calculateAllDerivatives<ADDouble>(Y_in, T9, rho);
-
263 }
+
257
+
+ +
259 const std::vector<ADDouble> &Y_in,
+
260 const ADDouble &T9,
+
261 const ADDouble &rho
+
262 ) const {
+
263 return calculateAllDerivatives<ADDouble>(Y_in, T9, rho);
+
264 }
-
264
-
- - -
267 const std::vector<double> &Y,
-
268 const double T9,
-
269 const double rho
-
270 ) const {
- -
272 }
+
265
+ -
273
-
- -
275 const std::vector<double> &Y,
-
276 const double T9,
-
277 const double rho
-
278 ) {
-
279
-
280 LOG_TRACE_L1(m_logger, "Generating jacobian matrix for T9={}, rho={}..", T9, rho);
-
281 const size_t numSpecies = m_networkSpecies.size();
-
282
-
283 // 1. Pack the input variables into a vector for CppAD
-
284 std::vector<double> adInput(numSpecies + 2, 0.0); // +2 for T9 and rho
-
285 for (size_t i = 0; i < numSpecies; ++i) {
-
286 adInput[i] = Y[i];
-
287 }
-
288 adInput[numSpecies] = T9; // T9
-
289 adInput[numSpecies + 1] = rho; // rho
-
290
-
291 // 2. Calculate the full jacobian
-
292 const std::vector<double> dotY = m_rhsADFun.Jacobian(adInput);
-
293
-
294 // 3. Pack jacobian vector into sparse matrix
-
295 m_jacobianMatrix.clear();
-
296 for (size_t i = 0; i < numSpecies; ++i) {
-
297 for (size_t j = 0; j < numSpecies; ++j) {
-
298 const double value = dotY[i * (numSpecies + 2) + j];
-
299 if (std::abs(value) > MIN_JACOBIAN_THRESHOLD) {
-
300 m_jacobianMatrix(i, j) = value;
-
301 }
-
302 }
-
303 }
-
304 LOG_TRACE_L1(m_logger, "Jacobian matrix generated with dimensions: {} rows x {} columns.", m_jacobianMatrix.size1(), m_jacobianMatrix.size2());
-
305 }
+
270
+ -
306
-
-
307 double GraphEngine::getJacobianMatrixEntry(const int i, const int j) const {
-
308 return m_jacobianMatrix(i, j);
-
309 }
+
274
+
+ + +
277 const std::vector<double> &Y,
+
278 const double T9,
+
279 const double rho
+
280 ) const {
+ +
282 }
-
310
-
-
311 std::unordered_map<fourdst::atomic::Species, int> GraphEngine::getNetReactionStoichiometry(
- -
313 ) {
-
314 return reaction.stoichiometry();
+
283
+
+ +
285 const std::vector<double> &Y,
+
286 const double T9,
+
287 const double rho
+
288 ) {
+
289
+
290 LOG_TRACE_L1(m_logger, "Generating jacobian matrix for T9={}, rho={}..", T9, rho);
+
291 const size_t numSpecies = m_networkSpecies.size();
+
292
+
293 // 1. Pack the input variables into a vector for CppAD
+
294 std::vector<double> adInput(numSpecies + 2, 0.0); // +2 for T9 and rho
+
295 for (size_t i = 0; i < numSpecies; ++i) {
+
296 adInput[i] = Y[i];
+
297 }
+
298 adInput[numSpecies] = T9; // T9
+
299 adInput[numSpecies + 1] = rho; // rho
+
300
+
301 // 2. Calculate the full jacobian
+
302 const std::vector<double> dotY = m_rhsADFun.Jacobian(adInput);
+
303
+
304 // 3. Pack jacobian vector into sparse matrix
+
305 m_jacobianMatrix.clear();
+
306 for (size_t i = 0; i < numSpecies; ++i) {
+
307 for (size_t j = 0; j < numSpecies; ++j) {
+
308 const double value = dotY[i * (numSpecies + 2) + j];
+
309 if (std::abs(value) > MIN_JACOBIAN_THRESHOLD) {
+
310 m_jacobianMatrix(i, j) = value;
+
311 }
+
312 }
+
313 }
+
314 LOG_TRACE_L1(m_logger, "Jacobian matrix generated with dimensions: {} rows x {} columns.", m_jacobianMatrix.size1(), m_jacobianMatrix.size2());
315 }
316
- -
318 const int speciesIndex,
-
319 const int reactionIndex
-
320 ) const {
-
321 return m_stoichiometryMatrix(speciesIndex, reactionIndex);
-
322 }
+
317 double GraphEngine::getJacobianMatrixEntry(const int i, const int j) const {
+
318 return m_jacobianMatrix(i, j);
+
319 }
+
+
320
+
+
321 std::unordered_map<fourdst::atomic::Species, int> GraphEngine::getNetReactionStoichiometry(
+ +
323 ) {
+
324 return reaction.stoichiometry();
+
325 }
-
323
-
-
324 void GraphEngine::exportToDot(const std::string &filename) const {
-
325 LOG_TRACE_L1(m_logger, "Exporting network graph to DOT file: {}", filename);
326
-
327 std::ofstream dotFile(filename);
-
328 if (!dotFile.is_open()) {
-
329 LOG_ERROR(m_logger, "Failed to open file for writing: {}", filename);
-
330 m_logger->flush_log();
-
331 throw std::runtime_error("Failed to open file for writing: " + filename);
-
332 }
-
333
-
334 dotFile << "digraph NuclearReactionNetwork {\n";
-
335 dotFile << " graph [rankdir=LR, splines=true, overlap=false, bgcolor=\"#f0f0f0\"];\n";
-
336 dotFile << " node [shape=circle, style=filled, fillcolor=\"#a7c7e7\", fontname=\"Helvetica\"];\n";
-
337 dotFile << " edge [fontname=\"Helvetica\", fontsize=10];\n\n";
-
338
-
339 // 1. Define all species as nodes
-
340 dotFile << " // --- Species Nodes ---\n";
-
341 for (const auto& species : m_networkSpecies) {
-
342 dotFile << " \"" << species.name() << "\" [label=\"" << species.name() << "\"];\n";
-
343 }
-
344 dotFile << "\n";
-
345
-
346 // 2. Define all reactions as intermediate nodes and connect them
-
347 dotFile << " // --- Reaction Edges ---\n";
-
348 for (const auto& reaction : m_reactions) {
-
349 // Create a unique ID for the reaction node
-
350 std::string reactionNodeId = "reaction_" + std::string(reaction.id());
-
351
-
352 // Define the reaction node (small, black dot)
-
353 dotFile << " \"" << reactionNodeId << "\" [shape=point, fillcolor=black, width=0.1, height=0.1, label=\"\"];\n";
-
354
-
355 // Draw edges from reactants to the reaction node
-
356 for (const auto& reactant : reaction.reactants()) {
-
357 dotFile << " \"" << reactant.name() << "\" -> \"" << reactionNodeId << "\";\n";
-
358 }
-
359
-
360 // Draw edges from the reaction node to products
-
361 for (const auto& product : reaction.products()) {
-
362 dotFile << " \"" << reactionNodeId << "\" -> \"" << product.name() << "\" [label=\"" << reaction.qValue() << " MeV\"];\n";
-
363 }
-
364 dotFile << "\n";
-
365 }
-
366
-
367 dotFile << "}\n";
-
368 dotFile.close();
-
369 LOG_TRACE_L1(m_logger, "Successfully exported network to {}", filename);
-
370 }
+
+ +
328 const int speciesIndex,
+
329 const int reactionIndex
+
330 ) const {
+
331 return m_stoichiometryMatrix(speciesIndex, reactionIndex);
+
332 }
-
371
-
-
372 void GraphEngine::exportToCSV(const std::string &filename) const {
-
373 LOG_TRACE_L1(m_logger, "Exporting network graph to CSV file: {}", filename);
-
374
-
375 std::ofstream csvFile(filename, std::ios::out | std::ios::trunc);
-
376 if (!csvFile.is_open()) {
-
377 LOG_ERROR(m_logger, "Failed to open file for writing: {}", filename);
-
378 m_logger->flush_log();
-
379 throw std::runtime_error("Failed to open file for writing: " + filename);
-
380 }
-
381 csvFile << "Reaction;Reactants;Products;Q-value;sources;rates\n";
-
382 for (const auto& reaction : m_reactions) {
-
383 // Dynamic cast to REACLIBReaction to access specific properties
-
384 csvFile << reaction.id() << ";";
-
385 // Reactants
-
386 int count = 0;
-
387 for (const auto& reactant : reaction.reactants()) {
-
388 csvFile << reactant.name();
-
389 if (++count < reaction.reactants().size()) {
-
390 csvFile << ",";
-
391 }
-
392 }
-
393 csvFile << ";";
-
394 count = 0;
-
395 for (const auto& product : reaction.products()) {
-
396 csvFile << product.name();
-
397 if (++count < reaction.products().size()) {
-
398 csvFile << ",";
-
399 }
-
400 }
-
401 csvFile << ";" << reaction.qValue() << ";";
-
402 // Reaction coefficients
-
403 auto sources = reaction.sources();
+
333
+
+
334 void GraphEngine::exportToDot(const std::string &filename) const {
+
335 LOG_TRACE_L1(m_logger, "Exporting network graph to DOT file: {}", filename);
+
336
+
337 std::ofstream dotFile(filename);
+
338 if (!dotFile.is_open()) {
+
339 LOG_ERROR(m_logger, "Failed to open file for writing: {}", filename);
+
340 m_logger->flush_log();
+
341 throw std::runtime_error("Failed to open file for writing: " + filename);
+
342 }
+
343
+
344 dotFile << "digraph NuclearReactionNetwork {\n";
+
345 dotFile << " graph [rankdir=LR, splines=true, overlap=false, bgcolor=\"#f0f0f0\"];\n";
+
346 dotFile << " node [shape=circle, style=filled, fillcolor=\"#a7c7e7\", fontname=\"Helvetica\"];\n";
+
347 dotFile << " edge [fontname=\"Helvetica\", fontsize=10];\n\n";
+
348
+
349 // 1. Define all species as nodes
+
350 dotFile << " // --- Species Nodes ---\n";
+
351 for (const auto& species : m_networkSpecies) {
+
352 dotFile << " \"" << species.name() << "\" [label=\"" << species.name() << "\"];\n";
+
353 }
+
354 dotFile << "\n";
+
355
+
356 // 2. Define all reactions as intermediate nodes and connect them
+
357 dotFile << " // --- Reaction Edges ---\n";
+
358 for (const auto& reaction : m_reactions) {
+
359 // Create a unique ID for the reaction node
+
360 std::string reactionNodeId = "reaction_" + std::string(reaction.id());
+
361
+
362 // Define the reaction node (small, black dot)
+
363 dotFile << " \"" << reactionNodeId << "\" [shape=point, fillcolor=black, width=0.1, height=0.1, label=\"\"];\n";
+
364
+
365 // Draw edges from reactants to the reaction node
+
366 for (const auto& reactant : reaction.reactants()) {
+
367 dotFile << " \"" << reactant.name() << "\" -> \"" << reactionNodeId << "\";\n";
+
368 }
+
369
+
370 // Draw edges from the reaction node to products
+
371 for (const auto& product : reaction.products()) {
+
372 dotFile << " \"" << reactionNodeId << "\" -> \"" << product.name() << "\" [label=\"" << reaction.qValue() << " MeV\"];\n";
+
373 }
+
374 dotFile << "\n";
+
375 }
+
376
+
377 dotFile << "}\n";
+
378 dotFile.close();
+
379 LOG_TRACE_L1(m_logger, "Successfully exported network to {}", filename);
+
380 }
+
+
381
+
+
382 void GraphEngine::exportToCSV(const std::string &filename) const {
+
383 LOG_TRACE_L1(m_logger, "Exporting network graph to CSV file: {}", filename);
+
384
+
385 std::ofstream csvFile(filename, std::ios::out | std::ios::trunc);
+
386 if (!csvFile.is_open()) {
+
387 LOG_ERROR(m_logger, "Failed to open file for writing: {}", filename);
+
388 m_logger->flush_log();
+
389 throw std::runtime_error("Failed to open file for writing: " + filename);
+
390 }
+
391 csvFile << "Reaction;Reactants;Products;Q-value;sources;rates\n";
+
392 for (const auto& reaction : m_reactions) {
+
393 // Dynamic cast to REACLIBReaction to access specific properties
+
394 csvFile << reaction.id() << ";";
+
395 // Reactants
+
396 int count = 0;
+
397 for (const auto& reactant : reaction.reactants()) {
+
398 csvFile << reactant.name();
+
399 if (++count < reaction.reactants().size()) {
+
400 csvFile << ",";
+
401 }
+
402 }
+
403 csvFile << ";";
404 count = 0;
-
405 for (const auto& source : sources) {
-
406 csvFile << source;
-
407 if (++count < sources.size()) {
+
405 for (const auto& product : reaction.products()) {
+
406 csvFile << product.name();
+
407 if (++count < reaction.products().size()) {
408 csvFile << ",";
409 }
410 }
-
411 csvFile << ";";
+
411 csvFile << ";" << reaction.qValue() << ";";
412 // Reaction coefficients
-
413 count = 0;
-
414 for (const auto& rates : reaction) {
-
415 csvFile << rates;
-
416 if (++count < reaction.size()) {
-
417 csvFile << ",";
-
418 }
-
419 }
-
420 csvFile << "\n";
-
421 }
-
422 csvFile.close();
-
423 LOG_TRACE_L1(m_logger, "Successfully exported network graph to {}", filename);
-
424 }
+
413 auto sources = reaction.sources();
+
414 count = 0;
+
415 for (const auto& source : sources) {
+
416 csvFile << source;
+
417 if (++count < sources.size()) {
+
418 csvFile << ",";
+
419 }
+
420 }
+
421 csvFile << ";";
+
422 // Reaction coefficients
+
423 count = 0;
+
424 for (const auto& rates : reaction) {
+
425 csvFile << rates;
+
426 if (++count < reaction.size()) {
+
427 csvFile << ",";
+
428 }
+
429 }
+
430 csvFile << "\n";
+
431 }
+
432 csvFile.close();
+
433 LOG_TRACE_L1(m_logger, "Successfully exported network graph to {}", filename);
+
434 }
-
425
-
-
426 std::unordered_map<fourdst::atomic::Species, double> GraphEngine::getSpeciesTimescales(const std::vector<double> &Y, const double T9,
-
427 const double rho) const {
-
428 auto [dydt, _] = calculateAllDerivatives<double>(Y, T9, rho);
-
429 std::unordered_map<fourdst::atomic::Species, double> speciesTimescales;
-
430 speciesTimescales.reserve(m_networkSpecies.size());
-
431 for (size_t i = 0; i < m_networkSpecies.size(); ++i) {
-
432 double timescale = std::numeric_limits<double>::infinity();
-
433 const auto species = m_networkSpecies[i];
-
434 if (std::abs(dydt[i]) > 0.0) {
-
435 timescale = std::abs(Y[i] / dydt[i]);
-
436 }
-
437 speciesTimescales.emplace(species, timescale);
-
438 }
-
439 return speciesTimescales;
-
440 }
+
435
+
+
436 std::unordered_map<fourdst::atomic::Species, double> GraphEngine::getSpeciesTimescales(const std::vector<double> &Y, const double T9,
+
437 const double rho) const {
+
438 auto [dydt, _] = calculateAllDerivatives<double>(Y, T9, rho);
+
439 std::unordered_map<fourdst::atomic::Species, double> speciesTimescales;
+
440 speciesTimescales.reserve(m_networkSpecies.size());
+
441 for (size_t i = 0; i < m_networkSpecies.size(); ++i) {
+
442 double timescale = std::numeric_limits<double>::infinity();
+
443 const auto species = m_networkSpecies[i];
+
444 if (std::abs(dydt[i]) > 0.0) {
+
445 timescale = std::abs(Y[i] / dydt[i]);
+
446 }
+
447 speciesTimescales.emplace(species, timescale);
+
448 }
+
449 return speciesTimescales;
+
450 }
-
441
-
- -
443 LOG_TRACE_L1(m_logger, "Recording AD tape for the RHS calculation...");
-
444
-
445 // Task 1: Set dimensions and initialize the matrix
-
446 const size_t numSpecies = m_networkSpecies.size();
-
447 if (numSpecies == 0) {
-
448 LOG_ERROR(m_logger, "Cannot record AD tape: No species in the network.");
-
449 m_logger->flush_log();
-
450 throw std::runtime_error("Cannot record AD tape: No species in the network.");
-
451 }
-
452 const size_t numADInputs = numSpecies + 2; // Note here that by not letting T9 and rho be independent variables, we are constraining the network to a constant temperature and density during each evaluation.
-
453
-
454 // --- CppAD Tape Recording ---
-
455 // 1. Declare independent variable (adY)
-
456 // We also initialize the dummy variable for tape recording (these tell CppAD what the derivative chain looks like).
-
457 // Their numeric values are irrelevant except for in so far as they avoid numerical instabilities.
+
451
+
+
452 void GraphEngine::update(const NetIn &netIn) {
+
453 return; // No-op for GraphEngine, as it does not support manually triggering updates.
+
454 }
+
+
455
+
+ +
457 LOG_TRACE_L1(m_logger, "Recording AD tape for the RHS calculation...");
458
-
459 // Distribute total mass fraction uniformly between species in the dummy variable space
-
460 const auto uniformMassFraction = static_cast<CppAD::AD<double>>(1.0 / numSpecies);
-
461 std::vector<CppAD::AD<double>> adInput(numADInputs, uniformMassFraction);
-
462 adInput[numSpecies] = 1.0; // Dummy T9
-
463 adInput[numSpecies + 1] = 1.0; // Dummy rho
-
464
-
465 // 3. Declare independent variables (what CppAD will differentiate wrt.)
-
466 // This also beings the tape recording process.
-
467 CppAD::Independent(adInput);
-
468
-
469 std::vector<CppAD::AD<double>> adY(numSpecies);
-
470 for(size_t i = 0; i < numSpecies; ++i) {
-
471 adY[i] = adInput[i];
-
472 }
-
473 const CppAD::AD<double> adT9 = adInput[numSpecies];
-
474 const CppAD::AD<double> adRho = adInput[numSpecies + 1];
-
475
-
476
-
477 // 5. Call the actual templated function
-
478 // We let T9 and rho be constant, so we pass them as fixed values.
-
479 auto [dydt, nuclearEnergyGenerationRate] = calculateAllDerivatives<CppAD::AD<double>>(adY, adT9, adRho);
-
480
-
481 m_rhsADFun.Dependent(adInput, dydt);
+
459 // Task 1: Set dimensions and initialize the matrix
+
460 const size_t numSpecies = m_networkSpecies.size();
+
461 if (numSpecies == 0) {
+
462 LOG_ERROR(m_logger, "Cannot record AD tape: No species in the network.");
+
463 m_logger->flush_log();
+
464 throw std::runtime_error("Cannot record AD tape: No species in the network.");
+
465 }
+
466 const size_t numADInputs = numSpecies + 2; // Note here that by not letting T9 and rho be independent variables, we are constraining the network to a constant temperature and density during each evaluation.
+
467
+
468 // --- CppAD Tape Recording ---
+
469 // 1. Declare independent variable (adY)
+
470 // We also initialize the dummy variable for tape recording (these tell CppAD what the derivative chain looks like).
+
471 // Their numeric values are irrelevant except for in so far as they avoid numerical instabilities.
+
472
+
473 // Distribute total mass fraction uniformly between species in the dummy variable space
+
474 const auto uniformMassFraction = static_cast<CppAD::AD<double>>(1.0 / numSpecies);
+
475 std::vector<CppAD::AD<double>> adInput(numADInputs, uniformMassFraction);
+
476 adInput[numSpecies] = 1.0; // Dummy T9
+
477 adInput[numSpecies + 1] = 1.0; // Dummy rho
+
478
+
479 // 3. Declare independent variables (what CppAD will differentiate wrt.)
+
480 // This also beings the tape recording process.
+
481 CppAD::Independent(adInput);
482
-
483 LOG_TRACE_L1(m_logger, "AD tape recorded successfully for the RHS calculation. Number of independent variables: {}.",
-
484 adInput.size());
-
485 }
+
483 std::vector<CppAD::AD<double>> adY(numSpecies);
+
484 for(size_t i = 0; i < numSpecies; ++i) {
+
485 adY[i] = adInput[i];
+
486 }
+
487 const CppAD::AD<double> adT9 = adInput[numSpecies];
+
488 const CppAD::AD<double> adRho = adInput[numSpecies + 1];
+
489
+
490
+
491 // 5. Call the actual templated function
+
492 // We let T9 and rho be constant, so we pass them as fixed values.
+
493 auto [dydt, nuclearEnergyGenerationRate] = calculateAllDerivatives<CppAD::AD<double>>(adY, adT9, adRho);
+
494
+
495 m_rhsADFun.Dependent(adInput, dydt);
+
496
+
497 LOG_TRACE_L1(m_logger, "AD tape recorded successfully for the RHS calculation. Number of independent variables: {}.",
+
498 adInput.size());
+
499 }
-
486}
-
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of species in the network.
-
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const override
Computes timescales for all species in the network.
-
void populateReactionIDMap()
Populates the reaction ID map.
-
CppAD::ADFun< double > m_rhsADFun
CppAD function for the right-hand side of the ODE.
-
boost::numeric::ublas::compressed_matrix< double > m_jacobianMatrix
Jacobian matrix (species x species).
-
double getJacobianMatrixEntry(const int i, const int j) const override
Gets an entry from the previously generated Jacobian matrix.
-
std::unordered_map< std::string_view, fourdst::atomic::Species > m_networkSpeciesMap
Map from species name to Species object.
-
void populateSpeciesToIndexMap()
Populates the species-to-index map.
-
quill::Logger * m_logger
-
void reserveJacobianMatrix()
Reserves space for the Jacobian matrix.
-
std::unordered_map< std::string_view, reaction::Reaction * > m_reactionIDMap
Map from reaction ID to REACLIBReaction. //PERF: This makes copies of REACLIBReaction and could be a ...
-
int getStoichiometryMatrixEntry(const int speciesIndex, const int reactionIndex) const override
Gets an entry from the stoichiometry matrix.
-
void exportToCSV(const std::string &filename) const
Exports the network to a CSV file for analysis.
-
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation rate.
-
static std::unordered_map< fourdst::atomic::Species, int > getNetReactionStoichiometry(const reaction::Reaction &reaction)
Gets the net stoichiometry for a given reaction.
-
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the molar reaction flow for a given reaction.
-
std::vector< fourdst::atomic::Species > m_networkSpecies
Vector of unique species in the network.
-
void recordADTape()
Records the AD tape for the right-hand side of the ODE.
-
GraphEngine(const fourdst::composition::Composition &composition)
Constructs a GraphEngine from a composition.
-
bool involvesSpecies(const fourdst::atomic::Species &species) const
Checks if a given species is involved in the network.
-
reaction::LogicalReactionSet m_reactions
Set of REACLIB reactions in the network.
-
void syncInternalMaps()
Synchronizes the internal maps.
-
bool validateConservation() const
Validates mass and charge conservation across all reactions.
-
boost::numeric::ublas::compressed_matrix< int > m_stoichiometryMatrix
Stoichiometry matrix (species x reactions).
-
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of logical reactions in the network.
-
std::unordered_map< fourdst::atomic::Species, size_t > m_speciesToIndexMap
Map from species to their index in the stoichiometry matrix.
-
void exportToDot(const std::string &filename) const
Exports the network to a DOT file for visualization.
-
void generateJacobianMatrix(const std::vector< double > &Y, const double T9, const double rho) override
Generates the Jacobian matrix for the current state.
-
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the network.
-
void collectNetworkSpecies()
Collects the unique species in the network.
-
void validateComposition(const fourdst::composition::Composition &composition, double culling, double T9)
Validates the composition against the current reaction set.
-
StepDerivatives< T > calculateAllDerivatives(const std::vector< T > &Y_in, T T9, T rho) const
Calculates all derivatives (dY/dt) and the energy generation rate.
-
A collection of LogicalReaction objects.
Definition reaction.h:554
-
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:71
+
500}
+
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of species in the network.
+
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const override
Computes timescales for all species in the network.
+
void populateReactionIDMap()
Populates the reaction ID map.
+
CppAD::ADFun< double > m_rhsADFun
CppAD function for the right-hand side of the ODE.
+
boost::numeric::ublas::compressed_matrix< double > m_jacobianMatrix
Jacobian matrix (species x species).
+
double getJacobianMatrixEntry(const int i, const int j) const override
Gets an entry from the previously generated Jacobian matrix.
+
std::unordered_map< std::string_view, fourdst::atomic::Species > m_networkSpeciesMap
Map from species name to Species object.
+
void populateSpeciesToIndexMap()
Populates the species-to-index map.
+
quill::Logger * m_logger
+
void update(const NetIn &netIn) override
+
screening::ScreeningType m_screeningType
Screening type for the reaction network. Default to no screening.
+
void reserveJacobianMatrix()
Reserves space for the Jacobian matrix.
+
std::unordered_map< std::string_view, reaction::Reaction * > m_reactionIDMap
Map from reaction ID to REACLIBReaction. //PERF: This makes copies of REACLIBReaction and could be a ...
+
screening::ScreeningType getScreeningModel() const override
+
int getStoichiometryMatrixEntry(const int speciesIndex, const int reactionIndex) const override
Gets an entry from the stoichiometry matrix.
+
void setScreeningModel(screening::ScreeningType) override
+
void exportToCSV(const std::string &filename) const
Exports the network to a CSV file for analysis.
+
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation rate.
+
static std::unordered_map< fourdst::atomic::Species, int > getNetReactionStoichiometry(const reaction::Reaction &reaction)
Gets the net stoichiometry for a given reaction.
+
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the molar reaction flow for a given reaction.
+
std::vector< fourdst::atomic::Species > m_networkSpecies
Vector of unique species in the network.
+
void recordADTape()
Records the AD tape for the right-hand side of the ODE.
+
GraphEngine(const fourdst::composition::Composition &composition)
Constructs a GraphEngine from a composition.
+
bool involvesSpecies(const fourdst::atomic::Species &species) const
Checks if a given species is involved in the network.
+
reaction::LogicalReactionSet m_reactions
Set of REACLIB reactions in the network.
+
void syncInternalMaps()
Synchronizes the internal maps.
+
bool validateConservation() const
Validates mass and charge conservation across all reactions.
+
boost::numeric::ublas::compressed_matrix< int > m_stoichiometryMatrix
Stoichiometry matrix (species x reactions).
+
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of logical reactions in the network.
+
std::unordered_map< fourdst::atomic::Species, size_t > m_speciesToIndexMap
Map from species to their index in the stoichiometry matrix.
+
void exportToDot(const std::string &filename) const
Exports the network to a DOT file for visualization.
+
void generateJacobianMatrix(const std::vector< double > &Y, const double T9, const double rho) override
Generates the Jacobian matrix for the current state.
+
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the network.
+
void collectNetworkSpecies()
Collects the unique species in the network.
+
void validateComposition(const fourdst::composition::Composition &composition, double culling, double T9)
Validates the composition against the current reaction set.
+
std::unique_ptr< screening::ScreeningModel > m_screeningModel
+
StepDerivatives< T > calculateAllDerivatives(const std::vector< T > &Y_in, T T9, T rho) const
Calculates all derivatives (dY/dt) and the energy generation rate.
+
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:72
- - -
CppAD::AD< double > ADDouble
Alias for CppAD AD type for double precision.
+ +
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
Definition reaction.h:557
+
std::unique_ptr< ScreeningModel > selectScreeningModel(ScreeningType type)
+ + +
CppAD::AD< double > ADDouble
Alias for CppAD AD type for double precision.
reaction::LogicalReactionSet build_reaclib_nuclear_network(const fourdst::composition::Composition &composition, bool reverse)
Definition network.cpp:64
-
static constexpr double MIN_JACOBIAN_THRESHOLD
Minimum value for Jacobian matrix entries.
+
static constexpr double MIN_JACOBIAN_THRESHOLD
Minimum value for Jacobian matrix entries.
STL namespace.
Defines classes for representing and managing nuclear reactions.
-
Structure holding derivatives and energy generation for a network step.
+ + +
Structure holding derivatives and energy generation for a network step.
diff --git a/docs/html/engine__graph_8h.html b/docs/html/engine__graph_8h.html index 4b500341..ea64e5c1 100644 --- a/docs/html/engine__graph_8h.html +++ b/docs/html/engine__graph_8h.html @@ -114,9 +114,12 @@ $(function(){initNavTree('engine__graph_8h.html',''); initResizable(true); }); #include "gridfire/network.h"
#include "gridfire/reaction/reaction.h"
#include "gridfire/engine/engine_abstract.h"
+#include "gridfire/screening/screening_abstract.h"
+#include "gridfire/screening/screening_types.h"
#include <string>
#include <unordered_map>
#include <vector>
+#include <memory>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include "cppad/cppad.hpp"
diff --git a/docs/html/engine__graph_8h_source.html b/docs/html/engine__graph_8h_source.html index a7134bb8..8be55e7c 100644 --- a/docs/html/engine__graph_8h_source.html +++ b/docs/html/engine__graph_8h_source.html @@ -112,343 +112,373 @@ $(function(){initNavTree('engine__graph_8h_source.html',''); initResizable(true)
8#include "gridfire/network.h"
-
11
-
12#include <string>
-
13#include <unordered_map>
-
14#include <vector>
-
15
-
16#include <boost/numeric/ublas/matrix_sparse.hpp>
-
17
-
18#include "cppad/cppad.hpp"
-
19
-
20// PERF: The function getNetReactionStoichiometry returns a map of species to their stoichiometric coefficients for a given reaction.
-
21// this makes extra copies of the species, which is not ideal and could be optimized further.
-
22// Even more relevant is the member m_reactionIDMap which makes copies of a REACLIBReaction for each reaction ID.
-
23// REACLIBReactions are quite large data structures, so this could be a performance bottleneck.
-
24
-
25namespace gridfire {
-
31 typedef CppAD::AD<double> ADDouble;
-
32
-
33 using fourdst::config::Config;
-
34 using fourdst::logging::LogManager;
-
35 using fourdst::constant::Constants;
-
36
-
44 static constexpr double MIN_DENSITY_THRESHOLD = 1e-18;
-
45
-
53 static constexpr double MIN_ABUNDANCE_THRESHOLD = 1e-18;
-
54
-
61 static constexpr double MIN_JACOBIAN_THRESHOLD = 1e-24;
-
62
-
-
86 class GraphEngine final : public DynamicEngine{
-
87 public:
-
98 explicit GraphEngine(const fourdst::composition::Composition &composition);
-
99
-
108 explicit GraphEngine(reaction::LogicalReactionSet reactions);
-
109
- -
124 const std::vector<double>& Y,
-
125 const double T9,
-
126 const double rho
-
127 ) const override;
-
128
- -
143 const std::vector<double>& Y,
-
144 const double T9,
-
145 const double rho
-
146 ) override;
-
147
-
154 void generateStoichiometryMatrix() override;
-
155
- - -
170 const std::vector<double>&Y,
-
171 const double T9,
-
172 const double rho
-
173 ) const override;
-
174
-
179 [[nodiscard]] const std::vector<fourdst::atomic::Species>& getNetworkSpecies() const override;
-
180
-
185 [[nodiscard]] const reaction::LogicalReactionSet& getNetworkReactions() const override;
-
186
-
198 [[nodiscard]] double getJacobianMatrixEntry(
-
199 const int i,
-
200 const int j
-
201 ) const override;
-
202
-
209 [[nodiscard]] static std::unordered_map<fourdst::atomic::Species, int> getNetReactionStoichiometry(
- -
211 );
-
212
-
224 [[nodiscard]] int getStoichiometryMatrixEntry(
-
225 const int speciesIndex,
-
226 const int reactionIndex
-
227 ) const override;
-
228
-
240 [[nodiscard]] std::unordered_map<fourdst::atomic::Species, double> getSpeciesTimescales(
-
241 const std::vector<double>& Y,
-
242 double T9,
-
243 double rho
-
244 ) const override;
-
245
-
252 [[nodiscard]] bool involvesSpecies(
-
253 const fourdst::atomic::Species& species
-
254 ) const;
-
255
-
272 void exportToDot(
-
273 const std::string& filename
-
274 ) const;
-
275
-
292 void exportToCSV(
-
293 const std::string& filename
-
294 ) const;
-
295
-
296
-
297 private:
- -
299 std::unordered_map<std::string_view, reaction::Reaction*> m_reactionIDMap;
+ + +
13
+
14#include <string>
+
15#include <unordered_map>
+
16#include <vector>
+
17#include <memory>
+
18
+
19#include <boost/numeric/ublas/matrix_sparse.hpp>
+
20
+
21#include "cppad/cppad.hpp"
+
22
+
23// PERF: The function getNetReactionStoichiometry returns a map of species to their stoichiometric coefficients for a given reaction.
+
24// this makes extra copies of the species, which is not ideal and could be optimized further.
+
25// Even more relevant is the member m_reactionIDMap which makes copies of a REACLIBReaction for each reaction ID.
+
26// REACLIBReactions are quite large data structures, so this could be a performance bottleneck.
+
27
+
28namespace gridfire {
+
34 typedef CppAD::AD<double> ADDouble;
+
35
+
36 using fourdst::config::Config;
+
37 using fourdst::logging::LogManager;
+
38 using fourdst::constant::Constants;
+
39
+
47 static constexpr double MIN_DENSITY_THRESHOLD = 1e-18;
+
48
+
56 static constexpr double MIN_ABUNDANCE_THRESHOLD = 1e-18;
+
57
+
64 static constexpr double MIN_JACOBIAN_THRESHOLD = 1e-24;
+
65
+
+
89 class GraphEngine final : public DynamicEngine{
+
90 public:
+
101 explicit GraphEngine(const fourdst::composition::Composition &composition);
+
102
+
111 explicit GraphEngine(reaction::LogicalReactionSet reactions);
+
112
+ +
127 const std::vector<double>& Y,
+
128 const double T9,
+
129 const double rho
+
130 ) const override;
+
131
+ +
146 const std::vector<double>& Y,
+
147 const double T9,
+
148 const double rho
+
149 ) override;
+
150
+
157 void generateStoichiometryMatrix() override;
+
158
+
171 [[nodiscard]] double calculateMolarReactionFlow(
+ +
173 const std::vector<double>&Y,
+
174 const double T9,
+
175 const double rho
+
176 ) const override;
+
177
+
182 [[nodiscard]] const std::vector<fourdst::atomic::Species>& getNetworkSpecies() const override;
+
183
+
188 [[nodiscard]] const reaction::LogicalReactionSet& getNetworkReactions() const override;
+
189
+
201 [[nodiscard]] double getJacobianMatrixEntry(
+
202 const int i,
+
203 const int j
+
204 ) const override;
+
205
+
212 [[nodiscard]] static std::unordered_map<fourdst::atomic::Species, int> getNetReactionStoichiometry(
+ +
214 );
+
215
+
227 [[nodiscard]] int getStoichiometryMatrixEntry(
+
228 const int speciesIndex,
+
229 const int reactionIndex
+
230 ) const override;
+
231
+
243 [[nodiscard]] std::unordered_map<fourdst::atomic::Species, double> getSpeciesTimescales(
+
244 const std::vector<double>& Y,
+
245 double T9,
+
246 double rho
+
247 ) const override;
+
248
+
249 void update(const NetIn& netIn) override;
+
250
+
257 [[nodiscard]] bool involvesSpecies(
+
258 const fourdst::atomic::Species& species
+
259 ) const;
+
260
+
277 void exportToDot(
+
278 const std::string& filename
+
279 ) const;
+
280
+
297 void exportToCSV(
+
298 const std::string& filename
+
299 ) const;
300
-
301 std::vector<fourdst::atomic::Species> m_networkSpecies;
-
302 std::unordered_map<std::string_view, fourdst::atomic::Species> m_networkSpeciesMap;
-
303 std::unordered_map<fourdst::atomic::Species, size_t> m_speciesToIndexMap;
+ +
302
+
303 [[nodiscard]] screening::ScreeningType getScreeningModel() const override;
304
-
305 boost::numeric::ublas::compressed_matrix<int> m_stoichiometryMatrix;
-
306 boost::numeric::ublas::compressed_matrix<double> m_jacobianMatrix;
-
307
-
308 CppAD::ADFun<double> m_rhsADFun;
+
305
+
306 private:
+ +
308 std::unordered_map<std::string_view, reaction::Reaction*> m_reactionIDMap;
309
-
310 Config& m_config = Config::getInstance();
-
311 Constants& m_constants = Constants::getInstance();
-
312 quill::Logger* m_logger = LogManager::getInstance().getLogger("log");
+
310 std::vector<fourdst::atomic::Species> m_networkSpecies;
+
311 std::unordered_map<std::string_view, fourdst::atomic::Species> m_networkSpeciesMap;
+
312 std::unordered_map<fourdst::atomic::Species, size_t> m_speciesToIndexMap;
313
-
314 private:
-
322 void syncInternalMaps();
-
323
- -
331
- -
339
- -
347
- -
356
-
366 void recordADTape();
-
367
-
377 [[nodiscard]] bool validateConservation() const;
-
378
- -
391 const fourdst::composition::Composition &composition,
-
392 double culling,
-
393 double T9
-
394 );
-
395
-
409 template <IsArithmeticOrAD T>
- - -
412 const std::vector<T> &Y,
-
413 const T T9,
-
414 const T rho
-
415 ) const;
-
416
-
429 template<IsArithmeticOrAD T>
- -
431 const std::vector<T> &Y_in,
-
432 T T9,
-
433 T rho
-
434 ) const;
-
435
- -
449 const std::vector<double>& Y_in,
-
450 const double T9,
-
451 const double rho
-
452 ) const;
-
453
- -
467 const std::vector<ADDouble>& Y_in,
-
468 const ADDouble &T9,
-
469 const ADDouble &rho
-
470 ) const;
-
471 };
+
314 boost::numeric::ublas::compressed_matrix<int> m_stoichiometryMatrix;
+
315 boost::numeric::ublas::compressed_matrix<double> m_jacobianMatrix;
+
316
+
317 CppAD::ADFun<double> m_rhsADFun;
+
318
+ +
320 std::unique_ptr<screening::ScreeningModel> m_screeningModel = screening::selectScreeningModel(m_screeningType);
+
321
+
322 Config& m_config = Config::getInstance();
+
323 Constants& m_constants = Constants::getInstance();
+
324 quill::Logger* m_logger = LogManager::getInstance().getLogger("log");
+
325
+
326 private:
+
334 void syncInternalMaps();
+
335
+ +
343
+ +
351
+ +
359
+ +
368
+
378 void recordADTape();
+
379
+
389 [[nodiscard]] bool validateConservation() const;
+
390
+ +
403 const fourdst::composition::Composition &composition,
+
404 double culling,
+
405 double T9
+
406 );
+
407
+
421 template <IsArithmeticOrAD T>
+ + +
424 const std::vector<T> &Y,
+
425 const T T9,
+
426 const T rho
+
427 ) const;
+
428
+
441 template<IsArithmeticOrAD T>
+ +
443 const std::vector<T> &Y_in,
+
444 T T9,
+
445 T rho
+
446 ) const;
+
447
+ +
461 const std::vector<double>& Y_in,
+
462 const double T9,
+
463 const double rho
+
464 ) const;
+
465
+ +
479 const std::vector<ADDouble>& Y_in,
+
480 const ADDouble &T9,
+
481 const ADDouble &rho
+
482 ) const;
+
483 };
-
472
-
473
-
474 template<IsArithmeticOrAD T>
-
- -
476 const std::vector<T> &Y_in, T T9, T rho) const {
-
477
-
478 // --- Setup output derivatives structure ---
-
479 StepDerivatives<T> result;
-
480 result.dydt.resize(m_networkSpecies.size(), static_cast<T>(0.0));
-
481
-
482 // --- AD Pre-setup (flags to control conditionals in an AD safe / branch aware manner) ---
-
483 // ----- Constants for AD safe calculations ---
-
484 const T zero = static_cast<T>(0.0);
-
485 const T one = static_cast<T>(1.0);
-
486
-
487 // ----- Initialize variables for molar concentration product and thresholds ---
-
488 // Note: the logic here is that we use CppAD::CondExprLt to test thresholds and if they are less we set the flag
-
489 // to zero so that the final returned reaction flow is 0. This is as opposed to standard if statements
-
490 // which create branches that break the AD tape.
-
491 const T rho_threshold = static_cast<T>(MIN_DENSITY_THRESHOLD);
-
492
-
493 // --- Check if the density is below the threshold where we ignore reactions ---
-
494 T threshold_flag = CppAD::CondExpLt(rho, rho_threshold, zero, one); // If rho < threshold, set flag to 0
-
495
-
496 std::vector<T> Y = Y_in;
-
497 for (size_t i = 0; i < m_networkSpecies.size(); ++i) {
-
498 // We use CppAD::CondExpLt to handle AD taping and prevent branching
-
499 // Note that while this is syntactically more complex this is equivalent to
-
500 // if (Y[i] < 0) {Y[i] = 0;}
-
501 // The issue is that this would introduce a branch which would require the auto diff tape to be re-recorded
-
502 // each timestep, which is very inefficient.
-
503 Y[i] = CppAD::CondExpLt(Y[i], zero, zero, Y[i]); // Ensure no negative abundances
-
504 }
+
484
+
485
+
486 template<IsArithmeticOrAD T>
+
+ +
488 const std::vector<T> &Y_in, T T9, T rho) const {
+
489 std::vector<T> screeningFactors = m_screeningModel->calculateScreeningFactors(
+ + +
492 Y_in,
+
493 T9,
+
494 rho
+
495 );
+
496
+
497 // --- Setup output derivatives structure ---
+
498 StepDerivatives<T> result;
+
499 result.dydt.resize(m_networkSpecies.size(), static_cast<T>(0.0));
+
500
+
501 // --- AD Pre-setup (flags to control conditionals in an AD safe / branch aware manner) ---
+
502 // ----- Constants for AD safe calculations ---
+
503 const T zero = static_cast<T>(0.0);
+
504 const T one = static_cast<T>(1.0);
505
-
506 const T u = static_cast<T>(m_constants.get("u").value); // Atomic mass unit in grams
-
507 const T N_A = static_cast<T>(m_constants.get("N_a").value); // Avogadro's number in mol^-1
-
508 const T c = static_cast<T>(m_constants.get("c").value); // Speed of light in cm/s
-
509
-
510 // --- SINGLE LOOP OVER ALL REACTIONS ---
-
511 for (size_t reactionIndex = 0; reactionIndex < m_reactions.size(); ++reactionIndex) {
-
512 const auto& reaction = m_reactions[reactionIndex];
-
513
-
514 // 1. Calculate reaction rate
-
515 const T molarReactionFlow = calculateMolarReactionFlow<T>(reaction, Y, T9, rho);
-
516
-
517 // 2. Use the rate to update all relevant species derivatives (dY/dt)
-
518 for (size_t speciesIndex = 0; speciesIndex < m_networkSpecies.size(); ++speciesIndex) {
-
519 const T nu_ij = static_cast<T>(m_stoichiometryMatrix(speciesIndex, reactionIndex));
-
520 result.dydt[speciesIndex] += threshold_flag * nu_ij * molarReactionFlow / rho;
-
521 }
-
522 }
-
523
-
524 T massProductionRate = static_cast<T>(0.0); // [mol][s^-1]
-
525 for (const auto& [species, index] : m_speciesToIndexMap) {
-
526 massProductionRate += result.dydt[index] * species.mass() * u;
-
527 }
+
506 // ----- Initialize variables for molar concentration product and thresholds ---
+
507 // Note: the logic here is that we use CppAD::CondExprLt to test thresholds and if they are less we set the flag
+
508 // to zero so that the final returned reaction flow is 0. This is as opposed to standard if statements
+
509 // which create branches that break the AD tape.
+
510 const T rho_threshold = static_cast<T>(MIN_DENSITY_THRESHOLD);
+
511
+
512 // --- Check if the density is below the threshold where we ignore reactions ---
+
513 T threshold_flag = CppAD::CondExpLt(rho, rho_threshold, zero, one); // If rho < threshold, set flag to 0
+
514
+
515 std::vector<T> Y = Y_in;
+
516 for (size_t i = 0; i < m_networkSpecies.size(); ++i) {
+
517 // We use CppAD::CondExpLt to handle AD taping and prevent branching
+
518 // Note that while this is syntactically more complex this is equivalent to
+
519 // if (Y[i] < 0) {Y[i] = 0;}
+
520 // The issue is that this would introduce a branch which would require the auto diff tape to be re-recorded
+
521 // each timestep, which is very inefficient.
+
522 Y[i] = CppAD::CondExpLt(Y[i], zero, zero, Y[i]); // Ensure no negative abundances
+
523 }
+
524
+
525 const T u = static_cast<T>(m_constants.get("u").value); // Atomic mass unit in grams
+
526 const T N_A = static_cast<T>(m_constants.get("N_a").value); // Avogadro's number in mol^-1
+
527 const T c = static_cast<T>(m_constants.get("c").value); // Speed of light in cm/s
528
-
529 result.nuclearEnergyGenerationRate = -massProductionRate * N_A * c * c; // [cm^2][s^-3] = [erg][s^-1][g^-1]
-
530
-
531 return result;
-
532 }
-
-
533
-
534
-
535 template <IsArithmeticOrAD T>
-
- - -
538 const std::vector<T> &Y,
-
539 const T T9,
-
540 const T rho
-
541 ) const {
+
529 // --- SINGLE LOOP OVER ALL REACTIONS ---
+
530 for (size_t reactionIndex = 0; reactionIndex < m_reactions.size(); ++reactionIndex) {
+
531 const auto& reaction = m_reactions[reactionIndex];
+
532
+
533 // 1. Calculate reaction rate
+
534 const T molarReactionFlow = screeningFactors[reactionIndex] * calculateMolarReactionFlow<T>(reaction, Y, T9, rho);
+
535
+
536 // 2. Use the rate to update all relevant species derivatives (dY/dt)
+
537 for (size_t speciesIndex = 0; speciesIndex < m_networkSpecies.size(); ++speciesIndex) {
+
538 const T nu_ij = static_cast<T>(m_stoichiometryMatrix(speciesIndex, reactionIndex));
+
539 result.dydt[speciesIndex] += threshold_flag * nu_ij * molarReactionFlow / rho;
+
540 }
+
541 }
542
-
543 // --- Pre-setup (flags to control conditionals in an AD safe / branch aware manner) ---
-
544 // ----- Constants for AD safe calculations ---
-
545 const T zero = static_cast<T>(0.0);
-
546 const T one = static_cast<T>(1.0);
+
543 T massProductionRate = static_cast<T>(0.0); // [mol][s^-1]
+
544 for (const auto& [species, index] : m_speciesToIndexMap) {
+
545 massProductionRate += result.dydt[index] * species.mass() * u;
+
546 }
547
-
548 // ----- Initialize variables for molar concentration product and thresholds ---
-
549 // Note: the logic here is that we use CppAD::CondExprLt to test thresholds and if they are less we set the flag
-
550 // to zero so that the final returned reaction flow is 0. This is as opposed to standard if statements
-
551 // which create branches that break the AD tape.
-
552 const T Y_threshold = static_cast<T>(MIN_ABUNDANCE_THRESHOLD);
-
553 T threshold_flag = one;
-
554
-
555 // --- Calculate the molar reaction rate (in units of [s^-1][cm^3(N-1)][mol^(1-N)] for N reactants) ---
-
556 const T k_reaction = reaction.calculate_rate(T9);
-
557
-
558 // --- Cound the number of each reactant species to account for species multiplicity ---
-
559 std::unordered_map<std::string, int> reactant_counts;
-
560 reactant_counts.reserve(reaction.reactants().size());
-
561 for (const auto& reactant : reaction.reactants()) {
-
562 reactant_counts[std::string(reactant.name())]++;
-
563 }
-
564
-
565 // --- Accumulator for the molar concentration ---
-
566 auto molar_concentration_product = static_cast<T>(1.0);
-
567
-
568 // --- Loop through each unique reactant species and calculate the molar concentration for that species then multiply that into the accumulator ---
-
569 for (const auto& [species_name, count] : reactant_counts) {
-
570 // --- Resolve species to molar abundance ---
-
571 // PERF: Could probably optimize out this lookup
-
572 const auto species_it = m_speciesToIndexMap.find(m_networkSpeciesMap.at(species_name));
-
573 const size_t species_index = species_it->second;
-
574 const T Yi = Y[species_index];
-
575
-
576 // --- Check if the species abundance is below the threshold where we ignore reactions ---
-
577 threshold_flag *= CppAD::CondExpLt(Yi, Y_threshold, zero, one);
-
578
-
579 // --- Convert from molar abundance to molar concentration ---
-
580 T molar_concentration = Yi * rho;
-
581
-
582 // --- If count is > 1 , we need to raise the molar concentration to the power of count since there are really count bodies in that reaction ---
-
583 molar_concentration_product *= CppAD::pow(molar_concentration, static_cast<T>(count)); // ni^count
-
584
-
585 // --- Apply factorial correction for identical reactions ---
-
586 if (count > 1) {
-
587 molar_concentration_product /= static_cast<T>(std::tgamma(static_cast<double>(count + 1))); // Gamma function for factorial
-
588 }
-
589 }
-
590 // --- Final reaction flow calculation [mol][s^-1][cm^-3] ---
-
591 // Note: If the threshold flag ever gets set to zero this will return zero.
-
592 // This will result basically in multiple branches being written to the AD tape, which will make
-
593 // the tape more expensive to record, but it will also mean that we only need to record it once for
-
594 // the entire network.
-
595 return molar_concentration_product * k_reaction * threshold_flag;
-
596 }
+
548 result.nuclearEnergyGenerationRate = -massProductionRate * N_A * c * c; // [cm^2][s^-3] = [erg][s^-1][g^-1]
+
549
+
550 return result;
+
551 }
-
597};
-
Abstract class for engines supporting Jacobian and stoichiometry operations.
-
Constants & m_constants
Access to physical constants.
-
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of species in the network.
-
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const override
Computes timescales for all species in the network.
-
void populateReactionIDMap()
Populates the reaction ID map.
-
CppAD::ADFun< double > m_rhsADFun
CppAD function for the right-hand side of the ODE.
-
boost::numeric::ublas::compressed_matrix< double > m_jacobianMatrix
Jacobian matrix (species x species).
-
double getJacobianMatrixEntry(const int i, const int j) const override
Gets an entry from the previously generated Jacobian matrix.
-
std::unordered_map< std::string_view, fourdst::atomic::Species > m_networkSpeciesMap
Map from species name to Species object.
- -
void populateSpeciesToIndexMap()
Populates the species-to-index map.
-
quill::Logger * m_logger
-
void reserveJacobianMatrix()
Reserves space for the Jacobian matrix.
-
std::unordered_map< std::string_view, reaction::Reaction * > m_reactionIDMap
Map from reaction ID to REACLIBReaction. //PERF: This makes copies of REACLIBReaction and could be a ...
-
int getStoichiometryMatrixEntry(const int speciesIndex, const int reactionIndex) const override
Gets an entry from the stoichiometry matrix.
-
void exportToCSV(const std::string &filename) const
Exports the network to a CSV file for analysis.
-
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation rate.
-
static std::unordered_map< fourdst::atomic::Species, int > getNetReactionStoichiometry(const reaction::Reaction &reaction)
Gets the net stoichiometry for a given reaction.
-
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the molar reaction flow for a given reaction.
-
std::vector< fourdst::atomic::Species > m_networkSpecies
Vector of unique species in the network.
-
void recordADTape()
Records the AD tape for the right-hand side of the ODE.
-
GraphEngine(const fourdst::composition::Composition &composition)
Constructs a GraphEngine from a composition.
-
bool involvesSpecies(const fourdst::atomic::Species &species) const
Checks if a given species is involved in the network.
-
reaction::LogicalReactionSet m_reactions
Set of REACLIB reactions in the network.
-
void syncInternalMaps()
Synchronizes the internal maps.
-
bool validateConservation() const
Validates mass and charge conservation across all reactions.
-
boost::numeric::ublas::compressed_matrix< int > m_stoichiometryMatrix
Stoichiometry matrix (species x reactions).
-
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of logical reactions in the network.
-
std::unordered_map< fourdst::atomic::Species, size_t > m_speciesToIndexMap
Map from species to their index in the stoichiometry matrix.
-
void exportToDot(const std::string &filename) const
Exports the network to a DOT file for visualization.
-
void generateJacobianMatrix(const std::vector< double > &Y, const double T9, const double rho) override
Generates the Jacobian matrix for the current state.
-
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the network.
-
void collectNetworkSpecies()
Collects the unique species in the network.
-
void validateComposition(const fourdst::composition::Composition &composition, double culling, double T9)
Validates the composition against the current reaction set.
-
StepDerivatives< T > calculateAllDerivatives(const std::vector< T > &Y_in, T T9, T rho) const
Calculates all derivatives (dY/dt) and the energy generation rate.
-
A collection of LogicalReaction objects.
Definition reaction.h:554
-
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:71
+
552
+
553
+
554 template <IsArithmeticOrAD T>
+
+ + +
557 const std::vector<T> &Y,
+
558 const T T9,
+
559 const T rho
+
560 ) const {
+
561
+
562 // --- Pre-setup (flags to control conditionals in an AD safe / branch aware manner) ---
+
563 // ----- Constants for AD safe calculations ---
+
564 const T zero = static_cast<T>(0.0);
+
565 const T one = static_cast<T>(1.0);
+
566
+
567 // ----- Initialize variables for molar concentration product and thresholds ---
+
568 // Note: the logic here is that we use CppAD::CondExprLt to test thresholds and if they are less we set the flag
+
569 // to zero so that the final returned reaction flow is 0. This is as opposed to standard if statements
+
570 // which create branches that break the AD tape.
+
571 const T Y_threshold = static_cast<T>(MIN_ABUNDANCE_THRESHOLD);
+
572 T threshold_flag = one;
+
573
+
574 // --- Calculate the molar reaction rate (in units of [s^-1][cm^3(N-1)][mol^(1-N)] for N reactants) ---
+
575 const T k_reaction = reaction.calculate_rate(T9);
+
576
+
577 // --- Cound the number of each reactant species to account for species multiplicity ---
+
578 std::unordered_map<std::string, int> reactant_counts;
+
579 reactant_counts.reserve(reaction.reactants().size());
+
580 for (const auto& reactant : reaction.reactants()) {
+
581 reactant_counts[std::string(reactant.name())]++;
+
582 }
+
583
+
584 // --- Accumulator for the molar concentration ---
+
585 auto molar_concentration_product = static_cast<T>(1.0);
+
586
+
587 // --- Loop through each unique reactant species and calculate the molar concentration for that species then multiply that into the accumulator ---
+
588 for (const auto& [species_name, count] : reactant_counts) {
+
589 // --- Resolve species to molar abundance ---
+
590 // PERF: Could probably optimize out this lookup
+
591 const auto species_it = m_speciesToIndexMap.find(m_networkSpeciesMap.at(species_name));
+
592 const size_t species_index = species_it->second;
+
593 const T Yi = Y[species_index];
+
594
+
595 // --- Check if the species abundance is below the threshold where we ignore reactions ---
+
596 threshold_flag *= CppAD::CondExpLt(Yi, Y_threshold, zero, one);
+
597
+
598 // --- Convert from molar abundance to molar concentration ---
+
599 T molar_concentration = Yi * rho;
+
600
+
601 // --- If count is > 1 , we need to raise the molar concentration to the power of count since there are really count bodies in that reaction ---
+
602 molar_concentration_product *= CppAD::pow(molar_concentration, static_cast<T>(count)); // ni^count
+
603
+
604 // --- Apply factorial correction for identical reactions ---
+
605 if (count > 1) {
+
606 molar_concentration_product /= static_cast<T>(std::tgamma(static_cast<double>(count + 1))); // Gamma function for factorial
+
607 }
+
608 }
+
609 // --- Final reaction flow calculation [mol][s^-1][cm^-3] ---
+
610 // Note: If the threshold flag ever gets set to zero this will return zero.
+
611 // This will result basically in multiple branches being written to the AD tape, which will make
+
612 // the tape more expensive to record, but it will also mean that we only need to record it once for
+
613 // the entire network.
+
614 return molar_concentration_product * k_reaction * threshold_flag;
+
615 }
+
+
616};
+
Abstract class for engines supporting Jacobian and stoichiometry operations.
+
Constants & m_constants
Access to physical constants.
+
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Gets the list of species in the network.
+
std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const override
Computes timescales for all species in the network.
+
void populateReactionIDMap()
Populates the reaction ID map.
+
CppAD::ADFun< double > m_rhsADFun
CppAD function for the right-hand side of the ODE.
+
boost::numeric::ublas::compressed_matrix< double > m_jacobianMatrix
Jacobian matrix (species x species).
+
double getJacobianMatrixEntry(const int i, const int j) const override
Gets an entry from the previously generated Jacobian matrix.
+
std::unordered_map< std::string_view, fourdst::atomic::Species > m_networkSpeciesMap
Map from species name to Species object.
+ +
void populateSpeciesToIndexMap()
Populates the species-to-index map.
+
quill::Logger * m_logger
+
void update(const NetIn &netIn) override
+
screening::ScreeningType m_screeningType
Screening type for the reaction network. Default to no screening.
+
void reserveJacobianMatrix()
Reserves space for the Jacobian matrix.
+
std::unordered_map< std::string_view, reaction::Reaction * > m_reactionIDMap
Map from reaction ID to REACLIBReaction. //PERF: This makes copies of REACLIBReaction and could be a ...
+
screening::ScreeningType getScreeningModel() const override
+
int getStoichiometryMatrixEntry(const int speciesIndex, const int reactionIndex) const override
Gets an entry from the stoichiometry matrix.
+
void setScreeningModel(screening::ScreeningType) override
+
void exportToCSV(const std::string &filename) const
Exports the network to a CSV file for analysis.
+
StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the right-hand side (dY/dt) and energy generation rate.
+
static std::unordered_map< fourdst::atomic::Species, int > getNetReactionStoichiometry(const reaction::Reaction &reaction)
Gets the net stoichiometry for a given reaction.
+
double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y, const double T9, const double rho) const override
Calculates the molar reaction flow for a given reaction.
+
std::vector< fourdst::atomic::Species > m_networkSpecies
Vector of unique species in the network.
+
void recordADTape()
Records the AD tape for the right-hand side of the ODE.
+
GraphEngine(const fourdst::composition::Composition &composition)
Constructs a GraphEngine from a composition.
+
bool involvesSpecies(const fourdst::atomic::Species &species) const
Checks if a given species is involved in the network.
+
reaction::LogicalReactionSet m_reactions
Set of REACLIB reactions in the network.
+
void syncInternalMaps()
Synchronizes the internal maps.
+
bool validateConservation() const
Validates mass and charge conservation across all reactions.
+
boost::numeric::ublas::compressed_matrix< int > m_stoichiometryMatrix
Stoichiometry matrix (species x reactions).
+
const reaction::LogicalReactionSet & getNetworkReactions() const override
Gets the set of logical reactions in the network.
+
std::unordered_map< fourdst::atomic::Species, size_t > m_speciesToIndexMap
Map from species to their index in the stoichiometry matrix.
+
void exportToDot(const std::string &filename) const
Exports the network to a DOT file for visualization.
+
void generateJacobianMatrix(const std::vector< double > &Y, const double T9, const double rho) override
Generates the Jacobian matrix for the current state.
+
void generateStoichiometryMatrix() override
Generates the stoichiometry matrix for the network.
+
void collectNetworkSpecies()
Collects the unique species in the network.
+
void validateComposition(const fourdst::composition::Composition &composition, double culling, double T9)
Validates the composition against the current reaction set.
+
std::unique_ptr< screening::ScreeningModel > m_screeningModel
+
StepDerivatives< T > calculateAllDerivatives(const std::vector< T > &Y_in, T T9, T rho) const
Calculates all derivatives (dY/dt) and the energy generation rate.
+
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:72
Abstract interfaces for reaction network engines in GridFire.
- - -
CppAD::AD< double > ADDouble
Alias for CppAD AD type for double precision.
-
static constexpr double MIN_ABUNDANCE_THRESHOLD
Minimum abundance threshold below which species are ignored.
-
static constexpr double MIN_DENSITY_THRESHOLD
Minimum density threshold below which reactions are ignored.
-
static constexpr double MIN_JACOBIAN_THRESHOLD
Minimum value for Jacobian matrix entries.
+ +
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
Definition reaction.h:557
+
std::unique_ptr< ScreeningModel > selectScreeningModel(ScreeningType type)
+ + + +
CppAD::AD< double > ADDouble
Alias for CppAD AD type for double precision.
+
static constexpr double MIN_ABUNDANCE_THRESHOLD
Minimum abundance threshold below which species are ignored.
+
static constexpr double MIN_DENSITY_THRESHOLD
Minimum density threshold below which reactions are ignored.
+
static constexpr double MIN_JACOBIAN_THRESHOLD
Minimum value for Jacobian matrix entries.
Defines classes for representing and managing nuclear reactions.
-
Structure holding derivatives and energy generation for a network step.
-
T nuclearEnergyGenerationRate
Specific energy generation rate (e.g., erg/g/s).
-
std::vector< T > dydt
Derivatives of abundances (dY/dt for each species).
+ + + +
Structure holding derivatives and energy generation for a network step.
+
T nuclearEnergyGenerationRate
Specific energy generation rate (e.g., erg/g/s).
+
std::vector< T > dydt
Derivatives of abundances (dY/dt for each species).
diff --git a/docs/html/engine__view__abstract_8h.html b/docs/html/engine__view__abstract_8h.html index 01b441bd..853819d8 100644 --- a/docs/html/engine__view__abstract_8h.html +++ b/docs/html/engine__view__abstract_8h.html @@ -5,7 +5,7 @@ -GridFire: src/network/include/gridfire/engine/engine_view_abstract.h File Reference +GridFire: src/network/include/gridfire/engine/views/engine_view_abstract.h File Reference @@ -148,7 +148,7 @@ Concepts diff --git a/docs/html/engine__view__abstract_8h_source.html b/docs/html/engine__view__abstract_8h_source.html index 0cd2349b..07524d67 100644 --- a/docs/html/engine__view__abstract_8h_source.html +++ b/docs/html/engine__view__abstract_8h_source.html @@ -5,7 +5,7 @@ -GridFire: src/network/include/gridfire/engine/engine_view_abstract.h Source File +GridFire: src/network/include/gridfire/engine/views/engine_view_abstract.h Source File @@ -128,13 +128,13 @@ $(function(){initNavTree('engine__view__abstract_8h_source.html',''); initResiza
virtual const EngineT & getBaseEngine() const =0
Access the underlying engine instance.
Concept for types allowed as engine bases in EngineView.
Abstract interfaces for reaction network engines in GridFire.
- +
diff --git a/docs/html/files.html b/docs/html/files.html index 01f467de..79339359 100644 --- a/docs/html/files.html +++ b/docs/html/files.html @@ -103,7 +103,7 @@ $(function(){initNavTree('files.html',''); initResizable(true); });
Here is a list of all files with brief descriptions:
-
[detail level 123456]

Files

+
[detail level 1234567]
@@ -111,29 +111,50 @@ $(function(){initNavTree('files.html',''); initResizable(true); }); - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  docs
 static
  src
  include
  gridfire
  engine
 engine_abstract.hAbstract interfaces for reaction network engines in GridFire
 engine_adaptive.h
 engine_approx8.h
 engine_graph.h
 engine_view_abstract.hAbstract interfaces for engine "views" in GridFire
  reaction
 reaclib.h
 reaction.hDefines classes for representing and managing nuclear reactions
 reactions_data.h
  solver
 solver.h
 network.h
  lib
  engine
 engine_adaptive.cpp
 engine_approx8.cpp
 engine_graph.cpp
  reaction
 reaclib.cpp
 reaction.cpp
  solver
 solver.cpp
 network.cpp
  views
 engine_adaptive.h
 engine_defined.h
 engine_view_abstract.hAbstract interfaces for engine "views" in GridFire
 engine_abstract.hAbstract interfaces for reaction network engines in GridFire
 engine_approx8.h
 engine_graph.h
  io
 network_file.h
  reaction
 reaclib.h
 reaction.hDefines classes for representing and managing nuclear reactions
 reactions_data.h
  screening
 screening_abstract.h
 screening_bare.h
 screening_types.h
 screening_weak.h
  solver
 solver.h
  utils
 logging.h
 network.h
  lib
  engine
  views
 engine_adaptive.cpp
 engine_defined.cpp
 engine_approx8.cpp
 engine_graph.cpp
  io
 network_file.cpp
  reaction
 reaclib.cpp
 reaction.cpp
  screening
 screening_bare.cpp
 screening_types.cpp
 screening_weak.cpp
  solver
 solver.cpp
  utils
 logging.cpp
 network.cpp
diff --git a/docs/html/functions.html b/docs/html/functions.html index 036cc58b..7559a656 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -110,7 +110,8 @@ $(function(){initNavTree('functions.html',''); initResizable(true); });
  • a5 : gridfire::reaction::RateCoefficientSet
  • a6 : gridfire::reaction::RateCoefficientSet
  • AdaptiveEngineView() : gridfire::AdaptiveEngineView
  • -
  • add_reaction() : gridfire::reaction::LogicalReaction, gridfire::reaction::ReactionSet
  • +
  • add_reaction() : gridfire::reaction::LogicalReaction, gridfire::reaction::TemplatedReactionSet< ReactionT >
  • +
  • ADDouble : gridfire::screening::BareScreeningModel, gridfire::screening::ScreeningModel
  • aIon : gridfire::approx8::Approx8Net
  • all_species() : gridfire::reaction::Reaction
  • Approx8Network() : gridfire::approx8::Approx8Network
  • diff --git a/docs/html/functions_b.html b/docs/html/functions_b.html index 43112d91..b8f2e87b 100644 --- a/docs/html/functions_b.html +++ b/docs/html/functions_b.html @@ -102,7 +102,8 @@ $(function(){initNavTree('functions_b.html',''); initResizable(true); });
    Here is a list of all class members with links to the classes they belong to:

    - b -

    diff --git a/docs/html/functions_c.html b/docs/html/functions_c.html index 8c4855d3..7bb53e63 100644 --- a/docs/html/functions_c.html +++ b/docs/html/functions_c.html @@ -104,23 +104,27 @@ $(function(){initNavTree('functions_c.html',''); initResizable(true); });

    - c -

    diff --git a/docs/html/functions_d.html b/docs/html/functions_d.html index 315c0848..e5aacf28 100644 --- a/docs/html/functions_d.html +++ b/docs/html/functions_d.html @@ -103,7 +103,7 @@ $(function(){initNavTree('functions_d.html',''); initResizable(true); });

    - d -