GridFire v0.7.1_rc2 General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
gridfire::policy::MainSequencePolicy Class Referencefinal

A NetworkPolicy for building reaction networks suitable for low-mass main-sequence stars. More...

`#include <stellar_policy.h>`

Inheritance diagram for gridfire::policy::MainSequencePolicy:
[legend]
Collaboration diagram for gridfire::policy::MainSequencePolicy:
[legend]

## Public Member Functions
| MainSequencePolicy (const fourdst::composition::Composition &composition)
| Constructs the policy from an existing composition object.
| MainSequencePolicy (std::vector< fourdst::atomic::Species > seed_species, const std::vector< double > &mass_fractions)
| Constructs the policy from a list of species and their mass fractions.
std::string | name () const override
| Returns the name of the policy.
const std::set< fourdst::atomic::Species > & | get_seed_species () const override
| Returns the set of seed species required by this policy.
const reaction::ReactionSet & | get_seed_reactions () const override
| Returns the set of seed reactions required by this policy (from the PP and CNO chains).
engine::DynamicEngine & | construct () override
| Constructs and returns the complete, multi-layered dynamic engine.
NetworkPolicyStatus | get_status () const override
| Gets the current status of the policy.
const std::vector< std::unique_ptr< engine::DynamicEngine > > & | get_engine_stack () const override
std::vector< engine::EngineTypes > | get_engine_types_stack () const override
const std::unique_ptr< partition::PartitionFunction > & | get_partition_function () const override
Public Member Functions inherited from gridfire::policy::NetworkPolicy
virtual | ~NetworkPolicy ()=default

## Private Member Functions
NetworkPolicyStatus | check_status () const

## Static Private Member Functions
static std::unique_ptr< partition::PartitionFunction > | build_partition_function ()

## Private Attributes
std::set< fourdst::atomic::Species > | m_seed_species
| The set of seed species required by this policy. These are H-1, He-3, He-4, C-12, N-14, O-16, Ne-20, Mg-24.
std::unique_ptr< ReactionChainPolicy > | m_reaction_policy = std::make_unique<MainSequenceReactionChainPolicy>()
| The composed reaction chain policy (PP-chain + CNO-cycle).
fourdst::composition::Composition | m_initializing_composition
| The initial composition used to build the network.
std::unique_ptr< partition::PartitionFunction > | m_partition_function
| The partition function used in network construction.
std::vector< std::unique_ptr< engine::DynamicEngine > > | m_network_stack
| The stack of dynamic engines constructed by the policy.
NetworkPolicyStatus | m_status = NetworkPolicyStatus::UNINITIALIZED
| The current status of the policy.

## Detailed Description

A NetworkPolicy for building reaction networks suitable for low-mass main-sequence stars.

This policy ensures that a constructed network contains all necessary species and reactions for modeling the core hydrogen burning phase in low-mass stars, primarily the PP-chain and the CNO-cycle.

The `construct()` method builds a stack of engine views (`GraphEngine` -> `MultiscalePartitioningEngineView` -> `AdaptiveEngineView`) to provide a dynamically adjusting, performance-optimized reaction network.

This policy requires the following seed species:

- H-1
- He-3
- He-4
- C-12
- N-14
- O-16
- Ne-20
- Mg-24

This policy composes the `ProtonProtonChainPolicy` and `CNOChainPolicy` to define the required reactions.

## Constructor & Destructor Documentation

## ◆ MainSequencePolicy() [1/2]

gridfire::policy::MainSequencePolicy::MainSequencePolicy | ( | const fourdst::composition::Composition & | composition | ) |
| explicit

Constructs the policy from an existing composition object.

Parameters

  composition | The initial composition, which must contain all seed species required by the policy.

Exceptions

  exceptions::MissingSeedSpeciesError | if the provided `composition` is missing a required species.

Example
  fourdst::composition::Composition comp;
  // ... populate composition ...
  LowMassMainSequencePolicy policy(comp);

## ◆ MainSequencePolicy() [2/2]

gridfire::policy::MainSequencePolicy::MainSequencePolicy | ( | std::vector< fourdst::atomic::Species > | seed_species,
|  | const std::vector< double > & | mass_fractions
| ) |  |
| explicit

Constructs the policy from a list of species and their mass fractions.

Parameters

  seed_species | A vector of atomic species.
  mass_fractions | A vector of corresponding mass fractions.

Exceptions

  exceptions::MissingSeedSpeciesError | if the provided species list is missing a required seed species.
  fourdst::composition::exceptions::CompositionNotFinalizedError | if the internal composition fails to finalize.

Example
  using namespace fourdst::atomic;
  std::vector<Species> species = {H_1, He_4, C_12, O_16};
  std::vector<double> mass_fractions = {0.7, 0.28, 0.01, 0.01};
  LowMassMainSequencePolicy policy(species, mass_fractions);

## Member Function Documentation

## ◆ build_partition_function()

std::unique_ptr< partition::PartitionFunction > gridfire::policy::MainSequencePolicy::build_partition_function | ( |  | ) |
| inline static private

## ◆ check_status()

NetworkPolicyStatus gridfire::policy::MainSequencePolicy::check_status | ( |  | ) | const
| inline private

## ◆ construct()

engine::DynamicEngine & gridfire::policy::MainSequencePolicy::construct | ( |  | ) |
| override virtual

Constructs and returns the complete, multi-layered dynamic engine.

This method builds the full network engine stack:

- A base `GraphEngine` is created with the initial composition. This is constructed three layers deep which is sufficient to capture all required reactions. Further a composite ground state and Rauscher Thielemann partition function is used.
- A `MultiscalePartitioningEngineView` is layered on top for performance optimization. This will put some species into equilibrium groups based on their reaction timescales.
- An `AdaptiveEngineView` is added as the final layer to dynamically cull reaction pathways based on molar reaction flows.

After construction, it verifies that the resulting network meets the policy's requirements.

Returns
  DynamicEngine& A reference to the top-level `AdaptiveEngineView`.

Exceptions

  exceptions::MissingKeyReactionError | if the final network is missing a required reaction.
  exceptions::MissingSeedSpeciesError | if the final network is missing a required species.
  exceptions::PolicyError | on other verification failures.

Example
  LowMassMainSequencePolicy enginePolicy(composition);
  DynamicEngine& engine = enginePolicy.construct();
  solver::CVODESolverStrategy solver(engine);
  // ... run solver ...
  gridfire::solver::CVODESolverStrategy
  Stiff ODE integrator backed by SUNDIALS CVODE (BDF) for network + energy.
  Definition CVODE_solver_strategy.h:81

Implements gridfire::policy::NetworkPolicy.

## ◆ get_engine_stack()

const std::vector< std::unique_ptr< engine::DynamicEngine > > & gridfire::policy::MainSequencePolicy::get_engine_stack | ( |  | ) | const
| override virtual

Implements gridfire::policy::NetworkPolicy.

## ◆ get_engine_types_stack()

std::vector< engine::EngineTypes > gridfire::policy::MainSequencePolicy::get_engine_types_stack | ( |  | ) | const
| override virtual

Implements gridfire::policy::NetworkPolicy.

## ◆ get_partition_function()

const std::unique_ptr< partition::PartitionFunction > & gridfire::policy::MainSequencePolicy::get_partition_function | ( |  | ) | const
| override virtual

Implements gridfire::policy::NetworkPolicy.

## ◆ get_seed_reactions()

const reaction::ReactionSet & gridfire::policy::MainSequencePolicy::get_seed_reactions | ( |  | ) | const
| inline override virtual

Returns the set of seed reactions required by this policy (from the PP and CNO chains).

Returns
  const reaction::ReactionSet&

Implements gridfire::policy::NetworkPolicy.

## ◆ get_seed_species()

const std::set< fourdst::atomic::Species > & gridfire::policy::MainSequencePolicy::get_seed_species | ( |  | ) | const
| inline override virtual

Returns the set of seed species required by this policy.

Returns
  const std::set<fourdst::atomic::Species>&

Implements gridfire::policy::NetworkPolicy.

## ◆ get_status()

NetworkPolicyStatus gridfire::policy::MainSequencePolicy::get_status | ( |  | ) | const
| inline override virtual

Gets the current status of the policy.

Returns
  NetworkPolicyStatus The construction and verification status.

Implements gridfire::policy::NetworkPolicy.

## ◆ name()

std::string gridfire::policy::MainSequencePolicy::name | ( |  | ) | const
| inline override virtual

Returns the name of the policy.

Returns
  "MainSequencePolicy"

Implements gridfire::policy::NetworkPolicy.

## Member Data Documentation

## ◆ m_initializing_composition

fourdst::composition::Composition gridfire::policy::MainSequencePolicy::m_initializing_composition
| private

The initial composition used to build the network.

## ◆ m_network_stack

std::vector<std::unique_ptr<engine::DynamicEngine> > gridfire::policy::MainSequencePolicy::m_network_stack
| private

The stack of dynamic engines constructed by the policy.

## ◆ m_partition_function

std::unique_ptr<partition::PartitionFunction> gridfire::policy::MainSequencePolicy::m_partition_function
| private

The partition function used in network construction.

## ◆ m_reaction_policy

std::unique_ptr<ReactionChainPolicy> gridfire::policy::MainSequencePolicy::m_reaction_policy = std::make_unique<MainSequenceReactionChainPolicy>()
| private

The composed reaction chain policy (PP-chain + CNO-cycle).

## ◆ m_seed_species

std::set<fourdst::atomic::Species> gridfire::policy::MainSequencePolicy::m_seed_species
| private

The set of seed species required by this policy. These are H-1, He-3, He-4, C-12, N-14, O-16, Ne-20, Mg-24.

## ◆ m_status

NetworkPolicyStatus gridfire::policy::MainSequencePolicy::m_status = NetworkPolicyStatus::UNINITIALIZED
| private

The current status of the policy.

The documentation for this class was generated from the following files:

- src/include/gridfire/policy/stellar_policy.h
- src/lib/policy/stellar_policy.cpp