mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 10:40:21 -06:00
use the new parser to read the PVT and grid data from the deck
the old code has not yet been removed, but in the long term, this is probably the way to go.
This commit is contained in:
parent
627b1f3906
commit
7f485626a2
@ -105,13 +105,13 @@ try
|
|||||||
Opm::DeckConstPtr newParserDeck = newParser->parse( deck_filename );
|
Opm::DeckConstPtr newParserDeck = newParser->parse( deck_filename );
|
||||||
|
|
||||||
// Grid init
|
// Grid init
|
||||||
grid.reset(new GridManager(*deck));
|
grid.reset(new GridManager(newParserDeck));
|
||||||
// Rock and fluid init
|
// Rock and fluid init
|
||||||
props.reset(new BlackoilPropertiesFromDeck(*deck, newParserDeck, *grid->c_grid(), param));
|
props.reset(new BlackoilPropertiesFromDeck(newParserDeck, *grid->c_grid(), param));
|
||||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||||
// Rock compressibility.
|
// Rock compressibility.
|
||||||
rock_comp.reset(new RockCompressibility(*deck));
|
rock_comp.reset(new RockCompressibility(newParserDeck));
|
||||||
// Gravity.
|
// Gravity.
|
||||||
gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity;
|
gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity;
|
||||||
// Init state variables (saturation and pressure).
|
// Init state variables (saturation and pressure).
|
||||||
|
@ -113,8 +113,16 @@ try
|
|||||||
|
|
||||||
Opm::EclipseWriter outputWriter(param, share_obj(*deck), share_obj(*grid->c_grid()));
|
Opm::EclipseWriter outputWriter(param, share_obj(*deck), share_obj(*grid->c_grid()));
|
||||||
// Rock and fluid init
|
// Rock and fluid init
|
||||||
props.reset(new BlackoilPropertiesFromDeck(*deck, newParserDeck, *grid->c_grid(), param));
|
|
||||||
new_props.reset(new BlackoilPropsAdFromDeck(*deck, newParserDeck, *grid->c_grid()));
|
#if 0
|
||||||
|
std::cout << "new parser\n";
|
||||||
|
props.reset(new BlackoilPropertiesFromDeck(newParserDeck, *grid->c_grid(), param));
|
||||||
|
new_props.reset(new BlackoilPropsAdFromDeck(newParserDeck, *grid->c_grid()));
|
||||||
|
#else
|
||||||
|
std::cout << "old parser\n";
|
||||||
|
props.reset(new BlackoilPropertiesFromDeck(*deck, *grid->c_grid(), param));
|
||||||
|
new_props.reset(new BlackoilPropsAdFromDeck(*deck, *grid->c_grid()));
|
||||||
|
#endif
|
||||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||||
// Rock compressibility.
|
// Rock compressibility.
|
||||||
|
@ -33,10 +33,11 @@
|
|||||||
#include <opm/core/utility/Units.hpp>
|
#include <opm/core/utility/Units.hpp>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
|
#include <opm/parser/eclipse/Utility/FullTable.hpp>
|
||||||
|
#include <opm/parser/eclipse/Utility/SimpleTable.hpp>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
// Making these typedef to make the code more readable.
|
// Making these typedef to make the code more readable.
|
||||||
typedef BlackoilPropsAdFromDeck::ADB ADB;
|
typedef BlackoilPropsAdFromDeck::ADB ADB;
|
||||||
typedef BlackoilPropsAdFromDeck::V V;
|
typedef BlackoilPropsAdFromDeck::V V;
|
||||||
@ -47,7 +48,6 @@ namespace Opm
|
|||||||
|
|
||||||
/// Constructor wrapping an opm-core black oil interface.
|
/// Constructor wrapping an opm-core black oil interface.
|
||||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
||||||
Opm::DeckConstPtr newParserDeck,
|
|
||||||
const UnstructuredGrid& grid,
|
const UnstructuredGrid& grid,
|
||||||
const bool init_rock)
|
const bool init_rock)
|
||||||
{
|
{
|
||||||
@ -132,6 +132,115 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Constructor wrapping an opm-core black oil interface.
|
||||||
|
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||||
|
const UnstructuredGrid& grid,
|
||||||
|
const bool init_rock)
|
||||||
|
{
|
||||||
|
if (init_rock){
|
||||||
|
rock_.init(newParserDeck, grid);
|
||||||
|
}
|
||||||
|
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");
|
||||||
|
const auto record = keyword->getRecord(region_number);
|
||||||
|
enum { ECL_oil = 0, ECL_water = 1, ECL_gas = 2 };
|
||||||
|
if (phase_usage_.phase_used[Aqua]) {
|
||||||
|
densities_[phase_usage_.phase_pos[Aqua]] = record->getItem("WATER")->getSIDouble(0);
|
||||||
|
}
|
||||||
|
if (phase_usage_.phase_used[Vapour]) {
|
||||||
|
densities_[phase_usage_.phase_pos[Vapour]] = record->getItem("GAS")->getSIDouble(0);
|
||||||
|
}
|
||||||
|
if (phase_usage_.phase_used[Liquid]) {
|
||||||
|
densities_[phase_usage_.phase_pos[Liquid]] = record->getItem("OIL")->getSIDouble(0);
|
||||||
|
}
|
||||||
|
} 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 (newParserDeck->hasKeyword("PVTW")) {
|
||||||
|
std::vector<std::string> columnNames{
|
||||||
|
"PREF", "FVFREF", "COMPRESSIBILITY", "MUREF", "VISCOSIBILITY"};
|
||||||
|
|
||||||
|
Opm::DeckKeywordConstPtr keyword = newParserDeck->getKeyword("PVTW");
|
||||||
|
Opm::SimpleTable pvtwTable(keyword, columnNames, /*recordIdx=*/region_number);
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Oil PVT
|
||||||
|
if (phase_usage_.phase_used[Liquid]) {
|
||||||
|
if (newParserDeck->hasKeyword("PVDO")) {
|
||||||
|
std::vector<std::string> columnNames{
|
||||||
|
"PO", "BO", "MUO"};
|
||||||
|
|
||||||
|
Opm::DeckKeywordConstPtr keyword = newParserDeck->getKeyword("PVDO");
|
||||||
|
Opm::SimpleTable pvdoTable(keyword, columnNames, region_number);
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(pvdoTable));
|
||||||
|
}
|
||||||
|
else if (newParserDeck->hasKeyword("PVTO")) {
|
||||||
|
std::vector<std::string> outerColumnNames{
|
||||||
|
"RS", "PBUBB", "RSSAT", "MU"};
|
||||||
|
|
||||||
|
std::vector<std::string> innerColumnNames{
|
||||||
|
"P", "RSSAT", "MU"};
|
||||||
|
|
||||||
|
Opm::DeckKeywordConstPtr pvtoKeyword = newParserDeck->getKeyword("PVTO");
|
||||||
|
Opm::FullTable pvtoTable(pvtoKeyword, outerColumnNames, innerColumnNames);
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(pvtoTable));
|
||||||
|
} else if (newParserDeck->hasKeyword("PVCDO")) {
|
||||||
|
std::vector<std::string> columnNames{
|
||||||
|
"PREF", "BO", "CO", "MUREF", "CMUO"};
|
||||||
|
|
||||||
|
Opm::DeckKeywordConstPtr pvcdoKeyword = newParserDeck->getKeyword("PVCDO");
|
||||||
|
Opm::SimpleTable pvcdoTable(pvcdoKeyword, columnNames, region_number);
|
||||||
|
|
||||||
|
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 (newParserDeck->hasKeyword("PVDG")) {
|
||||||
|
std::vector<std::string> columnNames{
|
||||||
|
"PG", "BG", "MUG"};
|
||||||
|
|
||||||
|
Opm::DeckKeywordConstPtr keyword = newParserDeck->getKeyword("PVDG");
|
||||||
|
Opm::SimpleTable pvdgTable(keyword, columnNames, region_number);
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(pvdgTable));
|
||||||
|
} else {
|
||||||
|
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SaturationPropsFromDeck<SatFuncGwsegNonuniform>* ptr
|
||||||
|
= new SaturationPropsFromDeck<SatFuncGwsegNonuniform>();
|
||||||
|
satprops_.reset(ptr);
|
||||||
|
ptr->init(newParserDeck, grid, -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() << ").");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Rock interface //
|
// Rock interface //
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
|
@ -52,7 +52,11 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
/// Constructor wrapping an opm-core black oil interface.
|
/// Constructor wrapping an opm-core black oil interface.
|
||||||
BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
BlackoilPropsAdFromDeck(const EclipseGridParser& deck,
|
||||||
Opm::DeckConstPtr newParserDeck,
|
const UnstructuredGrid& grid,
|
||||||
|
const bool init_rock = true );
|
||||||
|
|
||||||
|
/// Constructor wrapping an opm-core black oil interface.
|
||||||
|
BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck,
|
||||||
const UnstructuredGrid& grid,
|
const UnstructuredGrid& grid,
|
||||||
const bool init_rock = true );
|
const bool init_rock = true );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user