From d7249ea6e6685fcd1edc5be344accbda0d7b5c63 Mon Sep 17 00:00:00 2001 From: Jostein Alvestad Date: Wed, 6 Mar 2019 13:18:26 +0100 Subject: [PATCH 1/5] Initial work on unit tests for well connection data to restart file Establish framework and test data --- CMakeLists_files.cmake | 1 + tests/test_AggregateConnectionData.cpp | 701 +++++++++++++++++++++++++ 2 files changed, 702 insertions(+) create mode 100644 tests/test_AggregateConnectionData.cpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index ef9ac17f4..273ca6674 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -272,6 +272,7 @@ if(ENABLE_ECL_OUTPUT) tests/test_AggregateWellData.cpp tests/test_AggregateGroupData.cpp tests/test_AggregateMSWData.cpp + tests/test_AggregateConnectionData.cpp tests/test_ArrayDimChecker.cpp tests/test_CharArrayNullTerm.cpp tests/test_EclipseIO.cpp diff --git a/tests/test_AggregateConnectionData.cpp b/tests/test_AggregateConnectionData.cpp new file mode 100644 index 000000000..3a053da77 --- /dev/null +++ b/tests/test_AggregateConnectionData.cpp @@ -0,0 +1,701 @@ +/* + Copyright 2018 Statoil ASA + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#define BOOST_TEST_MODULE Aggregate_Well_Data +#include +#include + +#include + +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +struct MockIH +{ + MockIH(const int numWells, + + const int nsegWell = 1, // E100 + const int ncwMax = 20, + const int iConnPerConn = 25, // NICONZ + const int sConnPerConn = 40, // NSCONZ + const int xConnPerConn = 58) // NXCONZ + + + std::vector value; + + using Sz = std::vector::size_type; + + Sz nwells; + Sz nsegwl; + Sz nswlmx; + Sz ncwmax; + Sz niconz; + Sz nsconz; + Sz nxconz; +}; + +MockIH::MockIH(const int numWells, + const int nsegWell, + const int ncwMax, + const int iConnPerConn, + const int sConnPerConn, + const int xConnPerConn) + : 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->ncwmax = this->value[Ix::NCWMAX] = 20; + this->nswlmx = this->value[Ix::NSWLMX] = 1; + this->nsegmx = this->value[Ix::NSEGMX] = 32; + this->niconz = this->value[Ix::NICONZ] = iConnPerConn; + this->nsconz = this->value[Ix::NSCONZ] = sConnPerConn; + this->nxconz = this->value[Ix::NXCONZ] = xConnPerConn; +} + +namespace { + Opm::Deck first_sim() + { + // Mostly copy of tests/FIRST_SIM.DATA + const auto 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 + 1 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 + -- + / + +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 7020.00 .00000 0 0 5 / + 7200.00 3700.00 7300.00 .00000 7000.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* / + / + +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 + / + + +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::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.; + 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.)); + } + 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.; + 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.); + } + } + return xw; + } +} + +struct SimulationCase +{ + explicit SimulationCase(const Opm::Deck& deck) + : es ( deck ) + , grid(deck) + , sched( deck, es ) + {} + + // Order requirement: 'es' must be declared/initialised before 'sched'. + Opm::EclipseState es; + Opm::EclipseGrid grid; + Opm::Schedule sched; +}; + +// ===================================================================== + +BOOST_AUTO_TEST_SUITE(Aggregate_ConnData) + + +// test dimensions of Connection data +BOOST_AUTO_TEST_CASE (Constructor) +{ + const auto ih = MockIH{ 5 }; + + const auto amswd = Opm::RestartIO::Helpers::AggregateConnectionData{ ih.value }; + + BOOST_CHECK_EQUAL(amswd.getIConn().size(), ih.numWells * ih.ncwmax * ih.niconz); + BOOST_CHECK_EQUAL(amswd.getSConn().size(), ih.numWells * ih.ncwmax * ih.nsconz); + BOOST_CHECK_EQUAL(amswd.getXConn().size(), ih.numWells * ih.ncwmax * ih.nxconz); +} + +#if 0 +BOOST_AUTO_TEST_CASE (Declared_Connection_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 ih = MockIH { + static_cast(simCase.sched.getWells(rptStep).size()) + }; + + BOOST_CHECK_EQUAL(ih.nwells, MockIH::Sz{2}); + + const auto smry = sim_state(); + const Opm::data::WellRates wrc = wr(); + auto amswd = Opm::RestartIO::Helpers::AggregateMSWData{ih.value}; + amswd.captureDeclaredMSWData(simCase.sched, + rptStep, + simCase.es.getUnits(), + ih.value, + simCase.grid, + smry, + wrc + ); + + // ISEG (PROD) + { + auto start = 2*ih.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 + + start = 13*ih.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 + + } + + // ISEG (WINJ) + { + auto start = ih.nisegz*ih.nsegmx + 13*ih.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 + + 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 + + } + + // RSEG (PROD) + (WINJ) + { + // well no 1 - PROD + int welNo = 1; + 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(); + 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); + + 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.; + + 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 + int welNo = 2; + 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& 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); + + 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.; + + 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); + + } +#endif +} + + +BOOST_AUTO_TEST_SUITE_END() From 4b62303f36cd55da9e170cfb9e113c64f6b033b6 Mon Sep 17 00:00:00 2001 From: Jostein Alvestad Date: Fri, 8 Mar 2019 16:48:33 +0100 Subject: [PATCH 2/5] Added unit tests for the writing of well connection data That is writing well connection data to eclipse compatible restart file --- opm/output/eclipse/VectorItems/connection.hpp | 2 +- tests/test_AggregateConnectionData.cpp | 243 ++++++++---------- 2 files changed, 114 insertions(+), 131 deletions(-) diff --git a/opm/output/eclipse/VectorItems/connection.hpp b/opm/output/eclipse/VectorItems/connection.hpp index 85e0efe29..22e1d480b 100644 --- a/opm/output/eclipse/VectorItems/connection.hpp +++ b/opm/output/eclipse/VectorItems/connection.hpp @@ -50,7 +50,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems EffectiveKH = 3, // Effective Kh product of connection - item12 = 11, // Unknown + item12 = 11, // Connection transmissibility factor SegDistEnd = 20, // Distance to end of connection in segment SegDistStart = 21, // Distance to start of connection in segment diff --git a/tests/test_AggregateConnectionData.cpp b/tests/test_AggregateConnectionData.cpp index 3a053da77..96a439ecc 100644 --- a/tests/test_AggregateConnectionData.cpp +++ b/tests/test_AggregateConnectionData.cpp @@ -51,7 +51,7 @@ struct MockIH const int ncwMax = 20, const int iConnPerConn = 25, // NICONZ const int sConnPerConn = 40, // NSCONZ - const int xConnPerConn = 58) // NXCONZ + const int xConnPerConn = 58); // NXCONZ std::vector value; @@ -60,6 +60,7 @@ struct MockIH Sz nwells; Sz nsegwl; + Sz nsegmx; Sz nswlmx; Sz ncwmax; Sz niconz; @@ -97,7 +98,7 @@ namespace { RUNSPEC TITLE - TWO MULTI-LATERAL WELLS; PRODUCER AND INJECTOR - MULTI-SEGMENT BRANCHES + TWO MULTI-LATERAL WELLS; WINJUCER AND INJECTOR - MULTI-SEGMENT BRANCHES DIMENS 10 5 10 / @@ -344,7 +345,7 @@ SUMMARY =========================================================== FOPR WOPR - 'PROD' + 'WINJ' / FGPR @@ -485,6 +486,7 @@ END c.rates.set(o::wat, qw*(float(i)+1.)) .set(o::oil, qo*(float(i)+1.)) .set(o::gas, qg*(float(i)+1.)); + c.pressure = 215.; } auto seg = Opm::data::Segment{}; for (std::size_t i = 1; i < 5; i++) { @@ -503,6 +505,7 @@ END c.rates.set(o::wat, qw*(float(i)+1.)) .set(o::oil, 0.) .set(o::gas, 0.); + c.pressure = 218.; } } return xw; @@ -533,14 +536,14 @@ BOOST_AUTO_TEST_CASE (Constructor) { const auto ih = MockIH{ 5 }; - const auto amswd = Opm::RestartIO::Helpers::AggregateConnectionData{ ih.value }; + const auto amconn = Opm::RestartIO::Helpers::AggregateConnectionData{ ih.value }; - BOOST_CHECK_EQUAL(amswd.getIConn().size(), ih.numWells * ih.ncwmax * ih.niconz); - BOOST_CHECK_EQUAL(amswd.getSConn().size(), ih.numWells * ih.ncwmax * ih.nsconz); - BOOST_CHECK_EQUAL(amswd.getXConn().size(), ih.numWells * ih.ncwmax * ih.nxconz); + BOOST_CHECK_EQUAL(amconn.getIConn().size(), ih.nwells * ih.ncwmax * ih.niconz); + BOOST_CHECK_EQUAL(amconn.getSConn().size(), ih.nwells * ih.ncwmax * ih.nsconz); + BOOST_CHECK_EQUAL(amconn.getXConn().size(), ih.nwells * ih.ncwmax * ih.nxconz); } -#if 0 + BOOST_AUTO_TEST_CASE (Declared_Connection_Data) { const auto simCase = SimulationCase{first_sim()}; @@ -554,148 +557,128 @@ BOOST_AUTO_TEST_CASE (Declared_Connection_Data) BOOST_CHECK_EQUAL(ih.nwells, MockIH::Sz{2}); - const auto smry = sim_state(); const Opm::data::WellRates wrc = wr(); - auto amswd = Opm::RestartIO::Helpers::AggregateMSWData{ih.value}; - amswd.captureDeclaredMSWData(simCase.sched, - rptStep, - simCase.es.getUnits(), - ih.value, - simCase.grid, - smry, - wrc - ); + auto amconn = Opm::RestartIO::Helpers::AggregateConnectionData{ih.value}; + amconn.captureDeclaredConnData(simCase.sched, + simCase.grid, + simCase.es.getUnits(), + wrc, + rptStep + ); - // ISEG (PROD) + // ICONN (PROD) { - auto start = 2*ih.nisegz; + auto start = 0*ih.niconz; - 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 + const auto& iConn = amconn.getIConn(); + BOOST_CHECK_EQUAL(iConn[start + 0] , 1); // PROD-connection 1, sequence number + BOOST_CHECK_EQUAL(iConn[start + 1] , 1); // PROD-connection 1, Cell I + BOOST_CHECK_EQUAL(iConn[start + 2] , 5); // PROD-connection 1, Cell J + BOOST_CHECK_EQUAL(iConn[start + 3] , 2); // PROD-connection 1, Cell K + BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // PROD-connection 1, ConnStat + BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // PROD-connection 1, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // PROD-connection 1, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + 12] , 1); // PROD-connection 1, Complum number + BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // PROD-connection 1, Connection direction + BOOST_CHECK_EQUAL(iConn[start + 14] , 13); // PROD-connection 1, Segment ID for direction + + start = 3*ih.niconz; + BOOST_CHECK_EQUAL(iConn[start + 0] , 4); // PROD-connection 4, sequence number + BOOST_CHECK_EQUAL(iConn[start + 1] , 4); // PROD-connection 4, Cell I + BOOST_CHECK_EQUAL(iConn[start + 2] , 5); // PROD-connection 4, Cell J + BOOST_CHECK_EQUAL(iConn[start + 3] , 2); // PROD-connection 4, Cell K + BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // PROD-connection 4, ConnStat + BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // PROD-connection 4, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // PROD-connection 4, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + 12] , 4); // PROD-connection 4, Complum number + BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // PROD-connection 4, Connection direction + BOOST_CHECK_EQUAL(iConn[start + 14] , 16); // PROD-connection 4, Segment ID for direction - start = 13*ih.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 } - // ISEG (WINJ) + // ICONN (WINJ) { - auto start = ih.nisegz*ih.nsegmx + 13*ih.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 - - 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 + auto start = ih.ncwmax*ih.niconz; + const auto& iConn = amconn.getIConn(); + BOOST_CHECK_EQUAL(iConn[start + 0] , 1); // WINJ-connection 1, sequence number + BOOST_CHECK_EQUAL(iConn[start + 1] , 10); // WINJ-connection 1, Cell I + BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 1, Cell J + BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 1, Cell K + BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 1, ConnStat + BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 1, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 1, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + 12] , 1); // WINJ-connection 1, Complum number + BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 1, Connection direction + BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 1, Segment ID for direction + start = ih.ncwmax*ih.niconz + 2*ih.niconz; + BOOST_CHECK_EQUAL(iConn[start + 0] , 3); // WINJ-connection 1, sequence number + BOOST_CHECK_EQUAL(iConn[start + 1] , 8); // WINJ-connection 1, Cell I + BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 1, Cell J + BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 1, Cell K + BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 1, ConnStat + BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 1, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 1, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + 12] , 3); // WINJ-connection 1, Complum number + BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 1, Connection direction + BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 1, Segment ID for direction + } - - // RSEG (PROD) + (WINJ) + + // SCONN (PROD) + (WINJ) { // well no 1 - PROD - int welNo = 1; - 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(); - 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); + const auto& sconn = amconn.getSConn(); + int connNo = 1; + auto i0 = (connNo-1)*ih.nsconz; + BOOST_CHECK_CLOSE(sconn[i0 ], 2.55826545 , 1.0e-5); // PROD - conn 1 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + 1], 7050. , 1.0e-5); // PROD - conn 1 : Centre depth + BOOST_CHECK_CLOSE(sconn[i0 + 2], 0.20 , 1.0e-5); // PROD - conn 1 : diameter + BOOST_CHECK_CLOSE(sconn[i0 + 3], 1581.13879 , 1.0e-5); // PROD - conn 1 : effective kh-product + BOOST_CHECK_CLOSE(sconn[i0 + 11], 2.55826545 , 1.0e-5); // PROD - conn 1 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + 20], 130. , 1.0e-5); // PROD - conn 1 : Distance to end of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + 21], 30. , 1.0e-5); // PROD - conn 1 : Distance to start of connection in segment - 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; + // Well no 2 - WINJ well + connNo = 3; + i0 = ih.ncwmax*ih.nsconz + (connNo-1)*ih.nsconz; + BOOST_CHECK_CLOSE(sconn[i0 ], 2.55826545 , 1.0e-5); // WINJ - conn 3 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + 1], 7250. , 1.0e-5); // WINJ - conn 3 : Centre depth + BOOST_CHECK_CLOSE(sconn[i0 + 2], 0.20 , 1.0e-5); // WINJ - conn 3 : diameter + BOOST_CHECK_CLOSE(sconn[i0 + 3], 1581.13879 , 1.0e-5); // WINJ - conn 3 : effective kh-product + BOOST_CHECK_CLOSE(sconn[i0 + 11], 2.55826545 , 1.0e-5); // WINJ - conn 3 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + 20], 0. , 1.0e-5); // WINJ - conn 3 : Distance to end of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + 21], 0. , 1.0e-5); // WINJ - conn 3 : Distance to start of connection in segment - 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); } - - { - // well no 2 - WINJ - int welNo = 2; - 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& 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); - - 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.; - - 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); + // XCONN (PROD) + (WINJ) + { + const auto& units = simCase.es.getUnits(); + using M = ::Opm::UnitSystem::measure; + const auto& xconn = amconn.getXConn(); + + // PROD well + int connNo = 1; + auto i0 = (connNo-1)*ih.nxconz; + BOOST_CHECK_CLOSE(xconn[i0 ], -units.from_si(M::liquid_surface_rate,5.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface oil rate + BOOST_CHECK_CLOSE(xconn[i0 + 1], -units.from_si(M::liquid_surface_rate,4.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface water rate + BOOST_CHECK_CLOSE(xconn[i0 + 2], -units.from_si(M::gas_surface_rate, 50.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface gas rate + BOOST_CHECK_CLOSE(xconn[i0 + 34], units.from_si(M::pressure, 215.) , 1.0e-5); // PROD - conn 1 : Connection pressure + BOOST_CHECK_CLOSE(xconn[i0 + 49], 0. , 1.0e-5); // PROD - conn 1 : Reservoir volume rate + + // WINJ well + connNo = 3; + i0 = ih.ncwmax*ih.nxconz + (connNo-1)*ih.nxconz; + BOOST_CHECK_CLOSE(xconn[i0 + 1], -units.from_si(M::liquid_surface_rate,7.*(float(connNo))) , 1.0e-5); // WINJ - conn 3 : Surface water rate + BOOST_CHECK_CLOSE(xconn[i0 + 34], units.from_si(M::pressure, 218.) , 1.0e-5); // WINJ - conn 3 : Connection pressure + BOOST_CHECK_CLOSE(xconn[i0 + 49], 0. , 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + } -#endif } + BOOST_AUTO_TEST_SUITE_END() From a1365ffc99e9afe210459c19a91b4a4ea372e770 Mon Sep 17 00:00:00 2001 From: Jostein Alvestad Date: Tue, 19 Mar 2019 12:55:41 +0100 Subject: [PATCH 3/5] Added test to account for inactive well connections That is handling of well connections that are defined by COMPDAT and that become inactive of some reason. --- tests/test_AggregateConnectionData.cpp | 57 +++++++++++++++++++++----- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/tests/test_AggregateConnectionData.cpp b/tests/test_AggregateConnectionData.cpp index 96a439ecc..f493793ce 100644 --- a/tests/test_AggregateConnectionData.cpp +++ b/tests/test_AggregateConnectionData.cpp @@ -177,6 +177,12 @@ RPTGRID -- / +EDIT + +EQUALS + 'PORV' 0.0 7 7 1 1 9 9 / +/ + PROPS ========================================================== -- WATER RELATIVE PERMEABILITY AND CAPILLARY PRESSURE ARE TABULATED AS @@ -441,7 +447,7 @@ WCONPROD / WCONINJE - 'WINJ' 'WAT' 'OPEN' 'RESV' 1* 2000 3500 1* / + 'WINJ' 'WAT' 'OPEN' 'BHP' 1* 20000 3500 1* / / @@ -614,16 +620,28 @@ BOOST_AUTO_TEST_CASE (Declared_Connection_Data) BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 1, Segment ID for direction start = ih.ncwmax*ih.niconz + 2*ih.niconz; - BOOST_CHECK_EQUAL(iConn[start + 0] , 3); // WINJ-connection 1, sequence number - BOOST_CHECK_EQUAL(iConn[start + 1] , 8); // WINJ-connection 1, Cell I - BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 1, Cell J - BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 1, Cell K - BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 1, ConnStat - BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 1, Drainage saturation table - BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 1, Imbibition saturation table - BOOST_CHECK_EQUAL(iConn[start + 12] , 3); // WINJ-connection 1, Complum number - BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 1, Connection direction - BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 1, Segment ID for direction + BOOST_CHECK_EQUAL(iConn[start + 0] , 3); // WINJ-connection 3, sequence number + BOOST_CHECK_EQUAL(iConn[start + 1] , 8); // WINJ-connection 3, Cell I + BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 3, Cell J + BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 3, Cell K + BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 3, ConnStat + BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 3, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 3, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + 12] , 3); // WINJ-connection 3, Complum number + BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 3, Connection direction + BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 3, Segment ID for direction + + start = ih.ncwmax*ih.niconz + 3*ih.niconz; + BOOST_CHECK_EQUAL(iConn[start + 0] , 4); // WINJ-connection 4, sequence number + BOOST_CHECK_EQUAL(iConn[start + 1] , 6); // WINJ-connection 4, Cell I + BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 4, Cell J + BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 4, Cell K + BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 4, ConnStat + BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 4, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 4, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + 12] , 4); // WINJ-connection 4, Complum number + BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 4, Connection direction + BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 4, Segment ID for direction } @@ -652,6 +670,17 @@ BOOST_AUTO_TEST_CASE (Declared_Connection_Data) BOOST_CHECK_CLOSE(sconn[i0 + 20], 0. , 1.0e-5); // WINJ - conn 3 : Distance to end of connection in segment BOOST_CHECK_CLOSE(sconn[i0 + 21], 0. , 1.0e-5); // WINJ - conn 3 : Distance to start of connection in segment + connNo = 4; + i0 = ih.ncwmax*ih.nsconz + (connNo-1)*ih.nsconz; + BOOST_CHECK_CLOSE(sconn[i0 ], 2.55826545 , 1.0e-5); // WINJ - conn 4 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + 1], 7250. , 1.0e-5); // WINJ - conn 4 : Centre depth + BOOST_CHECK_CLOSE(sconn[i0 + 2], 0.20 , 1.0e-5); // WINJ - conn 4 : diameter + BOOST_CHECK_CLOSE(sconn[i0 + 3], 1581.13879 , 1.0e-5); // WINJ - conn 4 : effective kh-product + BOOST_CHECK_CLOSE(sconn[i0 + 11], 2.55826545 , 1.0e-5); // WINJ - conn 4 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + 20], 0. , 1.0e-5); // WINJ - conn 4 : Distance to end of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + 21], 0. , 1.0e-5); // WINJ - conn 4 : Distance to start of connection in segment + + } // XCONN (PROD) + (WINJ) @@ -676,6 +705,12 @@ BOOST_AUTO_TEST_CASE (Declared_Connection_Data) BOOST_CHECK_CLOSE(xconn[i0 + 34], units.from_si(M::pressure, 218.) , 1.0e-5); // WINJ - conn 3 : Connection pressure BOOST_CHECK_CLOSE(xconn[i0 + 49], 0. , 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + connNo = 4; + i0 = ih.ncwmax*ih.nxconz + (connNo-1)*ih.nxconz; + BOOST_CHECK_CLOSE(xconn[i0 + 1], -units.from_si(M::liquid_surface_rate,7.*(float(connNo))) , 1.0e-5); // WINJ - conn 3 : Surface water rate + BOOST_CHECK_CLOSE(xconn[i0 + 34], units.from_si(M::pressure, 218.) , 1.0e-5); // WINJ - conn 3 : Connection pressure + BOOST_CHECK_CLOSE(xconn[i0 + 49], 0. , 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + } } From 1247309b3fa4085b4947484c2220ec81c6d8bacc Mon Sep 17 00:00:00 2001 From: Jostein Alvestad Date: Mon, 25 Mar 2019 16:31:14 +0100 Subject: [PATCH 4/5] Corrections / improvments according to comments from maintaniners --- tests/test_AggregateConnectionData.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/test_AggregateConnectionData.cpp b/tests/test_AggregateConnectionData.cpp index f493793ce..372508885 100644 --- a/tests/test_AggregateConnectionData.cpp +++ b/tests/test_AggregateConnectionData.cpp @@ -17,7 +17,7 @@ along with OPM. If not, see . */ -#define BOOST_TEST_MODULE Aggregate_Well_Data +#define BOOST_TEST_MODULE Aggregate_Connection_Data #include #include @@ -274,12 +274,6 @@ PVDG -- 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 / From 5083db3715428d0ef627059be740d82800154322 Mon Sep 17 00:00:00 2001 From: Jostein Alvestad Date: Mon, 1 Apr 2019 16:09:30 +0200 Subject: [PATCH 5/5] Has added name for integer shift values as requested --- tests/test_AggregateConnectionData.cpp | 176 ++++++++++++------------- 1 file changed, 87 insertions(+), 89 deletions(-) diff --git a/tests/test_AggregateConnectionData.cpp b/tests/test_AggregateConnectionData.cpp index 372508885..53e8546ec 100644 --- a/tests/test_AggregateConnectionData.cpp +++ b/tests/test_AggregateConnectionData.cpp @@ -20,6 +20,7 @@ #define BOOST_TEST_MODULE Aggregate_Connection_Data #include #include +#include #include @@ -568,117 +569,114 @@ BOOST_AUTO_TEST_CASE (Declared_Connection_Data) // ICONN (PROD) { + using Ix = ::Opm::RestartIO::Helpers::VectorItems::IConn::index; auto start = 0*ih.niconz; const auto& iConn = amconn.getIConn(); - BOOST_CHECK_EQUAL(iConn[start + 0] , 1); // PROD-connection 1, sequence number - BOOST_CHECK_EQUAL(iConn[start + 1] , 1); // PROD-connection 1, Cell I - BOOST_CHECK_EQUAL(iConn[start + 2] , 5); // PROD-connection 1, Cell J - BOOST_CHECK_EQUAL(iConn[start + 3] , 2); // PROD-connection 1, Cell K - BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // PROD-connection 1, ConnStat - BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // PROD-connection 1, Drainage saturation table - BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // PROD-connection 1, Imbibition saturation table - BOOST_CHECK_EQUAL(iConn[start + 12] , 1); // PROD-connection 1, Complum number - BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // PROD-connection 1, Connection direction - BOOST_CHECK_EQUAL(iConn[start + 14] , 13); // PROD-connection 1, Segment ID for direction + BOOST_CHECK_EQUAL(iConn[start + Ix::SeqIndex ] , 1); // PROD-connection 1, sequence number + BOOST_CHECK_EQUAL(iConn[start + Ix::CellI ] , 1); // PROD-connection 1, Cell I + BOOST_CHECK_EQUAL(iConn[start + Ix::CellJ ] , 5); // PROD-connection 1, Cell J + BOOST_CHECK_EQUAL(iConn[start + Ix::CellK ] , 2); // PROD-connection 1, Cell K + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnStat ] , 1); // PROD-connection 1, ConnStat + BOOST_CHECK_EQUAL(iConn[start + Ix::Drainage ] , 0); // PROD-connection 1, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::Imbibition] , 0); // PROD-connection 1, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::ComplNum ] , 1); // PROD-connection 1, Complum number + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnDir ] , 1); // PROD-connection 1, Connection direction + BOOST_CHECK_EQUAL(iConn[start + Ix::Segment ] , 13); // PROD-connection 1, Segment ID for direction start = 3*ih.niconz; - BOOST_CHECK_EQUAL(iConn[start + 0] , 4); // PROD-connection 4, sequence number - BOOST_CHECK_EQUAL(iConn[start + 1] , 4); // PROD-connection 4, Cell I - BOOST_CHECK_EQUAL(iConn[start + 2] , 5); // PROD-connection 4, Cell J - BOOST_CHECK_EQUAL(iConn[start + 3] , 2); // PROD-connection 4, Cell K - BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // PROD-connection 4, ConnStat - BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // PROD-connection 4, Drainage saturation table - BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // PROD-connection 4, Imbibition saturation table - BOOST_CHECK_EQUAL(iConn[start + 12] , 4); // PROD-connection 4, Complum number - BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // PROD-connection 4, Connection direction - BOOST_CHECK_EQUAL(iConn[start + 14] , 16); // PROD-connection 4, Segment ID for direction - - - - } + BOOST_CHECK_EQUAL(iConn[start + Ix::SeqIndex ] , 4); // PROD-connection 4, sequence number + BOOST_CHECK_EQUAL(iConn[start + Ix::CellI ] , 4); // PROD-connection 4, Cell I + BOOST_CHECK_EQUAL(iConn[start + Ix::CellJ ] , 5); // PROD-connection 4, Cell J + BOOST_CHECK_EQUAL(iConn[start + Ix::CellK ] , 2); // PROD-connection 4, Cell K + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnStat ] , 1); // PROD-connection 4, ConnStat + BOOST_CHECK_EQUAL(iConn[start + Ix::Drainage ] , 0); // PROD-connection 4, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::Imbibition] , 0); // PROD-connection 4, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::ComplNum ] , 4); // PROD-connection 4, Complum number + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnDir ] , 1); // PROD-connection 4, Connection direction + BOOST_CHECK_EQUAL(iConn[start + Ix::Segment ] , 16); // PROD-connection 4, Segment ID for direction // ICONN (WINJ) - { - auto start = ih.ncwmax*ih.niconz; - const auto& iConn = amconn.getIConn(); - BOOST_CHECK_EQUAL(iConn[start + 0] , 1); // WINJ-connection 1, sequence number - BOOST_CHECK_EQUAL(iConn[start + 1] , 10); // WINJ-connection 1, Cell I - BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 1, Cell J - BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 1, Cell K - BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 1, ConnStat - BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 1, Drainage saturation table - BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 1, Imbibition saturation table - BOOST_CHECK_EQUAL(iConn[start + 12] , 1); // WINJ-connection 1, Complum number - BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 1, Connection direction - BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 1, Segment ID for direction + start = ih.ncwmax*ih.niconz; + BOOST_CHECK_EQUAL(iConn[start + Ix::SeqIndex ] , 1); // WINJ-connection 1, sequence number + BOOST_CHECK_EQUAL(iConn[start + Ix::CellI ] , 10); // WINJ-connection 1, Cell I + BOOST_CHECK_EQUAL(iConn[start + Ix::CellJ ] , 1); // WINJ-connection 1, Cell J + BOOST_CHECK_EQUAL(iConn[start + Ix::CellK ] , 9); // WINJ-connection 1, Cell K + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnStat ] , 1); // WINJ-connection 1, ConnStat + BOOST_CHECK_EQUAL(iConn[start + Ix::Drainage ] , 0); // WINJ-connection 1, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::Imbibition] , 0); // WINJ-connection 1, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::ComplNum ] , 1); // WINJ-connection 1, Complum number + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnDir ] , 1); // WINJ-connection 1, Connection direction + BOOST_CHECK_EQUAL(iConn[start + Ix::Segment ] , 0); // WINJ-connection 1, Segment ID for direction start = ih.ncwmax*ih.niconz + 2*ih.niconz; - BOOST_CHECK_EQUAL(iConn[start + 0] , 3); // WINJ-connection 3, sequence number - BOOST_CHECK_EQUAL(iConn[start + 1] , 8); // WINJ-connection 3, Cell I - BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 3, Cell J - BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 3, Cell K - BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 3, ConnStat - BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 3, Drainage saturation table - BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 3, Imbibition saturation table - BOOST_CHECK_EQUAL(iConn[start + 12] , 3); // WINJ-connection 3, Complum number - BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 3, Connection direction - BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 3, Segment ID for direction + BOOST_CHECK_EQUAL(iConn[start + Ix::SeqIndex ] , 3); // WINJ-connection 3, sequence number + BOOST_CHECK_EQUAL(iConn[start + Ix::CellI ] , 8); // WINJ-connection 3, Cell I + BOOST_CHECK_EQUAL(iConn[start + Ix::CellJ ] , 1); // WINJ-connection 3, Cell J + BOOST_CHECK_EQUAL(iConn[start + Ix::CellK ] , 9); // WINJ-connection 3, Cell K + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnStat ] , 1); // WINJ-connection 3, ConnStat + BOOST_CHECK_EQUAL(iConn[start + Ix::Drainage ] , 0); // WINJ-connection 3, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::Imbibition] , 0); // WINJ-connection 3, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::ComplNum ] , 3); // WINJ-connection 3, Complum number + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnDir ] , 1); // WINJ-connection 3, Connection direction + BOOST_CHECK_EQUAL(iConn[start + Ix::Segment ] , 0); // WINJ-connection 3, Segment ID for direction start = ih.ncwmax*ih.niconz + 3*ih.niconz; - BOOST_CHECK_EQUAL(iConn[start + 0] , 4); // WINJ-connection 4, sequence number - BOOST_CHECK_EQUAL(iConn[start + 1] , 6); // WINJ-connection 4, Cell I - BOOST_CHECK_EQUAL(iConn[start + 2] , 1); // WINJ-connection 4, Cell J - BOOST_CHECK_EQUAL(iConn[start + 3] , 9); // WINJ-connection 4, Cell K - BOOST_CHECK_EQUAL(iConn[start + 5] , 1); // WINJ-connection 4, ConnStat - BOOST_CHECK_EQUAL(iConn[start + 6] , 0); // WINJ-connection 4, Drainage saturation table - BOOST_CHECK_EQUAL(iConn[start + 9] , 0); // WINJ-connection 4, Imbibition saturation table - BOOST_CHECK_EQUAL(iConn[start + 12] , 4); // WINJ-connection 4, Complum number - BOOST_CHECK_EQUAL(iConn[start + 13] , 1); // WINJ-connection 4, Connection direction - BOOST_CHECK_EQUAL(iConn[start + 14] , 0); // WINJ-connection 4, Segment ID for direction + BOOST_CHECK_EQUAL(iConn[start + Ix::SeqIndex ] , 4); // WINJ-connection 4, sequence number + BOOST_CHECK_EQUAL(iConn[start + Ix::CellI ] , 6); // WINJ-connection 4, Cell I + BOOST_CHECK_EQUAL(iConn[start + Ix::CellJ ] , 1); // WINJ-connection 4, Cell J + BOOST_CHECK_EQUAL(iConn[start + Ix::CellK ] , 9); // WINJ-connection 4, Cell K + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnStat ] , 1); // WINJ-connection 4, ConnStat + BOOST_CHECK_EQUAL(iConn[start + Ix::Drainage ] , 0); // WINJ-connection 4, Drainage saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::Imbibition] , 0); // WINJ-connection 4, Imbibition saturation table + BOOST_CHECK_EQUAL(iConn[start + Ix::ComplNum ] , 4); // WINJ-connection 4, Complum number + BOOST_CHECK_EQUAL(iConn[start + Ix::ConnDir ] , 1); // WINJ-connection 4, Connection direction + BOOST_CHECK_EQUAL(iConn[start + Ix::Segment ] , 0); // WINJ-connection 4, Segment ID for direction } // SCONN (PROD) + (WINJ) { // well no 1 - PROD + using Ix = ::Opm::RestartIO::Helpers::VectorItems::SConn::index; const auto& sconn = amconn.getSConn(); int connNo = 1; auto i0 = (connNo-1)*ih.nsconz; - BOOST_CHECK_CLOSE(sconn[i0 ], 2.55826545 , 1.0e-5); // PROD - conn 1 : Transmissibility factor - BOOST_CHECK_CLOSE(sconn[i0 + 1], 7050. , 1.0e-5); // PROD - conn 1 : Centre depth - BOOST_CHECK_CLOSE(sconn[i0 + 2], 0.20 , 1.0e-5); // PROD - conn 1 : diameter - BOOST_CHECK_CLOSE(sconn[i0 + 3], 1581.13879 , 1.0e-5); // PROD - conn 1 : effective kh-product - BOOST_CHECK_CLOSE(sconn[i0 + 11], 2.55826545 , 1.0e-5); // PROD - conn 1 : Transmissibility factor - BOOST_CHECK_CLOSE(sconn[i0 + 20], 130. , 1.0e-5); // PROD - conn 1 : Distance to end of connection in segment - BOOST_CHECK_CLOSE(sconn[i0 + 21], 30. , 1.0e-5); // PROD - conn 1 : Distance to start of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + Ix::ConnTrans ], 2.55826545 , 1.0e-5); // PROD - conn 1 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + Ix::Depth ], 7050. , 1.0e-5); // PROD - conn 1 : Centre depth + BOOST_CHECK_CLOSE(sconn[i0 + Ix::Diameter ], 0.20 , 1.0e-5); // PROD - conn 1 : diameter + BOOST_CHECK_CLOSE(sconn[i0 + Ix::EffectiveKH ], 1581.13879 , 1.0e-5); // PROD - conn 1 : effective kh-product + BOOST_CHECK_CLOSE(sconn[i0 + Ix::item12 ], 2.55826545 , 1.0e-5); // PROD - conn 1 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + Ix::SegDistEnd ], 130. , 1.0e-5); // PROD - conn 1 : Distance to end of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + Ix::SegDistStart], 30. , 1.0e-5); // PROD - conn 1 : Distance to start of connection in segment // Well no 2 - WINJ well connNo = 3; i0 = ih.ncwmax*ih.nsconz + (connNo-1)*ih.nsconz; - BOOST_CHECK_CLOSE(sconn[i0 ], 2.55826545 , 1.0e-5); // WINJ - conn 3 : Transmissibility factor - BOOST_CHECK_CLOSE(sconn[i0 + 1], 7250. , 1.0e-5); // WINJ - conn 3 : Centre depth - BOOST_CHECK_CLOSE(sconn[i0 + 2], 0.20 , 1.0e-5); // WINJ - conn 3 : diameter - BOOST_CHECK_CLOSE(sconn[i0 + 3], 1581.13879 , 1.0e-5); // WINJ - conn 3 : effective kh-product - BOOST_CHECK_CLOSE(sconn[i0 + 11], 2.55826545 , 1.0e-5); // WINJ - conn 3 : Transmissibility factor - BOOST_CHECK_CLOSE(sconn[i0 + 20], 0. , 1.0e-5); // WINJ - conn 3 : Distance to end of connection in segment - BOOST_CHECK_CLOSE(sconn[i0 + 21], 0. , 1.0e-5); // WINJ - conn 3 : Distance to start of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + Ix::ConnTrans ], 2.55826545 , 1.0e-5); // WINJ - conn 3 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + Ix::Depth ], 7250. , 1.0e-5); // WINJ - conn 3 : Centre depth + BOOST_CHECK_CLOSE(sconn[i0 + Ix::Diameter ], 0.20 , 1.0e-5); // WINJ - conn 3 : diameter + BOOST_CHECK_CLOSE(sconn[i0 + Ix::EffectiveKH ], 1581.13879 , 1.0e-5); // WINJ - conn 3 : effective kh-product + BOOST_CHECK_CLOSE(sconn[i0 + Ix::item12 ], 2.55826545 , 1.0e-5); // WINJ - conn 3 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + Ix::SegDistEnd ], 0. , 1.0e-5); // WINJ - conn 3 : Distance to end of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + Ix::SegDistStart], 0. , 1.0e-5); // WINJ - conn 3 : Distance to start of connection in segment connNo = 4; i0 = ih.ncwmax*ih.nsconz + (connNo-1)*ih.nsconz; - BOOST_CHECK_CLOSE(sconn[i0 ], 2.55826545 , 1.0e-5); // WINJ - conn 4 : Transmissibility factor - BOOST_CHECK_CLOSE(sconn[i0 + 1], 7250. , 1.0e-5); // WINJ - conn 4 : Centre depth - BOOST_CHECK_CLOSE(sconn[i0 + 2], 0.20 , 1.0e-5); // WINJ - conn 4 : diameter - BOOST_CHECK_CLOSE(sconn[i0 + 3], 1581.13879 , 1.0e-5); // WINJ - conn 4 : effective kh-product - BOOST_CHECK_CLOSE(sconn[i0 + 11], 2.55826545 , 1.0e-5); // WINJ - conn 4 : Transmissibility factor - BOOST_CHECK_CLOSE(sconn[i0 + 20], 0. , 1.0e-5); // WINJ - conn 4 : Distance to end of connection in segment - BOOST_CHECK_CLOSE(sconn[i0 + 21], 0. , 1.0e-5); // WINJ - conn 4 : Distance to start of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + Ix::ConnTrans ], 2.55826545 , 1.0e-5); // WINJ - conn 4 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + Ix::Depth ], 7250. , 1.0e-5); // WINJ - conn 4 : Centre depth + BOOST_CHECK_CLOSE(sconn[i0 + Ix::Diameter ], 0.20 , 1.0e-5); // WINJ - conn 4 : diameter + BOOST_CHECK_CLOSE(sconn[i0 + Ix::EffectiveKH ], 1581.13879 , 1.0e-5); // WINJ - conn 4 : effective kh-product + BOOST_CHECK_CLOSE(sconn[i0 + Ix::item12 ], 2.55826545 , 1.0e-5); // WINJ - conn 4 : Transmissibility factor + BOOST_CHECK_CLOSE(sconn[i0 + Ix::SegDistEnd ], 0. , 1.0e-5); // WINJ - conn 4 : Distance to end of connection in segment + BOOST_CHECK_CLOSE(sconn[i0 + Ix::SegDistStart], 0. , 1.0e-5); // WINJ - conn 4 : Distance to start of connection in segment } // XCONN (PROD) + (WINJ) { + using Ix = ::Opm::RestartIO::Helpers::VectorItems::XConn::index; const auto& units = simCase.es.getUnits(); using M = ::Opm::UnitSystem::measure; const auto& xconn = amconn.getXConn(); @@ -686,24 +684,24 @@ BOOST_AUTO_TEST_CASE (Declared_Connection_Data) // PROD well int connNo = 1; auto i0 = (connNo-1)*ih.nxconz; - BOOST_CHECK_CLOSE(xconn[i0 ], -units.from_si(M::liquid_surface_rate,5.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface oil rate - BOOST_CHECK_CLOSE(xconn[i0 + 1], -units.from_si(M::liquid_surface_rate,4.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface water rate - BOOST_CHECK_CLOSE(xconn[i0 + 2], -units.from_si(M::gas_surface_rate, 50.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface gas rate - BOOST_CHECK_CLOSE(xconn[i0 + 34], units.from_si(M::pressure, 215.) , 1.0e-5); // PROD - conn 1 : Connection pressure - BOOST_CHECK_CLOSE(xconn[i0 + 49], 0. , 1.0e-5); // PROD - conn 1 : Reservoir volume rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilRate ], -units.from_si(M::liquid_surface_rate,5.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface oil rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WaterRate], -units.from_si(M::liquid_surface_rate,4.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface water rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasRate ], -units.from_si(M::gas_surface_rate, 50.*(float(connNo))) , 1.0e-5); // PROD - conn 1 : Surface gas rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::Pressure ], units.from_si(M::pressure, 215.) , 1.0e-5); // PROD - conn 1 : Connection pressure + BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate ], 0. , 1.0e-5); // PROD - conn 1 : Reservoir volume rate // WINJ well connNo = 3; i0 = ih.ncwmax*ih.nxconz + (connNo-1)*ih.nxconz; - BOOST_CHECK_CLOSE(xconn[i0 + 1], -units.from_si(M::liquid_surface_rate,7.*(float(connNo))) , 1.0e-5); // WINJ - conn 3 : Surface water rate - BOOST_CHECK_CLOSE(xconn[i0 + 34], units.from_si(M::pressure, 218.) , 1.0e-5); // WINJ - conn 3 : Connection pressure - BOOST_CHECK_CLOSE(xconn[i0 + 49], 0. , 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WaterRate], -units.from_si(M::liquid_surface_rate,7.*(float(connNo))) , 1.0e-5); // WINJ - conn 3 : Surface water rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::Pressure ], units.from_si(M::pressure, 218.) , 1.0e-5); // WINJ - conn 3 : Connection pressure + BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate ], 0. , 1.0e-5); // WINJ - conn 3 : Reservoir volume rate connNo = 4; i0 = ih.ncwmax*ih.nxconz + (connNo-1)*ih.nxconz; - BOOST_CHECK_CLOSE(xconn[i0 + 1], -units.from_si(M::liquid_surface_rate,7.*(float(connNo))) , 1.0e-5); // WINJ - conn 3 : Surface water rate - BOOST_CHECK_CLOSE(xconn[i0 + 34], units.from_si(M::pressure, 218.) , 1.0e-5); // WINJ - conn 3 : Connection pressure - BOOST_CHECK_CLOSE(xconn[i0 + 49], 0. , 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WaterRate], -units.from_si(M::liquid_surface_rate,7.*(float(connNo))) , 1.0e-5); // WINJ - conn 3 : Surface water rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::Pressure ], units.from_si(M::pressure, 218.) , 1.0e-5); // WINJ - conn 3 : Connection pressure + BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate ], 0. , 1.0e-5); // WINJ - conn 3 : Reservoir volume rate } }