Adds original ECL index of well connection to PerforationData

and use it in the WellInterface instead of creating a vector
with these indices there. The original approach recreates
information in another path of the well and assumes that all
connections are in a process's local partition. That assumption
does not hold any more for distributed wells.
This commit is contained in:
Markus Blatt
2020-11-12 14:04:27 +01:00
parent 010ff83f26
commit 049aaad326
4 changed files with 8 additions and 12 deletions

View File

@@ -595,6 +595,7 @@ namespace Opm {
well_perf_data_.resize(wells_ecl_.size()); well_perf_data_.resize(wells_ecl_.size());
int well_index = 0; int well_index = 0;
for (const auto& well : wells_ecl_) { for (const auto& well : wells_ecl_) {
std::size_t completion_index = 0;
well_perf_data_[well_index].clear(); well_perf_data_[well_index].clear();
well_perf_data_[well_index].reserve(well.getConnections().size()); well_perf_data_[well_index].reserve(well.getConnections().size());
for (const auto& completion : well.getConnections()) { for (const auto& completion : well.getConnections()) {
@@ -614,6 +615,7 @@ namespace Opm {
pd.cell_index = active_index; pd.cell_index = active_index;
pd.connection_transmissibility_factor = completion.CF(); pd.connection_transmissibility_factor = completion.CF();
pd.satnum_id = completion.satTableId(); pd.satnum_id = completion.satTableId();
pd.ecl_index = completion_index;
well_perf_data_[well_index].push_back(pd); well_perf_data_[well_index].push_back(pd);
} }
} else { } else {
@@ -622,6 +624,7 @@ namespace Opm {
"Completion state: " << Connection::State2String(completion.state()) << " not handled"); "Completion state: " << Connection::State2String(completion.state()) << " not handled");
} }
} }
++completion_index;
} }
++well_index; ++well_index;
} }

View File

@@ -29,6 +29,8 @@ struct PerforationData
int cell_index; int cell_index;
double connection_transmissibility_factor; double connection_transmissibility_factor;
int satnum_id; int satnum_id;
/// \brief The original index of the perforation in ECL Schedule
std::size_t ecl_index;
}; };
} // namespace Opm } // namespace Opm

View File

@@ -389,7 +389,7 @@ namespace Opm
// of states of individual well. // of states of individual well.
int first_perf_; int first_perf_;
std::vector<int> originalConnectionIndex_; const std::vector<PerforationData>* perf_data_;
std::vector<RateVector> connectionRates_; std::vector<RateVector> connectionRates_;

View File

@@ -48,6 +48,7 @@ namespace Opm
, number_of_phases_(num_phases) , number_of_phases_(num_phases)
, index_of_well_(index_of_well) , index_of_well_(index_of_well)
, first_perf_(first_perf_index) , first_perf_(first_perf_index)
, perf_data_(&perf_data)
{ {
if (time_step < 0) { if (time_step < 0) {
OPM_THROW(std::invalid_argument, "Negtive time step is used to construct WellInterface"); OPM_THROW(std::invalid_argument, "Negtive time step is used to construct WellInterface");
@@ -71,16 +72,6 @@ namespace Opm
saturation_table_number_[perf] = pd.satnum_id; saturation_table_number_[perf] = pd.satnum_id;
++perf; ++perf;
} }
int all_perf = 0;
originalConnectionIndex_.reserve(perf_data.size());
for (const auto& connection : well.getConnections()) {
if (connection.state() == Connection::State::OPEN) {
originalConnectionIndex_.push_back(all_perf);
}
++all_perf;
}
assert(originalConnectionIndex_.size() == perf_data.size());
} }
// initialization of the completions mapping // initialization of the completions mapping
@@ -1382,7 +1373,7 @@ namespace Opm
void void
WellInterface<TypeTag>::scaleProductivityIndex(const int perfIdx, double& productivity_index, const bool new_well, Opm::DeferredLogger& deferred_logger) WellInterface<TypeTag>::scaleProductivityIndex(const int perfIdx, double& productivity_index, const bool new_well, Opm::DeferredLogger& deferred_logger)
{ {
const auto& connection = well_ecl_.getConnections()[originalConnectionIndex_[perfIdx]]; const auto& connection = well_ecl_.getConnections()[(*perf_data_)[perfIdx].ecl_index];
if (well_ecl_.getDrainageRadius() < 0) { if (well_ecl_.getDrainageRadius() < 0) {
if (new_well && perfIdx == 0) { if (new_well && perfIdx == 0) {
deferred_logger.warning("PRODUCTIVITY_INDEX_WARNING", "Negative drainage radius not supported. The productivity index is set to zero"); deferred_logger.warning("PRODUCTIVITY_INDEX_WARNING", "Negative drainage radius not supported. The productivity index is set to zero");