From 589191f53261851f538ab23ed11bccccd9be07c6 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 28 Oct 2021 16:05:01 +0200 Subject: [PATCH] Write options for GLIFTOPT to restart file --- opm/output/eclipse/VectorItems/group.hpp | 2 ++ src/opm/output/eclipse/AggregateGroupData.cpp | 12 ++++++++++-- tests/test_AggregateGroupData.cpp | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/opm/output/eclipse/VectorItems/group.hpp b/opm/output/eclipse/VectorItems/group.hpp index 1a99c8f6d..7ddf26ef0 100644 --- a/opm/output/eclipse/VectorItems/group.hpp +++ b/opm/output/eclipse/VectorItems/group.hpp @@ -32,6 +32,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems WatRateLimit = 7, // Group's water production target/limit GasRateLimit = 8, // Group's gas production target/limit LiqRateLimit = 9, // Group's liquid production target/limit + GLOMaxSupply = 34, // Group's maximum supply of lift gas + GLOMaxRate = 91, // Group's maximum lift gas rate }; enum inj_index : std::vector::size_type { diff --git a/src/opm/output/eclipse/AggregateGroupData.cpp b/src/opm/output/eclipse/AggregateGroupData.cpp index 94dafc6f6..21df78390 100644 --- a/src/opm/output/eclipse/AggregateGroupData.cpp +++ b/src/opm/output/eclipse/AggregateGroupData.cpp @@ -755,6 +755,7 @@ allocate(const std::vector& inteHead) template void staticContrib(const Opm::Group& group, + const Opm::GasLiftOpt& glo, const Opm::SummaryState& sumState, const Opm::UnitSystem& units, SGrpArray& sGrp) @@ -830,6 +831,12 @@ void staticContrib(const Opm::Group& group, } } + if (glo.has_group(group.name())) { + const auto& glo_group = glo.group(group.name()); + sGrp[Isp::GLOMaxSupply] = sgprop(M::gas_surface_rate, glo_group.max_lift_gas().value()); + sGrp[Isp::GLOMaxRate] = sgprop(M::gas_surface_rate, glo_group.max_total_gas().value()); + } + if ((group.name() == "FIELD") && (group.getGroupType() == Opm::Group::GroupType::NONE)) { sGrp[Isp::GuideRate] = 0.; sGrp[14] = 0.; @@ -1011,6 +1018,7 @@ captureDeclaredGroupData(const Opm::Schedule& sched, const std::vector& inteHead) { const auto& curGroups = sched.restart_groups(simStep); + const auto& sched_state = sched[simStep]; groupLoop(curGroups, [&sched, simStep, sumState, this] (const Group& group, const std::size_t groupID) -> void @@ -1022,10 +1030,10 @@ captureDeclaredGroupData(const Opm::Schedule& sched, // Define Static Contributions to SGrp Array. groupLoop(curGroups, - [&sumState, &units, this](const Group& group , const std::size_t groupID) -> void + [&sumState, &units, &sched_state, this](const Group& group , const std::size_t groupID) -> void { auto sw = this->sGroup_[groupID]; - SGrp::staticContrib(group, sumState, units, sw); + SGrp::staticContrib(group, sched_state.glo(), sumState, units, sw); }); // Define Dynamic Contributions to XGrp Array. diff --git a/tests/test_AggregateGroupData.cpp b/tests/test_AggregateGroupData.cpp index b0686df41..52e9610e1 100644 --- a/tests/test_AggregateGroupData.cpp +++ b/tests/test_AggregateGroupData.cpp @@ -425,6 +425,13 @@ Opm::Deck first_sim() / / + LIFTOPT + 1 2 / + + GLIFTOPT + 'WGRP1' 100 200 / + / + TSTEP 4 / @@ -671,6 +678,16 @@ BOOST_AUTO_TEST_CASE (Declared_Group_Data) BOOST_CHECK_EQUAL(iGrp[start + ih.nwgmax + 27] , 0); // Group FIELD - Group level (FIELD level is 0) } + // SGRP + { + using Ix = ::Opm::RestartIO::Helpers::VectorItems::SGroup::prod_index; + auto start = 1*ih.nsgrpz; + + const auto& sGrp = agrpd.getSGroup(); + BOOST_CHECK_CLOSE(sGrp[start + Ix::GLOMaxSupply], 100, 1e-6); + BOOST_CHECK_CLOSE(sGrp[start + Ix::GLOMaxRate], 200, 1e-6); + } + // XGRP (PROD) {