only mark negative potentials as not operable

This commit is contained in:
Tor Harald Sandve
2021-11-22 11:27:45 +00:00
parent b5cdb1048a
commit 43fd50e355
4 changed files with 20 additions and 40 deletions

View File

@@ -253,7 +253,7 @@ namespace Opm
if (this->wellIsStopped()) { if (this->wellIsStopped()) {
return; return;
} }
this->operability_status_.has_non_positive_potentials = false; this->operability_status_.has_negative_potentials = false;
// If the well is pressure controlled the potential equals the rate. // If the well is pressure controlled the potential equals the rate.
bool thp_controlled_well = false; bool thp_controlled_well = false;
@@ -279,27 +279,17 @@ namespace Opm
if (thp_controlled_well || bhp_controlled_well) { if (thp_controlled_well || bhp_controlled_well) {
double total_rate = 0.0; double total_rate = 0.0;
const double sign = this->isInjector() ? 1.0:-1.0;
for (int phase = 0; phase < np; ++phase){ for (int phase = 0; phase < np; ++phase){
total_rate += ws.surface_rates[phase]; total_rate += sign * ws.surface_rates[phase];
} }
// for pressure controlled wells the well rates are the potentials // for pressure controlled wells the well rates are the potentials
// if the rates are trivial we are most probably looking at the newly // if the rates are trivial we are most probably looking at the newly
// opened well and we therefore make the affort of computing the potentials anyway. // opened well and we therefore make the affort of computing the potentials anyway.
if (std::abs(total_rate) > 0) { if (total_rate > 0) {
const double sign = this->isInjector() ? 1.0:-1.0;
double total_potential = 0.0;
for (int phase = 0; phase < np; ++phase){ for (int phase = 0; phase < np; ++phase){
well_potentials[phase] = sign * ws.surface_rates[phase]; well_potentials[phase] = sign * ws.surface_rates[phase];
total_potential += well_potentials[phase];
} }
if (total_potential <= 0.0) {
// wells with trivial or non-positive potentials
// are not operable
this->operability_status_.has_non_positive_potentials = true;
const std::string msg = std::string("well ") + this->name() + std::string(": has non positive potentials and is not operable");
deferred_logger.info(msg);
}
return; return;
} }
} }
@@ -321,11 +311,10 @@ namespace Opm
well_potentials[phase] *= sign; well_potentials[phase] *= sign;
total_potential += well_potentials[phase]; total_potential += well_potentials[phase];
} }
if (total_potential <= 0.0) { if (total_potential < 0.0) {
// wells with trivial or non-positive potentials // wells with negative potentials are not operable
// are not operable this->operability_status_.has_negative_potentials = true;
this->operability_status_.has_non_positive_potentials = true; const std::string msg = std::string("well ") + this->name() + std::string(": has non negative potentials is not operable");
const std::string msg = std::string("well ") + this->name() + std::string(": has non positive potentials is not operable");
deferred_logger.info(msg); deferred_logger.info(msg);
} }
} }

View File

@@ -1868,7 +1868,7 @@ namespace Opm
return; return;
} }
this->operability_status_.has_non_positive_potentials = false; this->operability_status_.has_negative_potentials = false;
// If the well is pressure controlled the potential equals the rate. // If the well is pressure controlled the potential equals the rate.
bool thp_controlled_well = false; bool thp_controlled_well = false;
bool bhp_controlled_well = false; bool bhp_controlled_well = false;
@@ -1893,25 +1893,17 @@ namespace Opm
if (thp_controlled_well || bhp_controlled_well) { if (thp_controlled_well || bhp_controlled_well) {
double total_rate = 0.0; double total_rate = 0.0;
const double sign = this->isInjector() ? 1.0:-1.0;
for (int phase = 0; phase < np; ++phase){ for (int phase = 0; phase < np; ++phase){
total_rate += ws.surface_rates[phase]; total_rate += sign * ws.surface_rates[phase];
} }
// for pressure controlled wells the well rates are the potentials // for pressure controlled wells the well rates are the potentials
// if the rates are trivial we are most probably looking at the newly // if the rates are trivial we are most probably looking at the newly
// opened well and we therefore make the affort of computing the potentials anyway. // opened well and we therefore make the affort of computing the potentials anyway.
if (std::abs(total_rate) > 0) { if (total_rate > 0) {
const double sign = this->isInjector() ? 1.0:-1.0; const double sign = this->isInjector() ? 1.0:-1.0;
double total_potential = 0.0;
for (int phase = 0; phase < np; ++phase){ for (int phase = 0; phase < np; ++phase){
well_potentials[phase] = sign * ws.surface_rates[phase]; well_potentials[phase] = sign * ws.surface_rates[phase];
total_potential += well_potentials[phase];
}
if (total_potential <= 0.0) {
// wells with trivial or non-positive potentials
// are not operable
this->operability_status_.has_non_positive_potentials = true;
const std::string msg = std::string("well ") + this->name() + std::string(": has non positive potentials and is not operable");
deferred_logger.info(msg);
} }
return; return;
} }
@@ -1935,11 +1927,10 @@ namespace Opm
well_potentials[phase] *= sign; well_potentials[phase] *= sign;
total_potential += well_potentials[phase]; total_potential += well_potentials[phase];
} }
if (total_potential <= 0.0) { if (total_potential < 0.0) {
// wells with trivial or non-positive potentials // wells with negative potentials are not operable
// are not operable this->operability_status_.has_negative_potentials = true;
this->operability_status_.has_non_positive_potentials = true; const std::string msg = std::string("well ") + this->name() + std::string(": has negative potentials and is not operable");
const std::string msg = std::string("well ") + this->name() + std::string(": has non positive potentials and is not operable");
deferred_logger.info(msg); deferred_logger.info(msg);
} }
} }

View File

@@ -189,7 +189,7 @@ protected:
// definition of the struct OperabilityStatus // definition of the struct OperabilityStatus
struct OperabilityStatus { struct OperabilityStatus {
bool isOperableAndSolvable() const { bool isOperableAndSolvable() const {
if (!operable_under_only_bhp_limit || !solvable || has_non_positive_potentials) { if (!operable_under_only_bhp_limit || !solvable || has_negative_potentials) {
return false; return false;
} else { } else {
return ( (isOperableUnderBHPLimit() || isOperableUnderTHPLimit()) ); return ( (isOperableUnderBHPLimit() || isOperableUnderTHPLimit()) );
@@ -225,7 +225,7 @@ protected:
// the well is solveable // the well is solveable
bool solvable = true; bool solvable = true;
// the well have non positive potentials // the well have non positive potentials
bool has_non_positive_potentials = false; bool has_negative_potentials = false;
}; };
OperabilityStatus operability_status_; OperabilityStatus operability_status_;

View File

@@ -482,7 +482,7 @@ namespace Opm
this->operability_status_.solvable = false; this->operability_status_.solvable = false;
} }
} }
if (this->operability_status_.has_non_positive_potentials) { if (this->operability_status_.has_negative_potentials) {
auto well_state_copy = well_state; auto well_state_copy = well_state;
std::vector<double> potentials; std::vector<double> potentials;
try { try {
@@ -490,7 +490,7 @@ namespace Opm
} catch (const std::exception& e) { } catch (const std::exception& e) {
const std::string msg = std::string("well ") + this->name() + std::string(": computeWellPotentials() failed during for re-computing: ") + e.what(); const std::string msg = std::string("well ") + this->name() + std::string(": computeWellPotentials() failed during for re-computing: ") + e.what();
deferred_logger.info(msg); deferred_logger.info(msg);
this->operability_status_.has_non_positive_potentials = true; this->operability_status_.has_negative_potentials = true;
} }
auto& ws = well_state.well(this->indexOfWell()); auto& ws = well_state.well(this->indexOfWell());
const int np = well_state.numPhases(); const int np = well_state.numPhases();