Merge pull request #4329 from blattms/treat-connection-not-attached-to-segments-correctly

[bugfix,mswells] Throw for connections not attached to segments correctly.
This commit is contained in:
Bård Skaflestad 2022-12-16 17:12:27 +01:00 committed by GitHub
commit c42e0051e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -37,6 +37,8 @@
#include <cmath>
#include <stdexcept>
#include <fmt/format.h>
namespace Opm
{
@ -65,6 +67,13 @@ MultisegmentWellGeneric(WellInterfaceGeneric& baseif)
const Connection& connection = completion_set.get(perf);
if (connection.state() == Connection::State::OPEN) {
const int segment_index = segmentNumberToIndex(connection.segment());
if ( segment_index == -1) {
OPM_THROW(std::logic_error,
fmt::format("COMPSEGS: Well {} has connection in cell {}, {}, {} "
"without associated segment.", baseif_.wellEcl().name(),
connection.getI() + 1, connection.getJ() + 1,
connection.getK() + 1));
}
segment_perforations_[segment_index].push_back(i_perf_wells);
baseif.perfDepth()[i_perf_wells] = connection.depth();
const double segment_depth = segmentSet()[segment_index].depth();

View File

@ -627,6 +627,14 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
const Connection& connection = completion_set.get(perf);
if (connection.state() == Connection::State::OPEN) {
const int segment_index = segment_set.segmentNumberToIndex(connection.segment());
if ( segment_index == -1) {
OPM_THROW(std::logic_error,
fmt::format("COMPSEGS: Well {} has connection in cell {}, {}, {} "
"without associated segment.", well_ecl.name(),
connection.getI() + 1 , connection.getJ() + 1,
connection.getK() + 1 ));
}
segment_perforations[segment_index].push_back(n_activeperf);
n_activeperf++;
}