diff --git a/opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp b/opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp index aadb88d0f..744c858e1 100644 --- a/opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp +++ b/opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp @@ -64,7 +64,8 @@ namespace Opm { EclipseGrid(const EclipseGrid& src, const double* zcorn, const std::vector& 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& dims , diff --git a/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp b/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp index f033f86c1..e1dcdd3d2 100644 --- a/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp +++ b/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp @@ -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; diff --git a/src/opm/input/eclipse/Schedule/MSW/Compsegs.cpp b/src/opm/input/eclipse/Schedule/MSW/Compsegs.cpp index b12f2a695..02592d11f 100644 --- a/src/opm/input/eclipse/Schedule/MSW/Compsegs.cpp +++ b/src/opm/input/eclipse/Schedule/MSW/Compsegs.cpp @@ -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 }); } diff --git a/tests/parser/MultisegmentWellTests.cpp b/tests/parser/MultisegmentWellTests.cpp index f301f80c9..150b450ef 100644 --- a/tests/parser/MultisegmentWellTests.cpp +++ b/tests/parser/MultisegmentWellTests.cpp @@ -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) );