Manage GConSale and GConSump with ScheduleState object

This commit is contained in:
Joakim Hove 2021-01-12 18:29:59 +01:00
parent 6ca2d2c9e6
commit b32f3f7546
3 changed files with 11 additions and 9 deletions

View File

@ -2291,7 +2291,7 @@ namespace Opm {
}
// check if gconsale is used for this group
if (!schedule().gConSale(reportStepIdx).has(group.name()))
if (!schedule()[reportStepIdx].gconsale().has(group.name()))
return;
std::ostringstream ss;
@ -2299,7 +2299,7 @@ namespace Opm {
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
const auto& comm = ebosSimulator_.vanguard().grid().comm();
const auto& gconsale = schedule().gConSale(reportStepIdx).get(group.name(), summaryState);
const auto& gconsale = schedule()[reportStepIdx].gconsale().get(group.name(), summaryState);
const Group::ProductionCMode& oldProductionControl = well_state.currentProductionGroupControl(group.name());
@ -2315,8 +2315,8 @@ namespace Opm {
double production_target = gconsale.sales_target + injection_rate;
// add import rate and substract consumption rate for group for gas
if (schedule().gConSump(reportStepIdx).has(group.name())) {
const auto& gconsump = schedule().gConSump(reportStepIdx).get(group.name(), summaryState);
if (schedule()[reportStepIdx].gconsump().has(group.name())) {
const auto& gconsump = schedule()[reportStepIdx].gconsump().get(group.name(), summaryState);
if (phase_usage_.phase_used[BlackoilPhases::Vapour]) {
sales_rate += gconsump.import_rate;
sales_rate -= gconsump.consumption_rate;

View File

@ -21,6 +21,8 @@
#include <config.h>
#include <opm/simulators/wells/WellGroupHelpers.hpp>
#include <opm/simulators/wells/TargetCalculator.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.hpp>
#include <algorithm>
#include <stack>
@ -98,7 +100,7 @@ namespace WellGroupHelpers
wellState.setCurrentProductionGroupControl(group.name(), controls.cmode);
}
if (schedule.gConSale(reportStepIdx).has(group.name())) {
if (schedule[reportStepIdx].gconsale().has(group.name())) {
wellState.setCurrentInjectionGroupControl(Phase::GAS, group.name(), Group::InjectionCMode::SALE);
}
}
@ -600,8 +602,8 @@ namespace WellGroupHelpers
}
// add import rate and substract consumption rate for group for gas
if (schedule.gConSump(reportStepIdx).has(group.name())) {
const auto& gconsump = schedule.gConSump(reportStepIdx).get(group.name(), st);
if (schedule[reportStepIdx].gconsump().has(group.name())) {
const auto& gconsump = schedule[reportStepIdx].gconsump().get(group.name(), st);
if (pu.phase_used[BlackoilPhases::Vapour]) {
rein[pu.phase_pos[BlackoilPhases::Vapour]] += gconsump.import_rate;
rein[pu.phase_pos[BlackoilPhases::Vapour]] -= gconsump.consumption_rate;
@ -1158,7 +1160,7 @@ namespace WellGroupHelpers
// 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 = wellState.currentInjectionREINRates(group.name())[phasePos];
const auto& gconsale = schedule.gConSale(reportStepIdx).get(group.name(), summaryState);
const auto& gconsale = schedule[reportStepIdx].gconsale().get(group.name(), summaryState);
inj_rate -= gconsale.sales_target;
const double current_rate = rates[phasePos];

View File

@ -2288,7 +2288,7 @@ namespace Opm
// Gas injection rate = Total gas production rate + gas import rate - gas consumption rate - sales rate;
// The import and consumption is already included in the REIN rates.
double inj_rate = well_state.currentInjectionREINRates(group.name())[phasePos];
const auto& gconsale = schedule.gConSale(current_step_).get(group.name(), summaryState);
const auto& gconsale = schedule[current_step_].gconsale().get(group.name(), summaryState);
inj_rate -= gconsale.sales_target;
double target = std::max(0.0, (inj_rate - groupTargetReduction)) / efficiencyFactor;