From bbb30de74e627150ba1dfabc6f7ac8b0fb7314e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Tue, 20 Dec 2016 14:08:58 +0100 Subject: [PATCH] Don't rely on Deck for checkTable and checkPhase Prefer using EclipseState over Deck. --- opm/core/props/rock/RockFromDeck.cpp | 1 - opm/core/props/satfunc/RelpermDiagnostics.cpp | 44 +++++++++---------- opm/core/props/satfunc/RelpermDiagnostics.hpp | 5 +-- .../props/satfunc/RelpermDiagnostics_impl.hpp | 4 +- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/opm/core/props/rock/RockFromDeck.cpp b/opm/core/props/rock/RockFromDeck.cpp index 7a4de8ddc..20eec193d 100644 --- a/opm/core/props/rock/RockFromDeck.cpp +++ b/opm/core/props/rock/RockFromDeck.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include diff --git a/opm/core/props/satfunc/RelpermDiagnostics.cpp b/opm/core/props/satfunc/RelpermDiagnostics.cpp index 2795a6d8c..41fb03fa3 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics.cpp +++ b/opm/core/props/satfunc/RelpermDiagnostics.cpp @@ -25,12 +25,13 @@ namespace Opm{ - void RelpermDiagnostics::phaseCheck_(const Deck& deck) + void RelpermDiagnostics::phaseCheck_(const EclipseState& es) { - bool hasWater = deck.hasKeyword("WATER"); - bool hasGas = deck.hasKeyword("GAS"); - bool hasOil = deck.hasKeyword("OIL"); - bool hasSolvent = deck.hasKeyword("SOLVENT"); + const auto& phases = es.runspec().phases(); + bool hasWater = phases.active( Phase::WATER ); + bool hasGas = phases.active( Phase::GAS ); + bool hasOil = phases.active( Phase::OIL ); + bool hasSolvent = phases.active( Phase::SOLVENT ); if (hasWater && hasGas && !hasOil && !hasSolvent) { const std::string msg = "System: Water-Gas system."; @@ -125,10 +126,9 @@ namespace Opm{ - void RelpermDiagnostics::tableCheck_(const EclipseState& eclState, - const Deck& deck) + void RelpermDiagnostics::tableCheck_(const EclipseState& eclState) { - const int numSatRegions = deck.getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0); + const int numSatRegions = eclState.runspec().tabdims().getNumSatTables(); { const std::string msg = "Number of saturation regions: " + std::to_string(numSatRegions) + "\n"; OpmLog::info(msg); @@ -149,46 +149,46 @@ namespace Opm{ const TableContainer& msfnTables = tableManager.getMsfnTables(); for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) { - if (deck.hasKeyword("SWOF")) { + if (tableManager.hasTables("SWOF")) { swofTableCheck_(swofTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SGOF")) { + if (tableManager.hasTables("SGOF")) { sgofTableCheck_(sgofTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SLGOF")) { + if (tableManager.hasTables("SLGOF")) { slgofTableCheck_(slgofTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SWFN")) { + if (tableManager.hasTables("SWFN")) { swfnTableCheck_(swfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SGFN")) { + if (tableManager.hasTables("SGFN")) { sgfnTableCheck_(sgfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SOF3")) { + if (tableManager.hasTables("SOF3")) { sof3TableCheck_(sof3Tables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SOF2")) { + if (tableManager.hasTables("SOF2")) { sof2TableCheck_(sof2Tables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SGWFN")) { + if (tableManager.hasTables("SGWFN")) { sgwfnTableCheck_(sgwfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SGCWMIS")) { + if (tableManager.hasTables("SGCWMIS")) { sgcwmisTableCheck_(sgcwmisTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SORWMIS")) { + if (tableManager.hasTables("SORWMIS")) { sorwmisTableCheck_(sorwmisTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("SSFN")) { + if (tableManager.hasTables("SSFN")) { ssfnTableCheck_(ssfnTables.getTable(satnumIdx), satnumIdx+1); } - if (deck.hasKeyword("MSFN")) { + if (tableManager.hasTables("MSFN")) { msfnTableCheck_(msfnTables.getTable(satnumIdx), satnumIdx+1); } } - if (deck.hasKeyword("MISCIBLE")) { + if (tableManager.hasTables("MISC")) { const int numMiscNumIdx = miscTables.size(); const std::string msg = "Number of misc regions: " + std::to_string(numMiscNumIdx) + "\n"; OpmLog::info(msg); @@ -610,7 +610,7 @@ namespace Opm{ const EclipseState& eclState) { // get the number of saturation regions and the number of cells in the deck - const int numSatRegions = deck.getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0); + const int numSatRegions = eclState.runspec().tabdims().getNumSatTables(); unscaledEpsInfo_.resize(numSatRegions); const auto& tables = eclState.getTableManager(); diff --git a/opm/core/props/satfunc/RelpermDiagnostics.hpp b/opm/core/props/satfunc/RelpermDiagnostics.hpp index 75002c213..a85cf8a34 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics.hpp +++ b/opm/core/props/satfunc/RelpermDiagnostics.hpp @@ -86,14 +86,13 @@ namespace Opm { ///Check the phase that used. - void phaseCheck_(const Deck& deck); + void phaseCheck_(const EclipseState& es); ///Check saturation family I and II. void satFamilyCheck_(const EclipseState& eclState); ///Check saturation tables. - void tableCheck_(const EclipseState& eclState, - const Deck& deck); + void tableCheck_(const EclipseState& eclState); ///Check endpoints in the saturation tables. void unscaledEndPointsCheck_(const Deck& deck, diff --git a/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp b/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp index 25debd076..250b3706a 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp +++ b/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp @@ -34,9 +34,9 @@ namespace Opm { const GridT& grid) { OpmLog::info("\n***************Saturation Functions Diagnostics***************"); - phaseCheck_(deck); + phaseCheck_(eclState); satFamilyCheck_(eclState); - tableCheck_(eclState, deck); + tableCheck_(eclState); unscaledEndPointsCheck_(deck, eclState); scaledEndPointsCheck_(deck, eclState, grid); }