EclipseState: infer default region from GRIDOPTS

This commit is contained in:
Joakim Hove
2015-03-03 15:40:55 +01:00
parent bae2fa4b3a
commit 8846d4b7b8
3 changed files with 115 additions and 0 deletions

View File

@@ -122,12 +122,14 @@ namespace Opm {
EclipseState::EclipseState(DeckConstPtr deck, LoggerPtr logger)
: m_defaultRegion("FLUXNUM")
{
m_deckUnitSystem = deck->getActiveUnitSystem();
initPhases(deck, logger);
initTables(deck, logger);
initEclipseGrid(deck, logger);
initGridopts(deck);
initSchedule(deck, logger);
initTitle(deck, logger);
initProperties(deck, logger);
@@ -415,6 +417,53 @@ namespace Opm {
}
void EclipseState::initGridopts(DeckConstPtr deck) {
if (deck->hasKeyword("GRIDOPTS")) {
/*
The EQUALREG, MULTREG, COPYREG, ... keywords are used to
manipulate vectors based on region values; for instance
the statement
EQUALREG
PORO 0.25 3 / -- Region array not specified
PERMX 100 3 F /
/
will set the PORO field to 0.25 for all cells in region
3 and the PERMX value to 100 mD for the same cells. The
fourth optional argument to the EQUALREG keyword is used
to indicate which REGION array should be used for the
selection.
If the REGION array is not indicated (as in the PORO
case) above, the default region to use in the xxxREG
keywords depends on the GRIDOPTS keyword:
1. If GRIDOPTS is present, and the NRMULT item is
greater than zero, the xxxREG keywords will default
to use the MULTNUM region.
2. If the GRIDOPTS keyword is not present - or the
NRMULT item equals zero, the xxxREG keywords will
default to use the FLUXNUM keyword.
This quite weird behaviour comes from reading the
GRIDOPTS and MULTNUM documentation, and practical
experience with ECLIPSE simulations. Ufortunately the
documentation of the xxxREG keywords does not confirm
this.
*/
auto gridOpts = deck->getKeyword("GRIDOPTS");
auto record = gridOpts->getRecord(0);
auto nrmult_item = record->getItem("NRMULT");
if (nrmult_item->getInt(0) > 0)
m_defaultRegion = "MULTNUM";
}
}
void EclipseState::initPhases(DeckConstPtr deck, LoggerPtr logger) {
if (deck->hasKeyword("OIL"))
phases.insert(Phase::PhaseEnum::OIL);
@@ -559,6 +608,10 @@ namespace Opm {
return gridProperty;
}
std::shared_ptr<GridProperty<int> > EclipseState::getDefaultRegion() const {
return m_intGridProperties->getInitializedKeyword( m_defaultRegion );
}
/*
Due to the post processor which might be applied to the

View File

@@ -82,6 +82,7 @@ namespace Opm {
std::string getTitle() const;
bool supportsGridProperty(const std::string& keyword, int enabledTypes=AllProperties) const;
std::shared_ptr<GridProperty<int> > getDefaultRegion() const;
std::shared_ptr<GridProperty<int> > getIntGridProperty( const std::string& keyword ) const;
std::shared_ptr<GridProperty<double> > getDoubleGridProperty( const std::string& keyword ) const;
bool hasIntGridProperty(const std::string& keyword) const;
@@ -132,6 +133,7 @@ namespace Opm {
void initSchedule(DeckConstPtr deck, LoggerPtr logger);
void initSimulationConfig(DeckConstPtr deck);
void initEclipseGrid(DeckConstPtr deck, LoggerPtr logger);
void initGridopts(DeckConstPtr deck);
void initPhases(DeckConstPtr deck, LoggerPtr logger);
void initTitle(DeckConstPtr deck, LoggerPtr logger);
void initProperties(DeckConstPtr deck, LoggerPtr logger);
@@ -261,6 +263,7 @@ namespace Opm {
std::shared_ptr<GridProperties<double> > m_doubleGridProperties;
std::shared_ptr<TransMult> m_transMult;
std::shared_ptr<FaultCollection> m_faults;
std::string m_defaultRegion;
};
typedef std::shared_ptr<EclipseState> EclipseStatePtr;

View File

@@ -349,3 +349,62 @@ BOOST_AUTO_TEST_CASE(FaceTransMults) {
}
}
}
static DeckPtr createDeckNoGridOpts() {
const char *deckData =
"RUNSPEC\n"
"\n"
"DIMENS\n"
" 10 10 10 /\n"
"GRID\n"
"FLUXNUM\n"
" 1000*1 /\n"
"MULTNUM\n"
" 1000*1 /\n";
ParserPtr parser(new Parser());
return parser->parseString(deckData) ;
}
static DeckPtr createDeckWithGridOpts() {
const char *deckData =
"RUNSPEC\n"
"GRIDOPTS\n"
" 'YES' 10 /"
"\n"
"DIMENS\n"
" 10 10 10 /\n"
"GRID\n"
"FLUXNUM\n"
" 1000*1 /\n"
"MULTNUM\n"
" 1000*1 /\n";
ParserPtr parser(new Parser());
return parser->parseString(deckData) ;
}
BOOST_AUTO_TEST_CASE(NoGridOptsDefaultRegion) {
DeckPtr deck = createDeckNoGridOpts();
EclipseState state(deck);
auto multnum = state.getIntGridProperty("MULTNUM");
auto fluxnum = state.getIntGridProperty("FLUXNUM");
auto def_property = state.getDefaultRegion();
BOOST_CHECK_EQUAL( fluxnum , def_property );
}
BOOST_AUTO_TEST_CASE(WithGridOptsDefaultRegion) {
DeckPtr deck = createDeckWithGridOpts();
EclipseState state(deck);
auto multnum = state.getIntGridProperty("MULTNUM");
auto fluxnum = state.getIntGridProperty("FLUXNUM");
auto def_property = state.getDefaultRegion();
BOOST_CHECK_EQUAL( multnum , def_property );
}