GridFire 0.6.0
General Purpose Nuclear Network
|
#include <engine_defined.h>
Public Member Functions | |
DefinedEngineView (const std::vector< std::string > &peNames, DynamicEngine &baseEngine) | |
const DynamicEngine & | getBaseEngine () const override |
Access the underlying engine instance. | |
const std::vector< fourdst::atomic::Species > & | getNetworkSpecies () const override |
Gets the list of active species in the network defined by the file. | |
std::expected< StepDerivatives< double >, expectations::StaleEngineError > | calculateRHSAndEnergy (const std::vector< double > &Y_defined, const double T9, const double rho) const override |
Calculates the right-hand side (dY/dt) and energy generation for the active species. | |
void | generateJacobianMatrix (const std::vector< double > &Y_dynamic, const double T9, const double rho) const override |
Generates the Jacobian matrix for the active species. | |
double | getJacobianMatrixEntry (const int i_defined, const int j_defined) const override |
Gets an entry from the Jacobian matrix for the active species. | |
void | generateStoichiometryMatrix () override |
Generates the stoichiometry matrix for the active reactions and species. | |
int | getStoichiometryMatrixEntry (const int speciesIndex_defined, const int reactionIndex_defined) const override |
Gets an entry from the stoichiometry matrix for the active species and reactions. | |
double | calculateMolarReactionFlow (const reaction::Reaction &reaction, const std::vector< double > &Y_defined, const double T9, const 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. | |
void | setNetworkReactions (const reaction::LogicalReactionSet &reactions) override |
std::expected< std::unordered_map< fourdst::atomic::Species, double >, expectations::StaleEngineError > | getSpeciesTimescales (const std::vector< double > &Y_defined, const double T9, const double rho) const override |
Computes timescales for all active species in the network. | |
std::expected< std::unordered_map< fourdst::atomic::Species, double >, expectations::StaleEngineError > | getSpeciesDestructionTimescales (const std::vector< double > &Y_defined, const double T9, const double rho) const override |
fourdst::composition::Composition | update (const NetIn &netIn) override |
Updates the engine view if it is marked as stale. | |
bool | isStale (const NetIn &netIn) override |
void | setScreeningModel (screening::ScreeningType model) override |
Sets the screening model for the base engine. | |
screening::ScreeningType | getScreeningModel () const override |
Gets the screening model from the base engine. | |
int | getSpeciesIndex (const fourdst::atomic::Species &species) const override |
Get the index of a species in the network. | |
std::vector< double > | mapNetInToMolarAbundanceVector (const NetIn &netIn) const override |
Map a NetIn object to a vector of molar abundances. | |
PrimingReport | primeEngine (const NetIn &netIn) override |
Prime the engine with initial conditions. | |
![]() | |
virtual void | generateJacobianMatrix (const std::vector< double > &Y_dynamic, double T9, double rho, const SparsityPattern &sparsityPattern) const |
virtual BuildDepthType | getDepth () const |
Get the depth of the network. | |
virtual void | rebuild (const fourdst::composition::Composition &comp, BuildDepthType depth) |
Rebuild the network with a specified depth. | |
![]() | |
virtual | ~Engine ()=default |
Virtual destructor. | |
![]() | |
virtual | ~EngineView ()=default |
Virtual destructor. | |
Protected Attributes | |
bool | m_isStale = true |
DynamicEngine & | m_baseEngine |
Private Member Functions | |
std::vector< size_t > | constructSpeciesIndexMap () const |
Constructs the species index map. | |
std::vector< size_t > | constructReactionIndexMap () const |
Constructs the reaction index map. | |
std::vector< double > | mapViewToFull (const std::vector< double > &defined) const |
Maps a vector of culled abundances to a vector of full abundances. | |
std::vector< double > | mapFullToView (const std::vector< double > &full) const |
Maps a vector of full abundances to a vector of culled abundances. | |
size_t | mapViewToFullSpeciesIndex (size_t definedSpeciesIndex) const |
Maps a culled species index to a full species index. | |
size_t | mapViewToFullReactionIndex (size_t definedReactionIndex) const |
Maps a culled reaction index to a full reaction index. | |
void | validateNetworkState () const |
void | collect (const std::vector< std::string > &peNames) |
Private Attributes | |
quill::Logger * | m_logger = fourdst::logging::LogManager::getInstance().getLogger("log") |
Active species in the defined engine. | |
std::vector< fourdst::atomic::Species > | m_activeSpecies |
Active reactions in the defined engine. | |
reaction::LogicalReactionSet | m_activeReactions |
Maps indices of active species to indices in the full network. | |
std::vector< size_t > | m_speciesIndexMap |
Maps indices of active reactions to indices in the full network. | |
std::vector< size_t > | m_reactionIndexMap |
gridfire::DefinedEngineView::DefinedEngineView | ( | const std::vector< std::string > & | peNames, |
DynamicEngine & | baseEngine ) |
|
overridevirtual |
Calculates the molar reaction flow for a given reaction in the active network.
reaction | The reaction for which to calculate the flow. |
Y_defined | Vector of current abundances for the active species. |
T9 | Temperature in units of 10^9 K. |
rho | Density in g/cm^3. |
std::runtime_error | If the view is stale or if the reaction is not in the active set. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Calculates the right-hand side (dY/dt) and energy generation for the active species.
Y_defined | A vector of abundances for the active species. |
T9 | The temperature in units of 10^9 K. |
rho | The density in g/cm^3. |
std::runtime_error | If the view is stale (i.e., update() has not been called after setNetworkFile() ). |
Implements gridfire::Engine.
|
private |
|
private |
Constructs the reaction index map.
This method creates a map from the indices of the active reactions to the indices of the corresponding reactions in the full network.
std::runtime_error | If an active reaction is not found in the base engine's reaction list. |
|
private |
Constructs the species index map.
This method creates a map from the indices of the active species to the indices of the corresponding species in the full network.
std::runtime_error | If an active species is not found in the base engine's species list. |
|
overridevirtual |
Generates the Jacobian matrix for the active species.
Y_dynamic | A vector of abundances for the active species. |
T9 | The temperature in units of 10^9 K. |
rho | The density in g/cm^3. |
std::runtime_error | If the view is stale. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Generates the stoichiometry matrix for the active reactions and species.
std::runtime_error | If the view is stale. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Access the underlying engine instance.
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:
Implements gridfire::EngineView< DynamicEngine >.
|
overridevirtual |
Gets an entry from the Jacobian matrix for the active species.
i_defined | The row index (species index) in the defined matrix. |
j_defined | The column index (species index) in the defined matrix. |
std::runtime_error | If the view is stale. |
std::out_of_range | If an index is out of bounds. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Gets the set of active logical reactions in the network.
std::runtime_error | If the view is stale. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Gets the list of active species in the network defined by the file.
Implements gridfire::Engine.
|
nodiscardoverridevirtual |
Gets the screening model from the base engine.
Implements gridfire::DynamicEngine.
|
nodiscardoverridevirtual |
Implements gridfire::DynamicEngine.
|
nodiscardoverridevirtual |
Get the index of a species in the network.
species | The species to look up. |
This method allows querying the index of a specific species in the engine's internal representation. It is useful for accessing species data efficiently.
Implements gridfire::DynamicEngine.
|
nodiscardoverridevirtual |
Computes timescales for all active species in the network.
Y_defined | Vector of current abundances for the active species. |
T9 | Temperature in units of 10^9 K. |
rho | Density in g/cm^3. |
std::runtime_error | If the view is stale. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Gets an entry from the stoichiometry matrix for the active species and reactions.
speciesIndex_defined | The index of the species in the defined species list. |
reactionIndex_defined | The index of the reaction in the defined reaction list. |
std::runtime_error | If the view is stale. |
std::out_of_range | If an index is out of bounds. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Implements gridfire::DynamicEngine.
|
private |
Maps a vector of full abundances to a vector of culled abundances.
full | A vector of abundances for the full network. |
|
nodiscardoverridevirtual |
Map a NetIn object to a vector of molar abundances.
netIn | The input conditions for the network. |
This method converts the input conditions into a vector of molar abundances, which can be used for further calculations or diagnostics.
Implements gridfire::DynamicEngine.
|
private |
Maps a vector of culled abundances to a vector of full abundances.
defined | A vector of abundances for the active species. |
|
private |
Maps a culled reaction index to a full reaction index.
definedReactionIndex | The index of the reaction in the defined reaction list. |
std::out_of_range | If the defined index is out of bounds for the reaction index map. |
|
private |
Maps a culled species index to a full species index.
definedSpeciesIndex | The index of the species in the defined species list. |
std::out_of_range | If the defined index is out of bounds for the species index map. |
|
nodiscardoverridevirtual |
Prime the engine with initial conditions.
netIn | The input conditions for the network. |
This method is used to prepare the engine for calculations by setting up initial conditions, reactions, and species. It may involve compiling reaction rates, initializing internal data structures, and performing any necessary pre-computation.
Implements gridfire::DynamicEngine.
|
overridevirtual |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Sets the screening model for the base engine.
model | The screening model to set. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Updates the engine view if it is marked as stale.
This method checks if the view is stale (e.g., after setNetworkFile
was called). If it is, it rebuilds the active network from the currently set file. The netIn
parameter is not used by this implementation but is required by the interface.
netIn | The current network input (unused). |
Implements gridfire::DynamicEngine.
|
private |
|
private |
Maps indices of active species to indices in the full network.
|
private |
Active reactions in the defined engine.
|
protected |
|
protected |
|
private |
Active species in the defined engine.
Logger instance for trace and debug information.
|
private |
|
private |
Maps indices of active reactions to indices in the full network.