Loading...
Searching...
No Matches
gridfire::engine::diagnostics Namespace Reference

## Functions

std::optional< nlohmann::json > | 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 > | 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 > | 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 | save_jacobian_to_file (const NetworkJacobian &jacobian, const std::string &filename)
| Save the Jacobian matrix to a file for external analysis.

## Function Documentation

## inspect_jacobian_stiffness()

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.

Parameters

  engine | Constant reference to the DynamicEngine instance.
  comp | The current composition of the system as a fourdst::composition::Composition object.
  T9 | The temperature in GK (10^9 K).
  rho | The density in g/cm^3.
  json | Flag indicating whether to return the results in JSON format. If false, results are printed to standard output.

Returns
  std::optional<nlohmann::json> JSON object containing the Jacobian stiffness report if `json` is true; otherwise, std::nullopt.

## inspect_species_balance()

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.

Parameters

  engine | Constant reference to the DynamicEngine instance.
  species_name | The name of the species to inspect.
  comp | The current composition of the system as a fourdst::composition::Composition object.
  T9 | The temperature in GK (10^9 K).
  rho | The density in g/cm^3.
  json | Flag indicating whether to return the results in JSON format. If false, results are printed to standard output.

Returns
  std::optional<nlohmann::json> JSON object containing the species balance report if `json` is true; otherwise, std::nullopt.

## report_limiting_species()

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.

Parameters

  engine | Constant reference to the DynamicEngine instance.
  Y_full | Vector of the current species molar abundances sorted in the same order as the dynamic engine species list.
  E_full | Vector of the current species molar abundance errors sorted in the same order as the dynamic engine species list.
  relTol | Relative tolerance for the integration.
  absTol | Absolute tolerance for the integration.
  top_n | The number of top limiting species to report. Default is 10.
  json | Flag indicating whether to return the results in JSON format. If false, results are printed to standard output.

Returns
  std::optional<nlohmann::json> JSON object containing the limiting species report if `json` is true; otherwise, std::nullopt.

## save_jacobian_to_file()

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.

Parameters

  jacobian | Constant reference to the NetworkJacobian instance to be saved.
  filename | The name of the file where the Jacobian will be saved.