Use well index to access WellState::perfThroughput()

This commit is contained in:
Joakim Hove
2021-06-02 11:14:57 +02:00
parent 42d1b4c4a8
commit 89ae75b46c
3 changed files with 9 additions and 9 deletions

View File

@@ -3202,7 +3202,7 @@ namespace Opm
{
if constexpr (Base::has_polymermw) {
if (this->isInjector()) {
auto * perf_water_throughput = &well_state.perfThroughput()[first_perf_];
auto * perf_water_throughput = well_state.perfThroughput(this->index_of_well_);
for (int perf = 0; perf < number_of_perforations_; ++perf) {
const double perf_water_vel = primary_variables_[Bhp + 1 + perf];
// we do not consider the formation damage due to water flowing from reservoir into wellbore
@@ -3263,7 +3263,7 @@ namespace Opm
const EvalWell eq_wat_vel = primary_variables_evaluation_[wat_vel_index] - water_velocity;
resWell_[0][wat_vel_index] = eq_wat_vel.value();
const auto * perf_water_throughput = &well_state.perfThroughput()[this->first_perf_];
const auto * perf_water_throughput = well_state.perfThroughput(this->index_of_well_);
const double throughput = perf_water_throughput[perf];
const int pskin_index = Bhp + 1 + number_of_perforations_ + perf;
@@ -3442,7 +3442,7 @@ namespace Opm
const int wat_vel_index = Bhp + 1 + perf;
const EvalWell water_velocity = primary_variables_evaluation_[wat_vel_index];
if (water_velocity > 0.) { // injecting
const auto * perf_water_throughput = &well_state.perfThroughput()[this->first_perf_];
const auto * perf_water_throughput = well_state.perfThroughput(this->index_of_well_);
const double throughput = perf_water_throughput[perf];
const EvalWell molecular_weight = wpolymermw(throughput, water_velocity, deferred_logger);
cq_s_polymw *= molecular_weight;

View File

@@ -480,11 +480,11 @@ void WellState::init(const std::vector<double>& cellPressures,
if (pu.has_polymermw) {
if (global_num_perf_same)
{
auto * throughput_target = &perf_water_throughput_[connpos];
auto * throughput_target = this->perfThroughput(newIndex);
auto * pressure_target = &perf_skin_pressure_[connpos];
auto * velocity_target = &perf_water_velocity_[connpos];
const auto * throughput_src = &prevState->perfThroughput()[oldPerf_idx_beg];
const auto * throughput_src = prevState->perfThroughput(oldIndex);
const auto * pressure_src = &prevState->perfSkinPressure()[oldPerf_idx_beg];
const auto * velocity_src = &prevState->perfWaterVelocity()[oldPerf_idx_beg];

View File

@@ -238,12 +238,12 @@ public:
return well_potentials_;
}
std::vector<double>& perfThroughput() {
return perf_water_throughput_;
double * perfThroughput(std::size_t well_index) {
return &perf_water_throughput_[this->first_perf_index_[well_index]];
}
const std::vector<double>& perfThroughput() const {
return perf_water_throughput_;
const double * perfThroughput(std::size_t well_index) const {
return &perf_water_throughput_[this->first_perf_index_[well_index]];
}
std::vector<double>& perfSkinPressure() {