Added VFPInjTable

This commit is contained in:
babrodtk
2015-07-03 08:53:22 +02:00
parent 08d5a92ae1
commit c87b21f328
7 changed files with 814 additions and 8 deletions

View File

@@ -0,0 +1,316 @@
/*
Copyright 2015 SINTEF ICT, Applied Mathematics.
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/>.
*/
#include <opm/parser/eclipse/EclipseState/Tables/VFPInjTable.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords.hpp>
//Anonymous namespace
namespace {
/**
* Trivial helper function that throws if a zero-sized item is found.
*/
template <typename T>
inline Opm::DeckItemPtr getNonEmptyItem(Opm::DeckRecordConstPtr record) {
auto retval = record->getItem<T>();
if (retval->size() == 0) {
throw std::invalid_argument("Zero-sized record found where non-empty record expected");
}
return retval;
}
} //Namespace
namespace Opm {
void VFPInjTable::init(int table_num,
double datum_depth,
FLO_TYPE flo_type,
const std::vector<double>& flo_data,
const std::vector<double>& thp_data,
const array_type& data) {
m_table_num = table_num;
m_datum_depth = datum_depth;
m_flo_type = flo_type;
m_flo_data = flo_data;
m_thp_data = thp_data;
extents shape;
shape[0] = data.shape()[0];
shape[1] = data.shape()[1];
m_data.resize(shape);
m_data = data;
check();
}
void VFPInjTable::init(DeckKeywordConstPtr table, std::shared_ptr<Opm::UnitSystem> deck_unit_system) {
using ParserKeywords::VFPINJ;
//Check that the table has enough records
if (table->size() < 4) {
throw std::invalid_argument("VFPINJ table does not appear to have enough records to be valid");
}
//Get record 1, the metadata for the table
auto header = table->getRecord(0);
//Get the different header items
m_table_num = getNonEmptyItem<VFPINJ::TABLE>(header)->getInt(0);
m_datum_depth = getNonEmptyItem<VFPINJ::DATUM_DEPTH>(header)->getSIDouble(0);
m_flo_type = getFloType(getNonEmptyItem<VFPINJ::RATE_TYPE>(header)->getString(0));
//Not used, but check that PRESSURE_DEF is indeed THP
std::string quantity_string = getNonEmptyItem<VFPINJ::PRESSURE_DEF>(header)->getString(0);
if (quantity_string != "THP") {
throw std::invalid_argument("PRESSURE_DEF is required to be THP");
}
//Check units used for this table
std::string units_string = "";
try {
units_string = getNonEmptyItem<VFPINJ::UNITS>(header)->getString(0);
}
catch (...) {
//If units does not exist in record, the default value is the
//unit system of the deck itself: do nothing...
}
if (units_string != "") {
UnitSystem::UnitType table_unit_type;
//FIXME: Only metric and field supported at the moment.
//Need to change all of the convertToSI functions to support LAB/PVT-M
if (units_string == "METRIC") {
table_unit_type = UnitSystem::UNIT_TYPE_METRIC;
}
else if (units_string == "FIELD") {
table_unit_type = UnitSystem::UNIT_TYPE_FIELD;
}
else if (units_string == "LAB") {
throw std::invalid_argument("Unsupported UNITS string: 'LAB'");
}
else if (units_string == "PVT-M") {
throw std::invalid_argument("Unsupported UNITS string: 'PVT-M'");
}
else {
throw std::invalid_argument("Invalid UNITS string");
}
//Sanity check
if(table_unit_type != deck_unit_system->getType()) {
throw std::invalid_argument("Deck units are not equal VFPINJ table units.");
}
}
//Quantity in the body of the table
std::string body_string = getNonEmptyItem<VFPINJ::BODY_DEF>(header)->getString(0);
if (body_string != "BHP") {
throw std::invalid_argument("Invalid BODY_DEF string");
}
//Get actual rate / flow values
m_flo_data = getNonEmptyItem<VFPINJ::FLOW_VALUES>(table->getRecord(1))->getRawDoubleData();
convertFloToSI(m_flo_type, m_flo_data, deck_unit_system);
//Get actual tubing head pressure values
m_thp_data = getNonEmptyItem<VFPINJ::THP_VALUES>(table->getRecord(2))->getRawDoubleData();
convertTHPToSI(m_thp_data, deck_unit_system);
//Finally, read the actual table itself.
size_t nt = m_thp_data.size();
size_t nf = m_flo_data.size();
extents shape;
shape[0] = nt;
shape[1] = nf;
m_data.resize(shape);
std::fill_n(m_data.data(), m_data.num_elements(), std::nan("0"));
//Check that size of table matches size of axis:
if (table->size() != nt + 3) {
throw std::invalid_argument("VFPINJ table does not contain enough records.");
}
const double table_scaling_factor = deck_unit_system->parse("Pressure")->getSIScaling();
for (int i=3; i<table->size(); ++i) {
const auto& record = table->getRecord(i);
//Get indices (subtract 1 to get 0-based index)
int t = getNonEmptyItem<VFPINJ::THP_INDEX>(record)->getInt(0) - 1;
//Rest of values (bottom hole pressure or tubing head temperature) have index of flo value
const std::vector<double>& bhp_tht = getNonEmptyItem<VFPINJ::VALUES>(record)->getRawDoubleData();
if (bhp_tht.size() != nf) {
throw std::invalid_argument("VFPINJ table does not contain enough FLO values.");
}
for (unsigned int f=0; f<bhp_tht.size(); ++f) {
const double& value = bhp_tht[f];
if (value > 1.0e10) {
//TODO: Replace with proper log message
std::cerr << "Too large value encountered in VFPINJ in ["
<< t << "," << f << "]=" << value << std::endl;
}
m_data[t][f] = table_scaling_factor*value;
}
}
check();
}
void VFPInjTable::check() {
//Table number
assert(m_table_num > 0);
//Misc types
assert(m_flo_type >= FLO_OIL && m_flo_type < FLO_INVALID);
//Data axis size
assert(m_flo_data.size() > 0);
assert(m_thp_data.size() > 0);
//Data axis sorted?
assert(is_sorted(m_flo_data.begin(), m_flo_data.end()));
assert(is_sorted(m_thp_data.begin(), m_thp_data.end()));
//Check data size matches axes
assert(m_data.num_dimensions() == 2);
assert(m_data.shape()[0] == m_thp_data.size());
assert(m_data.shape()[1] == m_flo_data.size());
//Finally, check that all data is within reasonable ranges, defined to be up-to 1.0e10...
typedef array_type::size_type size_type;
for (size_type t=0; t<m_data.shape()[0]; ++t) {
for (size_type f=0; f<m_data.shape()[1]; ++f) {
if (std::isnan(m_data[t][f])) {
//TODO: Replace with proper log message
std::cerr << "VFPINJ element [" << t << "," << f << "] not set!" << std::endl;
throw std::invalid_argument("Missing VFPINJ value");
}
}
}
}
VFPInjTable::FLO_TYPE VFPInjTable::getFloType(std::string flo_string) {
if (flo_string == "OIL") {
return FLO_OIL;
}
else if (flo_string == "WAT") {
return FLO_WAT;
}
else if (flo_string == "GAS") {
return FLO_GAS;
}
else {
throw std::invalid_argument("Invalid RATE_TYPE string");
}
return FLO_INVALID;
}
void VFPInjTable::scaleValues(std::vector<double>& values,
const double& scaling_factor) {
if (scaling_factor == 1.0) {
return;
}
else {
for (unsigned int i=0; i<values.size(); ++i) {
values[i] *= scaling_factor;
}
}
}
void VFPInjTable::convertFloToSI(const FLO_TYPE& type,
std::vector<double>& values,
std::shared_ptr<Opm::UnitSystem> unit_system) {
double scaling_factor = 1.0;
switch (type) {
case FLO_OIL:
case FLO_WAT:
scaling_factor = unit_system->parse("LiquidSurfaceVolume/Time")->getSIScaling();
break;
case FLO_GAS:
scaling_factor = unit_system->parse("GasSurfaceVolume/Time")->getSIScaling();
break;
default:
throw std::logic_error("Invalid FLO type");
}
scaleValues(values, scaling_factor);
}
void VFPInjTable::convertTHPToSI(std::vector<double>& values,
std::shared_ptr<Opm::UnitSystem> unit_system) {
double scaling_factor = unit_system->parse("Pressure")->getSIScaling();
scaleValues(values, scaling_factor);
}
} //Namespace

View File

@@ -0,0 +1,170 @@
/*
Copyright 2015 SINTEF ICT, Applied Mathematics.
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 OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPINJTABLE_HPP_
#define OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPINJTABLE_HPP_
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <boost/multi_array.hpp>
namespace Opm {
/**
* Class for reading data from a VFPINJ (vertical flow performance injection) table
*/
class VFPInjTable {
public:
typedef boost::multi_array<double, 2> array_type;
typedef boost::array<array_type::index, 2> extents;
///Rate type
enum FLO_TYPE {
FLO_OIL=1, //< Oil rate
FLO_WAT, //< Water rate
FLO_GAS, //< Gas rate
FLO_INVALID
};
/**
* Constructor
*/
inline VFPInjTable() : m_table_num(-1),
m_datum_depth(-1),
m_flo_type(FLO_INVALID) {
}
/**
* Initializes objects from raw data. NOTE: All raw data assumed to be in SI units
* @param table_num VFP table number
* @param datum_depth Reference depth for BHP
* @param flo_type Specifies what flo_data represents
* @param flo_data Axis for flo_type
* @param thp_data Axis for thp_type
* @param data BHP to be interpolated. Given as a 2D array so that
* BHP = data[thp][flo] for the indices thp, flo.
*/
void init(int table_num,
double datum_depth,
FLO_TYPE flo_type,
const std::vector<double>& flo_data,
const std::vector<double>& thp_data,
const array_type& data);
/**
* Constructor which parses a deck keyword and retrieves the relevant parts for a
* VFP table.
*/
void init(DeckKeywordConstPtr table, std::shared_ptr<Opm::UnitSystem> deck_unit_system);
/**
* Returns the table number
* @return table number
*/
inline int getTableNum() const {
return m_table_num;
}
/**
* Returns the datum depth for the table data
* @return datum depth
*/
inline double getDatumDepth() const {
return m_datum_depth;
}
/**
* Returns the rate/flo type for the flo axis
* @return flo type
*/
inline FLO_TYPE getFloType() const {
return m_flo_type;
}
/**
* Returns the coordinates of the FLO sample points in the table
* @return Flo sample coordinates
*/
inline const std::vector<double>& getFloAxis() const {
return m_flo_data;
}
/**
* Returns the coordinates for the tubing head pressure sample points in the table
* @return Tubing head pressure coordinates
*/
inline const std::vector<double>& getTHPAxis() const {
return m_thp_data;
}
/**
* Returns the data of the table itself. The data is ordered so that
*
* table = getTable();
* bhp = table[thp_idx][flo_idx];
*
* gives the bottom hole pressure value in the table for the coordinate
* given by
* flo_axis = getFloAxis();
* thp_axis = getTHPAxis();
*
* flo_coord = flo_axis(flo_idx);
* thp_coord = thp_axis(thp_idx);
*/
inline const array_type& getTable() const {
return m_data;
}
private:
//"Header" variables
int m_table_num;
double m_datum_depth;
FLO_TYPE m_flo_type;
//The actual table axes
std::vector<double> m_flo_data;
std::vector<double> m_thp_data;
//The data itself, using the data ordering m_data[thp][flo]
array_type m_data;
/**
* Debug function that runs a series of asserts to check for sanity of inputs.
* Called after init to check that everything looks ok.
*/
void check();
static FLO_TYPE getFloType(std::string flo_string);
static void scaleValues(std::vector<double>& values,
const double& scaling_factor);
static void convertFloToSI(const FLO_TYPE& type,
std::vector<double>& values,
std::shared_ptr<Opm::UnitSystem> unit_system);
static void convertTHPToSI(std::vector<double>& values,
std::shared_ptr<Opm::UnitSystem> unit_system);
};
} //Namespace Opm
#endif /* OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPINJTABLE_HPP_ */

View File

@@ -1,5 +1,23 @@
#include <opm/parser/eclipse/EclipseState/Tables/VFPProdTable.hpp>
/*
Copyright 2015 SINTEF ICT, Applied Mathematics.
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/>.
*/
#include <opm/parser/eclipse/EclipseState/Tables/VFPProdTable.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords.hpp>
@@ -179,6 +197,7 @@ void VFPProdTable::init(DeckKeywordConstPtr table, std::shared_ptr<Opm::UnitSyst
shape[3] = na;
shape[4] = nf;
m_data.resize(shape);
std::fill_n(m_data.data(), m_data.num_elements(), std::nan("0"));
//Check that size of table matches size of axis:
if (table->size() != nt*nw*ng*na + 6) {
@@ -257,11 +276,12 @@ void VFPProdTable::check() {
for (size_type g=0; g<m_data.shape()[2]; ++g) {
for (size_type a=0; a<m_data.shape()[3]; ++a) {
for (size_type f=0; f<m_data.shape()[4]; ++f) {
if (m_data[t][w][g][a][f] > 1.0e10) {
if (std::isnan(m_data[t][w][g][a][f])) {
//TODO: Replace with proper log message
std::cerr << "Too large value encountered in VFPPROD in ["
<< t << "," << w << "," << g << "," << a << "," << f << "]="
<< m_data[t][w][g][a][f] << std::endl;
std::cerr << "VFPPROD element ["
<< t << "," << w << "," << g << "," << a << "," << f
<< "] not set!" << std::endl;
throw std::invalid_argument("Missing VFPPROD value");
}
}
}

View File

@@ -92,7 +92,7 @@ public:
* @param gfr_type Specifies what gfr_data represents
* @param alq_type Specifies what alq_data represents
* @param flo_data Axis for flo_type
* @param thp_data Axis for thp_type
* @param thp_data Axis for tubing head pressure
* @param wfr_data Axis for wfr_type
* @param gfr_data Axis for gfr_type
* @param alq_data Axis for alq_type

View File

@@ -33,6 +33,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/SgofTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlyadsTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/VFPProdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/VFPInjTable.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
@@ -647,6 +648,43 @@ VFPPROD \n\
}
/**
* Missing value in table #2
*/
{
const char *missing_values = "\
VFPPROD \n\
-- Table Depth Rate WFR GFR \n\
-- ----- ----- ----- ----- ----- \n\
5 32.9 'LIQ' 'WCT' 'GOR' / \n\
-- Rate axis \n\
1 / \n\
-- THP axis \n\
7 9 / \n\
-- WFR axis \n\
13 / \n\
-- GFR axis \n\
19 / \n\
-- ALQ axis \n\
29 / \n\
-- Table data with THP# WFR# GFR# ALQ# <values 1-num_rates> \n\
-- Will fail, as two entries are required \n\
1 1 1 1 1.5 / \n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(missing_values));
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck->numKeywords("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, units), std::invalid_argument);
}
/**
* Missing items in header
*/
@@ -751,3 +789,254 @@ VFPPROD \n\
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, units), std::invalid_argument);
}
}
/**
* Tests "happy path" for a VFPPROD table, i.e., when everything goes well
*/
BOOST_AUTO_TEST_CASE(VFPInjTable_happy_Test) {
const char *deckData = "\
VFPINJ \n\
-- Table Depth Rate TAB UNITS BODY \n\
-- ----- ----- ----- ----- ------ ----- \n\
5 32.9 WAT THP METRIC BHP / \n\
-- Rate axis \n\
1 3 5 / \n\
-- THP axis \n\
7 11 / \n\
-- Table data with THP# <values 1-num_rates> \n\
1 1.5 2.5 3.5 / \n\
2 4.5 5.5 6.5 / \n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(deckData));
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
Opm::VFPInjTable vfpinjTable;
vfpinjTable.init(vfpprodKeyword, units);
BOOST_CHECK_EQUAL(vfpinjTable.getTableNum(), 5);
BOOST_CHECK_EQUAL(vfpinjTable.getDatumDepth(), 32.9);
BOOST_CHECK_EQUAL(vfpinjTable.getFloType(), Opm::VFPInjTable::FLO_WAT);
//Flo axis
{
const std::vector<double>& flo = vfpinjTable.getFloAxis();
BOOST_REQUIRE_EQUAL(flo.size(), 3);
//Unit of FLO is SM3/day, convert to SM3/second
double conversion_factor = 1.0 / (60*60*24);
BOOST_CHECK_EQUAL(flo[0], 1*conversion_factor);
BOOST_CHECK_EQUAL(flo[1], 3*conversion_factor);
BOOST_CHECK_EQUAL(flo[2], 5*conversion_factor);
}
//THP axis
{
const std::vector<double>& thp = vfpinjTable.getTHPAxis();
BOOST_REQUIRE_EQUAL(thp.size(), 2);
//Unit of THP is barsa => convert to pascal
double conversion_factor = 100000.0;
BOOST_CHECK_EQUAL(thp[0], 7*conversion_factor);
BOOST_CHECK_EQUAL(thp[1], 11*conversion_factor);
}
//The data itself
{
typedef Opm::VFPInjTable::array_type::size_type size_type;
const Opm::VFPInjTable::array_type& data = vfpinjTable.getTable();
const size_type* size = data.shape();
BOOST_CHECK_EQUAL(size[0], 2);
BOOST_CHECK_EQUAL(size[1], 3);
//Table given as BHP => barsa. Convert to pascal
double conversion_factor = 100000.0;
double index = 0.5;
for (size_type t=0; t<size[0]; ++t) {
for (size_type f=0; f<size[1]; ++f) {
index += 1.0;
BOOST_CHECK_EQUAL(data[t][f], index*conversion_factor);
}
}
}
}
/**
* Spot checks that the VFPPROD table will fail nicely when given invalid data
*/
BOOST_AUTO_TEST_CASE(VFPInjTable_sad_Test) {
/**
* Missing value in table
*/
{
const char *missing_values = "\
VFPINJ \n\
-- Table Depth Rate TAB UNITS BODY \n\
-- ----- ----- ----- ----- ------ ----- \n\
5 32.9 WAT THP METRIC BHP / \n\
-- Rate axis \n\
1 3 5 / \n\
-- THP axis \n\
7 11 / \n\
-- Table data with THP# <values 1-num_rates> \n\
-- Will fail, as rate axis requires three elements \n\
1 1.5 2.5 / \n\
2 4.5 5.5 / \n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(missing_values));
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
/**
* Missing value in table #2
*/
{
const char *missing_values = "\
VFPINJ \n\
-- Table Depth Rate TAB UNITS BODY \n\
-- ----- ----- ----- ----- ------ ----- \n\
5 32.9 WAT THP METRIC BHP / \n\
-- Rate axis \n\
1 3 5 / \n\
-- THP axis \n\
7 11 / \n\
-- Table data with THP# <values 1-num_rates> \n\
-- Will fail, as two entries are required \n\
1 1.5 2.5 3.5 / \n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(missing_values));
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
/**
* Missing items in header
*/
{
const char *missing_metadata = "\
VFPINJ \n\
-- Table Depth \n\
-- ----- ----- \n\
5 32.9 / \n\
-- Rate axis \n\
1 3 5 / \n\
-- THP axis \n\
7 11 / \n\
-- Table data with THP# <values 1-num_rates> \n\
1 1.5 2.5 3.5 / \n\
2 4.5 5.5 6.5 / \n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(missing_metadata));
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
/**
* Wrong items in header
*/
{
const char *wrong_metadata = "\
VFPINJ \n\
-- Table Depth Rate TAB UNITS BODY \n\
-- ----- ----- ----- ----- ------ ----- \n\
5 32.9 GOR BHP FOO GAGA / \n\
-- Rate axis \n\
1 3 5 / \n\
-- THP axis \n\
7 11 / \n\
-- Table data with THP# <values 1-num_rates> \n\
1 1.5 2.5 3.5 / \n\
2 4.5 5.5 6.5 / \n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(wrong_metadata));
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
/**
* Wrong axes in header
*/
{
const char *missing_axes = "\
VFPINJ \n\
-- Table Depth Rate TAB UNITS BODY \n\
-- ----- ----- ----- ----- ------ ----- \n\
5 32.9 WAT THP METRIC BHP / \n\
-- Rate axis \n\
1 3 5 / \n\
-- THP axis \n\
-- Missing! \n\
-- Table data with THP# <values 1-num_rates> \n\
1 1.5 2.5 3.5 / \n\
2 4.5 5.5 6.5 / \n";
Opm::ParserPtr parser(new Opm::Parser);
Opm::DeckConstPtr deck(parser->parseString(missing_axes));
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
}