From bae2fa4b3afb03dcef72bf6fea0ac4e537d8297b Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 3 Mar 2015 11:44:40 +0100 Subject: [PATCH] Updated VFPPROD keyword to include records. --- .../eclipse/IntegrationTests/ParseVFPPROD.cpp | 132 ++++++++++++++++++ .../share/keywords/000_Eclipse100/V/VFPPROD | 35 +++-- 2 files changed, 153 insertions(+), 14 deletions(-) diff --git a/opm/parser/eclipse/IntegrationTests/ParseVFPPROD.cpp b/opm/parser/eclipse/IntegrationTests/ParseVFPPROD.cpp index ce037c0dd..59f66c264 100644 --- a/opm/parser/eclipse/IntegrationTests/ParseVFPPROD.cpp +++ b/opm/parser/eclipse/IntegrationTests/ParseVFPPROD.cpp @@ -49,4 +49,136 @@ BOOST_AUTO_TEST_CASE( parse_VFPPROD_OK ) { BOOST_CHECK_EQUAL( 573U , VFPPROD1->size() ); BOOST_CHECK_EQUAL( 1U , BPR->size()); BOOST_CHECK_EQUAL( 573U , VFPPROD2->size()); + + { + auto record = VFPPROD1->getRecord(0); + { + auto item = record->getItem("TABLE"); + BOOST_CHECK_EQUAL( item->getInt(0) , 32 ); + } + + { + auto item = record->getItem("DATUM_DEPTH"); + BOOST_CHECK_EQUAL( item->getSIDouble(0) , 394); + } + + { + auto item = record->getItem("RATE_TYPE"); + BOOST_CHECK_EQUAL( item->getString(0) , "LIQ"); + } + + + { + auto item = record->getItem("WFR"); + BOOST_CHECK_EQUAL( item->getString(0) , "WCT"); + } + + { + auto item = record->getItem("GFR"); + BOOST_CHECK_EQUAL( item->getString(0) , "GOR"); + } + } + { + auto record = VFPPROD1->getRecord(1); + auto item = record->getItem("FLOW_VALUES"); + + BOOST_CHECK_EQUAL( item->size() , 12 ); + BOOST_CHECK_EQUAL( item->getRawDouble(0) , 100 ); + BOOST_CHECK_EQUAL( item->getRawDouble(11) , 20000 ); + } + + { + auto record = VFPPROD1->getRecord(4); + auto item = record->getItem("GFR_VALUES"); + + BOOST_CHECK_EQUAL( item->size() , 9 ); + BOOST_CHECK_EQUAL( item->getRawDouble(0) , 90 ); + BOOST_CHECK_EQUAL( item->getRawDouble(8) , 10000 ); + } + + { + auto record = VFPPROD1->getRecord(4); + auto item = record->getItem("GFR_VALUES"); + + BOOST_CHECK_EQUAL( item->size() , 9 ); + BOOST_CHECK_EQUAL( item->getRawDouble(0) , 90 ); + BOOST_CHECK_EQUAL( item->getRawDouble(8) , 10000 ); + } + + { + auto record = VFPPROD1->getRecord(4); + auto item = record->getItem("GFR_VALUES"); + + BOOST_CHECK_EQUAL( item->size() , 9 ); + BOOST_CHECK_EQUAL( item->getRawDouble(0) , 90 ); + BOOST_CHECK_EQUAL( item->getRawDouble(8) , 10000 ); + } + + { + auto record = VFPPROD1->getRecord(5); + auto item = record->getItem("ALQ_VALUES"); + + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getRawDouble(0) , 0 ); + } + + { + auto record = VFPPROD1->getRecord(6); + { + auto item = record->getItem("THP_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 1 ); + } + { + auto item = record->getItem("WFR_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 1 ); + } + { + auto item = record->getItem("GFR_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 1 ); + } + { + auto item = record->getItem("ALQ_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 1 ); + } + { + auto item = record->getItem("VALUES"); + BOOST_CHECK_EQUAL( item->size() , 12 ); + BOOST_CHECK_EQUAL( item->getRawDouble(0) , 44.85 ); + BOOST_CHECK_EQUAL( item->getRawDouble(11) , 115.14 ); + } + } + + { + auto record = VFPPROD1->getRecord(572); + { + auto item = record->getItem("THP_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 7 ); + } + { + auto item = record->getItem("WFR_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 9 ); + } + { + auto item = record->getItem("GFR_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 9 ); + } + { + auto item = record->getItem("ALQ_INDEX"); + BOOST_CHECK_EQUAL( item->size() , 1 ); + BOOST_CHECK_EQUAL( item->getInt(0) , 1 ); + } + { + auto item = record->getItem("VALUES"); + BOOST_CHECK_EQUAL( item->size() , 12 ); + BOOST_CHECK_EQUAL( item->getRawDouble(0) , 100.80 ); + BOOST_CHECK_EQUAL( item->getRawDouble(11) , 147.79 ); + } + } } diff --git a/opm/parser/share/keywords/000_Eclipse100/V/VFPPROD b/opm/parser/share/keywords/000_Eclipse100/V/VFPPROD index 041a51881..540cc51aa 100644 --- a/opm/parser/share/keywords/000_Eclipse100/V/VFPPROD +++ b/opm/parser/share/keywords/000_Eclipse100/V/VFPPROD @@ -1,17 +1,24 @@ {"name" : "VFPPROD" , "sections" : ["SCHEDULE"], "size" : "UNKNOWN" , - "items" : [{"name" : "STRING" , "value_type" : "STRING" , "size_type" : "ALL"}], - "comments" : [ -"The VFPPROD/VFPINJ keywords break the keyword model in two ways: ", -" ", -" 1. The total number of records is given as an arithmetic expression involving ", -" the number of items in the first couple of records. Such dependency is not ", -" properly supported in the parser code, the support is based on the size ", -" UNKNOWN which is interpreted as continue reading records until: ", -" a) Another known keyword appears. ", -" b) EOF ", -" ", -" 2. The different records have different item definitions; we therefor do not ", -" really internalize these properly - in the deck they are just a list of ", -" strings. "]} + "records" : [ +[{"name" : "TABLE" , "value_type" : "INT"}, + {"name" : "DATUM_DEPTH" , "value_type" : "DOUBLE" , "dimension" : "Length"}, + {"name" : "RATE_TYPE" , "value_type" : "STRING"}, + {"name" : "WFR" , "value_type" : "STRING"}, + {"name" : "GFR" , "value_type" : "STRING"}, + {"name" : "PRESSURE_DEF" , "value_type" : "STRING" , "default" : "THP"}, + {"name" : "ALQ_DEF" , "value_type" : "STRING" , "default" : "THP"}, + {"name" : "UNITS" , "value_type" : "STRING"}, + {"name" : "BODY_DEF" , "value_type" : "STRING" , "default" : "BHP"}], +[{"name" : "FLOW_VALUES" , "value_type" : "DOUBLE" , "dimension" : "Density", "size_type" : "ALL"}], +[{"name" : "THP_VALUES" , "value_type" : "DOUBLE" , "dimension" : "Pressure", "size_type" : "ALL"}], +[{"name" : "WFR_VALUES" , "value_type" : "DOUBLE" , "size_type" : "ALL"}], +[{"name" : "GFR_VALUES" , "value_type" : "DOUBLE" , "size_type" : "ALL"}], +[{"name" : "ALQ_VALUES" , "value_type" : "DOUBLE" , "size_type" : "ALL"}], +[{"name" : "THP_INDEX" , "value_type" : "INT"}, + {"name" : "WFR_INDEX" , "value_type" : "INT"}, + {"name" : "GFR_INDEX" , "value_type" : "INT"}, + {"name" : "ALQ_INDEX" , "value_type" : "INT"}, + {"name" : "VALUES" , "value_type" : "DOUBLE" , "size_type" : "ALL"}] +]}