mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-13 01:12:02 -05:00
Added tests for computing the flo/wfr/gfr values based on the aqua/liquid/vapour flow rates
This commit is contained in:
1 parent
2f6e44500b
commit
ccf06c2c1c
3 files changed
+458
-122
No files matched your search
+262
-33
@@ -38,13 +38,21 @@
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/autodiff/VFPProperties.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test fixture to set up axis etc.
|
||||
* All of our axes go from 0 to 1, but with a varying number of
|
||||
* values data is given at
|
||||
*/
|
||||
struct F {
|
||||
F() : thp_axis{0.0, 1.0},
|
||||
struct TrivialFixture {
|
||||
typedef Opm::VFPProperties::ADB ADB;
|
||||
|
||||
TrivialFixture() : thp_axis{0.0, 1.0},
|
||||
wfr_axis{0.0, 0.5, 1.0},
|
||||
gfr_axis{0.0, 0.25, 0.5, 0.75, 1},
|
||||
alq_axis{0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1},
|
||||
@@ -61,7 +69,7 @@ struct F {
|
||||
|
||||
}
|
||||
|
||||
~F() {
|
||||
~TrivialFixture() {
|
||||
|
||||
}
|
||||
|
||||
@@ -136,16 +144,16 @@ struct F {
|
||||
Opm::VFPProperties::array_type data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Set F to be our test suite fixture for our "trivial" tests
|
||||
BOOST_FIXTURE_TEST_SUITE( TrivialTests, F )
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE( TrivialTests, TrivialFixture )
|
||||
|
||||
/**
|
||||
* Test that we can generate some dummy zero-data, and
|
||||
* interpolate something the analytic solution
|
||||
* Test that we can generate some dummy zero-data,
|
||||
* interpolate using doubles as input, and compare against the analytic solution
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(InterpolateZero)
|
||||
{
|
||||
@@ -192,8 +200,8 @@ BOOST_AUTO_TEST_CASE(InterpolateZero)
|
||||
|
||||
|
||||
/**
|
||||
* Test that we can generate some dummy one-data, and
|
||||
* interpolate something the analytic solution
|
||||
* Test that we can generate some dummy one-data,
|
||||
* interpolate using doubles as input, and compare against the analytic solution
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(InterpolateOne)
|
||||
{
|
||||
@@ -241,8 +249,8 @@ BOOST_AUTO_TEST_CASE(InterpolateOne)
|
||||
|
||||
|
||||
/**
|
||||
* Test that we can generate some dummy one-data, and
|
||||
* interpolate something the analytic solution
|
||||
* Test that we can generate some dummy data representing an ND plane,
|
||||
* interpolate using doubles as input, and compare against the analytic solution
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(InterpolatePlane)
|
||||
{
|
||||
@@ -296,15 +304,15 @@ BOOST_AUTO_TEST_CASE(InterpolatePlane)
|
||||
}
|
||||
|
||||
BOOST_CHECK_CLOSE(sum, reference_sum, 0.0001);
|
||||
BOOST_CHECK_SMALL(max_d, 0.0005);
|
||||
BOOST_CHECK_SMALL(sad, 0.1);
|
||||
BOOST_CHECK_SMALL(max_d, 1.0e-10);
|
||||
BOOST_CHECK_SMALL(sad, 1.0e-10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test that we can generate some dummy one-data, and
|
||||
* interpolate something the analytic solution
|
||||
* Test that we can generate some dummy data representing an ND plane,
|
||||
* interpolate using doubles as input, and compare against the analytic solution
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(ExtrapolatePlane)
|
||||
{
|
||||
@@ -358,20 +366,19 @@ BOOST_AUTO_TEST_CASE(ExtrapolatePlane)
|
||||
}
|
||||
|
||||
BOOST_CHECK_CLOSE(sum, reference_sum, 0.0001);
|
||||
BOOST_CHECK_SMALL(max_d, 0.0005);
|
||||
BOOST_CHECK_SMALL(sad, 0.1);
|
||||
BOOST_CHECK_SMALL(max_d, 1.0e-10);
|
||||
BOOST_CHECK_SMALL(sad, 1.0e-10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test that we can generate some dummy one-data, and
|
||||
* interpolate something the analytic solution
|
||||
* Test that we can generate some dummy data representing an ND plane,
|
||||
* interpolate using ADBs as input, and compare against the analytic solution
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(ExtrapolatePlaneADB)
|
||||
{
|
||||
typedef Opm::VFPProperties::ADB ADB;
|
||||
fillPlane();
|
||||
|
||||
//Create table
|
||||
@@ -448,8 +455,19 @@ BOOST_AUTO_TEST_CASE(ExtrapolatePlaneADB)
|
||||
}
|
||||
|
||||
BOOST_CHECK_CLOSE(sum, reference_sum, 0.0001);
|
||||
BOOST_CHECK_SMALL(max_d, 0.0005);
|
||||
BOOST_CHECK_SMALL(sad, 0.1);
|
||||
BOOST_CHECK_SMALL(max_d, 1.0e-10);
|
||||
BOOST_CHECK_SMALL(sad, 1.0e-10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test that we can generate some dummy data representing an ND plane,
|
||||
* interpolate using well flow rates and ADBs as input, and compare against the analytic solution
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(Wells_Qs_thp_and_alq_interpolation)
|
||||
{
|
||||
BOOST_WARN("Not implemented");
|
||||
}
|
||||
|
||||
|
||||
@@ -458,16 +476,230 @@ BOOST_AUTO_TEST_SUITE_END() // Trivial tests
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct ConversionFixture : public TrivialFixture {
|
||||
ConversionFixture() : TrivialFixture(),
|
||||
num_wells(5),
|
||||
aqua_v(num_wells),
|
||||
liquid_v(num_wells),
|
||||
vapour_v(num_wells),
|
||||
aqua(ADB::null()),
|
||||
liquid(ADB::null()),
|
||||
vapour(ADB::null())
|
||||
{
|
||||
fillPlane();
|
||||
}
|
||||
|
||||
~ConversionFixture() {
|
||||
|
||||
}
|
||||
|
||||
void fillPhases(double aqua_in, double liquid_in, double vapour_in) {
|
||||
for (int i=0; i<num_wells; ++i) {
|
||||
aqua_v[i] = aqua_in;
|
||||
liquid_v[i] = liquid_in;
|
||||
vapour_v[i] = vapour_in;
|
||||
}
|
||||
|
||||
aqua = ADB::constant(aqua_v);
|
||||
liquid = ADB::constant(liquid_v);
|
||||
vapour = ADB::constant(vapour_v);
|
||||
}
|
||||
|
||||
void checkEqual(const ADB& lhs, double rhs) {
|
||||
const ADB::V& values = lhs.value();
|
||||
for (int i=0; i<values.size(); ++i) {
|
||||
BOOST_CHECK_EQUAL(static_cast<double>(values[i]), rhs);
|
||||
}
|
||||
}
|
||||
|
||||
int num_wells;
|
||||
ADB::V aqua_v;
|
||||
ADB::V liquid_v;
|
||||
ADB::V vapour_v;
|
||||
|
||||
ADB aqua;
|
||||
ADB liquid;
|
||||
ADB vapour;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE( ConversionTests, ConversionFixture )
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(getFlo)
|
||||
{
|
||||
double water = 3.0;
|
||||
double oil = 5.0;
|
||||
double gas = 7.0;
|
||||
|
||||
Opm::VFPProperties::FLO_TYPE types[] = {
|
||||
Opm::VFPProperties::FLO_OIL,
|
||||
Opm::VFPProperties::FLO_LIQ,
|
||||
Opm::VFPProperties::FLO_GAS
|
||||
};
|
||||
double reference[] = {
|
||||
oil,
|
||||
water+oil,
|
||||
gas
|
||||
};
|
||||
const int num_types = sizeof(types) / sizeof(types[0]);
|
||||
|
||||
for (int i=0; i<num_types; ++i) {
|
||||
//Create table
|
||||
Opm::VFPProperties vfp_table(1,
|
||||
1000.0,
|
||||
types[i],
|
||||
Opm::VFPProperties::WFR_WOR,
|
||||
Opm::VFPProperties::GFR_GOR,
|
||||
Opm::VFPProperties::ALQ_UNDEF,
|
||||
flo_axis,
|
||||
thp_axis,
|
||||
wfr_axis,
|
||||
gfr_axis,
|
||||
alq_axis,
|
||||
data);
|
||||
|
||||
fillPhases(water, oil, gas);
|
||||
ADB flo = vfp_table.getFlo(aqua, liquid, vapour);
|
||||
|
||||
BOOST_TEST_MESSAGE("Using FLO_TYPE=" << types[i]);
|
||||
checkEqual(flo, reference[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(getWFR)
|
||||
{
|
||||
double water = 3.0;
|
||||
double oil = 5.0;
|
||||
double gas = 7.0;
|
||||
|
||||
Opm::VFPProperties::WFR_TYPE types[] = {
|
||||
Opm::VFPProperties::WFR_WOR,
|
||||
Opm::VFPProperties::WFR_WCT,
|
||||
Opm::VFPProperties::WFR_WGR
|
||||
};
|
||||
double reference[] = {
|
||||
water / oil,
|
||||
water / (water + oil + gas),
|
||||
water / gas
|
||||
};
|
||||
const int num_types = sizeof(types) / sizeof(types[0]);
|
||||
|
||||
for (int i=0; i<num_types; ++i) {
|
||||
//Create table
|
||||
Opm::VFPProperties vfp_table(1,
|
||||
1000.0,
|
||||
Opm::VFPProperties::FLO_OIL,
|
||||
types[i],
|
||||
Opm::VFPProperties::GFR_GOR,
|
||||
Opm::VFPProperties::ALQ_UNDEF,
|
||||
flo_axis,
|
||||
thp_axis,
|
||||
wfr_axis,
|
||||
gfr_axis,
|
||||
alq_axis,
|
||||
data);
|
||||
|
||||
fillPhases(water, oil, gas);
|
||||
ADB flo = vfp_table.getWFR(aqua, liquid, vapour);
|
||||
|
||||
BOOST_TEST_MESSAGE("Using WFR_TYPE=" << types[i]);
|
||||
checkEqual(flo, reference[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(getGFR)
|
||||
{
|
||||
double water = 3.0;
|
||||
double oil = 5.0;
|
||||
double gas = 7.0;
|
||||
|
||||
Opm::VFPProperties::GFR_TYPE types[] = {
|
||||
Opm::VFPProperties::GFR_GOR,
|
||||
Opm::VFPProperties::GFR_GLR,
|
||||
Opm::VFPProperties::GFR_OGR
|
||||
};
|
||||
double reference[] = {
|
||||
gas / oil,
|
||||
gas / (oil + water),
|
||||
oil / gas
|
||||
};
|
||||
const int num_types = sizeof(types) / sizeof(types[0]);
|
||||
|
||||
for (int i=0; i<num_types; ++i) {
|
||||
//Create table
|
||||
Opm::VFPProperties vfp_table(1,
|
||||
1000.0,
|
||||
Opm::VFPProperties::FLO_OIL,
|
||||
Opm::VFPProperties::WFR_WOR,
|
||||
types[i],
|
||||
Opm::VFPProperties::ALQ_UNDEF,
|
||||
flo_axis,
|
||||
thp_axis,
|
||||
wfr_axis,
|
||||
gfr_axis,
|
||||
alq_axis,
|
||||
data);
|
||||
|
||||
fillPhases(water, oil, gas);
|
||||
ADB flo = vfp_table.getGFR(aqua, liquid, vapour);
|
||||
|
||||
BOOST_TEST_MESSAGE("Using GFR_TYPE=" << types[i]);
|
||||
checkEqual(flo, reference[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // unit tests
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(IntegrationTests)
|
||||
|
||||
extern const double reference[];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Tests that we can actually parse some input data, and interpolate within that space
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(Integration)
|
||||
BOOST_AUTO_TEST_CASE(ParseVFPProdAndInterpolate)
|
||||
{
|
||||
Opm::DeckConstPtr deck;
|
||||
std::shared_ptr<Opm::EclipseState> eclipseState;
|
||||
@@ -534,11 +766,10 @@ BOOST_AUTO_TEST_CASE(Integration)
|
||||
std::cout << "];" << std::endl;
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_SMALL(max_d, 0.0005);
|
||||
BOOST_CHECK_SMALL(sad, 0.00001);
|
||||
BOOST_CHECK_SMALL(max_d, 1.0e-10);
|
||||
BOOST_CHECK_SMALL(sad, 1.0e-10);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reference computed using MATLAB with the input above.
|
||||
*/
|
||||
@@ -546,8 +777,6 @@ const double reference[] = {
|
||||
44.850000000000001, 30.36904761904762, 40.238928571428566, 53.221714285714292, 67.885571428571438, 83.100857142857151, 99.021000000000015, 115.14, 27.986149999999999, 76.394680612244898, 146.58456352040815, 227.73038755102044, 323.29702921768705, 433.02474183673473, 519.09348404081641, 596.70497857142868, 25.483874999999998, 135.96136479591837, 276.35715114795914, 452.68607295918366, 676.76830807823114, 945.81213010204078, 1108.470853367347, 1234.3462321428572, 22.9816, 195.52804897959183, 406.12973877551008, 677.64175836734682, 1030.2395869387753, 1458.5995183673467, 1697.8482226938775, 1871.9874857142856, 21.93648, 260.13428359183678, 566.16254540816328, 972.26681151020421, 1344.8295676190476, 1774.9372779591836, 2013.0210626204084, 2185.0791771428571, 22.174319999999998, 329.1776176326531, 752.83812551020401, 1328.232636244898, 1625.1862990476188, 1918.3098995918363, 2086.7690417469385, 2212.4194514285709, 22.412159999999997, 398.22095167346936, 939.51370561224473, 1684.198460979592, 1905.5430304761903, 2061.6825212244894, 2160.5170208734694, 2239.7597257142857, 22.649999999999999, 467.26428571428573, 1126.1892857142857, 2040.1642857142861, 2185.8997619047618, 2205.0551428571425, 2234.2649999999999, 2267.0999999999999, 45.935714285714283, 31.165795918367351, 39.937755102040811, 52.72722448979593, 66.603455782312921, 81.156040816326524, 96.557926530612264, 112.18714285714286, 29.541501020408166, 68.10885813411079, 127.61792838921284, 195.14191513119539, 273.51727814382895, 362.26484685131197, 464.80925879300298, 571.05809489795934, 26.418334183673469, 118.58690218658893, 235.65489568148689, 377.46362485422748, 554.83594890670554, 764.83203053935858, 1015.1273887900876, 1276.0984719387757, 23.295167346938779, 169.06494623906704, 343.69186297376086, 559.7853345772595, 836.15461966958196, 1167.3992142274051, 1565.4455187871722, 1981.1388489795918, 21.823392653061227, 222.83265130417885, 472.45379858600586, 795.44837871720142, 1174.8842335704569, 1543.4152790437317, 1945.2266863183679, 2358.5925306122449, 21.805595102040819, 279.49675619825075, 619.46314463556848, 1078.076089212828, 1564.1616228338191, 1896.0542676618074, 2174.8576629877552, 2447.6207346938772, 21.787797551020411, 336.16086109232265, 766.47249068513111, 1360.7037997084549, 1953.4390120971816, 2248.6932562798829, 2404.4886396571433, 2536.64893877551, 21.770000000000003, 392.8249659863946, 913.48183673469384, 1643.331510204082, 2342.7164013605443, 2601.3322448979588, 2634.1196163265308, 2625.6771428571428, 47.03857142857143, 32.294666666666664, 39.655204081632654, 52.333755102040818, 66.056870748299303, 79.655795918367346, 94.904048979591849, 110.69571428571429, 31.4618112244898, 60.027269698736646, 109.31101308309036, 164.18323034985428, 226.53348555879492, 296.57316871720116, 377.61696073469392, 461.6498928571429, 27.707640306122446, 101.52058415937805, 197.02186251822158, 308.25257120991256, 443.23278785228376, 602.26389059766768, 794.2130148979594, 995.03794642857144, 23.953469387755103, 143.0138986200194, 284.73271195335275, 452.32191206997084, 659.93209014577235, 907.95461247813398, 1210.8090690612244, 1528.4259999999999, 22.096767346938773, 186.56175919922259, 385.1060212390671, 631.63031250145787, 943.5575367035957, 1305.3664132711372, 1664.3889660991258, 2019.3338204081635, 21.910702040816325, 231.91855601943632, 496.6280617784256, 841.96513350437328, 1286.1084689135077, 1783.5345340174924, 2150.5314876034986, 2472.8396897959183, 21.724636734693878, 277.27535283965011, 608.15010231778422, 1052.2999545072887, 1628.6594011234206, 2261.7026547638479, 2636.6740091078714, 2926.3455591836728, 21.53857142857143, 322.6321496598639, 719.67214285714283, 1262.6347755102042, 1971.210333333333, 2739.8707755102037, 3122.8165306122451, 3379.8514285714286, 48.172142857142859, 34.1152925170068, 39.812755102040818, 51.5600612244898, 65.615465986394554, 79.399040816326519, 94.464034693877551, 109.96857142857144, 33.996096428571427, 52.22108403790088, 92.038355357142862, 135.3683000145773, 183.62870803692908, 237.10243908163267, 298.29584687172019, 361.59696479591844, 29.556062499999996, 84.769836188046639, 160.74966900510205, 246.17866242711372, 346.31590522351797, 462.23331913265304, 600.79137528425667, 745.49898852040815, 25.116028571428572, 117.3185883381924, 229.46098265306119, 356.98902483965014, 509.00310241010675, 687.36419918367335, 903.28690369679305, 1129.4010122448979, 22.869793469387755, 151.34435734499516, 305.45451635568514, 488.96920695043741, 713.93443163848406, 980.47258414577254, 1273.7336899620996, 1572.743070204082, 22.555100408163263, 186.67057383090378, 387.85972008746353, 639.58847130029164, 956.05983537803672, 1333.4321309271136, 1704.0085286822157, 2068.4194277551019, 22.240407346938778, 221.99679031681239, 470.26492381924197, 790.20773565014576, 1198.1852391175898, 1686.3916777084546, 2134.2833674023323, 2564.0957853061223, 21.925714285714285, 257.3230068Line truncated
|
||||
};
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // Integration tests//
|
||||
|
||||
|
||||
Reference in new issue
Block a user