improve unit test for PVTG
now the data is parsed from a string specified in the source file instead of a separate file, the PvtgTable utility class is tested and the order of the fields in the JSON definition of PVTG is the same as for that of PVTO.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Utility/PvtgTable.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckDoubleItem.hpp>
|
||||
|
||||
@@ -13,16 +15,35 @@
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserDoubleItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
const char *pvtgData = "\n\
|
||||
TABDIMS\n\
|
||||
-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT\n\
|
||||
1 2 30 24 10 20 /\n\
|
||||
\n\
|
||||
PVTG\n\
|
||||
--\n\
|
||||
20.00 0.00002448 0.061895 0.01299\n\
|
||||
0.00001224 0.061810 0.01300\n\
|
||||
0.00000000 0.061725 0.01300 /\n\
|
||||
40.00 0.00000628 0.030252 0.01383\n\
|
||||
0.00000314 0.030249 0.01383\n\
|
||||
0.00000000 0.030245 0.01383 /\n\
|
||||
/\n\
|
||||
197.66 0.00006327 0.005820 0.02160\n\
|
||||
0.00003164 0.005840 0.02122\n\
|
||||
0.00000000 0.005860 0.02086 /\n\
|
||||
231.13 0.00010861 0.005042 0.02477\n\
|
||||
0.00005431 0.005061 0.02389\n\
|
||||
0.00000000 0.005082 0.02306 /\n\
|
||||
/\n";
|
||||
|
||||
|
||||
void check_parser(ParserPtr parser) {
|
||||
|
||||
boost::filesystem::path pvtgFile("testdata/integration_tests/PVTG/PVTG.txt");
|
||||
DeckPtr deck = parser->parseFile(pvtgFile.string());
|
||||
DeckPtr deck = parser->parseString(pvtgData);
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("PVTG" , 0);
|
||||
BOOST_CHECK_EQUAL(5U , kw1->size());
|
||||
|
||||
@@ -64,9 +85,22 @@ void check_parser(ParserPtr parser) {
|
||||
BOOST_CHECK_EQUAL(9U , item4_1->size());
|
||||
BOOST_CHECK_EQUAL(2U , record4->size());
|
||||
|
||||
Opm::PvtgTable pvtgTable(kw1, /*tableIdx=*/0);
|
||||
const auto &outerTable = *pvtgTable.getOuterTable();
|
||||
const auto &innerTable0 = *pvtgTable.getInnerTable(0);
|
||||
|
||||
BOOST_CHECK_EQUAL(2, outerTable.numRows());
|
||||
BOOST_CHECK_EQUAL(4, outerTable.numColumns());
|
||||
BOOST_CHECK_EQUAL(3, innerTable0.numRows());
|
||||
BOOST_CHECK_EQUAL(3, innerTable0.numColumns());
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL(20.0e5, outerTable.getPressureColumn()[0]);
|
||||
BOOST_CHECK_EQUAL(0.00002448, outerTable.getOilSolubilityColumn()[0]);
|
||||
BOOST_CHECK_EQUAL(outerTable.getOilSolubilityColumn()[0], innerTable0.getOilSolubilityColumn()[0]);
|
||||
BOOST_CHECK_EQUAL(0.061895, outerTable.getGasFormationFactorColumn()[0]);
|
||||
BOOST_CHECK_EQUAL(outerTable.getGasFormationFactorColumn()[0], innerTable0.getGasFormationFactorColumn()[0]);
|
||||
BOOST_CHECK_EQUAL(1.299e-5, outerTable.getGasViscosityColumn()[0]);
|
||||
BOOST_CHECK_EQUAL(outerTable.getGasViscosityColumn()[0], innerTable0.getGasViscosityColumn()[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user