Tables: Add Structurally Correct Gas PVT Output from PVTG

This commit expands the private member function

    Tables::addGasPVTTables(const EclipseState&)

to create structurally correct TAB vector entries from the PVTG
(wet gas) input table data when gas is an active phase in a
simulation run.  Specifically, the main result array has the columns

    [ Rv, 1/Bg, 1/(Bg*mu_g), d(1/Bg)/dRv, d(1/(Bg*mu_g))/dRv ]

and the ancillary table (base pointer JBPVTG) holds the gas pressure
nodes.

Note that while we do create structurally correct output tables, we
do not fill in undersaturated states that have been defaulted in the
input table.

The number of table rows in the main table is equal to number of PVT
regions times the number of declared pressure nodes (TABDIMS item 4,
NPPVT) times the number of declared composition nodes (TABDIMS item
6, NRPVT).  In other words, the main result array is expanded to
fill NRPVT rows per gas pressure node per PVT region.  Fill value
-2.0e+20.  We have verified the results with ECLIPSE 100.  The
ancillary table is expanded to the number of declared pressure nodes
for each PVT region.  Here the fill value is +2.0e+20.

As an OPM extension, we will use the maximum number of active
composition and pressure nodes across all PVTG tables if the
declared maximum pressure nodes in TABDIMS is too small.  This will
create TAB vector representations that are not compatible with
ECLIPSE, but which will nevertheless be useful in the context of
ResInsight's flux calculation.

Add unit tests for all gas-related PVT tables.
This commit is contained in:
Bård Skaflestad
2019-03-28 19:30:31 +01:00
parent 877ff028be
commit 25d7b538aa
2 changed files with 938 additions and 1 deletions

View File

@@ -1656,6 +1656,697 @@ END
}
}
BOOST_AUTO_TEST_SUITE (Gas)
BOOST_AUTO_TEST_CASE (PVDG_Regular)
{
const auto rspec = std::string { R"(RUNSPEC
DIMENS
10 10 10 /
TITLE
Test PVDG Output
GAS
FIELD
TABDIMS
-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT
1* 2 1* 16 1* 1*
/
)" };
const auto props = std::string { R"(
PVDG
14.7 166.666 0.0080
264.7 12.093 0.0096
514.7 6.274 0.0112
1014.7 3.197 0.0140
2014.7 1.614 0.0189
2514.7 1.294 0.0208
3014.7 1.080 0.0228
4014.7 0.811 0.0268
5014.7 0.649 0.0309
9014.7 0.386 0.0470 /
400.0 5.900 0.0130
800.0 2.950 0.0135
1200.0 1.960 0.0140
1600.0 1.470 0.0145
2000.0 1.180 0.0150
2400.0 0.980 0.0155
2800.0 0.840 0.0160
3200.0 0.740 0.0165
3600.0 0.650 0.0170
4000.0 0.590 0.0175
4400.0 0.540 0.0180
4800.0 0.490 0.0185
5200.0 0.450 0.0190
5600.0 0.420 0.0195 /
)" };
const auto es = parse(rspec, props);
auto tables = ::Opm::Tables(es.getUnits());
tables.addPVTTables(es);
const auto& tabdims = tables.tabdims();
const auto& tab = tables.tab();
const auto ibpvtg = tabdims[ TABDIMS_IBPVTG_OFFSET_ITEM ] - 1;
const auto nppvtg = tabdims[ TABDIMS_NPPVTG_ITEM ];
const auto ntpvtg = tabdims[ TABDIMS_NTPVTG_ITEM ];
const auto ncol = 5;
// Pg table defaulted
BOOST_CHECK_EQUAL(tabdims[TABDIMS_JBPVTG_OFFSET_ITEM], 1);
BOOST_CHECK_EQUAL(tabdims[TABDIMS_NRPVTG_ITEM], 1);
BOOST_CHECK_EQUAL(nppvtg, 16);
BOOST_CHECK_EQUAL(ntpvtg, 2);
const auto pvdg = std::vector<double> {
&tab[ ibpvtg ] + 0,
&tab[ ibpvtg ] + ntpvtg*nppvtg*ncol
};
const auto expect_pvdg = makeTable(5, {
// Pg 1/Bg 1/(Bg*mu_g) d(1/Bg)/dPg d(1/(Bg*mu_g))/dPg
//
// Table 1 (10 pressure nodes)
1.470000000000000e+01, 6.000024000096002e-03, 7.500030000120003e-01, 2.000000000000000e+20, 2.000000000000000e+20,
2.647000000000000e+02, 8.269246671628215e-02, 8.613798616279391e+00, 3.067697708647446e-04, 3.145518246506956e-02,
5.147000000000000e+02, 1.593879502709595e-01, 1.423106698847853e+01, 3.067819342187094e-04, 2.246907348879655e-02,
1.014700000000000e+03, 3.127932436659369e-01, 2.234237454756692e+01, 3.068105867899547e-04, 1.622261511817678e-02,
2.014700000000000e+03, 6.195786864931847e-01, 3.278194108429548e+01, 3.067854428272479e-04, 1.043956653672856e-02,
2.514700000000000e+03, 7.727975270479135e-01, 3.715372726191892e+01, 3.064376811094576e-04, 8.743572355246868e-03,
3.014700000000000e+03, 9.259259259259259e-01, 4.061078622482131e+01, 3.062567977560249e-04, 6.914117925804789e-03,
4.014699999999999e+03, 1.233045622688040e+00, 4.600916502567312e+01, 3.071196967621139e-04, 5.398378800851812e-03,
5.014700000000000e+03, 1.540832049306626e+00, 4.986511486429210e+01, 3.077864266185862e-04, 3.855949838618981e-03,
9.014699999999999e+03, 2.590673575129534e+00, 5.512071436445817e+01, 2.624603814557271e-04, 1.313899875041518e-03,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
// ===========================================================================================================================
// Table 2 (14 pressure nodes)
4.000000000000000e+02, 1.694915254237289e-01, 1.303780964797914e+01, 2.000000000000000e+20, 2.000000000000000e+20,
8.000000000000000e+02, 3.389830508474577e-01, 2.510985561833020e+01, 4.237288135593221e-04, 3.018011492587764e-02,
1.200000000000000e+03, 5.102040816326532e-01, 3.644314868804666e+01, 4.280525769629887e-04, 2.833323267429114e-02,
1.600000000000000e+03, 6.802721088435375e-01, 4.691531785127844e+01, 4.251700680272108e-04, 2.618042290807946e-02,
2.000000000000000e+03, 8.474576271186441e-01, 5.649717514124294e+01, 4.179637956877669e-04, 2.395464322491127e-02,
2.400000000000000e+03, 1.020408163265306e+00, 6.583278472679396e+01, 4.323763403666553e-04, 2.333902396387753e-02,
2.800000000000000e+03, 1.190476190476191e+00, 7.440476190476191e+01, 4.251700680272113e-04, 2.142994294491990e-02,
3.200000000000000e+03, 1.351351351351352e+00, 8.190008190008190e+01, 4.021879021879017e-04, 1.873829998829995e-02,
3.600000000000000e+03, 1.538461538461539e+00, 9.049773755656106e+01, 4.677754677754675e-04, 2.149413914119791e-02,
4.000000000000000e+03, 1.694915254237288e+00, 9.685230024213075e+01, 3.911342894393748e-04, 1.588640671392424e-02,
4.400000000000000e+03, 1.851851851851852e+00, 1.028806584362140e+02, 3.923414940364085e-04, 1.507089548520804e-02,
4.800000000000000e+03, 2.040816326530613e+00, 1.103143960286818e+02, 4.724111866969022e-04, 1.858434398116948e-02,
5.199999999999999e+03, 2.222222222222222e+00, 1.169590643274854e+02, 4.535147392290250e-04, 1.661167074700910e-02,
5.599999999999999e+03, 2.380952380952381e+00, 1.221001221001221e+02, 3.968253968253976e-04, 1.285264443159182e-02,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
});
check_is_close(pvdg, expect_pvdg);
}
BOOST_AUTO_TEST_CASE (PVDG_Exceed_Tabdims_Limits)
{
// This checks that Flow's extended table allocation scheme does what
// it's supposed to do. Normally, one would announce the maximum sizes
// in the RUNSPEC keyword 'TABDIMS'. Note that the maximum sizes need
// to be big enough in order to run the case in ECLIPSE. Other than
// NTPVT, Flow does not really care about these declared maximum sizes.
const auto rspec = std::string { R"(RUNSPEC
DIMENS
10 10 10 /
TITLE
Test PVDG Output
GAS
FIELD
TABDIMS
-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT
1* 2 1* 2 1* 1*
/
)" };
const auto props = std::string { R"(
PVDG
14.7 166.666 0.0080
264.7 12.093 0.0096
514.7 6.274 0.0112
1014.7 3.197 0.0140
2014.7 1.614 0.0189
2514.7 1.294 0.0208
3014.7 1.080 0.0228
4014.7 0.811 0.0268
5014.7 0.649 0.0309
9014.7 0.386 0.0470 /
400.0 5.900 0.0130
800.0 2.950 0.0135
1200.0 1.960 0.0140
1600.0 1.470 0.0145
2000.0 1.180 0.0150
2400.0 0.980 0.0155
2800.0 0.840 0.0160
3200.0 0.740 0.0165
3600.0 0.650 0.0170
4000.0 0.590 0.0175
4400.0 0.540 0.0180
4800.0 0.490 0.0185
5200.0 0.450 0.0190
5600.0 0.420 0.0195 /
)" };
const auto es = parse(rspec, props);
auto tables = ::Opm::Tables(es.getUnits());
tables.addPVTTables(es);
const auto& tabdims = tables.tabdims();
const auto& tab = tables.tab();
const auto ibpvtg = tabdims[ TABDIMS_IBPVTG_OFFSET_ITEM ] - 1;
const auto nppvtg = tabdims[ TABDIMS_NPPVTG_ITEM ];
const auto ntpvtg = tabdims[ TABDIMS_NTPVTG_ITEM ];
const auto ncol = 5;
// Pg table defaulted
BOOST_CHECK_EQUAL(tabdims[TABDIMS_JBPVTG_OFFSET_ITEM], 1);
BOOST_CHECK_EQUAL(tabdims[TABDIMS_NRPVTG_ITEM], 1);
BOOST_CHECK_EQUAL(nppvtg, 14); // Table 2
BOOST_CHECK_EQUAL(ntpvtg, 2);
const auto pvdg = std::vector<double> {
&tab[ ibpvtg ] + 0,
&tab[ ibpvtg ] + ntpvtg*nppvtg*ncol
};
const auto expect_pvdg = makeTable(5, {
// Pg 1/Bg 1/(Bg*mu_g) d(1/Bg)/dPg d(1/(Bg*mu_g))/dPg
//
// Table 1 (10 pressure nodes)
1.470000000000000e+01, 6.000024000096002e-03, 7.500030000120003e-01, 2.000000000000000e+20, 2.000000000000000e+20,
2.647000000000000e+02, 8.269246671628215e-02, 8.613798616279391e+00, 3.067697708647446e-04, 3.145518246506956e-02,
5.147000000000000e+02, 1.593879502709595e-01, 1.423106698847853e+01, 3.067819342187094e-04, 2.246907348879655e-02,
1.014700000000000e+03, 3.127932436659369e-01, 2.234237454756692e+01, 3.068105867899547e-04, 1.622261511817678e-02,
2.014700000000000e+03, 6.195786864931847e-01, 3.278194108429548e+01, 3.067854428272479e-04, 1.043956653672856e-02,
2.514700000000000e+03, 7.727975270479135e-01, 3.715372726191892e+01, 3.064376811094576e-04, 8.743572355246868e-03,
3.014700000000000e+03, 9.259259259259259e-01, 4.061078622482131e+01, 3.062567977560249e-04, 6.914117925804789e-03,
4.014699999999999e+03, 1.233045622688040e+00, 4.600916502567312e+01, 3.071196967621139e-04, 5.398378800851812e-03,
5.014700000000000e+03, 1.540832049306626e+00, 4.986511486429210e+01, 3.077864266185862e-04, 3.855949838618981e-03,
9.014699999999999e+03, 2.590673575129534e+00, 5.512071436445817e+01, 2.624603814557271e-04, 1.313899875041518e-03,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20, 2.000000000000000e+20,
// ===========================================================================================================================
// Table 2 (14 pressure nodes)
4.000000000000000e+02, 1.694915254237289e-01, 1.303780964797914e+01, 2.000000000000000e+20, 2.000000000000000e+20,
8.000000000000000e+02, 3.389830508474577e-01, 2.510985561833020e+01, 4.237288135593221e-04, 3.018011492587764e-02,
1.200000000000000e+03, 5.102040816326532e-01, 3.644314868804666e+01, 4.280525769629887e-04, 2.833323267429114e-02,
1.600000000000000e+03, 6.802721088435375e-01, 4.691531785127844e+01, 4.251700680272108e-04, 2.618042290807946e-02,
2.000000000000000e+03, 8.474576271186441e-01, 5.649717514124294e+01, 4.179637956877669e-04, 2.395464322491127e-02,
2.400000000000000e+03, 1.020408163265306e+00, 6.583278472679396e+01, 4.323763403666553e-04, 2.333902396387753e-02,
2.800000000000000e+03, 1.190476190476191e+00, 7.440476190476191e+01, 4.251700680272113e-04, 2.142994294491990e-02,
3.200000000000000e+03, 1.351351351351352e+00, 8.190008190008190e+01, 4.021879021879017e-04, 1.873829998829995e-02,
3.600000000000000e+03, 1.538461538461539e+00, 9.049773755656106e+01, 4.677754677754675e-04, 2.149413914119791e-02,
4.000000000000000e+03, 1.694915254237288e+00, 9.685230024213075e+01, 3.911342894393748e-04, 1.588640671392424e-02,
4.400000000000000e+03, 1.851851851851852e+00, 1.028806584362140e+02, 3.923414940364085e-04, 1.507089548520804e-02,
4.800000000000000e+03, 2.040816326530613e+00, 1.103143960286818e+02, 4.724111866969022e-04, 1.858434398116948e-02,
5.199999999999999e+03, 2.222222222222222e+00, 1.169590643274854e+02, 4.535147392290250e-04, 1.661167074700910e-02,
5.599999999999999e+03, 2.380952380952381e+00, 1.221001221001221e+02, 3.968253968253976e-04, 1.285264443159182e-02,
});
check_is_close(pvdg, expect_pvdg);
}
BOOST_AUTO_TEST_CASE (PVTG_USat_Defaulted)
{
const auto rspec = std::string { R"(RUNSPEC
DIMENS
10 10 10 /
TITLE
Test PVTG Output
GAS
METRIC
TABDIMS
-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT
1* 2 1* 7 1* 2
/
)" };
const auto props = std::string { R"(
PVTG
30 0.00014 0.0523 0.0234
0 0.0521 0.0238 /
90 0.00012 0.0132 0.0252
0 0.0131 0.0253 /
150 0.00015 0.00877 0.0281
0 0.00861 0.0275 /
210 0.00019 0.00554 0.0318
0 0.00555 0.0302 /
270 0.00029 0.00417 0.0355
0 0.00421 0.0330 /
330 0.00049 0.00357 0.0392
0 0.00361 0.0358 /
530 0.00060 0.00356 0.0393
0 0.00360 0.0359 /
/
60 0.00014 0.0523 0.0234 /
120 0.00012 0.0132 0.0252 /
180 0.00015 0.00877 0.0281 /
240 0.00019 0.00554 0.0318 /
300 0.00029 0.00417 0.0355 /
360 0.00049 0.00357 0.0392 /
560 0.00060 0.00356 0.0393
0 0.00360 0.0359 /
/
)" };
const auto es = parse(rspec, props);
auto tables = ::Opm::Tables(es.getUnits());
tables.addPVTTables(es);
const auto& tabdims = tables.tabdims();
const auto& tab = tables.tab();
const auto ibpvtg = tabdims[ TABDIMS_IBPVTG_OFFSET_ITEM ] - 1;
const auto jbpvtg = tabdims[ TABDIMS_JBPVTG_OFFSET_ITEM ] - 1;
const auto nppvtg = tabdims[ TABDIMS_NPPVTG_ITEM ];
const auto nrpvtg = tabdims[ TABDIMS_NRPVTG_ITEM ];
const auto ntpvtg = tabdims[ TABDIMS_NTPVTG_ITEM ];
const auto ncol = 5;
BOOST_CHECK_EQUAL(nppvtg, 7);
BOOST_CHECK_EQUAL(nrpvtg, 2);
BOOST_CHECK_EQUAL(ntpvtg, 2);
const auto pvtg = std::vector<double> {
&tab[ ibpvtg ] + 0,
&tab[ ibpvtg ] + ntpvtg*nppvtg*nrpvtg*ncol
};
const auto pg = std::vector<double> {
&tab[ jbpvtg ] + 0,
&tab[ jbpvtg ] + ntpvtg*nppvtg
};
const auto expect_pvtg = makeTable(5, {
// Rv 1/Bg 1/(Bg*mu_g) d(1/Bg)/dRv d(1/(Bg*mu_g))/dRv
//
// Table 1 (Pg 1)
1.400000000000000e-04, 1.912045889101339e+01, 8.171136278210848e+02, -2.000000000000000e+20, -2.000000000000000e+20,
0, 1.919385796545106e+01, 8.064646203971031e+02, -5.242791031262176e+02, 7.606433874272674e+04,
// Table 1 (Pg 2) ------------------------------------------------------------------------------------------------------------
1.200000000000000e-04, 7.575757575757576e+01, 3.006253006253006e+03, -2.000000000000000e+20, -2.000000000000000e+20,
0, 7.633587786259541e+01, 3.017228374015629e+03, -4.819184208497044e+03, -9.146139802185188e+04,
// Table 1 (Pg 3) ------------------------------------------------------------------------------------------------------------
1.500000000000000e-04, 1.140250855188141e+02, 4.057832224868830e+03, -2.000000000000000e+20, -2.000000000000000e+20,
0, 1.161440185830430e+02, 4.223418857565199e+03, -1.412622042819227e+04, -1.103910884642458e+06,
// Table 1 (Pg 4) ------------------------------------------------------------------------------------------------------------
1.900000000000000e-04, 1.805054151624549e+02, 5.676270917058329e+03, -2.000000000000000e+20, -2.000000000000000e+20,
0, 1.801801801801802e+02, 5.966231131794045e+03, 1.711763064603725e+03, -1.526106393345871e+06,
// Table 1 (Pg 5) ------------------------------------------------------------------------------------------------------------
2.900000000000000e-04, 2.398081534772182e+02, 6.755159252879387e+03, -2.000000000000000e+20, -2.000000000000000e+20,
0, 2.375296912114014e+02, 7.197869430648528e+03, 7.856766433850982e+03, -1.526586819893588e+06,
// Table 1 (Pg 6) ------------------------------------------------------------------------------------------------------------
4.900000000000000e-04, 2.801120448179272e+02, 7.145715429028755e+03, -2.000000000000000e+20, -2.000000000000000e+20,
0, 2.770083102493075e+02, 7.737662297466691e+03, 6.334152180856531e+03, -1.208054833546807e+06,
// Table 1 (Pg 7) ------------------------------------------------------------------------------------------------------------
5.999999999999999e-04, 2.808988764044944e+02, 7.147554106984589e+03, -2.000000000000000e+20, -2.000000000000000e+20,
0, 2.777777777777778e+02, 7.737542556484059e+03, 5.201831044527695e+03, -9.833140824991158e+05,
// ==========================================================================================================================
// Table 2 (Pg 1)
1.400000000000000e-04, 1.912045889101339e+01, 8.171136278210848e+02, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 2) ------------------------------------------------------------------------------------------------------------
1.200000000000000e-04, 7.575757575757576e+01, 3.006253006253006e+03, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 3) ------------------------------------------------------------------------------------------------------------
1.500000000000000e-04, 1.140250855188141e+02, 4.057832224868830e+03, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 4) ------------------------------------------------------------------------------------------------------------
1.900000000000000e-04, 1.805054151624549e+02, 5.676270917058329e+03, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 5) ------------------------------------------------------------------------------------------------------------
2.900000000000000e-04, 2.398081534772182e+02, 6.755159252879387e+03, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 6) ------------------------------------------------------------------------------------------------------------
4.900000000000000e-04, 2.801120448179272e+02, 7.145715429028755e+03, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 7) ------------------------------------------------------------------------------------------------------------
5.999999999999999e-04, 2.808988764044944e+02, 7.147554106984589e+03, -2.000000000000000e+20, -2.000000000000000e+20,
0, 2.777777777777778e+02, 7.737542556484059e+03, 5.201831044527695e+03, -9.833140824991158e+05,
});
const auto expect_pg = makeTable(1, {
// Table 1
30, 90, 150, 210, 270, 330, 530,
// Table 2
60, 120, 180, 240, 300, 360, 560,
});
check_is_close(pvtg, expect_pvtg);
check_is_close(pg , expect_pg );
}
BOOST_AUTO_TEST_CASE (PVTG_USat_Full_Large_Tabdims)
{
const auto rspec = std::string { R"(RUNSPEC
DIMENS
10 10 10 /
TITLE
Test PVTG Output
GAS
METRIC
TABDIMS
-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT
1* 1 1* 7 1* 5
/
)" };
const auto props = std::string { R"(
PVTG
50.00 0.00000497 0.024958 0.01441
0.00000248 0.024958 0.01440
0.00000000 0.024958 0.01440 /
70.00 0.00000521 0.017639 0.01491
0.00000261 0.017641 0.01490
0.00000000 0.017643 0.01490 /
90.00 0.00000627 0.013608 0.01547
0.00000313 0.013611 0.01546
0.00000000 0.013615 0.01544 /
110.00 0.00000798 0.011072 0.01609
0.00000399 0.011076 0.01607
0.00000000 0.011081 0.01605 /
/
)" };
const auto es = parse(rspec, props);
auto tables = ::Opm::Tables(es.getUnits());
tables.addPVTTables(es);
const auto& tabdims = tables.tabdims();
const auto& tab = tables.tab();
const auto ibpvtg = tabdims[ TABDIMS_IBPVTG_OFFSET_ITEM ] - 1;
const auto jbpvtg = tabdims[ TABDIMS_JBPVTG_OFFSET_ITEM ] - 1;
const auto nppvtg = tabdims[ TABDIMS_NPPVTG_ITEM ];
const auto nrpvtg = tabdims[ TABDIMS_NRPVTG_ITEM ];
const auto ntpvtg = tabdims[ TABDIMS_NTPVTG_ITEM ];
const auto ncol = 5;
BOOST_CHECK_EQUAL(nppvtg, 7);
BOOST_CHECK_EQUAL(nrpvtg, 5);
BOOST_CHECK_EQUAL(ntpvtg, 1);
const auto pvtg = std::vector<double> {
&tab[ ibpvtg ] + 0,
&tab[ ibpvtg ] + ntpvtg*nppvtg*nrpvtg*ncol
};
const auto pg = std::vector<double> {
&tab[ jbpvtg ] + 0,
&tab[ jbpvtg ] + ntpvtg*nppvtg
};
const auto expect_pvtg = makeTable(5, {
// Rv 1/Bg 1/(Bg*mu_g) d(1/Bg)/dRv d(1/(Bg*mu_g))/dRv
//
// Table 1 (Pg 1)
4.970000000000000e-06, 4.006731308598445e+01, 2.780521380012800e+03, -2.000000000000000e+20, -2.000000000000000e+20,
2.480000000000000e-06, 4.006731308598445e+01, 2.782452297637809e+03, 0, -7.754689257064208e+05,
0, 4.006731308598445e+01, 2.782452297637809e+03, 0, 0,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 1 (Pg 2) ------------------------------------------------------------------------------------------------------------
5.210000000000000e-06, 5.669255626736210e+01, 3.802317657100074e+03, -2.000000000000000e+20, -2.000000000000000e+20,
2.610000000000000e-06, 5.668612890425712e+01, 3.804438181493767e+03, 2.472062732683009e+03, -8.155863052665014e+05,
0, 5.667970299835629e+01, 3.804006912641362e+03, 2.462032912196776e+03, 1.652371082011811e+05,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 1 (Pg 3) ------------------------------------------------------------------------------------------------------------
6.270000000000000e-06, 7.348618459729570e+01, 4.750238176942192e+03, -2.000000000000000e+20, -2.000000000000000e+20,
3.130000000000000e-06, 7.346998751010213e+01, 4.752263098971676e+03, 5.158308023431543e+03, -6.448796272243677e+05,
0, 7.344840249724568e+01, 4.757020887127311e+03, 6.896170241676778e+03, -1.520060113621228e+06,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 1 (Pg 4) ------------------------------------------------------------------------------------------------------------
7.980000000000000e-06, 9.031791907514450e+01, 5.613295156938751e+03, -2.000000000000000e+20, -2.000000000000000e+20,
3.990000000000000e-06, 9.028530155290719e+01, 5.618251496758381e+03, 8.174817603337499e+03, -1.242190430985102e+06,
0, 9.024456276509339e+01, 5.622714190971551e+03, 1.021022250972279e+04, -1.118469727611510e+06,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 1 (Pg 5) ------------------------------------------------------------------------------------------------------------
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 1 (Pg 6) ------------------------------------------------------------------------------------------------------------
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 1 (Pg 7) ------------------------------------------------------------------------------------------------------------
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
});
const auto expect_pg = makeTable(1, {
// Table 1
50.00, 70.00, 90.00, 110.00, 2.0e20, 2.0e20, 2.0e20,
});
check_is_close(pvtg, expect_pvtg);
check_is_close(pg , expect_pg );
}
BOOST_AUTO_TEST_CASE (PVTG_Exceed_Tabdims_Limits)
{
// This checks that Flow's extended table allocation scheme does what
// it's supposed to do. Normally, one would announce the maximum sizes
// in the RUNSPEC keyword 'TABDIMS'. Note that the maximum sizes need
// to be big enough in order to run the case in ECLIPSE. Other than
// NTPVT, Flow does not really care about these declared maximum sizes.
const auto rspec = std::string { R"(RUNSPEC
DIMENS
10 10 10 /
TITLE
Test PVTG Output
GAS
METRIC
TABDIMS
-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT
1* 2 1* 1 1* 1
/
)" };
const auto props = std::string { R"(
PVTG
50.00 0.00000497 0.024958 0.01441
0.00000248 0.024958 0.01440
0.00000000 0.024958 0.01440 /
70.00 0.00000521 0.017639 0.01491
0.00000261 0.017641 0.01490
0.00000000 0.017643 0.01490 /
90.00 0.00000627 0.013608 0.01547
0.00000313 0.013611 0.01546
0.00000000 0.013615 0.01544 /
110.00 0.00000798 0.011072 0.01609
0.00000399 0.011076 0.01607
0.00000000 0.011081 0.01605 /
130.00 0.00001041 0.009340 0.01677
0.00000520 0.009346 0.01674
0.00000000 0.009352 0.01671 /
/
50.00 0.00000497 0.024958 0.01441
0.00000248 0.024958 0.01440
0.00000000 0.024958 0.01440 /
/
)" };
const auto es = parse(rspec, props);
auto tables = ::Opm::Tables(es.getUnits());
tables.addPVTTables(es);
const auto& tabdims = tables.tabdims();
const auto& tab = tables.tab();
const auto ibpvtg = tabdims[ TABDIMS_IBPVTG_OFFSET_ITEM ] - 1;
const auto jbpvtg = tabdims[ TABDIMS_JBPVTG_OFFSET_ITEM ] - 1;
const auto nppvtg = tabdims[ TABDIMS_NPPVTG_ITEM ];
const auto nrpvtg = tabdims[ TABDIMS_NRPVTG_ITEM ];
const auto ntpvtg = tabdims[ TABDIMS_NTPVTG_ITEM ];
const auto ncol = 5;
BOOST_CHECK_EQUAL(nppvtg, 5); // Table 1
BOOST_CHECK_EQUAL(nrpvtg, 3); // Table 1, Pg 1
BOOST_CHECK_EQUAL(ntpvtg, 2); // TABDIMS
const auto pvtg = std::vector<double> {
&tab[ ibpvtg ] + 0,
&tab[ ibpvtg ] + ntpvtg*nppvtg*nrpvtg*ncol
};
const auto pg = std::vector<double> {
&tab[ jbpvtg ] + 0,
&tab[ jbpvtg ] + ntpvtg*nppvtg
};
const auto expect_pvtg = makeTable(5, {
// Rv 1/Bg 1/(Bg*mu_g) d(1/Bg)/dRv d(1/(Bg*mu_g))/dRv
//
// Table 1 (Pg 1)
4.970000000000000e-06, 4.006731308598445e+01, 2.780521380012800e+03, -2.000000000000000e+20, -2.000000000000000e+20,
2.480000000000000e-06, 4.006731308598445e+01, 2.782452297637809e+03, 0, -7.754689257064208e+05,
0, 4.006731308598445e+01, 2.782452297637809e+03, 0, 0,
// Table 1 (Pg 2) ------------------------------------------------------------------------------------------------------------
5.210000000000000e-06, 5.669255626736210e+01, 3.802317657100074e+03, -2.000000000000000e+20, -2.000000000000000e+20,
2.610000000000000e-06, 5.668612890425712e+01, 3.804438181493767e+03, 2.472062732683009e+03, -8.155863052665014e+05,
0, 5.667970299835629e+01, 3.804006912641362e+03, 2.462032912196776e+03, 1.652371082011811e+05,
// Table 1 (Pg 3) ------------------------------------------------------------------------------------------------------------
6.270000000000000e-06, 7.348618459729570e+01, 4.750238176942192e+03, -2.000000000000000e+20, -2.000000000000000e+20,
3.130000000000000e-06, 7.346998751010213e+01, 4.752263098971676e+03, 5.158308023431543e+03, -6.448796272243677e+05,
0, 7.344840249724568e+01, 4.757020887127311e+03, 6.896170241676778e+03, -1.520060113621228e+06,
// Table 1 (Pg 4) ------------------------------------------------------------------------------------------------------------
7.980000000000000e-06, 9.031791907514450e+01, 5.613295156938751e+03, -2.000000000000000e+20, -2.000000000000000e+20,
3.990000000000000e-06, 9.028530155290719e+01, 5.618251496758381e+03, 8.174817603337499e+03, -1.242190430985102e+06,
0, 9.024456276509339e+01, 5.622714190971551e+03, 1.021022250972279e+04, -1.118469727611510e+06,
// Table 1 (Pg 5) ------------------------------------------------------------------------------------------------------------
1.041000000000000e-05, 1.070663811563169e+02, 6.384399591909179e+03, -2.000000000000000e+20, -2.000000000000000e+20,
5.200000000000000e-06, 1.069976460517869e+02, 6.391735128541628e+03, 1.319291833590461e+04, -1.407972482235984e+06,
0, 1.069289991445680e+02, 6.399102282738958e+03, 1.320132831131706e+04, -1.416760422563444e+06,
// ==========================================================================================================================
// Table 2 (Pg 1)
4.970000000000000e-06, 4.006731308598445e+01, 2.780521380012800e+03, -2.000000000000000e+20, -2.000000000000000e+20,
2.480000000000000e-06, 4.006731308598445e+01, 2.782452297637809e+03, 0, -7.754689257064208e+05,
0, 4.006731308598445e+01, 2.782452297637809e+03, 0, 0,
// Table 2 (Pg 2) ------------------------------------------------------------------------------------------------------------
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 3) ------------------------------------------------------------------------------------------------------------
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 4) ------------------------------------------------------------------------------------------------------------
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
// Table 2 (Pg 5) ------------------------------------------------------------------------------------------------------------
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
-2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20, -2.000000000000000e+20,
});
const auto expect_pg = makeTable(1, {
// Table 1
50.00, 70.00, 90.00, 110.00, 130.0,
// Table 2
50.00, 2.0e20, 2.0e20, 2.0e20, 2.0e20,
});
check_is_close(pvtg, expect_pvtg);
check_is_close(pg , expect_pg );
}
BOOST_AUTO_TEST_SUITE_END ()
// =====================================================================
BOOST_AUTO_TEST_SUITE (Oil)
BOOST_AUTO_TEST_CASE (PVCDO)