feat(MultiscalePartitioningEngineView): New check for log abundance normalized flow

We added one new check to the partitioning stage for
MultiscalePartitioningEngine view which, after group validation, prunes
any species only connected by reactions with a log(flow/mean involved
species abundance) less than -30. Currently this is a magic number and
will need to be adjusted. These pruned groups succsessfully prevent
light elements getting vacumed up into QSE groups due to their overall
weak couplings to the entire network. This is important else the
conditioning of the QSE systems falls apart.
This commit is contained in:
2025-11-18 08:15:34 -05:00
parent 47c446a0a2
commit 8b1b7c3034
5 changed files with 358 additions and 20 deletions

View File

@@ -85,4 +85,19 @@ namespace gridfire {
NOT_PRESENT
};
inline std::string SpeciesStatus_to_string(const SpeciesStatus status) {
switch (status) {
case SpeciesStatus::ACTIVE:
return "ACTIVE";
case SpeciesStatus::EQUILIBRIUM:
return "EQUILIBRIUM";
case SpeciesStatus::INACTIVE_FLOW:
return "INACTIVE_FLOW";
case SpeciesStatus::NOT_PRESENT:
return "NOT_PRESENT";
default:
return "UNKNOWN_STATUS";
}
}
}

View File

@@ -431,6 +431,7 @@ namespace gridfire {
const DynamicEngine & getBaseEngine() const override;
/**
* @brief Partitions the network based on timescales from a `NetIn` struct.
*
@@ -724,6 +725,12 @@ namespace gridfire {
int df(const InputType& v_qse, JacobianType& J_qse) const;
};
struct FluxValidationResult {
std::vector<QSEGroup> valid_groups;
std::vector<QSEGroup> invalid_groups;
std::vector<reaction::ReactionSet> validatedGroupReactions;
};
private:
/**
* @brief Logger instance for logging messages.
@@ -807,7 +814,7 @@ namespace gridfire {
* flux exceeds a configurable threshold, the group is considered valid and is added
* to the returned vector.
*/
std::pair<std::vector<QSEGroup>, std::vector<QSEGroup>> validateGroupsWithFluxAnalysis(
FluxValidationResult validateGroupsWithFluxAnalysis(
const std::vector<QSEGroup> &candidate_groups,
const fourdst::composition::Composition &comp,
double T9,
@@ -929,6 +936,14 @@ namespace gridfire {
std::vector<std::vector<fourdst::atomic::Species>> analyzeTimescalePoolConnectivity(
const std::vector<std::vector<fourdst::atomic::Species>> &timescale_pools
) const;
std::vector<QSEGroup> pruneValidatedGroups(
const std::vector<QSEGroup> &groups,
const std::vector<reaction::ReactionSet> &groupReactions,
const fourdst::composition::Composition &comp,
double T9,
double rho
) const;
};
}