Internalize guide rate when loading GCONINJE keyword
This commit is contained in:
@@ -115,6 +115,18 @@ static GuideRateProdTarget GuideRateProdTargetFromString( const std::string& str
|
||||
static GuideRateProdTarget GuideRateProdTargetFromInt(int ecl_id);
|
||||
|
||||
|
||||
enum class GuideRateInjTarget {
|
||||
RATE = 1,
|
||||
VOID = 2,
|
||||
NETV = 3,
|
||||
RESV = 4,
|
||||
POTN = 5,
|
||||
NO_GUIDE_RATE = 6
|
||||
};
|
||||
static GuideRateInjTarget GuideRateInjTargetFromString( const std::string& stringValue );
|
||||
static GuideRateInjTarget GuideRateInjTargetFromInt(int ecl_id);
|
||||
|
||||
|
||||
struct GroupInjectionProperties {
|
||||
GroupInjectionProperties();
|
||||
GroupInjectionProperties(Phase phase, const UnitSystem& unit_system);
|
||||
@@ -128,6 +140,8 @@ struct GroupInjectionProperties {
|
||||
std::optional<std::string> reinj_group;
|
||||
std::optional<std::string> voidage_group;
|
||||
bool available_group_control = true;
|
||||
double guide_rate = 0;
|
||||
GuideRateInjTarget guide_rate_def = GuideRateInjTarget::NO_GUIDE_RATE;
|
||||
|
||||
static GroupInjectionProperties serializeObject();
|
||||
|
||||
@@ -148,6 +162,8 @@ struct GroupInjectionProperties {
|
||||
serializer(voidage_group);
|
||||
serializer(injection_controls);
|
||||
serializer(available_group_control);
|
||||
serializer(guide_rate);
|
||||
serializer(guide_rate_def);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -161,6 +177,8 @@ struct InjectionControls {
|
||||
int injection_controls = 0;
|
||||
std::string reinj_group;
|
||||
std::string voidage_group;
|
||||
double guide_rate;
|
||||
GuideRateInjTarget guide_rate_def = GuideRateInjTarget::NO_GUIDE_RATE;
|
||||
bool has_control(InjectionCMode control) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -246,6 +246,8 @@ Group::GroupInjectionProperties Group::GroupInjectionProperties::serializeObject
|
||||
result.reinj_group = "test1";
|
||||
result.voidage_group = "test2";
|
||||
result.injection_controls = 5;
|
||||
result.guide_rate = 12345;
|
||||
result.guide_rate_def = Group::GuideRateInjTarget::NETV;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -261,6 +263,8 @@ bool Group::GroupInjectionProperties::operator==(const GroupInjectionProperties&
|
||||
this->injection_controls == other.injection_controls &&
|
||||
this->target_void_fraction == other.target_void_fraction &&
|
||||
this->reinj_group == other.reinj_group &&
|
||||
this->guide_rate == other.guide_rate &&
|
||||
this->guide_rate_def == other.guide_rate_def &&
|
||||
this->available_group_control == other.available_group_control &&
|
||||
this->voidage_group == other.voidage_group;
|
||||
}
|
||||
@@ -539,6 +543,8 @@ Group::InjectionControls Group::injectionControls(Phase phase, const SummaryStat
|
||||
ic.target_void_fraction = UDA::eval_group_uda(inj.target_void_fraction, this->m_name, st, this->udq_undefined);
|
||||
ic.reinj_group = inj.reinj_group.value_or(this->m_name);
|
||||
ic.voidage_group = inj.voidage_group.value_or(this->m_name);
|
||||
ic.guide_rate = inj.guide_rate;
|
||||
ic.guide_rate_def = inj.guide_rate_def;
|
||||
|
||||
return ic;
|
||||
}
|
||||
@@ -756,6 +762,19 @@ Group::InjectionCMode Group::InjectionCModeFromInt(int ecl_int) {
|
||||
}
|
||||
}
|
||||
|
||||
Group::GuideRateInjTarget Group::GuideRateInjTargetFromString( const std::string& stringValue ) {
|
||||
if (stringValue == "RATE")
|
||||
return GuideRateInjTarget::RATE;
|
||||
else if (stringValue == "RESV")
|
||||
return GuideRateInjTarget::RESV;
|
||||
else if (stringValue == "VOID")
|
||||
return GuideRateInjTarget::VOID;
|
||||
else if (stringValue == "NETV")
|
||||
return GuideRateInjTarget::NETV;
|
||||
else
|
||||
return GuideRateInjTarget::NO_GUIDE_RATE;
|
||||
}
|
||||
|
||||
Group::GuideRateProdTarget Group::GuideRateProdTargetFromString( const std::string& stringValue ) {
|
||||
if (stringValue == "OIL")
|
||||
return GuideRateProdTarget::OIL;
|
||||
|
||||
@@ -330,41 +330,69 @@ namespace {
|
||||
const auto voidage_target = record.getItem("VOIDAGE_TARGET").get<UDAValue>(0);
|
||||
const bool is_free = DeckItem::to_bool(record.getItem("FREE").getTrimmedString(0));
|
||||
|
||||
std::optional<std::string> guide_rate_str;
|
||||
{
|
||||
const auto& item = record.getItem("GUIDE_RATE_DEF");
|
||||
if (item.hasValue(0)) {
|
||||
const auto& string_value = record.getItem("GUIDE_RATE_DEF").getTrimmedString(0);
|
||||
if (string_value.size() > 0)
|
||||
guide_rate_str = string_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (const auto& group_name : group_names) {
|
||||
const bool availableForGroupControl = is_free && (group_name != "FIELD");
|
||||
auto new_group = this->snapshots.back().groups.get(group_name);
|
||||
Group::GroupInjectionProperties injection;
|
||||
injection.phase = phase;
|
||||
injection.cmode = controlMode;
|
||||
injection.surface_max_rate = surfaceInjectionRate;
|
||||
injection.resv_max_rate = reservoirInjectionRate;
|
||||
injection.target_reinj_fraction = reinj_target;
|
||||
injection.target_void_fraction = voidage_target;
|
||||
injection.injection_controls = 0;
|
||||
injection.available_group_control = availableForGroupControl;
|
||||
const bool is_field { group_name == "FIELD" } ;
|
||||
|
||||
if (!record.getItem("SURFACE_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::RATE);
|
||||
auto guide_rate_def = Group::GuideRateInjTarget::NO_GUIDE_RATE;
|
||||
double guide_rate = 0;
|
||||
if (!is_field) {
|
||||
if (guide_rate_str) {
|
||||
guide_rate_def = Group::GuideRateInjTargetFromString(guide_rate_str.value());
|
||||
guide_rate = record.getItem("GUIDE_RATE").get<double>(0);
|
||||
if (guide_rate == 0)
|
||||
guide_rate_def = Group::GuideRateInjTarget::POTN;
|
||||
}
|
||||
}
|
||||
|
||||
if (!record.getItem("RESV_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::RESV);
|
||||
{
|
||||
const bool availableForGroupControl = is_free && !is_field;
|
||||
auto new_group = this->snapshots.back().groups.get(group_name);
|
||||
Group::GroupInjectionProperties injection;
|
||||
injection.phase = phase;
|
||||
injection.cmode = controlMode;
|
||||
injection.surface_max_rate = surfaceInjectionRate;
|
||||
injection.resv_max_rate = reservoirInjectionRate;
|
||||
injection.target_reinj_fraction = reinj_target;
|
||||
injection.target_void_fraction = voidage_target;
|
||||
injection.injection_controls = 0;
|
||||
injection.guide_rate = guide_rate;
|
||||
injection.guide_rate_def = guide_rate_def;
|
||||
injection.available_group_control = availableForGroupControl;
|
||||
|
||||
if (!record.getItem("REINJ_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::REIN);
|
||||
if (!record.getItem("SURFACE_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::RATE);
|
||||
|
||||
if (!record.getItem("VOIDAGE_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::VREP);
|
||||
if (!record.getItem("RESV_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::RESV);
|
||||
|
||||
if (record.getItem("REINJECT_GROUP").hasValue(0))
|
||||
injection.reinj_group = record.getItem("REINJECT_GROUP").getTrimmedString(0);
|
||||
if (!record.getItem("REINJ_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::REIN);
|
||||
|
||||
if (record.getItem("VOIDAGE_GROUP").hasValue(0))
|
||||
injection.voidage_group = record.getItem("VOIDAGE_GROUP").getTrimmedString(0);
|
||||
if (!record.getItem("VOIDAGE_TARGET").defaultApplied(0))
|
||||
injection.injection_controls += static_cast<int>(Group::InjectionCMode::VREP);
|
||||
|
||||
if (new_group.updateInjection(injection)) {
|
||||
this->snapshots.back().groups.update( std::move(new_group));
|
||||
this->snapshots.back().events().addEvent( ScheduleEvents::GROUP_INJECTION_UPDATE );
|
||||
this->snapshots.back().wellgroup_events().addEvent( group_name, ScheduleEvents::GROUP_INJECTION_UPDATE);
|
||||
if (record.getItem("REINJECT_GROUP").hasValue(0))
|
||||
injection.reinj_group = record.getItem("REINJECT_GROUP").getTrimmedString(0);
|
||||
|
||||
if (record.getItem("VOIDAGE_GROUP").hasValue(0))
|
||||
injection.voidage_group = record.getItem("VOIDAGE_GROUP").getTrimmedString(0);
|
||||
|
||||
if (new_group.updateInjection(injection)) {
|
||||
this->snapshots.back().groups.update( std::move(new_group));
|
||||
this->snapshots.back().events().addEvent( ScheduleEvents::GROUP_INJECTION_UPDATE );
|
||||
this->snapshots.back().wellgroup_events().addEvent( group_name, ScheduleEvents::GROUP_INJECTION_UPDATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -413,7 +441,6 @@ namespace {
|
||||
|
||||
for (const auto& group_name : group_names) {
|
||||
const bool is_field { group_name == "FIELD" } ;
|
||||
const bool availableForGroupControl { respond_to_parent && !is_field } ;
|
||||
|
||||
auto guide_rate_def = Group::GuideRateProdTarget::NO_GUIDE_RATE;
|
||||
double guide_rate = 0;
|
||||
@@ -437,6 +464,7 @@ namespace {
|
||||
}
|
||||
|
||||
{
|
||||
const bool availableForGroupControl { respond_to_parent && !is_field } ;
|
||||
auto new_group = this->snapshots.back().groups.get(group_name);
|
||||
Group::GroupProductionProperties production(this->m_static.m_unit_system, group_name);
|
||||
production.gconprod_cmode = controlMode;
|
||||
|
||||
Reference in New Issue
Block a user