Explicit check for inactive wells and throw if trying to initialize a distributed multi-segment well

This commit is contained in:
Vegard Kippe
2024-11-20 15:40:18 +01:00
parent c42f02e802
commit e189d56167
2 changed files with 15 additions and 2 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->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()))});
@@ -728,7 +729,10 @@ void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
// For inactive wells there is no need for calculating an initial solution // For inactive wells there is no need for calculating an initial solution
// \todo{ Update the procedure below to work for actually distributed wells. } // \todo{ Update the procedure below to work for actually distributed wells. }
if (static_cast<int>(ws.perf_data.size()) != n_activeperf) if (static_cast<int>(ws.perf_data.size()) != n_activeperf)
if (this->is_inactive_well(well_ecl.name()))
continue; continue;
else
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);
@@ -1056,7 +1060,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->inactive_well_names_ == rhs.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(inactive_well_names_);
} }
private: private:
bool is_inactive_well(const std::string& wname) const {
return std::find(this->inactive_well_names_.begin(), this->inactive_well_names_.end(), wname) != this->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 inactive well names
std::vector<std::string> 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,