// create table from single record void SimpleTable::init(Opm::DeckItemConstPtr deckItem, const std::vector<std::string> &columnNames) { createColumns(columnNames); if ( (deckItem->size() % numColumns()) != 0) throw std::runtime_error("Number of columns in the data file is" "inconsistent with the ones specified"); { size_t rows = deckItem->size() / numColumns(); for (size_t rowIdx = 0; rowIdx < rows; rowIdx++) { for (size_t colIdx = 0; colIdx < numColumns(); ++colIdx) { size_t deckItemIdx = rowIdx*numColumns() + colIdx; m_columns[colIdx].push_back( deckItem->getSIDouble(deckItemIdx) ); m_valueDefaulted[colIdx].push_back( deckItem->defaultApplied(deckItemIdx) ); } } } }
std::vector<double> getMapaxesValues(Opm::DeckConstPtr deck) { Opm::DeckRecordConstPtr mapaxesRecord = deck->getKeyword("MAPAXES")->getRecord(0); std::vector<double> result; for (size_t itemIdx = 0; itemIdx < mapaxesRecord->size(); ++itemIdx) { Opm::DeckItemConstPtr curItem = mapaxesRecord->getItem(itemIdx); for (size_t dataItemIdx = 0; dataItemIdx < curItem->size(); ++dataItemIdx) { result.push_back(curItem->getRawDouble(dataItemIdx)); } } return result; }
/*! * \brief Reads all relevant material parameters form a cell of a parsed ECL deck. * * This requires that the opm-parser module is available. */ void initFromDeck(Opm::DeckConstPtr deck) { enableHysteresis_ = false; if (!deck->hasKeyword("SATOPTS")) return; Opm::DeckItemConstPtr satoptsItem = deck->getKeyword("SATOPTS")->getRecord(0)->getItem(0); for (unsigned i = 0; i < satoptsItem->size(); ++i) { std::string satoptsValue = satoptsItem->getString(0); std::transform(satoptsValue.begin(), satoptsValue.end(), satoptsValue.begin(), ::toupper); if (satoptsValue == "HYSTER") enableHysteresis_ = true; } // check for the (deprecated) HYST keyword if (deck->hasKeyword("HYST")) enableHysteresis_ = true; if (!enableHysteresis_) return; if (!deck->hasKeyword("EHYSTR")) OPM_THROW(std::runtime_error, "Enabling hysteresis via the HYST parameter for SATOPTS requires the " "presence of the EHYSTR keyword"); Opm::DeckKeywordConstPtr ehystrKeyword = deck->getKeyword("EHYSTR"); if (deck->hasKeyword("NOHYKR")) krHysteresisModel_ = -1; else { krHysteresisModel_ = ehystrKeyword->getRecord(0)->getItem("relative_perm_hyst")->getInt(0); if (krHysteresisModel_ != 0) OPM_THROW(std::runtime_error, "Only the Carlson kr hystersis model (indicated by a 0 on the second item" " of the 'EHYSTR' keyword) is supported"); } if (deck->hasKeyword("NOHYPC")) pcHysteresisModel_ = -1; else { // if capillary pressure hysteresis is enabled, Eclipse always uses the // Killough model pcHysteresisModel_ = 0; } }