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.
This commit is contained in:
Bård Skaflestad 2018-09-11 19:56:24 +02:00 committed by Jostein Alvestad
parent d42c98223c
commit 335b070564
3 changed files with 106 additions and 33 deletions

View File

@ -486,6 +486,7 @@ if(ENABLE_ECL_OUTPUT)
opm/output/data/Cells.hpp opm/output/data/Cells.hpp
opm/output/data/Solution.hpp opm/output/data/Solution.hpp
opm/output/data/Wells.hpp opm/output/data/Wells.hpp
opm/output/eclipse/VectorItems/connection.hpp
opm/output/eclipse/VectorItems/intehead.hpp opm/output/eclipse/VectorItems/intehead.hpp
opm/output/eclipse/VectorItems/well.hpp opm/output/eclipse/VectorItems/well.hpp
opm/output/eclipse/AggregateGroupData.hpp opm/output/eclipse/AggregateGroupData.hpp

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace IConn {
enum index : std::vector<int>::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<float>::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<double>::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

View File

@ -19,6 +19,7 @@
#include <opm/output/eclipse/AggregateConnectionData.hpp> #include <opm/output/eclipse/AggregateConnectionData.hpp>
#include <opm/output/eclipse/VectorItems/connection.hpp>
#include <opm/output/eclipse/VectorItems/intehead.hpp> #include <opm/output/eclipse/VectorItems/intehead.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp> #include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
@ -49,7 +50,7 @@ namespace {
{ {
return inteHead[VI::intehead::NCWMAX]; return inteHead[VI::intehead::NCWMAX];
} }
std::map <std::size_t, const Opm::Connection*> mapSeqIndexToConnection(const Opm::WellConnections& conns) std::map <std::size_t, const Opm::Connection*> mapSeqIndexToConnection(const Opm::WellConnections& conns)
{ {
// make seqIndex to Connection map // make seqIndex to Connection map
@ -139,26 +140,29 @@ namespace {
IConnArray& iConn) IConnArray& iConn)
{ {
using ConnState = ::Opm::WellCompletion::StateEnum; using ConnState = ::Opm::WellCompletion::StateEnum;
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IConn::index;
// Wrong. Should be connection's order of appearance in COMPDAT. iConn[Ix::SeqIndex] = connID + 1;
//iConn[0] = conn.getSeqIndex()+1;
iConn[0] = connID+1; iConn[Ix::CellI] = conn.getI() + 1;
iConn[1] = conn.getI() + 1; iConn[Ix::CellJ] = conn.getJ() + 1;
iConn[2] = conn.getJ() + 1; iConn[Ix::CellK] = conn.getK() + 1;
iConn[3] = conn.getK() + 1;
iConn[5] = (conn.state == ConnState::OPEN) iConn[Ix::ConnStat] = (conn.state == ConnState::OPEN)
? 1 : -1000; ? 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 // Don't support differing sat-func tables for
// draining and imbibition curves at connections. // draining and imbibition curves at connections.
iConn[9] = iConn[6]; iConn[Ix::Imbibition] = iConn[Ix::Drainage];
//iConn[12] = std::abs(conn.complnum); //iConn[Ix::ComplNum] = std::abs(conn.complnum);
iConn[12] = iConn[0]; iConn[Ix::ComplNum] = iConn[Ix::SeqIndex];
iConn[13] = conn.dir;
iConn[14] = conn.attachedToSegment() iConn[Ix::ConnDir] = conn.dir;
iConn[Ix::Segment] = conn.attachedToSegment()
? conn.segment_number : 0; ? conn.segment_number : 0;
} }
} // IConn } // IConn
@ -186,7 +190,8 @@ namespace {
const Opm::UnitSystem& units, const Opm::UnitSystem& units,
SConnArray& sConn) 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 auto scprop = [&units](const M u, const double x) -> float
{ {
@ -198,37 +203,31 @@ namespace {
.getConnectionTransmissibilityFactorAsValueObject(); .getConnectionTransmissibilityFactorAsValueObject();
if (ctf.hasValue()) { 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[Ix::Depth] = scprop(M::length, conn.center_depth);
sConn[2] = scprop(M::length, conn.getDiameter()); sConn[Ix::Diameter] = scprop(M::length, conn.getDiameter());
{ {
const auto& ckh = conn const auto& ckh = conn
.getEffectiveKhAsValueObject(); .getEffectiveKhAsValueObject();
if (ckh.hasValue()) { if (ckh.hasValue()) {
auto tkh = scprop(M::permeability, ckh.getValue()); sConn[Ix::EffectiveKH] =
sConn[3] = scprop(M::length, tkh); 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 sConn[Ix::SegDistEnd] = scprop(M::length, conn.getSegDistEnd());
// end, 21 is start) lengths of the current connection in a sConn[Ix::SegDistStart] = scprop(M::length, conn.getSegDistStart());
// multisegmented well. That information is impossible to
// reconstruct here since it is discared in member function
// ::Opm::Well::handleCOMPSEGS().
sConn[20] = static_cast<float>(conn.getSegDistEnd());
sConn[21] = static_cast<float>(conn.getSegDistStart());
sConn[29] = -1.0e+20f; sConn[Ix::item30] = -1.0e+20f;
sConn[30] = -1.0e+20f; sConn[Ix::item31] = -1.0e+20f;
} }
} // SConn } // SConn
} // Anonymous } // Anonymous
@ -248,7 +247,6 @@ captureDeclaredConnData(const Schedule& sched,
const UnitSystem& units, const UnitSystem& units,
const std::size_t sim_step) const std::size_t sim_step)
{ {
//const auto& actnum = grid.activeIndex;
const auto& wells = sched.getWells(sim_step); const auto& wells = sched.getWells(sim_step);
connectionLoop(wells, grid, sim_step, [&units, this] connectionLoop(wells, grid, sim_step, [&units, this]