Moved well status routines

This commit is contained in:
Joakim Hove 2021-05-20 11:14:15 +02:00
parent 0f8dec5224
commit 7cb7b0eb82
4 changed files with 43 additions and 49 deletions

View File

@ -72,37 +72,6 @@ void WellState::init(const std::vector<double>& cellPressures,
void WellState::shutWell(int well_index)
{
this->status_[well_index] = Well::Status::SHUT;
this->thp_[well_index] = 0;
this->bhp_[well_index] = 0;
const int np = numPhases();
this->wellrates_[well_index].assign(np, 0);
}
void WellState::stopWell(int well_index)
{
this->status_[well_index] = Well::Status::STOP;
this->thp_[well_index] = 0;
}
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");
}
}
void WellState::initSingleWell(const std::vector<double>& cellPressures, void WellState::initSingleWell(const std::vector<double>& cellPressures,
@ -153,7 +122,7 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
const double global_pressure = well_info->broadcastFirstPerforationValue(local_pressure); const double global_pressure = well_info->broadcastFirstPerforationValue(local_pressure);
if (well.getStatus() == Well::Status::OPEN) { if (well.getStatus() == Well::Status::OPEN) {
this->openWell(w); this->status_[w] = Well::Status::OPEN;
} }
if (well.getStatus() == Well::Status::STOP) { if (well.getStatus() == Well::Status::STOP) {

View File

@ -110,28 +110,18 @@ public:
return this->phase_usage_; return this->phase_usage_;
} }
void openWell(int well_index) {
this->status_[well_index] = Well::Status::OPEN;
}
virtual void shutWell(int well_index);
virtual void stopWell(int well_index);
void updateStatus(int well_index, Well::Status status);
protected: protected:
WellContainer<Well::Status> status_; WellContainer<Well::Status> status_;
WellContainer<std::vector<PerforationData>> well_perf_data_; WellContainer<std::vector<PerforationData>> well_perf_data_;
WellContainer<const ParallelWellInfo*> parallel_well_info_; WellContainer<const ParallelWellInfo*> parallel_well_info_;
WellMapType wellMap_; WellMapType wellMap_;
std::vector<double> bhp_;
std::vector<double> thp_;
WellContainer<std::vector<double>> wellrates_;
private: private:
PhaseUsage phase_usage_; PhaseUsage phase_usage_;
std::vector<double> bhp_;
std::vector<double> thp_;
std::vector<double> temperature_; std::vector<double> temperature_;
WellContainer<std::vector<double>> wellrates_;
WellContainer<std::vector<double>> perfrates_; WellContainer<std::vector<double>> perfrates_;
WellContainer<std::vector<double>> perfpress_; WellContainer<std::vector<double>> perfpress_;

View File

@ -841,10 +841,19 @@ int WellStateFullyImplicitBlackoil::topSegmentIndex(const int w) const
return top_segment_index_[w]; return top_segment_index_[w];
} }
void WellStateFullyImplicitBlackoil::stopWell(int well_index)
{
this->status_[well_index] = Well::Status::STOP;
this->thp_[well_index] = 0;
}
void WellStateFullyImplicitBlackoil::shutWell(int well_index) void WellStateFullyImplicitBlackoil::shutWell(int well_index)
{ {
WellState::shutWell(well_index); this->status_[well_index] = Well::Status::SHUT;
this->thp_[well_index] = 0;
this->bhp_[well_index] = 0;
const int np = numPhases(); const int np = numPhases();
this->wellrates_[well_index].assign(np, 0);
auto& resv = this->well_reservoir_rates_[well_index]; auto& resv = this->well_reservoir_rates_[well_index];
auto* wpi = &this->productivity_index_[np*well_index + 0]; auto* wpi = &this->productivity_index_[np*well_index + 0];
@ -860,6 +869,25 @@ void WellStateFullyImplicitBlackoil::shutWell(int well_index)
this->conn_productivity_index_.begin() + last, 0.0); this->conn_productivity_index_.begin() + last, 0.0);
} }
void WellStateFullyImplicitBlackoil::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");
}
}
template<class Comm> template<class Comm>
void WellStateFullyImplicitBlackoil::communicateGroupRates(const Comm& comm) void WellStateFullyImplicitBlackoil::communicateGroupRates(const Comm& comm)
{ {

View File

@ -64,7 +64,6 @@ public:
using BaseType :: bhp; using BaseType :: bhp;
using BaseType :: perfPress; using BaseType :: perfPress;
using BaseType :: numPhases; using BaseType :: numPhases;
using BaseType :: updateStatus;
explicit WellStateFullyImplicitBlackoil(const PhaseUsage& pu) : explicit WellStateFullyImplicitBlackoil(const PhaseUsage& pu) :
WellState(pu) WellState(pu)
@ -312,8 +311,6 @@ public:
return perf_water_velocity_; return perf_water_velocity_;
} }
void shutWell(int well_index) override;
template<class Comm> template<class Comm>
void communicateGroupRates(const Comm& comm); void communicateGroupRates(const Comm& comm);
@ -396,6 +393,16 @@ public:
void resetConnectionTransFactors(const int well_index, void resetConnectionTransFactors(const int well_index,
const std::vector<PerforationData>& well_perf_data); const std::vector<PerforationData>& well_perf_data);
void updateStatus(int well_index, Well::Status status);
void openWell(int well_index) {
this->status_[well_index] = Well::Status::OPEN;
}
void shutWell(int well_index);
void stopWell(int well_index);
private: private:
std::vector<double> perfphaserates_; std::vector<double> perfphaserates_;
WellContainer<int> is_producer_; // Size equal to number of local wells. WellContainer<int> is_producer_; // Size equal to number of local wells.