Added changes to improve treatment of multi segment wells in Eclipse Restart

Added flowing well bottom hole pressure to item[8] and [39] plus adjusted item[9]
This commit is contained in:
Jostein Alvestad 2018-09-28 09:48:03 +02:00
parent cfc1b29c08
commit 3f94b580a2
3 changed files with 30 additions and 8 deletions

View File

@ -21,6 +21,8 @@
#define OPM_AGGREGATE_MSW_DATA_HPP #define OPM_AGGREGATE_MSW_DATA_HPP
#include <opm/output/data/Wells.hpp> #include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
#include <opm/output/eclipse/CharArrayNullTerm.hpp> #include <opm/output/eclipse/CharArrayNullTerm.hpp>
#include <opm/output/eclipse/WindowedArray.hpp> #include <opm/output/eclipse/WindowedArray.hpp>
@ -32,6 +34,7 @@ namespace Opm {
class Schedule; class Schedule;
class EclipseGrid; class EclipseGrid;
class UnitSystem; class UnitSystem;
class SummaryState;
} // Opm } // Opm
namespace Opm { namespace RestartIO { namespace Helpers { namespace Opm { namespace RestartIO { namespace Helpers {
@ -53,7 +56,9 @@ namespace Opm { namespace RestartIO { namespace Helpers {
const std::size_t rptStep, const std::size_t rptStep,
const Opm::UnitSystem& units, const Opm::UnitSystem& units,
const std::vector<int>& inteHead, const std::vector<int>& inteHead,
const Opm::EclipseGrid& grid); const Opm::EclipseGrid& grid,
const ::Opm::SummaryState& smry
);
/// Retrieve Integer Multisegment well data Array. /// Retrieve Integer Multisegment well data Array.
const std::vector<int>& getISeg() const const std::vector<int>& getISeg() const

View File

@ -20,6 +20,7 @@
#include <opm/output/eclipse/AggregateMSWData.hpp> #include <opm/output/eclipse/AggregateMSWData.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp> #include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@ -390,6 +391,7 @@ namespace {
const std::size_t rptStep, const std::size_t rptStep,
const std::vector<int>& inteHead, const std::vector<int>& inteHead,
const Opm::UnitSystem& units, const Opm::UnitSystem& units,
const ::Opm::SummaryState& smry,
RSegArray& rSeg) RSegArray& rSeg)
{ {
if (well.isMultiSegment(rptStep)) { if (well.isMultiSegment(rptStep)) {
@ -398,17 +400,29 @@ namespace {
auto welSegSet = well.getWellSegments(rptStep); auto welSegSet = well.getWellSegments(rptStep);
auto completionSet = well.getCompletions(rptStep); auto completionSet = well.getCompletions(rptStep);
auto noElmSeg = nrsegz(inteHead); 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 //treat the top segment individually
rSeg[0] = units.from_si(M::length, welSegSet.lengthTopSegment()); rSeg[0] = units.from_si(M::length, welSegSet.lengthTopSegment());
rSeg[1] = units.from_si(M::length, welSegSet.depthTopSegment()); rSeg[1] = units.from_si(M::length, welSegSet.depthTopSegment());
rSeg[5] = units.from_si(M::volume, welSegSet.volumeTopSegment()); rSeg[5] = units.from_si(M::volume, welSegSet.volumeTopSegment());
rSeg[6] = rSeg[0]; rSeg[6] = rSeg[0];
rSeg[7] = rSeg[1]; 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 // set item ind + 10 to 0.5 based on tests on E100
rSeg[10] = 0.5; rSeg[10] = 0.5;
// segment pressure (to be added!!) // segment pressure - set equal to item 8
rSeg[ 39] = 0; rSeg[ 39] = rSeg[8];
//Default values //Default values
rSeg[ 39] = 1.0; rSeg[ 39] = 1.0;
@ -563,7 +577,9 @@ captureDeclaredMSWData(const Schedule& sched,
const std::size_t rptStep, const std::size_t rptStep,
const Opm::UnitSystem& units, const Opm::UnitSystem& units,
const std::vector<int>& inteHead, const std::vector<int>& inteHead,
const Opm::EclipseGrid& grid) const Opm::EclipseGrid& grid,
const ::Opm::SummaryState& smry
)
{ {
const auto& wells = sched.getWells(rptStep); const auto& wells = sched.getWells(rptStep);
auto msw = std::vector<const Opm::Well*>{}; auto msw = std::vector<const Opm::Well*>{};
@ -586,12 +602,12 @@ captureDeclaredMSWData(const Schedule& sched,
// Extract Contributions to RSeg Array // 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 (const Well& well, const std::size_t mswID) -> void
{ {
auto rmsw = this->rSeg_[mswID]; auto rmsw = this->rSeg_[mswID];
RSeg::staticContrib(well, rptStep, inteHead, units, rmsw); RSeg::staticContrib(well, rptStep, inteHead, units, smry, rmsw);
}); });
} }

View File

@ -320,12 +320,13 @@ namespace {
const UnitSystem& units, const UnitSystem& units,
const Schedule& schedule, const Schedule& schedule,
const EclipseGrid& grid, const EclipseGrid& grid,
const Opm::SummaryState& sumState,
const std::vector<int>& ih) const std::vector<int>& ih)
{ {
// write ISEG, RSEG, ILBS and ILBR to restart file // write ISEG, RSEG, ILBS and ILBR to restart file
const size_t simStep = static_cast<size_t> (sim_step); const size_t simStep = static_cast<size_t> (sim_step);
auto MSWData = Helpers::AggregateMSWData(ih); 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, "ISEG", MSWData.getISeg());
write_kw(rst_file, "ILBS", MSWData.getILBs()); 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); 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, writeWell(rst_file.get(), sim_step, ecl_compatible_rst, es.runspec().phases(), units,
grid, schedule, value.wells, sumState, inteHD); grid, schedule, value.wells, sumState, inteHD);