GridFire v0.7.0-alpha 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::LowMassMainSequencePolicy 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::LowMassMainSequencePolicy:
[legend]
Collaboration diagram for gridfire::policy::LowMassMainSequencePolicy:
[legend]

## Public Member Functions
| LowMassMainSequencePolicy (const fourdst::composition::Composition &composition)
| Constructs the policy from an existing composition object.
| LowMassMainSequencePolicy (std::vector< fourdst::atomic::Species > seed_species, 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).
DynamicEngine & | construct () override
| Constructs and returns the complete, multi-layered dynamic engine.
NetworkPolicyStatus | getStatus () const override
| Gets the current status of the policy.
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
std::unique_ptr< ReactionChainPolicy > | m_reaction_policy = std::make_unique<LowMassMainSequenceReactionChainPolicy>()
fourdst::composition::Composition | m_initializing_composition
std::unique_ptr< partition::PartitionFunction > | m_partition_function
std::vector< std::unique_ptr< DynamicEngine > > | m_network_stack
NetworkPolicyStatus | m_status = NetworkPolicyStatus::UNINITIALIZED

## 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

## ◆ LowMassMainSequencePolicy() [1/2]

gridfire::policy::LowMassMainSequencePolicy::LowMassMainSequencePolicy | ( | const fourdst::composition::Composition & | composition | ) |
| inline 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);
  gridfire::policy::LowMassMainSequencePolicy::LowMassMainSequencePolicy
  LowMassMainSequencePolicy(const fourdst::composition::Composition &composition)
  Constructs the policy from an existing composition object.
  Definition stellar_policy.h:174
  gridfire::policy
  Definition chains.h:28

## ◆ LowMassMainSequencePolicy() [2/2]

gridfire::policy::LowMassMainSequencePolicy::LowMassMainSequencePolicy | ( | std::vector< fourdst::atomic::Species > | seed_species,
|  | std::vector< double > | mass_fractions )
| inline 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::LowMassMainSequencePolicy::build_partition_function | ( |  | ) |
| inline static private

## ◆ check_status()

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

## ◆ construct()

DynamicEngine & gridfire::policy::LowMassMainSequencePolicy::construct | ( |  | ) |
| inline 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::DynamicEngine
  Abstract class for engines supporting Jacobian and stoichiometry operations.
  Definition engine_abstract.h:143
  gridfire::solver::CVODESolverStrategy
  Stiff ODE integrator backed by SUNDIALS CVODE (BDF) for network + energy.
  Definition CVODE_solver_strategy.h:81
  gridfire::solver
  Definition solver.h:12

Implements gridfire::policy::NetworkPolicy.

## ◆ get_seed_reactions()

const reaction::ReactionSet & gridfire::policy::LowMassMainSequencePolicy::get_seed_reactions | ( |  | ) | const
| inline nodiscard 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::LowMassMainSequencePolicy::get_seed_species | ( |  | ) | const
| inline nodiscard override virtual

Returns the set of seed species required by this policy.

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

Implements gridfire::policy::NetworkPolicy.

## ◆ getStatus()

NetworkPolicyStatus gridfire::policy::LowMassMainSequencePolicy::getStatus | ( |  | ) | const
| inline nodiscard 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::LowMassMainSequencePolicy::name | ( |  | ) | const
| inline nodiscard override virtual

Returns the name of the policy.

Returns
  "LowMassMainSequencePolicy"

Implements gridfire::policy::NetworkPolicy.

## Member Data Documentation

## ◆ m_initializing_composition

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

## ◆ m_network_stack

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

## ◆ m_partition_function

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

## ◆ m_reaction_policy

std::unique_ptr<ReactionChainPolicy> gridfire::policy::LowMassMainSequencePolicy::m_reaction_policy = std::make_unique<LowMassMainSequenceReactionChainPolicy>()
| private

## ◆ m_seed_species

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

Initial value:
= {
fourdst::atomic::H_1,
fourdst::atomic::He_3,
fourdst::atomic::He_4,
fourdst::atomic::C_12,
fourdst::atomic::N_14,
fourdst::atomic::O_16,
fourdst::atomic::Ne_20,
fourdst::atomic::Mg_24
}

## ◆ m_status

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

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

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