2013-10-25 17:28:56 +02: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/>.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef SCHEDULE_HPP
|
|
|
|
|
#define SCHEDULE_HPP
|
|
|
|
|
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
2013-11-05 15:25:47 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
2013-11-14 16:08:10 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
2013-11-18 13:11:49 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
2014-09-04 14:09:33 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
|
2015-01-25 23:48:48 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
2013-11-05 15:25:47 +01:00
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
|
|
|
|
|
2013-12-02 13:07:01 +01:00
|
|
|
#include <memory>
|
2013-11-05 15:25:47 +01:00
|
|
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
2013-10-25 17:28:56 +02:00
|
|
|
|
2013-11-05 15:25:47 +01:00
|
|
|
#include <map>
|
2013-10-25 17:28:56 +02:00
|
|
|
|
2014-12-08 16:34:28 +01:00
|
|
|
namespace Opm
|
2013-10-25 17:28:56 +02:00
|
|
|
{
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2013-10-25 17:28:56 +02:00
|
|
|
const boost::gregorian::date defaultStartDate( 1983 , boost::gregorian::Jan , 1);
|
|
|
|
|
|
|
|
|
|
class Schedule {
|
|
|
|
|
public:
|
2015-01-16 14:51:57 +01:00
|
|
|
Schedule(std::shared_ptr<const EclipseGrid> grid , DeckConstPtr deck);
|
2014-02-21 16:31:55 +01:00
|
|
|
boost::posix_time::ptime getStartTime() const
|
|
|
|
|
{ return m_timeMap->getStartTime(/*timeStepIdx=*/0); }
|
2013-10-25 17:28:56 +02:00
|
|
|
TimeMapConstPtr getTimeMap() const;
|
2013-11-05 15:25:47 +01:00
|
|
|
|
|
|
|
|
size_t numWells() const;
|
2015-02-12 12:54:57 +01:00
|
|
|
size_t numWells(size_t timestep) const;
|
|
|
|
|
size_t getMaxNumCompletionsForWells(size_t timestep) const;
|
2013-11-05 15:25:47 +01:00
|
|
|
bool hasWell(const std::string& wellName) const;
|
|
|
|
|
WellPtr getWell(const std::string& wellName) const;
|
2015-02-12 12:54:57 +01:00
|
|
|
std::vector<WellConstPtr> getWells() const;
|
|
|
|
|
std::vector<WellConstPtr> getWells(size_t timeStep) const;
|
2015-02-12 15:32:31 +01:00
|
|
|
std::vector<WellPtr> getWells(const std::string& wellNamePattern) const;
|
2014-01-22 14:40:10 +01:00
|
|
|
|
2013-11-14 16:08:10 +01:00
|
|
|
GroupTreePtr getGroupTree(size_t t) const;
|
2013-11-18 13:11:49 +01:00
|
|
|
size_t numGroups() const;
|
|
|
|
|
bool hasGroup(const std::string& groupName) const;
|
|
|
|
|
GroupPtr getGroup(const std::string& groupName) const;
|
2014-12-05 12:59:53 +01:00
|
|
|
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2013-10-25 17:28:56 +02:00
|
|
|
private:
|
|
|
|
|
TimeMapPtr m_timeMap;
|
2014-04-30 14:45:37 +02:00
|
|
|
OrderedMap<WellPtr> m_wells;
|
2015-01-25 23:48:48 +01:00
|
|
|
std::shared_ptr<const EclipseGrid> m_grid;
|
2013-11-18 13:11:49 +01:00
|
|
|
std::map<std::string , GroupPtr> m_groups;
|
2013-12-02 13:07:01 +01:00
|
|
|
std::shared_ptr<DynamicState<GroupTreePtr> > m_rootGroupTree;
|
2013-11-05 15:25:47 +01:00
|
|
|
|
2013-11-26 12:48:20 +01:00
|
|
|
void addWellToGroup( GroupPtr newGroup , WellPtr well , size_t timeStep);
|
2015-01-16 14:51:57 +01:00
|
|
|
void initFromDeck(DeckConstPtr deck);
|
|
|
|
|
void createTimeMap(DeckConstPtr deck);
|
2013-11-14 16:08:10 +01:00
|
|
|
void initRootGroupTreeNode(TimeMapConstPtr timeMap);
|
2015-01-16 14:51:57 +01:00
|
|
|
void iterateScheduleSection(DeckConstPtr deck);
|
2013-11-18 15:28:58 +01:00
|
|
|
bool handleGroupFromWELSPECS(const std::string& groupName, GroupTreePtr newTree) const;
|
2013-11-25 16:31:44 +01:00
|
|
|
void addGroup(const std::string& groupName , size_t timeStep);
|
2014-01-20 14:52:30 +01:00
|
|
|
void addWell(const std::string& wellName, DeckRecordConstPtr record, size_t timeStep);
|
2015-01-16 14:51:57 +01:00
|
|
|
void checkWELSPECSConsistency(WellConstPtr well, DeckKeywordConstPtr keyword, size_t recordIdx) const;
|
|
|
|
|
void handleWELSPECS(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleWCONProducer(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode);
|
|
|
|
|
void handleWCONHIST(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleWCONPROD(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleWGRUPCON(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleCOMPDAT(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleWCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleWPOLYMER(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleWCONINJH(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep);
|
2015-02-16 17:19:39 +01:00
|
|
|
void handleWELOPEN(DeckKeywordConstPtr keyword, size_t currentStep, bool hascomplump);
|
2015-04-07 08:02:06 +02:00
|
|
|
void handleWELTARG(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep);
|
2015-01-16 14:51:57 +01:00
|
|
|
void handleGCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleGCONPROD(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleDATES(DeckKeywordConstPtr keyword);
|
|
|
|
|
void handleTSTEP(DeckKeywordConstPtr keyword);
|
|
|
|
|
void handleGRUPTREE(DeckKeywordConstPtr keyword, size_t currentStep);
|
2015-02-12 08:38:26 +01:00
|
|
|
void handleWRFT(DeckKeywordConstPtr keyword, size_t currentStep);
|
|
|
|
|
void handleWRFTPLT(DeckKeywordConstPtr keyword, size_t currentStep);
|
2013-11-14 16:08:10 +01:00
|
|
|
|
2015-01-28 09:39:13 +01:00
|
|
|
void checkUnhandledKeywords(DeckConstPtr deck) const;
|
2014-02-19 15:43:42 +01:00
|
|
|
|
2015-01-28 09:30:07 +01:00
|
|
|
static double convertInjectionRateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem);
|
|
|
|
|
static double convertInjectionRateToSI(double rawRate, Phase::PhaseEnum wellPhase, const Opm::UnitSystem &unitSystem);
|
2014-02-19 15:43:42 +01:00
|
|
|
static bool convertEclipseStringToBool(const std::string& eclipseString);
|
2015-01-14 11:41:13 +01:00
|
|
|
|
2013-10-25 17:28:56 +02:00
|
|
|
};
|
2013-12-02 13:07:01 +01:00
|
|
|
typedef std::shared_ptr<Schedule> SchedulePtr;
|
|
|
|
|
typedef std::shared_ptr<const Schedule> ScheduleConstPtr;
|
2013-10-25 17:28:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|