Merge pull request #1125 from jokva/reduce-deck-use-relperm-diagnostics

Don't rely on Deck for checkTable and checkPhase
This commit is contained in:
Atgeirr Flø Rasmussen 2017-01-09 09:35:25 +01:00 committed by GitHub
commit 95d4a8101d
4 changed files with 26 additions and 28 deletions

View File

@ -23,7 +23,6 @@
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/core/utility/CompressedPropertyAccess.hpp> #include <opm/core/utility/CompressedPropertyAccess.hpp>

View File

@ -25,12 +25,13 @@
namespace Opm{ namespace Opm{
void RelpermDiagnostics::phaseCheck_(const Deck& deck) void RelpermDiagnostics::phaseCheck_(const EclipseState& es)
{ {
bool hasWater = deck.hasKeyword("WATER"); const auto& phases = es.runspec().phases();
bool hasGas = deck.hasKeyword("GAS"); bool hasWater = phases.active( Phase::WATER );
bool hasOil = deck.hasKeyword("OIL"); bool hasGas = phases.active( Phase::GAS );
bool hasSolvent = deck.hasKeyword("SOLVENT"); bool hasOil = phases.active( Phase::OIL );
bool hasSolvent = phases.active( Phase::SOLVENT );
if (hasWater && hasGas && !hasOil && !hasSolvent) { if (hasWater && hasGas && !hasOil && !hasSolvent) {
const std::string msg = "System: Water-Gas system."; const std::string msg = "System: Water-Gas system.";
@ -125,10 +126,9 @@ namespace Opm{
void RelpermDiagnostics::tableCheck_(const EclipseState& eclState, void RelpermDiagnostics::tableCheck_(const EclipseState& eclState)
const Deck& deck)
{ {
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"; const std::string msg = "Number of saturation regions: " + std::to_string(numSatRegions) + "\n";
OpmLog::info(msg); OpmLog::info(msg);
@ -149,46 +149,46 @@ namespace Opm{
const TableContainer& msfnTables = tableManager.getMsfnTables(); const TableContainer& msfnTables = tableManager.getMsfnTables();
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) { for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {
if (deck.hasKeyword("SWOF")) { if (tableManager.hasTables("SWOF")) {
swofTableCheck_(swofTables.getTable<SwofTable>(satnumIdx), satnumIdx+1); swofTableCheck_(swofTables.getTable<SwofTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SGOF")) { if (tableManager.hasTables("SGOF")) {
sgofTableCheck_(sgofTables.getTable<SgofTable>(satnumIdx), satnumIdx+1); sgofTableCheck_(sgofTables.getTable<SgofTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SLGOF")) { if (tableManager.hasTables("SLGOF")) {
slgofTableCheck_(slgofTables.getTable<SlgofTable>(satnumIdx), satnumIdx+1); slgofTableCheck_(slgofTables.getTable<SlgofTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SWFN")) { if (tableManager.hasTables("SWFN")) {
swfnTableCheck_(swfnTables.getTable<SwfnTable>(satnumIdx), satnumIdx+1); swfnTableCheck_(swfnTables.getTable<SwfnTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SGFN")) { if (tableManager.hasTables("SGFN")) {
sgfnTableCheck_(sgfnTables.getTable<SgfnTable>(satnumIdx), satnumIdx+1); sgfnTableCheck_(sgfnTables.getTable<SgfnTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SOF3")) { if (tableManager.hasTables("SOF3")) {
sof3TableCheck_(sof3Tables.getTable<Sof3Table>(satnumIdx), satnumIdx+1); sof3TableCheck_(sof3Tables.getTable<Sof3Table>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SOF2")) { if (tableManager.hasTables("SOF2")) {
sof2TableCheck_(sof2Tables.getTable<Sof2Table>(satnumIdx), satnumIdx+1); sof2TableCheck_(sof2Tables.getTable<Sof2Table>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SGWFN")) { if (tableManager.hasTables("SGWFN")) {
sgwfnTableCheck_(sgwfnTables.getTable<SgwfnTable>(satnumIdx), satnumIdx+1); sgwfnTableCheck_(sgwfnTables.getTable<SgwfnTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SGCWMIS")) { if (tableManager.hasTables("SGCWMIS")) {
sgcwmisTableCheck_(sgcwmisTables.getTable<SgcwmisTable>(satnumIdx), satnumIdx+1); sgcwmisTableCheck_(sgcwmisTables.getTable<SgcwmisTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SORWMIS")) { if (tableManager.hasTables("SORWMIS")) {
sorwmisTableCheck_(sorwmisTables.getTable<SorwmisTable>(satnumIdx), satnumIdx+1); sorwmisTableCheck_(sorwmisTables.getTable<SorwmisTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("SSFN")) { if (tableManager.hasTables("SSFN")) {
ssfnTableCheck_(ssfnTables.getTable<SsfnTable>(satnumIdx), satnumIdx+1); ssfnTableCheck_(ssfnTables.getTable<SsfnTable>(satnumIdx), satnumIdx+1);
} }
if (deck.hasKeyword("MSFN")) { if (tableManager.hasTables("MSFN")) {
msfnTableCheck_(msfnTables.getTable<MsfnTable>(satnumIdx), satnumIdx+1); msfnTableCheck_(msfnTables.getTable<MsfnTable>(satnumIdx), satnumIdx+1);
} }
} }
if (deck.hasKeyword("MISCIBLE")) { if (tableManager.hasTables("MISC")) {
const int numMiscNumIdx = miscTables.size(); const int numMiscNumIdx = miscTables.size();
const std::string msg = "Number of misc regions: " + std::to_string(numMiscNumIdx) + "\n"; const std::string msg = "Number of misc regions: " + std::to_string(numMiscNumIdx) + "\n";
OpmLog::info(msg); OpmLog::info(msg);
@ -610,7 +610,7 @@ namespace Opm{
const EclipseState& eclState) const EclipseState& eclState)
{ {
// get the number of saturation regions and the number of cells in the deck // 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); unscaledEpsInfo_.resize(numSatRegions);
const auto& tables = eclState.getTableManager(); const auto& tables = eclState.getTableManager();

View File

@ -86,14 +86,13 @@ namespace Opm {
///Check the phase that used. ///Check the phase that used.
void phaseCheck_(const Deck& deck); void phaseCheck_(const EclipseState& es);
///Check saturation family I and II. ///Check saturation family I and II.
void satFamilyCheck_(const EclipseState& eclState); void satFamilyCheck_(const EclipseState& eclState);
///Check saturation tables. ///Check saturation tables.
void tableCheck_(const EclipseState& eclState, void tableCheck_(const EclipseState& eclState);
const Deck& deck);
///Check endpoints in the saturation tables. ///Check endpoints in the saturation tables.
void unscaledEndPointsCheck_(const Deck& deck, void unscaledEndPointsCheck_(const Deck& deck,

View File

@ -34,9 +34,9 @@ namespace Opm {
const GridT& grid) const GridT& grid)
{ {
OpmLog::info("\n***************Saturation Functions Diagnostics***************"); OpmLog::info("\n***************Saturation Functions Diagnostics***************");
phaseCheck_(deck); phaseCheck_(eclState);
satFamilyCheck_(eclState); satFamilyCheck_(eclState);
tableCheck_(eclState, deck); tableCheck_(eclState);
unscaledEndPointsCheck_(deck, eclState); unscaledEndPointsCheck_(deck, eclState);
scaledEndPointsCheck_(deck, eclState, grid); scaledEndPointsCheck_(deck, eclState, grid);
} }