move checkMaxWGRLimit to WellTest

This commit is contained in:
Arne Morten Kvarving
2022-10-24 11:40:30 +02:00
parent fe8259bb76
commit e7273868f5
4 changed files with 39 additions and 40 deletions
@@ -590,41 +590,6 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
}
}
template<typename FluidSystem>
void
WellInterfaceFluidSystem<FluidSystem>::
checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
const SingleWellState& ws,
RatioLimitCheckReport& report) const
{
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
// function to calculate wgr based on rates
auto wgr = [](const std::vector<double>& rates,
const PhaseUsage& pu) {
const double water_rate = -rates[pu.phase_pos[Water]];
const double gas_rate = -rates[pu.phase_pos[Gas]];
if (water_rate <= 0.)
return 0.;
else if (gas_rate <= 0.)
return 1.e100; // big value to mark it as violated
else
return (water_rate / gas_rate);
};
const double max_wgr_limit = econ_production_limits.maxWaterGasRatio();
assert(max_wgr_limit > 0.);
const bool wgr_limit_violated = WellTest(*this).checkMaxRatioLimitWell(ws, max_wgr_limit, wgr);
if (wgr_limit_violated) {
report.ratio_limit_violated = true;
WellTest(*this).checkMaxRatioLimitCompletions(ws, max_wgr_limit, wgr, report);
}
}
template<typename FluidSystem>
void
WellInterfaceFluidSystem<FluidSystem>::
@@ -652,7 +617,9 @@ checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
}
if (econ_production_limits.onMaxWaterGasRatio()) {
checkMaxWGRLimit(econ_production_limits, ws, report);
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
WellTest(*this).checkMaxWGRLimit(econ_production_limits, ws, report);
}
if (econ_production_limits.onMaxGasLiquidRatio()) {