mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
Make check whether a connection exists work for distributed wells.
This commit is contained in:
parent
bd06dff7e2
commit
a9a733ebc1
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1194,23 +1194,23 @@ namespace Opm
|
||||
|
||||
// COMPDAT handling
|
||||
const auto& connectionSet = well_ecl_.getConnections();
|
||||
CheckDistributedWellConnections checker(well_ecl_, parallel_well_info_);
|
||||
for (size_t c=0; c<connectionSet.size(); c++) {
|
||||
const auto& connection = connectionSet.get(c);
|
||||
const int i = connection.getI();
|
||||
const int j = connection.getJ();
|
||||
const int k = connection.getK();
|
||||
|
||||
const int* cpgdim = cart_dims;
|
||||
const int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k);
|
||||
const int cell = cartesian_to_compressed[cart_grid_indx];
|
||||
if (connection.state() != Connection::State::OPEN || cell >= 0)
|
||||
{
|
||||
checker.connectionFound(c);
|
||||
}
|
||||
if (connection.state() == Connection::State::OPEN) {
|
||||
const int i = connection.getI();
|
||||
const int j = connection.getJ();
|
||||
const int k = connection.getK();
|
||||
|
||||
const int* cpgdim = cart_dims;
|
||||
const int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k);
|
||||
const int cell = cartesian_to_compressed[cart_grid_indx];
|
||||
|
||||
if (cell < 0) {
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Cell with i,j,k indices " << i << ' ' << j << ' '
|
||||
<< k << " not found in grid (well = " << name() << ')', deferred_logger);
|
||||
}
|
||||
|
||||
{
|
||||
if (cell >= 0) {
|
||||
double radius = connection.rw();
|
||||
const std::array<double, 3> cubical =
|
||||
wellhelpers::getCubeDim<3>(cell_to_faces, begin_face_centroids, cell);
|
||||
@ -1242,6 +1242,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
}
|
||||
checker.checkAllConnectionsFound();
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
|
Loading…
Reference in New Issue
Block a user