From e08691f90add7629ea503d479b7600332219a478 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 2 Sep 2015 12:29:45 +0200 Subject: [PATCH] fix the fallout of the TableManager the problem is that the EclMaterialLawManager is currently not used in any opm-material unit test, so the module compiled just fine without these fixes. Mental note to myself: add such a unit test! --- .../EclMaterialLawManager.hpp | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp b/opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp index f3dd21ecf..ab9e96064 100644 --- a/opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp +++ b/opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp @@ -560,17 +560,21 @@ private: // If SWOF and SGOF are specified in the deck it return FamilyI // If SWFN, SGFN and SOF3 are specified in the deck it return FamilyII // If keywords are missing or mixed, an error is given. + enum SaturationFunctionFamily { + noFamily, + FamilyI, + FamilyII + }; - enum SaturationFunctionFamily { noFamily = 0, FamilyI = 1, FamilyII = 2}; - - const SaturationFunctionFamily getSaturationFunctionFamily(Opm::EclipseStateConstPtr eclState) const{ - - const std::vector& swofTables = eclState->getSwofTables(); - const std::vector& slgofTables = eclState->getSlgofTables(); - const std::vector& sgofTables = eclState->getSgofTables(); - const std::vector& swfnTables = eclState->getSwfnTables(); - const std::vector& sgfnTables = eclState->getSgfnTables(); - const std::vector& sof3Tables = eclState->getSof3Tables(); + SaturationFunctionFamily getSaturationFunctionFamily(Opm::EclipseStateConstPtr eclState) const + { + const auto& tableManager = eclState->getTableManager(); + const std::vector& swofTables = tableManager->getSwofTables(); + const std::vector& slgofTables = tableManager->getSlgofTables(); + const std::vector& sgofTables = tableManager->getSgofTables(); + const std::vector& swfnTables = tableManager->getSwfnTables(); + const std::vector& sgfnTables = tableManager->getSgfnTables(); + const std::vector& sof3Tables = tableManager->getSof3Tables(); bool family1 = (!sgofTables.empty() || !slgofTables.empty()) && !swofTables.empty(); bool family2 = !swfnTables.empty() && !sgfnTables.empty() && !sof3Tables.empty(); @@ -604,12 +608,13 @@ private: // shifted by the connate water saturation. Scalar Swco = unscaledEpsInfo_[satnumRegionIdx].Swl; + const auto& tableManager = eclState->getTableManager(); auto& effParams = *dest[satnumRegionIdx]; switch (getSaturationFunctionFamily(eclState)) { case FamilyI: { - if (!eclState->getSgofTables().empty()) { - const auto& sgofTable = eclState->getSgofTables()[satnumRegionIdx]; + if (!tableManager->getSgofTables().empty()) { + const auto& sgofTable = tableManager->getSgofTables()[satnumRegionIdx]; // convert the saturations of the SGOF keyword from gas to oil saturations std::vector SoSamples(sgofTable.numRows()); @@ -624,8 +629,8 @@ private: effParams.setPcnwSamples(SoSamples, sgofTable.getPcogColumn()); effParams.finalize(); } - else if (!eclState->getSlgofTables().empty()) { - const auto& slgofTable = eclState->getSlgofTables()[satnumRegionIdx]; + else if (!tableManager->getSlgofTables().empty()) { + const auto& slgofTable = tableManager->getSlgofTables()[satnumRegionIdx]; // convert the saturations of the SLGOF keyword from "liquid" to oil saturations std::vector SoSamples(slgofTable.numRows()); @@ -646,8 +651,8 @@ private: case FamilyII: { - const auto& sgfnTable = eclState->getSgfnTables()[satnumRegionIdx]; - const auto& sof3Table = eclState->getSof3Tables()[satnumRegionIdx]; + const auto& sgfnTable = tableManager->getSgfnTables()[satnumRegionIdx]; + const auto& sof3Table = tableManager->getSof3Tables()[satnumRegionIdx]; // convert the saturations of the SGFN keyword from gas to oil saturations std::vector SoSamples(sgfnTable.numRows()); @@ -676,10 +681,11 @@ private: { dest[satnumRegionIdx] = std::make_shared(); + const auto& tableManager = eclState->getTableManager(); auto& effParams = *dest[satnumRegionIdx]; switch (getSaturationFunctionFamily(eclState)) { case FamilyI: { - const auto& swofTable = eclState->getSwofTables()[satnumRegionIdx]; + const auto& swofTable = tableManager->getSwofTables()[satnumRegionIdx]; const auto &SwColumn = swofTable.getSwColumn(); effParams.setKrwSamples(SwColumn, swofTable.getKrwColumn()); @@ -690,8 +696,8 @@ private: } case FamilyII: { - const auto& swfnTable = eclState->getSwfnTables()[satnumRegionIdx]; - const auto& sof3Table = eclState->getSof3Tables()[satnumRegionIdx]; + const auto& swfnTable = tableManager->getSwfnTables()[satnumRegionIdx]; + const auto& sof3Table = tableManager->getSof3Tables()[satnumRegionIdx]; const auto &SwColumn = swfnTable.getSwColumn(); // convert the saturations of the SOF3 keyword from oil to water saturations