Use WellContainer<> for perforation skin pressure

This commit is contained in:
Joakim Hove
2021-06-03 13:08:48 +02:00
parent 36cd1f51e9
commit b0fd14a597
3 changed files with 11 additions and 12 deletions

View File

@@ -1305,7 +1305,7 @@ namespace Opm
if constexpr (Base::has_polymermw) { if constexpr (Base::has_polymermw) {
if (this->isInjector()) { if (this->isInjector()) {
auto * perf_water_velocity = well_state.perfWaterVelocity(this->index_of_well_); auto * perf_water_velocity = well_state.perfWaterVelocity(this->index_of_well_);
auto * perf_skin_pressure = well_state.perfSkinPressure(this->index_of_well_); auto& perf_skin_pressure = well_state.perfSkinPressure(this->index_of_well_);
for (int perf = 0; perf < number_of_perforations_; ++perf) { for (int perf = 0; perf < number_of_perforations_; ++perf) {
perf_water_velocity[perf] = primary_variables_[Bhp + 1 + perf]; perf_water_velocity[perf] = primary_variables_[Bhp + 1 + perf];
perf_skin_pressure[perf] = primary_variables_[Bhp + 1 + number_of_perforations_ + perf]; perf_skin_pressure[perf] = primary_variables_[Bhp + 1 + number_of_perforations_ + perf];
@@ -2833,7 +2833,7 @@ namespace Opm
if constexpr (Base::has_polymermw) { if constexpr (Base::has_polymermw) {
if (this->isInjector()) { if (this->isInjector()) {
const auto * water_velocity = well_state.perfWaterVelocity(this->index_of_well_); const auto * water_velocity = well_state.perfWaterVelocity(this->index_of_well_);
const auto * skin_pressure = well_state.perfSkinPressure(this->index_of_well_); const auto& skin_pressure = well_state.perfSkinPressure(this->index_of_well_);
for (int perf = 0; perf < number_of_perforations_; ++perf) { for (int perf = 0; perf < number_of_perforations_; ++perf) {
primary_variables_[Bhp + 1 + perf] = water_velocity[perf]; primary_variables_[Bhp + 1 + perf] = water_velocity[perf];
primary_variables_[Bhp + 1 + number_of_perforations_ + perf] = skin_pressure[perf]; primary_variables_[Bhp + 1 + number_of_perforations_ + perf] = skin_pressure[perf];

View File

@@ -41,6 +41,7 @@ void WellState::base_init(const std::vector<double>& cellPressures,
// clear old name mapping // clear old name mapping
this->wellMap_.clear(); this->wellMap_.clear();
this->perfpress_.clear(); this->perfpress_.clear();
this->perf_skin_pressure_.clear();
this->perfrates_.clear(); this->perfrates_.clear();
this->status_.clear(); this->status_.clear();
this->well_perf_data_.clear(); this->well_perf_data_.clear();
@@ -101,6 +102,7 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
this->segment_state.add(well.name(), SegmentState{}); this->segment_state.add(well.name(), SegmentState{});
this->perfpress_.add(well.name(), std::vector<double>(num_perf_this_well, -1e100)); this->perfpress_.add(well.name(), std::vector<double>(num_perf_this_well, -1e100));
this->perfrates_.add(well.name(), std::vector<double>(num_perf_this_well, 0)); this->perfrates_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->perf_skin_pressure_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->bhp_.add(well.name(), 0.0); this->bhp_.add(well.name(), 0.0);
this->thp_.add(well.name(), 0.0); this->thp_.add(well.name(), 0.0);
if ( well.isInjector() ) if ( well.isInjector() )
@@ -284,8 +286,6 @@ void WellState::init(const std::vector<double>& cellPressures,
perf_water_throughput_.resize(nperf, 0.0); perf_water_throughput_.resize(nperf, 0.0);
perf_water_velocity_.clear(); perf_water_velocity_.clear();
perf_water_velocity_.resize(nperf, 0.0); perf_water_velocity_.resize(nperf, 0.0);
perf_skin_pressure_.clear();
perf_skin_pressure_.resize(nperf, 0.0);
first_perf_index_.resize(nw, 0); first_perf_index_.resize(nw, 0);
first_perf_index_[0] = 0; first_perf_index_[0] = 0;
@@ -371,6 +371,7 @@ void WellState::init(const std::vector<double>& cellPressures,
if (well.getStatus() == Well::Status::SHUT) { if (well.getStatus() == Well::Status::SHUT) {
continue; continue;
} }
const auto& wname = well.name();
auto it = prevState->wellMap().find(well.name()); auto it = prevState->wellMap().find(well.name());
if (it != end) if (it != end)
@@ -481,19 +482,17 @@ void WellState::init(const std::vector<double>& cellPressures,
if (global_num_perf_same) if (global_num_perf_same)
{ {
auto * throughput_target = this->perfThroughput(newIndex); auto * throughput_target = this->perfThroughput(newIndex);
auto * pressure_target = this->perfSkinPressure(newIndex);
auto * velocity_target = this->perfWaterVelocity(newIndex); auto * velocity_target = this->perfWaterVelocity(newIndex);
const auto * throughput_src = prevState->perfThroughput(oldIndex); const auto * throughput_src = prevState->perfThroughput(oldIndex);
const auto * pressure_src = prevState->perfSkinPressure(oldIndex);
const auto * velocity_src = prevState->perfWaterVelocity(oldIndex); const auto * velocity_src = prevState->perfWaterVelocity(oldIndex);
for (int perf = 0; perf < num_perf_this_well; ++perf) for (int perf = 0; perf < num_perf_this_well; ++perf)
{ {
throughput_target[ perf ] = throughput_src[perf]; throughput_target[ perf ] = throughput_src[perf];
pressure_target[ perf ] = pressure_src[perf];
velocity_target[ perf ] = velocity_src[perf]; velocity_target[ perf ] = velocity_src[perf];
} }
this->perf_skin_pressure_.copy_welldata(prevState->perf_skin_pressure_, wname);
} }
} }

View File

@@ -266,12 +266,12 @@ public:
return &perf_water_throughput_[this->first_perf_index_[well_index]]; return &perf_water_throughput_[this->first_perf_index_[well_index]];
} }
double * perfSkinPressure(std::size_t well_index) { std::vector<double>& perfSkinPressure(std::size_t well_index) {
return &perf_skin_pressure_[this->first_perf_index_[well_index]]; return perf_skin_pressure_[well_index];
} }
const double * perfSkinPressure(std::size_t well_index) const { const std::vector<double>& perfSkinPressure(std::size_t well_index) const {
return &perf_skin_pressure_[this->first_perf_index_[well_index]]; return perf_skin_pressure_[well_index];
} }
double * perfWaterVelocity(std::size_t well_index) { double * perfWaterVelocity(std::size_t well_index) {
@@ -465,7 +465,7 @@ private:
// skin pressure of peforation // skin pressure of peforation
// it will only be used for injectors to check the injectivity // it will only be used for injectors to check the injectivity
std::vector<double> perf_skin_pressure_; WellContainer<std::vector<double>> perf_skin_pressure_;
// it will only be used for injectors to check the injectivity // it will only be used for injectors to check the injectivity
// water velocity of perforation // water velocity of perforation