Created classes for all the endpoint initializers.

This commit is contained in:
Joakim Hove
2015-04-06 20:54:22 +02:00
parent 121ec9320b
commit 10facf19b3
5 changed files with 371 additions and 363 deletions

View File

@@ -292,6 +292,7 @@ namespace Opm {
ntpvt = record->getItem("NTPVT")->getInt(0);
nssfun = record->getItem("NSSFUN")->getInt(0);
nppvt = record->getItem("NPPVT")->getInt(0);
ntfip = record->getItem("NTFIP")->getInt(0);
nrpvt = record->getItem("NRPVT")->getInt(0);
}
m_tabdims = std::make_shared<Tabdims>(ntsfun , ntpvt , nssfun , nppvt , ntfip , nrpvt);
@@ -723,14 +724,24 @@ namespace Opm {
});
double nan = std::numeric_limits<double>::quiet_NaN();
const auto eptLookup = std::make_shared<EndpointInitializer<>>(*deck, *this);
const auto SGLLookup = std::make_shared<SGLEndpointInitializer<>>(*deck, *this);
const auto ISGLLookup = std::make_shared<ISGLEndpointInitializer<>>(*deck, *this);
const auto SWLLookup = std::make_shared<SWLEndpointInitializer<>>(*deck, *this);
const auto ISWLLookup = std::make_shared<ISWLEndpointInitializer<>>(*deck, *this);
const auto SGULookup = std::make_shared<SGUEndpointInitializer<>>(*deck, *this);
const auto ISGULookup = std::make_shared<ISGUEndpointInitializer<>>(*deck, *this);
const auto SWULookup = std::make_shared<SWUEndpointInitializer<>>(*deck, *this);
const auto ISWULookup = std::make_shared<ISWUEndpointInitializer<>>(*deck, *this);
const auto SGCRLookup = std::make_shared<SGCREndpointInitializer<>>(*deck, *this);
const auto ISGCRLookup = std::make_shared<ISGCREndpointInitializer<>>(*deck, *this);
const auto SOWCRLookup = std::make_shared<SOWCREndpointInitializer<>>(*deck, *this);
const auto ISOWCRLookup = std::make_shared<ISOWCREndpointInitializer<>>(*deck, *this);
const auto SOGCRLookup = std::make_shared<SOGCREndpointInitializer<>>(*deck, *this);
const auto ISOGCRLookup = std::make_shared<ISOGCREndpointInitializer<>>(*deck, *this);
const auto SWCRLookup = std::make_shared<SWCREndpointInitializer<>>(*deck, *this);
const auto ISWCRLookup = std::make_shared<ISWCREndpointInitializer<>>(*deck, *this);
const auto tempLookup = std::make_shared<GridPropertyTemperatureLookupInitializer<>>(*deck, *this);
@@ -792,88 +803,88 @@ namespace Opm {
SupportedDoubleKeywordInfo( "ISGUZ-" , ISGULookup, "1" ),
// keywords to specify the maximum water saturation.
SupportedDoubleKeywordInfo( "SWU" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWU" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWUX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWUX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWUY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWUY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWUZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWUZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWU" , SWULookup, "1" ),
SupportedDoubleKeywordInfo( "SWUX" , SWULookup, "1" ),
SupportedDoubleKeywordInfo( "SWUX-" , SWULookup, "1" ),
SupportedDoubleKeywordInfo( "SWUY" , SWULookup, "1" ),
SupportedDoubleKeywordInfo( "SWUY-" , SWULookup, "1" ),
SupportedDoubleKeywordInfo( "SWUZ" , SWULookup, "1" ),
SupportedDoubleKeywordInfo( "SWUZ-" , SWULookup, "1" ),
SupportedDoubleKeywordInfo( "ISWU" , ISWULookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUX" , ISWULookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUX-" , ISWULookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUY" , ISWULookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUY-" , ISWULookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUZ" , ISWULookup, "1" ),
SupportedDoubleKeywordInfo( "ISWUZ-" , ISWULookup, "1" ),
// keywords to specify the scaled critical gas
// saturation.
SupportedDoubleKeywordInfo( "SGCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCR" , SGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRX" , SGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRX-" , SGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRY" , SGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRY-" , SGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRZ" , SGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SGCRZ-" , SGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCR" , ISGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRX" , ISGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRX-" , ISGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRY" , ISGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRY-" , ISGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRZ" , ISGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISGCRZ-" , ISGCRLookup, "1" ),
// keywords to specify the scaled critical oil-in-water
// saturation.
SupportedDoubleKeywordInfo( "SOWCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCR" , SOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRX" , SOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRX-" , SOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRY" , SOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRY-" , SOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRZ" , SOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOWCRZ-" , SOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCR" , ISOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRX" , ISOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRX-" , ISOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRY" , ISOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRY-" , ISOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRZ" , ISOWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOWCRZ-" , ISOWCRLookup, "1" ),
// keywords to specify the scaled critical oil-in-gas
// saturation.
SupportedDoubleKeywordInfo( "SOGCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCR" , SOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRX" , SOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRX-" , SOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRY" , SOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRY-" , SOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRZ" , SOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SOGCRZ-" , SOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCR" , ISOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRX" , ISOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRX-" , ISOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRY" , ISOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRY-" , ISOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRZ" , ISOGCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISOGCRZ-" , ISOGCRLookup, "1" ),
// keywords to specify the scaled critical water
// saturation.
SupportedDoubleKeywordInfo( "SWCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCR" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRX" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRX-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRY" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRY-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRZ-" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCR" , SWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRX" , SWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRX-" , SWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRY" , SWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRY-" , SWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRZ" , SWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "SWCRZ-" , SWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCR" , ISWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRX" , ISWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRX-" , ISWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRY" , ISWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRY-" , ISWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRZ" , ISWCRLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRZ-" , ISWCRLookup, "1" ),
// cell temperature (E300 only, but makes a lot of sense for E100, too)
SupportedDoubleKeywordInfo( "TEMPI" , tempLookup, "Temperature" ),

View File

@@ -160,7 +160,7 @@ public:
m_kwInfo = kwInfo;
m_data.resize( nx * ny * nz );
m_kwInfo.getInitializer()->apply(m_data, m_kwInfo.getKeywordName());
m_kwInfo.getInitializer()->apply(m_data);
m_hasRunPostProcessor = false;
}

View File

@@ -54,8 +54,7 @@ protected:
{ }
public:
virtual void apply(std::vector<ValueType>& values,
const std::string& propertyName) const = 0;
virtual void apply(std::vector<ValueType>& values) const = 0;
};
template <class ValueType>
@@ -67,8 +66,7 @@ public:
: m_value(value)
{ }
void apply(std::vector<ValueType>& values,
const std::string& /*propertyName*/) const
void apply(std::vector<ValueType>& values) const
{
std::fill(values.begin(), values.end(), m_value);
}
@@ -94,12 +92,8 @@ public:
, m_eclipseState(eclipseState)
{ }
void apply(std::vector<double>& values,
const std::string& propertyName) const
void apply(std::vector<double>& values) const
{
if (propertyName != "TEMPI")
throw std::logic_error("The TemperatureLookupInitializer can only be used for the initial temperature!");
if (!m_deck.hasKeyword("EQLNUM")) {
// if values are defaulted in the TEMPI keyword, but no
// EQLNUM is specified, you will get NaNs...

View File

@@ -62,118 +62,6 @@ public:
*/
void apply(std::vector<double>& values,
const std::string& propertyName) const
{
auto eclipseGrid = m_eclipseState.getEclipseGrid();
auto tabdims = m_eclipseState.getTabdims();
int numSatTables = tabdims->getNumSatTables();
const std::vector<int>& satnumData = m_eclipseState.getIntGridProperty("SATNUM")->getData();
const std::vector<int>& imbnumData = m_eclipseState.getIntGridProperty("IMBNUM")->getData();
const std::vector<int>& endnumData = m_eclipseState.getIntGridProperty("ENDNUM")->getData();
assert(satnumData.size() == values.size());
assert(imbnumData.size() == values.size());
findSaturationEndpoints( );
findCriticalPoints( );
// 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 = m_deck.hasKeyword("ENPTVD");
bool useImptvd = m_deck.hasKeyword("IMPTVD");
const auto& enptvdTables = m_eclipseState.getEnptvdTables();
const auto& imptvdTables = m_eclipseState.getImptvdTables();
for (size_t cellIdx = 0; cellIdx < satnumData.size(); ++cellIdx) {
int satTableIdx = satnumData[cellIdx] - 1;
int imbTableIdx = imbnumData[cellIdx] - 1;
int endNum = endnumData[cellIdx] - 1;
double cellDepth = std::get<2>(eclipseGrid->getCellCenter(cellIdx));
assert(0 <= satTableIdx && satTableIdx < numSatTables);
assert(0 <= imbTableIdx && imbTableIdx < numSatTables);
// the SWU keyword family
if (propertyName.find("SWU") == 0)
values[cellIdx] = selectValue(enptvdTables,
(useEnptvd && endNum >= 0) ? endNum : -1,
"SWMAX",
cellDepth,
m_maxWaterSat[satTableIdx],
/*useOneMinusTableValue=*/true);
else if (propertyName.find("ISWU") == 0)
values[cellIdx] = selectValue(imptvdTables,
(useEnptvd && endNum >= 0) ? endNum : -1,
"SWMAX",
cellDepth,
m_maxWaterSat[imbTableIdx],
/*useOneMinusTableValue=*/true);
// the SGCR keyword family
else if (propertyName.find("SGCR") == 0)
values[cellIdx] = selectValue(enptvdTables,
(useEnptvd && endNum >= 0) ? endNum : -1,
"SGCRIT",
cellDepth,
m_criticalGasSat[satTableIdx]);
else if (propertyName.find("ISGCR") == 0)
values[cellIdx] = selectValue(imptvdTables,
(useImptvd && endNum >= 0) ? endNum : -1,
"SGCRIT",
cellDepth,
m_criticalGasSat[imbTableIdx]);
// the SWCR keyword family
else if (propertyName.find("SWCR") == 0)
values[cellIdx] = selectValue(enptvdTables,
(useEnptvd && endNum >= 0) ? endNum : -1,
"SWCRIT",
cellDepth,
m_criticalWaterSat[satTableIdx]);
else if (propertyName.find("ISWCR") == 0)
values[cellIdx] = selectValue(imptvdTables,
(useImptvd && endNum >= 0) ? endNum : -1,
"SWCRIT",
cellDepth,
m_criticalWaterSat[imbTableIdx]);
// the SOGCR keyword family
else if (propertyName.find("SOGCR") == 0)
values[cellIdx] = selectValue(enptvdTables,
(useEnptvd && endNum >= 0) ? endNum : -1,
"SOGCRIT",
cellDepth,
m_criticalOilOGSat[satTableIdx]);
else if (propertyName.find("ISOGCR") == 0)
values[cellIdx] = selectValue(imptvdTables,
(useImptvd && endNum >= 0) ? endNum : -1,
"SOGCRIT",
cellDepth,
m_criticalOilOGSat[imbTableIdx]);
// the SOWCR keyword family
else if (propertyName.find("SOWCR") == 0)
values[cellIdx] = selectValue(enptvdTables,
(useEnptvd && endNum >= 0) ? endNum : -1,
"SOWCRIT",
cellDepth,
m_criticalOilOWSat[satTableIdx]);
else if (propertyName.find("ISOWCR") == 0)
values[cellIdx] = selectValue(imptvdTables,
(useImptvd && endNum >= 0) ? endNum : -1,
"SOWCRIT",
cellDepth,
m_criticalOilOWSat[imbTableIdx]);
}
}
protected:
/*
@@ -286,7 +174,7 @@ protected:
const std::string& columnName,
double cellDepth,
double fallbackValue,
bool useOneMinusTableValue = false) const {
bool useOneMinusTableValue) const {
double value = fallbackValue;
if (tableIdx >= 0) {
@@ -322,21 +210,23 @@ protected:
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SGLEndpointInitializer
class SatnumEndpointInitializer
: public EndpointInitializer<EclipseState,Deck>
{
public:
SGLEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
SatnumEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: EndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values,
const std::string& /* propertyname */ ) const
void apply(std::vector<double>& ) const = 0;
void SatnumApply( std::vector<double>& values,
const std::string& columnName,
const std::vector<double>& fallbackValues,
bool useOneMinusTableValue) const
{
auto eclipseGrid = this->m_eclipseState.getEclipseGrid();
auto tabdims = this->m_eclipseState.getTabdims();
@@ -347,7 +237,7 @@ public:
satnum->checkLimits(1 , numSatTables);
this->findSaturationEndpoints( );
this->findCriticalPoints( );
// 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
@@ -363,100 +253,116 @@ public:
values[cellIdx] = selectValue(enptvdTables,
(useEnptvd && endNum >= 0) ? endNum : -1,
"SGCO",
columnName ,
cellDepth,
this->m_minGasSat[satTableIdx]);
fallbackValues[satTableIdx],
useOneMinusTableValue);
}
}
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ImbnumEndpointInitializer
: public EndpointInitializer<EclipseState,Deck>
{
public:
ImbnumEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: EndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& ) const = 0;
void ImbnumApply( std::vector<double>& values,
const std::string& columnName,
const std::vector<double>& fallBackValues ,
bool useOneMinusTableValue) 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( );
this->findCriticalPoints( );
// 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,
columnName,
cellDepth,
fallBackValues[imbTableIdx],
useOneMinusTableValue);
}
}
};
/*****************************************************************/
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SGLEndpointInitializer
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SGLEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
SatnumApply(values , "SGCO" , this->m_minGasSat , false);
}
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISGLEndpointInitializer
: public EndpointInitializer<EclipseState,Deck>
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISGLEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: EndpointInitializer<EclipseState,Deck>( deck , eclipseState )
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values,
const std::string& /* propertyname */ ) const
void apply(std::vector<double>& values) 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,
"SGCO",
cellDepth,
this->m_minGasSat[imbTableIdx]);
}
ImbnumApply(values , "SGCO" , this->m_minGasSat , false);
}
};
/*****************************************************************/
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SGUEndpointInitializer
: public EndpointInitializer<EclipseState,Deck>
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SGUEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: EndpointInitializer<EclipseState,Deck>( deck , eclipseState )
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values,
const std::string& /* propertyname */ ) const
void apply(std::vector<double>& values) 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,
"SGMAX",
cellDepth,
this->m_maxGasSat[satTableIdx]);
}
SatnumApply(values , "SGMAX" , this->m_maxGasSat, false);
}
};
@@ -464,90 +370,34 @@ public:
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISGUEndpointInitializer
: public EndpointInitializer<EclipseState,Deck>
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISGUEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: EndpointInitializer<EclipseState,Deck>( deck , eclipseState )
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values,
const std::string& /* propertyname */ ) const
void apply(std::vector<double>& values) 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,
"SGMAX",
cellDepth,
this->m_maxGasSat[imbTableIdx]);
}
ImbnumApply(values , "SGMAX" , this->m_maxGasSat , false);
}
};
/*****************************************************************/
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SWLEndpointInitializer
: public EndpointInitializer<EclipseState,Deck>
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SWLEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: EndpointInitializer<EclipseState,Deck>( deck , eclipseState )
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values,
const std::string& /* propertyname */ ) const
void apply(std::vector<double>& values) 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]);
}
SatnumApply(values , "SWCO" , this->m_minWaterSat , false);
}
};
@@ -556,48 +406,200 @@ public:
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISWLEndpointInitializer
: public EndpointInitializer<EclipseState,Deck>
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISWLEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: EndpointInitializer<EclipseState,Deck>( deck , eclipseState )
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values,
const std::string& /* propertyname */ ) const
void apply(std::vector<double>& values) 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();
ImbnumApply(values , "SWCO" , this->m_minWaterSat , false);
}
};
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));
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SWUEndpointInitializer
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SWUEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
values[cellIdx] = selectValue(imptvdTables,
(useImptvd && endNum >= 0) ? endNum : -1,
"SWCO",
cellDepth,
this->m_minWaterSat[imbTableIdx]);
}
void apply(std::vector<double>& values) const
{
SatnumApply(values , "SWMAX" , this->m_maxWaterSat , true);
}
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISWUEndpointInitializer
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISWUEndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
ImbnumApply(values , "SWMAX" , this->m_maxWaterSat , true);
}
};
/*****************************************************************/
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SGCREndpointInitializer
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SGCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
SatnumApply(values , "SGCRIT" , this->m_criticalGasSat , false);
}
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISGCREndpointInitializer
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISGCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
ImbnumApply(values , "SGCRIT" , this->m_criticalGasSat , false);
}
};
/*****************************************************************/
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SOWCREndpointInitializer
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SOWCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
SatnumApply(values , "SOWCRIT", this->m_criticalOilOWSat , false);
}
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISOWCREndpointInitializer
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISOWCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
ImbnumApply(values , "SOWCRIT" , this->m_criticalOilOWSat , false);
}
};
/*****************************************************************/
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SOGCREndpointInitializer
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SOGCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
SatnumApply(values , "SOGCRIT" , this->m_criticalOilOGSat , false);
}
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISOGCREndpointInitializer
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISOGCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
ImbnumApply(values , "SOGCRIT" , this->m_criticalOilOGSat , false);
}
};
/*****************************************************************/
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class SWCREndpointInitializer
: public SatnumEndpointInitializer<EclipseState,Deck>
{
public:
SWCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: SatnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
SatnumApply(values , "SWCRIT" , this->m_criticalOilOWSat , false);
}
};
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class ISWCREndpointInitializer
: public ImbnumEndpointInitializer<EclipseState,Deck>
{
public:
ISWCREndpointInitializer(const Deck& deck, const EclipseState& eclipseState)
: ImbnumEndpointInitializer<EclipseState,Deck>( deck , eclipseState )
{ }
void apply(std::vector<double>& values) const
{
ImbnumApply(values , "SWCRIT" , this->m_criticalWaterSat , false);
}
};
}
#endif

View File

@@ -514,12 +514,13 @@ BOOST_AUTO_TEST_CASE(kw_test) {
ERT::EclKW<int> kw1 = p1.getEclKW();
ERT::EclKW<double> kw2 = p2.getEclKW();
for (size_t g = 0; g < kw1.size(); g++)
BOOST_CHECK_EQUAL( p1.iget(g) , kw1[g]);
for (size_t g = 0; g < kw2.size(); g++)
BOOST_CHECK_EQUAL( p2.iget(g) , kw2[g]);
}
BOOST_AUTO_TEST_CASE(CheckLimits) {