@@ -112,7 +112,7 @@ enum class GuideRateTarget {
|
||||
NO_GUIDE_RATE = 11
|
||||
};
|
||||
static GuideRateTarget GuideRateTargetFromString( const std::string& stringValue );
|
||||
|
||||
static GuideRateTarget GuideRateTargetFromInt(int ecl_id);
|
||||
|
||||
|
||||
struct GroupInjectionProperties {
|
||||
|
||||
@@ -32,6 +32,14 @@ namespace RestartIO {
|
||||
|
||||
using M = ::Opm::UnitSystem::measure;
|
||||
|
||||
double sgrp_value(float raw_value) {
|
||||
const auto infty = 1.0e+20f;
|
||||
if (std::abs(raw_value) == infty)
|
||||
return 0;
|
||||
else
|
||||
return raw_value;
|
||||
}
|
||||
|
||||
RstGroup::RstGroup(const ::Opm::UnitSystem& unit_system,
|
||||
const RstHeader& header,
|
||||
const std::string* zwel,
|
||||
@@ -45,18 +53,21 @@ RstGroup::RstGroup(const ::Opm::UnitSystem& unit_system,
|
||||
winj_cmode(igrp[header.nwgmax + VI::IGroup::WInjCMode]),
|
||||
ginj_cmode(igrp[header.nwgmax + VI::IGroup::GInjCMode]),
|
||||
guide_rate_def(igrp[header.nwgmax + VI::IGroup::GuideRateDef]),
|
||||
oil_rate_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::OilRateLimit])),
|
||||
water_rate_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::WatRateLimit])),
|
||||
gas_rate_limit( unit_system.to_si(M::gas_surface_rate, sgrp[VI::SGroup::GasRateLimit])),
|
||||
liquid_rate_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::LiqRateLimit])),
|
||||
water_surface_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::waterSurfRateLimit])),
|
||||
water_reservoir_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::waterResRateLimit])),
|
||||
water_reinject_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::waterReinjectionLimit])),
|
||||
water_voidage_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::waterVoidageLimit])),
|
||||
gas_surface_limit( unit_system.to_si(M::gas_surface_rate, sgrp[VI::SGroup::gasSurfRateLimit])),
|
||||
gas_reservoir_limit( unit_system.to_si(M::geometric_volume_rate, sgrp[VI::SGroup::gasResRateLimit])),
|
||||
gas_reinject_limit( unit_system.to_si(M::gas_surface_rate, sgrp[VI::SGroup::gasReinjectionLimit])),
|
||||
gas_voidage_limit( unit_system.to_si(M::geometric_volume_rate, sgrp[VI::SGroup::gasVoidageLimit])),
|
||||
// The values oil_rate_limit -> gas_voidage_limit will be used in UDA
|
||||
// values. The UDA values are responsible for unit conversion and raw values
|
||||
// are internalized here.
|
||||
oil_rate_limit( sgrp_value(sgrp[VI::SGroup::OilRateLimit])),
|
||||
water_rate_limit( sgrp_value(sgrp[VI::SGroup::WatRateLimit])),
|
||||
gas_rate_limit( sgrp_value(sgrp[VI::SGroup::GasRateLimit])),
|
||||
liquid_rate_limit( sgrp_value(sgrp[VI::SGroup::LiqRateLimit])),
|
||||
water_surface_limit( sgrp_value(sgrp[VI::SGroup::waterSurfRateLimit])),
|
||||
water_reservoir_limit( sgrp_value(sgrp[VI::SGroup::waterResRateLimit])),
|
||||
water_reinject_limit( sgrp_value(sgrp[VI::SGroup::waterReinjectionLimit])),
|
||||
water_voidage_limit( sgrp_value(sgrp[VI::SGroup::waterVoidageLimit])),
|
||||
gas_surface_limit( sgrp_value(sgrp[VI::SGroup::gasSurfRateLimit])),
|
||||
gas_reservoir_limit( sgrp_value(sgrp[VI::SGroup::gasResRateLimit])),
|
||||
gas_reinject_limit( sgrp_value(sgrp[VI::SGroup::gasReinjectionLimit])),
|
||||
gas_voidage_limit( sgrp_value(sgrp[VI::SGroup::gasVoidageLimit])),
|
||||
oil_production_rate( unit_system.to_si(M::liquid_surface_rate, xgrp[VI::XGroup::OilPrRate])),
|
||||
water_production_rate( unit_system.to_si(M::liquid_surface_rate, xgrp[VI::XGroup::WatPrRate])),
|
||||
gas_production_rate( unit_system.to_si(M::gas_surface_rate, xgrp[VI::XGroup::GasPrRate])),
|
||||
|
||||
@@ -344,8 +344,8 @@ std::vector<std::size_t> groupParentSeqIndex(const Opm::Schedule& sched,
|
||||
|
||||
|
||||
bool higherLevelProdCMode_NotNoneFld(const Opm::Schedule& sched,
|
||||
const Opm::Group& group,
|
||||
const size_t simStep)
|
||||
const Opm::Group& group,
|
||||
const size_t simStep)
|
||||
{
|
||||
bool ctrl_mode_not_none_fld = false;
|
||||
if (group.defined( simStep )) {
|
||||
@@ -447,28 +447,28 @@ void productionGroup(const Opm::Schedule& sched,
|
||||
iGrp[nwgmax + 7] = 0;
|
||||
switch (prod_cmode) {
|
||||
case Opm::Group::ProductionCMode::NONE:
|
||||
iGrp[nwgmax + 10] = 0;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 0;
|
||||
break;
|
||||
case Opm::Group::ProductionCMode::ORAT:
|
||||
iGrp[nwgmax + 10] = 1;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 1;
|
||||
break;
|
||||
case Opm::Group::ProductionCMode::WRAT:
|
||||
iGrp[nwgmax + 10] = 2;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 2;
|
||||
break;
|
||||
case Opm::Group::ProductionCMode::GRAT:
|
||||
iGrp[nwgmax + 10] = 3;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 3;
|
||||
break;
|
||||
case Opm::Group::ProductionCMode::LRAT:
|
||||
iGrp[nwgmax + 10] = 4;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 4;
|
||||
break;
|
||||
case Opm::Group::ProductionCMode::RESV:
|
||||
iGrp[nwgmax + 10] = 5;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 5;
|
||||
break;
|
||||
case Opm::Group::ProductionCMode::FLD:
|
||||
iGrp[nwgmax + 10] = 0;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 0;
|
||||
break;
|
||||
default:
|
||||
iGrp[nwgmax + 10] = 0;
|
||||
iGrp[nwgmax + IGroup::GConProdCMode] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -520,8 +520,8 @@ void productionGroup(const Opm::Schedule& sched,
|
||||
*/
|
||||
// default value
|
||||
iGrp[nwgmax + 5] = -1;
|
||||
int higher_lev_ctrl = higherLevelProdControlGroupSeqIndex(sched, sumState, group, simStep);
|
||||
int higher_lev_ctrl_mode = higherLevelProdControlMode(sched, sumState, group, simStep);
|
||||
const int higher_lev_ctrl = higherLevelProdControlGroupSeqIndex(sched, sumState, group, simStep);
|
||||
const int higher_lev_ctrl_mode = higherLevelProdControlMode(sched, sumState, group, simStep);
|
||||
// Start branching for determining iGrp[nwgmax + 5]
|
||||
// use default value if group is not available for group control
|
||||
if (groupProductionControllable(sched, sumState, group, simStep)) {
|
||||
|
||||
@@ -58,6 +58,44 @@ Group::Group(const std::string& name, std::size_t insert_index_arg, std::size_t
|
||||
Group::Group(const RestartIO::RstGroup& rst_group, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system_arg) :
|
||||
Group(rst_group.name, insert_index_arg, init_step_arg, udq_undefined_arg, unit_system_arg)
|
||||
{
|
||||
if (rst_group.prod_active_cmode != 0) {
|
||||
Group::GroupProductionProperties production(unit_system_arg, this->m_name);
|
||||
production.oil_target.update(rst_group.oil_rate_limit);
|
||||
production.gas_target.update(rst_group.gas_rate_limit);
|
||||
production.water_target.update(rst_group.water_rate_limit);
|
||||
production.liquid_target.update(rst_group.liquid_rate_limit);
|
||||
production.active_cmode = Group::ProductionCModeFromInt(rst_group.prod_active_cmode);
|
||||
production.gconprod_cmode = Group::ProductionCModeFromInt(rst_group.gconprod_cmode);
|
||||
production.guide_rate_def = Group::GuideRateTargetFromInt(rst_group.guide_rate_def);
|
||||
if ((production.active_cmode == Group::ProductionCMode::ORAT) ||
|
||||
(production.active_cmode == Group::ProductionCMode::WRAT) ||
|
||||
(production.active_cmode == Group::ProductionCMode::GRAT) ||
|
||||
(production.active_cmode == Group::ProductionCMode::LRAT))
|
||||
production.exceed_action = Group::ExceedAction::RATE;
|
||||
this->updateProduction(production);
|
||||
}
|
||||
|
||||
if (rst_group.winj_cmode != 0) {
|
||||
Group::GroupInjectionProperties injection;
|
||||
injection.surface_max_rate.update(rst_group.water_surface_limit);
|
||||
injection.resv_max_rate.update(rst_group.water_reservoir_limit);
|
||||
injection.target_reinj_fraction.update(rst_group.water_reinject_limit);
|
||||
injection.target_void_fraction.update(rst_group.water_voidage_limit);
|
||||
injection.phase = Phase::WATER;
|
||||
injection.cmode = Group::InjectionCModeFromInt(rst_group.winj_cmode);
|
||||
this->updateInjection(injection);
|
||||
}
|
||||
|
||||
if (rst_group.ginj_cmode != 0) {
|
||||
Group::GroupInjectionProperties injection;
|
||||
injection.surface_max_rate.update(rst_group.gas_surface_limit);
|
||||
injection.resv_max_rate.update(rst_group.gas_reservoir_limit);
|
||||
injection.target_reinj_fraction.update(rst_group.gas_reinject_limit);
|
||||
injection.target_void_fraction.update(rst_group.gas_voidage_limit);
|
||||
injection.phase = Phase::GAS;
|
||||
injection.cmode = Group::InjectionCModeFromInt(rst_group.ginj_cmode);
|
||||
this->updateInjection(injection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -747,6 +785,31 @@ Group::GuideRateTarget Group::GuideRateTargetFromString( const std::string& stri
|
||||
return GuideRateTarget::NO_GUIDE_RATE;
|
||||
}
|
||||
|
||||
|
||||
// Integer values defined vectoritems/group.hpp
|
||||
Group::GuideRateTarget Group::GuideRateTargetFromInt(int ecl_id) {
|
||||
switch(ecl_id) {
|
||||
case 0:
|
||||
return GuideRateTarget::NO_GUIDE_RATE;
|
||||
case 1:
|
||||
return GuideRateTarget::OIL;
|
||||
case 2:
|
||||
return GuideRateTarget::WAT;
|
||||
case 3:
|
||||
return GuideRateTarget::GAS;
|
||||
case 4:
|
||||
return GuideRateTarget::LIQ;
|
||||
case 7:
|
||||
return GuideRateTarget::POTN;
|
||||
case 8:
|
||||
return GuideRateTarget::FORM;
|
||||
case 9:
|
||||
return GuideRateTarget::COMB;
|
||||
default:
|
||||
throw std::logic_error(fmt::format("Integer GuideRateTarget: {} not recognized", ecl_id));
|
||||
}
|
||||
}
|
||||
|
||||
bool Group::operator==(const Group& data) const
|
||||
{
|
||||
return this->name() == data.name() &&
|
||||
|
||||
@@ -421,7 +421,7 @@ private:
|
||||
restart_skip = false;
|
||||
currentStep = time_map.restart_offset();
|
||||
logger.restart();
|
||||
logger(fmt::format("Found restart date {}", Schedule::formatDate(deck_time)));
|
||||
logger(fmt::format("Found restart date: {} report: {}", Schedule::formatDate(deck_time), time_map.restart_offset()));
|
||||
} else
|
||||
logger(fmt::format("Skipping DATES keyword {}", Schedule::formatDate(deck_time)));
|
||||
} else {
|
||||
@@ -1684,9 +1684,9 @@ namespace {
|
||||
this->addWell(well, report_step);
|
||||
this->addWellToGroup(well.groupName(), well.name(), report_step);
|
||||
}
|
||||
m_tuning.update(report_step + 1, rst_state.tuning);
|
||||
m_events.addEvent( ScheduleEvents::TUNING_CHANGE , report_step + 1);
|
||||
|
||||
m_tuning.update(report_step, rst_state.tuning);
|
||||
m_events.addEvent( ScheduleEvents::TUNING_CHANGE , report_step);
|
||||
|
||||
{
|
||||
const auto& header = rst_state.header;
|
||||
|
||||
@@ -100,7 +100,7 @@ int main(int argc, char ** argv) {
|
||||
const auto& sched = load_schedule(python, argv[1]);
|
||||
const auto& rst_sched = load_schedule(python, argv[2], report_step);
|
||||
|
||||
if (Opm::Schedule::cmp(sched, rst_sched, report_step) ) {
|
||||
if (Opm::Schedule::cmp(sched, rst_sched, static_cast<std::size_t>(report_step)) ) {
|
||||
std::cout << "Schedule objects were equal!" << std::endl;
|
||||
std::exit( EXIT_SUCCESS );
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user