Immplemented PLYSHLOG table with TableContainer.
The PLYSHLOG table specification is based on alternating header and data records, this is not supported by th parser - and the thing will throw if more than table is specified.
This commit is contained in:
@@ -27,19 +27,17 @@ namespace Opm {
|
||||
// forward declaration
|
||||
class TableManager;
|
||||
|
||||
class PlyshlogTable {
|
||||
|
||||
class PlyshlogTable : public SimpleTable {
|
||||
public:
|
||||
friend class TableManager;
|
||||
PlyshlogTable() = default;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Read the PLYSHLOG keyword and provide some convenience
|
||||
* methods for it.
|
||||
*/
|
||||
void init(Opm::DeckKeywordConstPtr keyword) {
|
||||
Opm::DeckRecordConstPtr indexRecord = keyword->getRecord(0);
|
||||
Opm::DeckRecordConstPtr dataRecord = keyword->getRecord(1);
|
||||
|
||||
void init(Opm::DeckRecordConstPtr indexRecord, Opm::DeckRecordConstPtr dataRecord) {
|
||||
{
|
||||
const auto item = indexRecord->getItem<ParserKeywords::PLYSHLOG::REF_POLYMER_CONCENTRATION>();
|
||||
setRefPolymerConcentration(item->getRawDouble(0));
|
||||
@@ -63,16 +61,11 @@ namespace Opm {
|
||||
setHasRefTemperature(false);
|
||||
}
|
||||
|
||||
m_data = new SimpleTable();
|
||||
m_data->init(dataRecord->getItem<ParserKeywords::PLYSHLOG::DATA>(),
|
||||
std::vector<std::string>{
|
||||
"WaterVelocity",
|
||||
"ShearMultiplier"
|
||||
});
|
||||
|
||||
m_data->checkNonDefaultable("WaterVelocity");
|
||||
m_data->checkMonotonic("WaterVelocity", /*isAscending=*/true);
|
||||
m_data->checkNonDefaultable("ShearMultiplier");
|
||||
SimpleTable::init( dataRecord->getItem<ParserKeywords::PLYSHLOG::DATA>(),
|
||||
std::vector<std::string>{ "WaterVelocity", "ShearMultiplier" } );
|
||||
SimpleTable::checkNonDefaultable("WaterVelocity");
|
||||
SimpleTable::checkMonotonic("WaterVelocity", /*isAscending=*/true);
|
||||
SimpleTable::checkNonDefaultable("ShearMultiplier");
|
||||
|
||||
}
|
||||
|
||||
@@ -118,10 +111,10 @@ namespace Opm {
|
||||
}
|
||||
|
||||
const std::vector<double> &getWaterVelocityColumn() const
|
||||
{ return m_data->getColumn(0); }
|
||||
{ return getColumn(0); }
|
||||
|
||||
const std::vector<double> &getShearMultiplierColumn() const
|
||||
{ return m_data->getColumn(1); }
|
||||
{ return getColumn(1); }
|
||||
|
||||
|
||||
private:
|
||||
@@ -131,9 +124,6 @@ namespace Opm {
|
||||
|
||||
bool m_hasRefSalinity;
|
||||
bool m_hasRefTemperature;
|
||||
|
||||
SimpleTable *m_data;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -168,9 +168,6 @@ namespace Opm {
|
||||
addTables( "ROCKTAB", numRocktabTables);
|
||||
}
|
||||
|
||||
/*
|
||||
initPlyshlogTables(deck, "PLYSHLOG", m_plyshlogTables);
|
||||
*/
|
||||
initSimpleTableContainer<SwofTable>(deck, "SWOF" , m_tabdims->getNumSatTables());
|
||||
initSimpleTableContainer<SgofTable>(deck, "SGOF" , m_tabdims->getNumSatTables());
|
||||
initSimpleTableContainer<SlgofTable>(deck, "SLGOF" , m_tabdims->getNumSatTables());
|
||||
@@ -210,8 +207,7 @@ namespace Opm {
|
||||
initGasvisctTables(deck);
|
||||
initRTempTables(deck);
|
||||
initRocktabTables(deck);
|
||||
|
||||
initPlyshlogTables(deck, "PLYSHLOG" , m_plyshlogTables);
|
||||
initPlyshlogTables(deck);
|
||||
}
|
||||
|
||||
|
||||
@@ -257,9 +253,8 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
void TableManager::initPlyshlogTables(const Deck& deck,
|
||||
const std::string& keywordName,
|
||||
std::vector<PlyshlogTable>& tableVector){
|
||||
void TableManager::initPlyshlogTables(const Deck& deck) {
|
||||
const std::string keywordName = "PLYSHLOG";
|
||||
|
||||
if (!deck.hasKeyword(keywordName)) {
|
||||
return;
|
||||
@@ -269,13 +264,25 @@ namespace Opm {
|
||||
complainAboutAmbiguousKeyword(deck, keywordName);
|
||||
return;
|
||||
}
|
||||
size_t numTables = m_tabdims->getNumPVTTables();
|
||||
auto& container = forceGetTables(keywordName , numTables);
|
||||
const auto& tableKeyword = deck.getKeyword(keywordName);
|
||||
|
||||
const auto& keyword = deck.getKeyword(keywordName);
|
||||
|
||||
tableVector.push_back(PlyshlogTable());
|
||||
|
||||
tableVector[0].init(keyword);
|
||||
if (tableKeyword->size() > 2) {
|
||||
std::string msg = "The Parser does currently NOT support the alternating record schema used in PLYSHLOG";
|
||||
throw std::invalid_argument( msg );
|
||||
}
|
||||
|
||||
for (size_t tableIdx = 0; tableIdx < tableKeyword->size(); tableIdx += 2) {
|
||||
const auto indexRecord = tableKeyword->getRecord( tableIdx );
|
||||
const auto dataRecord = tableKeyword->getRecord( tableIdx + 1);
|
||||
const auto dataItem = dataRecord->getItem( 0 );
|
||||
if (dataItem->size() > 0) {
|
||||
std::shared_ptr<PlyshlogTable> table = std::make_shared<PlyshlogTable>();
|
||||
table->init(indexRecord , dataRecord);
|
||||
container.addTable( tableIdx , table );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -536,9 +543,8 @@ namespace Opm {
|
||||
return getTables("PLYROCK");
|
||||
}
|
||||
|
||||
|
||||
const std::vector<PlyshlogTable>& TableManager::getPlyshlogTables() const {
|
||||
return m_plyshlogTables;
|
||||
const TableContainer& TableManager::getPlyshlogTables() const {
|
||||
return getTables("PLYSHLOG");
|
||||
}
|
||||
|
||||
const std::vector<PvtgTable>& TableManager::getPvtgTables() const {
|
||||
|
||||
@@ -100,12 +100,7 @@ namespace Opm {
|
||||
const TableContainer& getPlydhflfTables() const;
|
||||
const TableContainer& getPlymaxTables() const;
|
||||
const TableContainer& getPlyrockTables() const;
|
||||
|
||||
|
||||
// the tables used by the deck. If the tables had some defaulted data in the
|
||||
// deck, the objects returned here exhibit the correct values. If the table is
|
||||
// not present in the deck, the corresponding vector is of size zero.
|
||||
const std::vector<PlyshlogTable>& getPlyshlogTables() const;
|
||||
const TableContainer& getPlyshlogTables() const;
|
||||
|
||||
const std::vector<PvtgTable>& getPvtgTables() const;
|
||||
const std::vector<PvtoTable>& getPvtoTables() const;
|
||||
@@ -132,11 +127,7 @@ namespace Opm {
|
||||
|
||||
void initPlymaxTables(const Deck& deck);
|
||||
void initPlyrockTables(const Deck& deck);
|
||||
|
||||
|
||||
void initPlyshlogTables(const Deck& deck,
|
||||
const std::string& keywordName,
|
||||
std::vector<PlyshlogTable>& tableVector);
|
||||
void initPlyshlogTables(const Deck& deck);
|
||||
|
||||
template <class TableType>
|
||||
void initSimpleTableContainer(const Deck& deck,
|
||||
@@ -233,7 +224,6 @@ namespace Opm {
|
||||
std::map<int, VFPInjTable> m_vfpinjTables;
|
||||
std::vector<PvtgTable> m_pvtgTables;
|
||||
std::vector<PvtoTable> m_pvtoTables;
|
||||
std::vector<PlyshlogTable> m_plyshlogTables;
|
||||
|
||||
std::shared_ptr<Regdims> m_regdims;
|
||||
std::shared_ptr<Tabdims> m_tabdims;
|
||||
|
||||
Reference in New Issue
Block a user