Initial changes to add group data to restart output

While here also add changes to include no of groups in InteHEAD
This commit is contained in:
Jostein Alvestad
2018-04-23 15:09:09 +02:00
parent 9cf9bf310d
commit 0f26e2e958
2 changed files with 116 additions and 131 deletions

View File

@@ -24,7 +24,6 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
@@ -220,6 +219,117 @@ namespace {
return level;
}
#if 0
namespace SWell {
template <class SWellArray>
void staticContrib(SWellArray& sWell)
{
const auto dflt = -1.0e+20f;
const auto infty = 1.0e+20f;
const auto zero = 0.0f;
const auto one = 1.0f;
const auto half = 0.5f;
// Initial data by Statoil ASA.
const auto init = std::vector<float> { // 122 Items (0..121)
// 0 1 2 3 4 5
infty, infty, infty, infty, infty, infty, // 0.. 5 ( 0)
one , zero , zero , zero , zero , 1.0e-05f, // 6.. 11 ( 1)
zero , zero , infty, infty, zero , dflt , // 12.. 17 ( 2)
infty, infty, infty, infty, infty, zero , // 18.. 23 ( 3)
one , zero , zero , zero , zero , zero , // 24.. 29 ( 4)
zero , one , zero , infty, zero , zero , // 30.. 35 ( 5)
zero , zero , zero , zero , zero , zero , // 36.. 41 ( 6)
zero , zero , zero , zero , zero , zero , // 42.. 47 ( 7)
zero , zero , zero , zero , zero , zero , // 48.. 53 ( 8)
infty, zero , zero , zero , zero , zero , // 54.. 59 ( 9)
zero , zero , zero , zero , zero , zero , // 60.. 65 (10)
zero , zero , zero , zero , zero , zero , // 66.. 71 (11)
zero , zero , zero , zero , zero , zero , // 72.. 77 (12)
zero , infty, infty, zero , zero , one , // 78.. 83 (13)
one , one , zero , infty, zero , infty, // 84.. 89 (14)
one , dflt , one , zero , zero , zero , // 90.. 95 (15)
zero , zero , zero , zero , zero , zero , // 96..101 (16)
zero , zero , zero , zero , zero , zero , // 102..107 (17)
zero , zero , half , one , zero , zero , // 108..113 (18)
zero , zero , zero , zero , zero , infty, // 114..119 (19)
zero , one , // 120..121 (20)
};
const auto sz = static_cast<
decltype(init.size())>(sWell.size());
auto b = std::begin(init);
auto e = b + std::min(init.size(), sz);
std::copy(b, e, std::begin(sWell));
}
} // SWell
namespace XWell {
bool activeGas(const ::Opm::Phases& phases)
{
return phases.active(::Opm::Phase::GAS);
}
bool activeOil(const ::Opm::Phases& phases)
{
return phases.active(::Opm::Phase::OIL);
}
bool activeWater(const ::Opm::Phases& phases)
{
return phases.active(::Opm::Phase::WATER);
}
template <class XWellArray>
void assignProducer(const ::Opm::data::Well& xw,
const ::Opm::Phases& phases,
XWellArray& xWell)
{
using SolnQuant = ::Opm::data::Rates::opt;
if (activeGas(phases)) {
if (xw.rates.has(SolnQuant::gas)) {
xWell[2] = xw.rates.get(SolnQuant::gas);
}
}
if (activeOil(phases)) {
if (xw.rates.has(SolnQuant::oil)) {
xWell[0] = xw.rates.get(SolnQuant::oil);
}
}
if (activeWater(phases)) {
if (xw.rates.has(SolnQuant::wat)) {
xWell[1] = xw.rates.get(SolnQuant::wat);
}
}
}
template <class XWellArray>
void dynamicContrib(const ::Opm::Well& well,
const ::Opm::Phases& phases,
const ::Opm::WellRates& wRates,
XWellArray& xWell)
{
auto x = wRates.find(well.name());
if (x == wRates.end()) { return; }
const auto& xw = *x->second;
}
} // XWell
namespace ZWell {
template <class ZWellArray>
void staticContrib(const Opm::Well& well, ZWellArray& zWell)
{
zWell[1 - 1] = well.name();
}
} // ZWell
#endif
namespace IGrp {
std::size_t entriesPerGroup(const std::vector<int>& inteHead)
{
@@ -404,53 +514,6 @@ namespace {
}
} // SGrp
#if 0
template <class SWellArray>
void staticContrib(SWellArray& sWell)
{
const auto dflt = -1.0e+20f;
const auto infty = 1.0e+20f;
const auto zero = 0.0f;
const auto one = 1.0f;
const auto half = 0.5f;
// Initial data by Statoil ASA.
const auto init = std::vector<float> { // 122 Items (0..121)
// 0 1 2 3 4 5
infty, infty, infty, infty, infty, infty, // 0.. 5 ( 0)
one , zero , zero , zero , zero , 1.0e-05f, // 6.. 11 ( 1)
zero , zero , infty, infty, zero , dflt , // 12.. 17 ( 2)
infty, infty, infty, infty, infty, zero , // 18.. 23 ( 3)
one , zero , zero , zero , zero , zero , // 24.. 29 ( 4)
zero , one , zero , infty, zero , zero , // 30.. 35 ( 5)
zero , zero , zero , zero , zero , zero , // 36.. 41 ( 6)
zero , zero , zero , zero , zero , zero , // 42.. 47 ( 7)
zero , zero , zero , zero , zero , zero , // 48.. 53 ( 8)
infty, zero , zero , zero , zero , zero , // 54.. 59 ( 9)
zero , zero , zero , zero , zero , zero , // 60.. 65 (10)
zero , zero , zero , zero , zero , zero , // 66.. 71 (11)
zero , zero , zero , zero , zero , zero , // 72.. 77 (12)
zero , infty, infty, zero , zero , one , // 78.. 83 (13)
one , one , zero , infty, zero , infty, // 84.. 89 (14)
one , dflt , one , zero , zero , zero , // 90.. 95 (15)
zero , zero , zero , zero , zero , zero , // 96..101 (16)
zero , zero , zero , zero , zero , zero , // 102..107 (17)
zero , zero , half , one , zero , zero , // 108..113 (18)
zero , zero , zero , zero , zero , infty, // 114..119 (19)
zero , one , // 120..121 (20)
};
const auto sz = static_cast<
decltype(init.size())>(sWell.size());
auto b = std::begin(init);
auto e = b + std::min(init.size(), sz);
std::copy(b, e, std::begin(sWell));
}
} // SWell
#endif
namespace XGrp {
using SolnQuant = ::Opm::data::Rates::opt;
@@ -472,62 +535,6 @@ namespace {
}
}
#if 0
bool activeGas(const ::Opm::Phases& phases)
{
return phases.active(::Opm::Phase::GAS);
}
bool activeOil(const ::Opm::Phases& phases)
{
return phases.active(::Opm::Phase::OIL);
}
bool activeWater(const ::Opm::Phases& phases)
{
return phases.active(::Opm::Phase::WATER);
}
template <class XWellArray>
void assignProducer(const ::Opm::data::Well& xw,
const ::Opm::Phases& phases,
XWellArray& xWell)
{
using SolnQuant = ::Opm::data::Rates::opt;
if (activeGas(phases)) {
if (xw.rates.has(SolnQuant::gas)) {
xWell[2] = xw.rates.get(SolnQuant::gas);
}
}
if (activeOil(phases)) {
if (xw.rates.has(SolnQuant::oil)) {
xWell[0] = xw.rates.get(SolnQuant::oil);
}
}
if (activeWater(phases)) {
if (xw.rates.has(SolnQuant::wat)) {
xWell[1] = xw.rates.get(SolnQuant::wat);
}
}
}
template <class XWellArray>
void dynamicContrib(const ::Opm::Well& well,
const ::Opm::Phases& phases,
const ::Opm::WellRates& wRates,
XWellArray& xWell)
{
auto x = wRates.find(well.name());
if (x == wRates.end()) { return; }
const auto& xw = *x->second;
}
} // XWell
#endif
namespace ZGrp {
std::size_t entriesPerGroup(const std::vector<int>& inteHead)
{
@@ -550,21 +557,8 @@ namespace {
};
}
}
#if 0
template <class ZWellArray>
void staticContrib(const Opm::Well& well, ZWellArray& zWell)
{
zWell[1 - 1] = well.name();
}
} // ZWell
#endif
} // Anonymous
// =====================================================================
Opm::RestartIO::Helpers::AggregateGroupData::
@@ -573,8 +567,8 @@ AggregateGroupData(const std::vector<int>& inteHead)
, sGroup_ (SGrp::allocate(inteHead))
, xGroup_ (XGrp::allocate(inteHead))
, zGroup_ (ZGrp::allocate(inteHead))
, nWGMax_(nwgmax(inteHead))
, nGMaxz_(ngmaxz(inteHead))
, nWGMax_ (nwgmax(inteHead))
, nGMaxz_ (ngmaxz(inteHead))
{}
// ---------------------------------------------------------------------
@@ -626,20 +620,10 @@ captureDeclaredGroupData(const Schedule& sched,
auto sw = this->sGroup_[groupID];
SGrp::staticContrib(sw);
});
#if 0
// Define Static Contributions to ZWell Array.
wellLoop(wells,
[this](const Well& well, const std::size_t wellID) -> void
{
auto zw = this->zWell_[wellID];
ZWell::staticContrib(well, zw);
});
#endif
}
// ---------------------------------------------------------------------
#if 0
void
Opm::RestartIO::Helpers::AggregateWellData::

View File

@@ -375,7 +375,8 @@ namespace {
// ---------------------------------------------------------------------
Opm::RestartIO::DoubHEAD::DoubHEAD()
: data_(Index::NUMBER_OF_ITEMS, -1.0e20)
: data_(Index::NUMBER_OF_ITEMS, 0.0)
//: data_(Index::NUMBER_OF_ITEMS, -1.0e20)
{
// Numbers below have unknown usage, values have been determined by
// experiments to be constant across a range of reference cases.