mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 04:23:48 -06:00
Move updateStatus functionality to SingleWellState
This commit is contained in:
parent
d150f400fe
commit
03cf7b0327
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user