61 double mixed_volume,
double arriving_volume) {
62 if (!(mixed_volume > 1e-12) || !(arriving_volume > 1e-12))
65 for (
const auto& source : r.sources)
66 if (source.booster && source.node ==
node && source.species == species) {
67 const double strength =
69 const double added = source.booster == 1 ? strength * arriving_volume
70 : std::max(0., strength * mixed_volume - mass);
71 if (r.booster_mass.size() != std::size_t(r.n_species()))
72 r.booster_mass.assign(r.n_species(), 0.);
73 r.booster_mass[species] += added;
74 if (r.msx_ledger.armed)
75 r.msx_ledger.inflow[species] += added;
The central, reentrant simulation context for the new engine.
double reactionSourceFactor(const ReactionData &r, const ReactionData::Source &source, double seconds)
Read a periodic reaction-source pattern factor at an elapsed simulation time.
Definition ReactionSources.hpp:28
double reactionBoosterMass(SimulationContext &ctx, int node, int species, double mass, double mixed_volume, double arriving_volume)
Compute and book the first matching node/species booster inventory addition.
Definition ReactionSources.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
ReactionData reactions
Multispecies reaction system (EPANET-MSX conventions), parsed from the reactions component's config f...
Definition SimulationContext.hpp:624
double current_time
Current simulation time in SECONDS from start_date.
Definition SimulationContext.hpp:489