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/>.
|
2013-11-08 15:55:11 +01:00
|
|
|
*/
|
2013-10-25 17:28:56 +02:00
|
|
|
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
2014-03-25 09:26:43 +01:00
|
|
|
#include <opm/parser/eclipse/Deck/Section.hpp>
|
2014-02-19 15:43:42 +01:00
|
|
|
#include <boost/algorithm/string.hpp>
|
2013-11-14 16:08:10 +01:00
|
|
|
#include <iostream>
|
2013-10-25 17:28:56 +02:00
|
|
|
|
2014-02-19 15:43:42 +01:00
|
|
|
|
|
|
|
|
|
2013-11-08 15:55:11 +01:00
|
|
|
namespace Opm {
|
|
|
|
|
|
2013-10-25 17:28:56 +02:00
|
|
|
Schedule::Schedule(DeckConstPtr deck) {
|
2013-11-18 13:11:49 +01:00
|
|
|
if (deck->hasKeyword("SCHEDULE")) {
|
2013-11-08 15:55:11 +01:00
|
|
|
initFromDeck(deck);
|
2013-11-18 13:11:49 +01:00
|
|
|
} else
|
2013-11-05 15:25:47 +01:00
|
|
|
throw std::invalid_argument("Deck does not contain SCHEDULE section.\n");
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-14 16:08:10 +01:00
|
|
|
void Schedule::initFromDeck(DeckConstPtr deck) {
|
|
|
|
|
createTimeMap(deck);
|
2013-12-02 11:47:14 +01:00
|
|
|
addGroup( "FIELD", 0 );
|
2013-11-14 16:08:10 +01:00
|
|
|
initRootGroupTreeNode(getTimeMap());
|
|
|
|
|
iterateScheduleSection(deck);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Schedule::initRootGroupTreeNode(TimeMapConstPtr timeMap) {
|
|
|
|
|
m_rootGroupTree.reset(new DynamicState<GroupTreePtr>(timeMap, GroupTreePtr(new GroupTree())));
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-05 17:58:57 +01:00
|
|
|
void Schedule::createTimeMap(DeckConstPtr deck) {
|
2014-02-21 16:31:55 +01:00
|
|
|
boost::posix_time::ptime startTime(defaultStartDate);
|
2013-11-05 17:58:57 +01:00
|
|
|
if (deck->hasKeyword("START")) {
|
|
|
|
|
DeckKeywordConstPtr startKeyword = deck->getKeyword("START");
|
2014-02-21 16:31:55 +01:00
|
|
|
startTime = TimeMap::timeFromEclipse(startKeyword->getRecord(0));
|
2013-11-05 17:58:57 +01:00
|
|
|
}
|
2013-11-08 15:55:11 +01:00
|
|
|
|
2014-02-21 16:31:55 +01:00
|
|
|
m_timeMap.reset(new TimeMap(startTime));
|
2013-11-05 17:58:57 +01:00
|
|
|
}
|
2013-11-05 15:25:47 +01:00
|
|
|
|
2013-11-05 17:58:57 +01:00
|
|
|
void Schedule::iterateScheduleSection(DeckConstPtr deck) {
|
2013-11-05 15:25:47 +01:00
|
|
|
size_t currentStep = 0;
|
2014-03-25 09:26:43 +01:00
|
|
|
SCHEDULESection section(deck);
|
|
|
|
|
for (auto iter=section.begin(); iter != section.end(); ++iter) {
|
2013-11-08 15:55:11 +01:00
|
|
|
|
2014-03-25 09:26:43 +01:00
|
|
|
DeckKeywordConstPtr keyword = (*iter);
|
2013-11-08 15:55:11 +01:00
|
|
|
|
2013-11-05 17:58:57 +01:00
|
|
|
if (keyword->name() == "DATES") {
|
2013-11-08 15:55:11 +01:00
|
|
|
handleDATES(keyword);
|
2013-11-05 15:25:47 +01:00
|
|
|
currentStep += keyword->size();
|
2013-11-05 17:58:57 +01:00
|
|
|
}
|
2013-11-05 15:25:47 +01:00
|
|
|
|
2013-11-05 17:58:57 +01:00
|
|
|
if (keyword->name() == "TSTEP") {
|
2013-11-08 15:55:11 +01:00
|
|
|
handleTSTEP(keyword);
|
|
|
|
|
currentStep += keyword->getRecord(0)->getItem(0)->size(); // This is a bit weird API.
|
2013-11-05 17:58:57 +01:00
|
|
|
}
|
2013-11-08 15:55:11 +01:00
|
|
|
|
2013-11-18 15:28:58 +01:00
|
|
|
if (keyword->name() == "WELSPECS") {
|
|
|
|
|
handleWELSPECS(keyword, currentStep);
|
|
|
|
|
}
|
2013-11-08 15:55:11 +01:00
|
|
|
|
|
|
|
|
if (keyword->name() == "WCONHIST")
|
|
|
|
|
handleWCONHIST(keyword, currentStep);
|
|
|
|
|
|
|
|
|
|
if (keyword->name() == "WCONPROD")
|
|
|
|
|
handleWCONPROD(keyword, currentStep);
|
|
|
|
|
|
2013-11-11 17:06:22 +01:00
|
|
|
if (keyword->name() == "WCONINJE")
|
2014-02-10 16:15:22 +01:00
|
|
|
handleWCONINJE(deck, keyword, currentStep);
|
2013-11-11 17:06:22 +01:00
|
|
|
|
|
|
|
|
if (keyword->name() == "WCONINJH")
|
2014-02-10 16:15:22 +01:00
|
|
|
handleWCONINJH(deck, keyword, currentStep);
|
2013-11-05 15:25:47 +01:00
|
|
|
|
2014-02-17 16:10:31 +01:00
|
|
|
if (keyword->name() == "WGRUPCON")
|
|
|
|
|
handleWGRUPCON(keyword, currentStep);
|
|
|
|
|
|
2013-11-14 16:08:10 +01:00
|
|
|
if (keyword->name() == "COMPDAT")
|
|
|
|
|
handleCOMPDAT(keyword, currentStep);
|
|
|
|
|
|
2014-02-04 16:12:49 +01:00
|
|
|
if (keyword->name() == "WELOPEN")
|
|
|
|
|
handleWELOPEN(keyword, currentStep);
|
2013-11-14 16:08:10 +01:00
|
|
|
|
|
|
|
|
if (keyword->name() == "GRUPTREE")
|
|
|
|
|
handleGRUPTREE(keyword, currentStep);
|
2013-11-09 13:17:42 +01:00
|
|
|
|
2013-11-18 16:06:50 +01:00
|
|
|
if (keyword->name() == "GCONINJE")
|
2014-02-10 16:15:22 +01:00
|
|
|
handleGCONINJE( deck, keyword , currentStep );
|
2013-11-18 16:06:50 +01:00
|
|
|
|
2013-11-20 17:07:49 +01:00
|
|
|
if (keyword->name() == "GCONPROD")
|
|
|
|
|
handleGCONPROD( keyword , currentStep );
|
2013-11-05 15:25:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-05 17:58:57 +01:00
|
|
|
void Schedule::handleDATES(DeckKeywordConstPtr keyword) {
|
2013-11-08 15:55:11 +01:00
|
|
|
m_timeMap->addFromDATESKeyword(keyword);
|
2013-11-05 15:25:47 +01:00
|
|
|
}
|
|
|
|
|
|
2013-11-05 17:58:57 +01:00
|
|
|
void Schedule::handleTSTEP(DeckKeywordConstPtr keyword) {
|
2013-11-08 15:55:11 +01:00
|
|
|
m_timeMap->addFromTSTEPKeyword(keyword);
|
2013-11-05 17:58:57 +01:00
|
|
|
}
|
2013-11-05 15:25:47 +01:00
|
|
|
|
2013-11-18 15:28:58 +01:00
|
|
|
bool Schedule::handleGroupFromWELSPECS(const std::string& groupName, GroupTreePtr newTree) const {
|
|
|
|
|
bool treeUpdated = false;
|
|
|
|
|
if (!newTree->getNode(groupName)) {
|
|
|
|
|
treeUpdated = true;
|
|
|
|
|
newTree->updateTree(groupName);
|
|
|
|
|
}
|
|
|
|
|
return treeUpdated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Schedule::handleWELSPECS(DeckKeywordConstPtr keyword, size_t currentStep) {
|
|
|
|
|
bool needNewTree = false;
|
|
|
|
|
GroupTreePtr newTree = m_rootGroupTree->get(currentStep)->deepCopy();
|
|
|
|
|
|
2013-11-05 15:25:47 +01:00
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
2013-11-08 15:55:11 +01:00
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& wellName = record->getItem("WELL")->getTrimmedString(0);
|
|
|
|
|
const std::string& groupName = record->getItem("GROUP")->getTrimmedString(0);
|
2013-11-18 16:06:50 +01:00
|
|
|
|
|
|
|
|
if (!hasGroup(groupName)) {
|
2013-11-25 16:31:44 +01:00
|
|
|
addGroup(groupName , currentStep);
|
2013-11-18 16:06:50 +01:00
|
|
|
}
|
2013-11-08 15:55:11 +01:00
|
|
|
|
|
|
|
|
if (!hasWell(wellName)) {
|
2014-01-20 14:52:30 +01:00
|
|
|
addWell(wellName, record, currentStep);
|
2013-10-25 17:28:56 +02:00
|
|
|
}
|
2013-11-18 15:28:58 +01:00
|
|
|
|
2014-01-20 14:52:30 +01:00
|
|
|
WellConstPtr currentWell = getWell(wellName);
|
|
|
|
|
checkWELSPECSConsistency(currentWell, record);
|
|
|
|
|
|
|
|
|
|
addWellToGroup( getGroup(groupName) , getWell(wellName) , currentStep);
|
2014-02-14 12:36:26 +01:00
|
|
|
bool treeChanged = handleGroupFromWELSPECS(groupName, newTree);
|
|
|
|
|
needNewTree = needNewTree || treeChanged;
|
2013-11-18 15:28:58 +01:00
|
|
|
}
|
|
|
|
|
if (needNewTree) {
|
|
|
|
|
m_rootGroupTree->add(currentStep, newTree);
|
2013-11-05 15:25:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 14:52:30 +01:00
|
|
|
void Schedule::checkWELSPECSConsistency(WellConstPtr well, DeckRecordConstPtr record) const {
|
2014-01-29 11:48:02 +01:00
|
|
|
if (well->getHeadI() != record->getItem("HEAD_I")->getInt(0) - 1) {
|
2014-01-20 14:52:30 +01:00
|
|
|
throw std::invalid_argument("Unable process WELSPECS for well " + well->name() + ", HEAD_I deviates from existing value");
|
|
|
|
|
}
|
2014-01-29 11:48:02 +01:00
|
|
|
if (well->getHeadJ() != record->getItem("HEAD_J")->getInt(0) - 1) {
|
2014-01-20 14:52:30 +01:00
|
|
|
throw std::invalid_argument("Unable process WELSPECS for well " + well->name() + ", HEAD_J deviates from existing value");
|
|
|
|
|
}
|
2014-01-21 10:10:05 +01:00
|
|
|
if (well->getRefDepth() != record->getItem("REF_DEPTH")->getSIDouble(0)) {
|
2014-01-20 14:52:30 +01:00
|
|
|
throw std::invalid_argument("Unable process WELSPECS for well " + well->name() + ", REF_DEPTH deviates from existing value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-30 15:20:17 +01:00
|
|
|
|
|
|
|
|
|
2013-11-11 17:06:22 +01:00
|
|
|
void Schedule::handleWCONProducer(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode) {
|
2013-11-05 15:25:47 +01:00
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
2013-11-08 15:55:11 +01:00
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& wellName = record->getItem("WELL")->getTrimmedString(0);
|
2014-01-30 13:29:04 +01:00
|
|
|
WellPtr well = getWell(wellName);
|
|
|
|
|
double orat = record->getItem("ORAT")->getSIDouble(0);
|
|
|
|
|
double wrat = record->getItem("WRAT")->getSIDouble(0);
|
|
|
|
|
double grat = record->getItem("GRAT")->getSIDouble(0);
|
2014-04-03 14:15:13 +02:00
|
|
|
WellCommon::StatusEnum status = WellCommon::StatusFromString( record->getItem("STATUS")->getTrimmedString(0));
|
2014-03-21 00:05:02 +01:00
|
|
|
WellProductionProperties properties = well->getProductionPropertiesCopy(currentStep);
|
|
|
|
|
|
2014-01-29 15:55:02 +01:00
|
|
|
well->setStatus( currentStep , status );
|
2014-01-30 11:49:33 +01:00
|
|
|
{
|
|
|
|
|
double liquidRate = 0;
|
2014-01-30 12:01:40 +01:00
|
|
|
double resVRate = 0;
|
2014-01-30 13:29:04 +01:00
|
|
|
double BHPLimit = 0;
|
|
|
|
|
double THPLimit = 0;
|
|
|
|
|
|
2014-01-30 11:49:33 +01:00
|
|
|
if (isPredictionMode) {
|
|
|
|
|
liquidRate = record->getItem("LRAT")->getSIDouble(0);
|
2014-01-30 13:29:04 +01:00
|
|
|
BHPLimit = record->getItem("BHP")->getSIDouble(0);
|
|
|
|
|
THPLimit = record->getItem("THP")->getSIDouble(0);
|
2014-02-10 16:15:22 +01:00
|
|
|
resVRate = record->getItem("RESV")->getSIDouble(0);
|
2014-01-30 16:31:35 +01:00
|
|
|
}
|
|
|
|
|
|
2014-03-20 23:27:18 +01:00
|
|
|
properties.predictionMode = isPredictionMode;
|
2014-03-10 15:56:24 +01:00
|
|
|
properties.OilRate = orat;
|
|
|
|
|
properties.WaterRate = wrat;
|
|
|
|
|
properties.GasRate = grat;
|
|
|
|
|
properties.LiquidRate = liquidRate;
|
|
|
|
|
properties.ResVRate = resVRate;
|
2014-03-11 10:53:01 +01:00
|
|
|
properties.BHPLimit = BHPLimit;
|
|
|
|
|
properties.THPLimit = THPLimit;
|
2014-01-30 16:31:35 +01:00
|
|
|
|
|
|
|
|
if (isPredictionMode) {
|
2014-01-30 15:20:17 +01:00
|
|
|
if (record->getItem("LRAT")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::LRAT);
|
2014-03-17 08:31:39 +01:00
|
|
|
else
|
|
|
|
|
properties.addProductionControl(WellProducer::LRAT);
|
2014-01-30 16:31:35 +01:00
|
|
|
|
2014-01-30 15:20:17 +01:00
|
|
|
if (record->getItem("RESV")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::RESV);
|
2014-03-17 08:31:39 +01:00
|
|
|
else
|
|
|
|
|
properties.addProductionControl(WellProducer::RESV);
|
|
|
|
|
|
2014-01-30 15:20:17 +01:00
|
|
|
if (record->getItem("BHP")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::BHP);
|
2014-03-17 08:31:39 +01:00
|
|
|
else
|
|
|
|
|
properties.addProductionControl(WellProducer::BHP);
|
|
|
|
|
|
2014-01-30 15:20:17 +01:00
|
|
|
if (record->getItem("THP")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::THP);
|
2014-03-17 08:31:39 +01:00
|
|
|
else
|
|
|
|
|
properties.addProductionControl(WellProducer::THP);
|
2014-01-30 16:31:35 +01:00
|
|
|
} else {
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::LRAT);
|
|
|
|
|
properties.dropProductionControl(WellProducer::RESV);
|
|
|
|
|
properties.dropProductionControl(WellProducer::BHP);
|
|
|
|
|
properties.dropProductionControl(WellProducer::THP);
|
2014-01-30 11:49:33 +01:00
|
|
|
}
|
2014-01-30 10:14:51 +01:00
|
|
|
}
|
2014-01-30 16:31:35 +01:00
|
|
|
|
2014-01-30 15:20:17 +01:00
|
|
|
if (record->getItem("ORAT")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::ORAT);
|
2014-03-17 15:30:41 +01:00
|
|
|
else
|
|
|
|
|
properties.addProductionControl(WellProducer::ORAT);
|
2014-01-30 15:20:17 +01:00
|
|
|
|
2014-03-17 15:30:41 +01:00
|
|
|
if (record->getItem("GRAT")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::GRAT);
|
2014-03-17 15:30:41 +01:00
|
|
|
else
|
|
|
|
|
properties.addProductionControl(WellProducer::GRAT);
|
2014-01-30 15:20:17 +01:00
|
|
|
|
2014-03-17 15:30:41 +01:00
|
|
|
if (record->getItem("WRAT")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropProductionControl(WellProducer::WRAT);
|
2014-03-17 15:30:41 +01:00
|
|
|
else
|
|
|
|
|
properties.addProductionControl(WellProducer::WRAT);
|
2014-03-03 15:00:42 +01:00
|
|
|
|
|
|
|
|
if (status != WellCommon::SHUT) {
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& cmodeString = record->getItem("CMODE")->getTrimmedString(0);
|
2014-03-03 15:00:42 +01:00
|
|
|
WellProducer::ControlModeEnum control = WellProducer::ControlModeFromString( cmodeString );
|
2014-03-12 12:21:55 +01:00
|
|
|
if (properties.hasProductionControl( control))
|
2014-03-21 00:05:02 +01:00
|
|
|
properties.controlMode = control;
|
2014-03-03 15:00:42 +01:00
|
|
|
else {
|
|
|
|
|
/*
|
|
|
|
|
This is an awkward situation. The current control mode variable
|
|
|
|
|
points to a control which has not been specified in the deck; i.e. a
|
|
|
|
|
situation like this:
|
|
|
|
|
|
|
|
|
|
WCONHIST
|
|
|
|
|
'WELL' 'OPEN' 'RESV' 0.000 0.000 0.000 5* /
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
We have specified that the well should be controlled with 'RESV'
|
|
|
|
|
mode, but actual RESV value has been defaulted. ECLIPSE seems to
|
|
|
|
|
handle this, but the well machinery in OPM-Core keeps close track of
|
|
|
|
|
which controls are available, i.e. have a value set, and will be
|
|
|
|
|
confused by this. We therefor throw here; the fix is to modify the
|
|
|
|
|
deck to set an explicit value for the defaulted control, or
|
|
|
|
|
alternatively change control mode.
|
|
|
|
|
*/
|
|
|
|
|
throw std::invalid_argument("Tried to set invalid control: " + cmodeString + " for well: " + wellName);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-03-17 15:30:41 +01:00
|
|
|
|
2014-03-12 12:21:55 +01:00
|
|
|
well->setProductionProperties(currentStep, properties);
|
2013-11-05 15:25:47 +01:00
|
|
|
}
|
2013-10-25 17:28:56 +02:00
|
|
|
}
|
|
|
|
|
|
2013-11-08 15:55:11 +01:00
|
|
|
void Schedule::handleWCONHIST(DeckKeywordConstPtr keyword, size_t currentStep) {
|
2013-11-11 17:06:22 +01:00
|
|
|
handleWCONProducer(keyword, currentStep, false);
|
2013-11-08 15:55:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Schedule::handleWCONPROD(DeckKeywordConstPtr keyword, size_t currentStep) {
|
2013-11-11 17:06:22 +01:00
|
|
|
handleWCONProducer(keyword, currentStep, true);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-10 16:15:22 +01:00
|
|
|
void Schedule::handleWCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep) {
|
2013-11-11 17:06:22 +01:00
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
|
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& wellName = record->getItem("WELL")->getTrimmedString(0);
|
2013-11-11 17:06:22 +01:00
|
|
|
WellPtr well = getWell(wellName);
|
2014-02-07 17:19:37 +01:00
|
|
|
|
2014-02-10 16:15:22 +01:00
|
|
|
// calculate the injection rates. These are context
|
|
|
|
|
// dependent, so we have to jump through some hoops
|
|
|
|
|
// here...
|
2014-04-03 14:15:13 +02:00
|
|
|
WellInjector::TypeEnum injectorType = WellInjector::TypeFromString( record->getItem("TYPE")->getTrimmedString(0) );
|
2014-02-10 16:15:22 +01:00
|
|
|
double surfaceInjectionRate = record->getItem("RATE")->getRawDouble(0);
|
|
|
|
|
double reservoirInjectionRate = record->getItem("RESV")->getRawDouble(0);
|
|
|
|
|
surfaceInjectionRate = convertInjectionRateToSI(surfaceInjectionRate, injectorType, *deck->getActiveUnitSystem());
|
|
|
|
|
reservoirInjectionRate = convertInjectionRateToSI(reservoirInjectionRate, injectorType, *deck->getActiveUnitSystem());
|
2014-02-07 17:19:37 +01:00
|
|
|
|
2014-01-30 16:31:35 +01:00
|
|
|
double BHPLimit = record->getItem("BHP")->getSIDouble(0);
|
|
|
|
|
double THPLimit = record->getItem("THP")->getSIDouble(0);
|
2014-04-03 14:15:13 +02:00
|
|
|
WellCommon::StatusEnum status = WellCommon::StatusFromString( record->getItem("STATUS")->getTrimmedString(0));
|
2014-01-29 16:42:55 +01:00
|
|
|
|
2014-01-29 15:55:02 +01:00
|
|
|
well->setStatus( currentStep , status );
|
2014-03-17 16:03:58 +01:00
|
|
|
WellInjectionProperties properties(well->getInjectionPropertiesCopy(currentStep));
|
2014-03-20 23:27:18 +01:00
|
|
|
properties.surfaceInjectionRate = surfaceInjectionRate;
|
|
|
|
|
properties.reservoirInjectionRate = reservoirInjectionRate;
|
2014-03-11 10:53:01 +01:00
|
|
|
properties.BHPLimit = BHPLimit;
|
|
|
|
|
properties.THPLimit = THPLimit;
|
2014-03-20 23:27:18 +01:00
|
|
|
properties.injectorType = injectorType;
|
|
|
|
|
properties.predictionMode = true;
|
2014-01-30 16:31:35 +01:00
|
|
|
|
|
|
|
|
if (record->getItem("RATE")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropInjectionControl(WellInjector::RATE);
|
2014-03-17 15:30:41 +01:00
|
|
|
else
|
|
|
|
|
properties.addInjectionControl(WellInjector::RATE);
|
2014-01-30 16:31:35 +01:00
|
|
|
|
|
|
|
|
if (record->getItem("RESV")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropInjectionControl(WellInjector::RESV);
|
2014-03-17 15:30:41 +01:00
|
|
|
else
|
|
|
|
|
properties.addInjectionControl(WellInjector::RESV);
|
|
|
|
|
|
2014-01-30 16:31:35 +01:00
|
|
|
if (record->getItem("THP")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropInjectionControl(WellInjector::THP);
|
2014-03-17 15:30:41 +01:00
|
|
|
else
|
|
|
|
|
properties.addInjectionControl(WellInjector::THP);
|
2014-01-30 16:31:35 +01:00
|
|
|
|
|
|
|
|
if (record->getItem("BHP")->defaultApplied())
|
2014-03-12 12:21:55 +01:00
|
|
|
properties.dropInjectionControl(WellInjector::BHP);
|
2014-03-17 15:30:41 +01:00
|
|
|
else
|
|
|
|
|
properties.addInjectionControl(WellInjector::BHP);
|
2014-03-03 15:00:42 +01:00
|
|
|
{
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& cmodeString = record->getItem("CMODE")->getTrimmedString(0);
|
2014-03-03 15:00:42 +01:00
|
|
|
WellInjector::ControlModeEnum controlMode = WellInjector::ControlModeFromString( cmodeString );
|
2014-03-12 12:21:55 +01:00
|
|
|
if (properties.hasInjectionControl( controlMode))
|
2014-03-21 00:05:02 +01:00
|
|
|
properties.controlMode = controlMode;
|
2014-03-03 15:00:42 +01:00
|
|
|
else {
|
|
|
|
|
throw std::invalid_argument("Tried to set invalid control: " + cmodeString + " for well: " + wellName);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-03-12 12:21:55 +01:00
|
|
|
well->setInjectionProperties(currentStep, properties);
|
2013-11-11 17:06:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-03 15:00:42 +01:00
|
|
|
|
2014-02-10 16:15:22 +01:00
|
|
|
void Schedule::handleWCONINJH(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep) {
|
2013-11-11 17:06:22 +01:00
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
|
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& wellName = record->getItem("WELL")->getTrimmedString(0);
|
2013-11-11 17:06:22 +01:00
|
|
|
WellPtr well = getWell(wellName);
|
2014-02-07 17:19:37 +01:00
|
|
|
|
2014-02-10 16:15:22 +01:00
|
|
|
// convert injection rates to SI
|
2014-04-03 14:15:13 +02:00
|
|
|
WellInjector::TypeEnum wellType = WellInjector::TypeFromString( record->getItem("TYPE")->getTrimmedString(0));
|
2014-02-10 16:15:22 +01:00
|
|
|
double injectionRate = record->getItem("RATE")->getRawDouble(0);
|
|
|
|
|
injectionRate = convertInjectionRateToSI(injectionRate, wellType, *deck->getActiveUnitSystem());
|
2014-02-07 17:19:37 +01:00
|
|
|
|
2014-04-03 14:15:13 +02:00
|
|
|
WellCommon::StatusEnum status = WellCommon::StatusFromString( record->getItem("STATUS")->getTrimmedString(0));
|
2014-02-10 16:15:22 +01:00
|
|
|
|
2014-01-29 15:55:02 +01:00
|
|
|
well->setStatus( currentStep , status );
|
2014-03-17 16:03:58 +01:00
|
|
|
WellInjectionProperties properties(well->getInjectionPropertiesCopy(currentStep));
|
2014-03-20 23:27:18 +01:00
|
|
|
properties.surfaceInjectionRate = injectionRate;
|
|
|
|
|
properties.predictionMode = false;
|
2014-03-10 16:54:05 +01:00
|
|
|
well->setInjectionProperties(currentStep, properties);
|
2013-11-11 17:06:22 +01:00
|
|
|
}
|
2013-11-08 15:55:11 +01:00
|
|
|
}
|
|
|
|
|
|
2014-02-04 16:12:49 +01:00
|
|
|
void Schedule::handleWELOPEN(DeckKeywordConstPtr keyword, size_t currentStep) {
|
|
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
|
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& wellName = record->getItem("WELL")->getTrimmedString(0);
|
2014-02-04 16:12:49 +01:00
|
|
|
WellPtr well = getWell(wellName);
|
|
|
|
|
|
|
|
|
|
for (size_t i=2; i<7; i++) {
|
|
|
|
|
if (record->getItem(i)->getInt(0) > 0 ) {
|
|
|
|
|
throw std::logic_error("Error processing WELOPEN keyword, specifying specific connections is not supported yet.");
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-04-03 14:15:13 +02:00
|
|
|
WellCommon::StatusEnum status = WellCommon::StatusFromString( record->getItem("STATUS")->getTrimmedString(0));
|
2014-02-04 16:12:49 +01:00
|
|
|
well->setStatus(currentStep, status);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-14 16:08:10 +01:00
|
|
|
|
2014-02-10 16:15:22 +01:00
|
|
|
void Schedule::handleGCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep) {
|
2013-11-18 16:06:50 +01:00
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
|
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& groupName = record->getItem("GROUP")->getTrimmedString(0);
|
2013-11-18 16:06:50 +01:00
|
|
|
GroupPtr group = getGroup(groupName);
|
|
|
|
|
|
|
|
|
|
{
|
2014-04-03 14:15:13 +02:00
|
|
|
Phase::PhaseEnum phase = Phase::PhaseEnumFromString( record->getItem("PHASE")->getTrimmedString(0) );
|
2013-11-18 16:06:50 +01:00
|
|
|
group->setInjectionPhase( currentStep , phase );
|
|
|
|
|
}
|
|
|
|
|
{
|
2014-04-03 14:15:13 +02:00
|
|
|
GroupInjection::ControlEnum controlMode = GroupInjection::ControlEnumFromString( record->getItem("CONTROL_MODE")->getTrimmedString(0) );
|
2013-11-18 16:06:50 +01:00
|
|
|
group->setInjectionControlMode( currentStep , controlMode );
|
|
|
|
|
}
|
2014-02-10 16:15:22 +01:00
|
|
|
|
2014-04-03 14:15:13 +02:00
|
|
|
Phase::PhaseEnum wellPhase = Phase::PhaseEnumFromString( record->getItem("PHASE")->getTrimmedString(0));
|
2014-02-10 16:15:22 +01:00
|
|
|
|
|
|
|
|
// calculate SI injection rates for the group
|
|
|
|
|
double surfaceInjectionRate = record->getItem("SURFACE_TARGET")->getRawDouble(0);
|
|
|
|
|
surfaceInjectionRate = convertInjectionRateToSI(surfaceInjectionRate, wellPhase, *deck->getActiveUnitSystem());
|
|
|
|
|
double reservoirInjectionRate = record->getItem("RESV_TARGET")->getRawDouble(0);
|
|
|
|
|
reservoirInjectionRate = convertInjectionRateToSI(reservoirInjectionRate, wellPhase, *deck->getActiveUnitSystem());
|
|
|
|
|
|
|
|
|
|
group->setSurfaceMaxRate( currentStep , surfaceInjectionRate);
|
|
|
|
|
group->setReservoirMaxRate( currentStep , reservoirInjectionRate);
|
|
|
|
|
group->setTargetReinjectFraction( currentStep , record->getItem("REINJ_TARGET")->getSIDouble(0));
|
|
|
|
|
group->setTargetVoidReplacementFraction( currentStep , record->getItem("VOIDAGE_TARGET")->getSIDouble(0));
|
2014-02-10 15:29:59 +01:00
|
|
|
|
|
|
|
|
group->setProductionGroup(currentStep, false);
|
2013-11-18 16:06:50 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-11-20 17:07:49 +01:00
|
|
|
void Schedule::handleGCONPROD(DeckKeywordConstPtr keyword, size_t currentStep) {
|
|
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
|
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& groupName = record->getItem("GROUP")->getTrimmedString(0);
|
2013-11-20 17:07:49 +01:00
|
|
|
GroupPtr group = getGroup(groupName);
|
|
|
|
|
{
|
2014-04-03 14:15:13 +02:00
|
|
|
GroupProduction::ControlEnum controlMode = GroupProduction::ControlEnumFromString( record->getItem("CONTROL_MODE")->getTrimmedString(0) );
|
2013-11-20 17:07:49 +01:00
|
|
|
group->setProductionControlMode( currentStep , controlMode );
|
|
|
|
|
}
|
2013-12-16 17:23:46 +01:00
|
|
|
group->setOilTargetRate( currentStep , record->getItem("OIL_TARGET")->getSIDouble(0));
|
|
|
|
|
group->setGasTargetRate( currentStep , record->getItem("GAS_TARGET")->getSIDouble(0));
|
|
|
|
|
group->setWaterTargetRate( currentStep , record->getItem("WATER_TARGET")->getSIDouble(0));
|
|
|
|
|
group->setLiquidTargetRate( currentStep , record->getItem("LIQUID_TARGET")->getSIDouble(0));
|
2013-11-20 17:07:49 +01:00
|
|
|
{
|
2014-04-03 14:15:13 +02:00
|
|
|
GroupProductionExceedLimit::ActionEnum exceedAction = GroupProductionExceedLimit::ActionEnumFromString(record->getItem("EXCEED_PROC")->getTrimmedString(0) );
|
2013-11-20 17:07:49 +01:00
|
|
|
group->setProductionExceedLimitAction( currentStep , exceedAction );
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-10 15:29:59 +01:00
|
|
|
group->setProductionGroup(currentStep, true);
|
2013-11-20 17:07:49 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-09 13:17:42 +01:00
|
|
|
void Schedule::handleCOMPDAT(DeckKeywordConstPtr keyword , size_t currentStep) {
|
2014-03-27 15:41:19 +01:00
|
|
|
std::map<std::string , std::vector< CompletionPtr> > completionMapList = Completion::completionsFromCOMPDATKeyword( keyword );
|
|
|
|
|
std::map<std::string , std::vector< CompletionPtr> >::iterator iter;
|
2013-11-09 13:17:42 +01:00
|
|
|
|
|
|
|
|
for( iter= completionMapList.begin(); iter != completionMapList.end(); iter++) {
|
|
|
|
|
const std::string wellName = iter->first;
|
2013-11-14 16:08:10 +01:00
|
|
|
WellPtr well = getWell(wellName);
|
|
|
|
|
well->addCompletions(currentStep, iter->second);
|
2013-11-09 13:17:42 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 16:10:31 +01:00
|
|
|
void Schedule::handleWGRUPCON(DeckKeywordConstPtr keyword, size_t currentStep) {
|
|
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
|
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& wellName = record->getItem("WELL")->getTrimmedString(0);
|
2014-02-17 16:10:31 +01:00
|
|
|
WellPtr well = getWell(wellName);
|
2014-02-19 15:43:42 +01:00
|
|
|
|
2014-04-03 14:15:13 +02:00
|
|
|
bool availableForGroupControl = convertEclipseStringToBool(record->getItem("GROUP_CONTROLLED")->getTrimmedString(0));
|
2014-02-19 15:43:42 +01:00
|
|
|
well->setAvailableForGroupControl(currentStep, availableForGroupControl);
|
|
|
|
|
|
|
|
|
|
well->setGuideRate(currentStep, record->getItem("GUIDE_RATE")->getRawDouble(0));
|
2014-02-21 12:48:36 +01:00
|
|
|
|
|
|
|
|
if (record->getItem("PHASE")->defaultApplied()) {
|
|
|
|
|
well->setGuideRatePhase(currentStep, GuideRate::UNDEFINED);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2014-04-03 14:15:13 +02:00
|
|
|
std::string guideRatePhase = record->getItem("PHASE")->getTrimmedString(0);
|
2014-02-21 12:48:36 +01:00
|
|
|
well->setGuideRatePhase(currentStep, GuideRate::GuideRatePhaseEnumFromString(guideRatePhase));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
well->setGuideRateScalingFactor(currentStep, record->getItem("SCALING_FACTOR")->getRawDouble(0));
|
2014-02-17 16:10:31 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-14 16:08:10 +01:00
|
|
|
void Schedule::handleGRUPTREE(DeckKeywordConstPtr keyword, size_t currentStep) {
|
|
|
|
|
GroupTreePtr currentTree = m_rootGroupTree->get(currentStep);
|
|
|
|
|
GroupTreePtr newTree = currentTree->deepCopy();
|
|
|
|
|
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
2013-11-18 15:28:58 +01:00
|
|
|
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
2014-04-03 14:15:13 +02:00
|
|
|
const std::string& childName = record->getItem("CHILD_GROUP")->getTrimmedString(0);
|
|
|
|
|
const std::string& parentName = record->getItem("PARENT_GROUP")->getTrimmedString(0);
|
2013-11-21 08:55:24 +01:00
|
|
|
newTree->updateTree(childName, parentName);
|
2014-03-03 13:29:02 +01:00
|
|
|
|
|
|
|
|
if (!hasGroup(parentName))
|
|
|
|
|
addGroup( parentName , currentStep );
|
|
|
|
|
|
|
|
|
|
if (!hasGroup(childName))
|
|
|
|
|
addGroup( childName , currentStep );
|
2013-11-14 16:08:10 +01:00
|
|
|
}
|
|
|
|
|
m_rootGroupTree->add(currentStep, newTree);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-25 17:28:56 +02:00
|
|
|
TimeMapConstPtr Schedule::getTimeMap() const {
|
|
|
|
|
return m_timeMap;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-14 16:08:10 +01:00
|
|
|
GroupTreePtr Schedule::getGroupTree(size_t timeStep) const {
|
|
|
|
|
return m_rootGroupTree->get(timeStep);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 14:52:30 +01:00
|
|
|
void Schedule::addWell(const std::string& wellName, DeckRecordConstPtr record, size_t timeStep) {
|
2014-01-29 11:48:02 +01:00
|
|
|
|
|
|
|
|
// We change from eclipse's 1 - n, to a 0 - n-1 solution
|
|
|
|
|
int headI = record->getItem("HEAD_I")->getInt(0) - 1;
|
|
|
|
|
int headJ = record->getItem("HEAD_J")->getInt(0) - 1;
|
2014-01-21 10:10:05 +01:00
|
|
|
double refDepth = record->getItem("REF_DEPTH")->getSIDouble(0);
|
2014-04-06 23:11:38 +02:00
|
|
|
Phase::PhaseEnum preferredPhase = Phase::PhaseEnumFromString(record->getItem("PHASE")->getTrimmedString(0));
|
|
|
|
|
WellPtr well(new Well(wellName, headI, headJ, refDepth, preferredPhase, m_timeMap , timeStep));
|
2013-11-05 17:58:57 +01:00
|
|
|
m_wells[ wellName ] = well;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-05 15:25:47 +01:00
|
|
|
size_t Schedule::numWells() const {
|
|
|
|
|
return m_wells.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Schedule::hasWell(const std::string& wellName) const {
|
2013-11-08 15:55:11 +01:00
|
|
|
return m_wells.find(wellName) != m_wells.end();
|
2013-11-05 15:25:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WellPtr Schedule::getWell(const std::string& wellName) const {
|
|
|
|
|
if (hasWell(wellName)) {
|
|
|
|
|
return m_wells.at(wellName);
|
2013-11-08 15:55:11 +01:00
|
|
|
} else
|
2013-11-05 15:25:47 +01:00
|
|
|
throw std::invalid_argument("Well: " + wellName + " does not exist");
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-22 14:40:10 +01:00
|
|
|
std::vector<WellConstPtr> Schedule::getWells() const {
|
|
|
|
|
return getWells(m_timeMap->size()-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<WellConstPtr> Schedule::getWells(size_t timeStep) const {
|
|
|
|
|
if (timeStep >= m_timeMap->size()) {
|
|
|
|
|
throw std::invalid_argument("Timestep to large");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<WellConstPtr> wells;
|
|
|
|
|
for (auto iter = m_wells.begin(); iter != m_wells.end(); ++iter) {
|
|
|
|
|
WellConstPtr well = (*iter).second;
|
|
|
|
|
if (well->hasBeenDefined(timeStep)) {
|
|
|
|
|
wells.push_back(well);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return wells;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 16:31:44 +01:00
|
|
|
void Schedule::addGroup(const std::string& groupName, size_t timeStep) {
|
2013-12-02 11:47:14 +01:00
|
|
|
if (!m_timeMap) {
|
|
|
|
|
throw std::invalid_argument("TimeMap is null, can't add group named: " + groupName);
|
|
|
|
|
}
|
2013-11-25 16:31:44 +01:00
|
|
|
GroupPtr group(new Group(groupName, m_timeMap , timeStep));
|
2013-11-18 13:11:49 +01:00
|
|
|
m_groups[ groupName ] = group;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t Schedule::numGroups() const {
|
|
|
|
|
return m_groups.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Schedule::hasGroup(const std::string& groupName) const {
|
|
|
|
|
return m_groups.find(groupName) != m_groups.end();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GroupPtr Schedule::getGroup(const std::string& groupName) const {
|
|
|
|
|
if (hasGroup(groupName)) {
|
|
|
|
|
return m_groups.at(groupName);
|
|
|
|
|
} else
|
|
|
|
|
throw std::invalid_argument("Group: " + groupName + " does not exist");
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-26 12:48:20 +01:00
|
|
|
void Schedule::addWellToGroup( GroupPtr newGroup , WellPtr well , size_t timeStep) {
|
|
|
|
|
const std::string currentGroupName = well->getGroupName(timeStep);
|
|
|
|
|
if (currentGroupName != "") {
|
|
|
|
|
GroupPtr currentGroup = getGroup( currentGroupName );
|
|
|
|
|
currentGroup->delWell( timeStep , well->name());
|
|
|
|
|
}
|
|
|
|
|
well->setGroupName(timeStep , newGroup->name());
|
|
|
|
|
newGroup->addWell(timeStep , well);
|
|
|
|
|
}
|
2013-11-18 13:11:49 +01:00
|
|
|
|
2013-11-05 15:25:47 +01:00
|
|
|
|
2014-02-10 16:15:22 +01:00
|
|
|
double Schedule::convertInjectionRateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem) const {
|
|
|
|
|
switch (wellType) {
|
|
|
|
|
case WellInjector::MULTI:
|
|
|
|
|
// multi-phase controlled injectors are a really funny
|
|
|
|
|
// construct in Eclipse: the quantity controlled for is
|
|
|
|
|
// not physically meaningful, i.e. Eclipse adds up
|
|
|
|
|
// MCFT/day and STB/day.
|
|
|
|
|
throw std::logic_error("There is no generic way to handle multi-phase injectors at this level!");
|
|
|
|
|
|
|
|
|
|
case WellInjector::OIL:
|
|
|
|
|
case WellInjector::WATER:
|
|
|
|
|
return rawRate * unitSystem.parse("LiquidVolume/Time")->getSIScaling();
|
|
|
|
|
|
|
|
|
|
case WellInjector::GAS:
|
|
|
|
|
return rawRate * unitSystem.parse("GasVolume/Time")->getSIScaling();
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
throw std::logic_error("Unknown injector type");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double Schedule::convertInjectionRateToSI(double rawRate, Phase::PhaseEnum wellPhase, const Opm::UnitSystem &unitSystem) const {
|
|
|
|
|
switch (wellPhase) {
|
|
|
|
|
case Phase::OIL:
|
|
|
|
|
case Phase::WATER:
|
|
|
|
|
return rawRate * unitSystem.parse("LiquidVolume/Time")->getSIScaling();
|
|
|
|
|
|
|
|
|
|
case Phase::GAS:
|
|
|
|
|
return rawRate * unitSystem.parse("GasVolume/Time")->getSIScaling();
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
throw std::logic_error("Unknown injection phase");
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-02-19 15:43:42 +01:00
|
|
|
|
|
|
|
|
bool Schedule::convertEclipseStringToBool(const std::string& eclipseString) {
|
|
|
|
|
std::string lowerTrimmed = boost::algorithm::to_lower_copy(eclipseString);
|
|
|
|
|
boost::algorithm::trim(lowerTrimmed);
|
|
|
|
|
|
|
|
|
|
if (lowerTrimmed == "y" || lowerTrimmed == "yes") {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (lowerTrimmed == "n" || lowerTrimmed == "no") {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else throw std::invalid_argument("String " + eclipseString + " not recognized as a boolean-convertible string.");
|
|
|
|
|
}
|
2013-10-25 17:28:56 +02:00
|
|
|
}
|