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
BlackoilWellModelGeneric::
guideRateUpdateIsNeeded() const {
int update = 0;
for (const auto& well : well_container_generic_) {
if (well->changedToOpenThisStep()) {
update = 1;
break;
}
}
update = comm_.max(update);
return update;
const auto need_update =
std::any_of(this->well_container_generic_.begin(),
this->well_container_generic_.end(),
[](const WellInterfaceGeneric* well)
{
return well->changedToOpenThisStep();
});
return this->comm_.max(static_cast<int>(need_update));
}

View File

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

View File

@ -1901,7 +1901,6 @@ namespace Opm
// 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 (total_rate > 0) {
const double sign = this->isInjector() ? 1.0:-1.0;
for (int phase = 0; phase < np; ++phase){
well_potentials[phase] = sign * ws.surface_rates[phase];
}

View File

@ -488,7 +488,7 @@ namespace Opm
try {
computeWellPotentials(ebosSimulator, well_state_copy, potentials, deferred_logger);
} 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);
this->operability_status_.has_negative_potentials = true;
}