Move updateStatus functionality to SingleWellState

This commit is contained in:
Joakim Hove 2021-10-30 16:31:32 +02:00
parent d150f400fe
commit 03cf7b0327
3 changed files with 19 additions and 15 deletions

View File

@ -57,8 +57,7 @@ void SingleWellState::shut() {
std::fill(this->reservoir_rates.begin(), this->reservoir_rates.end(), 0);
std::fill(this->productivity_index.begin(), this->productivity_index.end(), 0);
auto& perf_data = this->perf_data;
auto& connpi = perf_data.prod_index;
auto& connpi = this->perf_data.prod_index;
connpi.assign(connpi.size(), 0);
}
@ -71,6 +70,21 @@ void SingleWellState::open() {
this->status = Well::Status::OPEN;
}
void SingleWellState::updateStatus(Well::Status new_status) {
switch (new_status) {
case Well::Status::OPEN:
this->open();
break;
case Well::Status::SHUT:
this->shut();
break;
case Well::Status::STOP:
this->stop();
break;
default:
throw std::logic_error("Invalid well status");
}
}
double SingleWellState::sum_connection_rates(const std::vector<double>& connection_rates) const {
return this->parallel_info.get().sumPerfValues(connection_rates.begin(), connection_rates.end());

View File

@ -55,6 +55,7 @@ public:
Well::ProducerCMode production_cmode{Well::ProducerCMode::CMODE_UNDEFINED};
void updateStatus(Well::Status status);
void init_timestep(const SingleWellState& other);
void shut();
void stop();

View File

@ -755,19 +755,8 @@ void WellState::shutWell(int well_index)
void WellState::updateStatus(int well_index, Well::Status status)
{
switch (status) {
case Well::Status::OPEN:
this->openWell(well_index);
break;
case Well::Status::SHUT:
this->shutWell(well_index);
break;
case Well::Status::STOP:
this->stopWell(well_index);
break;
default:
throw std::logic_error("Invalid well status");
}
auto& ws = this->well(well_index);
ws.updateStatus(status);
}