Merge pull request #3640 from vkip/top_segment_perfdepth

Avoid top segment perforation depth outside perforated grid cell.
This commit is contained in:
Kai Bao
2023-09-01 23:55:37 +02:00
committed by GitHub
4 changed files with 16 additions and 12 deletions

View File

@@ -64,7 +64,8 @@ namespace Opm {
EclipseGrid(const EclipseGrid& src, const double* zcorn, const std::vector<int>& actnum);
EclipseGrid(size_t nx, size_t ny, size_t nz,
double dx = 1.0, double dy = 1.0, double dz = 1.0);
double dx = 1.0, double dy = 1.0, double dz = 1.0,
double top = 0.0);
explicit EclipseGrid(const GridDims& gd);
EclipseGrid(const std::array<int, 3>& dims ,

View File

@@ -155,7 +155,7 @@ EclipseGrid::EclipseGrid(const GridDims& gd)
EclipseGrid::EclipseGrid(size_t nx, size_t ny , size_t nz,
double dx, double dy, double dz)
double dx, double dy, double dz, double top)
: GridDims(nx, ny, nz),
m_minpvMode(MinpvMode::Inactive),
m_pinchoutMode(PinchMode::TOPBOT),
@@ -186,8 +186,8 @@ EclipseGrid::EclipseGrid(size_t nx, size_t ny , size_t nz,
// top face of cell
int zind = i*2 + j*nx*4 + k*nx*ny*8;
double zt = k*dz;
double zb = (k+1)*dz;
double zt = top + k*dz;
double zb = top + (k+1)*dz;
m_zcorn[zind] = zt;
m_zcorn[zind + 1] = zt;

View File

@@ -89,9 +89,10 @@ struct Record {
const double segment_depth = segment.depth();
const double segment_distance = segment.totalLength();
// for top segment, no interpolation is needed
// Using top segment depth may lead to depths outside of the
// perforated grid cell, so simply stick to grid cell center in this case
if (segment_number == 1) {
center_depth = segment_depth;
center_depth = -1.0;
return;
}
@@ -324,9 +325,11 @@ namespace {
const int j = compseg.m_j;
const int k = compseg.m_k;
if (grid.get_cell(i, j, k).is_active()) {
// Negative values to indicate cell depths should be used
double cdepth = compseg.center_depth >= 0. ? compseg.center_depth : grid.get_cell(i, j, k).depth;
Connection& connection = new_connection_set.getFromIJK(i, j, k);
connection.updateSegment(compseg.segment_number,
compseg.center_depth,
cdepth,
compseg.m_seqIndex,
{ compseg.m_distance_start, compseg.m_distance_end });
}

View File

@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(AICDWellTest) {
auto dir = Opm::Connection::Direction::Z;
const auto kind = Opm::Connection::CTFKind::DeckValue;
Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10);
Opm::EclipseGrid grid(20,20,20);
Opm::EclipseGrid grid(20,20,20, 1., 1., 25.0, 2500.0);
connection_set.add(Opm::Connection( 19, 0, 0,grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 1,grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 2,grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
@@ -220,7 +220,7 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
auto dir = Opm::Connection::Direction::Z;
const auto kind = Opm::Connection::CTFKind::DeckValue;
Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10);
Opm::EclipseGrid grid(20,20,20);
Opm::EclipseGrid grid(20,20,20, 1., 1., 25.0, 2500.0);
connection_set.add(Opm::Connection( 19, 0, 0,grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 1,grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 2,grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
@@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) {
auto dir = Opm::Connection::Direction::Z;
const auto kind = Opm::Connection::CTFKind::DeckValue;
Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10);
Opm::EclipseGrid grid(20,20,20);
Opm::EclipseGrid grid(20,20,20, 1., 1., 25., 2500.);
connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
@@ -456,7 +456,7 @@ BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) {
auto dir = Opm::Connection::Direction::Z;
const auto kind = Opm::Connection::CTFKind::DeckValue;
Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10);
Opm::EclipseGrid grid(20,20,20);
Opm::EclipseGrid grid(20,20,20, 1., 1., 25., 2500.);
connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
@@ -525,7 +525,7 @@ BOOST_AUTO_TEST_CASE(testwsegvalv) {
auto dir = Opm::Connection::Direction::Z;
const auto kind = Opm::Connection::CTFKind::DeckValue;
Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10);
Opm::EclipseGrid grid(20,20,20);
Opm::EclipseGrid grid(20,20,20, 1., 1., 25., 2500.);
connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );
connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) );