mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3060 from joakim-hove/wellpi-extract
Extract method wellPI() from existing lambda implementation
This commit is contained in:
commit
591826ea4e
@ -267,6 +267,7 @@ namespace Opm {
|
||||
/// Returns true if the well was actually found and shut.
|
||||
bool forceShutWellByNameIfPredictionMode(const std::string& wellname, const double simulation_time);
|
||||
|
||||
double wellPI(int well_index) const;
|
||||
protected:
|
||||
Simulator& ebosSimulator_;
|
||||
|
||||
|
@ -2576,26 +2576,10 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
double
|
||||
BlackoilWellModel<TypeTag>::
|
||||
runWellPIScaling(const int timeStepIdx, DeferredLogger& local_deferredLogger)
|
||||
{
|
||||
if (this->last_run_wellpi_.has_value() && (*this->last_run_wellpi_ == timeStepIdx)) {
|
||||
// We've already run WELPI scaling for this report step. Most
|
||||
// common for the very first report step. Don't redo WELPI scaling.
|
||||
return;
|
||||
}
|
||||
|
||||
auto hasWellPIEvent = [this, timeStepIdx](const int well_index) -> bool
|
||||
{
|
||||
return this->schedule()[timeStepIdx]
|
||||
.wellgroup_events().hasEvent(this->wells_ecl_[well_index].name(),
|
||||
ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX);
|
||||
};
|
||||
|
||||
auto getWellPI = [this](const int well_index) -> double
|
||||
wellPI(int well_index) const
|
||||
{
|
||||
const auto& pu = this->phase_usage_;
|
||||
const auto np = this->numPhases();
|
||||
@ -2624,6 +2608,25 @@ namespace Opm {
|
||||
std::to_string(static_cast<int>(preferred))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
runWellPIScaling(const int timeStepIdx, DeferredLogger& local_deferredLogger)
|
||||
{
|
||||
if (this->last_run_wellpi_.has_value() && (*this->last_run_wellpi_ == timeStepIdx)) {
|
||||
// We've already run WELPI scaling for this report step. Most
|
||||
// common for the very first report step. Don't redo WELPI scaling.
|
||||
return;
|
||||
}
|
||||
|
||||
auto hasWellPIEvent = [this, timeStepIdx](const int well_index) -> bool
|
||||
{
|
||||
return this->schedule()[timeStepIdx]
|
||||
.wellgroup_events().hasEvent(this->wells_ecl_[well_index].name(),
|
||||
ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX);
|
||||
};
|
||||
|
||||
auto rescaleWellPI =
|
||||
@ -2663,7 +2666,7 @@ namespace Opm {
|
||||
const auto nw = this->numLocalWells();
|
||||
for (auto wellID = 0*nw; wellID < nw; ++wellID) {
|
||||
if (hasWellPIEvent(wellID)) {
|
||||
const auto newWellPI = getWellPI(wellID);
|
||||
const auto newWellPI = this->wellPI(wellID);
|
||||
rescaleWellPI(wellID, newWellPI);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user