From fe9ade9dabb3da86ca89fb466b9f105e5779b741 Mon Sep 17 00:00:00 2001 From: Jostein Alvestad Date: Tue, 8 Dec 2020 14:50:45 +0100 Subject: [PATCH] changes to SWEL and XCONN for lift gas optimisation --- opm/output/eclipse/VectorItems/connection.hpp | 4 +++ .../eclipse/AggregateConnectionData.cpp | 3 +++ src/opm/output/eclipse/AggregateWellData.cpp | 27 +++++++++++++------ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/opm/output/eclipse/VectorItems/connection.hpp b/opm/output/eclipse/VectorItems/connection.hpp index 5f7325d02..24e352f7c 100644 --- a/opm/output/eclipse/VectorItems/connection.hpp +++ b/opm/output/eclipse/VectorItems/connection.hpp @@ -67,6 +67,10 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems WaterRate = 1, // Surface flow rate (water) GasRate = 2, // Surface Flow rate (gas) + OilRate_Copy = 17, // Surface flow rate (oil) + WaterRate_Copy = 18, // Surface flow rate (water) + GasRate_Copy = 19, // Surface Flow rate (gas) + Pressure = 34, // Connection pressure value ResVRate = 49, // Reservoir voidage rate diff --git a/src/opm/output/eclipse/AggregateConnectionData.cpp b/src/opm/output/eclipse/AggregateConnectionData.cpp index 312bcad4e..2ecec7500 100755 --- a/src/opm/output/eclipse/AggregateConnectionData.cpp +++ b/src/opm/output/eclipse/AggregateConnectionData.cpp @@ -253,16 +253,19 @@ namespace { if (Q.has(R::oil)) { xConn[Ix::OilRate] = - units.from_si(M::liquid_surface_rate, Q.get(R::oil)); + xConn[Ix::OilRate_Copy] = xConn[Ix::OilRate]; } if (Q.has(R::wat)) { xConn[Ix::WaterRate] = - units.from_si(M::liquid_surface_rate, Q.get(R::wat)); + xConn[Ix::WaterRate_Copy] = xConn[Ix::WaterRate]; } if (Q.has(R::gas)) { xConn[Ix::GasRate] = - units.from_si(M::gas_surface_rate, Q.get(R::gas)); + xConn[Ix::GasRate_Copy] = xConn[Ix::GasRate]; } xConn[Ix::ResVRate] = 0.0; diff --git a/src/opm/output/eclipse/AggregateWellData.cpp b/src/opm/output/eclipse/AggregateWellData.cpp index e16098632..7617e0310 100644 --- a/src/opm/output/eclipse/AggregateWellData.cpp +++ b/src/opm/output/eclipse/AggregateWellData.cpp @@ -498,10 +498,12 @@ namespace { return rLimit; }; template - void staticContrib(const Opm::Well& well, - const Opm::UnitSystem& units, - const ::Opm::SummaryState& smry, - SWellArray& sWell) + void staticContrib(const Opm::Well& well, + const Opm::UnitSystem& units, + const std::size_t sim_step, + const Opm::Schedule& sched, + const ::Opm::SummaryState& smry, + SWellArray& sWell) { using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index; using M = ::Opm::UnitSystem::measure; @@ -575,9 +577,18 @@ namespace { : swprop(M::pressure, 1.0*::Opm::unit::atm); sWell[Ix::HistBHPTarget] = sWell[Ix::BHPTarget]; - //alq_value - has no unit conversion according to parser code if (pc.alq_value != 0.0) { - sWell[Ix::Alq_value] = pc.alq_value; + auto vfpTable = sched.getVFPProdTable(pc.vfp_table_number,sim_step); + if (vfpTable.getALQType() == Opm::VFPProdTable::ALQ_GRAT) { + sWell[Ix::Alq_value] = static_cast(units.from_si(M::gas_surface_rate, pc.alq_value)); + } + else if ((vfpTable.getALQType() == Opm::VFPProdTable::ALQ_IGLR) || (vfpTable.getALQType() == Opm::VFPProdTable::ALQ_TGLR)) { + sWell[Ix::Alq_value] = static_cast(units.from_si(M::gas_oil_ratio, pc.alq_value)); + } + else { + // not all alq_value options have units + sWell[Ix::Alq_value] = pc.alq_value; + } } if (predMode) { @@ -960,12 +971,12 @@ captureDeclaredWellData(const Schedule& sched, } // Static contributions to SWEL array. - wellLoop(wells, [&units, &smry, this] + wellLoop(wells, [&units, &sim_step, &sched, &smry, this] (const Well& well, const std::size_t wellID) -> void { auto sw = this->sWell_[wellID]; - SWell::staticContrib(well, units, smry, sw); + SWell::staticContrib(well, units, sim_step, sched, smry, sw); }); // Static contributions to XWEL array.