Merge pull request #3055 from joakim-hove/wellpi-update-connections

Extract functionality to update ecl_well
This commit is contained in:
Bård Skaflestad 2021-02-10 21:15:20 +01:00 committed by GitHub
commit 4f112e443f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 16 deletions

View File

@ -480,6 +480,7 @@ namespace Opm {
void setWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, double wsolvent);
void updateEclWell(int timeStepIdx, int well_index);
void runWellPIScaling(const int timeStepIdx, DeferredLogger& local_deferredLogger);
void assignWellGuideRates(data::Wells& wsrpt) const;

View File

@ -2551,6 +2551,32 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
updateEclWell(int timeStepIdx, int well_index)
{
const auto& schedule = this->ebosSimulator_.vanguard().schedule();
const auto& wname = this->wells_ecl_[well_index].name();
this->wells_ecl_[well_index] = schedule.getWell(wname, timeStepIdx);
const auto& well = this->wells_ecl_[well_index];
auto& pd = this->well_perf_data_[well_index];
auto pdIter = pd.begin();
for (const auto& conn : well.getConnections()) {
if (conn.state() != Connection::State::SHUT) {
pdIter->connection_transmissibility_factor = conn.CF();
++pdIter;
}
}
this->well_state_.resetConnectionTransFactors(well_index, pd);
this->prod_index_calc_[well_index].reInit(well);
}
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
@ -2607,23 +2633,9 @@ namespace Opm {
{
const auto& wname = this->wells_ecl_[well_index].name();
auto& schedule = this->ebosSimulator_.vanguard().schedule(); // Mutable
schedule.applyWellProdIndexScaling(wname, timeStepIdx, newWellPI);
this->wells_ecl_[well_index] = schedule.getWell(wname, timeStepIdx);
}
const auto& well = this->wells_ecl_[well_index];
auto& pd = this->well_perf_data_[well_index];
auto pdIter = pd.begin();
for (const auto& conn : well.getConnections()) {
if (conn.state() != Connection::State::SHUT) {
pdIter->connection_transmissibility_factor = conn.CF();
++pdIter;
}
}
this->well_state_.resetConnectionTransFactors(well_index, pd);
this->prod_index_calc_[well_index].reInit(well);
this->updateEclWell(timeStepIdx, well_index);
};
// Minimal well setup to compute PI/II values
@ -2645,7 +2657,6 @@ namespace Opm {
}
this->calculateProductivityIndexValues(local_deferredLogger);
this->previous_well_state_ = std::move(saved_previous_well_state);
}