add a grid property for TEMPI

by default it is initialized using the temperature vs depth table...
This commit is contained in:
Andreas Lauser 2014-12-01 18:34:24 +01:00
parent 9ab4897587
commit ad7f915a3e
2 changed files with 50 additions and 0 deletions

View File

@ -537,6 +537,7 @@ namespace Opm {
double nan = std::numeric_limits<double>::quiet_NaN();
const auto eptLookup = std::make_shared<GridPropertyEndpointTableLookupInitializer<>>(*deck, *this);
const auto tempLookup = std::make_shared<GridPropertyTemperatureLookupInitializer<>>(*deck, *this);
const auto distributeTopLayer = std::make_shared<const GridPropertyPostProcessor::DistributeTopLayer>(*this);
const auto initPORV = std::make_shared<GridPropertyPostProcessor::InitPORV>(*this);
@ -678,6 +679,9 @@ namespace Opm {
SupportedDoubleKeywordInfo( "ISWCRZ" , eptLookup, "1" ),
SupportedDoubleKeywordInfo( "ISWCRZ-" , eptLookup, "1" ),
// cell temperature (E300 only, but makes a lot of sense for E100, too)
SupportedDoubleKeywordInfo( "TEMPI" , tempLookup, "Temperature" ),
// porosity
SupportedDoubleKeywordInfo( "PORO" , nan, distributeTopLayer , "1" ),

View File

@ -21,6 +21,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/SwofTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SgofTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp>
#include <vector>
#include <string>
@ -349,6 +350,51 @@ private:
const Deck& m_deck;
const EclipseState& m_eclipseState;
};
// initialize the TEMPI grid property using the temperature vs depth
// table (stemming from the TEMPVD or the RTEMPVD keyword)
template <class EclipseState=Opm::EclipseState,
class Deck=Opm::Deck>
class GridPropertyTemperatureLookupInitializer
: public GridPropertyBaseInitializer<double>
{
public:
GridPropertyTemperatureLookupInitializer(const Deck& deck, const EclipseState& eclipseState)
: m_deck(deck)
, m_eclipseState(eclipseState)
{ }
void apply(std::vector<double>& values,
const std::string& propertyName) 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...
double nan = std::numeric_limits<double>::quiet_NaN();
std::fill(values.begin(), values.end(), nan);
return;
}
auto eclipseGrid = m_eclipseState.getEclipseGrid();
const std::vector<RtempvdTable>& rtempvdTables = m_eclipseState.getRtempvdTables();
const std::vector<int>& eqlNum = m_eclipseState.getIntGridProperty("EQLNUM")->getData();
for (int cellIdx = 0; cellIdx < eqlNum.size(); ++ cellIdx) {
int cellEquilNum = eqlNum[cellIdx];
const RtempvdTable& rtempvdTable = rtempvdTables[cellEquilNum];
double cellDepth = std::get<2>(eclipseGrid->getCellCenter(cellIdx));
values[cellIdx] = rtempvdTable.evaluate("Temperature", cellDepth);
}
}
private:
const Deck& m_deck;
const EclipseState& m_eclipseState;
};
}
#endif