From 522625aca88cfe4b130251b8407dd520ce33d0af Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 19 Feb 2024 12:26:10 +0100 Subject: [PATCH] WellGroupHelpers: change from namespace to class with static members this to simplify adding support for float Scalars --- opm/simulators/wells/WellGroupHelpers.cpp | 409 ++++++++++--------- opm/simulators/wells/WellGroupHelpers.hpp | 454 +++++++++++----------- 2 files changed, 440 insertions(+), 423 deletions(-) diff --git a/opm/simulators/wells/WellGroupHelpers.cpp b/opm/simulators/wells/WellGroupHelpers.cpp index e531bb967..85e4e972c 100644 --- a/opm/simulators/wells/WellGroupHelpers.cpp +++ b/opm/simulators/wells/WellGroupHelpers.cpp @@ -124,13 +124,14 @@ namespace { } } // namespace Anonymous -namespace Opm::WellGroupHelpers { +namespace Opm { -void setCmodeGroup(const Group& group, - const Schedule& schedule, - const SummaryState& summaryState, - const int reportStepIdx, - GroupState& group_state) +void WellGroupHelpers:: +setCmodeGroup(const Group& group, + const Schedule& schedule, + const SummaryState& summaryState, + const int reportStepIdx, + GroupState& group_state) { for (const std::string& groupName : group.groups()) { @@ -184,10 +185,11 @@ void setCmodeGroup(const Group& group, } } -void accumulateGroupEfficiencyFactor(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - double& factor) +void WellGroupHelpers:: +accumulateGroupEfficiencyFactor(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + double& factor) { factor *= group.getGroupEfficiencyFactor(); if (group.parent() != "FIELD" && !group.parent().empty()) @@ -195,32 +197,34 @@ void accumulateGroupEfficiencyFactor(const Group& group, schedule.getGroup(group.parent(), reportStepIdx), schedule, reportStepIdx, factor); } - -double sumWellSurfaceRates(const Group& group, - const Schedule& schedule, - const WellState& wellState, - const int reportStepIdx, - const int phasePos, - const bool injector) +double WellGroupHelpers:: +sumWellSurfaceRates(const Group& group, + const Schedule& schedule, + const WellState& wellState, + const int reportStepIdx, + const int phasePos, + const bool injector) { return sumWellPhaseRates(false, group, schedule, wellState, reportStepIdx, phasePos, injector); } -double sumWellResRates(const Group& group, - const Schedule& schedule, - const WellState& wellState, - const int reportStepIdx, - const int phasePos, - const bool injector) +double WellGroupHelpers:: +sumWellResRates(const Group& group, + const Schedule& schedule, + const WellState& wellState, + const int reportStepIdx, + const int phasePos, + const bool injector) { return sumWellPhaseRates(true, group, schedule, wellState, reportStepIdx, phasePos, injector); } -double sumSolventRates(const Group& group, - const Schedule& schedule, - const WellState& wellState, - const int reportStepIdx, - const bool injector) +double WellGroupHelpers:: +sumSolventRates(const Group& group, + const Schedule& schedule, + const WellState& wellState, + const int reportStepIdx, + const bool injector) { double rate = 0.0; @@ -258,15 +262,16 @@ double sumSolventRates(const Group& group, return rate; } -void updateGuideRatesForInjectionGroups(const Group& group, - const Schedule& schedule, - const SummaryState& summaryState, - const Opm::PhaseUsage& pu, - const int reportStepIdx, - const WellState& wellState, - const GroupState& group_state, - GuideRate* guideRate, - Opm::DeferredLogger& deferred_logger) +void WellGroupHelpers:: +updateGuideRatesForInjectionGroups(const Group& group, + const Schedule& schedule, + const SummaryState& summaryState, + const PhaseUsage& pu, + const int reportStepIdx, + const WellState& wellState, + const GroupState& group_state, + GuideRate* guideRate, + DeferredLogger& deferred_logger) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -318,15 +323,16 @@ void updateGuideRatesForInjectionGroups(const Group& group, } } -void updateGroupTargetReduction(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const bool isInjector, - const PhaseUsage& pu, - const GuideRate& guide_rate, - const WellState& wellState, - GroupState& group_state, - std::vector& groupTargetReduction) +void WellGroupHelpers:: +updateGroupTargetReduction(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const bool isInjector, + const PhaseUsage& pu, + const GuideRate& guide_rate, + const WellState& wellState, + GroupState& group_state, + std::vector& groupTargetReduction) { const int np = wellState.numPhases(); for (const std::string& subGroupName : group.groups()) { @@ -456,13 +462,15 @@ void updateGroupTargetReduction(const Group& group, group_state.update_production_reduction_rates(group.name(), groupTargetReduction); } -void updateWellRatesFromGroupTargetScale(const double scale, - const Group& group, - const Schedule& schedule, - const int reportStepIdx, - bool isInjector, - const GroupState& group_state, - WellState& wellState) { +void WellGroupHelpers:: +updateWellRatesFromGroupTargetScale(const double scale, + const Group& group, + const Schedule& schedule, + const int reportStepIdx, + bool isInjector, + const GroupState& group_state, + WellState& wellState) +{ for (const std::string& groupName : group.groups()) { bool individual_control = false; if (isInjector) { @@ -524,12 +532,12 @@ void updateWellRatesFromGroupTargetScale(const double scale, } - -void updateVREPForGroups(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellState, - GroupState& group_state) +void WellGroupHelpers:: +updateVREPForGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -549,11 +557,12 @@ void updateVREPForGroups(const Group& group, group_state.update_injection_vrep_rate(group.name(), resv); } -void updateReservoirRatesInjectionGroups(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellState, - GroupState& group_state) +void WellGroupHelpers:: +updateReservoirRatesInjectionGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -573,11 +582,12 @@ void updateReservoirRatesInjectionGroups(const Group& group, group_state.update_injection_reservoir_rates(group.name(), resv); } -void updateSurfaceRatesInjectionGroups(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellState, - GroupState& group_state) +void WellGroupHelpers:: +updateSurfaceRatesInjectionGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -597,11 +607,12 @@ void updateSurfaceRatesInjectionGroups(const Group& group, group_state.update_injection_surface_rates(group.name(), rates); } -void updateWellRates(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellStateNupcol, - WellState& wellState) +void WellGroupHelpers:: +updateWellRates(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellStateNupcol, + WellState& wellState) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -627,11 +638,12 @@ void updateWellRates(const Group& group, } } -void updateGroupProductionRates(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellState, - GroupState& group_state) +void WellGroupHelpers:: +updateGroupProductionRates(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -645,15 +657,15 @@ void updateGroupProductionRates(const Group& group, group_state.update_production_rates(group.name(), rates); } - -void updateREINForGroups(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const PhaseUsage& pu, - const SummaryState& st, - const WellState& wellState, - GroupState& group_state, - bool sum_rank) +void WellGroupHelpers:: +updateREINForGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const PhaseUsage& pu, + const SummaryState& st, + const WellState& wellState, + GroupState& group_state, + bool sum_rank) { const int np = wellState.numPhases(); for (const std::string& groupName : group.groups()) { @@ -682,13 +694,14 @@ void updateREINForGroups(const Group& group, template -void updateGpMaintTargetForGroups(const Group& group, - const Schedule& schedule, - const RegionalValues& regional_values, - const int reportStepIdx, - const double dt, - const WellState& well_state, - GroupState& group_state) +void WellGroupHelpers:: +updateGpMaintTargetForGroups(const Group& group, + const Schedule& schedule, + const RegionalValues& regional_values, + const int reportStepIdx, + const double dt, + const WellState& well_state, + GroupState& group_state) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -772,6 +785,7 @@ void updateGpMaintTargetForGroups(const Group& group, std::map +WellGroupHelpers:: computeNetworkPressures(const Opm::Network::ExtNetwork& network, const WellState& well_state, const GroupState& group_state, @@ -911,6 +925,7 @@ computeNetworkPressures(const Opm::Network::ExtNetwork& network, GuideRate::RateVector +WellGroupHelpers:: getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name) @@ -919,6 +934,7 @@ getWellRateVector(const WellState& well_state, } GuideRate::RateVector +WellGroupHelpers:: getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name) @@ -926,14 +942,15 @@ getProductionGroupRateVector(const GroupState& group_state, return getGuideRateVector(group_state.production_rates(group_name), pu); } -double getGuideRate(const std::string& name, - const Schedule& schedule, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const GuideRateModel::Target target, - const PhaseUsage& pu) +double WellGroupHelpers:: +getGuideRate(const std::string& name, + const Schedule& schedule, + const WellState& wellState, + const GroupState& group_state, + const int reportStepIdx, + const GuideRate* guideRate, + const GuideRateModel::Target target, + const PhaseUsage& pu) { if (schedule.hasWell(name, reportStepIdx)) { if (guideRate->has(name) || guideRate->hasPotentials(name)) { @@ -979,16 +996,16 @@ double getGuideRate(const std::string& name, return totalGuideRate; } - -double getGuideRateInj(const std::string& name, - const Schedule& schedule, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const GuideRateModel::Target target, - const Phase& injectionPhase, - const PhaseUsage& pu) +double WellGroupHelpers:: +getGuideRateInj(const std::string& name, + const Schedule& schedule, + const WellState& wellState, + const GroupState& group_state, + const int reportStepIdx, + const GuideRate* guideRate, + const GuideRateModel::Target target, + const Phase& injectionPhase, + const PhaseUsage& pu) { if (schedule.hasWell(name, reportStepIdx)) { return getGuideRate(name, schedule, wellState, group_state, @@ -1030,16 +1047,15 @@ double getGuideRateInj(const std::string& name, return totalGuideRate; } - - -int groupControlledWells(const Schedule& schedule, - const WellState& well_state, - const GroupState& group_state, - const int report_step, - const std::string& group_name, - const std::string& always_included_child, - const bool is_production_group, - const Phase injection_phase) +int WellGroupHelpers:: +groupControlledWells(const Schedule& schedule, + const WellState& well_state, + const GroupState& group_state, + const int report_step, + const std::string& group_name, + const std::string& always_included_child, + const bool is_production_group, + const Phase injection_phase) { const Group& group = schedule.getGroup(group_name, report_step); int num_wells = 0; @@ -1074,7 +1090,11 @@ int groupControlledWells(const Schedule& schedule, } std::vector -groupChainTopBot(const std::string& bottom, const std::string& top, const Schedule& schedule, const int report_step) +WellGroupHelpers:: +groupChainTopBot(const std::string& bottom, + const std::string& top, + const Schedule& schedule, + const int report_step) { // Get initial parent, 'bottom' can be a well or a group. std::string parent; @@ -1099,23 +1119,22 @@ groupChainTopBot(const std::string& bottom, const std::string& top, const Schedu return chain; } - - - -std::pair checkGroupConstraintsProd(const std::string& name, - const std::string& parent, - const Group& group, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const double* rates, - const PhaseUsage& pu, - const double efficiencyFactor, - const Schedule& schedule, - const SummaryState& summaryState, - const std::vector& resv_coeff, - DeferredLogger& deferred_logger) +std::pair +WellGroupHelpers:: +checkGroupConstraintsProd(const std::string& name, + const std::string& parent, + const Group& group, + const WellState& wellState, + const GroupState& group_state, + const int reportStepIdx, + const GuideRate* guideRate, + const double* rates, + const PhaseUsage& pu, + const double efficiencyFactor, + const Schedule& schedule, + const SummaryState& summaryState, + const std::vector& resv_coeff, + DeferredLogger& deferred_logger) { // When called for a well ('name' is a well name), 'parent' // will be the name of 'group'. But if we recurse, 'name' and @@ -1263,21 +1282,23 @@ std::pair checkGroupConstraintsProd(const std::string& name, return std::make_pair(current_rate > target_rate, scale); } -std::pair checkGroupConstraintsInj(const std::string& name, - const std::string& parent, - const Group& group, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const double* rates, - Phase injectionPhase, - const PhaseUsage& pu, - const double efficiencyFactor, - const Schedule& schedule, - const SummaryState& summaryState, - const std::vector& resv_coeff, - DeferredLogger& deferred_logger) +std::pair +WellGroupHelpers:: +checkGroupConstraintsInj(const std::string& name, + const std::string& parent, + const Group& group, + const WellState& wellState, + const GroupState& group_state, + const int reportStepIdx, + const GuideRate* guideRate, + const double* rates, + Phase injectionPhase, + const PhaseUsage& pu, + const double efficiencyFactor, + const Schedule& schedule, + const SummaryState& summaryState, + const std::vector& resv_coeff, + DeferredLogger& deferred_logger) { // When called for a well ('name' is a well name), 'parent' // will be the name of 'group'. But if we recurse, 'name' and @@ -1432,6 +1453,7 @@ std::pair checkGroupConstraintsInj(const std::string& name, } std::pair, double> +WellGroupHelpers:: worstOffendingWell(const Group& group, const Schedule& schedule, const int reportStepIdx, @@ -1530,12 +1552,13 @@ worstOffendingWell(const Group& group, } template -void setRegionAveragePressureCalculator(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const FieldPropsManager& fp, - const PhaseUsage& pu, - std::map>& regionalAveragePressureCalculator) +void WellGroupHelpers:: +setRegionAveragePressureCalculator(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const FieldPropsManager& fp, + const PhaseUsage& pu, + std::map>& regionalAveragePressureCalculator) { for (const std::string& groupName : group.groups()) { setRegionAveragePressureCalculator( schedule.getGroup(groupName, reportStepIdx), schedule, @@ -1556,18 +1579,19 @@ void setRegionAveragePressureCalculator(const Group& group, } } -void updateGuideRates(const Group& group, - const Schedule& schedule, - const SummaryState& summary_state, - const PhaseUsage& pu, - const int report_step, - const double sim_time, - WellState& well_state, - const GroupState& group_state, - const Parallel::Communication& comm, - GuideRate* guide_rate, - std::vector& pot, - Opm::DeferredLogger& deferred_logger) +void WellGroupHelpers:: +updateGuideRates(const Group& group, + const Schedule& schedule, + const SummaryState& summary_state, + const PhaseUsage& pu, + const int report_step, + const double sim_time, + WellState& well_state, + const GroupState& group_state, + const Parallel::Communication& comm, + GuideRate* guide_rate, + std::vector& pot, + DeferredLogger& deferred_logger) { guide_rate->updateGuideRateExpiration(sim_time, report_step); updateGuideRateForProductionGroups(group, schedule, pu, report_step, sim_time, well_state, group_state, comm, guide_rate, pot); @@ -1575,16 +1599,17 @@ void updateGuideRates(const Group& group, updateGuideRatesForWells(schedule, pu, report_step, sim_time, well_state, comm, guide_rate); } -void updateGuideRateForProductionGroups(const Group& group, - const Schedule& schedule, - const PhaseUsage& pu, - const int reportStepIdx, - const double& simTime, - WellState& wellState, - const GroupState& group_state, - const Parallel::Communication& comm, - GuideRate* guideRate, - std::vector& pot) +void WellGroupHelpers:: +updateGuideRateForProductionGroups(const Group& group, + const Schedule& schedule, + const PhaseUsage& pu, + const int reportStepIdx, + const double& simTime, + WellState& wellState, + const GroupState& group_state, + const Parallel::Communication& comm, + GuideRate* guideRate, + std::vector& pot) { const int np = pu.num_phases; for (const std::string& groupName : group.groups()) { @@ -1653,13 +1678,14 @@ void updateGuideRateForProductionGroups(const Group& group, guideRate->compute(group.name(), reportStepIdx, simTime, oilPot, gasPot, waterPot); } -void updateGuideRatesForWells(const Schedule& schedule, - const PhaseUsage& pu, - const int reportStepIdx, - const double& simTime, - const WellState& wellState, - const Parallel::Communication& comm, - GuideRate* guideRate) +void WellGroupHelpers:: +updateGuideRatesForWells(const Schedule& schedule, + const PhaseUsage& pu, + const int reportStepIdx, + const double& simTime, + const WellState& wellState, + const Parallel::Communication& comm, + GuideRate* guideRate) { for (const auto& well : schedule.getWells(reportStepIdx)) { std::array potentials{}; @@ -1706,4 +1732,5 @@ template void WellGroupHelpers:: const FieldPropsManager&, const PhaseUsage&, AvgPMap&); + } // namespace Opm::WellGroupHelpers diff --git a/opm/simulators/wells/WellGroupHelpers.hpp b/opm/simulators/wells/WellGroupHelpers.hpp index d87906af5..3c907629d 100644 --- a/opm/simulators/wells/WellGroupHelpers.hpp +++ b/opm/simulators/wells/WellGroupHelpers.hpp @@ -43,262 +43,252 @@ class FieldPropsManager; namespace Network { class ExtNetwork; } -namespace WellGroupHelpers { - -void setCmodeGroup(const Group& group, - const Schedule& schedule, - const SummaryState& summaryState, - const int reportStepIdx, - GroupState& group_state); - -void accumulateGroupEfficiencyFactor(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - double& factor); - -double sumWellSurfaceRates(const Group& group, - const Schedule& schedule, - const WellState& wellState, - const int reportStepIdx, - const int phasePos, - const bool injector); - -double sumWellResRates(const Group& group, - const Schedule& schedule, - const WellState& wellState, - const int reportStepIdx, - const int phasePos, - const bool injector); - -double sumSolventRates(const Group& group, - const Schedule& schedule, - const WellState& wellState, - const int reportStepIdx, - const bool injector); - -void updateGroupTargetReduction(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const bool isInjector, - const PhaseUsage& pu, - const GuideRate& guide_rate, - const WellState& wellState, - GroupState& group_state, - std::vector& groupTargetReduction); - -void updateGuideRates(const Group& group, - const Schedule& schedule, - const SummaryState& summary_state, - const PhaseUsage& pu, - int report_step, - double sim_time, - WellState& well_state, - const GroupState& group_state, - const Parallel::Communication& comm, - GuideRate* guide_rate, - std::vector& pot, - Opm::DeferredLogger& deferred_logge); - -void updateGuideRateForProductionGroups(const Group& group, - const Schedule& schedule, - const PhaseUsage& pu, - const int reportStepIdx, - const double& simTime, - WellState& wellState, - const GroupState& group_state, - const Parallel::Communication& comm, - GuideRate* guideRate, - std::vector& pot); - -void updateGuideRatesForWells(const Schedule& schedule, - const PhaseUsage& pu, +class WellGroupHelpers +{ +public: + static void setCmodeGroup(const Group& group, + const Schedule& schedule, + const SummaryState& summaryState, const int reportStepIdx, - const double& simTime, - const WellState& wellState, - const Parallel::Communication& comm, - GuideRate* guideRate); + GroupState& group_state); -void updateGuideRatesForInjectionGroups(const Group& group, - const Schedule& schedule, - const SummaryState& summaryState, - const Opm::PhaseUsage& pu, - const int reportStepIdx, - const WellState& wellState, - const GroupState& group_state, - GuideRate* guideRate, - Opm::DeferredLogger& deferred_logger); + static void accumulateGroupEfficiencyFactor(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + double& factor); -void updateVREPForGroups(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellState, - GroupState& group_state); + static double sumWellSurfaceRates(const Group& group, + const Schedule& schedule, + const WellState& wellState, + const int reportStepIdx, + const int phasePos, + const bool injector); -void updateReservoirRatesInjectionGroups(const Group& group, - const Schedule& schedule, + /// Returns the name of the worst offending well and its fraction (i.e. violated_phase / preferred_phase) + static std::pair, double> + worstOffendingWell(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const Group::ProductionCMode& offendedControl, + const PhaseUsage& pu, + const Parallel::Communication& comm, + const WellState& wellState, + DeferredLogger& deferred_logger); + + static double sumWellResRates(const Group& group, + const Schedule& schedule, + const WellState& wellState, + const int reportStepIdx, + const int phasePos, + const bool injector); + + static double sumSolventRates(const Group& group, + const Schedule& schedule, + const WellState& wellState, + const int reportStepIdx, + const bool injector); + + static void updateGroupTargetReduction(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const bool isInjector, + const PhaseUsage& pu, + const GuideRate& guide_rate, + const WellState& wellState, + GroupState& group_state, + std::vector& groupTargetReduction); + + static void updateGuideRates(const Group& group, + const Schedule& schedule, + const SummaryState& summary_state, + const PhaseUsage& pu, + int report_step, + double sim_time, + WellState& well_state, + const GroupState& group_state, + const Parallel::Communication& comm, + GuideRate* guide_rate, + std::vector& pot, + DeferredLogger& deferred_logge); + + static void updateGuideRateForProductionGroups(const Group& group, + const Schedule& schedule, + const PhaseUsage& pu, + const int reportStepIdx, + const double& simTime, + WellState& wellState, + const GroupState& group_state, + const Parallel::Communication& comm, + GuideRate* guideRate, + std::vector& pot); + + static void updateGuideRatesForWells(const Schedule& schedule, + const PhaseUsage& pu, const int reportStepIdx, + const double& simTime, const WellState& wellState, - GroupState& group_state); + const Parallel::Communication& comm, + GuideRate* guideRate); -void updateSurfaceRatesInjectionGroups(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellState, - GroupState& group_state); + static void updateGuideRatesForInjectionGroups(const Group& group, + const Schedule& schedule, + const SummaryState& summaryState, + const PhaseUsage& pu, + const int reportStepIdx, + const WellState& wellState, + const GroupState& group_state, + GuideRate* guideRate, + DeferredLogger& deferred_logger); -void updateWellRates(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const WellState& wellStateNupcol, - WellState& wellState); + static void updateVREPForGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state); -void updateGroupProductionRates(const Group& group, + template + static void updateGpMaintTargetForGroups(const Group& group, + const Schedule& schedule, + const RegionalValues& regional_values, + const int reportStepIdx, + const double dt, + const WellState& well_state, + GroupState& group_state); + + static void updateReservoirRatesInjectionGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state); + + static void updateSurfaceRatesInjectionGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state); + + static void updateWellRates(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellState& wellState, - GroupState& group_state); + const WellState& wellStateNupcol, + WellState& wellState); -void updateWellRatesFromGroupTargetScale(const double scale, - const Group& group, - const Schedule& schedule, - const int reportStepIdx, - bool isInjector, - const GroupState& group_state, - WellState& wellState); + static void updateGroupProductionRates(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const WellState& wellState, + GroupState& group_state); -void updateREINForGroups(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const PhaseUsage& pu, - const SummaryState& st, - const WellState& wellState, - GroupState& group_state, - bool sum_rank); + static void updateWellRatesFromGroupTargetScale(const double scale, + const Group& group, + const Schedule& schedule, + const int reportStepIdx, + bool isInjector, + const GroupState& group_state, + WellState& wellState); + static void updateREINForGroups(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const PhaseUsage& pu, + const SummaryState& st, + const WellState& wellState, + GroupState& group_state, + bool sum_rank); -/// Returns the name of the worst offending well and its fraction -/// (i.e. violated_phase / preferred_phase) -std::pair, double> -worstOffendingWell(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const Group::ProductionCMode& offendedControl, - const PhaseUsage& pu, - const Parallel::Communication& comm, - const WellState& wellState, - DeferredLogger& deferred_logger); + static std::map + computeNetworkPressures(const Network::ExtNetwork& network, + const WellState& well_state, + const GroupState& group_state, + const VFPProdProperties& vfp_prod_props, + const Schedule& schedule, + const int report_time_step); -template -void updateGpMaintTargetForGroups(const Group& group, + static GuideRate::RateVector + getWellRateVector(const WellState& well_state, + const PhaseUsage& pu, + const std::string& name); + + static GuideRate::RateVector + getProductionGroupRateVector(const GroupState& group_state, + const PhaseUsage& pu, + const std::string& group_name); + + static double getGuideRate(const std::string& name, + const Schedule& schedule, + const WellState& wellState, + const GroupState& group_state, + const int reportStepIdx, + const GuideRate* guideRate, + const GuideRateModel::Target target, + const PhaseUsage& pu); + + static double getGuideRateInj(const std::string& name, const Schedule& schedule, - const RegionalValues& regional_values, + const WellState& wellState, + const GroupState& group_state, const int reportStepIdx, - const double dt, - const WellState& well_state, - GroupState& group_state); + const GuideRate* guideRate, + const GuideRateModel::Target target, + const Phase& injectionPhase, + const PhaseUsage& pu); -std::map -computeNetworkPressures(const Opm::Network::ExtNetwork& network, - const WellState& well_state, - const GroupState& group_state, - const VFPProdProperties& vfp_prod_props, - const Schedule& schedule, - const int report_time_step); + static int groupControlledWells(const Schedule& schedule, + const WellState& well_state, + const GroupState& group_state, + const int report_step, + const std::string& group_name, + const std::string& always_included_child, + const bool is_production_group, + const Phase injection_phase); -GuideRate::RateVector -getWellRateVector(const WellState& well_state, - const PhaseUsage& pu, - const std::string& name); - -GuideRate::RateVector -getProductionGroupRateVector(const GroupState& group_state, + static std::pair + checkGroupConstraintsInj(const std::string& name, + const std::string& parent, + const Group& group, + const WellState& wellState, + const GroupState& group_state, + const int reportStepIdx, + const GuideRate* guideRate, + const double* rates, + Phase injectionPhase, const PhaseUsage& pu, - const std::string& group_name); + const double efficiencyFactor, + const Schedule& schedule, + const SummaryState& summaryState, + const std::vector& resv_coeff, + DeferredLogger& deferred_logger); -double getGuideRate(const std::string& name, - const Schedule& schedule, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const GuideRateModel::Target target, - const PhaseUsage& pu); + static std::vector + groupChainTopBot(const std::string& bottom, + const std::string& top, + const Schedule& schedule, + const int report_step); + static std::pair + checkGroupConstraintsProd(const std::string& name, + const std::string& parent, + const Group& group, + const WellState& wellState, + const GroupState& group_state, + const int reportStepIdx, + const GuideRate* guideRate, + const double* rates, + const PhaseUsage& pu, + const double efficiencyFactor, + const Schedule& schedule, + const SummaryState& summaryState, + const std::vector& resv_coeff, + DeferredLogger& deferred_logger); -double getGuideRateInj(const std::string& name, - const Schedule& schedule, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const GuideRateModel::Target target, - const Phase& injectionPhase, - const PhaseUsage& pu); - -int groupControlledWells(const Schedule& schedule, - const WellState& well_state, - const GroupState& group_state, - const int report_step, - const std::string& group_name, - const std::string& always_included_child, - const bool is_production_group, - const Phase injection_phase); - - -std::pair checkGroupConstraintsInj(const std::string& name, - const std::string& parent, - const Group& group, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const double* rates, - Phase injectionPhase, - const PhaseUsage& pu, - const double efficiencyFactor, - const Schedule& schedule, - const SummaryState& summaryState, - const std::vector& resv_coeff, - DeferredLogger& deferred_logger); - - - - - - -std::vector groupChainTopBot(const std::string& bottom, - const std::string& top, - const Schedule& schedule, - const int report_step); - - - - -std::pair checkGroupConstraintsProd(const std::string& name, - const std::string& parent, - const Group& group, - const WellState& wellState, - const GroupState& group_state, - const int reportStepIdx, - const GuideRate* guideRate, - const double* rates, - const PhaseUsage& pu, - const double efficiencyFactor, - const Schedule& schedule, - const SummaryState& summaryState, - const std::vector& resv_coeff, - DeferredLogger& deferred_logger); - -template -void setRegionAveragePressureCalculator(const Group& group, - const Schedule& schedule, - const int reportStepIdx, - const FieldPropsManager& fp, - const PhaseUsage& pu, - std::map>& regionalAveragePressureCalculator); - - -} // namespace WellGroupHelpers + template + static void setRegionAveragePressureCalculator(const Group& group, + const Schedule& schedule, + const int reportStepIdx, + const FieldPropsManager& fp, + const PhaseUsage& pu, + std::map>& regionalAveragePressureCalculator); +}; } // namespace Opm