|
GridFire v0.7.0-alpha
General Purpose Nuclear Network
|
#include <engine_defined.h>
Public Member Functions | |
| DefinedEngineView (const std::vector< std::string > &peNames, GraphEngine &baseEngine) | |
| const DynamicEngine & | getBaseEngine () const override |
| Get the base engine associated with this defined engine view. | |
| 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 fourdst::composition::Composition &comp, double T9, double rho) const override |
| Calculates the right-hand side (dY/dt) and energy generation for the active species. | |
| EnergyDerivatives | calculateEpsDerivatives (const fourdst::composition::Composition &comp, double T9, double rho) const override |
| Calculate the derivatives of the energy generation rate with respect to T and rho. | |
| void | generateJacobianMatrix (const fourdst::composition::Composition &comp, double T9, double rho) const override |
| Generates the Jacobian matrix for the active species. | |
| void | generateJacobianMatrix (const fourdst::composition::Composition &comp, double T9, double rho, const std::vector< fourdst::atomic::Species > &activeSpecies) const override |
| Generates the Jacobian matrix for the active species. | |
| void | generateJacobianMatrix (const fourdst::composition::Composition &comp, double T9, double rho, const SparsityPattern &sparsityPattern) const override |
| Generates the Jacobian matrix for a given sparsity pattern. | |
| double | getJacobianMatrixEntry (const fourdst::atomic::Species &rowSpecies, const fourdst::atomic::Species &colSpecies) 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 fourdst::atomic::Species &species, const reaction::Reaction &reaction) const override |
| Gets an entry from the stoichiometry matrix for the active species and reactions. | |
| double | calculateMolarReactionFlow (const reaction::Reaction &reaction, const fourdst::composition::Composition &comp, double T9, double rho) const override |
| Calculates the molar reaction flow for a given reaction in the active network. | |
| const reaction::ReactionSet & | getNetworkReactions () const override |
| Gets the set of active logical reactions in the network. | |
| void | setNetworkReactions (const reaction::ReactionSet &reactions) override |
| std::expected< std::unordered_map< fourdst::atomic::Species, double >, expectations::StaleEngineError > | getSpeciesTimescales (const fourdst::composition::Composition &comp, double T9, 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 fourdst::composition::Composition &comp, double T9, 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. | |
| size_t | 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. | |
| fourdst::composition::Composition | collectComposition (fourdst::composition::Composition &comp) const override |
| Recursively collect composition from current engine and any sub engines if they exist. | |
Public Member Functions inherited from gridfire::DynamicEngine | |
| 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. | |
Public Member Functions inherited from gridfire::Engine | |
| virtual | ~Engine ()=default |
| Virtual destructor. | |
Public Member Functions inherited from gridfire::EngineView< DynamicEngine > | |
| virtual | ~EngineView ()=default |
| Virtual destructor. | |
Protected Attributes | |
| bool | m_isStale = true |
| GraphEngine & | 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::set< fourdst::atomic::Species > | m_activeSpecies |
| Cache for the active species vector to avoid dangling references. | |
| std::optional< std::vector< fourdst::atomic::Species > > | m_activeSpeciesVectorCache = std::nullopt |
| Active reactions in the defined engine. | |
| reaction::ReactionSet | 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, |
| GraphEngine & | baseEngine ) |
|
nodiscardoverridevirtual |
Calculate the derivatives of the energy generation rate with respect to T and rho.
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
This method computes the partial derivatives of the specific nuclear energy generation rate with respect to temperature and density for the current state.
Implements gridfire::DynamicEngine.
|
nodiscardoverridevirtual |
Calculates the molar reaction flow for a given reaction in the active network.
| reaction | The reaction for which to calculate the flow. |
| comp | A Composition object containing the current composition of the system |
| 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.
|
nodiscardoverridevirtual |
Calculates the right-hand side (dY/dt) and energy generation for the active species.
| comp | A Composition object containing the current composition of the system |
| 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 |
|
overridevirtual |
Recursively collect composition from current engine and any sub engines if they exist.
If species i is defined in comp and in any sub engine or self composition then the molar abundance of species i in the returned composition will be that defined in comp. If there are species defined in sub engine compositions which are not defined in comp then their molar abundances will be based on the reported values from each sub engine.
| comp | Input composition to "normalize". |
Implements gridfire::DynamicEngine.
|
nodiscardprivate |
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. |
|
nodiscardprivate |
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.
| comp | A Composition object containing the current composition of the system |
| 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 Jacobian matrix for a given sparsity pattern.
| comp | A Composition object containing the current composition of the system |
| T9 | The temperature in units of 10^9 K. |
| rho | The density in g/cm^3. |
| sparsityPattern | The sparsity pattern to use for the Jacobian matrix. |
| std::runtime_error | If the view is stale. |
Implements gridfire::DynamicEngine.
|
overridevirtual |
Generates the Jacobian matrix for the active species.
| comp | A Composition object containing the current composition of the system |
| T9 | The temperature in units of 10^9 K. |
| rho | The density in g/cm^3. |
| activeSpecies | The vector of active species to include in the Jacobian. |
| 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.
|
nodiscardoverridevirtual |
Get the base engine associated with this defined engine view.
Implements gridfire::EngineView< DynamicEngine >.
|
nodiscardoverridevirtual |
Gets an entry from the Jacobian matrix for the active species.
| rowSpecies | The species corresponding to the row index. |
| colSpecies | The species corresponding to the column index. |
| std::runtime_error | If the view is stale. |
| std::out_of_range | If an index is out of bounds. |
Implements gridfire::DynamicEngine.
|
nodiscardoverridevirtual |
Gets the set of active logical reactions in the network.
| std::runtime_error | If the view is stale. |
Implements gridfire::DynamicEngine.
|
nodiscardoverridevirtual |
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.
| comp | A Composition object containing the current composition of the system |
| 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.
|
nodiscardoverridevirtual |
Gets an entry from the stoichiometry matrix for the active species and reactions.
| species | The species for which to get the stoichiometric coefficient. |
| reaction | The reaction for which to get the stoichiometric coefficient. |
| 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.
|
nodiscardprivate |
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.
|
nodiscardprivate |
Maps a vector of culled abundances to a vector of full abundances.
| defined | A vector of abundances for the active species. |
|
nodiscardprivate |
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. |
|
nodiscardprivate |
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 |
Cache for the active species vector to avoid dangling references.
|
mutableprivate |
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.