/* Copyright 2012 SINTEF ICT, Applied Mathematics. This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OPM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OPM. If not, see . */ #include #include #define NVERBOSE // Suppress own messages when throw()ing #define BOOST_TEST_MODULE WellCollectionTest #include #include #include #include #include #include #include #include using namespace Opm; BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) { Parser parser; std::string scheduleFile("wells_group.data"); Deck deck = parser.parseFile(scheduleFile); EclipseState eclipseState(deck); PhaseUsage pu = phaseUsageFromDeck(eclipseState); const auto& grid = eclipseState.getInputGrid(); const TableManager table ( deck ); const Eclipse3DProperties eclipseProperties ( deck , table, grid); const Runspec runspec(deck); const Schedule sched(deck, grid, eclipseProperties, runspec); SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime())); WellCollection collection; // Add groups to WellCollection const auto& fieldGroup = sched.getGroup2("FIELD", 2); collection.addField(fieldGroup, summaryState, pu); collection.addGroup( sched.getGroup2( "G1", 2 ), fieldGroup.name(), summaryState, pu); collection.addGroup( sched.getGroup2( "G2", 2 ), fieldGroup.name(), summaryState, pu); BOOST_CHECK_EQUAL("FIELD", collection.findNode("FIELD")->name()); BOOST_CHECK_EQUAL("FIELD", collection.findNode("G1")->getParent()->name()); BOOST_CHECK_EQUAL("FIELD", collection.findNode("G2")->getParent()->name()); // Add wells to WellCollection WellCollection wellCollection; const auto wells = sched.getWells2atEnd(); for (size_t i=0; igetParent()->name()); BOOST_CHECK_EQUAL("G1", collection.findNode("INJ2")->getParent()->name()); BOOST_CHECK_EQUAL("G2", collection.findNode("PROD1")->getParent()->name()); BOOST_CHECK_EQUAL("G2", collection.findNode("PROD2")->getParent()->name()); } BOOST_AUTO_TEST_CASE(EfficiencyFactor) { Parser parser; std::string scheduleFile("wells_group.data"); Deck deck = parser.parseFile(scheduleFile); EclipseState eclipseState(deck); PhaseUsage pu = phaseUsageFromDeck(eclipseState); const auto& grid = eclipseState.getInputGrid(); const TableManager table ( deck ); const Eclipse3DProperties eclipseProperties ( deck , table, grid); const Runspec runspec(deck); const Schedule sched(deck, grid, eclipseProperties, runspec); Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime())); size_t timestep = 2; WellCollection collection; // Add groups to WellCollection const auto& fieldGroup = sched.getGroup2("FIELD", timestep); collection.addField( fieldGroup, summaryState, pu); collection.addGroup( sched.getGroup2( "G1", timestep ), fieldGroup.name(), summaryState, pu); collection.addGroup( sched.getGroup2( "G2", timestep ), fieldGroup.name(), summaryState, pu); BOOST_CHECK_EQUAL(1.0, collection.findNode("FIELD")->efficiencyFactor()); BOOST_CHECK_EQUAL(1.0, collection.findNode("G1")->getParent()->efficiencyFactor()); BOOST_CHECK_EQUAL(1.0, collection.findNode("G2")->getParent()->efficiencyFactor()); // Add wells to WellCollection const auto wells1 = sched.getWells2(timestep); for (size_t i=0; i