Merge pull request #5534 from vkip/alqstate_init

Ensure default ALQ is set for all production wells on all processes
This commit is contained in:
Bård Skaflestad 2024-08-16 09:26:29 +02:00 committed by GitHub
commit d6f93a5f20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 15 deletions

View File

@ -451,7 +451,7 @@ namespace Opm {
this->updateAndCommunicateGroupData(reportStepIdx,
simulator_.model().newtonMethod().numIterations());
this->wellState().updateWellsDefaultALQ(this->wells_ecl_, this->summaryState());
this->wellState().updateWellsDefaultALQ(this->schedule(), reportStepIdx, this->summaryState());
this->wellState().gliftTimeStepInit();
const double simulationTime = simulator_.time();

View File

@ -424,7 +424,7 @@ void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures,
}
}
updateWellsDefaultALQ(wells_ecl, summary_state);
updateWellsDefaultALQ(schedule, report_step, summary_state);
}
template<class Scalar>
@ -1028,19 +1028,19 @@ bool WellState<Scalar>::wellIsOwned(const std::string& wellName) const
return wellIsOwned(well_index.value(), wellName);
}
template<class Scalar>
void WellState<Scalar>::
updateWellsDefaultALQ(const std::vector<Well>& wells_ecl,
const SummaryState& summary_state)
template <typename Scalar>
void WellState<Scalar>::updateWellsDefaultALQ(const Schedule& schedule,
const int report_step,
const SummaryState& summary_state)
{
const int nw = wells_ecl.size();
for (int i = 0; i<nw; i++) {
const Well &well = wells_ecl[i];
if (well.isProducer()) {
// NOTE: This is the value set in item 12 of WCONPROD, or with WELTARG
auto alq = well.alq_value(summary_state);
this->alq_state.update_default(well.name(), alq);
const auto wells = schedule.wellNames(report_step);
for (const auto& wname : wells) {
const auto& well = schedule.getWell(wname, report_step);
if (! well.isProducer()) {
continue;
}
const auto alq = well.alq_value(summary_state);
this->alq_state.update_default(wname, alq);
}
}

View File

@ -227,8 +227,9 @@ public:
// reset current_alq and update default_alq. ALQ is used for
// constant lift gas injection and for gas lift optimization
// (THP controlled wells).
void updateWellsDefaultALQ(const std::vector<Well>& wells_ecl,
const SummaryState& summary_state);
void updateWellsDefaultALQ(const Schedule& schedule,
const int report_step,
const SummaryState& summary_state);
int wellNameToGlobalIdx(const std::string& name)
{