From 2947336982230cdcaba7f69de3dfeab8cb681115 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 31 Mar 2015 12:18:13 +0200 Subject: [PATCH] Added derived iniitializer classes SWL and ISWL --- .../eclipse/EclipseState/EclipseState.cpp | 32 ++--- .../Grid/SatfuncPropertyInitializers.hpp | 109 +++++++++++++++--- 2 files changed, 113 insertions(+), 28 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/EclipseState.cpp b/opm/parser/eclipse/EclipseState/EclipseState.cpp index 1c25c388d..99412e838 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -724,8 +724,12 @@ namespace Opm { double nan = std::numeric_limits::quiet_NaN(); const auto eptLookup = std::make_shared>(*deck, *this); + const auto SGLLookup = std::make_shared>(*deck, *this); const auto ISGLLookup = std::make_shared>(*deck, *this); + const auto SWLLookup = std::make_shared>(*deck, *this); + const auto ISWLLookup = std::make_shared>(*deck, *this); + const auto tempLookup = std::make_shared>(*deck, *this); const auto distributeTopLayer = std::make_shared(*this); const auto initPORV = std::make_shared(*this); @@ -753,20 +757,20 @@ namespace Opm { SupportedDoubleKeywordInfo( "ISGLZ-" , ISGLLookup, "1" ), // keywords to specify the connate water saturation. - SupportedDoubleKeywordInfo( "SWL" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "ISWL" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "SWLX" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "SWLX-" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "ISWLX" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "ISWLX-" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "SWLY" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "SWLY-" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "ISWLY" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "ISWLY-" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "SWLZ" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "SWLZ-" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "ISWLZ" , eptLookup, "1" ), - SupportedDoubleKeywordInfo( "ISWLZ-" , eptLookup, "1" ), + SupportedDoubleKeywordInfo( "SWL" , SWLLookup, "1" ), + SupportedDoubleKeywordInfo( "SWLX" , SWLLookup, "1" ), + SupportedDoubleKeywordInfo( "SWLX-" , SWLLookup, "1" ), + SupportedDoubleKeywordInfo( "SWLY" , SWLLookup, "1" ), + SupportedDoubleKeywordInfo( "SWLY-" , SWLLookup, "1" ), + SupportedDoubleKeywordInfo( "SWLZ" , SWLLookup, "1" ), + SupportedDoubleKeywordInfo( "SWLZ-" , SWLLookup, "1" ), + SupportedDoubleKeywordInfo( "ISWL" , ISWLLookup, "1" ), + SupportedDoubleKeywordInfo( "ISWLX" , ISWLLookup, "1" ), + SupportedDoubleKeywordInfo( "ISWLX-" , ISWLLookup, "1" ), + SupportedDoubleKeywordInfo( "ISWLY" , ISWLLookup, "1" ), + SupportedDoubleKeywordInfo( "ISWLY-" , ISWLLookup, "1" ), + SupportedDoubleKeywordInfo( "ISWLZ" , ISWLLookup, "1" ), + SupportedDoubleKeywordInfo( "ISWLZ-" , ISWLLookup, "1" ), // keywords to specify the maximum gas saturation. SupportedDoubleKeywordInfo( "SGU" , eptLookup, "1" ), diff --git a/opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp b/opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp index 1b04b22a8..0c59143f5 100644 --- a/opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp +++ b/opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp @@ -98,22 +98,9 @@ public: assert(0 <= satTableIdx && satTableIdx < numSatTables); assert(0 <= imbTableIdx && imbTableIdx < numSatTables); - // the SWL keyword family - if (propertyName.find("SWL") == 0) - values[cellIdx] = selectValue(enptvdTables, - (useEnptvd && endNum >= 0) ? endNum : -1, - "SWCO", - cellDepth, - m_minWaterSat[satTableIdx]); - else if (propertyName.find("ISWL") == 0) - values[cellIdx] = selectValue(imptvdTables, - (useImptvd && endNum >= 0) ? endNum : -1, - "SWCO", - cellDepth, - m_minWaterSat[imbTableIdx]); // the SGU keyword family - else if (propertyName.find("SGU") == 0) + if (propertyName.find("SGU") == 0) values[cellIdx] = selectValue(enptvdTables, (useEnptvd && endNum >= 0) ? endNum : -1, "SGMAX", @@ -440,6 +427,100 @@ public: } } }; + + +template +class SWLEndpointInitializer + : public EndpointInitializer +{ +public: + SWLEndpointInitializer(const Deck& deck, const EclipseState& eclipseState) + : EndpointInitializer( deck , eclipseState ) + { } + + void apply(std::vector& values, + const std::string& /* propertyname */ ) const + { + auto eclipseGrid = this->m_eclipseState.getEclipseGrid(); + auto tabdims = this->m_eclipseState.getTabdims(); + auto satnum = this->m_eclipseState.getIntGridProperty("SATNUM"); + auto endnum = this->m_eclipseState.getIntGridProperty("ENDNUM"); + int numSatTables = tabdims->getNumSatTables(); + + + satnum->checkLimits(1 , numSatTables); + this->findSaturationEndpoints( ); + + // acctually assign the defaults. if the ENPVD keyword was specified in the deck, + // this currently cannot be done because we would need the Z-coordinate of the + // cell and we would need to know how the simulator wants to interpolate between + // sampling points. Both of these are outside the scope of opm-parser, so we just + // assign a NaN in this case... + bool useEnptvd = this->m_deck.hasKeyword("ENPTVD"); + const auto& enptvdTables = this->m_eclipseState.getEnptvdTables(); + for (size_t cellIdx = 0; cellIdx < eclipseGrid->getCartesianSize(); cellIdx++) { + int satTableIdx = satnum->iget( cellIdx ) - 1; + int endNum = endnum->iget( cellIdx ) - 1; + double cellDepth = std::get<2>(eclipseGrid->getCellCenter(cellIdx)); + + + values[cellIdx] = selectValue(enptvdTables, + (useEnptvd && endNum >= 0) ? endNum : -1, + "SWCO", + cellDepth, + this->m_minWaterSat[satTableIdx]); + } + } +}; + + + +template +class ISWLEndpointInitializer + : public EndpointInitializer +{ +public: + ISWLEndpointInitializer(const Deck& deck, const EclipseState& eclipseState) + : EndpointInitializer( deck , eclipseState ) + { } + + void apply(std::vector& values, + const std::string& /* propertyname */ ) const + { + auto eclipseGrid = this->m_eclipseState.getEclipseGrid(); + auto tabdims = this->m_eclipseState.getTabdims(); + auto imbnum = this->m_eclipseState.getIntGridProperty("IMBNUM"); + auto endnum = this->m_eclipseState.getIntGridProperty("ENDNUM"); + int numSatTables = tabdims->getNumSatTables(); + + imbnum->checkLimits(1 , numSatTables); + this->findSaturationEndpoints( ); + + // acctually assign the defaults. if the ENPVD keyword was specified in the deck, + // this currently cannot be done because we would need the Z-coordinate of the + // cell and we would need to know how the simulator wants to interpolate between + // sampling points. Both of these are outside the scope of opm-parser, so we just + // assign a NaN in this case... + bool useImptvd = this->m_deck.hasKeyword("IMPTVD"); + const auto& imptvdTables = this->m_eclipseState.getImptvdTables(); + for (size_t cellIdx = 0; cellIdx < eclipseGrid->getCartesianSize(); cellIdx++) { + int imbTableIdx = imbnum->iget( cellIdx ) - 1; + int endNum = endnum->iget( cellIdx ) - 1; + double cellDepth = std::get<2>(eclipseGrid->getCellCenter(cellIdx)); + + values[cellIdx] = selectValue(imptvdTables, + (useImptvd && endNum >= 0) ? endNum : -1, + "SWCO", + cellDepth, + this->m_minWaterSat[imbTableIdx]); + } + } +}; + + + } #endif