Added corrections / improvements - generalisations for Eclipse compatible restartfiles

This commit is contained in:
Jostein Alvestad
2018-11-14 15:45:55 +01:00
parent 0cfbfb9957
commit 2add79d122
3 changed files with 48 additions and 22 deletions

View File

@@ -259,7 +259,7 @@ namespace {
}
if (Q.has(R::gas)) {
xConn[Ix::WaterRate] =
xConn[Ix::GasRate] =
- units.from_si(M::gas_surface_rate, Q.get(R::gas));
}

View File

@@ -493,6 +493,7 @@ namespace {
const auto& wname = well.name();
const auto wPKey = "WBHP:" + wname;
const auto& wRatesIt = wr.find(wname);
bool haveWellRes = wRatesIt != wr.end();
//
//Initialize temporary variables
double temp_o = 0.;
@@ -500,8 +501,12 @@ namespace {
double temp_g = 0.;
// find well connections and calculate segment rates based on well connection production/injection terms
const auto& rateConns = wRatesIt->second.connections;
auto sSFR = getSegmentSetFlowRates(welSegSet, rateConns, welConns, units);
auto sSFR = Opm::RestartIO::Helpers::SegmentSetFlowRates{};
if (haveWellRes) {
sSFR = getSegmentSetFlowRates(welSegSet, wRatesIt->second.connections, welConns, units);
}
auto get = [&smry, &wname, &stringSegNum](const std::string& vector)
{
// 'stringSegNum' is one-based (1 .. #segments inclusive)
@@ -527,7 +532,9 @@ namespace {
//Rseg[10]= sgfr*0.001/ Rseg[8]
// branch according to whether multisegment well calculations are switched on or not
if (wRatesIt->second.segments.size() < 2) {
if (haveWellRes && wRatesIt->second.segments.size() < 2) {
// Note: Segment flow rates and pressure from 'smry' have correct
// output units and sign conventions.
temp_o = sSFR.sofr[segNumber];
@@ -583,7 +590,7 @@ namespace {
//see section above for explanation of values
// branch according to whether multisegment well calculations are switched on or not
if (wRatesIt->second.segments.size() < 2) {
if (haveWellRes && wRatesIt->second.segments.size() < 2) {
// Note: Segment flow rates and pressure from 'smry' have correct
// output units and sign conventions.
temp_o = sSFR.sofr[segNumber];

View File

@@ -199,15 +199,15 @@ namespace {
using WMCtrlVal = ::Opm::RestartIO::Helpers::
VectorItems::IWell::Value::WellCtrlMode;
{
/*{
const auto stat = well.getStatus(sim_step);
using WStat = ::Opm::WellCommon::StatusEnum;
if ((stat == WStat::SHUT) || (stat == WStat::STOP)) {
if (stat == WStat::SHUT) {
return WMCtrlVal::Shut;
}
}
}*/
if (well.isInjector(sim_step)) {
const auto& prop = well
@@ -236,7 +236,16 @@ namespace {
case CMode::GRUP: return WMCtrlVal::Group;
default:
return WMCtrlVal::WMCtlUnk;
{
const auto stat = well.getStatus(sim_step);
using WStat = ::Opm::WellCommon::StatusEnum;
if (stat == WStat::SHUT) {
return WMCtrlVal::Shut;
}
}
return WMCtrlVal::WMCtlUnk;
}
}
else if (well.isProducer(sim_step)) {
@@ -254,9 +263,19 @@ namespace {
case CMode::THP: return WMCtrlVal::THP;
case CMode::BHP: return WMCtrlVal::BHP;
case CMode::CRAT: return WMCtrlVal::CombRate;
case CMode::GRUP: return WMCtrlVal::Group;
case CMode::GRUP: return WMCtrlVal::Group;
default:
{
const auto stat = well.getStatus(sim_step);
default: return WMCtrlVal::WMCtlUnk;
using WStat = ::Opm::WellCommon::StatusEnum;
if (stat == WStat::SHUT) {
return WMCtrlVal::Shut;
}
}
return WMCtrlVal::WMCtlUnk;
}
}
@@ -476,18 +495,19 @@ namespace {
if (well.isProducer(sim_step)) {
const auto& pp = well.getProductionProperties(sim_step);
const auto& predMode = pp.predictionMode;
if (pp.OilRate != 0.0) {
if ((pp.OilRate != 0.0) || (!predMode)) {
sWell[Ix::OilRateTarget] =
swprop(M::liquid_surface_rate, pp.OilRate);
}
if (pp.WaterRate != 0.0) {
if ((pp.WaterRate != 0.0) || (!predMode)) {
sWell[Ix::WatRateTarget] =
swprop(M::liquid_surface_rate, pp.WaterRate);
}
if (pp.GasRate != 0.0) {
if ((pp.GasRate != 0.0) || (!predMode)) {
sWell[Ix::GasRateTarget] =
swprop(M::gas_surface_rate, pp.GasRate);
}
@@ -501,21 +521,20 @@ namespace {
swprop(M::liquid_surface_rate, pp.OilRate + pp.WaterRate);
}
if (pp.ResVRate != 0.0) {
if (pp.ResVRate != 0.0) {
sWell[Ix::ResVRateTarget] =
swprop(M::rate, pp.ResVRate);
}
else if (smry.has("WVPR:" + well.name())) {
else if ((smry.has("WVPR:" + well.name())) && (!predMode)) {
// Write out summary voidage production rate if
// target/limit is not set
sWell[Ix::ResVRateTarget] =
static_cast<float>(smry.get("WVPR:" + well.name()));
auto vr = static_cast<float>(smry.get("WVPR:" + well.name()));
if (vr != 0.0) sWell[Ix::ResVRateTarget] = vr;
}
if (pp.THPLimit != 0.0) {
sWell[Ix::THPTarget] =
swprop(M::pressure, pp.THPLimit);
}
sWell[Ix::THPTarget] = pp.THPLimit != 0.0
? swprop(M::pressure, pp.THPLimit)
: 0.;
sWell[Ix::BHPTarget] = pp.BHPLimit != 0.0
? swprop(M::pressure, pp.BHPLimit)