Fixed special initialisation of PLYROCK tables.

This commit is contained in:
Joakim Hove
2015-09-17 18:47:21 +02:00
parent d15b472704
commit a44733405d
4 changed files with 72 additions and 36 deletions

View File

@@ -30,36 +30,21 @@ namespace Opm {
friend class TableManager;
PlyrockTable() = default;
/*!
* \brief Read the PLYROCK keyword and provide some convenience
* methods for it.
*/
void init(Opm::DeckItemConstPtr item)
{
SimpleTable::init(item,
std::vector<std::string>{
"DeadPoreVolume",
"ResidualResistanceFactor",
"RockDensityFactor",
"AdsorbtionIndex",
"MaxAdsorbtion"
});
// the entries of this keyword cannot be defaulted except for the
// forth. ensure this.
int nRows = numRows();
int nCols = numColumns();
for (int rowIdx = 0; rowIdx < nRows; ++rowIdx) {
for (int colIdx = 0; colIdx < nCols; ++colIdx) {
if (m_valueDefaulted[colIdx][rowIdx]) {
if (colIdx == 3) {
m_valueDefaulted[colIdx][rowIdx] = false;
m_columns[colIdx][rowIdx] = 1.0;
}
else
throw std::invalid_argument("The values of the PLYROCK table cannot be defaulted");
}
}
void init(Opm::DeckRecordConstPtr record)
{
createColumns(std::vector<std::string>{
"DeadPoreVolume",
"ResidualResistanceFactor",
"RockDensityFactor",
"AdsorbtionIndex",
"MaxAdsorbtion"
});
for (size_t colIdx = 0; colIdx < record->size(); colIdx++) {
auto item = record->getItem( colIdx );
m_columns[colIdx].push_back( item->getSIDouble(0) );
m_valueDefaulted[colIdx].push_back( item->defaultApplied(0) );
}
}

View File

@@ -39,7 +39,6 @@ namespace Opm {
initSimpleTables(deck, "PVDS", m_pvdsTables);
initSimpleTables(deck, "PLYADS", m_plyadsTables);
initSimpleTables(deck, "PLYMAX", m_plymaxTables);
initSimpleTables(deck, "PLYROCK", m_plyrockTables);
initSimpleTables(deck, "PLYVISC", m_plyviscTables);
initSimpleTables(deck, "PLYDHFLF", m_plydhflfTables);
initSimpleTables(deck, "OILVISCT", m_oilvisctTables);
@@ -51,6 +50,7 @@ namespace Opm {
initSimpleTables(deck, "RSVD", m_rsvdTables);
initSimpleTables(deck, "RVVD", m_rvvdTables);
initPlyrockTables(deck, "PLYROCK", m_plyrockTables);
initPlyshlogTables(deck, "PLYSHLOG", m_plyshlogTables);
initRocktabTables(deck);
initRTempTables(deck);
@@ -160,6 +160,27 @@ namespace Opm {
}
void TableManager::initPlyrockTables(const Deck& deck,
const std::string& keywordName,
std::vector<PlyrockTable>& tableVector){
if (!deck.hasKeyword(keywordName)) {
return;
}
if (!deck.numKeywords(keywordName)) {
complainAboutAmbiguousKeyword(deck, keywordName);
return;
}
const auto& keyword = deck.getKeyword(keywordName);
for( auto iter = keyword->begin(); iter != keyword->end(); ++iter) {
auto record = *iter;
tableVector.push_back( PlyrockTable() );
tableVector.back().init( record );
}
}
void TableManager::initRocktabTables(const Deck& deck) {

View File

@@ -111,10 +111,6 @@ namespace Opm {
const std::string& keywordName,
std::vector<GasvisctTable>& tableVector);
void initPlyshlogTables(const Deck& deck,
const std::string& keywordName,
std::vector<PlyshlogTable>& tableVector);
void initVFPProdTables(const Deck& deck,
std::map<int, VFPProdTable>& tableMap);
@@ -123,6 +119,15 @@ namespace Opm {
std::map<int, VFPInjTable>& tableMap);
void initPlyrockTables(const Deck& deck,
const std::string& keywordName,
std::vector<PlyrockTable>& tableVector);
void initPlyshlogTables(const Deck& deck,
const std::string& keywordName,
std::vector<PlyshlogTable>& tableVector);
template <class TableType>
void initSimpleTables(const Deck& deck,
const std::string& keywordName,

View File

@@ -35,6 +35,7 @@
// keyword specific table classes
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlyrockTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SwofTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SgofTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlyadsTable.hpp>
@@ -1066,8 +1067,32 @@ VFPINJ \n\
}
BOOST_AUTO_TEST_CASE( TestPLYROCK ) {
const char *data =
"TABDIMS\n"
" 2 /\n"
"\n"
"PLYROCK\n"
" 1 2 3 4 5 /\n"
" 10 20 30 40 50 /\n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(data, Opm::ParseMode()));
Opm::TableManager tables( *deck );
const std::vector<Opm::PlyrockTable>& plyrock = tables.getPlyrockTables();
BOOST_CHECK_EQUAL( plyrock.size() , 2 ) ;
const Opm::PlyrockTable& table0 = plyrock[0];
const Opm::PlyrockTable& table1 = plyrock[1];
BOOST_CHECK_EQUAL( table0.numColumns() , 5 );
BOOST_CHECK_EQUAL( table0.getDeadPoreVolumeColumn()[0] , 1.0 );
BOOST_CHECK_EQUAL( table0.getMaxAdsorbtionColumn()[0] , 5.0 );
BOOST_CHECK_EQUAL( table1.numColumns() , 5 );
BOOST_CHECK_EQUAL( table1.getDeadPoreVolumeColumn()[0] , 10.0 );
BOOST_CHECK_EQUAL( table1.getMaxAdsorbtionColumn()[0] , 50.0 );
}