GridFire v0.7.0_rc2
General Purpose Nuclear Network
Loading...
Searching...
No Matches
dynamic_engine_diagnostics.h File Reference

Diagnostics utilities for DynamicEngine instances. More...

#include "gridfire/engine/engine_abstract.h"
#include <vector>
#include <string>
#include "nlohmann/json.hpp"
Include dependency graph for dynamic_engine_diagnostics.h:
This graph shows which files directly or indirectly include this file:

Namespaces

namespace  gridfire
 
namespace  gridfire::engine
 
namespace  gridfire::engine::diagnostics
 

Functions

std::optional< nlohmann::json > gridfire::engine::diagnostics::report_limiting_species (const DynamicEngine &engine, const std::vector< double > &Y_full, const std::vector< double > &E_full, double relTol, double absTol, size_t top_n=10, bool json=false)
 Report the species that are limiting the accuracy of the integration. This is useful for identifying species that may be limiting the timestepping due to their high relative errors compared to the specified tolerances.
 
std::optional< nlohmann::json > gridfire::engine::diagnostics::inspect_species_balance (const DynamicEngine &engine, const std::string &species_name, const fourdst::composition::Composition &comp, double T9, double rho, bool json)
 Inspect the production and destruction balance of a specific species in the reaction network. This function analyzes the reactions that create and destroy the specified species, providing insights into potential imbalances that may affect the accuracy of the simulation.
 
std::optional< nlohmann::json > gridfire::engine::diagnostics::inspect_jacobian_stiffness (const DynamicEngine &engine, const fourdst::composition::Composition &comp, double T9, double rho, bool json)
 Inspect the stiffness of the Jacobian matrix for the reaction network at the given temperature and density. This function evaluates the diagonal and off-diagonal elements of the Jacobian to identify potential numerical issues related to stiffness.
 
void gridfire::engine::diagnostics::save_jacobian_to_file (const NetworkJacobian &jacobian, const std::string &filename)
 Save the Jacobian matrix to a file for external analysis.
 

Detailed Description

Diagnostics utilities for DynamicEngine instances.

These free functions provide diagnostic tools for analyzing and reporting on the behavior of DynamicEngine instances in GridFire. They include functions for identifying limiting species, inspecting species balance, and evaluating Jacobian stiffness. Generally these functions are expensive to call and should be avoided in performance-critical code paths or during large simulations. These are primarily intended for debugging and analysis during development.

Functions

  • report_limiting_species: Identifies species that are limiting the accuracy of the integration based on specified tolerances.
  • inspect_species_balance: Analyzes the production and destruction rates of a specified species to identify imbalances.
  • inspect_jacobian_stiffness: Evaluates the stiffness of the Jacobian matrix to identify potential numerical issues.
  • save_jacobian_to_file: Saves the Jacobian matrix to a file for external analysis.
Note
Each of these functions, aside from save_jacobian_to_file, may return results in JSON format for easy integration with other tools and workflows. If the json parameter is set then the output will be formatted as JSON; otherwise, it will be printed to standard output and std::nullopt will be returned.