Make check whether a connection exists work for distributed wells.

This commit is contained in:
Markus Blatt
2020-11-27 18:19:23 +01:00
parent bd06dff7e2
commit a9a733ebc1
2 changed files with 26 additions and 24 deletions

View File

@@ -563,6 +563,7 @@ namespace Opm {
int globalNumWells = 0;
// Make wells_ecl_ contain only this partition's non-shut wells.
wells_ecl_ = getLocalNonshutWells(report_step, globalNumWells);
local_parallel_well_info_ = createLocalParallelWellInfo(wells_ecl_);
this->initializeWellProdIndCalculators();
initializeWellPerfData();
@@ -614,19 +615,17 @@ namespace Opm {
std::size_t completion_index = 0;
well_perf_data_[well_index].clear();
well_perf_data_[well_index].reserve(well.getConnections().size());
CheckDistributedWellConnections checker(well, *local_parallel_well_info_[well_index]);
for (const auto& completion : well.getConnections()) {
const int i = completion.getI();
const int j = completion.getJ();
const int k = completion.getK();
const int cart_grid_indx = i + cartDims[0] * (j + cartDims[1] * k);
const int active_index = cartesian_to_compressed_[cart_grid_indx];
if (completion.state() == Connection::State::OPEN) {
const int i = completion.getI();
const int j = completion.getJ();
const int k = completion.getK();
const int cart_grid_indx = i + cartDims[0] * (j + cartDims[1] * k);
const int active_index = cartesian_to_compressed_[cart_grid_indx];
if (active_index < 0) {
const std::string msg
= ("Cell with i,j,k indices " + std::to_string(i) + " " + std::to_string(j) + " "
+ std::to_string(k) + " not found in grid (well = " + well.name() + ").");
OPM_THROW(std::runtime_error, msg);
} else {
if (active_index >= 0) {
checker.connectionFound(completion_index);
PerforationData pd;
pd.cell_index = active_index;
pd.connection_transmissibility_factor = completion.CF();
@@ -635,6 +634,7 @@ namespace Opm {
well_perf_data_[well_index].push_back(pd);
}
} else {
checker.connectionFound(completion_index);
if (completion.state() != Connection::State::SHUT) {
OPM_THROW(std::runtime_error,
"Completion state: " << Connection::State2String(completion.state()) << " not handled");
@@ -642,6 +642,7 @@ namespace Opm {
}
++completion_index;
}
checker.checkAllConnectionsFound();
++well_index;
}
}