mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 18:21:00 -06:00
completely remove the EclipseGridParser from the module
This commit is contained in:
parent
553698a933
commit
dbb19403fc
@ -92,7 +92,7 @@ try
|
||||
// The current code for the non-deck case fails for unknown reasons.
|
||||
OPM_THROW(std::runtime_error, "This simulator cannot run without a deck with wells. Use deck_filename to specify deck.");
|
||||
}
|
||||
boost::scoped_ptr<EclipseGridParser> deck;
|
||||
Opm::DeckConstPtr newParserDeck;
|
||||
boost::scoped_ptr<GridManager> grid;
|
||||
boost::scoped_ptr<BlackoilPropertiesInterface> props;
|
||||
boost::scoped_ptr<RockCompressibility> rock_comp;
|
||||
@ -103,11 +103,9 @@ try
|
||||
double gravity[3] = { 0.0 };
|
||||
if (use_deck) {
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
deck.reset(new EclipseGridParser(deck_filename));
|
||||
Opm::ParserPtr newParser(new Opm::Parser() );
|
||||
Opm::DeckConstPtr newParserDeck = newParser->parseFile( deck_filename );
|
||||
eclipseState.reset( new EclipseState(newParserDeck ));
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck = parser->parseFile( deck_filename );
|
||||
eclipseState.reset(new EclipseState(newParserDeck));
|
||||
|
||||
// Grid init
|
||||
grid.reset(new GridManager(newParserDeck));
|
||||
@ -118,12 +116,12 @@ try
|
||||
// Rock compressibility.
|
||||
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 {
|
||||
@ -207,10 +205,7 @@ try
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
@ -232,42 +227,26 @@ try
|
||||
} else {
|
||||
// With a deck, we may have more epochs etc.
|
||||
WellState well_state;
|
||||
int step = 0;
|
||||
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
||||
SimulatorTimer simtimer;
|
||||
// Use timer for last epoch to obtain total time.
|
||||
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
||||
simtimer.init(*deck);
|
||||
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);
|
||||
}
|
||||
simtimer.setCurrentStepNum(step);
|
||||
simtimer.setTotalTime(total_time);
|
||||
|
||||
// Report on start of epoch.
|
||||
std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------"
|
||||
<< "\n (number of steps: "
|
||||
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
|
||||
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
|
||||
// Report on start of report step.
|
||||
std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------"
|
||||
<< "\n (number of steps left: "
|
||||
<< timeMap->numTimesteps() - reportStepIdx << ")\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);
|
||||
}
|
||||
|
||||
simtimer.setCurrentStepNum(reportStepIdx);
|
||||
|
||||
// Create and run simulator.
|
||||
SimulatorCompressibleAd simulator(param,
|
||||
*grid->c_grid(),
|
||||
@ -276,7 +255,7 @@ try
|
||||
wells,
|
||||
linsolver,
|
||||
grav);
|
||||
if (epoch == 0) {
|
||||
if (reportStepIdx == 0) {
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state);
|
||||
@ -285,7 +264,6 @@ try
|
||||
}
|
||||
// Update total timing report and remember step number.
|
||||
rep += epoch_rep;
|
||||
step = simtimer.currentStepNum();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,8 @@ try
|
||||
|
||||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
boost::scoped_ptr<EclipseGridParser> deck;
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr newParserDeck;
|
||||
boost::scoped_ptr<GridManager> grid;
|
||||
boost::scoped_ptr<IncompPropertiesInterface> props;
|
||||
boost::scoped_ptr<RockCompressibility> rock_comp;
|
||||
@ -110,25 +111,24 @@ try
|
||||
double gravity[3] = { 0.0 };
|
||||
if (use_deck) {
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
ParserPtr parser(new Opm::Parser());
|
||||
eclipseState.reset( new EclipseState(parser->parseFile(deck_filename)));
|
||||
newParserDeck = parser->parseFile(deck_filename);
|
||||
eclipseState.reset(new 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()));
|
||||
// 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.
|
||||
@ -215,9 +215,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) {
|
||||
@ -239,44 +237,27 @@ try
|
||||
well_state.init(0, state);
|
||||
rep = simulator.run(simtimer, state, well_state);
|
||||
} else {
|
||||
// With a deck, we may have more epochs etc.
|
||||
// With a deck, we may have more report steps etc.
|
||||
WellState well_state;
|
||||
int step = 0;
|
||||
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
||||
SimulatorTimer simtimer;
|
||||
// Use timer for last epoch to obtain total time.
|
||||
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
||||
simtimer.init(*deck);
|
||||
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);
|
||||
}
|
||||
simtimer.setCurrentStepNum(step);
|
||||
simtimer.setTotalTime(total_time);
|
||||
|
||||
// Report on start of epoch.
|
||||
std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------"
|
||||
<< "\n (number of steps: "
|
||||
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
|
||||
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
|
||||
// Report on start of report step.
|
||||
std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------"
|
||||
<< "\n (number of steps left: "
|
||||
<< timeMap->numTimesteps() - reportStepIdx << ")\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);
|
||||
}
|
||||
|
||||
simtimer.setCurrentStepNum(reportStepIdx);
|
||||
|
||||
// Create and run simulator.
|
||||
SimulatorIncompTwophaseAd simulator(param,
|
||||
*grid->c_grid(),
|
||||
@ -287,7 +268,7 @@ try
|
||||
bcs.c_bcs(),
|
||||
linsolver,
|
||||
grav);
|
||||
if (epoch == 0) {
|
||||
if (reportStepIdx == 0) {
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state);
|
||||
@ -296,7 +277,6 @@ try
|
||||
}
|
||||
// Update total timing report and remember step number.
|
||||
rep += epoch_rep;
|
||||
step = simtimer.currentStepNum();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ try
|
||||
|
||||
Opm::ParserPtr newParser(new Opm::Parser() );
|
||||
Opm::DeckConstPtr newParserDeck = newParser->parseFile( deck_filename );
|
||||
std::shared_ptr<EclipseState> eclipseState(new EclipseState(newParserDeck));
|
||||
std::shared_ptr<EclipseState> eclipseState(new EclipseState(deck));
|
||||
|
||||
// Grid init
|
||||
grid.reset(new GridManager(eclipseState->getEclipseGrid()));
|
||||
|
@ -33,8 +33,10 @@
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Utility/PvdoTable.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>
|
||||
|
||||
namespace Opm
|
||||
@ -48,7 +50,7 @@ namespace Opm
|
||||
Vapour = BlackoilPhases::Vapour };
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
|
||||
const UnstructuredGrid& grid,
|
||||
const bool init_rock)
|
||||
{
|
||||
@ -56,19 +58,9 @@ namespace Opm
|
||||
grid.cell_centroids, grid.dimensions, init_rock);
|
||||
}
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||
const UnstructuredGrid& grid,
|
||||
const bool init_rock)
|
||||
{
|
||||
init(newParserDeck, grid.number_of_cells, grid.global_cell, grid.cartdims,
|
||||
grid.cell_centroids, grid.dimensions, init_rock);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DUNE_CORNERPOINT
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
|
||||
const Dune::CpGrid& grid,
|
||||
const bool init_rock )
|
||||
{
|
||||
@ -76,141 +68,30 @@ namespace Opm
|
||||
static_cast<const int*>(&grid.logicalCartesianSize()[0]),
|
||||
grid.beginCellCentroids(), Dune::CpGrid::dimension, init_rock);
|
||||
}
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||
const Dune::CpGrid& grid,
|
||||
const bool init_rock )
|
||||
{
|
||||
init(newParserDeck, grid.numCells(), static_cast<const int*>(&grid.globalCell()[0]),
|
||||
static_cast<const int*>(&grid.logicalCartesianSize()[0]),
|
||||
grid.beginCellCentroids(), Dune::CpGrid::dimension, init_rock);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
template<class T>
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||
int number_of_cells,
|
||||
const int* global_cell,
|
||||
const int* cart_dims,
|
||||
T begin_cell_centroids,
|
||||
int dimensions,
|
||||
const bool init_rock)
|
||||
{
|
||||
init(newParserDeck, number_of_cells, global_cell, cart_dims, begin_cell_centroids,
|
||||
dimensions, init_rock);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void BlackoilPropsAdFromDeck::init(const EclipseGridParser& deck,
|
||||
/// Initializes the properties.
|
||||
template <class CentroidIterator>
|
||||
void BlackoilPropsAdFromDeck::init(Opm::DeckConstPtr deck,
|
||||
int number_of_cells,
|
||||
const int* global_cell,
|
||||
const int* cart_dims,
|
||||
T begin_cell_centroids,
|
||||
int dimensions,
|
||||
const CentroidIterator& begin_cell_centroids,
|
||||
int dimension,
|
||||
const bool init_rock)
|
||||
{
|
||||
if (init_rock){
|
||||
rock_.init(deck, number_of_cells, global_cell, cart_dims);
|
||||
}
|
||||
|
||||
const int samples = 0;
|
||||
const int region_number = 0;
|
||||
|
||||
phase_usage_ = phaseUsageFromDeck(deck);
|
||||
|
||||
// Surface densities. Accounting for different orders in eclipse and our code.
|
||||
if (deck.hasField("DENSITY")) {
|
||||
const std::vector<double>& d = deck.getDENSITY().densities_[region_number];
|
||||
enum { ECL_oil = 0, ECL_water = 1, ECL_gas = 2 };
|
||||
if (phase_usage_.phase_used[Aqua]) {
|
||||
densities_[phase_usage_.phase_pos[Aqua]] = d[ECL_water];
|
||||
}
|
||||
if (phase_usage_.phase_used[Vapour]) {
|
||||
densities_[phase_usage_.phase_pos[Vapour]] = d[ECL_gas];
|
||||
}
|
||||
if (phase_usage_.phase_used[Liquid]) {
|
||||
densities_[phase_usage_.phase_pos[Liquid]] = d[ECL_oil];
|
||||
}
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing DENSITY\n");
|
||||
}
|
||||
|
||||
// Set the properties.
|
||||
props_.resize(phase_usage_.num_phases);
|
||||
// Water PVT
|
||||
if (phase_usage_.phase_used[Aqua]) {
|
||||
if (deck.hasField("PVTW")) {
|
||||
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(deck.getPVTW().pvtw_));
|
||||
} else {
|
||||
// Eclipse 100 default.
|
||||
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(0.5*Opm::prefix::centi*Opm::unit::Poise));
|
||||
}
|
||||
}
|
||||
// Oil PVT
|
||||
if (phase_usage_.phase_used[Liquid]) {
|
||||
if (deck.hasField("PVDO")) {
|
||||
if (samples > 0) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(deck.getPVDO().pvdo_, samples));
|
||||
} else {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDead(deck.getPVDO().pvdo_));
|
||||
}
|
||||
} else if (deck.hasField("PVTO")) {
|
||||
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_));
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDO, PVTO or PVCDO\n");
|
||||
}
|
||||
}
|
||||
// Gas PVT
|
||||
if (phase_usage_.phase_used[Vapour]) {
|
||||
if (deck.hasField("PVDG")) {
|
||||
if (samples > 0) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(deck.getPVDG().pvdg_, samples));
|
||||
} else {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDead(deck.getPVDG().pvdg_));
|
||||
}
|
||||
} else if (deck.hasField("PVTG")) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_));
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||
}
|
||||
}
|
||||
|
||||
SaturationPropsFromDeck<SatFuncGwsegNonuniform>* ptr
|
||||
= new SaturationPropsFromDeck<SatFuncGwsegNonuniform>();
|
||||
satprops_.reset(ptr);
|
||||
ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimensions, -1);
|
||||
|
||||
if (phase_usage_.num_phases != satprops_->numPhases()) {
|
||||
OPM_THROW(std::runtime_error, "BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck() - "
|
||||
"Inconsistent number of phases in pvt data (" << phase_usage_.num_phases
|
||||
<< ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void BlackoilPropsAdFromDeck::init(Opm::DeckConstPtr newParserDeck,
|
||||
int number_of_cells,
|
||||
const int* global_cell,
|
||||
const int* cart_dims,
|
||||
T begin_cell_centroids,
|
||||
int dimensions,
|
||||
const bool init_rock)
|
||||
{
|
||||
if (init_rock){
|
||||
rock_.init(newParserDeck, number_of_cells, global_cell, cart_dims);
|
||||
}
|
||||
|
||||
const int samples = 0;
|
||||
const int region_number = 0;
|
||||
|
||||
phase_usage_ = phaseUsageFromDeck(newParserDeck);
|
||||
|
||||
// Surface densities. Accounting for different orders in eclipse and our code.
|
||||
if (newParserDeck->hasKeyword("DENSITY")) {
|
||||
const auto keyword = newParserDeck->getKeyword("DENSITY");
|
||||
if (deck->hasKeyword("DENSITY")) {
|
||||
const auto keyword = deck->getKeyword("DENSITY");
|
||||
const auto record = keyword->getRecord(region_number);
|
||||
enum { ECL_oil = 0, ECL_water = 1, ECL_gas = 2 };
|
||||
if (phase_usage_.phase_used[Aqua]) {
|
||||
@ -230,8 +111,8 @@ namespace Opm
|
||||
props_.resize(phase_usage_.num_phases);
|
||||
// Water PVT
|
||||
if (phase_usage_.phase_used[Aqua]) {
|
||||
if (newParserDeck->hasKeyword("PVTW")) {
|
||||
Opm::PvtwTable pvtwTable(newParserDeck->getKeyword("PVTW"), region_number);
|
||||
if (deck->hasKeyword("PVTW")) {
|
||||
Opm::PvtwTable pvtwTable(deck->getKeyword("PVTW"), region_number);
|
||||
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(pvtwTable));
|
||||
} else {
|
||||
// Eclipse 100 default.
|
||||
@ -241,19 +122,19 @@ namespace Opm
|
||||
|
||||
// Oil PVT
|
||||
if (phase_usage_.phase_used[Liquid]) {
|
||||
if (newParserDeck->hasKeyword("PVDO")) {
|
||||
Opm::PvdoTable pvdoTable(newParserDeck->getKeyword("PVDO"), region_number);
|
||||
if (deck->hasKeyword("PVDO")) {
|
||||
Opm::PvdoTable pvdoTable(deck->getKeyword("PVDO"), region_number);
|
||||
if (samples > 0) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(pvdoTable, samples));
|
||||
} else {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDead(pvdoTable));
|
||||
}
|
||||
}
|
||||
else if (newParserDeck->hasKeyword("PVTO")) {
|
||||
Opm::PvtoTable pvtoTable(newParserDeck->getKeyword("PVTO"), /*tableIdx=*/0);
|
||||
else if (deck->hasKeyword("PVTO")) {
|
||||
Opm::PvtoTable pvtoTable(deck->getKeyword("PVTO"), /*tableIdx=*/0);
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(pvtoTable));
|
||||
} else if (newParserDeck->hasKeyword("PVCDO")) {
|
||||
Opm::PvcdoTable pvdcoTable(newParserDeck->getKeyword("PVCDO"), region_number);
|
||||
} else if (deck->hasKeyword("PVCDO")) {
|
||||
Opm::PvcdoTable pvdcoTable(deck->getKeyword("PVCDO"), region_number);
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(pvdcoTable));
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDO, PVTO or PVCDO\n");
|
||||
@ -262,15 +143,15 @@ namespace Opm
|
||||
|
||||
// Gas PVT
|
||||
if (phase_usage_.phase_used[Vapour]) {
|
||||
if (newParserDeck->hasKeyword("PVDG")) {
|
||||
Opm::PvdoTable pvdgTable(newParserDeck->getKeyword("PVDG"), region_number);
|
||||
if (deck->hasKeyword("PVDG")) {
|
||||
Opm::PvdoTable pvdgTable(deck->getKeyword("PVDG"), region_number);
|
||||
if (samples > 0) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(pvdgTable, samples));
|
||||
} else {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDead(pvdgTable));
|
||||
}
|
||||
} else if (newParserDeck->hasKeyword("PVTG")) {
|
||||
Opm::PvtgTable pvtgTable(newParserDeck->getKeyword("PVTG"), /*tableIdx=*/0);
|
||||
} else if (deck->hasKeyword("PVTG")) {
|
||||
Opm::PvtgTable pvtgTable(deck->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");
|
||||
@ -280,16 +161,15 @@ namespace Opm
|
||||
SaturationPropsFromDeck<SatFuncGwsegNonuniform>* ptr
|
||||
= new SaturationPropsFromDeck<SatFuncGwsegNonuniform>();
|
||||
satprops_.reset(ptr);
|
||||
ptr->init(newParserDeck, number_of_cells, global_cell, begin_cell_centroids, dimensions, -1);
|
||||
ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, -1);
|
||||
|
||||
if (phase_usage_.num_phases != satprops_->numPhases()) {
|
||||
OPM_THROW(std::runtime_error, "BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck() - "
|
||||
"Inconsistent number of phases in pvt data (" << phase_usage_.num_phases
|
||||
<< ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||
"Inconsistent number of phases in pvt data (" << phase_usage_.num_phases
|
||||
<< ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////
|
||||
// Rock interface //
|
||||
////////////////////////////
|
||||
|
@ -23,15 +23,12 @@
|
||||
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
|
||||
#include <opm/autodiff/AutoDiffBlock.hpp>
|
||||
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
#include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/props/rock/RockFromDeck.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <memory>
|
||||
|
||||
#ifdef HAVE_DUNE_CORNERPOINT
|
||||
#include "disable_warning_pragmas.h"
|
||||
@ -56,50 +53,18 @@ namespace Opm
|
||||
class BlackoilPropsAdFromDeck : public BlackoilPropsAdInterface
|
||||
{
|
||||
public:
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
||||
const UnstructuredGrid& grid,
|
||||
const bool init_rock = true );
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||
const UnstructuredGrid& grid,
|
||||
const bool init_rock = true );
|
||||
|
||||
#ifdef HAVE_DUNE_CORNERPOINT
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
||||
const Dune::CpGrid& grid,
|
||||
const bool init_rock = true );
|
||||
|
||||
/// Constructor wrapping an opm-core black oil interface.
|
||||
BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||
const Dune::CpGrid& grid,
|
||||
const bool init_rock = true );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/// Constructor taking not a grid but only the needed information
|
||||
template<class T>
|
||||
BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||
int number_of_cells,
|
||||
const int* global_cell,
|
||||
const int* cart_dims,
|
||||
T begin_cell_centroids,
|
||||
int dimensions,
|
||||
const bool init_rock);
|
||||
|
||||
/// Constructor taking not a grid but only the needed information
|
||||
template<class T>
|
||||
BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
||||
int number_of_cells,
|
||||
const int* global_cell,
|
||||
const int* cart_dims,
|
||||
T begin_cell_centroids,
|
||||
int dimensions,
|
||||
const bool init_rock);
|
||||
|
||||
////////////////////////////
|
||||
// Rock interface //
|
||||
@ -371,25 +336,17 @@ namespace Opm
|
||||
|
||||
private:
|
||||
/// Initializes the properties.
|
||||
template<class T>
|
||||
void init(const EclipseGridParser& deck,
|
||||
int number_of_cells,
|
||||
const int* global_cell,
|
||||
const int* cart_dims,
|
||||
T begin_cell_centroids,
|
||||
int dimension,
|
||||
const bool init_rock);
|
||||
/// Initializes the properties.
|
||||
template<class T>
|
||||
template <class CentroidIterator>
|
||||
void init(Opm::DeckConstPtr deck,
|
||||
int number_of_cells,
|
||||
const int* global_cell,
|
||||
const int* cart_dims,
|
||||
T begin_cell_centroids,
|
||||
const CentroidIterator& begin_cell_centroids,
|
||||
int dimension,
|
||||
const bool init_rock);
|
||||
|
||||
RockFromDeck rock_;
|
||||
boost::scoped_ptr<SaturationPropsInterface> satprops_;
|
||||
std::unique_ptr<SaturationPropsInterface> satprops_;
|
||||
PhaseUsage phase_usage_;
|
||||
std::vector<boost::shared_ptr<SinglePvtInterface> > props_;
|
||||
double densities_[BlackoilPhases::MaxNumPhases];
|
||||
|
@ -30,23 +30,23 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
struct SetupSimple {
|
||||
SetupSimple()
|
||||
: param()
|
||||
, deck()
|
||||
{
|
||||
std::ifstream str("fluid.data");
|
||||
deck.read(str);
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
newParserDeck = parser->parseFile("fluid.data");
|
||||
|
||||
param.disableOutput();
|
||||
param.insertParameter("init_rock" , "false" );
|
||||
@ -56,7 +56,7 @@ struct SetupSimple {
|
||||
}
|
||||
|
||||
Opm::parameter::ParameterGroup param;
|
||||
Opm::EclipseGridParser deck;
|
||||
Opm::DeckConstPtr newParserDeck;
|
||||
};
|
||||
|
||||
|
||||
@ -65,14 +65,14 @@ struct TestFixture : public Setup
|
||||
{
|
||||
TestFixture()
|
||||
: Setup()
|
||||
, grid (deck)
|
||||
, props(deck, *grid.c_grid(), param,
|
||||
, grid (newParserDeck)
|
||||
, props(newParserDeck, *grid.c_grid(), param,
|
||||
param.getDefault("init_rock", false))
|
||||
{
|
||||
}
|
||||
|
||||
using Setup::param;
|
||||
using Setup::deck;
|
||||
using Setup::newParserDeck;
|
||||
|
||||
Opm::GridManager grid;
|
||||
Opm::BlackoilPropertiesFromDeck props;
|
||||
|
Loading…
Reference in New Issue
Block a user