Fixed bug in PLYMAX table.
This commit is contained in:
@@ -34,11 +34,14 @@ namespace Opm {
|
||||
* \brief Read the PLYMAX keyword and provide some convenience
|
||||
* methods for it.
|
||||
*/
|
||||
void init(Opm::DeckItemConstPtr item)
|
||||
void init(Opm::DeckRecordConstPtr record)
|
||||
{
|
||||
SimpleTable::init(item,
|
||||
std::vector<std::string>{"C_POLYMER", "C_POLYMER_MAX"});
|
||||
|
||||
createColumns(std::vector<std::string>{"C_POLYMER", "C_POLYMER_MAX"});
|
||||
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) );
|
||||
}
|
||||
SimpleTable::checkNonDefaultable("C_POLYMER");
|
||||
SimpleTable::checkMonotonic("C_POLYMER", /*isAscending=*/false);
|
||||
SimpleTable::checkNonDefaultable("C_POLYMER_MAX");
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace Opm {
|
||||
initSimpleTables(deck, "SSFN", m_ssfnTables);
|
||||
initSimpleTables(deck, "PVDS", m_pvdsTables);
|
||||
initSimpleTables(deck, "PLYADS", m_plyadsTables);
|
||||
initSimpleTables(deck, "PLYMAX", m_plymaxTables);
|
||||
initSimpleTables(deck, "PLYVISC", m_plyviscTables);
|
||||
initSimpleTables(deck, "PLYDHFLF", m_plydhflfTables);
|
||||
initSimpleTables(deck, "OILVISCT", m_oilvisctTables);
|
||||
@@ -50,6 +49,7 @@ namespace Opm {
|
||||
initSimpleTables(deck, "RSVD", m_rsvdTables);
|
||||
initSimpleTables(deck, "RVVD", m_rvvdTables);
|
||||
|
||||
initPlymaxTables(deck , "PLYMAX" , m_plymaxTables);
|
||||
initPlyrockTables(deck, "PLYROCK", m_plyrockTables);
|
||||
initPlyshlogTables(deck, "PLYSHLOG", m_plyshlogTables);
|
||||
initRocktabTables(deck);
|
||||
@@ -182,6 +182,28 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
void TableManager::initPlymaxTables(const Deck& deck,
|
||||
const std::string& keywordName,
|
||||
std::vector<PlymaxTable>& 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( PlymaxTable() );
|
||||
tableVector.back().init( record );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TableManager::initRocktabTables(const Deck& deck) {
|
||||
if (!deck.hasKeyword("ROCKTAB"))
|
||||
|
||||
@@ -119,6 +119,10 @@ namespace Opm {
|
||||
std::map<int, VFPInjTable>& tableMap);
|
||||
|
||||
|
||||
void initPlymaxTables(const Deck& deck,
|
||||
const std::string& keywordName,
|
||||
std::vector<PlymaxTable>& tableVector);
|
||||
|
||||
void initPlyrockTables(const Deck& deck,
|
||||
const std::string& keywordName,
|
||||
std::vector<PlyrockTable>& tableVector);
|
||||
|
||||
@@ -1095,4 +1095,32 @@ BOOST_AUTO_TEST_CASE( TestPLYROCK ) {
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( TestPLYMAX ) {
|
||||
const char *data =
|
||||
"REGDIMS\n"
|
||||
" 9* 2 /\n"
|
||||
"\n"
|
||||
"PLYMAX\n"
|
||||
" 1 2 /\n"
|
||||
" 10 20 /\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(data, Opm::ParseMode()));
|
||||
Opm::TableManager tables( *deck );
|
||||
const std::vector<Opm::PlymaxTable>& plymax = tables.getPlymaxTables();
|
||||
|
||||
BOOST_CHECK_EQUAL( plymax.size() , 2 ) ;
|
||||
const Opm::PlymaxTable& table0 = plymax[0];
|
||||
const Opm::PlymaxTable& table1 = plymax[1];
|
||||
|
||||
BOOST_CHECK_EQUAL( table0.numColumns() , 2 );
|
||||
BOOST_CHECK_EQUAL( table0.getPolymerConcentrationColumn()[0] , 1.0 );
|
||||
BOOST_CHECK_EQUAL( table0.getMaxPolymerConcentrationColumn()[0] , 2.0 );
|
||||
|
||||
BOOST_CHECK_EQUAL( table1.numColumns() , 2 );
|
||||
BOOST_CHECK_EQUAL( table1.getPolymerConcentrationColumn()[0] , 10.0 );
|
||||
BOOST_CHECK_EQUAL( table1.getMaxPolymerConcentrationColumn()[0] , 20.0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user