Merge pull request #1922 from GitPaean/support_gor_wecon

adding GOR checking for WECON
This commit is contained in:
Atgeirr Flø Rasmussen 2019-07-05 15:47:16 +02:00 committed by GitHub
commit 2058d47fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 1 deletions

View File

@ -385,11 +385,16 @@ namespace Opm
const WellState& well_state,
RatioLimitCheckReport& report) const;
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
const WellState& well_state,
RatioLimitCheckReport& report) const;
void checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
const WellState& well_state,
RatioLimitCheckReport& report,
Opm::DeferredLogger& deferred_logger) const;
template <typename RatioFunc>
bool checkMaxRatioLimitWell(const WellState& well_state,
const double max_ratio_limit,

View File

@ -648,6 +648,57 @@ namespace Opm
template<typename TypeTag>
void
WellInterface<TypeTag>::
checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
const WellState& well_state,
RatioLimitCheckReport& report) const
{
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
// function to calculate gor based on rates
auto gor = [](const std::vector<double>& rates,
const PhaseUsage& pu) {
const double oil_rate = rates[pu.phase_pos[Oil]];
const double gas_rate = rates[pu.phase_pos[Gas]];
// both rate should be in the same direction
assert(oil_rate * gas_rate >= 0.);
double gas_oil_ratio = 0.;
if (oil_rate != 0.) {
gas_oil_ratio = gas_rate / oil_rate;
} else {
if (gas_rate != 0.) {
gas_oil_ratio = 1.e100; // big value to mark it as violated
} else {
gas_oil_ratio = 0.0;
}
}
return gas_oil_ratio;
};
const double max_gor_limit = econ_production_limits.maxGasOilRatio();
assert(max_gor_limit > 0.);
const bool gor_limit_violated = checkMaxRatioLimitWell(well_state, max_gor_limit, gor);
if (gor_limit_violated) {
report.ratio_limit_violated = true;
checkMaxRatioLimitCompletions(well_state, max_gor_limit, gor, report);
}
}
template<typename TypeTag>
void
WellInterface<TypeTag>::
@ -669,7 +720,7 @@ namespace Opm
}
if (econ_production_limits.onMaxGasOilRatio()) {
deferred_logger.warning("NOT_SUPPORTING_MAX_GOR", "the support for max Gas-Oil ratio is not implemented yet!");
checkMaxGORLimit(econ_production_limits, well_state, report);
}
if (econ_production_limits.onMaxWaterGasRatio()) {