From d11d26a2f1bb69b2de3f03d22880e08b867827d7 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 23 May 2019 13:50:04 +0200 Subject: [PATCH] adding test WrongDistanceCOMPSEGS --- .../MSW/updatingConnectionsWithSegments.hpp | 2 +- tests/parser/MultisegmentWellTests.cpp | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp index 33f8e6e45..c9c4d6df5 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp @@ -28,7 +28,7 @@ namespace Opm { WellConnections * newConnectionsWithSegments(const DeckKeyword& compsegs, const WellConnections& input_connections, - const WellSegments& segments, const EclipseGrid& grid, + const WellSegments& segments, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); } diff --git a/tests/parser/MultisegmentWellTests.cpp b/tests/parser/MultisegmentWellTests.cpp index f1b1fd0bb..339251586 100644 --- a/tests/parser/MultisegmentWellTests.cpp +++ b/tests/parser/MultisegmentWellTests.cpp @@ -124,3 +124,56 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) { BOOST_CHECK_EQUAL(segment_number_connection7, 7); BOOST_CHECK_EQUAL(center_depth_connection7, 2534.5); } + +BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) { + Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z; + Opm::WellConnections connection_set(10,10); + Opm::EclipseGrid grid(20,20,20); + connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) ); + + connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); + connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) ); + + BOOST_CHECK_EQUAL( 7U , connection_set.size() ); + + const std::string compsegs_string = + "WELSEGS \n" + "'PROD01' 2512.5 2512.5 1.0e-5 'ABS' 'H--' 'HO' /\n" + "2 2 1 1 2537.5 2537.5 0.3 0.00010 /\n" + "3 3 1 2 2562.5 2562.5 0.2 0.00010 /\n" + "4 4 2 2 2737.5 2537.5 0.2 0.00010 /\n" + "6 6 2 4 3037.5 2539.5 0.2 0.00010 /\n" + "7 7 2 6 3337.5 2534.5 0.2 0.00010 /\n" + "/\n" + "\n" + "COMPSEGS\n" + "PROD01 / \n" + "20 1 1 1 2512.5 2525.0 /\n" + "20 1 2 1 2525.0 2550.0 /\n" + "20 1 3 1 2550.0 2545.0 /\n" + "19 1 2 2 2637.5 2837.5 /\n" + "18 1 2 2 2837.5 3037.5 /\n" + "17 1 2 2 3037.5 3237.5 /\n" + "16 1 2 2 3237.5 3437.5 /\n" + "/\n"; + + Opm::Parser parser; + Opm::Deck deck = parser.parseString(compsegs_string); + + const Opm::DeckKeyword compsegs = deck.getKeyword("COMPSEGS"); + BOOST_CHECK_EQUAL( 8U, compsegs.size() ); + + Opm::WellSegments segment_set; + const Opm::DeckKeyword welsegs = deck.getKeyword("WELSEGS"); + segment_set.loadWELSEGS(welsegs); + + BOOST_CHECK_EQUAL(6U, segment_set.size()); + + Opm::ErrorGuard errorGuard; + Opm::ParseContext parseContext; + BOOST_CHECK_THROW(Opm::newConnectionsWithSegments(compsegs, connection_set, segment_set, grid, parseContext, errorGuard), std::invalid_argument); +}