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()) {
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.
bool thp_controlled_well = false;
@@ -279,27 +279,17 @@ namespace Opm
if (thp_controlled_well || bhp_controlled_well) {
double total_rate = 0.0;
const double sign = this->isInjector() ? 1.0:-1.0;
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
// 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.
if (std::abs(total_rate) > 0) {
const double sign = this->isInjector() ? 1.0:-1.0;
double total_potential = 0.0;
if (total_rate > 0) {
for (int phase = 0; phase < np; ++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;
}
}
@@ -321,11 +311,10 @@ namespace Opm
well_potentials[phase] *= sign;
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 is not operable");
if (total_potential < 0.0) {
// wells with negative potentials are not operable
this->operability_status_.has_negative_potentials = true;
const std::string msg = std::string("well ") + this->name() + std::string(": has non negative potentials is not operable");
deferred_logger.info(msg);
}
}

View File

@@ -1868,7 +1868,7 @@ namespace Opm
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.
bool thp_controlled_well = false;
bool bhp_controlled_well = false;
@@ -1893,25 +1893,17 @@ namespace Opm
if (thp_controlled_well || bhp_controlled_well) {
double total_rate = 0.0;
const double sign = this->isInjector() ? 1.0:-1.0;
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
// 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.
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){
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;
}
@@ -1935,11 +1927,10 @@ namespace Opm
well_potentials[phase] *= sign;
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");
if (total_potential < 0.0) {
// wells with negative potentials are not operable
this->operability_status_.has_negative_potentials = true;
const std::string msg = std::string("well ") + this->name() + std::string(": has negative potentials and is not operable");
deferred_logger.info(msg);
}
}

View File

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

View File

@@ -482,7 +482,7 @@ namespace Opm
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;
std::vector<double> potentials;
try {
@@ -490,7 +490,7 @@ namespace Opm
} catch (const std::exception& e) {
const std::string msg = std::string("well ") + this->name() + std::string(": computeWellPotentials() failed during for re-computing: ") + e.what();
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());
const int np = well_state.numPhases();