From 335b070564ca7d5fa5751c53a8338145cfa07fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 11 Sep 2018 19:56:24 +0200 Subject: [PATCH] Aggregate Connection Data: Use Named Indices This commit introduces a new set of named indices pertaining to the *CON vectors (ICON, SCON, XCON). Use these where appropriate in ICON and SCON. --- CMakeLists_files.cmake | 1 + opm/output/eclipse/VectorItems/connection.hpp | 74 +++++++++++++++++++ .../eclipse/AggregateConnectionData.cpp | 64 ++++++++-------- 3 files changed, 106 insertions(+), 33 deletions(-) create mode 100644 opm/output/eclipse/VectorItems/connection.hpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index d202c919c..08a00dd12 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -486,6 +486,7 @@ if(ENABLE_ECL_OUTPUT) opm/output/data/Cells.hpp opm/output/data/Solution.hpp opm/output/data/Wells.hpp + opm/output/eclipse/VectorItems/connection.hpp opm/output/eclipse/VectorItems/intehead.hpp opm/output/eclipse/VectorItems/well.hpp opm/output/eclipse/AggregateGroupData.hpp diff --git a/opm/output/eclipse/VectorItems/connection.hpp b/opm/output/eclipse/VectorItems/connection.hpp new file mode 100644 index 000000000..ae725de1c --- /dev/null +++ b/opm/output/eclipse/VectorItems/connection.hpp @@ -0,0 +1,74 @@ +/* + Copyright (c) 2018 Equinor 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 . +*/ + +#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP +#define OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP + +#include + +namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems { + namespace IConn { + enum index : std::vector::size_type { + SeqIndex = 0, // Connection sequence index + CellI = 1, // I-location (1-based cell index) of connection + CellJ = 2, // J-location (1-based cell index) of connection + CellK = 3, // K-location (1-based cell index) of connection + ConnStat = 5, // Connection status. + // > 0 => open, shut otherwise + + Drainage = 6, // Saturation function (table ID) for drainage + Imbibition = 9, // Saturation function (table ID) for imbibition + + ComplNum = 12, // Completion ID (1-based) + ConnDir = 13, // Penetration direction (1:X, 2:Y, 3:Z) + Segment = 14, // Segment ID of connection + // 0 for regular connections, > 0 for MSW. + }; + } // IConn + + namespace SConn { + enum index : std::vector::size_type { + ConnTrans = 0, // Connection transmissibility factor + Depth = 1, // Connection centre depth + Diameter = 2, // Connection diameter + + EffectiveKH = 3, // Effective Kh product of connection + + item12 = 11, // Unknown + + SegDistEnd = 20, // Distance to end of connection in segment + SegDistStart = 21, // Distance to start of connection in segment + + item30 = 29, // Unknown + item31 = 30, // Unknown + }; + } // SConn + + namespace XConn { + enum index : std::vector::size_type { + OilRate = 0, // Surface flow rate (oil) + WaterRate = 1, // Surface flow rate (water) + GasRate = 2, // Surface Flow rate (gas) + + ResVRate = 49, // Reservoir voidage rate + }; + } // XConn +}}}} // Opm::RestartIO::Helpers::VectorItems + +#endif // OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP diff --git a/src/opm/output/eclipse/AggregateConnectionData.cpp b/src/opm/output/eclipse/AggregateConnectionData.cpp index 4467a3595..a4573368f 100755 --- a/src/opm/output/eclipse/AggregateConnectionData.cpp +++ b/src/opm/output/eclipse/AggregateConnectionData.cpp @@ -19,6 +19,7 @@ #include +#include #include #include @@ -49,7 +50,7 @@ namespace { { return inteHead[VI::intehead::NCWMAX]; } - + std::map mapSeqIndexToConnection(const Opm::WellConnections& conns) { // make seqIndex to Connection map @@ -139,26 +140,29 @@ namespace { IConnArray& iConn) { using ConnState = ::Opm::WellCompletion::StateEnum; + using Ix = ::Opm::RestartIO::Helpers::VectorItems::IConn::index; - // Wrong. Should be connection's order of appearance in COMPDAT. - //iConn[0] = conn.getSeqIndex()+1; - iConn[0] = connID+1; - iConn[1] = conn.getI() + 1; - iConn[2] = conn.getJ() + 1; - iConn[3] = conn.getK() + 1; - iConn[5] = (conn.state == ConnState::OPEN) + iConn[Ix::SeqIndex] = connID + 1; + + iConn[Ix::CellI] = conn.getI() + 1; + iConn[Ix::CellJ] = conn.getJ() + 1; + iConn[Ix::CellK] = conn.getK() + 1; + + iConn[Ix::ConnStat] = (conn.state == ConnState::OPEN) ? 1 : -1000; - iConn[6] = conn.getDefaultSatTabId() ? 0 : conn.sat_tableId; + iConn[Ix::Drainage] = conn.getDefaultSatTabId() + ? 0 : conn.sat_tableId; // Don't support differing sat-func tables for // draining and imbibition curves at connections. - iConn[9] = iConn[6]; + iConn[Ix::Imbibition] = iConn[Ix::Drainage]; - //iConn[12] = std::abs(conn.complnum); - iConn[12] = iConn[0]; - iConn[13] = conn.dir; - iConn[14] = conn.attachedToSegment() + //iConn[Ix::ComplNum] = std::abs(conn.complnum); + iConn[Ix::ComplNum] = iConn[Ix::SeqIndex]; + + iConn[Ix::ConnDir] = conn.dir; + iConn[Ix::Segment] = conn.attachedToSegment() ? conn.segment_number : 0; } } // IConn @@ -186,7 +190,8 @@ namespace { const Opm::UnitSystem& units, SConnArray& sConn) { - using M = ::Opm::UnitSystem::measure; + using M = ::Opm::UnitSystem::measure; + using Ix = ::Opm::RestartIO::Helpers::VectorItems::SConn::index; auto scprop = [&units](const M u, const double x) -> float { @@ -198,37 +203,31 @@ namespace { .getConnectionTransmissibilityFactorAsValueObject(); if (ctf.hasValue()) { - sConn[0] = scprop(M::transmissibility, ctf.getValue()); + sConn[Ix::ConnTrans] = + scprop(M::transmissibility, ctf.getValue()); } } - sConn[1] = scprop(M::length, conn.center_depth); - sConn[2] = scprop(M::length, conn.getDiameter()); + sConn[Ix::Depth] = scprop(M::length, conn.center_depth); + sConn[Ix::Diameter] = scprop(M::length, conn.getDiameter()); { const auto& ckh = conn .getEffectiveKhAsValueObject(); if (ckh.hasValue()) { - auto tkh = scprop(M::permeability, ckh.getValue()); - sConn[3] = scprop(M::length, tkh); + sConn[Ix::EffectiveKH] = + scprop(M::effective_Kh, ckh.getValue()); } } - - - sConn[11] = sConn[0]; + sConn[Ix::item12] = sConn[Ix::ConnTrans]; - // sConn[20] and sConn[21] are tubing end/start (yes, 20 is - // end, 21 is start) lengths of the current connection in a - // multisegmented well. That information is impossible to - // reconstruct here since it is discared in member function - // ::Opm::Well::handleCOMPSEGS(). - sConn[20] = static_cast(conn.getSegDistEnd()); - sConn[21] = static_cast(conn.getSegDistStart()); + sConn[Ix::SegDistEnd] = scprop(M::length, conn.getSegDistEnd()); + sConn[Ix::SegDistStart] = scprop(M::length, conn.getSegDistStart()); - sConn[29] = -1.0e+20f; - sConn[30] = -1.0e+20f; + sConn[Ix::item30] = -1.0e+20f; + sConn[Ix::item31] = -1.0e+20f; } } // SConn } // Anonymous @@ -248,7 +247,6 @@ captureDeclaredConnData(const Schedule& sched, const UnitSystem& units, const std::size_t sim_step) { - //const auto& actnum = grid.activeIndex; const auto& wells = sched.getWells(sim_step); connectionLoop(wells, grid, sim_step, [&units, this]