convert the examples and the tests to opm-parser
This commit is contained in:
parent
3b2aa175d5
commit
1d7ed18419
|
@ -87,7 +87,6 @@ try
|
|||
Opm::ParserPtr parser(new Opm::Parser() );
|
||||
Opm::DeckConstPtr deck = parser->parseFile(deck_filename);
|
||||
const double grav = param.getDefault("gravity", unit::gravity);
|
||||
//EclipseGridParser deck(deck_filename);
|
||||
GridManager gm(deck);
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
BlackoilPropertiesFromDeck props(deck, grid, param);
|
||||
|
|
|
@ -104,7 +104,7 @@ try
|
|||
|
||||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
std::unique_ptr<EclipseGridParser> deck;
|
||||
Opm::DeckConstPtr newParserDeck;
|
||||
std::unique_ptr<GridManager> grid;
|
||||
std::unique_ptr<IncompPropertiesInterface> props;
|
||||
std::unique_ptr<Opm::WellsManager> wells;
|
||||
|
@ -115,22 +115,22 @@ try
|
|||
if (use_deck) {
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(parser->parseFile(deck_filename)));
|
||||
newParserDeck = parser->parseFile(deck_filename);
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
|
||||
|
||||
deck.reset(new EclipseGridParser(deck_filename));
|
||||
// Grid init
|
||||
grid.reset(new GridManager(*deck));
|
||||
grid.reset(new GridManager(newParserDeck));
|
||||
// Rock and fluid init
|
||||
props.reset(new IncompPropertiesFromDeck(*deck, *grid->c_grid()));
|
||||
props.reset(new IncompPropertiesFromDeck(newParserDeck, *grid->c_grid()));
|
||||
// Wells init.
|
||||
wells.reset(new Opm::WellsManager(eclipseState , 0 , *grid->c_grid(), props->permeability()));
|
||||
// Gravity.
|
||||
gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity;
|
||||
gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state);
|
||||
initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state);
|
||||
}
|
||||
} else {
|
||||
// Grid init.
|
||||
|
|
|
@ -85,35 +85,37 @@ try
|
|||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
EclipseStateConstPtr eclipseState;
|
||||
std::unique_ptr<EclipseGridParser> deck;
|
||||
std::unique_ptr<GridManager> grid;
|
||||
std::unique_ptr<BlackoilPropertiesInterface> props;
|
||||
std::unique_ptr<RockCompressibility> rock_comp;
|
||||
|
||||
ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck;
|
||||
|
||||
BlackoilState state;
|
||||
// bool check_well_controls = false;
|
||||
// int max_well_control_iterations = 0;
|
||||
double gravity[3] = { 0.0 };
|
||||
if (use_deck) {
|
||||
ParserPtr parser(new Opm::Parser());
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
newParserDeck = parser->parseFile(deck_filename);
|
||||
|
||||
eclipseState.reset( new EclipseState(parser->parseFile(deck_filename)));
|
||||
deck.reset(new EclipseGridParser(deck_filename));
|
||||
eclipseState.reset(new EclipseState(newParserDeck));
|
||||
// Grid init
|
||||
grid.reset(new GridManager(*deck));
|
||||
grid.reset(new GridManager(newParserDeck));
|
||||
// Rock and fluid init
|
||||
props.reset(new BlackoilPropertiesFromDeck(*deck, *grid->c_grid(), param));
|
||||
props.reset(new BlackoilPropertiesFromDeck(newParserDeck, *grid->c_grid(), param));
|
||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(*deck));
|
||||
rock_comp.reset(new RockCompressibility(newParserDeck));
|
||||
// Gravity.
|
||||
gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity;
|
||||
gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state);
|
||||
initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state);
|
||||
}
|
||||
initBlackoilSurfvol(*grid->c_grid(), *props, state);
|
||||
} else {
|
||||
|
@ -196,9 +198,7 @@ try
|
|||
}
|
||||
|
||||
|
||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||
<< " (number of epochs: "
|
||||
<< (use_deck ? deck->numberOfEpochs() : 1) << ")\n\n" << std::flush;
|
||||
std::cout << "\n\n================ Starting main simulation loop ===============\n";
|
||||
|
||||
SimulatorReport rep;
|
||||
if (!use_deck) {
|
||||
|
@ -225,36 +225,24 @@ try
|
|||
int step = 0;
|
||||
SimulatorTimer simtimer;
|
||||
// Use timer for last epoch to obtain total time.
|
||||
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
||||
simtimer.init(*deck);
|
||||
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
||||
simtimer.init(timeMap);
|
||||
const double total_time = simtimer.totalTime();
|
||||
for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) {
|
||||
// Set epoch index.
|
||||
deck->setCurrentEpoch(epoch);
|
||||
|
||||
// Update the timer.
|
||||
if (deck->hasField("TSTEP")) {
|
||||
simtimer.init(*deck);
|
||||
} else {
|
||||
if (epoch != 0) {
|
||||
OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch);
|
||||
}
|
||||
simtimer.init(param);
|
||||
}
|
||||
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
|
||||
simtimer.setCurrentStepNum(step);
|
||||
simtimer.setTotalTime(total_time);
|
||||
|
||||
// Report on start of epoch.
|
||||
std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------"
|
||||
// Report on start of report step.
|
||||
std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------"
|
||||
<< "\n (number of steps: "
|
||||
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
|
||||
|
||||
// Create new wells, well_state
|
||||
WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability());
|
||||
WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
|
||||
// @@@ HACK: we should really make a new well state and
|
||||
// properly transfer old well state to it every epoch,
|
||||
// properly transfer old well state to it every report step,
|
||||
// since number of wells may change etc.
|
||||
if (epoch == 0) {
|
||||
if (reportStepIdx == 0) {
|
||||
well_state.init(wells.c_wells(), state);
|
||||
}
|
||||
|
||||
|
@ -268,7 +256,7 @@ try
|
|||
bcs.c_bcs(),
|
||||
linsolver,
|
||||
grav);
|
||||
if (epoch == 0) {
|
||||
if (reportStepIdx == 0) {
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state);
|
||||
|
|
|
@ -100,7 +100,7 @@ try
|
|||
bool use_deck = param.has("deck_filename");
|
||||
EclipseStateConstPtr eclipseState;
|
||||
|
||||
std::unique_ptr<EclipseGridParser> deck;
|
||||
Opm::DeckConstPtr newParserDeck;
|
||||
std::unique_ptr<GridManager> grid;
|
||||
std::unique_ptr<IncompPropertiesInterface> props;
|
||||
std::unique_ptr<RockCompressibility> rock_comp;
|
||||
|
@ -110,24 +110,25 @@ try
|
|||
double gravity[3] = { 0.0 };
|
||||
if (use_deck) {
|
||||
ParserPtr parser(new Opm::Parser());
|
||||
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
deck.reset(new EclipseGridParser(deck_filename));
|
||||
eclipseState.reset( new EclipseState(parser->parseFile(deck_filename)));
|
||||
newParserDeck = parser->parseFile(deck_filename);
|
||||
eclipseState.reset( new EclipseState(newParserDeck));
|
||||
// Grid init
|
||||
grid.reset(new GridManager(*deck));
|
||||
grid.reset(new GridManager(newParserDeck));
|
||||
// Rock and fluid init
|
||||
props.reset(new IncompPropertiesFromDeck(*deck, *grid->c_grid()));
|
||||
props.reset(new IncompPropertiesFromDeck(newParserDeck, *grid->c_grid()));
|
||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(*deck));
|
||||
rock_comp.reset(new RockCompressibility(newParserDeck));
|
||||
// Gravity.
|
||||
gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity;
|
||||
gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state);
|
||||
initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state);
|
||||
}
|
||||
} else {
|
||||
// Grid init.
|
||||
|
@ -213,10 +214,11 @@ try
|
|||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
|
||||
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
||||
|
||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||
<< " (number of epochs: "
|
||||
<< (use_deck ? deck->numberOfEpochs() : 1) << ")\n\n" << std::flush;
|
||||
<< " (number of report steps: "
|
||||
<< (use_deck ? timeMap->numTimesteps() : 1) << ")\n\n" << std::flush;
|
||||
|
||||
SimulatorReport rep;
|
||||
if (!use_deck) {
|
||||
|
@ -243,36 +245,24 @@ try
|
|||
int step = 0;
|
||||
SimulatorTimer simtimer;
|
||||
// Use timer for last epoch to obtain total time.
|
||||
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
||||
simtimer.init(*deck);
|
||||
simtimer.init(timeMap);
|
||||
const double total_time = simtimer.totalTime();
|
||||
for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) {
|
||||
// Set epoch index.
|
||||
deck->setCurrentEpoch(epoch);
|
||||
|
||||
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
|
||||
// Update the timer.
|
||||
if (deck->hasField("TSTEP")) {
|
||||
simtimer.init(*deck);
|
||||
} else {
|
||||
if (epoch != 0) {
|
||||
OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch);
|
||||
}
|
||||
simtimer.init(param);
|
||||
}
|
||||
simtimer.setCurrentStepNum(step);
|
||||
simtimer.setTotalTime(total_time);
|
||||
|
||||
// Report on start of epoch.
|
||||
std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------"
|
||||
<< "\n (number of steps: "
|
||||
// Report on start of report step.
|
||||
std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------"
|
||||
<< "\n (number of time steps: "
|
||||
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
|
||||
|
||||
// Create new wells, well_state
|
||||
WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability());
|
||||
WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
|
||||
// @@@ HACK: we should really make a new well state and
|
||||
// properly transfer old well state to it every epoch,
|
||||
// properly transfer old well state to it every report step,
|
||||
// since number of wells may change etc.
|
||||
if (epoch == 0) {
|
||||
if (reportStepIdx == 0) {
|
||||
well_state.init(wells.c_wells(), state);
|
||||
}
|
||||
|
||||
|
@ -286,7 +276,7 @@ try
|
|||
bcs.c_bcs(),
|
||||
linsolver,
|
||||
grav);
|
||||
if (epoch == 0) {
|
||||
if (reportStepIdx == 0) {
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state);
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include "config.h"
|
||||
#include <iostream>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/core/simulator/initState.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
|
@ -20,6 +19,7 @@
|
|||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
@ -34,16 +34,17 @@ try
|
|||
simtimer.init(parameters);
|
||||
|
||||
// Read input file
|
||||
EclipseGridParser parser(file_name);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck = parser->parseFile(file_name);
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
// Setup grid
|
||||
GridManager grid(parser);
|
||||
GridManager grid(newParserDeck);
|
||||
|
||||
// Define rock and fluid properties
|
||||
IncompPropertiesFromDeck incomp_properties(parser, *grid.c_grid());
|
||||
RockCompressibility rock_comp(parser);
|
||||
ParserPtr newParser(new Opm::Parser());
|
||||
EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParser->parseFile(file_name)));
|
||||
IncompPropertiesFromDeck incomp_properties(newParserDeck, *grid.c_grid());
|
||||
RockCompressibility rock_comp(newParserDeck);
|
||||
EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
|
||||
|
||||
// Finally handle the wells
|
||||
WellsManager wells(eclipseState , 0 , *grid.c_grid(), incomp_properties.permeability());
|
||||
|
@ -75,7 +76,7 @@ try
|
|||
|
||||
Opm::TwophaseState state;
|
||||
|
||||
initStateFromDeck(*grid.c_grid(), incomp_properties, parser, gravity[2], state);
|
||||
initStateFromDeck(*grid.c_grid(), incomp_properties, newParserDeck, gravity[2], state);
|
||||
|
||||
Opm::WellState well_state;
|
||||
well_state.init(wells.c_wells(), state);
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user