convert the examples and the tests to opm-parser
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/props/pvt/SinglePvtConstCompr.hpp>
|
||||
#include <opm/core/props/pvt/SinglePvtDead.hpp>
|
||||
@@ -12,6 +11,14 @@
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Utility/PvtoTable.hpp>
|
||||
#include <opm/parser/eclipse/Utility/PvtgTable.hpp>
|
||||
#include <opm/parser/eclipse/Utility/PvtwTable.hpp>
|
||||
#include <opm/parser/eclipse/Utility/PvdoTable.hpp>
|
||||
#include <opm/parser/eclipse/Utility/PvcdoTable.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
@@ -29,7 +36,7 @@ using namespace Opm;
|
||||
using namespace std;
|
||||
|
||||
|
||||
std::vector<std::shared_ptr<SinglePvtInterface> > getProps(const EclipseGridParser deck,PhaseUsage phase_usage_){
|
||||
std::vector<std::shared_ptr<SinglePvtInterface> > getProps(Opm::DeckConstPtr newParserDeck,PhaseUsage phase_usage_){
|
||||
|
||||
|
||||
enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2 };
|
||||
@@ -42,8 +49,9 @@ std::vector<std::shared_ptr<SinglePvtInterface> > getProps(const EclipseGridPars
|
||||
|
||||
// Water PVT
|
||||
if (phase_usage_.phase_used[Aqua]) {
|
||||
if (deck.hasField("PVTW")) {
|
||||
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(deck.getPVTW().pvtw_));
|
||||
if (newParserDeck->hasKeyword("PVTW")) {
|
||||
Opm::PvtwTable pvtwTable(newParserDeck->getKeyword("PVTW"));
|
||||
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(pvtwTable));
|
||||
} else {
|
||||
// Eclipse 100 default.
|
||||
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(0.5*Opm::prefix::centi*Opm::unit::Poise));
|
||||
@@ -52,31 +60,39 @@ std::vector<std::shared_ptr<SinglePvtInterface> > getProps(const EclipseGridPars
|
||||
|
||||
// Oil PVT
|
||||
if (phase_usage_.phase_used[Liquid]) {
|
||||
if (deck.hasField("PVDO")) {
|
||||
if (newParserDeck->hasKeyword("PVDO")) {
|
||||
Opm::PvdoTable pvdoTable(newParserDeck->getKeyword("PVDO"));
|
||||
if (samples > 0) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(deck.getPVDO().pvdo_, samples));
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(pvdoTable, samples));
|
||||
} else {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDead(deck.getPVDO().pvdo_));
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDead(pvdoTable));
|
||||
}
|
||||
} else if (deck.hasField("PVTO")) {
|
||||
} else if (newParserDeck->hasKeyword("PVTO")) {
|
||||
Opm::PvtoTable pvtoTable(newParserDeck->getKeyword("PVTO"), /*tableIdx=*/0);
|
||||
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(deck.getPVTO().pvto_));
|
||||
} else if (deck.hasField("PVCDO")) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(deck.getPVCDO().pvcdo_));
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(pvtoTable));
|
||||
} else if (newParserDeck->hasKeyword("PVCDO")) {
|
||||
Opm::PvcdoTable pvcdoTable(newParserDeck->getKeyword("PVCDO"), /*tableIdx=*/0);
|
||||
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(pvcdoTable));
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDO or PVTO\n");
|
||||
}
|
||||
}
|
||||
// Gas PVT
|
||||
if (phase_usage_.phase_used[Vapour]) {
|
||||
if (deck.hasField("PVDG")) {
|
||||
if (newParserDeck->hasKeyword("PVDG")) {
|
||||
Opm::PvdgTable pvdgTable(newParserDeck->getKeyword("PVDG"));
|
||||
|
||||
if (samples > 0) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(deck.getPVDG().pvdg_, samples));
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(pvdgTable, samples));
|
||||
} else {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDead(deck.getPVDG().pvdg_));
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDead(pvdgTable));
|
||||
}
|
||||
} else if (deck.hasField("PVTG")) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_));
|
||||
} else if (newParserDeck->hasKeyword("PVTG")) {
|
||||
Opm::PvtgTable pvtgTable(newParserDeck->getKeyword("PVTG"), /*tableIdx=*/0);
|
||||
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(pvtgTable));
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||
}
|
||||
@@ -213,13 +229,14 @@ BOOST_AUTO_TEST_CASE(test_liveoil)
|
||||
|
||||
|
||||
// read eclipse deck
|
||||
const string filename = "liveoil.DATA";
|
||||
const std::string filename = "liveoil.DATA";
|
||||
cout << "Reading deck: " << filename << endl;
|
||||
const EclipseGridParser deck (filename);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
// setup pvt interface
|
||||
PhaseUsage phase_usage_ = phaseUsageFromDeck(deck);
|
||||
std::vector<std::shared_ptr<SinglePvtInterface> > props_ = getProps(deck,phase_usage_);
|
||||
PhaseUsage phase_usage_ = phaseUsageFromDeck(newParserDeck);
|
||||
std::vector<std::shared_ptr<SinglePvtInterface> > props_ = getProps(newParserDeck,phase_usage_);
|
||||
|
||||
|
||||
// setup a test case. We will check 6 [p,r] pairs and compare them to both the [p,z] interface and a finite difference
|
||||
@@ -286,13 +303,15 @@ BOOST_AUTO_TEST_CASE(test_wetgas)
|
||||
|
||||
|
||||
// read eclipse deck
|
||||
const string filename = "wetgas.DATA";
|
||||
|
||||
const std::string filename = "wetgas.DATA";
|
||||
cout << "Reading deck: " << filename << endl;
|
||||
const EclipseGridParser deck (filename);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
// setup pvt interface
|
||||
PhaseUsage phase_usage_ = phaseUsageFromDeck(deck);
|
||||
std::vector<std::shared_ptr<SinglePvtInterface> > props_ = getProps(deck,phase_usage_);
|
||||
PhaseUsage phase_usage_ = phaseUsageFromDeck(newParserDeck);
|
||||
std::vector<std::shared_ptr<SinglePvtInterface> > props_ = getProps(newParserDeck,phase_usage_);
|
||||
|
||||
|
||||
// setup a test case. We will check 6 [p,r] pairs and compare them to both the [p,z] interface and a finite difference
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
@@ -29,12 +31,13 @@ BOOST_AUTO_TEST_CASE(EqualsDifferentDeckReturnFalse) {
|
||||
|
||||
const string filename1 = "testBlackoilState1.DATA";
|
||||
const string filename2 = "testBlackoilState2.DATA";
|
||||
const EclipseGridParser deck1 (filename1);
|
||||
const EclipseGridParser deck2 (filename2);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck1(parser->parseFile(filename1));
|
||||
Opm::DeckConstPtr newParserDeck2(parser->parseFile(filename2));
|
||||
|
||||
GridManager gridManager1(deck1);
|
||||
GridManager gridManager1(newParserDeck1);
|
||||
const UnstructuredGrid* grid1 = gridManager1.c_grid();
|
||||
GridManager gridManager2(deck2);
|
||||
GridManager gridManager2(newParserDeck2);
|
||||
const UnstructuredGrid* grid2 = gridManager2.c_grid();
|
||||
|
||||
BlackoilState state1;
|
||||
@@ -51,9 +54,10 @@ BOOST_AUTO_TEST_CASE(EqualsDifferentDeckReturnFalse) {
|
||||
BOOST_AUTO_TEST_CASE(EqualsDifferentNumPhasesReturnFalse) {
|
||||
|
||||
const string filename = "testBlackoilState1.DATA";
|
||||
const EclipseGridParser deck (filename);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
GridManager gridManager(deck);
|
||||
GridManager gridManager(newParserDeck);
|
||||
const UnstructuredGrid* grid = gridManager.c_grid();
|
||||
|
||||
BlackoilState state1;
|
||||
@@ -70,9 +74,10 @@ BOOST_AUTO_TEST_CASE(EqualsDifferentNumPhasesReturnFalse) {
|
||||
BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) {
|
||||
|
||||
const string filename = "testBlackoilState1.DATA";
|
||||
const EclipseGridParser deck (filename);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
GridManager gridManager(deck);
|
||||
GridManager gridManager(newParserDeck);
|
||||
const UnstructuredGrid* grid = gridManager.c_grid();
|
||||
|
||||
BlackoilState state1;
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <opm/core/grid/ColumnExtract.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
@@ -128,11 +130,10 @@ BOOST_AUTO_TEST_CASE(DisjointColumn)
|
||||
correct_answer[4].resize(1);
|
||||
correct_answer[9].resize(1);
|
||||
|
||||
std::istringstream is(grdecl);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseString(grdecl));
|
||||
|
||||
Opm::EclipseGridParser deck;
|
||||
deck.read(is);
|
||||
Opm::GridManager manager(deck);
|
||||
Opm::GridManager manager(newParserDeck);
|
||||
|
||||
VVI columns;
|
||||
Opm::extractColumn(*manager.c_grid(), columns);
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/well_controls.h>
|
||||
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
|
||||
|
||||
@@ -175,11 +174,12 @@ void check_controls_epoch1( struct WellControls ** ctrls) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(New_Constructor_Works) {
|
||||
|
||||
const std::string filename = "wells_manager_data.data";
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(parser->parseFile("wells_manager_data.data")));
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
Opm::EclipseGridParser Deck("wells_manager_data.data");
|
||||
Opm::GridManager gridManager(Deck);
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
|
||||
Opm::GridManager gridManager(newParserDeck);
|
||||
|
||||
{
|
||||
Opm::WellsManager wellsManager(eclipseState, 0, *gridManager.c_grid(), NULL);
|
||||
@@ -197,10 +197,12 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WellsEqual) {
|
||||
Opm::EclipseGridParser Deck("wells_manager_data.data");
|
||||
Opm::GridManager gridManager(Deck);
|
||||
const std::string filename = "wells_manager_data.data";
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(parser->parseFile("wells_manager_data.data")));
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
|
||||
Opm::GridManager gridManager(newParserDeck);
|
||||
|
||||
Opm::WellsManager wellsManager0(eclipseState , 0 , *gridManager.c_grid(), NULL);
|
||||
Opm::WellsManager wellsManager1(eclipseState , 1 , *gridManager.c_grid(), NULL);
|
||||
@@ -211,11 +213,12 @@ BOOST_AUTO_TEST_CASE(WellsEqual) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ControlsEqual) {
|
||||
Opm::EclipseGridParser Deck("wells_manager_data.data");
|
||||
Opm::GridManager gridManager(Deck);
|
||||
|
||||
const std::string filename = "wells_manager_data.data";
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(parser->parseFile("wells_manager_data.data")));
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
|
||||
Opm::GridManager gridManager(newParserDeck);
|
||||
|
||||
Opm::WellsManager wellsManager0(eclipseState , 0 , *gridManager.c_grid(), NULL);
|
||||
Opm::WellsManager wellsManager1(eclipseState , 1 , *gridManager.c_grid(), NULL);
|
||||
@@ -234,16 +237,12 @@ BOOST_AUTO_TEST_CASE(ControlsEqual) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WellHasSTOP_ExceptionIsThrown) {
|
||||
Opm::EclipseGridParser Deck("wells_manager_data_wellSTOP.data");
|
||||
Opm::GridManager gridManager(Deck);
|
||||
|
||||
const std::string filename = "wells_manager_data_wellSTOP.data";
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(parser->parseFile("wells_manager_data_wellSTOP.data")));
|
||||
Opm::DeckConstPtr newParserDeck(parser->parseFile(filename));
|
||||
|
||||
Deck.setCurrentEpoch(0);
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
|
||||
Opm::GridManager gridManager(newParserDeck);
|
||||
|
||||
BOOST_CHECK_THROW( new Opm::WellsManager(eclipseState, 0, *gridManager.c_grid(), NULL), std::runtime_error );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user