diff --git a/opm/core/props/satfunc/RelpermDiagnostics.cpp b/opm/core/props/satfunc/RelpermDiagnostics.cpp index 830badd22..cf79f518b 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics.cpp +++ b/opm/core/props/satfunc/RelpermDiagnostics.cpp @@ -19,9 +19,21 @@ #include #include + #include -#include + +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include namespace Opm{ @@ -609,10 +621,27 @@ namespace Opm{ void RelpermDiagnostics::unscaledEndPointsCheck_(const EclipseState& eclState) { // get the number of saturation regions and the number of cells in the deck - const int numSatRegions = eclState.runspec().tabdims().getNumSatTables(); + const auto& runspec = eclState.runspec(); + const int numSatRegions = runspec.tabdims().getNumSatTables(); + + if (numSatRegions < 1) { + return; + } + unscaledEpsInfo_.resize(numSatRegions); const auto& tables = eclState.getTableManager(); + const auto& phases = runspec.phases(); + const auto tolcrit = runspec.saturationFunctionControls() + .minimumRelpermMobilityThreshold(); + const auto family = runspec.saturationFunctionControls().family(); + + const auto rtepPtr = + satfunc::getRawTableEndpoints(tables, phases, tolcrit); + + const auto rfuncPtr = + satfunc::getRawFunctionValues(tables, phases, *rtepPtr); + const TableContainer& swofTables = tables.getSwofTables(); const TableContainer& sgofTables = tables.getSgofTables(); const TableContainer& slgofTables = tables.getSlgofTables(); @@ -620,7 +649,9 @@ namespace Opm{ // std::cout << "***************\nEnd-Points In all the Tables\n"; for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) { - unscaledEpsInfo_[satnumIdx].extractUnscaled(eclState, satnumIdx); + this->unscaledEpsInfo_[satnumIdx] + .extractUnscaled(*rtepPtr, *rfuncPtr, family, satnumIdx); + const std::string regionIdx = std::to_string(satnumIdx + 1); ///Consistency check. if (unscaledEpsInfo_[satnumIdx].Sgu > (1. - unscaledEpsInfo_[satnumIdx].Swl)) { diff --git a/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp b/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp index f4f602a45..fc3c36a6b 100644 --- a/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp +++ b/opm/core/props/satfunc/RelpermDiagnostics_impl.hpp @@ -62,10 +62,10 @@ namespace Opm { std::string cellIdx; { std::array ijk; - const int cartIdx = compressedToCartesianIdx[c]; - ijk[0] = cartIdx % dims[0]; - ijk[1] = (cartIdx / dims[0]) % dims[1]; - ijk[2] = cartIdx / dims[0] / dims[1]; + int cartIdx = compressedToCartesianIdx[c]; + ijk[0] = cartIdx % dims[0]; cartIdx /= dims[0]; + ijk[1] = cartIdx % dims[1]; + ijk[2] = cartIdx / dims[1]; cellIdx = "(" + std::to_string(ijk[0]) + ", " + std::to_string(ijk[1]) + ", " + std::to_string(ijk[2]) + ")";