From 00af07ceed24546e1fae913b362ee6076482ae56 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 29 Oct 2020 11:34:02 +0100 Subject: [PATCH] Load MSW pressure drop model fro restart file --- opm/io/eclipse/rst/well.hpp | 1 + src/opm/io/eclipse/rst/well.cpp | 1 + .../EclipseState/Schedule/MSW/Compsegs.cpp | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/opm/io/eclipse/rst/well.hpp b/opm/io/eclipse/rst/well.hpp index 72b01b781..33114a167 100644 --- a/opm/io/eclipse/rst/well.hpp +++ b/opm/io/eclipse/rst/well.hpp @@ -75,6 +75,7 @@ struct RstWell { int msw_index; int completion_ordering; int pvt_table; + int msw_pressure_drop_model; float orat_target; float wrat_target; diff --git a/src/opm/io/eclipse/rst/well.cpp b/src/opm/io/eclipse/rst/well.cpp index 2f2231d93..ba77fc051 100644 --- a/src/opm/io/eclipse/rst/well.cpp +++ b/src/opm/io/eclipse/rst/well.cpp @@ -70,6 +70,7 @@ RstWell::RstWell(const ::Opm::UnitSystem& unit_system, msw_index( iwel[VI::IWell::MsWID]), completion_ordering( iwel[VI::IWell::CompOrd]), pvt_table( def_pvt_table), + msw_pressure_drop_model( iwel[VI::IWell::MSW_PlossMod]), orat_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::OilRateTarget]))), wrat_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::WatRateTarget]))), grat_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::GasRateTarget]))), diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp index 90379478e..ea9bb7931 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -356,6 +357,21 @@ namespace { } } + + WellSegments::CompPressureDrop pressure_drop_from_int(int ecl_id) { + using PLM = RestartIO::Helpers::VectorItems::IWell::Value::PLossMod; + switch (ecl_id) { + case PLM::HFA: + return WellSegments::CompPressureDrop::HFA; + case PLM::HF_: + return WellSegments::CompPressureDrop::HF_; + case PLM::H__: + return WellSegments::CompPressureDrop::H__; + default: + throw std::logic_error("Converting to pressure loss value failed"); + } + } + } std::pair @@ -391,7 +407,7 @@ namespace { segments_list.push_back( std::move(segment_pair.second) ); std::sort( segments_list.begin(), segments_list.end(),[](const Segment& seg1, const Segment& seg2) { return seg1.segmentNumber() < seg2.segmentNumber(); } ); - auto comp_pressure_drop = WellSegments::CompPressureDrop::HFA; + auto comp_pressure_drop = pressure_drop_from_int(rst_well.msw_pressure_drop_model); WellSegments segments( comp_pressure_drop, segments_list); segments.updatePerfLength( connections );