Merge pull request #5751 from vkip/dont_initsolve_inactive_msw

Do not try to compute initial solution for inactive multi-segment wells split across processors
This commit is contained in:
Bård Skaflestad 2024-11-21 10:16:53 +01:00 committed by GitHub
commit 20a13eefcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -273,6 +273,7 @@ void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures,
report_step, report_step,
wells_ecl); wells_ecl);
well_rates.clear(); well_rates.clear();
this->permanently_inactive_well_names_ = schedule.getInactiveWellNamesAtEnd();
for (const auto& wname : schedule.wellNames(report_step)) for (const auto& wname : schedule.wellNames(report_step))
{ {
well_rates.insert({wname, std::make_pair(false, std::vector<Scalar>(this->numPhases()))}); well_rates.insert({wname, std::make_pair(false, std::vector<Scalar>(this->numPhases()))});
@ -694,6 +695,9 @@ void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
// what we do here, is to set the segment rates and perforation rates // what we do here, is to set the segment rates and perforation rates
for (int w = 0; w < nw; ++w) { for (int w = 0; w < nw; ++w) {
const auto& well_ecl = wells_ecl[w]; const auto& well_ecl = wells_ecl[w];
if (this->is_permanently_inactive_well(well_ecl.name()))
continue;
auto& ws = this->well(w); auto& ws = this->well(w);
if (well_ecl.isMultiSegment()) { if (well_ecl.isMultiSegment()) {
@ -725,6 +729,10 @@ void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
} }
} }
if (static_cast<int>(ws.perf_data.size()) != n_activeperf)
throw std::logic_error("Distributed multi-segment wells cannot be initialized properly yet.");
std::vector<std::vector<int>> segment_inlets(well_nseg); std::vector<std::vector<int>> segment_inlets(well_nseg);
for (int seg = 0; seg < well_nseg; ++seg) { for (int seg = 0; seg < well_nseg; ++seg) {
const Segment& segment = segment_set[seg]; const Segment& segment = segment_set[seg];
@ -1050,7 +1058,8 @@ bool WellState<Scalar>::operator==(const WellState& rhs) const
{ {
return this->alq_state == rhs.alq_state && return this->alq_state == rhs.alq_state &&
this->well_rates == rhs.well_rates && this->well_rates == rhs.well_rates &&
this->wells_ == rhs.wells_; this->wells_ == rhs.wells_ &&
this->permanently_inactive_well_names_ == rhs.permanently_inactive_well_names_;
} }
template<class Scalar> template<class Scalar>

View File

@ -348,9 +348,14 @@ public:
for (auto& w : wells_) { for (auto& w : wells_) {
serializer(w); serializer(w);
} }
serializer(permanently_inactive_well_names_);
} }
private: private:
bool is_permanently_inactive_well(const std::string& wname) const {
return std::find(this->permanently_inactive_well_names_.begin(), this->permanently_inactive_well_names_.end(), wname) != this->permanently_inactive_well_names_.end();
}
PhaseUsage phase_usage_; PhaseUsage phase_usage_;
// The wells_ variable is essentially a map of all the wells on the current // The wells_ variable is essentially a map of all the wells on the current
@ -372,6 +377,9 @@ private:
// not. // not.
std::map<std::string, std::pair<bool, std::vector<Scalar>>> well_rates; std::map<std::string, std::pair<bool, std::vector<Scalar>>> well_rates;
// Keep track of permanently inactive well names
std::vector<std::string> permanently_inactive_well_names_;
data::Segment data::Segment
reportSegmentResults(const int well_id, reportSegmentResults(const int well_id,
const int seg_ix, const int seg_ix,