This commit is contained in:
Tor Harald Sandve 2021-11-23 12:56:03 +00:00
parent 43fd50e355
commit 50ab26c330
4 changed files with 11 additions and 14 deletions

View File

@ -2378,15 +2378,14 @@ runWellPIScaling(const int timeStepIdx,
bool bool
BlackoilWellModelGeneric:: BlackoilWellModelGeneric::
guideRateUpdateIsNeeded() const { guideRateUpdateIsNeeded() const {
int update = 0; const auto need_update =
for (const auto& well : well_container_generic_) { std::any_of(this->well_container_generic_.begin(),
if (well->changedToOpenThisStep()) { this->well_container_generic_.end(),
update = 1; [](const WellInterfaceGeneric* well)
break; {
} return well->changedToOpenThisStep();
} });
update = comm_.max(update); return this->comm_.max(static_cast<int>(need_update));
return update;
} }

View File

@ -113,9 +113,8 @@ computeWellRates_(
displayDebugMessage_(msg); displayDebugMessage_(msg);
} }
for (size_t phase = 0; phase < potentials.size(); ++phase){ for (auto& potential : potentials) {
// make sure the potentials are negative potential = std::min(0.0, potential);
potentials[phase] = std::min(0.0, potentials[phase]);
} }
} }

View File

@ -1901,7 +1901,6 @@ namespace Opm
// 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 (total_rate > 0) { if (total_rate > 0) {
const double sign = this->isInjector() ? 1.0:-1.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];
} }

View File

@ -488,7 +488,7 @@ namespace Opm
try { try {
computeWellPotentials(ebosSimulator, well_state_copy, potentials, deferred_logger); computeWellPotentials(ebosSimulator, well_state_copy, potentials, deferred_logger);
} 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 attempt to recompute potentials for well : ") + e.what();
deferred_logger.info(msg); deferred_logger.info(msg);
this->operability_status_.has_negative_potentials = true; this->operability_status_.has_negative_potentials = true;
} }