Core header for the GridFire reaction network engine module.
This module defines the core interfaces and classes for reaction network engines in GridFire. It provides abstract base classes for engines, dynamic engines, and engine views, as well as concrete engine implementations and view implementations.
The engine module is designed to support a wide range of reaction network simulations, from simple single-zone calculations to complex multi-zone simulations with adaptive network topologies.
Engine Design
The engine module is built around the following key concepts:
- Engine: The base class for all reaction network engines. It defines the minimal interface for evaluating the right-hand side (dY/dt) and energy generation rate for a given set of abundances, temperature, and density.
- DynamicEngine: An extension of the Engine class that supports Jacobian and stoichiometry operations, as well as the ability to dynamically modify the reaction network.
- EngineView: An abstract base class for "views" of reaction network engines. Engine views provide a way to dynamically or adaptively modify the network topology without modifying the underlying physics engine.
Engine Composition
Engines and engine views can be composed to create complex reaction network simulations. For example, an AdaptiveEngineView can be used to dynamically cull species and reactions from a GraphEngine, reducing the computational cost of the simulation.
The order in which engines and engine views are composed is important. The base engine should always be the innermost engine, and the engine views should be layered on top of the base engine.
Available Engines
The engine module provides the following concrete engine implementations:
- GraphEngine: A reaction network engine that uses a graph-based representation of the reaction network. It uses sparse matrices for efficient storage and computation of the stoichiometry and Jacobian matrices.
Available Views
The engine module provides the following engine view implementations:
- AdaptiveEngineView: An engine view that dynamically adapts the reaction network based on runtime conditions. It culls species and reactions with low reaction flow rates, reducing the computational cost of the simulation.
- DefinedEngineView: An engine view that restricts the reaction network to a predefined set of species and reactions. This can be useful for simulating specific reaction pathways or for comparing results with other codes.
- MultiscalePartitioningEngineView: An engine view that partitions the reaction network into multiple groups based on timescales. This can be useful for simulating stiff reaction networks, where some reactions occur much faster than others.
- NetworkPrimingEngineView: An engine view that primes the reaction network with a specific species or set of species. This can be useful for igniting a reaction network or for studying the effects of specific species on the network.
Usage Examples
GraphEngine Example
The following code shows how to create a GraphEngine from a composition:
#include "fourdst/composition/composition.h"
fourdst::composition::Composition composition;
A reaction network engine that uses a graph-based representation.
Definition engine_graph.h:100
AdaptiveEngineView Example
The following code shows how to create an AdaptiveEngineView from a GraphEngine:
#include "fourdst/composition/composition.h"
fourdst::composition::Composition composition;
An engine view that dynamically adapts the reaction network based on runtime conditions.
Definition engine_adaptive.h:50
DefinedEngineView Example
The following code shows how to create a DefinedEngineView from a GraphEngine:
#include "fourdst/composition/composition.h"
fourdst::composition::Composition composition;
std::vector<std::string> peNames = {"p(p,e+)d", "he4(a,g)be8"};
Definition engine_defined.h:16
MultiscalePartitioningEngineView Example
The following code shows how to create a MultiscalePartitioningEngineView from a GraphEngine:
#include "fourdst/composition/composition.h"
fourdst::composition::Composition composition;
An engine view that partitions the reaction network into multiple groups based on timescales.
Definition engine_multiscale.h:182
NetworkPrimingEngineView Example
The following code shows how to create a NetworkPrimingEngineView from a GraphEngine:
#include "fourdst/composition/composition.h"
fourdst::composition::Composition composition;
std::string primingSymbol = "p";
Provides a view of a DynamicEngine filtered to reactions involving a specified priming species.
Definition engine_priming.h:30