From e96778c440b85734839661929ecfcde3c423bd8a Mon Sep 17 00:00:00 2001 From: Jostein Alvestad Date: Fri, 26 Feb 2021 14:56:00 +0100 Subject: [PATCH] changes in test-dataset and initial adaptions to the new data set, plus corrections for ScalingFactor --- CMakeLists_files.cmake | 1 + opm/output/eclipse/VectorItems/msw.hpp | 2 +- opm/parser/eclipse/Units/UnitSystem.hpp | 1 + src/opm/output/eclipse/AggregateMSWData.cpp | 7 +- src/opm/parser/eclipse/Units/UnitSystem.cpp | 20 + tests/TEST_AGGREGATE_MSW.DATA | 493 +++++++++ tests/test_AggregateMSWData.cpp | 1092 +++++++------------ 7 files changed, 908 insertions(+), 708 deletions(-) create mode 100644 tests/TEST_AGGREGATE_MSW.DATA diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index e557ff556..598463034 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -461,6 +461,7 @@ if(ENABLE_ECL_OUTPUT) tests/UDQ_TEST_WCONPROD_IUAD-2.DATA tests/UDQ_ACTIONX_TEST1.DATA tests/UDQ_ACTIONX_TEST1_U.DATA + tests/TEST_AGGREGATE_MSW.DATA tests/include_example_pvt.txt tests/include_example_summary.txt tests/include_sgof.txt diff --git a/opm/output/eclipse/VectorItems/msw.hpp b/opm/output/eclipse/VectorItems/msw.hpp index e8f25c497..95d327d47 100644 --- a/opm/output/eclipse/VectorItems/msw.hpp +++ b/opm/output/eclipse/VectorItems/msw.hpp @@ -66,7 +66,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems DeviceBaseStrength = 86, - AbsValICDLength = 87, + ScalingFactor = 87, CalibrFluidDensity = 88, CalibrFluidViscosity = 89, diff --git a/opm/parser/eclipse/Units/UnitSystem.hpp b/opm/parser/eclipse/Units/UnitSystem.hpp index b06d9c891..bfed4730d 100644 --- a/opm/parser/eclipse/Units/UnitSystem.hpp +++ b/opm/parser/eclipse/Units/UnitSystem.hpp @@ -76,6 +76,7 @@ namespace Opm { energy, energy_rate, icd_strength, + aicd_strength, polymer_density, salinity, _count // New entries must be added *before* this diff --git a/src/opm/output/eclipse/AggregateMSWData.cpp b/src/opm/output/eclipse/AggregateMSWData.cpp index 6017a9212..4fa231a95 100644 --- a/src/opm/output/eclipse/AggregateMSWData.cpp +++ b/src/opm/output/eclipse/AggregateMSWData.cpp @@ -638,10 +638,11 @@ namespace { const auto& aicd = segment.autoICD(); rSeg[baseIndex + Ix::DeviceBaseStrength] = - usys.from_si(M::icd_strength, aicd.strength()); + usys.from_si(M::aicd_strength, aicd.strength()); - rSeg[baseIndex + Ix::AbsValICDLength] = - usys.from_si(M::length, std::abs(aicd.length())); + rSeg[baseIndex + Ix::ScalingFactor] = ((aicd.methodFlowScaling() == 1) || + ((aicd.methodFlowScaling() < 0) && (aicd.length() < 0))) ? + usys.from_si(M::length, aicd.scalingFactor()) : aicd.scalingFactor(); rSeg[baseIndex + Ix::CalibrFluidDensity] = usys.from_si(M::density, aicd.densityCalibration()); diff --git a/src/opm/parser/eclipse/Units/UnitSystem.cpp b/src/opm/parser/eclipse/Units/UnitSystem.cpp index 8d63ef400..ac236ef77 100644 --- a/src/opm/parser/eclipse/Units/UnitSystem.cpp +++ b/src/opm/parser/eclipse/Units/UnitSystem.cpp @@ -88,6 +88,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_metric[] = { @@ -127,6 +128,7 @@ namespace { 1 / Metric::Energy, 1 / ( Metric::Energy / Metric::Time ), 1 / (Metric::Pressure / Opm::unit::square(Metric::GeomVolume / Metric::Time)), + 1 / (Metric::Pressure / Metric::Density / Opm::unit::square(Metric::GeomVolume / Metric::Time)), 1 / Metric::PolymerDensity, 1 / Metric::Salinity, }; @@ -168,6 +170,7 @@ namespace { Metric::Energy, Metric::Energy / Metric::Time, Metric::Pressure / Opm::unit::square(Metric::GeomVolume / Metric::Time), + Metric::Pressure / Metric::Density / Opm::unit::square(Metric::GeomVolume / Metric::Time), Metric::PolymerDensity, Metric::Salinity, }; @@ -209,6 +212,7 @@ namespace { "KJ", /* energy */ "KJ/DAY", /* energy rate*/ "BARS/(RM3/DAY)2", /* ICD strength parameter */ + "BARS/(KG/SM3)/(RM3/DAY)2", /* AICD strength parameter */ "KG / SM3", /*polymer density */ "KG / SM3", /*salinity */ }; @@ -272,6 +276,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_field[] = { @@ -311,6 +316,7 @@ namespace { 1 / Field::Energy, 1 / (Field::Energy / Field::Time), 1 / (Field::Pressure / Opm::unit::square(Field::GeomVolume / Field::Time)), + 1 / (Field::Pressure / Field::Density / Opm::unit::square(Field::GeomVolume / Field::Time)), 1 / Field::PolymerDensity, 1 / Field::Salinity, }; @@ -352,6 +358,7 @@ namespace { Field::Energy, Field::Energy / Field::Time, Field::Pressure / Opm::unit::square(Field::GeomVolume / Field::Time), + Field::Pressure / Field::Density / Opm::unit::square(Field::GeomVolume / Field::Time), Field::PolymerDensity, Field::Salinity, }; @@ -393,6 +400,7 @@ namespace { "BTU", /* energy */ "BTU/DAY", /* energy rate*/ "PSI/(RFT3/DAY)2", /* ICD strength parameter */ + "PSI/(LB/FT3)/(RFT3/DAY)2", /* AICD strength parameter */ "LB/STB", /*polymer density */ "LB/STB", /*salinity */ }; @@ -456,6 +464,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_lab[] = { @@ -495,6 +504,7 @@ namespace { 1 / Lab::Energy, 1 / ( Lab::Energy / Lab::Time ), 1 / (Lab::Pressure / Opm::unit::square(Lab::GeomVolume / Lab::Time)), + 1 / (Lab::Pressure / Lab::Density / Opm::unit::square(Lab::GeomVolume / Lab::Time)), 1 / Lab::PolymerDensity, 1 / Lab::Salinity, }; @@ -536,6 +546,7 @@ namespace { Lab::Energy, Lab::Energy / Lab::Time, Lab::Pressure / Opm::unit::square(Lab::GeomVolume / Lab::Time), + Lab::Pressure / Lab::Density / Opm::unit::square(Lab::GeomVolume / Lab::Time), Lab::PolymerDensity, Lab::Salinity, }; @@ -577,6 +588,7 @@ namespace { "J", /* energy */ "J/HR", /* energy */ "ATM/(RCC/H)2", /* ICD strength parameter */ + "ATM/(G/SCC)/(RCC/H)2", /* AICD strength parameter */ "G/SCC", /*polymer density */ "G/SCC", /*salinity */ }; @@ -640,6 +652,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_pvt_m[] = { @@ -679,6 +692,7 @@ namespace { 1 / PVT_M::Energy, 1 / ( PVT_M::Energy/ PVT_M::Time ), 1 / (PVT_M::Pressure / Opm::unit::square(PVT_M::GeomVolume / PVT_M::Time)), + 1 / (PVT_M::Pressure / PVT_M::Density / Opm::unit::square(PVT_M::GeomVolume / PVT_M::Time)), 1 / PVT_M::PolymerDensity, 1 / PVT_M::Salinity, }; @@ -720,6 +734,7 @@ namespace { PVT_M::Energy, PVT_M::Energy / PVT_M::Time, PVT_M::Pressure / Opm::unit::square(PVT_M::GeomVolume / PVT_M::Time), + PVT_M::Pressure / PVT_M::Density / Opm::unit::square(PVT_M::GeomVolume / PVT_M::Time), PVT_M::PolymerDensity, PVT_M::Salinity, }; @@ -761,6 +776,7 @@ namespace { "KJ" /* energy */, "KJ/DAY" /* energy */, "ATM/(RM3/DAY)2", /* ICD strength parameter */ + "ATM/(KG/SM3)/(RM3/DAY)2", /* AICD strength parameter */ "KG/SM3", /*polymer density */ "KG/SM3", /*salinity */ }; @@ -824,6 +840,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_input[] = { @@ -865,6 +882,7 @@ namespace { 1, 1, 1, + 1, }; static const double from_input[] = { @@ -906,6 +924,7 @@ namespace { 1, 1, 1, + 1, }; static constexpr const char* input_names[static_cast(UnitSystem::measure::_count)] = { @@ -945,6 +964,7 @@ namespace { "KJ", /* energy */ "KJ/DAY", /* energy rate*/ "BARS/(RM3/DAY)2", /* ICD strength parameter */ + "BARS/(KG/SM3)/(RM3/DAY)2", /* AICD strength parameter */ "KG/SM3", /*polymer density */ "KG/SM3", /*salinity */ }; diff --git a/tests/TEST_AGGREGATE_MSW.DATA b/tests/TEST_AGGREGATE_MSW.DATA new file mode 100644 index 000000000..f0b677bed --- /dev/null +++ b/tests/TEST_AGGREGATE_MSW.DATA @@ -0,0 +1,493 @@ +-- This reservoir simulation deck is made available under the Open Database +-- License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in +-- individual contents of the database are licensed under the Database Contents +-- License: http://opendatacommons.org/licenses/dbcl/1.0/ + +-- Copyright (C) 2015 Statoil + +-- This simulation is based on the data given in +-- 'Comparison of Solutions to a Three-Dimensional +-- Black-Oil Reservoir Simulation Problem' by Aziz S. Odeh, +-- Journal of Petroleum Technology, January 1981 + + +--------------------------------------------------------------------------- +------------------------ SPE1 - CASE 1 ------------------------------------ +--------------------------------------------------------------------------- + +RUNSPEC +-- ------------------------------------------------------------------------- + +TITLE + SPE1 - CASE 1 + +DIMENS + 10 5 10 / + +-- The number of equilibration regions is inferred from the EQLDIMS +-- keyword. +EQLDIMS +/ + +-- The number of PVTW tables is inferred from the TABDIMS keyword; +-- when no data is included in the keyword the default values are used. +TABDIMS +/ + +OIL +GAS +WATER +DISGAS +-- As seen from figure 4 in Odeh, GOR is increasing with time, +-- which means that dissolved gas is present + +FIELD + +START + 1 'JAN' 2015 / + +WELLDIMS +-- Item 1: maximum number of wells in the model +-- - there are two wells in the problem; injector and producer +-- Item 2: maximum number of grid blocks connected to any one well +-- - must be one as the wells are located at specific grid blocks +-- Item 3: maximum number of groups in the model +-- - we are dealing with only one 'group' +-- Item 4: maximum number of wells in any one group +-- - there must be two wells in a group as there are two wells in total + 3 20 1 3 / + + +WSEGDIMS + 2 32 5 / + +UNIFIN +UNIFOUT + +START + 1 'JAN' 2015 / + +GRID + +-- The INIT keyword is used to request an .INIT file. The .INIT file +-- is written before the simulation actually starts, and contains grid +-- properties and saturation tables as inferred from the input +-- deck. There are no other keywords which can be used to configure +-- exactly what is written to the .INIT file. +INIT + + +-- ------------------------------------------------------------------------- +--NOECHO + +BOX + 1 10 1 5 1 1 / + +TOPS +50*7000 / + +BOX +1 10 1 5 1 10 / + +DXV +10*100 / +DYV +5*100 / +DZ +100*20 +50*100 +350*20 +/ + +EQUALS +-- 'DX' 100 / +-- 'DY' 100 / + 'PERMX' 500 / + 'PERMZ' 50 / +-- 'DZ' 20 / + 'PORO' 0.2 / +-- 'TOPS' 7000 1 10 1 5 1 1 / +-- 'DZ' 100 1 10 1 5 3 3 / +-- 'PORO' 0.0 1 10 1 5 3 3 / + / + +COPY + PERMX PERMY / + / + + +ECHO + +PROPS +-- ------------------------------------------------------------------------- + +PVTW +-- Item 1: pressure reference (psia) +-- Item 2: water FVF (rb per bbl or rb per stb) +-- Item 3: water compressibility (psi^{-1}) +-- Item 4: water viscosity (cp) +-- Item 5: water 'viscosibility' (psi^{-1}) + +-- Using values from Norne: +-- In METRIC units: +-- 277.0 1.038 4.67E-5 0.318 0.0 / +-- In FIELD units: + 4017.55 1.038 3.22E-6 0.318 0.0 / + +ROCK +-- Item 1: reference pressure (psia) +-- Item 2: rock compressibility (psi^{-1}) + +-- Using values from table 1 in Odeh: + 14.7 3E-6 / + +SWOF +-- Column 1: water saturation +-- - this has been set to (almost) equally spaced values from 0.12 to 1 +-- Column 2: water relative permeability +-- - generated from the Corey-type approx. formula +-- the coeffisient is set to 10e-5, S_{orw}=0 and S_{wi}=0.12 +-- Column 3: oil relative permeability when only oil and water are present +-- - we will use the same values as in column 3 in SGOF. +-- This is not really correct, but since only the first +-- two values are of importance, this does not really matter +-- Column 4: water-oil capillary pressure (psi) + +0.12 0 1 0 +0.18 4.64876033057851E-008 1 0 +0.24 0.000000186 0.997 0 +0.3 4.18388429752066E-007 0.98 0 +0.36 7.43801652892562E-007 0.7 0 +0.42 1.16219008264463E-006 0.35 0 +0.48 1.67355371900826E-006 0.2 0 +0.54 2.27789256198347E-006 0.09 0 +0.6 2.97520661157025E-006 0.021 0 +0.66 3.7654958677686E-006 0.01 0 +0.72 4.64876033057851E-006 0.001 0 +0.78 0.000005625 0.0001 0 +0.84 6.69421487603306E-006 0 0 +0.91 8.05914256198347E-006 0 0 +1 0.00001 0 0 / + + +SGOF +-- Column 1: gas saturation +-- Column 2: gas relative permeability +-- Column 3: oil relative permeability when oil, gas and connate water are present +-- Column 4: oil-gas capillary pressure (psi) +-- - stated to be zero in Odeh's paper + +-- Values in column 1-3 are taken from table 3 in Odeh's paper: +0 0 1 0 +0.001 0 1 0 +0.02 0 0.997 0 +0.05 0.005 0.980 0 +0.12 0.025 0.700 0 +0.2 0.075 0.350 0 +0.25 0.125 0.200 0 +0.3 0.190 0.090 0 +0.4 0.410 0.021 0 +0.45 0.60 0.010 0 +0.5 0.72 0.001 0 +0.6 0.87 0.0001 0 +0.7 0.94 0.000 0 +0.85 0.98 0.000 0 +0.88 0.984 0.000 0 / +--1.00 1.0 0.000 0 / +-- Warning from Eclipse: first sat. value in SWOF + last sat. value in SGOF +-- must not be greater than 1, but Eclipse still runs +-- Flow needs the sum to be excactly 1 so I added a row with gas sat. = 0.88 +-- The corresponding krg value was estimated by assuming linear rel. between +-- gas sat. and krw. between gas sat. 0.85 and 1.00 (the last two values given) + +DENSITY +-- Density (lb per ft³) at surface cond. of +-- oil, water and gas, respectively (in that order) + +-- Using values from Norne: +-- In METRIC units: +-- 859.5 1033.0 0.854 / +-- In FIELD units: + 53.66 64.49 0.0533 / + +PVDG +-- Column 1: gas phase pressure (psia) +-- Column 2: gas formation volume factor (rb per Mscf) +-- - in Odeh's paper the units are said to be given in rb per bbl, +-- but this is assumed to be a mistake: FVF-values in Odeh's paper +-- are given in rb per scf, not rb per bbl. This will be in +-- agreement with conventions +-- Column 3: gas viscosity (cP) + +-- Using values from lower right table in Odeh's table 2: +14.700 166.666 0.008000 +264.70 12.0930 0.009600 +514.70 6.27400 0.011200 +1014.7 3.19700 0.014000 +2014.7 1.61400 0.018900 +2514.7 1.29400 0.020800 +3014.7 1.08000 0.022800 +4014.7 0.81100 0.026800 +5014.7 0.64900 0.030900 +9014.7 0.38600 0.047000 / + +PVTO +-- Column 1: dissolved gas-oil ratio (Mscf per stb) +-- Column 2: bubble point pressure (psia) +-- Column 3: oil FVF for saturated oil (rb per stb) +-- Column 4: oil viscosity for saturated oil (cP) + +-- Use values from top left table in Odeh's table 2: + 0.00100 14.7 1.0620 1.0400 / + 0.09050 264.7 1.1500 0.9750 / + 0.18000 514.7 1.2070 0.9100 / + 0.37100 1014.7 1.2950 0.8300 / + 0.63600 2014.7 1.4350 0.6950 / + 0.77500 2514.7 1.5000 0.6410 / + 0.93000 3014.7 1.5650 0.5940 / + 1.27000 4014.7 1.6950 0.5100 + 5014.7 1.6710 0.5490 + 9014.7 1.5790 0.7400 / + 1.61800 5014.7 1.8270 0.4490 + 9014.7 1.7260 0.6050 / + 2.00000 8014.7 1.9500 0.3000 + 9014.7 1.8500 0.5500 / +/ +-- It is required to enter data for undersaturated oil for the highest GOR +-- (i.e. the last row) in the PVTO table. +-- In order to fulfill this requirement, values for oil FVF and viscosity +-- at 9014.7psia and GOR=1.618 for undersaturated oil have been approximated: +-- It has been assumed that there is a linear relation between the GOR +-- and the FVF when keeping the pressure constant at 9014.7psia. +-- From Odeh we know that (at 9014.7psia) the FVF is 2.357 at GOR=2.984 +-- for saturated oil and that the FVF is 1.579 at GOR=1.27 for undersaturated oil, +-- so it is possible to use the assumption described above. +-- An equivalent approximation for the viscosity has been used. + +SOLUTION +-- ------------------------------------------------------------------------- + +EQUIL +-- Item 1: datum depth (ft) +-- Item 2: pressure at datum depth (psia) +-- - Odeh's table 1 says that initial reservoir pressure is +-- 4800 psi at 8400ft, which explains choice of item 1 and 2 +-- Item 3: depth of water-oil contact (ft) +-- - chosen to be directly under the reservoir +-- Item 4: oil-water capillary pressure at the water oil contact (psi) +-- - given to be 0 in Odeh's paper +-- Item 5: depth of gas-oil contact (ft) +-- - chosen to be directly above the reservoir +-- Item 6: gas-oil capillary pressure at gas-oil contact (psi) +-- - given to be 0 in Odeh's paper +-- Item 7: RSVD-table +-- Item 8: RVVD-table +-- Item 9: Set to 0 as this is the only value supported by OPM + +-- Item #: 1 2 3 4 5 6 7 8 9 + 7200 4800 7300 0 7000 0 1 0 0 / + +RSVD +-- Dissolved GOR is initially constant with depth through the reservoir. +-- The reason is that the initial reservoir pressure given is higher +---than the bubble point presssure of 4014.7psia, meaning that there is no +-- free gas initially present. +7000 1.270 +8000 1.270 / + +SUMMARY +-- ------------------------------------------------------------------------- + +-- 1a) Oil rate vs time +FOPR +-- Field Oil Production Rate + +-- 1b) GOR vs time +WGOR +-- Well Gas-Oil Ratio + 'PROD' +/ +-- Using FGOR instead of WGOR:PROD results in the same graph +FGOR + + +-- In order to compare Eclipse with Flow: +WBHP +/ +WGIR +/ +WGIT +/ +WGPR +/ +WGPT +/ +WOIR +/ +WOIT + +/ +WOPR + +/ +WOPT +/ +WWIR +/ +WWIT +/ +WWPR +/ +WWPT +/ + +SOFR + 'PROD' / + 'WINJ' / +/ + +SPR + 'PROD' / + 'WINJ' / +/ + +SPRD + 'PROD' / + 'WINJ' / +/ + + +SCHEDULE +-- ------------------------------------------------------------------------- + +TUNING +1* 1. / +/ +20 1 50 1 16 16 / + +TUNINGDP +/ + + +RPTSCHED + 'PRES' 'SGAS' 'RS' 'WELLS=5' WELSPECS / + +RPTRST + 'BASIC=2' / + + +-- If no resolution (i.e. case 1), the two following lines must be added: +--DRSDT +-- 0 / +-- if DRSDT is set to 0, GOR cannot rise and free gas does not +-- dissolve in undersaturated oil -> constant bubble point pressure + +WELSPECS + 'PROD' 'G' 1 5 7030 'OIL' 0.0 'STD' 'STOP' / + 'WINJ' 'G' 10 1 7030 'WAT' 0.0 'STD' 'STOP' / +/ + +COMPDAT + + 'PROD' 1 5 2 2 3* 0.2 3* 'X' / + 'PROD' 2 5 2 2 3* 0.2 3* 'X' / + 'PROD' 3 5 2 2 3* 0.2 3* 'X' / + 'PROD' 4 5 2 2 3* 0.2 3* 'X' / + 'PROD' 5 5 2 2 3* 0.2 3* 'X' / + +'WINJ' 10 1 9 9 3* 0.2 3* 'X' / + 'WINJ' 9 1 9 9 3* 0.2 3* 'X' / + 'WINJ' 8 1 9 9 3* 0.2 3* 'X' / + 'WINJ' 7 1 9 9 3* 0.2 3* 'X' / + 'WINJ' 6 1 9 9 3* 0.2 3* 'X' / +/ + +WELSEGS + +-- Name Dep 1 Tlen 1 Vol 1 + 'PROD' 7010 10 0.31 'INC' / + +-- First Last Branch Outlet Length Depth Diam Ruff Area Vol +-- Seg Seg Num Seg Chang +-- Main Stem + 2 2 1 1 20 20 0.2 1.E-3 1* 1* / +-- Top Branch + 3 3 2 2 50 0 0.2 1.E-3 1* 1* / + 4 7 2 3 100 0 0.2 1.E-3 1* 1* / + 8 8 3 4 0.32800 0 0.500 3.3E-5 / + 9 9 4 5 0.32800 0 0.500 3.3E-5 / + 10 10 5 6 0.32800 0 0.500 3.3E-5 / + / + +COMPSEGS + +-- Name + 'PROD' / + +-- I J K Brn Start End Dirn End +-- No Length Length Penet Range +-- Top Branch + 1 5 2 2 30 130 'X' 3* / + 2 5 2 2 130 230 'X' 3* / + 3 5 2 2 230 330 'X' 3* / + 4 5 2 2 330 430 'X' 3* / + 5 5 2 2 430 530 'X' 3* / +-- Middle Branch + / + +WSEGAICD +-- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... + PROD 8 8 3.260E-05 0.06391 63.678 0.48 1* 1* 1* 1 1* 2.1 1.2 OPEN 1* 1* 1* 1* 1* 1* / + PROD 9 9 3.260E-05 0.07448 63.678 0.48 1* 1* 1* 1 1* 2.1 1.2 OPEN 1* 1* 1* 1* 1* 1* / + PROD 10 10 3.260E-05 0.0876 63.678 0.48 0.53 0.048 4.89 0 9.876E6 2.1 1.2 OPEN 0.92 0.89 0.91 1.01 1.02 1.03 / +/ + +WELSEGS + +-- Name Dep 1 Tlen 1 Vol 1 + 'WINJ' 7010 10 0.31 'INC' / + +-- First Last Branch Outlet Length Depth Diam Ruff Area Vol +-- Seg Seg Num Seg Chang +-- Main Stem + 2 13 1 1 20 20 0.2 1.E-3 1* 1* / + +-- Bottom Branch + 14 14 2 13 50 0 0.2 1.E-3 1* 1* / + 15 18 2 14 100 0 0.2 1.E-3 1* 1* / + / + +COMPSEGS + +-- Name + 'WINJ' / + +-- I J K Brn Start End Dirn End +-- No Length Length Penet Range + +-- Bottom Branch + 10 1 9 2 270 370 'X' 3* / + 9 1 9 2 370 470 'X' 3* / + 8 1 9 2 470 570 'X' 3* / + 7 1 9 2 570 670 'X' 3* / + 6 1 9 2 670 770 'X' 3* / + / + + +WCONPROD + 'PROD' 'OPEN' 'GRAT' 2* 100000. 2000 1* 2500 1* / + / + +WCONINJE + 'WINJ' 'WAT' 'OPEN' 'RESV' 1* 2000 8000 1* / + / + + +TSTEP +--Advance the simulater once a month for TEN years: +30 +30 +180. +/ + +END diff --git a/tests/test_AggregateMSWData.cpp b/tests/test_AggregateMSWData.cpp index 366ff1fbc..1828ad019 100644 --- a/tests/test_AggregateMSWData.cpp +++ b/tests/test_AggregateMSWData.cpp @@ -19,6 +19,7 @@ #define BOOST_TEST_MODULE Aggregate_MSW_Data #include +#include #include @@ -27,6 +28,7 @@ #include #include +#include #include @@ -45,557 +47,101 @@ #include #include -struct MockIH -{ - MockIH(const int numWells, +namespace { - const int nsegWell = 2, // E100 - const int isegPerWell = 22, // E100 - const int rsegPerWell = 146, // E100 - const int ilbsPerWell = 5, // E100 - const int ilbrPerWell = 10); // E100 +namespace VI = ::Opm::RestartIO::Helpers::VectorItems; - - std::vector value; - - using Sz = std::vector::size_type; - - Sz nwells; - - Sz nsegwl; - Sz nswlmx; - Sz nsegmx; - Sz nlbrmx; - Sz nisegz; - Sz nrsegz; - Sz nilbrz; -}; - -MockIH::MockIH(const int numWells, - const int nsegWell, - const int isegPerWell, - const int rsegPerWell, - const int ilbsPerWell, - const int ilbrPerWell ) - : value(411, 0) -{ - using Ix = ::Opm::RestartIO::Helpers::VectorItems::intehead; - - this->nwells = this->value[Ix::NWELLS] = numWells; - - this->nsegwl = this->value[Ix::NSEGWL] = nsegWell; - this->nswlmx = this->value[Ix::NSWLMX] = 2; - this->nsegmx = this->value[Ix::NSEGMX] = 32; - this->nisegz = this->value[Ix::NISEGZ] = isegPerWell; - this->nrsegz = this->value[Ix::NRSEGZ] = rsegPerWell; - this->nlbrmx = this->value[Ix::NLBRMX] = ilbsPerWell; - this->nilbrz = this->value[Ix::NILBRZ] = ilbrPerWell; +Opm::Deck first_sim(std::string fname) { + return Opm::Parser {} .parseFile(fname); } -namespace { - Opm::Deck first_sim() +Opm::SummaryState sim_state() +{ + auto state = Opm::SummaryState{Opm::TimeService::now()}; + + state.update("SPR:PROD:1", 235.); + state.update("SPR:PROD:2", 237.); + state.update("SPR:PROD:3", 239.); + state.update("SPR:PROD:4", 243.); + + state.update("SOFR:PROD:1", 35.); + state.update("SOFR:PROD:2", 30.); + state.update("SOFR:PROD:3", 25.); + state.update("SOFR:PROD:4", 20.); + + state.update("SGFR:PROD:1", 25.E3); + state.update("SGFR:PROD:2", 20.E3); + state.update("SGFR:PROD:3", 15.E3); + state.update("SGFR:PROD:4", 10.E3); + + state.update("SWFR:PROD:1", 11.); + state.update("SWFR:PROD:2", 12.); + state.update("SWFR:PROD:3", 13.); + state.update("SWFR:PROD:4", 14.); + + state.update("SPR:WINJ:1", 310.); + state.update("SPR:WINJ:2", 320.); + state.update("SPR:WINJ:3", 330.); + state.update("SPR:WINJ:4", 340.); + + state.update("SWFR:WINJ:1", 21.); + state.update("SWFR:WINJ:2", 22.); + state.update("SWFR:WINJ:3", 23.); + state.update("SWFR:WINJ:4", 24.); + + state.update("WBHP:WINJ", 234.); + return state; +} +Opm::data::WellRates wr() +{ + using o = ::Opm::data::Rates::opt; + + auto xw = ::Opm::data::WellRates {}; + { - // Mostly copy of tests/FIRST_SIM.DATA - const std::string input = std::string { - R"~( -RUNSPEC - -TITLE - TWO MULTI-LATERAL WELLS; PRODUCER AND INJECTOR - MULTI-SEGMENT BRANCHES - -DIMENS - 10 5 10 / - - -OIL - -WATER - -GAS - -DISGAS - -FIELD - -TABDIMS - 1 1 15 15 2 15 / - -EQLDIMS - 2 / - -WELLDIMS - 3 20 1 3 / - -WSEGDIMS - 2 32 5 / - -UNIFIN -UNIFOUT - ---FMTIN ---FMTOUT - -START - 1 'JAN' 2015 / - --- RPTRUNSP - -GRID ========================================================= - ---NOGGF -BOX - 1 10 1 5 1 1 / - -TOPS -50*7000 / - -BOX -1 10 1 5 1 10 / - -DXV -10*100 / -DYV -5*100 / -DZV -2*20 100 7*20 / - -EQUALS --- 'DX' 100 / --- 'DY' 100 / - 'PERMX' 50 / - 'PERMZ' 5 / --- 'DZ' 20 / - 'PORO' 0.2 / --- 'TOPS' 7000 1 10 1 5 1 1 / --- 'DZ' 100 1 10 1 5 3 3 / --- 'PORO' 0.0 1 10 1 5 3 3 / - / - -COPY - PERMX PERMY / - / - -RPTGRID - -- Report Levels for Grid Section Data - -- - / - -PORO - 500*0.15 / - -PROPS ========================================================== - --- WATER RELATIVE PERMEABILITY AND CAPILLARY PRESSURE ARE TABULATED AS --- A FUNCTION OF WATER SATURATION. --- --- SWAT KRW PCOW -SWFN - - 0.12 0 0 - 1.0 0.00001 0 / - --- SIMILARLY FOR GAS --- --- SGAS KRG PCOG -SGFN - - 0 0 0 - 0.02 0 0 - 0.05 0.005 0 - 0.12 0.025 0 - 0.2 0.075 0 - 0.25 0.125 0 - 0.3 0.19 0 - 0.4 0.41 0 - 0.45 0.6 0 - 0.5 0.72 0 - 0.6 0.87 0 - 0.7 0.94 0 - 0.85 0.98 0 - 1.0 1.0 0 -/ - --- OIL RELATIVE PERMEABILITY IS TABULATED AGAINST OIL SATURATION --- FOR OIL-WATER AND OIL-GAS-CONNATE WATER CASES --- --- SOIL KROW KROG -SOF3 - - 0 0 0 - 0.18 0 0 - 0.28 0.0001 0.0001 - 0.38 0.001 0.001 - 0.43 0.01 0.01 - 0.48 0.021 0.021 - 0.58 0.09 0.09 - 0.63 0.2 0.2 - 0.68 0.35 0.35 - 0.76 0.7 0.7 - 0.83 0.98 0.98 - 0.86 0.997 0.997 - 0.879 1 1 - 0.88 1 1 / - - --- PVT PROPERTIES OF WATER --- --- REF. PRES. REF. FVF COMPRESSIBILITY REF VISCOSITY VISCOSIBILITY -PVTW - 4014.7 1.029 3.13D-6 0.31 0 / - --- ROCK COMPRESSIBILITY --- --- REF. PRES COMPRESSIBILITY -ROCK - 14.7 3.0D-6 / - --- SURFACE DENSITIES OF RESERVOIR FLUIDS --- --- OIL WATER GAS -DENSITY - 49.1 64.79 0.06054 / - --- PVT PROPERTIES OF DRY GAS (NO VAPOURISED OIL) --- WE WOULD USE PVTG TO SPECIFY THE PROPERTIES OF WET GAS --- --- PGAS BGAS VISGAS -PVDG - 14.7 166.666 0.008 - 264.7 12.093 0.0096 - 514.7 6.274 0.0112 - 1014.7 3.197 0.014 - 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.047 / - --- PVT PROPERTIES OF LIVE OIL (WITH DISSOLVED GAS) --- WE WOULD USE PVDO TO SPECIFY THE PROPERTIES OF DEAD OIL --- --- FOR EACH VALUE OF RS THE SATURATION PRESSURE, FVF AND VISCOSITY --- ARE SPECIFIED. FOR RS=1.27 AND 1.618, THE FVF AND VISCOSITY OF --- UNDERSATURATED OIL ARE DEFINED AS A FUNCTION OF PRESSURE. DATA --- FOR UNDERSATURATED OIL MAY BE SUPPLIED FOR ANY RS, BUT MUST BE --- SUPPLIED FOR THE HIGHEST RS (1.618). --- --- RS POIL FVFO VISO -PVTO - 0.001 14.7 1.062 1.04 / - 0.0905 264.7 1.15 0.975 / - 0.18 514.7 1.207 0.91 / - 0.371 1014.7 1.295 0.83 / - 0.636 2014.7 1.435 0.695 / - 0.775 2514.7 1.5 0.641 / - 0.93 3014.7 1.565 0.594 / - 1.270 4014.7 1.695 0.51 - 5014.7 1.671 0.549 - 9014.7 1.579 0.74 / - 1.618 5014.7 1.827 0.449 - 9014.7 1.726 0.605 / -/ - - -RPTPROPS --- PROPS Reporting Options --- -/ - -REGIONS =========================================================== - - -FIPNUM - - 100*1 - 400*2 -/ - -EQLNUM - - 100*1 - 400*2 -/ - -RPTREGS - - / - -SOLUTION ============================================================ - -EQUIL - 7020.00 2700.00 7990.00 .00000 7200.00 .00000 0 0 5 / - 7200.00 3700.00 7300.00 .00000 7100.00 .00000 1 0 5 / - -RSVD 2 TABLES 3 NODES IN EACH FIELD 12:00 17 AUG 83 - 7000.0 1.0000 - 7990.0 1.0000 -/ - 7000.0 1.0000 - 7400.0 1.0000 -/ - -RPTRST --- Restart File Output Control --- -'BASIC=2' 'FLOWS' 'POT' 'PRES' / - ---RPTSOL --- --- Initialisation Print Output --- ---'PRES' 'SOIL' 'SWAT' 'SGAS' 'RS' 'RESTART=1' 'FIP=2' 'EQUIL' 'RSVD' / - -SUMMARY =========================================================== - -FOPR - -WOPR - 'PROD' - / - -FGPR - -FWPR - -FWIR - -FWCT - -FGOR - ---RUNSUM - -ALL - -MSUMLINS - -MSUMNEWT - -SEPARATE - -SCHEDULE =========================================================== - -DEBUG - 1 3 / - -DRSDT - 1.0E20 / - -RPTSCHED - 'PRES' 'SWAT' 'SGAS' 'RESTART=1' 'RS' 'WELLS=2' 'SUMMARY=2' - 'CPU=2' 'WELSPECS' 'NEWTON=2' / - -NOECHO - - -ECHO - -WELSPECS - 'PROD' 'G' 1 5 7030 'OIL' 0.0 'STD' 'STOP' / - 'WINJ' 'G' 10 1 7030 'WAT' 0.0 'STD' 'STOP' / -/ - -COMPDAT - - 'PROD' 1 5 2 2 3* 0.2 3* 'X' / - 'PROD' 2 5 2 2 3* 0.2 3* 'X' / - 'PROD' 3 5 2 2 3* 0.2 3* 'X' / - 'PROD' 4 5 2 2 3* 0.2 3* 'X' / - 'PROD' 5 5 2 2 3* 0.2 3* 'X' / - -'WINJ' 10 1 9 9 3* 0.2 3* 'X' / - 'WINJ' 9 1 9 9 3* 0.2 3* 'X' / - 'WINJ' 8 1 9 9 3* 0.2 3* 'X' / - 'WINJ' 7 1 9 9 3* 0.2 3* 'X' / - 'WINJ' 6 1 9 9 3* 0.2 3* 'X' / -/ - -WELSEGS - --- Name Dep 1 Tlen 1 Vol 1 - 'PROD' 7010 10 0.31 'INC' / - --- First Last Branch Outlet Length Depth Diam Ruff Area Vol --- Seg Seg Num Seg Chang --- Main Stem - 2 12 1 1 20 20 0.2 1.E-3 1* 1* / --- Top Branch - 13 13 2 3 50 0 0.2 1.E-3 1* 1* / - 14 17 2 13 100 0 0.2 1.E-3 1* 1* / - 18 18 2 3 0.10000 0 0.15200 1.E-5 / - 19 19 2 4 0.10000 0 0.15200 1.E-5 / - 20 20 2 5 0.10000 0 0.15200 1.E-5 / - / - -COMPSEGS - --- Name - 'PROD' / - --- I J K Brn Start End Dirn End --- No Length Length Penet Range --- Top Branch - 1 5 2 2 30 130 'X' 3* / - 2 5 2 2 130 230 'X' 3* / - 3 5 2 2 230 330 'X' 3* / - 4 5 2 2 330 430 'X' 3* / - 5 5 2 2 430 530 'X' 3* / --- Middle Branch - / - -WSEGAICD - PROD 18 18 0.000175 0.019479 1020 0.48 1* 1* 1* 1 1* 2.1 1.2 OPEN 1* 1* 1* 1* 1* 1* / - PROD 19 19 0.000175 0.04099 1020 0.48 1* 1* 1* 1 1* 2.1 1.2 OPEN 1* 1* 1* 1* 1* 1* / - PROD 20 20 0.000175 0.045951 1020 0.48 1* 1* 1* 1 1* 2.1 1.2 OPEN 1* 1* 1* 1* 1* 1* / -/ - -WELSEGS - --- Name Dep 1 Tlen 1 Vol 1 - 'WINJ' 7010 10 0.31 'INC' / - --- First Last Branch Outlet Length Depth Diam Ruff Area Vol --- Seg Seg Num Seg Chang --- Main Stem - 2 14 1 1 20 20 0.2 1.E-3 1* 1* / - --- Bottom Branch - 15 15 2 14 50 0 0.2 1.E-3 1* 1* / - 16 19 2 15 100 0 0.2 1.E-3 1* 1* / - / - -COMPSEGS - --- Name - 'WINJ' / - --- I J K Brn Start End Dirn End --- No Length Length Penet Range - --- Bottom Branch - 10 1 9 2 270 370 'X' 3* / - 9 1 9 2 370 470 'X' 3* / - 8 1 9 2 470 570 'X' 3* / - 7 1 9 2 570 670 'X' 3* / - 6 1 9 2 670 770 'X' 3* / - / - - -WCONPROD - 'PROD' 'OPEN' 'LRAT' 3* 2000 1* 2500 1* / - / - -WCONINJE - 'WINJ' 'WAT' 'OPEN' 'RESV' 1* 2000 3500 1* / - / - - -TUNING - / - / - / - -TSTEP - 2 2 -/ - - -END - - -)~" }; - - return Opm::Parser{}.parseString(input); - } - - Opm::SummaryState sim_state() - { - auto state = Opm::SummaryState{Opm::TimeService::now()}; - - state.update("SPR:PROD:1", 235.); - state.update("SPR:PROD:2", 237.); - state.update("SPR:PROD:3", 239.); - state.update("SPR:PROD:4", 243.); - - state.update("SOFR:PROD:1", 35.); - state.update("SOFR:PROD:2", 30.); - state.update("SOFR:PROD:3", 25.); - state.update("SOFR:PROD:4", 20.); - - state.update("SGFR:PROD:1", 25.E3); - state.update("SGFR:PROD:2", 20.E3); - state.update("SGFR:PROD:3", 15.E3); - state.update("SGFR:PROD:4", 10.E3); - - state.update("SWFR:PROD:1", 11.); - state.update("SWFR:PROD:2", 12.); - state.update("SWFR:PROD:3", 13.); - state.update("SWFR:PROD:4", 14.); - - state.update("SPR:WINJ:1", 310.); - state.update("SPR:WINJ:2", 320.); - state.update("SPR:WINJ:3", 330.); - state.update("SPR:WINJ:4", 340.); - - state.update("SWFR:WINJ:1", 21.); - state.update("SWFR:WINJ:2", 22.); - state.update("SWFR:WINJ:3", 23.); - state.update("SWFR:WINJ:4", 24.); - - state.update("WBHP:WINJ", 234.); - return state; - } - Opm::data::WellRates wr() - { - using o = ::Opm::data::Rates::opt; - - auto xw = ::Opm::data::WellRates{}; - - { - xw["PROD"].rates - .set(o::wat, 1.0) - .set(o::oil, 2.0) - .set(o::gas, 3.0); - xw["PROD"].bhp = 213.0; - double qo = 5.; - double qw = 4.; - double qg = 50.; - int firstConnectedCell = 90; // zero-based linear index of (1,5,2) - for (int i = 0; i < 5; i++) { - xw["PROD"].connections.emplace_back(); - auto& c = xw["PROD"].connections.back(); - - c.rates.set(o::wat, qw*(float(i)+1.)) - .set(o::oil, qo*(float(i)+1.)) - .set(o::gas, qg*(float(i)+1.)); - - c.index = firstConnectedCell + i; - } - auto seg = Opm::data::Segment{}; - for (std::size_t i = 1; i < 5; i++) { - xw["PROD"].segments.insert(std::pair(i,seg)); - } - xw["WINJ"].bhp = 234.0; - - xw["WINJ"].rates.set(o::wat, 5.0); - xw["WINJ"].rates.set(o::oil, 0.0); - xw["WINJ"].rates.set(o::gas, 0.0); - qw = 7.; - firstConnectedCell = 409; // zero-based linear index of (10,1,9) - for (int i = 0; i < 5; i++) { - xw["WINJ"].connections.emplace_back(); - auto& c = xw["WINJ"].connections.back(); - - c.rates.set(o::wat, qw*(float(i)+1.)) - .set(o::oil, 0.) - .set(o::gas, 0.); - - c.index = firstConnectedCell - i; - } + xw["PROD"].rates + .set(o::wat, 1.0) + .set(o::oil, 2.0) + .set(o::gas, 3.0); + xw["PROD"].bhp = 213.0; + double qo = 5.; + double qw = 4.; + double qg = 50.; + int firstConnectedCell = 90; // zero-based linear index of (1,5,2) + for (int i = 0; i < 5; i++) { + xw["PROD"].connections.emplace_back(); + auto& c = xw["PROD"].connections.back(); + + c.rates.set(o::wat, qw*(float(i)+1.)) + .set(o::oil, qo*(float(i)+1.)) + .set(o::gas, qg*(float(i)+1.)); + + c.index = firstConnectedCell + i; + } + auto seg = Opm::data::Segment {}; + for (std::size_t i = 1; i < 5; i++) { + xw["PROD"].segments.insert(std::pair(i,seg)); + } + xw["WINJ"].bhp = 234.0; + + xw["WINJ"].rates.set(o::wat, 5.0); + xw["WINJ"].rates.set(o::oil, 0.0); + xw["WINJ"].rates.set(o::gas, 0.0); + qw = 7.; + firstConnectedCell = 409; // zero-based linear index of (10,1,9) + for (int i = 0; i < 5; i++) { + xw["WINJ"].connections.emplace_back(); + auto& c = xw["WINJ"].connections.back(); + + c.rates.set(o::wat, qw*(float(i)+1.)) + .set(o::oil, 0.) + .set(o::gas, 0.); + + c.index = firstConnectedCell - i; } - return xw; } + return xw; +} } struct SimulationCase @@ -622,244 +168,382 @@ BOOST_AUTO_TEST_SUITE(Aggregate_MSW) // test dimensions of multisegment data BOOST_AUTO_TEST_CASE (Constructor) { - const auto ih = MockIH{ 5 }; + const auto simCase = SimulationCase {first_sim("TEST_AGGREGATE_MSW.DATA")}; - const auto amswd = Opm::RestartIO::Helpers::AggregateMSWData{ ih.value }; + Opm::EclipseState es = simCase.es; + Opm::Runspec rspec = es.runspec(); + Opm::SummaryState st = sim_state(); + Opm::Schedule sched = simCase.sched; + Opm::EclipseGrid grid = simCase.grid; - BOOST_CHECK_EQUAL(amswd.getISeg().size(), ih.nswlmx * ih.nsegmx * ih.nisegz); - BOOST_CHECK_EQUAL(amswd.getRSeg().size(), ih.nswlmx * ih.nsegmx * ih.nrsegz); - BOOST_CHECK_EQUAL(amswd.getILBs().size(), ih.nswlmx * ih.nlbrmx); - BOOST_CHECK_EQUAL(amswd.getILBr().size(), ih.nswlmx * ih.nlbrmx * ih.nilbrz); + // Report Step 1: 2008-10-10 --> 2011-01-20 + const auto rptStep = std::size_t {1}; + + double secs_elapsed = 3.1536E07; + const auto ih = Opm::RestartIO::Helpers:: + createInteHead(es, grid, sched, secs_elapsed, + rptStep, rptStep+1, rptStep); + + const auto amswd = Opm::RestartIO::Helpers::AggregateMSWData { ih }; + const auto nswlmx = VI::intehead::NSWLMX; + const auto nsegmx = VI::intehead::NSEGMX; + const auto nisegz = VI::intehead::NISEGZ; + const auto nrsegz = VI::intehead::NRSEGZ; + const auto nlbrmx = VI::intehead::NLBRMX; + const auto nilbrz = VI::intehead::NILBRZ; + BOOST_CHECK_EQUAL(static_cast(amswd.getISeg().size()), ih[nswlmx] * ih[nsegmx] * ih[nisegz]); + BOOST_CHECK_EQUAL(static_cast(amswd.getRSeg().size()), ih[nswlmx] * ih[nsegmx] * ih[nrsegz]); + BOOST_CHECK_EQUAL(static_cast(amswd.getILBs().size()), ih[nswlmx] * ih[nlbrmx]); + BOOST_CHECK_EQUAL(static_cast(amswd.getILBr().size()), ih[nswlmx] * ih[nlbrmx] * ih[nilbrz]); } BOOST_AUTO_TEST_CASE (Declared_MSW_Data) { - const auto simCase = SimulationCase{first_sim()}; - // Report Step 1: 2115-01-01 --> 2015-01-03 - const auto rptStep = std::size_t{1}; + const auto simCase = SimulationCase {first_sim("TEST_AGGREGATE_MSW.DATA")}; - const auto ih = MockIH { - static_cast(simCase.sched.getWells(rptStep).size()) - }; + Opm::EclipseState es = simCase.es; + Opm::Runspec rspec = es.runspec(); + Opm::SummaryState smry = sim_state(); + Opm::Schedule sched = simCase.sched; + Opm::EclipseGrid grid = simCase.grid; + const auto& units = es.getUnits(); - BOOST_CHECK_EQUAL(ih.nwells, MockIH::Sz{2}); - const auto smry = sim_state(); + // Report Step 1: 2008-10-10 --> 2011-01-20 + const auto rptStep = std::size_t {1}; + + double secs_elapsed = 3.1536E07; + const auto ih = Opm::RestartIO::Helpers:: + createInteHead(es, grid, sched, secs_elapsed, + rptStep, rptStep+1, rptStep); + + //BOOST_CHECK_EQUAL(ih.nwells, MockIH::Sz{2}); + const Opm::data::WellRates wrc = wr(); - auto amswd = Opm::RestartIO::Helpers::AggregateMSWData{ih.value}; + auto amswd = Opm::RestartIO::Helpers::AggregateMSWData {ih}; amswd.captureDeclaredMSWData(simCase.sched, - rptStep, - simCase.es.getUnits(), - ih.value, - simCase.grid, - smry, - wrc - ); + rptStep, + units, + ih, + grid, + smry, + wrc + ); // ISEG (PROD) { - auto start = 2*ih.nisegz; + auto start = 2*ih[VI::intehead::NISEGZ]; const auto& iSeg = amswd.getISeg(); - BOOST_CHECK_EQUAL(iSeg[start + 0] , 15); // PROD-segment 3, ordered segment - BOOST_CHECK_EQUAL(iSeg[start + 1] , 2); // PROD-segment 3, outlet segment - BOOST_CHECK_EQUAL(iSeg[start + 2] , 4); // PROD-segment 3, inflow segment current branch - BOOST_CHECK_EQUAL(iSeg[start + 3] , 1); // PROD-segment 3, branch number - BOOST_CHECK_EQUAL(iSeg[start + 4] , 1); // PROD-segment 3, number of inflow branches - BOOST_CHECK_EQUAL(iSeg[start + 5] , 1); // PROD-segment 3, Sum number of inflow branches from first segment to current segment - BOOST_CHECK_EQUAL(iSeg[start + 6] , 0); // PROD-segment 3, number of connections in segment - BOOST_CHECK_EQUAL(iSeg[start + 7] , 0); // PROD-segment 3, sum of connections with lower segmeent number than current segment - BOOST_CHECK_EQUAL(iSeg[start + 8] , 15); // PROD-segment 3, ordered segment + BOOST_CHECK_EQUAL(iSeg[start + 0] , 10); // PROD-segment 3, ordered segment + BOOST_CHECK_EQUAL(iSeg[start + 1] , 2); // PROD-segment 3, outlet segment + BOOST_CHECK_EQUAL(iSeg[start + 2] , 4); // PROD-segment 3, inflow segment current branch + BOOST_CHECK_EQUAL(iSeg[start + 3] , 2); // PROD-segment 3, branch number + BOOST_CHECK_EQUAL(iSeg[start + 4] , 0); // PROD-segment 3, number of inflow branches + BOOST_CHECK_EQUAL(iSeg[start + 5] , 0); // PROD-segment 3, Sum number of inflow branches from first segment to current segment + BOOST_CHECK_EQUAL(iSeg[start + 6] , 1); // PROD-segment 3, number of connections in segment + BOOST_CHECK_EQUAL(iSeg[start + 7] , 1); // PROD-segment 3, sum of connections with lower segmeent number than current segment + BOOST_CHECK_EQUAL(iSeg[start + 8] , 8); // PROD-segment 3, ordered segment - start = 13*ih.nisegz; + start = 9*ih[VI::intehead::NISEGZ]; - BOOST_CHECK_EQUAL(iSeg[start + 0] , 4); // PROD-segment 14, ordered segment - BOOST_CHECK_EQUAL(iSeg[start + 1] , 13); // PROD-segment 14, outlet segment - BOOST_CHECK_EQUAL(iSeg[start + 2] , 15); // PROD-segment 14, inflow segment current branch - BOOST_CHECK_EQUAL(iSeg[start + 3] , 2); // PROD-segment 14, branch number - BOOST_CHECK_EQUAL(iSeg[start + 4] , 0); // PROD-segment 14, number of inflow branches - BOOST_CHECK_EQUAL(iSeg[start + 5] , 0); // PROD-segment 14, Sum number of inflow branches from first segment to current segment - BOOST_CHECK_EQUAL(iSeg[start + 6] , 1); // PROD-segment 14, number of connections in segment - BOOST_CHECK_EQUAL(iSeg[start + 7] , 2); // PROD-segment 14, sum of connections with lower segmeent number than current segment - BOOST_CHECK_EQUAL(iSeg[start + 8] , 4); // PROD-segment 14, ordered segment + BOOST_CHECK_EQUAL(iSeg[start + 0] , 1); // PROD-segment 10, ordered segment + BOOST_CHECK_EQUAL(iSeg[start + 1] , 6); // PROD-segment 10, outlet segment + BOOST_CHECK_EQUAL(iSeg[start + 2] , 0); // PROD-segment 10, inflow segment current branch + BOOST_CHECK_EQUAL(iSeg[start + 3] , 5); // PROD-segment 10, branch number + BOOST_CHECK_EQUAL(iSeg[start + 4] , 0); // PROD-segment 10, number of inflow branches + BOOST_CHECK_EQUAL(iSeg[start + 5] , 0); // PROD-segment 10, Sum number of inflow branches from first segment to current segment + BOOST_CHECK_EQUAL(iSeg[start + 6] , 0); // PROD-segment 10, number of connections in segment + BOOST_CHECK_EQUAL(iSeg[start + 7] , 0); // PROD-segment 10, sum of connections with lower segmeent number than current segment + BOOST_CHECK_EQUAL(iSeg[start + 8] , 3); // PROD-segment 10, ordered segment } // ISEG (WINJ) { - auto start = ih.nisegz*ih.nsegmx + 13*ih.nisegz; - + auto start = ih[VI::intehead::NISEGZ]*ih[VI::intehead::NSEGMX] + 13*ih[VI::intehead::NISEGZ]; const auto& iSeg = amswd.getISeg(); - BOOST_CHECK_EQUAL(iSeg[start + 0] , 6); // WINJ-segment 14, ordered segment - BOOST_CHECK_EQUAL(iSeg[start + 1] , 13); // WINJ-segment 14, outlet segment - BOOST_CHECK_EQUAL(iSeg[start + 2] , 0); // WINJ-segment 14, inflow segment current branch - BOOST_CHECK_EQUAL(iSeg[start + 3] , 1); // WINJ-segment 14, branch number - BOOST_CHECK_EQUAL(iSeg[start + 4] , 1); // WINJ-segment 14, number of inflow branches - BOOST_CHECK_EQUAL(iSeg[start + 5] , 1); // WINJ-segment 14, Sum number of inflow branches from first segment to current segment - BOOST_CHECK_EQUAL(iSeg[start + 6] , 0); // WINJ-segment 14, number of connections in segment - BOOST_CHECK_EQUAL(iSeg[start + 7] , 0); // WINJ-segment 14, sum of connections with lower segmeent number than current segment - BOOST_CHECK_EQUAL(iSeg[start + 8] , 6); // WINJ-segment 14, ordered segment + BOOST_CHECK_EQUAL(iSeg[start + 0] , 5); // WINJ-segment 14, ordered segment + BOOST_CHECK_EQUAL(iSeg[start + 1] , 13); // WINJ-segment 14, outlet segment + BOOST_CHECK_EQUAL(iSeg[start + 2] , 15); // WINJ-segment 14, inflow segment current branch + BOOST_CHECK_EQUAL(iSeg[start + 3] , 2); // WINJ-segment 14, branch number + BOOST_CHECK_EQUAL(iSeg[start + 4] , 0); // WINJ-segment 14, number of inflow branches + BOOST_CHECK_EQUAL(iSeg[start + 5] , 0); // WINJ-segment 14, Sum number of inflow branches from first segment to current segment + BOOST_CHECK_EQUAL(iSeg[start + 6] , 1); // WINJ-segment 14, number of connections in segment + BOOST_CHECK_EQUAL(iSeg[start + 7] , 1); // WINJ-segment 14, sum of connections with lower segmeent number than current segment + BOOST_CHECK_EQUAL(iSeg[start + 8] , 5); // WINJ-segment 14, ordered segment - start = ih.nisegz*ih.nsegmx + 16*ih.nisegz; - BOOST_CHECK_EQUAL(iSeg[start + 0] , 3); // WINJ-segment 17, ordered segment - BOOST_CHECK_EQUAL(iSeg[start + 1] , 16); // WINJ-segment 17, outlet segment - BOOST_CHECK_EQUAL(iSeg[start + 2] , 18); // WINJ-segment 17, inflow segment current branch - BOOST_CHECK_EQUAL(iSeg[start + 3] , 2); // WINJ-segment 17, branch number - BOOST_CHECK_EQUAL(iSeg[start + 4] , 0); // WINJ-segment 17, number of inflow branches - BOOST_CHECK_EQUAL(iSeg[start + 5] , 0); // WINJ-segment 17, Sum number of inflow branches from first segment to current segment - BOOST_CHECK_EQUAL(iSeg[start + 6] , 1); // WINJ-segment 17, number of connections in segment - BOOST_CHECK_EQUAL(iSeg[start + 7] , 3); // WINJ-segment 17, sum of connections with lower segmeent number than current segment - BOOST_CHECK_EQUAL(iSeg[start + 8] , 3); // WINJ-segment 17, ordered segment + start = ih[VI::intehead::NISEGZ]*ih[VI::intehead::NSEGMX] + 16*ih[VI::intehead::NISEGZ]; + BOOST_CHECK_EQUAL(iSeg[start + 0] , 2); // WINJ-segment 17, ordered segment + BOOST_CHECK_EQUAL(iSeg[start + 1] , 16); // WINJ-segment 17, outlet segment + BOOST_CHECK_EQUAL(iSeg[start + 2] , 18); // WINJ-segment 17, inflow segment current branch + BOOST_CHECK_EQUAL(iSeg[start + 3] , 2); // WINJ-segment 17, branch number + BOOST_CHECK_EQUAL(iSeg[start + 4] , 0); // WINJ-segment 17, number of inflow branches + BOOST_CHECK_EQUAL(iSeg[start + 5] , 0); // WINJ-segment 17, Sum number of inflow branches from first segment to current segment + BOOST_CHECK_EQUAL(iSeg[start + 6] , 1); // WINJ-segment 17, number of connections in segment + BOOST_CHECK_EQUAL(iSeg[start + 7] , 4); // WINJ-segment 17, sum of connections with lower segmeent number than current segment + BOOST_CHECK_EQUAL(iSeg[start + 8] , 2); // WINJ-segment 17, ordered segment } // RSEG (PROD) + (WINJ) { - // well no 1 - PROD - const std::string wname = "PROD"; - int segNo = 1; - // 'stringSegNum' is one-based (1 .. #segments inclusive) - std::string stringSegNo = std::to_string(segNo); + // well no 1 - PROD + const std::string wname = "PROD"; + int segNo = 1; + // 'stringSegNum' is one-based (1 .. #segments inclusive) + std::string stringSegNo = std::to_string(segNo); - const auto i0 = (segNo-1)*ih.nrsegz; - const auto& units = simCase.es.getUnits(); - const auto gfactor = (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_FIELD) - ? 0.1781076 : 0.001; + const auto i0 = (segNo-1)*ih[VI::intehead::NRSEGZ]; + const auto gfactor = (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_FIELD) + ? 0.1781076 : 0.001; const auto& rseg = amswd.getRSeg(); - BOOST_CHECK_CLOSE(rseg[i0 ], 10. , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 1], 7010. , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 5], 0.31 , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 6], 10. , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 7], 7010. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 ], 10. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 1], 7010. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 5], 0.31 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 6], 10. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 7], 7010. , 1.0e-10); - const double temp_o = smry.get("SOFR:PROD:1"); - const double temp_w = smry.get("SWFR:PROD:1")*0.1; - const double temp_g = smry.get("SGFR:PROD:1")*gfactor; + const double temp_o = smry.get("SOFR:PROD:1"); + const double temp_w = smry.get("SWFR:PROD:1")*0.1; + const double temp_g = smry.get("SGFR:PROD:1")*gfactor; - auto t0 = temp_o + temp_w + temp_g; - double t1 = (std::abs(temp_w) > 0) ? temp_w / t0 : 0.; - double t2 = (std::abs(temp_g) > 0) ? temp_g / t0 : 0.; + auto t0 = temp_o + temp_w + temp_g; + double t1 = (std::abs(temp_w) > 0) ? temp_w / t0 : 0.; + double t2 = (std::abs(temp_g) > 0) ? temp_g / t0 : 0.; - BOOST_CHECK_CLOSE(rseg[i0 + 8], t0, 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 9], t1, 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 10], t2, 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 11], 235., 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 8], t0, 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 9], t1, 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 10], t2, 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 11], 235., 1.0e-10); } { - // well no 2 - WINJ - const std::string wname = "WINJ"; - int segNo = 1; - // 'stringSegNum' is one-based (1 .. #segments inclusive) - std::string stringSegNo = std::to_string(segNo); + // well no 2 - WINJ + const std::string wname = "WINJ"; + int segNo = 1; + // 'stringSegNum' is one-based (1 .. #segments inclusive) + std::string stringSegNo = std::to_string(segNo); - const auto i0 = ih.nrsegz*ih.nsegmx + (segNo-1)*ih.nrsegz; - const auto& units = simCase.es.getUnits(); - using M = ::Opm::UnitSystem::measure; - const auto gfactor = (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_FIELD) - ? 0.1781076 : 0.001; + const auto i0 = ih[VI::intehead::NRSEGZ]*ih[VI::intehead::NSEGMX] + (segNo-1)*ih[VI::intehead::NRSEGZ]; + using M = ::Opm::UnitSystem::measure; + const auto gfactor = (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_FIELD) + ? 0.1781076 : 0.001; const auto& rseg = amswd.getRSeg(); - BOOST_CHECK_CLOSE(rseg[i0 ], 10. , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 1], 7010. , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 5], 0.31 , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 6], 10. , 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 7], 7010. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 ], 10. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 1], 7010. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 5], 0.31 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 6], 10. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 7], 7010. , 1.0e-10); - const double temp_o = 0.; - const double temp_w = -units.from_si(M::liquid_surface_rate,105.)*0.1; - const double temp_g = 0.0*gfactor; + const double temp_o = 0.; + const double temp_w = -units.from_si(M::liquid_surface_rate,105.)*0.1; + const double temp_g = 0.0*gfactor; - auto t0 = temp_o + temp_w + temp_g; - double t1 = (std::abs(temp_w) > 0) ? temp_w / t0 : 0.; - double t2 = (std::abs(temp_g) > 0) ? temp_g / t0 : 0.; + auto t0 = temp_o + temp_w + temp_g; + double t1 = (std::abs(temp_w) > 0) ? temp_w / t0 : 0.; + double t2 = (std::abs(temp_g) > 0) ? temp_g / t0 : 0.; - BOOST_CHECK_CLOSE(rseg[i0 + 8], t0, 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 9], t1, 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 10], t2, 1.0e-10); - BOOST_CHECK_CLOSE(rseg[i0 + 11], 234., 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 8], t0, 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 9], t1, 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 10], t2, 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + 11], 234., 1.0e-10); } // ILBR { - auto start = 0*ih.nilbrz; + auto start = 0*ih[VI::intehead::NILBRZ]; const auto& iLBr = amswd.getILBr(); - //PROD - BOOST_CHECK_EQUAL(iLBr[start + 0] , 0); // PROD-branch 1, outlet segment - BOOST_CHECK_EQUAL(iLBr[start + 1] , 12); // PROD-branch 1, No of segments in branch - BOOST_CHECK_EQUAL(iLBr[start + 2] , 1); // PROD-branch 1, first segment - BOOST_CHECK_EQUAL(iLBr[start + 3] , 12); // PROD-branch 1, last segment - BOOST_CHECK_EQUAL(iLBr[start + 4] , 0); // PROD-branch 1, branch no - 1 - //PROD - start = 1*ih.nilbrz; - BOOST_CHECK_EQUAL(iLBr[start + 0] , 3); // PROD-branch 2, outlet segment - BOOST_CHECK_EQUAL(iLBr[start + 1] , 5); // PROD-branch 2, No of segments in branch - BOOST_CHECK_EQUAL(iLBr[start + 2] , 13); // PROD-branch 2, first segment - BOOST_CHECK_EQUAL(iLBr[start + 3] , 17); // PROD-branch 2, last segment - BOOST_CHECK_EQUAL(iLBr[start + 4] , 1); // PROD-branch 2, branch no - 1 + //PROD + BOOST_CHECK_EQUAL(iLBr[start + 0] , 0); // PROD-branch 1, outlet segment + BOOST_CHECK_EQUAL(iLBr[start + 1] , 12); // PROD-branch 1, No of segments in branch + BOOST_CHECK_EQUAL(iLBr[start + 2] , 1); // PROD-branch 1, first segment + BOOST_CHECK_EQUAL(iLBr[start + 3] , 12); // PROD-branch 1, last segment + BOOST_CHECK_EQUAL(iLBr[start + 4] , 0); // PROD-branch 1, branch no - 1 + //PROD + start = 1*ih[VI::intehead::NILBRZ]; + BOOST_CHECK_EQUAL(iLBr[start + 0] , 3); // PROD-branch 2, outlet segment + BOOST_CHECK_EQUAL(iLBr[start + 1] , 5); // PROD-branch 2, No of segments in branch + BOOST_CHECK_EQUAL(iLBr[start + 2] , 13); // PROD-branch 2, first segment + BOOST_CHECK_EQUAL(iLBr[start + 3] , 17); // PROD-branch 2, last segment + BOOST_CHECK_EQUAL(iLBr[start + 4] , 1); // PROD-branch 2, branch no - 1 - start = ih.nilbrz*ih.nlbrmx + 0*ih.nilbrz; - //WINJ - BOOST_CHECK_EQUAL(iLBr[start + 0] , 0); // WINJ-branch 1, outlet segment - BOOST_CHECK_EQUAL(iLBr[start + 1] , 14); // WINJ-branch 1, No of segments in branch - BOOST_CHECK_EQUAL(iLBr[start + 2] , 1); // WINJ-branch 1, first segment - BOOST_CHECK_EQUAL(iLBr[start + 3] , 14); // WINJ-branch 1, last segment - BOOST_CHECK_EQUAL(iLBr[start + 4] , 0); // WINJ-branch 1, branch no - 1 + start = ih[VI::intehead::NILBRZ]*ih[VI::intehead::NLBRMX] + 0*ih[VI::intehead::NILBRZ]; + //WINJ + BOOST_CHECK_EQUAL(iLBr[start + 0] , 0); // WINJ-branch 1, outlet segment + BOOST_CHECK_EQUAL(iLBr[start + 1] , 14); // WINJ-branch 1, No of segments in branch + BOOST_CHECK_EQUAL(iLBr[start + 2] , 1); // WINJ-branch 1, first segment + BOOST_CHECK_EQUAL(iLBr[start + 3] , 14); // WINJ-branch 1, last segment + BOOST_CHECK_EQUAL(iLBr[start + 4] , 0); // WINJ-branch 1, branch no - 1 - start = ih.nilbrz*ih.nlbrmx + 1*ih.nilbrz; - //WINJ - BOOST_CHECK_EQUAL(iLBr[start + 0] , 14); // WINJ-branch 2, outlet segment - BOOST_CHECK_EQUAL(iLBr[start + 1] , 5); // WINJ-branch 2, No of segments in branch - BOOST_CHECK_EQUAL(iLBr[start + 2] , 15); // WINJ-branch 2, first segment - BOOST_CHECK_EQUAL(iLBr[start + 3] , 19); // WINJ-branch 2, last segment - BOOST_CHECK_EQUAL(iLBr[start + 4] , 1); // WINJ-branch 2, branch no - 1 + start = ih[VI::intehead::NILBRZ]*ih[VI::intehead::NLBRMX] + 1*ih[VI::intehead::NILBRZ]; + //WINJ + BOOST_CHECK_EQUAL(iLBr[start + 0] , 14); // WINJ-branch 2, outlet segment + BOOST_CHECK_EQUAL(iLBr[start + 1] , 5); // WINJ-branch 2, No of segments in branch + BOOST_CHECK_EQUAL(iLBr[start + 2] , 15); // WINJ-branch 2, first segment + BOOST_CHECK_EQUAL(iLBr[start + 3] , 19); // WINJ-branch 2, last segment + BOOST_CHECK_EQUAL(iLBr[start + 4] , 1); // WINJ-branch 2, branch no - 1 } - // ILBS + // ILBS { - auto start = 0*ih.nlbrmx; + auto start = 0*ih[VI::intehead::NLBRMX]; const auto& iLBs = amswd.getILBs(); - //PROD - BOOST_CHECK_EQUAL(iLBs[start + 0] , 13); // PROD-branch 2, first segment in branch + //PROD + BOOST_CHECK_EQUAL(iLBs[start + 0] , 13); // PROD-branch 2, first segment in branch - start = ih.nlbrmx + 0*ih.nlbrmx; - //WINJ - BOOST_CHECK_EQUAL(iLBs[start + 0] , 15); // WINJ-branch 2, first segment in branch + start = ih[VI::intehead::NLBRMX] + 0*ih[VI::intehead::NLBRMX]; + //WINJ + BOOST_CHECK_EQUAL(iLBs[start + 0] , 15); // WINJ-branch 2, first segment in branch } } -BOOST_AUTO_TEST_CASE(MSW_RST) { - const auto simCase = SimulationCase{first_sim()}; +BOOST_AUTO_TEST_CASE(MSW_AICD) { + const auto simCase = SimulationCase {first_sim("TEST_AGGREGATE_MSW.DATA")}; - // Report Step 1: 2115-01-01 --> 2015-01-03 - const auto rptStep = std::size_t{1}; + Opm::EclipseState es = simCase.es; + Opm::Runspec rspec = es.runspec(); + Opm::SummaryState smry = sim_state(); + Opm::Schedule sched = simCase.sched; + Opm::EclipseGrid grid = simCase.grid; + const auto& units = es.getUnits(); + + + // Report Step 1: 2008-10-10 --> 2011-01-20 + const auto rptStep = std::size_t {1}; + + double secs_elapsed = 3.1536E07; + const auto ih = Opm::RestartIO::Helpers:: + createInteHead(es, grid, sched, secs_elapsed, + rptStep, rptStep+1, rptStep); - const auto ih = MockIH { - static_cast(simCase.sched.getWells(rptStep).size()) - }; - const auto smry = sim_state(); const Opm::data::WellRates wrc = wr(); - auto amswd = Opm::RestartIO::Helpers::AggregateMSWData{ih.value}; + auto amswd = Opm::RestartIO::Helpers::AggregateMSWData {ih}; amswd.captureDeclaredMSWData(simCase.sched, rptStep, - simCase.es.getUnits(), - ih.value, - simCase.grid, + units, + ih, + grid, smry, wrc - ); + ); + +// ISEG (PROD) + { + const auto& iSeg = amswd.getISeg(); + auto start = 17*ih[VI::intehead::NISEGZ]; + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::SegmentType], -8); // PROD-segment 18, + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::ICDScalingMode], 1); // PROD-segment 18, + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::ICDOpenShutFlag], 0); // PROD-segment 18, + + start = 18*ih[VI::intehead::NISEGZ]; + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::SegmentType], -8); // PROD-segment 19, + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::ICDScalingMode], 1); // PROD-segment 19, + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::ICDOpenShutFlag], 1); // PROD-segment 19, + + start = 19*ih[VI::intehead::NISEGZ]; + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::SegmentType], -8); // PROD-segment 20, + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::ICDScalingMode], 0); // PROD-segment 20, + BOOST_CHECK_EQUAL(iSeg[start + VI::ISeg::index::ICDOpenShutFlag], 0); // PROD-segment 20, + + + + } + + // RSEG (PROD) + { + // well no 1 - PROD + const auto& rseg = amswd.getRSeg(); + + int segNo = 18; + auto i0 = (segNo-1)*ih[VI::intehead::NRSEGZ]; + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::DeviceBaseStrength], 3.260E-05 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::ScalingFactor], 0.06391 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::CalibrFluidDensity], 63.678 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::CalibrFluidViscosity], 0.48 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::CriticalWaterFraction], 0.5 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::TransitionRegWidth], 0.05 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::MaxEmulsionRatio], 5. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::FlowRateExponent], 2.1 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::ViscFuncExponent], 1.2 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::MaxValidFlowRate], -2e+20 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::ICDLength], 0.06391 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionOilDensityExponent], 1. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionWaterDensityExponent], 1. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionGasDensityExponent], 1. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionOilViscosityExponent], 1. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionWaterViscosityExponent], 1. , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionGasViscosityExponent], 1. , 1.0e-10); + + segNo = 20; + i0 = (segNo-1)*ih[VI::intehead::NRSEGZ]; + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::DeviceBaseStrength], 3.260E-05 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::ScalingFactor], 0.007538 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::CalibrFluidDensity], 63.678 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::CalibrFluidViscosity], 0.48 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::CriticalWaterFraction], 0.53 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::TransitionRegWidth], 0.048 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::MaxEmulsionRatio], 4.89 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::FlowRateExponent], 2.1 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::ViscFuncExponent], 1.2 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::MaxValidFlowRate], 9.876e+06 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::ICDLength], 0.15076 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionOilDensityExponent], 0.92 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionWaterDensityExponent], 0.89 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionGasDensityExponent], 0.91 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionOilViscosityExponent], 1.01 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionWaterViscosityExponent], 1.02 , 1.0e-10); + BOOST_CHECK_CLOSE(rseg[i0 + VI::RSeg::index::flowFractionGasViscosityExponent], 1.03 , 1.0e-10); + + } + +} + + +BOOST_AUTO_TEST_CASE(MSW_RST) { + const auto simCase = SimulationCase {first_sim("TEST_AGGREGATE_MSW.DATA")}; + + Opm::EclipseState es = simCase.es; + Opm::Runspec rspec = es.runspec(); + Opm::SummaryState smry = sim_state(); + Opm::Schedule sched = simCase.sched; + Opm::EclipseGrid grid = simCase.grid; + const auto& units = es.getUnits(); + + + // Report Step 1: 2008-10-10 --> 2011-01-20 + const auto rptStep = std::size_t {1}; + + double secs_elapsed = 3.1536E07; + const auto ih = Opm::RestartIO::Helpers:: + createInteHead(es, grid, sched, secs_elapsed, + rptStep, rptStep+1, rptStep); + + + const Opm::data::WellRates wrc = wr(); + auto amswd = Opm::RestartIO::Helpers::AggregateMSWData {ih}; + amswd.captureDeclaredMSWData(simCase.sched, + rptStep, + units, + ih, + grid, + smry, + wrc + ); + const auto& iseg = amswd.getISeg(); const auto& rseg = amswd.getRSeg(); auto segment = Opm::RestartIO::RstSegment(simCase.es.getUnits(), 1, iseg.data(), rseg.data());