Merge pull request #3573 from totto82/crossFlowEcon

remove assert and handle opposite rates in wecon related fractions.
This commit is contained in:
Kai Bao 2021-11-15 15:31:05 +01:00 committed by GitHub
commit c2e18fd077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -508,19 +508,18 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
// function to calculate water cut based on rates // function to calculate water cut based on rates
auto waterCut = [](const std::vector<double>& rates, auto waterCut = [](const std::vector<double>& rates,
const PhaseUsage& pu) { const PhaseUsage& pu) {
const double oil_rate = -rates[pu.phase_pos[Oil]];
const double oil_rate = rates[pu.phase_pos[Oil]]; const double water_rate = -rates[pu.phase_pos[Water]];
const double water_rate = rates[pu.phase_pos[Water]];
// both rate should be in the same direction
assert(oil_rate * water_rate >= 0.);
const double liquid_rate = oil_rate + water_rate; const double liquid_rate = oil_rate + water_rate;
if (liquid_rate != 0.) { if (liquid_rate == 0.)
return (water_rate / liquid_rate);
} else {
return 0.; return 0.;
} else if (water_rate < 0)
return 0.;
else if (oil_rate < 0)
return 1.;
else
return (water_rate / liquid_rate);
}; };
const double max_water_cut_limit = econ_production_limits.maxWaterCut(); const double max_water_cut_limit = econ_production_limits.maxWaterCut();
@ -547,26 +546,14 @@ checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
// function to calculate gor based on rates // function to calculate gor based on rates
auto gor = [](const std::vector<double>& rates, auto gor = [](const std::vector<double>& rates,
const PhaseUsage& pu) { const PhaseUsage& pu) {
const double oil_rate = -rates[pu.phase_pos[Oil]];
const double oil_rate = rates[pu.phase_pos[Oil]]; const double gas_rate = -rates[pu.phase_pos[Gas]];
const double gas_rate = rates[pu.phase_pos[Gas]]; if (gas_rate <= 0.)
return 0.;
// both rate should be in the same direction else if (oil_rate <= 0.)
assert(oil_rate * gas_rate >= 0.); return 1.e100; // big value to mark it as violated
else
double gas_oil_ratio = 0.; return (gas_rate / oil_rate);
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(); const double max_gor_limit = econ_production_limits.maxGasOilRatio();
@ -594,25 +581,14 @@ checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
auto wgr = [](const std::vector<double>& rates, auto wgr = [](const std::vector<double>& rates,
const PhaseUsage& pu) { const PhaseUsage& pu) {
const double water_rate = rates[pu.phase_pos[Water]]; const double water_rate = -rates[pu.phase_pos[Water]];
const double gas_rate = rates[pu.phase_pos[Gas]]; const double gas_rate = -rates[pu.phase_pos[Gas]];
if (water_rate <= 0.)
// both rate should be in the same direction return 0.;
assert(water_rate * gas_rate >= 0.); else if (gas_rate <= 0.)
return 1.e100; // big value to mark it as violated
double water_gas_ratio = 0.; else
return (water_rate / gas_rate);
if (gas_rate != 0.) {
water_gas_ratio = water_rate / gas_rate;
} else {
if (water_rate != 0.) {
water_gas_ratio = 1.e100; // big value to mark it as violated
} else {
water_gas_ratio = 0.0;
}
}
return water_gas_ratio;
}; };
const double max_wgr_limit = econ_production_limits.maxWaterGasRatio(); const double max_wgr_limit = econ_production_limits.maxWaterGasRatio();