diff --git a/opm/output/eclipse/AggregateMSWData.hpp b/opm/output/eclipse/AggregateMSWData.hpp index 8c3f8f54e..1b76d058e 100644 --- a/opm/output/eclipse/AggregateMSWData.hpp +++ b/opm/output/eclipse/AggregateMSWData.hpp @@ -21,6 +21,8 @@ #define OPM_AGGREGATE_MSW_DATA_HPP #include +#include + #include #include @@ -32,6 +34,7 @@ namespace Opm { class Schedule; class EclipseGrid; class UnitSystem; + class SummaryState; } // Opm namespace Opm { namespace RestartIO { namespace Helpers { @@ -53,7 +56,9 @@ namespace Opm { namespace RestartIO { namespace Helpers { const std::size_t rptStep, const Opm::UnitSystem& units, const std::vector& inteHead, - const Opm::EclipseGrid& grid); + const Opm::EclipseGrid& grid, + const ::Opm::SummaryState& smry + ); /// Retrieve Integer Multisegment well data Array. const std::vector& getISeg() const diff --git a/src/opm/output/eclipse/AggregateMSWData.cpp b/src/opm/output/eclipse/AggregateMSWData.cpp index b98c5462a..e94101090 100644 --- a/src/opm/output/eclipse/AggregateMSWData.cpp +++ b/src/opm/output/eclipse/AggregateMSWData.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -390,6 +391,7 @@ namespace { const std::size_t rptStep, const std::vector& inteHead, const Opm::UnitSystem& units, + const ::Opm::SummaryState& smry, RSegArray& rSeg) { if (well.isMultiSegment(rptStep)) { @@ -398,17 +400,29 @@ namespace { auto welSegSet = well.getWellSegments(rptStep); auto completionSet = well.getCompletions(rptStep); auto noElmSeg = nrsegz(inteHead); + auto& wname = well.name(); + auto get = [&smry, &wname](const std::string& vector) + { + const auto key = vector + ':' + wname; + + return smry.has(key) ? smry.get(key) : 0.0; + }; + //treat the top segment individually rSeg[0] = units.from_si(M::length, welSegSet.lengthTopSegment()); rSeg[1] = units.from_si(M::length, welSegSet.depthTopSegment()); rSeg[5] = units.from_si(M::volume, welSegSet.volumeTopSegment()); rSeg[6] = rSeg[0]; rSeg[7] = rSeg[1]; + //Item ind+8: should output segment pressure, use well pressure instead + rSeg[8] = get("WBHP"); + //Item ind+9: not sure what this parameter is, the current value works well for tests on E100 + rSeg[9] = 0.01; // set item ind + 10 to 0.5 based on tests on E100 rSeg[10] = 0.5; - // segment pressure (to be added!!) - rSeg[ 39] = 0; + // segment pressure - set equal to item 8 + rSeg[ 39] = rSeg[8]; //Default values rSeg[ 39] = 1.0; @@ -563,7 +577,9 @@ captureDeclaredMSWData(const Schedule& sched, const std::size_t rptStep, const Opm::UnitSystem& units, const std::vector& inteHead, - const Opm::EclipseGrid& grid) + const Opm::EclipseGrid& grid, + const ::Opm::SummaryState& smry + ) { const auto& wells = sched.getWells(rptStep); auto msw = std::vector{}; @@ -586,12 +602,12 @@ captureDeclaredMSWData(const Schedule& sched, // Extract Contributions to RSeg Array { - MSWLoop(msw, [&units, rptStep, inteHead, this] + MSWLoop(msw, [&units, rptStep, inteHead, &smry, this] (const Well& well, const std::size_t mswID) -> void { auto rmsw = this->rSeg_[mswID]; - RSeg::staticContrib(well, rptStep, inteHead, units, rmsw); + RSeg::staticContrib(well, rptStep, inteHead, units, smry, rmsw); }); } diff --git a/src/opm/output/eclipse/RestartIO.cpp b/src/opm/output/eclipse/RestartIO.cpp index e9824bc5c..e59f059a7 100644 --- a/src/opm/output/eclipse/RestartIO.cpp +++ b/src/opm/output/eclipse/RestartIO.cpp @@ -320,12 +320,13 @@ namespace { const UnitSystem& units, const Schedule& schedule, const EclipseGrid& grid, + const Opm::SummaryState& sumState, const std::vector& ih) { // write ISEG, RSEG, ILBS and ILBR to restart file const size_t simStep = static_cast (sim_step); auto MSWData = Helpers::AggregateMSWData(ih); - MSWData.captureDeclaredMSWData(schedule, simStep, units, ih, grid); + MSWData.captureDeclaredMSWData(schedule, simStep, units, ih, grid, sumState); write_kw(rst_file, "ISEG", MSWData.getISeg()); write_kw(rst_file, "ILBS", MSWData.getILBs()); @@ -470,7 +471,7 @@ void save(const std::string& filename, writeGroup(rst_file.get(), sim_step, ecl_compatible_rst, schedule, sumState, inteHD); - writeMSWData(rst_file.get(), sim_step, units, schedule, grid, inteHD); + writeMSWData(rst_file.get(), sim_step, units, schedule, grid, sumState, inteHD); writeWell(rst_file.get(), sim_step, ecl_compatible_rst, es.runspec().phases(), units, grid, schedule, value.wells, sumState, inteHD);