Extract group state and create WGState to manage well & group state

This commit is contained in:
Joakim Hove
2021-04-22 17:31:21 +02:00
parent 42a6505cf1
commit e1d117c59f
19 changed files with 406 additions and 337 deletions

View File

@@ -175,6 +175,7 @@ namespace WellGroupHelpers
const std::string& group_name,
const double sales_target,
const WellStateFullyImplicitBlackoil& well_state,
const GroupState& group_state,
const Phase& injection_phase,
DeferredLogger& deferred_logger)
: cmode_(cmode)
@@ -183,6 +184,7 @@ namespace WellGroupHelpers
, group_name_(group_name)
, sales_target_(sales_target)
, well_state_(well_state)
, group_state_(group_state)
{
// initialize to avoid warning
pos_ = pu.phase_pos[BlackoilPhases::Aqua];
@@ -226,14 +228,12 @@ namespace WellGroupHelpers
case Group::InjectionCMode::RESV:
return ctrl.resv_max_rate;
case Group::InjectionCMode::REIN: {
double production_rate = well_state_.currentInjectionREINRates(ctrl.reinj_group)[pos_];
double production_rate = this->group_state_.injection_rein_rates(ctrl.reinj_group)[pos_];
return ctrl.target_reinj_fraction * production_rate;
}
case Group::InjectionCMode::VREP: {
const std::vector<double>& group_injection_reductions
= well_state_.currentInjectionGroupReductionRates(group_name_);
double voidage_rate
= well_state_.currentInjectionVREPRates(ctrl.voidage_group) * ctrl.target_void_fraction;
const std::vector<double>& group_injection_reductions = this->group_state_.injection_reduction_rates(this->group_name_);
double voidage_rate = group_state_.injection_vrep_rate(ctrl.voidage_group) * ctrl.target_void_fraction;
double inj_reduction = 0.0;
if (ctrl.phase != Phase::WATER)
inj_reduction += group_injection_reductions[pu_.phase_pos[BlackoilPhases::Aqua]]
@@ -251,7 +251,7 @@ namespace WellGroupHelpers
assert(pos_ == pu_.phase_pos[BlackoilPhases::Vapour]);
// Gas injection rate = Total gas production rate + gas import rate - gas consumption rate - sales rate;
// Gas import and consumption is already included in the REIN rates
double inj_rate = well_state_.currentInjectionREINRates(group_name_)[pos_];
double inj_rate = group_state_.injection_rein_rates(this->group_name_)[pos_];
inj_rate -= sales_target_;
return inj_rate;
}
@@ -283,6 +283,7 @@ namespace WellGroupHelpers
const std::string& group_name_;
double sales_target_;
const WellStateFullyImplicitBlackoil& well_state_;
const GroupState& group_state_;
int pos_;
GuideRateModel::Target target_;