2014-01-07 17:39:07 +01:00
|
|
|
/*
|
|
|
|
|
Copyright 2013 Statoil ASA.
|
|
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-10-01 16:07:44 +02:00
|
|
|
#ifndef OPM_ECLIPSE_STATE_HPP
|
|
|
|
|
#define OPM_ECLIPSE_STATE_HPP
|
2014-01-07 17:39:07 +01:00
|
|
|
|
|
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
2014-12-12 20:56:34 +01:00
|
|
|
#include <opm/parser/eclipse/Log/Logger.hpp>
|
2014-10-01 16:07:44 +02:00
|
|
|
|
2014-01-08 15:59:38 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
2014-04-24 09:01:58 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
2014-05-30 10:08:35 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/Box.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/BoxManager.hpp>
|
2014-05-16 15:58:04 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
|
2014-06-23 11:58:27 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
|
2014-01-08 16:03:19 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
2014-07-05 13:47:22 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
2014-01-07 17:39:07 +01:00
|
|
|
|
2014-09-18 16:28:36 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/EnkrvdTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/EnptvdTable.hpp>
|
2014-09-24 12:39:27 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/ImkrvdTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/ImptvdTable.hpp>
|
2014-09-18 16:28:36 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PlyadsTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PlymaxTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PlyrockTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PlyviscTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PvdgTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PvdoTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/RocktabTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/RsvdTable.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/RvvdTable.hpp>
|
2014-12-01 18:33:56 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp>
|
2014-09-18 16:28:36 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/SgofTable.hpp>
|
2014-12-08 13:39:32 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/Sof2Table.hpp>
|
2014-09-18 16:28:36 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/SwofTable.hpp>
|
2014-12-08 13:39:32 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/SwfnTable.hpp>
|
2014-09-16 13:14:12 +02:00
|
|
|
|
2014-01-07 17:52:20 +01:00
|
|
|
#include <set>
|
2014-01-07 17:39:07 +01:00
|
|
|
#include <memory>
|
2014-10-07 15:35:44 +02:00
|
|
|
#include <iostream>
|
2014-01-07 17:39:07 +01:00
|
|
|
|
|
|
|
|
namespace Opm {
|
|
|
|
|
class EclipseState {
|
|
|
|
|
public:
|
2014-08-27 12:18:34 +02:00
|
|
|
enum EnabledTypes {
|
|
|
|
|
IntProperties = 0x01,
|
|
|
|
|
DoubleProperties = 0x02,
|
|
|
|
|
|
|
|
|
|
AllProperties = IntProperties | DoubleProperties
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-12 20:56:34 +01:00
|
|
|
EclipseState(DeckConstPtr deck, LoggerPtr logger = std::make_shared<Logger>(&std::cout));
|
2014-08-27 12:18:34 +02:00
|
|
|
|
2014-01-07 17:39:07 +01:00
|
|
|
ScheduleConstPtr getSchedule() const;
|
2014-04-24 09:01:58 +02:00
|
|
|
EclipseGridConstPtr getEclipseGrid() const;
|
2014-07-17 21:20:42 +02:00
|
|
|
EclipseGridPtr getEclipseGridCopy() const;
|
2014-01-28 08:18:03 +01:00
|
|
|
bool hasPhase(enum Phase::PhaseEnum phase) const;
|
2014-01-29 19:39:33 +01:00
|
|
|
std::string getTitle() const;
|
2014-08-27 12:18:34 +02:00
|
|
|
bool supportsGridProperty(const std::string& keyword, int enabledTypes=AllProperties) const;
|
2014-06-02 09:07:16 +02:00
|
|
|
|
2014-06-02 16:23:01 +02:00
|
|
|
std::shared_ptr<GridProperty<int> > getIntGridProperty( const std::string& keyword ) const;
|
|
|
|
|
std::shared_ptr<GridProperty<double> > getDoubleGridProperty( const std::string& keyword ) const;
|
2014-05-16 15:58:04 +02:00
|
|
|
bool hasIntGridProperty(const std::string& keyword) const;
|
2014-06-02 09:07:16 +02:00
|
|
|
bool hasDoubleGridProperty(const std::string& keyword) const;
|
|
|
|
|
|
2014-10-03 14:21:20 +02:00
|
|
|
void loadGridPropertyFromDeckKeyword(std::shared_ptr<const Box> inputBox,
|
|
|
|
|
DeckKeywordConstPtr deckKeyword,
|
2014-12-12 20:56:34 +01:00
|
|
|
LoggerPtr logger,
|
2014-10-03 14:21:20 +02:00
|
|
|
int enabledTypes = AllProperties);
|
2014-06-23 11:58:27 +02:00
|
|
|
|
2014-07-05 13:47:22 +02:00
|
|
|
std::shared_ptr<const FaultCollection> getFaults() const;
|
2014-06-23 11:58:27 +02:00
|
|
|
std::shared_ptr<const TransMult> getTransMult() const;
|
2014-09-09 12:16:13 +02:00
|
|
|
|
2014-09-16 13:14:12 +02:00
|
|
|
// 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<EnkrvdTable>& getEnkrvdTables() const;
|
|
|
|
|
const std::vector<EnptvdTable>& getEnptvdTables() const;
|
2014-09-24 12:39:27 +02:00
|
|
|
const std::vector<ImkrvdTable>& getImkrvdTables() const;
|
|
|
|
|
const std::vector<ImptvdTable>& getImptvdTables() const;
|
2014-09-16 13:14:12 +02:00
|
|
|
const std::vector<PlyadsTable>& getPlyadsTables() const;
|
|
|
|
|
const std::vector<PlymaxTable>& getPlymaxTables() const;
|
|
|
|
|
const std::vector<PlyrockTable>& getPlyrockTables() const;
|
|
|
|
|
const std::vector<PlyviscTable>& getPlyviscTables() const;
|
|
|
|
|
const std::vector<PvdgTable>& getPvdgTables() const;
|
|
|
|
|
const std::vector<PvdoTable>& getPvdoTables() const;
|
|
|
|
|
const std::vector<PvtgTable>& getPvtgTables() const;
|
|
|
|
|
const std::vector<PvtoTable>& getPvtoTables() const;
|
|
|
|
|
const std::vector<RocktabTable>& getRocktabTables() const;
|
|
|
|
|
const std::vector<RsvdTable>& getRsvdTables() const;
|
|
|
|
|
const std::vector<RvvdTable>& getRvvdTables() const;
|
2014-12-01 18:33:56 +01:00
|
|
|
const std::vector<RtempvdTable>& getRtempvdTables() const;
|
2014-09-16 13:14:12 +02:00
|
|
|
const std::vector<SgofTable>& getSgofTables() const;
|
2014-12-08 13:39:32 +01:00
|
|
|
const std::vector<Sof2Table>& getSof2Tables() const;
|
2014-09-16 13:14:12 +02:00
|
|
|
const std::vector<SwofTable>& getSwofTables() const;
|
2014-12-08 13:39:32 +01:00
|
|
|
const std::vector<SwfnTable>& getSwfnTables() const;
|
2014-09-16 13:14:12 +02:00
|
|
|
|
2014-09-09 12:16:13 +02:00
|
|
|
// the unit system used by the deck. note that it is rarely needed to convert
|
|
|
|
|
// units because internally to opm-parser everything is represented by SI
|
|
|
|
|
// units...
|
|
|
|
|
std::shared_ptr<const UnitSystem> getDeckUnitSystem() const;
|
|
|
|
|
|
2014-01-07 17:39:07 +01:00
|
|
|
private:
|
2014-12-12 20:56:34 +01:00
|
|
|
void initTables(DeckConstPtr deck, LoggerPtr logger);
|
|
|
|
|
void initSchedule(DeckConstPtr deck, LoggerPtr logger);
|
|
|
|
|
void initEclipseGrid(DeckConstPtr deck, LoggerPtr logger);
|
|
|
|
|
void initPhases(DeckConstPtr deck, LoggerPtr logger);
|
|
|
|
|
void initTitle(DeckConstPtr deck, LoggerPtr logger);
|
|
|
|
|
void initProperties(DeckConstPtr deck, LoggerPtr logger);
|
|
|
|
|
void initTransMult(LoggerPtr logger);
|
|
|
|
|
void initFaults(DeckConstPtr deck, LoggerPtr logger);
|
2014-09-16 13:14:12 +02:00
|
|
|
|
|
|
|
|
template <class TableType>
|
|
|
|
|
void initSimpleTables(DeckConstPtr deck,
|
2014-12-12 20:56:34 +01:00
|
|
|
LoggerPtr logger,
|
2014-09-16 13:14:12 +02:00
|
|
|
const std::string& keywordName,
|
|
|
|
|
std::vector<TableType>& tableVector) {
|
|
|
|
|
if (!deck->hasKeyword(keywordName))
|
|
|
|
|
return; // the table is not featured by the deck...
|
|
|
|
|
|
2014-10-03 14:21:20 +02:00
|
|
|
if (deck->numKeywords(keywordName) > 1) {
|
2014-12-12 20:56:34 +01:00
|
|
|
complainAboutAmbiguousKeyword(deck, logger, keywordName);
|
2014-10-03 14:21:20 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2014-09-16 13:14:12 +02:00
|
|
|
|
|
|
|
|
const auto& tableKeyword = deck->getKeyword(keywordName);
|
|
|
|
|
for (size_t tableIdx = 0; tableIdx < tableKeyword->size(); ++tableIdx) {
|
|
|
|
|
if (tableKeyword->getRecord(tableIdx)->getItem(0)->size() == 0) {
|
|
|
|
|
// for simple tables, an empty record indicates that the previous table
|
|
|
|
|
// should be copied...
|
2014-10-03 14:21:20 +02:00
|
|
|
if (tableIdx == 0) {
|
2014-12-12 20:56:34 +01:00
|
|
|
logger->addError(tableKeyword->getFileName(),
|
2014-10-03 14:21:20 +02:00
|
|
|
tableKeyword->getLineNumber(),
|
|
|
|
|
"The first table for keyword "+keywordName+
|
|
|
|
|
" must be explicitly defined! Ignoring keyword");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-09-17 14:41:37 +02:00
|
|
|
tableVector.push_back(tableVector.back());
|
2014-09-16 13:14:12 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-17 14:41:37 +02:00
|
|
|
tableVector.push_back(TableType());
|
2014-09-16 13:14:12 +02:00
|
|
|
tableVector[tableIdx].init(tableKeyword, tableIdx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <class TableType>
|
|
|
|
|
void initFullTables(DeckConstPtr deck,
|
2014-12-12 20:56:34 +01:00
|
|
|
LoggerPtr logger,
|
2014-09-16 13:14:12 +02:00
|
|
|
const std::string& keywordName,
|
|
|
|
|
std::vector<TableType>& tableVector) {
|
|
|
|
|
if (!deck->hasKeyword(keywordName))
|
|
|
|
|
return; // the table is not featured by the deck...
|
|
|
|
|
|
2014-10-03 14:21:20 +02:00
|
|
|
if (deck->numKeywords(keywordName) > 1) {
|
2014-12-12 20:56:34 +01:00
|
|
|
complainAboutAmbiguousKeyword(deck, logger, keywordName);
|
2014-10-03 14:21:20 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2014-09-16 13:14:12 +02:00
|
|
|
|
|
|
|
|
const auto& tableKeyword = deck->getKeyword(keywordName);
|
|
|
|
|
|
|
|
|
|
int numTables = TableType::numTables(tableKeyword);
|
2014-09-17 14:41:37 +02:00
|
|
|
for (int tableIdx = 0; tableIdx < numTables; ++tableIdx) {
|
|
|
|
|
tableVector.push_back(TableType());
|
2014-09-16 13:14:12 +02:00
|
|
|
tableVector[tableIdx].init(tableKeyword, tableIdx);
|
2014-09-17 14:41:37 +02:00
|
|
|
}
|
2014-09-16 13:14:12 +02:00
|
|
|
}
|
|
|
|
|
|
2014-12-12 20:56:34 +01:00
|
|
|
void initRocktabTables(DeckConstPtr deck, LoggerPtr logger);
|
2014-09-16 13:14:12 +02:00
|
|
|
|
2014-12-12 20:56:34 +01:00
|
|
|
void setMULTFLT(std::shared_ptr<const Section> section, LoggerPtr logger) const;
|
|
|
|
|
void initMULTREGT(DeckConstPtr deck, LoggerPtr logger);
|
2014-05-30 15:05:56 +02:00
|
|
|
|
2014-06-03 17:45:55 +02:00
|
|
|
double getSIScaling(const std::string &dimensionString) const;
|
|
|
|
|
|
2014-12-12 20:56:34 +01:00
|
|
|
void processGridProperties(Opm::DeckConstPtr deck, LoggerPtr logger, int enabledTypes);
|
|
|
|
|
void scanSection(std::shared_ptr<Opm::Section> section, LoggerPtr logger, int enabledTypes);
|
|
|
|
|
void handleADDKeyword(DeckKeywordConstPtr deckKeyword , LoggerPtr logger, BoxManager& boxManager, int enabledTypes);
|
|
|
|
|
void handleBOXKeyword(DeckKeywordConstPtr deckKeyword , LoggerPtr logger, BoxManager& boxManager);
|
|
|
|
|
void handleCOPYKeyword(DeckKeywordConstPtr deckKeyword , LoggerPtr logger, BoxManager& boxManager, int enabledTypes);
|
2014-06-02 16:49:21 +02:00
|
|
|
void handleENDBOXKeyword(BoxManager& boxManager);
|
2014-12-12 20:56:34 +01:00
|
|
|
void handleEQUALSKeyword(DeckKeywordConstPtr deckKeyword , LoggerPtr logger, BoxManager& boxManager, int enabledTypes);
|
|
|
|
|
void handleMULTIPLYKeyword(DeckKeywordConstPtr deckKeyword , LoggerPtr logger, BoxManager& boxManager, int enabledTypes);
|
2014-12-12 19:47:18 +01:00
|
|
|
void handleEQUALREGKeyword(DeckKeywordConstPtr deckKeyword, ParserLogPtr parserLog, int enabledTypes);
|
2014-12-13 20:40:20 +01:00
|
|
|
void handleMULTIREGKeyword(DeckKeywordConstPtr deckKeyword, ParserLogPtr parserLog, int enabledTypes);
|
2014-12-08 13:39:32 +01:00
|
|
|
|
2014-12-12 20:56:34 +01:00
|
|
|
void setKeywordBox(DeckKeywordConstPtr deckKeyword, size_t recordIdx, LoggerPtr logger, BoxManager& boxManager);
|
2014-06-02 09:07:16 +02:00
|
|
|
|
2014-05-30 13:20:30 +02:00
|
|
|
void copyIntKeyword(const std::string& srcField , const std::string& targetField , std::shared_ptr<const Box> inputBox);
|
2014-06-02 09:07:16 +02:00
|
|
|
void copyDoubleKeyword(const std::string& srcField , const std::string& targetField , std::shared_ptr<const Box> inputBox);
|
2014-01-07 17:52:20 +01:00
|
|
|
|
2014-12-12 20:56:34 +01:00
|
|
|
void complainAboutAmbiguousKeyword(DeckConstPtr deck, LoggerPtr logger, const std::string& keywordName) const;
|
2014-10-03 14:21:20 +02:00
|
|
|
|
2014-04-24 09:01:58 +02:00
|
|
|
EclipseGridConstPtr m_eclipseGrid;
|
2014-01-07 17:39:07 +01:00
|
|
|
ScheduleConstPtr schedule;
|
2014-09-16 13:14:12 +02:00
|
|
|
|
|
|
|
|
std::vector<EnkrvdTable> m_enkrvdTables;
|
|
|
|
|
std::vector<EnptvdTable> m_enptvdTables;
|
2014-09-24 12:39:27 +02:00
|
|
|
std::vector<ImkrvdTable> m_imkrvdTables;
|
|
|
|
|
std::vector<ImptvdTable> m_imptvdTables;
|
2014-09-16 13:14:12 +02:00
|
|
|
std::vector<PlyadsTable> m_plyadsTables;
|
|
|
|
|
std::vector<PlymaxTable> m_plymaxTables;
|
|
|
|
|
std::vector<PlyrockTable> m_plyrockTables;
|
|
|
|
|
std::vector<PlyviscTable> m_plyviscTables;
|
|
|
|
|
std::vector<PvdgTable> m_pvdgTables;
|
|
|
|
|
std::vector<PvdoTable> m_pvdoTables;
|
|
|
|
|
std::vector<PvtgTable> m_pvtgTables;
|
|
|
|
|
std::vector<PvtoTable> m_pvtoTables;
|
|
|
|
|
std::vector<RocktabTable> m_rocktabTables;
|
|
|
|
|
std::vector<RsvdTable> m_rsvdTables;
|
|
|
|
|
std::vector<RvvdTable> m_rvvdTables;
|
2014-12-01 18:33:56 +01:00
|
|
|
std::vector<RtempvdTable> m_rtempvdTables;
|
2014-09-16 13:14:12 +02:00
|
|
|
std::vector<SgofTable> m_sgofTables;
|
2014-12-08 13:39:32 +01:00
|
|
|
std::vector<Sof2Table> m_sof2Tables;
|
2014-09-16 13:14:12 +02:00
|
|
|
std::vector<SwofTable> m_swofTables;
|
2014-12-08 13:39:32 +01:00
|
|
|
std::vector<SwfnTable> m_swfnTables;
|
2014-09-16 13:14:12 +02:00
|
|
|
|
2014-01-28 08:18:03 +01:00
|
|
|
std::set<enum Phase::PhaseEnum> phases;
|
2014-01-29 19:39:33 +01:00
|
|
|
std::string m_title;
|
2014-09-09 12:16:13 +02:00
|
|
|
std::shared_ptr<const UnitSystem> m_deckUnitSystem;
|
2014-05-16 15:58:04 +02:00
|
|
|
std::shared_ptr<GridProperties<int> > m_intGridProperties;
|
2014-06-02 09:07:16 +02:00
|
|
|
std::shared_ptr<GridProperties<double> > m_doubleGridProperties;
|
2014-06-23 11:58:27 +02:00
|
|
|
std::shared_ptr<TransMult> m_transMult;
|
2014-07-05 13:47:22 +02:00
|
|
|
std::shared_ptr<FaultCollection> m_faults;
|
2014-01-07 17:39:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::shared_ptr<EclipseState> EclipseStatePtr;
|
|
|
|
|
typedef std::shared_ptr<const EclipseState> EclipseStateConstPtr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|