Unconditionally Calculate PI at End of Timestep

This commit ensures that we calculate the well and connection level
per-phase steady-state productivity index (PI) at the end of a
completed time step (triggered from endTimeStep()).

We add a new data member,

    BlackoilWellModel<>::prod_index_calc_

which holds one WellProdIndexCalculator for each of the process'
local wells and a new interface member function

    WellInterface::updateProductivityIndex

which uses a per-well PI calculator to actually compute the PI
values and store those in the WellState.  Implement this member
function for both StandardWell and MultisegmentWell.  Were it not
for 'getMobility' existing only in the derived classes, the two
equal implementations could be merged and moved to the interface.

We also add a new data member to the WellStateFullyImplicitBlackoil
to hold the connection-level PI values.  Finally, remove the
conditional PI calculation from StandardWell's well equation
assembly routine.
This commit is contained in:
Bård Skaflestad
2020-10-09 13:38:33 +02:00
parent 9f12a2edba
commit 75156cd872
9 changed files with 271 additions and 81 deletions

View File

@@ -237,6 +237,8 @@ namespace Opm {
int globalNumWells = 0;
// Make wells_ecl_ contain only this partition's non-shut wells.
wells_ecl_ = getLocalNonshutWells(timeStepIdx, globalNumWells);
this->initializeWellProdIndCalculators();
initializeWellPerfData();
// Wells are active if they are active wells on at least
@@ -507,6 +509,8 @@ namespace Opm {
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
checkGconsaleLimits(fieldGroup, well_state_, local_deferredLogger);
this->calculateProductivityIndexValues(local_deferredLogger);
previous_well_state_ = well_state_;
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
@@ -566,6 +570,7 @@ namespace Opm {
// Make wells_ecl_ contain only this partition's non-shut wells.
wells_ecl_ = getLocalNonshutWells(report_step, globalNumWells);
this->initializeWellProdIndCalculators();
initializeWellPerfData();
const int nw = wells_ecl_.size();
@@ -586,6 +591,22 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
initializeWellProdIndCalculators()
{
this->prod_index_calc_.clear();
this->prod_index_calc_.reserve(this->wells_ecl_.size());
for (const auto& well : this->wells_ecl_) {
this->prod_index_calc_.emplace_back(well);
}
}
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
@@ -1439,6 +1460,31 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
calculateProductivityIndexValues(DeferredLogger& deferred_logger)
{
if (! this->localWellsActive()) {
return;
}
auto piCalc = this->prod_index_calc_.begin();
for (const auto& wellPtr : this->well_container_) {
wellPtr->updateProductivityIndex(this->ebosSimulator_,
*piCalc,
this->well_state_,
deferred_logger);
++piCalc;
}
}
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::