2014-02-11 07:12:36 -06:00
|
|
|
/*
|
2014-02-11 07:21:15 -06:00
|
|
|
Copyright 2014 Statoil.
|
2014-02-11 07:12:36 -06:00
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#if HAVE_DYNAMIC_BOOST_TEST
|
|
|
|
#define BOOST_TEST_DYN_LINK
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NVERBOSE // Suppress own messages when throw()ing
|
|
|
|
|
|
|
|
#define BOOST_TEST_MODULE WellsGroupTest
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
|
|
|
#include <opm/core/wells/WellsGroup.hpp>
|
|
|
|
|
|
|
|
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
2016-03-16 20:57:59 -05:00
|
|
|
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
2014-02-11 07:12:36 -06:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
2016-01-20 07:12:04 -06:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
|
2014-02-11 07:12:36 -06:00
|
|
|
|
2016-01-20 07:12:04 -06:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
2014-02-11 07:12:36 -06:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
|
|
|
|
|
|
|
using namespace Opm;
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
|
2016-01-24 16:09:47 -06:00
|
|
|
std::string scheduleFile("wells_group.data");
|
2016-03-16 20:57:59 -05:00
|
|
|
ParseContext parseContext;
|
2016-10-13 09:03:35 -05:00
|
|
|
Parser parser;
|
|
|
|
Deck deck = parser.parseFile(scheduleFile, parseContext);
|
|
|
|
EclipseState eclipseState(deck , parseContext);
|
2017-10-24 13:38:15 -05:00
|
|
|
const auto& grid = eclipseState.getInputGrid();
|
|
|
|
const TableManager table ( deck );
|
|
|
|
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
|
|
|
const Schedule sched(deck, grid, eclipseProperties, Phases(true, true, true), parseContext );
|
|
|
|
|
|
|
|
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
|
2014-02-11 07:12:36 -06:00
|
|
|
|
2017-10-24 13:38:15 -05:00
|
|
|
auto wells = sched.getWells();
|
2014-02-11 07:12:36 -06:00
|
|
|
|
|
|
|
for (size_t i=0; i<wells.size(); i++) {
|
2016-06-16 02:33:43 -05:00
|
|
|
const auto* well = wells[i];
|
2014-02-11 07:12:36 -06:00
|
|
|
std::shared_ptr<WellsGroupInterface> wellsGroup = createWellWellsGroup(well, 2, pu);
|
|
|
|
BOOST_CHECK_EQUAL(well->name(), wellsGroup->name());
|
|
|
|
if (well->isInjector(2)) {
|
2014-03-20 18:35:15 -05:00
|
|
|
const WellInjectionProperties& properties = well->getInjectionProperties(2);
|
|
|
|
BOOST_CHECK_EQUAL(properties.surfaceInjectionRate, wellsGroup->injSpec().surface_flow_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(properties.BHPLimit, wellsGroup->injSpec().BHP_limit_);
|
|
|
|
BOOST_CHECK_EQUAL(properties.reservoirInjectionRate, wellsGroup->injSpec().reservoir_flow_max_rate_);
|
2014-02-11 07:12:36 -06:00
|
|
|
BOOST_CHECK_EQUAL(0.0, wellsGroup->prodSpec().guide_rate_);
|
|
|
|
}
|
|
|
|
if (well->isProducer(2)) {
|
2014-03-20 18:35:15 -05:00
|
|
|
const WellProductionProperties& properties = well->getProductionProperties(2);
|
|
|
|
BOOST_CHECK_EQUAL(properties.ResVRate, wellsGroup->prodSpec().reservoir_flow_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(properties.BHPLimit, wellsGroup->prodSpec().BHP_limit_);
|
|
|
|
BOOST_CHECK_EQUAL(properties.OilRate, wellsGroup->prodSpec().oil_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(properties.WaterRate, wellsGroup->prodSpec().water_max_rate_);
|
2014-02-11 07:12:36 -06:00
|
|
|
BOOST_CHECK_EQUAL(0.0, wellsGroup->injSpec().guide_rate_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
|
2016-10-13 09:03:35 -05:00
|
|
|
Parser parser;
|
2016-03-16 20:57:59 -05:00
|
|
|
ParseContext parseContext;
|
2016-01-24 16:09:47 -06:00
|
|
|
std::string scheduleFile("wells_group.data");
|
2016-10-13 09:03:35 -05:00
|
|
|
Deck deck = parser.parseFile(scheduleFile, parseContext);
|
|
|
|
EclipseState eclipseState(deck , parseContext);
|
2014-02-11 07:12:36 -06:00
|
|
|
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
|
2017-10-24 13:38:15 -05:00
|
|
|
const auto& grid = eclipseState.getInputGrid();
|
|
|
|
const TableManager table ( deck );
|
|
|
|
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
|
|
|
const Schedule sched(deck, grid, eclipseProperties, Phases(true, true, true), parseContext );
|
|
|
|
|
2014-02-11 07:12:36 -06:00
|
|
|
|
2017-10-24 13:38:15 -05:00
|
|
|
const auto& nodes = sched.getGroupTree(2);
|
2016-11-07 07:37:00 -06:00
|
|
|
|
2017-10-24 13:38:15 -05:00
|
|
|
for( const auto& grp : sched.getGroups() ) {
|
2016-11-07 07:37:00 -06:00
|
|
|
if( !nodes.exists( grp->name() ) ) continue;
|
|
|
|
const auto& group = *grp;
|
2014-02-11 07:12:36 -06:00
|
|
|
|
|
|
|
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, 2, pu);
|
2016-10-05 08:24:14 -05:00
|
|
|
BOOST_CHECK_EQUAL(group.name(), wellsGroup->name());
|
|
|
|
if (group.isInjectionGroup(2)) {
|
|
|
|
BOOST_CHECK_EQUAL(group.getSurfaceMaxRate(2), wellsGroup->injSpec().surface_flow_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(group.getReservoirMaxRate(2), wellsGroup->injSpec().reservoir_flow_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(group.getTargetReinjectFraction(2), wellsGroup->injSpec().reinjection_fraction_target_);
|
|
|
|
BOOST_CHECK_EQUAL(group.getTargetVoidReplacementFraction(2), wellsGroup->injSpec().voidage_replacment_fraction_);
|
2014-02-11 07:12:36 -06:00
|
|
|
}
|
2016-10-05 08:24:14 -05:00
|
|
|
if (group.isProductionGroup(2)) {
|
|
|
|
BOOST_CHECK_EQUAL(group.getReservoirVolumeTargetRate(2), wellsGroup->prodSpec().reservoir_flow_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(group.getGasTargetRate(2), wellsGroup->prodSpec().gas_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(group.getOilTargetRate(2), wellsGroup->prodSpec().oil_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(group.getWaterTargetRate(2), wellsGroup->prodSpec().water_max_rate_);
|
|
|
|
BOOST_CHECK_EQUAL(group.getLiquidTargetRate(2), wellsGroup->prodSpec().liquid_max_rate_);
|
2014-02-11 07:12:36 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|