EclipseState.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2013 Statoil ASA.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OPM_ECLIPSE_STATE_HPP
21 #define OPM_ECLIPSE_STATE_HPP
22 
25 
35 
40 
42 
43 #include <set>
44 #include <memory>
45 #include <iostream>
46 #include <map>
47 #include <vector>
48 
49 namespace Opm {
50  class EclipseState {
51  public:
52  enum EnabledTypes {
53  IntProperties = 0x01,
55 
57  };
58 
59  EclipseState(DeckConstPtr deck , const ParseMode& parseMode);
60 
61  const ParseMode& getParseMode() const;
64  IOConfigPtr getIOConfig() const;
69  bool hasPhase(enum Phase::PhaseEnum phase) const;
70  std::string getTitle() const;
71  bool supportsGridProperty(const std::string& keyword, int enabledTypes=AllProperties) const;
72 
73  std::shared_ptr<GridProperty<int> > getRegion(DeckItemConstPtr regionItem) const;
74  std::shared_ptr<GridProperty<int> > getDefaultRegion() const;
75  std::shared_ptr<GridProperty<int> > getIntGridProperty( const std::string& keyword ) const;
76  std::shared_ptr<GridProperty<double> > getDoubleGridProperty( const std::string& keyword ) const;
77  bool hasIntGridProperty(const std::string& keyword) const;
78  bool hasDoubleGridProperty(const std::string& keyword) const;
79 
80  void loadGridPropertyFromDeckKeyword(std::shared_ptr<const Box> inputBox,
81  DeckKeywordConstPtr deckKeyword,
82  int enabledTypes = AllProperties);
83 
84  std::shared_ptr<const FaultCollection> getFaults() const;
85  std::shared_ptr<const TransMult> getTransMult() const;
86  std::shared_ptr<const NNC> getNNC() const;
87  bool hasNNC() const;
88 
89  std::shared_ptr<const TableManager> getTableManager() const;
90  size_t getNumPhases() const;
91 
92  // the unit system used by the deck. note that it is rarely needed to convert
93  // units because internally to opm-parser everything is represented by SI
94  // units...
95  std::shared_ptr<const UnitSystem> getDeckUnitSystem() const;
96 
97  private:
98  void initTabdims(DeckConstPtr deck);
99  void initTables(DeckConstPtr deck);
100  void initIOConfig(DeckConstPtr deck);
101  void initSchedule(DeckConstPtr deck);
102  void initIOConfigPostSchedule(DeckConstPtr deck);
103  void initInitConfig(DeckConstPtr deck);
104  void initSimulationConfig(DeckConstPtr deck);
105  void initEclipseGrid(DeckConstPtr deck);
106  void initGridopts(DeckConstPtr deck);
107  void initPhases(DeckConstPtr deck);
108  void initTitle(DeckConstPtr deck);
109  void initProperties(DeckConstPtr deck);
110  void initTransMult();
111  void initFaults(DeckConstPtr deck);
112  void initNNC(DeckConstPtr deck);
113 
114 
115  void setMULTFLT(std::shared_ptr<const Section> section) const;
116  void initMULTREGT(DeckConstPtr deck);
117 
118  double getSIScaling(const std::string &dimensionString) const;
119 
120  void processGridProperties(Opm::DeckConstPtr deck, int enabledTypes);
121  void scanSection(std::shared_ptr<Opm::Section> section , int enabledTypes);
122  void handleADDKeyword(DeckKeywordConstPtr deckKeyword , BoxManager& boxManager, int enabledTypes);
123  void handleBOXKeyword(DeckKeywordConstPtr deckKeyword , BoxManager& boxManager);
124  void handleCOPYKeyword(DeckKeywordConstPtr deckKeyword , BoxManager& boxManager, int enabledTypes);
125  void handleENDBOXKeyword(BoxManager& boxManager);
126  void handleEQUALSKeyword(DeckKeywordConstPtr deckKeyword , BoxManager& boxManager, int enabledTypes);
127  void handleMULTIPLYKeyword(DeckKeywordConstPtr deckKeyword , BoxManager& boxManager, int enabledTypes);
128 
129  void handleEQUALREGKeyword(DeckKeywordConstPtr deckKeyword, int enabledTypes);
130  void handleMULTIREGKeyword(DeckKeywordConstPtr deckKeyword, int enabledTypes);
131  void handleADDREGKeyword(DeckKeywordConstPtr deckKeyword , int enabledTypes);
132  void handleCOPYREGKeyword(DeckKeywordConstPtr deckKeyword , int enabledTypes);
133 
134  void setKeywordBox(DeckKeywordConstPtr deckKeyword, size_t recordIdx, BoxManager& boxManager);
135 
136  void copyIntKeyword(const std::string& srcField , const std::string& targetField , std::shared_ptr<const Box> inputBox);
137  void copyDoubleKeyword(const std::string& srcField , const std::string& targetField , std::shared_ptr<const Box> inputBox);
138 
139  void complainAboutAmbiguousKeyword(DeckConstPtr deck, const std::string& keywordName) const;
140 
141  EclipseGridConstPtr m_eclipseGrid;
142  IOConfigPtr m_ioConfig;
143  InitConfigConstPtr m_initConfig;
144  ScheduleConstPtr schedule;
145  SimulationConfigConstPtr m_simulationConfig;
146 
147  std::shared_ptr<const TableManager> m_tables;
148 
149  std::set<enum Phase::PhaseEnum> phases;
150  std::string m_title;
151  std::shared_ptr<const UnitSystem> m_deckUnitSystem;
152  std::shared_ptr<GridProperties<int> > m_intGridProperties;
153  std::shared_ptr<GridProperties<double> > m_doubleGridProperties;
154  std::shared_ptr<TransMult> m_transMult;
155  std::shared_ptr<FaultCollection> m_faults;
156  std::shared_ptr<NNC> m_nnc;
157  std::string m_defaultRegion;
158  const ParseMode& m_parseMode;
159  };
160 
161  typedef std::shared_ptr<EclipseState> EclipseStatePtr;
162  typedef std::shared_ptr<const EclipseState> EclipseStateConstPtr;
163 }
164 
165 #endif
EclipseState(DeckConstPtr deck, const ParseMode &parseMode)
SimulationConfigConstPtr getSimulationConfig() const
std::shared_ptr< const IOConfig > IOConfigConstPtr
Definition: IOConfig.hpp:204
std::shared_ptr< const EclipseGrid > EclipseGridConstPtr
Definition: EclipseGrid.hpp:143
bool hasNNC() const
std::shared_ptr< const NNC > getNNC() const
Definition: Deck.hpp:29
std::shared_ptr< GridProperty< double > > getDoubleGridProperty(const std::string &keyword) const
std::shared_ptr< const FaultCollection > getFaults() const
EclipseGridConstPtr getEclipseGrid() const
bool hasDoubleGridProperty(const std::string &keyword) const
std::shared_ptr< const DeckKeyword > DeckKeywordConstPtr
Definition: DeckKeyword.hpp:71
std::shared_ptr< EclipseState > EclipseStatePtr
Definition: EclipseState.hpp:161
std::shared_ptr< const SimulationConfig > SimulationConfigConstPtr
Definition: SimulationConfig.hpp:50
std::shared_ptr< const DeckItem > DeckItemConstPtr
Definition: DeckItem.hpp:127
IOConfigPtr getIOConfig() const
std::shared_ptr< const Deck > DeckConstPtr
Definition: Deck.hpp:86
bool supportsGridProperty(const std::string &keyword, int enabledTypes=AllProperties) const
size_t getNumPhases() const
std::shared_ptr< EclipseGrid > EclipseGridPtr
Definition: EclipseGrid.hpp:142
std::shared_ptr< const Schedule > ScheduleConstPtr
Definition: Schedule.hpp:142
std::shared_ptr< const EclipseState > EclipseStateConstPtr
Definition: EclipseState.hpp:162
IOConfigConstPtr getIOConfigConst() const
void loadGridPropertyFromDeckKeyword(std::shared_ptr< const Box > inputBox, DeckKeywordConstPtr deckKeyword, int enabledTypes=AllProperties)
Definition: EclipseState.hpp:50
const ParseMode & getParseMode() const
PhaseEnum
Definition: ScheduleEnums.hpp:75
EclipseGridPtr getEclipseGridCopy() const
Definition: ParseMode.hpp:78
std::shared_ptr< const InitConfig > InitConfigConstPtr
Definition: InitConfig.hpp:45
std::shared_ptr< const TableManager > getTableManager() const
std::string getTitle() const
std::shared_ptr< const TransMult > getTransMult() const
EnabledTypes
Definition: EclipseState.hpp:52
Definition: BoxManager.hpp:54
bool hasPhase(enum Phase::PhaseEnum phase) const
Definition: EclipseState.hpp:54
ScheduleConstPtr getSchedule() const
bool hasIntGridProperty(const std::string &keyword) const
Definition: EclipseState.hpp:53
InitConfigConstPtr getInitConfig() const
std::shared_ptr< const UnitSystem > getDeckUnitSystem() const
Definition: EclipseState.hpp:56
std::shared_ptr< GridProperty< int > > getIntGridProperty(const std::string &keyword) const
std::shared_ptr< GridProperty< int > > getRegion(DeckItemConstPtr regionItem) const
std::shared_ptr< IOConfig > IOConfigPtr
Definition: IOConfig.hpp:203
std::shared_ptr< GridProperty< int > > getDefaultRegion() const