OPM-87, added code for handling keyword WELTARG.

This commit is contained in:
Edvin Brudevoll (ITV DIS RD) 2015-03-25 08:20:22 +01:00
parent 7afa65a230
commit 8ac548d564
5 changed files with 173 additions and 7 deletions

View File

@ -64,7 +64,6 @@ namespace Opm {
void Schedule::iterateScheduleSection(DeckConstPtr deck) {
size_t currentStep = 0;
std::vector<std::pair<DeckKeywordConstPtr , size_t> > rftProperties;
for (size_t keywordIdx = 0; keywordIdx < deck->size(); ++keywordIdx) {
@ -108,6 +107,9 @@ namespace Opm {
if (keyword->name() == "WELOPEN")
handleWELOPEN(keyword, currentStep , deck->hasKeyword("COMPLUMP"));
if (keyword->name() == "WELTARG")
handleWELTARG(keyword, currentStep);
if (keyword->name() == "GRUPTREE")
handleGRUPTREE(keyword, currentStep);
@ -185,7 +187,7 @@ namespace Opm {
m_rootGroupTree->add(currentStep, newTree);
}
}
void Schedule::checkWELSPECSConsistency(WellConstPtr well, DeckKeywordConstPtr keyword, size_t recordIdx) const {
DeckRecordConstPtr record = keyword->getRecord(recordIdx);
if (well->getHeadI() != record->getItem("HEAD_I")->getInt(0) - 1) {
@ -490,12 +492,82 @@ namespace Opm {
well->setStatus(currentStep, status);
}
}
}
}
void Schedule::handleWELTARG(DeckKeywordConstPtr keyword, size_t currentStep) {
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
DeckRecordConstPtr record = keyword->getRecord(recordNr);
const std::string& wellNamePattern = record->getItem("WELL")->getTrimmedString(0);
const std::string& cMode = record->getItem("CMODE")->getTrimmedString(0);
double newValue = record->getItem("NEW_VALUE")->getRawDouble(0);
const std::vector<WellPtr>& wells = getWells(wellNamePattern);
for (auto wellIter=wells.begin(); wellIter != wells.end(); ++wellIter) {
WellPtr well = *wellIter;
WellProductionProperties prop = well->getProductionPropertiesCopy(currentStep);
if (cMode == "ORAT"){
prop.OilRate = newValue;
}
else if (cMode == "WRAT"){
prop.WaterRate = newValue;
}
else if (cMode == "GRAT"){
prop.GasRate = newValue;
}
else if (cMode == "LRAT"){
prop.LiquidRate = newValue;
}
else if (cMode == "CRAT"){
prop.LinearlyCombinedRate = newValue;
}
else if (cMode == "RESV"){
prop.ResVRate = newValue;
}
else if (cMode == "BHP"){
prop.BHPLimit = newValue;
}
else if (cMode == "THP"){
prop.THPLimit = newValue;
}
else if (cMode == "VFP"){
prop.VFPTableNumber = newValue;
}
else if (cMode == "LIFT"){
prop.ArtificialLiftQuantity = newValue;
}
else if (cMode == "GUID"){
prop.GuideRate = newValue;
}
else if (cMode == "WGRA"){
prop.WetGasRate = newValue;
}
else if (cMode == "NGL"){
prop.NGLRate = newValue;
}
else if (cMode == "CVAL"){
prop.CalorificProductionRate = newValue;
}
else if (cMode == "REIN"){
prop.ReinjectionFraction = newValue;
}
else if (cMode == "STRA"){
prop.SteamRate = newValue;
}
else if (cMode == "SATP"){
prop.SaturationPressureOffset = newValue;
}
else if (cMode == "SATT"){
prop.SaturationTemperatureOffset = newValue;
}
well->setProductionProperties(currentStep, prop);
}
}
}
void Schedule::handleGCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep) {
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
@ -601,6 +673,9 @@ namespace Opm {
m_rootGroupTree->add(currentStep, newTree);
}
//
//
void Schedule::handleWRFT(DeckKeywordConstPtr keyword, size_t currentStep) {
/* Rule for handling RFT: Request current RFT data output for specified wells, plus output when

View File

@ -86,6 +86,7 @@ namespace Opm
void handleWPOLYMER(DeckKeywordConstPtr keyword, size_t currentStep);
void handleWCONINJH(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep);
void handleWELOPEN(DeckKeywordConstPtr keyword, size_t currentStep, bool hascomplump);
void handleWELTARG(DeckKeywordConstPtr keyword, size_t currentStep);
void handleGCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep);
void handleGCONPROD(DeckKeywordConstPtr keyword, size_t currentStep);
void handleDATES(DeckKeywordConstPtr keyword);

View File

@ -118,9 +118,20 @@ namespace Opm {
GasRate = 0.0;
WaterRate = 0.0;
LiquidRate = 0.0;
LinearlyCombinedRate = 0.0;
ResVRate = 0.0;
BHPLimit = 0.0;
THPLimit = 0.0;
VFPTableNumber = 0.0;
ArtificialLiftQuantity = 0.0;
GuideRate = 0.0;
WetGasRate = 0.0;
NGLRate = 0.0;
CalorificProductionRate = 0.0;
ReinjectionFraction = 0.0;
SteamRate = 0.0;
SaturationPressureOffset = 0.0;
SaturationTemperatureOffset = 0.0;
controlMode = WellProducer::CMODE_UNDEFINED;
m_productionControls = 0;

View File

@ -29,9 +29,20 @@ namespace Opm {
double GasRate;
double WaterRate;
double LiquidRate;
double LinearlyCombinedRate;
double ResVRate;
double BHPLimit;
double THPLimit;
double VFPTableNumber;
double ArtificialLiftQuantity;
double GuideRate;
double WetGasRate;
double NGLRate;
double CalorificProductionRate;
double ReinjectionFraction;
double SteamRate;
double SaturationPressureOffset;
double SaturationTemperatureOffset;
bool predictionMode;
WellProducer::ControlModeEnum controlMode;

View File

@ -339,7 +339,6 @@ static DeckPtr createDeckWithWellsAndCompletionDataWithWELOPEN() {
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndCompletionDataWithWELOPEN) {
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,10);
DeckPtr deck = createDeckWithWellsAndCompletionDataWithWELOPEN();
@ -694,7 +693,6 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) {
"WELOPEN\n"
" 'OP_1' OPEN / \n"
"/\n"
"COMPLUMP\n"
" 'OP_1' 0 0 0 0 0 / \n "
"/\n"
@ -708,7 +706,6 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) {
WellPtr well;
well = schedule.getWell("OP_1");
size_t currentStep = 3;
BOOST_CHECK_EQUAL(well->getRFTActive(currentStep),false);
currentStep = 4;
@ -718,3 +715,74 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) {
BOOST_CHECK_EQUAL(well->getRFTActive(currentStep),false);
}
BOOST_AUTO_TEST_CASE(createDeckWithWeltArg) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
"SCHEDULE\n"
"DATES -- 1\n"
" 10 OKT 2008 / \n"
"/\n"
"WELSPECS\n"
" 'OP_1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
"/\n"
"COMPDAT\n"
" 'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
" 'OP_1' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
"/\n"
"DATES -- 2\n"
" 20 JAN 2010 / \n"
"/\n"
"WELTARG\n"
" OP_1 ORAT 1300 /\n"
" OP_1 WRAT 1400 /\n"
" OP_1 GRAT 1500 /\n"
" OP_1 LRAT 1600.58 /\n"
" OP_1 CRAT 1722.15 /\n"
" OP_1 RESV 1801.05 /\n"
" OP_1 BHP 1900 /\n"
" OP_1 THP 2000 /\n"
" OP_1 VFP 2100 /\n"
" OP_1 LIFT 2200 /\n"
" OP_1 GUID 2300 /\n"
" OP_1 WGRA 2490.09 /\n"
" OP_1 NGL 2519.51 /\n"
" OP_1 CVAL 2600 /\n"
" OP_1 REIN 2700 /\n"
" OP_1 STRA 2800 /\n"
" OP_1 SATP 2900 /\n"
" OP_1 SATT 3000 /\n"
"/\n";
DeckPtr deck = parser.parseString(input);
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
Schedule schedule(grid , deck);
WellPtr well = schedule.getWell("OP_1");
size_t currentStep = 1;
WellProductionProperties wpp = well->getProductionProperties(currentStep);
BOOST_CHECK_EQUAL(wpp.WaterRate,0);
currentStep = 2;
wpp = well->getProductionProperties(currentStep);
BOOST_CHECK_EQUAL(wpp.OilRate, 1300);
BOOST_CHECK_EQUAL(wpp.WaterRate, 1400);
BOOST_CHECK_EQUAL(wpp.GasRate, 1500);
BOOST_CHECK_EQUAL(wpp.LiquidRate, 1600.58);
BOOST_CHECK_EQUAL(wpp.LinearlyCombinedRate, 1722.15);
BOOST_CHECK_EQUAL(wpp.ResVRate, 1801.05);
BOOST_CHECK_EQUAL(wpp.BHPLimit, 1900);
BOOST_CHECK_EQUAL(wpp.THPLimit, 2000);
BOOST_CHECK_EQUAL(wpp.VFPTableNumber, 2100);
BOOST_CHECK_EQUAL(wpp.ArtificialLiftQuantity, 2200);
BOOST_CHECK_EQUAL(wpp.GuideRate, 2300);
BOOST_CHECK_EQUAL(wpp.WetGasRate, 2490.09);
BOOST_CHECK_EQUAL(wpp.NGLRate, 2519.51);
BOOST_CHECK_EQUAL(wpp.CalorificProductionRate, 2600);
BOOST_CHECK_EQUAL(wpp.ReinjectionFraction, 2700);
BOOST_CHECK_EQUAL(wpp.SteamRate, 2800);
BOOST_CHECK_EQUAL(wpp.SaturationPressureOffset, 2900);
BOOST_CHECK_EQUAL(wpp.SaturationTemperatureOffset, 3000);
}