Earlier continue and rename vector

This commit is contained in:
Vegard Kippe 2024-11-20 16:23:11 +01:00
parent e189d56167
commit 673d541932
2 changed files with 12 additions and 14 deletions

View File

@ -273,7 +273,7 @@ void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures,
report_step,
wells_ecl);
well_rates.clear();
this->inactive_well_names_ = schedule.getInactiveWellNamesAtEnd();
this->permanently_inactive_well_names_ = schedule.getInactiveWellNamesAtEnd();
for (const auto& wname : schedule.wellNames(report_step))
{
well_rates.insert({wname, std::make_pair(false, std::vector<Scalar>(this->numPhases()))});
@ -695,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
for (int w = 0; w < nw; ++w) {
const auto& well_ecl = wells_ecl[w];
if (this->is_permanently_inactive_well(well_ecl.name()))
continue;
auto& ws = this->well(w);
if (well_ecl.isMultiSegment()) {
@ -725,14 +728,9 @@ void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
n_activeperf++;
}
}
// If perf_data does not contain all active perfs, the well is distributed or inactive
// For inactive wells there is no need for calculating an initial solution
// \todo{ Update the procedure below to work for actually distributed wells. }
if (static_cast<int>(ws.perf_data.size()) != n_activeperf)
if (this->is_inactive_well(well_ecl.name()))
continue;
else
throw std::logic_error("Distributed multi-segment wells cannot be initialized properly yet.");
throw std::logic_error("Distributed multi-segment wells cannot be initialized properly yet.");
std::vector<std::vector<int>> segment_inlets(well_nseg);
@ -1061,7 +1059,7 @@ bool WellState<Scalar>::operator==(const WellState& rhs) const
return this->alq_state == rhs.alq_state &&
this->well_rates == rhs.well_rates &&
this->wells_ == rhs.wells_ &&
this->inactive_well_names_ == rhs.inactive_well_names_;
this->permanently_inactive_well_names_ == rhs.permanently_inactive_well_names_;
}
template<class Scalar>

View File

@ -348,12 +348,12 @@ public:
for (auto& w : wells_) {
serializer(w);
}
serializer(inactive_well_names_);
serializer(permanently_inactive_well_names_);
}
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();
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_;
@ -377,8 +377,8 @@ private:
// not.
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_;
// Keep track of permanently inactive well names
std::vector<std::string> permanently_inactive_well_names_;
data::Segment
reportSegmentResults(const int well_id,