|
GridFire v0.7.6rc4.0
General Purpose Nuclear Network
|
#include <py_engine.h>
Public Member Functions | |
| const std::vector< fourdst::atomic::Species > & | getNetworkSpecies (gridfire::engine::scratch::StateBlob &ctx) const override |
| PyDynamicEngine Implementation ///. | |
| std::expected< gridfire::engine::StepDerivatives< double >, gridfire::engine::EngineStatus > | calculateRHSAndEnergy (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho, bool trust) const override |
| Calculate the right-hand side (dY/dt) and energy generation. | |
| gridfire::engine::NetworkJacobian | generateJacobianMatrix (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho) const override |
| Generate the Jacobian matrix for the current state. | |
| gridfire::engine::NetworkJacobian | generateJacobianMatrix (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho, const std::vector< fourdst::atomic::Species > &activeSpecies) const override |
| Generate the Jacobian matrix for the current state using a subset of active species. | |
| gridfire::engine::NetworkJacobian | generateJacobianMatrix (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho, const gridfire::engine::SparsityPattern &sparsityPattern) const override |
| Generate the Jacobian matrix for the current state with a specified sparsity pattern. | |
| double | calculateMolarReactionFlow (gridfire::engine::scratch::StateBlob &ctx, const gridfire::reaction::Reaction &reaction, const fourdst::composition::CompositionAbstract &comp, double T9, double rho) const override |
| Calculate the molar reaction flow for a given reaction. | |
| const gridfire::reaction::ReactionSet & | getNetworkReactions (gridfire::engine::scratch::StateBlob &ctx) const override |
| Get the set of logical reactions in the network. | |
| std::expected< std::unordered_map< fourdst::atomic::Species, double >, gridfire::engine::EngineStatus > | getSpeciesTimescales (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho) const override |
| Compute timescales for all species in the network. | |
| std::expected< std::unordered_map< fourdst::atomic::Species, double >, gridfire::engine::EngineStatus > | getSpeciesDestructionTimescales (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho) const override |
| Compute destruction timescales for all species in the network. | |
| fourdst::composition::Composition | project (gridfire::engine::scratch::StateBlob &ctx, const gridfire::NetIn &netIn) const override |
| Update the thread local scratch pad state of a network. | |
| gridfire::screening::ScreeningType | getScreeningModel (gridfire::engine::scratch::StateBlob &ctx) const override |
| Get the current electron screening model. | |
| size_t | getSpeciesIndex (gridfire::engine::scratch::StateBlob &ctx, const fourdst::atomic::Species &species) const override |
| Get the index of a species in the network. | |
| gridfire::engine::PrimingReport | primeEngine (gridfire::engine::scratch::StateBlob &ctx, const gridfire::NetIn &netIn) const override |
| Prime the engine with initial conditions. | |
| gridfire::engine::EnergyDerivatives | calculateEpsDerivatives (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho) const override |
| Calculate the derivatives of the energy generation rate with respect to T and rho. | |
| fourdst::composition::Composition | collectComposition (gridfire::engine::scratch::StateBlob &ctx, const fourdst::composition::CompositionAbstract &comp, double T9, double rho) const override |
| Recursively collect composition from current engine and any sub engines if they exist. | |
| gridfire::engine::SpeciesStatus | getSpeciesStatus (gridfire::engine::scratch::StateBlob &ctx, const fourdst::atomic::Species &species) const override |
| Get the status of a species in the network. | |
| std::optional< gridfire::engine::StepDerivatives< double > > | getMostRecentRHSCalculation (gridfire::engine::scratch::StateBlob &ctx) const override |
| std::unique_ptr< gridfire::engine::scratch::StateBlob > | constructStateBlob (const gridfire::engine::scratch::StateBlob *blob) const override |
Public Member Functions inherited from gridfire::engine::DynamicEngine | |
| virtual reaction::ReactionSet | getInactiveNetworkReactions (scratch::StateBlob &ctx) const |
| Get the set of inactive reactions in the network. | |
| virtual double | getInactiveReactionMolarReactionFlow (scratch::StateBlob &ctx, const reaction::Reaction &reaction, const fourdst::composition::CompositionAbstract &comp, const double T9, const double rho) const |
Public Member Functions inherited from gridfire::engine::Engine | |
| virtual | ~Engine ()=default |
| Virtual destructor. | |
Private Attributes | |
| std::vector< fourdst::atomic::Species > | m_species_cache |
|
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::engine::DynamicEngine.
|
overridevirtual |
Calculate the molar reaction flow for a given reaction.
| ctx | The scratchpad context for the current state. |
| reaction | The reaction for which to calculate the flow. |
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
This method computes the net rate at which the given reaction proceeds under the current state.
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Calculate the right-hand side (dY/dt) and energy generation.
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
| trust | If true, indicates that the engine should trust the passed composition has already been collected. |
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.
Implements gridfire::engine::Engine.
|
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.
| ctx | The scratchpad context for the current state. |
| comp | Input composition to "normalize". |
| T9 | |
| rho |
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Generate the Jacobian matrix for the current state.
| ctx | The scratchpad context for the current state. |
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
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().
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Generate the Jacobian matrix for the current state with a specified sparsity pattern.
| ctx | Get the scratchpad context for the current state. |
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
| sparsityPattern | The sparsity pattern to use for the Jacobian matrix. |
This method must compute and store the Jacobian matrix (∂(dY/dt)_i/∂Y_j) for the current state using automatic differentiation, taking into account the provided sparsity pattern. The matrix can then be accessed via getJacobianMatrixEntry().
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Generate the Jacobian matrix for the current state using a subset of active species.
| ctx | The scratchpad context for the current state. |
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
| activeSpecies | The set of species to include in the Jacobian calculation. |
This method must compute and store the Jacobian matrix (∂(dY/dt)_i/∂Y_j) for the current state, considering only the specified subset of active species. The matrix can then be accessed via getJacobianMatrixEntry().
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Get the set of logical reactions in the network.
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
PyDynamicEngine Implementation ///.
Implements gridfire::engine::Engine.
|
overridevirtual |
Get the current electron screening model.
| ctx | The scratchpad context for the current state. |
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Compute destruction timescales for all species in the network.
| ctx | The scratchpad context for the current state. |
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
This method estimates the destruction timescale for each species, which can be useful for understanding reaction flows and equilibrium states.
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Get the index of a species in the network.
| ctx | The scratchpad context for the current state. |
| 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::engine::DynamicEngine.
|
overridevirtual |
Get the status of a species in the network.
| species | The species to check. |
This method allows querying the current status of a specific species within the engine's network.
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Compute timescales for all species in the network.
| comp | Composition object containing current abundances. |
| T9 | Temperature in units of 10^9 K. |
| rho | Density in g/cm^3. |
This method estimates the timescale for abundance change of each species, which can be used for timestep control, diagnostics, and reaction network culling.
Implements gridfire::engine::DynamicEngine.
|
overridevirtual |
Prime the engine with initial conditions.
| ctx | The scratchpad context for the current state. |
| 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::engine::DynamicEngine.
|
overridevirtual |
Update the thread local scratch pad state of a network.
| ctx | The scratchpad context for the current state. |
| netIn | A struct containing the current network input, such as temperature, density, and composition. |
This method is intended to be implemented by derived classes to update their internal state based on the provided network conditions. For example, an adaptive engine might use this to re-evaluate which reactions and species are active. For other engines that do not support manually updating, this method might do nothing.
Implements gridfire::engine::DynamicEngine.
|
mutableprivate |