Opm::GroupStateHelper< Scalar, IndexTraits > Class Template Reference

#include <GroupStateHelper.hpp>

Inheritance diagram for Opm::GroupStateHelper< Scalar, IndexTraits >:
Inheritance graph

Classes

class  GroupStateGuard
 
class  ScopedLoggerGuard
 RAII guard that owns a DeferredLogger and auto-gathers on destruction. More...
 
class  WellStateGuard
 

Public Types

using GroupTarget = typename SingleWellState< Scalar, IndexTraits >::GroupTarget
 

Public Member Functions

 GroupStateHelper (WellState< Scalar, IndexTraits > &well_state, GroupState< Scalar > &group_state, const Schedule &schedule, const SummaryState &summary_state, const GuideRate &guide_rate, const PhaseUsageInfo< IndexTraits > &phase_usage_info, const Parallel::Communication &comm, bool terminal_output)
 
void accumulateGroupEfficiencyFactor (const Group &group, Scalar &factor) const
 
std::pair< bool, Scalar > checkGroupConstraintsInj (const std::string &name, const std::string &parent, const Group &group, const Scalar *rates, const Phase injection_phase, const Scalar efficiency_factor, const std::vector< Scalar > &resv_coeff, const bool check_guide_rate, const bool assume_fld_control=false) const
 Check whether a well or group violates an injection constraint of an ancestor group. More...
 
std::pair< bool, Scalar > checkGroupConstraintsProd (const std::string &name, const std::string &parent, const Group &group, const Scalar *rates, const Scalar efficiency_factor, const std::vector< Scalar > &resv_coeff, const bool check_guide_rate) const
 
std::pair< Group::ProductionCMode, Scalar > checkGroupProductionConstraints (const Group &group) const
 
const Parallel::Communication & comm () const
 
DeferredLogger & deferredLogger () const
 Get the deferred logger. More...
 
std::pair< std::optional< Scalar >, std::optional< Scalar > > getGasLiftGroupLimits (const Group &group) const
 Gas lift limits of a group: maximum lift gas and maximum total gas. More...
 
std::vector< Scalar > getGroupRatesAvailableForHigherLevelControl (const Group &group, const bool is_injector) const
 
Scalar getInjectionGroupTarget (const Group &group, const Phase &injection_phase, const std::vector< Scalar > &resv_coeff) const
 
GuideRateModel::Target getInjectionGuideTargetMode (Phase injection_phase) const
 Get the guide rate target mode for an injection phase. More...
 
Scalar getProductionGroupTarget (const Group &group) const
 
Scalar getProductionGroupTargetForMode (const Group &group, const Group::ProductionCMode cmode) const
 Get the production target for a specific control mode (not necessarily the active one). More...
 
std::optional< Scalar > getProductionGroupRateLimit (const Group &group, const Group::ProductionCMode rate_type) const
 Get the limit on one production rate type of a group, if any. More...
 
GuideRateModel::Target getProductionGuideTargetMode (const Group &group) const
 Get the guide rate target mode for a production group. More...
 
GuideRateModel::Target getProductionGuideTargetModeFromControlMode (const Group::ProductionCMode cmode) const
 
std::pair< Scalar, Group::ProductionCMode > getAutoChokeGroupProductionTargetRate (const Group &bottom_group, const Group &group, const std::vector< Scalar > &resv_coeff, Scalar efficiencyFactor) const
 
GuideRate::RateVector getProductionGroupRateVector (const std::string &group_name) const
 
std::optional< GroupTarget > getWellGroupTargetInjector (const std::string &name, const std::string &parent, const Group &group, const Scalar *rates, const Phase injection_phase, const Scalar efficiency_factor, const std::vector< Scalar > &resv_coeff) const
 
std::optional< GroupTarget > getWellGroupTargetProducer (const std::string &name, const std::string &parent, const Group &group, const Scalar *rates, const Scalar efficiency_factor, const std::vector< Scalar > &resv_coeff, std::optional< Group::ProductionCMode > target_cmode=std::nullopt) const
 
GuideRate::RateVector getWellRateVector (const std::string &name) const
 
std::vector< std::string > groupChainTopBot (const std::string &bottom, const std::string &top) const
 
int groupControlledWells (const std::string &group_name, const std::string &always_included_child, const bool is_production_group, const Phase injection_phase) const
 
GroupState< Scalar > & groupState () const
 
const GuideRate & guideRate () const
 
bool isMasterGroupEligibleForGuideRate (const std::string &group_name) const
 Whether a reservoir-coupling master group is eligible to participate in its parent's guide-rate distribution (GCONPROD item 8 RESPOND_TO_PARENT = YES). More...
 
bool isMasterGroupEligibleForInjectionGuideRate (const std::string &group_name, Phase injection_phase) const
 Whether a reservoir-coupling master group is eligible to participate in its parent's injection guide-rate distribution for one phase. More...
 
bool isRank0 () const
 
bool isReservoirCouplingMaster () const
 
bool isReservoirCouplingMasterGroup (const Group &group) const
 
bool isReservoirCouplingSlave () const
 
bool isReservoirCouplingSlaveGroup (const Group &group) const
 
constexpr int numPhases () const
 
int phaseToActivePhaseIdx (const Phase phase) const
 
Scalar reservoirCouplingMasterGroupGasLiftRate (const Group &group, const bool network) const
 Lift gas rate the slave reported for a reservoir coupling master group. More...
 
const PhaseUsageInfo< IndexTraits > & phaseUsage () const
 
GroupStateGuard pushGroupState (GroupState< Scalar > &group_state)
 
ScopedLoggerGuard pushLogger (bool do_mpi_gather=true) const
 Push a new logger onto the stack with auto-cleanup on destruction. More...
 
WellStateGuard pushWellState (WellState< Scalar, IndexTraits > &well_state)
 
int reportStepIdx () const
 
const Schedule & schedule () const
 
ReservoirCoupling::Proxy< Scalar > & rescoup ()
 
const ReservoirCoupling::Proxy< Scalar > & rescoup () const
 
ReservoirCouplingMaster< Scalar > & reservoirCouplingMaster ()
 
const ReservoirCouplingMaster< Scalar > & reservoirCouplingMaster () const
 
ReservoirCouplingSlave< Scalar > & reservoirCouplingSlave ()
 
const ReservoirCouplingSlave< Scalar > & reservoirCouplingSlave () const
 
void setCmodeGroup (const Group &group)
 
template<class AverageRegionalPressureType >
void setRegionAveragePressureCalculator (const Group &group, const FieldPropsManager &fp, std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > &regional_average_pressure_calculator) const
 
void setReportStep (int report_step)
 
const SummaryState & summaryState () const
 
Scalar sumSolventRates (const Group &group, const bool is_injector) const
 
Scalar sumWellResRates (const Group &group, const int phase_pos, const bool injector) const
 
Scalar sumWellSurfaceRates (const Group &group, const int phase_pos, const bool injector) const
 
Scalar sumWellGasLiftHeadroom (const Group &group) const
 Sum how much more lift gas the gas lift wells below a group can take. More...
 
Scalar sumWellPhaseRates (bool res_rates, const Group &group, const int phase_pos, const bool injector, const bool network=false) const
 
Scalar sumWellGasLiftRates (const Group &group, const bool network=false) const
 Sum the lift gas rates (ALQ) of the open producers below a group. More...
 
bool terminalOutput () const
 
template<class RegionalValues >
void updateGpMaintTargetForGroups (const Group &group, const RegionalValues &regional_values, const double dt)
 
int updateGroupControlledWells (const bool is_production_group, const Phase injection_phase)
 
void updateGroupProductionRates (const Group &group)
 
void updatePreviousGroupProductionRates (const Group &group)
 
void updateGroupTargetReduction (const Group &group, const bool is_injector)
 
void updateNetworkLeafNodeRates ()
 
void updateNONEProductionGroups ()
 Set production control to NONE for groups not targeting any well. More...
 
void updateREINForGroups (const Group &group, bool sum_rank)
 
void updateReservoirRatesInjectionGroups (const Group &group)
 
void updateState (WellState< Scalar, IndexTraits > &well_state, GroupState< Scalar > &group_state)
 
void updateSurfaceRatesInjectionGroups (const Group &group)
 
void updateVREPForGroups (const Group &group)
 
void updateWellRates (const Group &group, const WellState< Scalar, IndexTraits > &well_state_nupcol, WellState< Scalar, IndexTraits > &well_state) const
 
const WellState< Scalar, IndexTraits > & wellState () const
 
void updateWellRatesFromGroupTargetScale (const Scalar scale, const Group &group, bool is_injector, WellState< Scalar, IndexTraits > &well_state) const
 
Scalar wellRateContributionToGroup (const std::string &well_name, const int phase_pos, const bool res_rates, const bool is_injector, const bool network=false, const WellState< Scalar, IndexTraits > *well_state=nullptr) const
 The contribution of a single well to a group rate sum. More...
 
std::pair< std::optional< std::string >, Scalar > worstOffendingWell (const Group &group, const Group::ProductionCMode &offended_control) const
 Returns the name of the worst offending well and its fraction (i.e. violated_phase / preferred_phase) More...
 

Member Typedef Documentation

◆ GroupTarget

template<typename Scalar , typename IndexTraits >
using Opm::GroupStateHelper< Scalar, IndexTraits >::GroupTarget = typename SingleWellState<Scalar, IndexTraits>::GroupTarget

Constructor & Destructor Documentation

◆ GroupStateHelper()

template<typename Scalar , typename IndexTraits >
Opm::GroupStateHelper< Scalar, IndexTraits >::GroupStateHelper ( WellState< Scalar, IndexTraits > &  well_state,
GroupState< Scalar > &  group_state,
const Schedule &  schedule,
const SummaryState &  summary_state,
const GuideRate &  guide_rate,
const PhaseUsageInfo< IndexTraits > &  phase_usage_info,
const Parallel::Communication &  comm,
bool  terminal_output 
)

Member Function Documentation

◆ accumulateGroupEfficiencyFactor()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::accumulateGroupEfficiencyFactor ( const Group &  group,
Scalar &  factor 
) const

◆ checkGroupConstraintsInj()

template<typename Scalar , typename IndexTraits >
std::pair< bool, Scalar > Opm::GroupStateHelper< Scalar, IndexTraits >::checkGroupConstraintsInj ( const std::string &  name,
const std::string &  parent,
const Group &  group,
const Scalar *  rates,
const Phase  injection_phase,
const Scalar  efficiency_factor,
const std::vector< Scalar > &  resv_coeff,
const bool  check_guide_rate,
const bool  assume_fld_control = false 
) const

Check whether a well or group violates an injection constraint of an ancestor group.

Starting at group, the group tree is traversed upwards while the groups are under FLD or NONE control and available for higher level control. The rate of name is then checked against its guide rate share of the target of the first group found with a control of its own.

Parameters
nameName of the well or group to check.
parentName of the group name belongs to. Unchanged in the recursion.
groupGroup to check; the parent of name in the initial call, and an ancestor further up in the recursion.
ratesSurface injection rates of name for all active phases. For a group, the rates available for higher level control, i.e. the group rates minus its reduction rates, or the full group rates if assume_fld_control is true.
injection_phaseInjection phase to check.
efficiency_factorEfficiency factor of name, accumulated with the efficiency factors of the groups between name and group.
resv_coeffCoefficients converting surface rates to reservoir rates.
check_guide_rateWhether to also check if name exceeds the guide rate fraction of any group between it and the controlling group.
assume_fld_controlIf true, name is a group on individual control without group controlled wells, and its guide rate share is computed as if it was under FLD control with all its wells under group control.
Returns
Whether a constraint is violated, and the factor by which the rate of name must be scaled to honour it.

◆ checkGroupConstraintsProd()

template<typename Scalar , typename IndexTraits >
std::pair< bool, Scalar > Opm::GroupStateHelper< Scalar, IndexTraits >::checkGroupConstraintsProd ( const std::string &  name,
const std::string &  parent,
const Group &  group,
const Scalar *  rates,
const Scalar  efficiency_factor,
const std::vector< Scalar > &  resv_coeff,
const bool  check_guide_rate 
) const

◆ checkGroupProductionConstraints()

template<typename Scalar , typename IndexTraits >
std::pair< Group::ProductionCMode, Scalar > Opm::GroupStateHelper< Scalar, IndexTraits >::checkGroupProductionConstraints ( const Group &  group) const

◆ comm()

template<typename Scalar , typename IndexTraits >
const Parallel::Communication & Opm::GroupStateHelper< Scalar, IndexTraits >::comm ( ) const
inline

◆ deferredLogger()

template<typename Scalar , typename IndexTraits >
DeferredLogger & Opm::GroupStateHelper< Scalar, IndexTraits >::deferredLogger ( ) const
inline

Get the deferred logger.

Exceptions
std::logic_errorif no logger has been set via pushLogger()

Referenced by Opm::MultisegmentWell< TypeTag >::assembleWellEqWithoutIteration(), Opm::StandardWell< TypeTag >::assembleWellEqWithoutIterationImpl(), Opm::MultisegmentWell< TypeTag >::calculateExplicitQuantities(), Opm::MultisegmentWell< TypeTag >::checkOperabilityUnderTHPLimit(), Opm::StandardWell< TypeTag >::checkOperabilityUnderTHPLimit(), Opm::WellInterface< TypeTag >::checkWellOperability(), Opm::MultisegmentWell< TypeTag >::computeBhpAtThpLimitInj(), Opm::StandardWell< TypeTag >::computeBhpAtThpLimitInj(), Opm::StandardWell< TypeTag >::computeBhpAtThpLimitProdWithAlq(), Opm::MultisegmentWell< TypeTag >::computeBhpAtThpLimitProdWithAlq(), Opm::StandardWell< TypeTag >::computeWellConnectionDensitesPressures(), Opm::MultisegmentWell< TypeTag >::computeWellPotentials(), Opm::StandardWell< TypeTag >::computeWellPotentials(), Opm::StandardWell< TypeTag >::computeWellPotentialWithTHP(), Opm::MultisegmentWell< TypeTag >::computeWellPotentialWithTHP(), Opm::StandardWell< TypeTag >::computeWellRatesAndBhpWithThpAlqProd(), Opm::StandardWell< TypeTag >::computeWellRatesWithBhpIterations(), Opm::GroupConstraintCalculator< Scalar, IndexTraits >::deferredLogger(), Opm::GuideRateHandler< Scalar, IndexTraits >::deferredLogger(), Opm::MultisegmentWell< TypeTag >::getWellConvergence(), Opm::StandardWell< TypeTag >::getWellConvergence(), Opm::WellInterface< TypeTag >::iterateWellEquations(), Opm::MultisegmentWell< TypeTag >::iterateWellEqWithControl(), Opm::StandardWell< TypeTag >::iterateWellEqWithControl(), Opm::MultisegmentWell< TypeTag >::iterateWellEqWithSwitching(), Opm::StandardWell< TypeTag >::iterateWellEqWithSwitching(), Opm::WellInterface< TypeTag >::prepareWellBeforeAssembling(), Opm::MultisegmentWell< TypeTag >::recoverWellSolutionAndUpdateWellState(), Opm::MultisegmentWell< TypeTag >::solveEqAndUpdateWellState(), Opm::WellInterface< TypeTag >::solveWellEquation(), Opm::WellInterface< TypeTag >::solveWellForTesting(), Opm::WellInterface< TypeTag >::solveWellWithOperabilityCheck(), Opm::WellInterface< TypeTag >::stopWellAndSolveWithZeroRate(), Opm::MultisegmentWell< TypeTag >::updateIPRImplicit(), Opm::StandardWell< TypeTag >::updateIPRImplicit(), Opm::StandardWell< TypeTag >::updatePrimaryVariables(), Opm::WellInterface< TypeTag >::updateWellControl(), Opm::WellInterface< TypeTag >::updateWellControlAndStatusLocalIteration(), Opm::WellInterface< TypeTag >::updateWellOperability(), Opm::StandardWell< TypeTag >::updateWellState(), Opm::MultisegmentWell< TypeTag >::updateWellState(), Opm::WellInterface< TypeTag >::updateWellStateWithTarget(), Opm::WellInterface< TypeTag >::updateWellStateWithTHPTargetProd(), and Opm::WellInterface< TypeTag >::wellTesting().

◆ getAutoChokeGroupProductionTargetRate()

template<typename Scalar , typename IndexTraits >
std::pair< Scalar, Group::ProductionCMode > Opm::GroupStateHelper< Scalar, IndexTraits >::getAutoChokeGroupProductionTargetRate ( const Group &  bottom_group,
const Group &  group,
const std::vector< Scalar > &  resv_coeff,
Scalar  efficiencyFactor 
) const

◆ getGasLiftGroupLimits()

template<typename Scalar , typename IndexTraits >
std::pair< std::optional< Scalar >, std::optional< Scalar > > Opm::GroupStateHelper< Scalar, IndexTraits >::getGasLiftGroupLimits ( const Group &  group) const

Gas lift limits of a group: maximum lift gas and maximum total gas.

The group's GLIFTOPT record, and for a reservoir coupling slave group the limits the master imposes; the smaller value applies.

Returns
(max lift gas, max total gas), each nullopt if there is no limit

◆ getGroupRatesAvailableForHigherLevelControl()

template<typename Scalar , typename IndexTraits >
std::vector< Scalar > Opm::GroupStateHelper< Scalar, IndexTraits >::getGroupRatesAvailableForHigherLevelControl ( const Group &  group,
const bool  is_injector 
) const

◆ getInjectionGroupTarget()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::getInjectionGroupTarget ( const Group &  group,
const Phase &  injection_phase,
const std::vector< Scalar > &  resv_coeff 
) const

◆ getInjectionGuideTargetMode()

template<typename Scalar , typename IndexTraits >
GuideRateModel::Target Opm::GroupStateHelper< Scalar, IndexTraits >::getInjectionGuideTargetMode ( Phase  injection_phase) const

Get the guide rate target mode for an injection phase.

Parameters
injection_phaseThe injection phase (WATER, OIL, or GAS)
Returns
The corresponding GuideRateModel::Target for the injection phase

◆ getProductionGroupRateLimit()

template<typename Scalar , typename IndexTraits >
std::optional< Scalar > Opm::GroupStateHelper< Scalar, IndexTraits >::getProductionGroupRateLimit ( const Group &  group,
const Group::ProductionCMode  rate_type 
) const

Get the limit on one production rate type of a group, if any.

Returns the group's own GCONPROD limit for rate_type (ORAT, WRAT, GRAT, LRAT or RESV) when the group has that control. For a reservoir coupling slave group, the limit imposed by the master for that rate type is combined with it according to the GRUPSLAV filter flag, so a slave group without GCONPROD still gets the master's limits.

Parameters
groupThe production group
rate_typeThe production rate type
Returns
The limit, or std::nullopt if the group has no limit for rate_type

◆ getProductionGroupRateVector()

template<typename Scalar , typename IndexTraits >
GuideRate::RateVector Opm::GroupStateHelper< Scalar, IndexTraits >::getProductionGroupRateVector ( const std::string &  group_name) const

◆ getProductionGroupTarget()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::getProductionGroupTarget ( const Group &  group) const

◆ getProductionGroupTargetForMode()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::getProductionGroupTargetForMode ( const Group &  group,
const Group::ProductionCMode  cmode 
) const

Get the production target for a specific control mode (not necessarily the active one).

◆ getProductionGuideTargetMode()

template<typename Scalar , typename IndexTraits >
GuideRateModel::Target Opm::GroupStateHelper< Scalar, IndexTraits >::getProductionGuideTargetMode ( const Group &  group) const

Get the guide rate target mode for a production group.

Parameters
groupThe production group
Returns
The GuideRateModel::Target based on the group's production control mode

◆ getProductionGuideTargetModeFromControlMode()

template<typename Scalar , typename IndexTraits >
GuideRateModel::Target Opm::GroupStateHelper< Scalar, IndexTraits >::getProductionGuideTargetModeFromControlMode ( const Group::ProductionCMode  cmode) const

◆ getWellGroupTargetInjector()

template<typename Scalar , typename IndexTraits >
std::optional< GroupTarget > Opm::GroupStateHelper< Scalar, IndexTraits >::getWellGroupTargetInjector ( const std::string &  name,
const std::string &  parent,
const Group &  group,
const Scalar *  rates,
const Phase  injection_phase,
const Scalar  efficiency_factor,
const std::vector< Scalar > &  resv_coeff 
) const

◆ getWellGroupTargetProducer()

template<typename Scalar , typename IndexTraits >
std::optional< GroupTarget > Opm::GroupStateHelper< Scalar, IndexTraits >::getWellGroupTargetProducer ( const std::string &  name,
const std::string &  parent,
const Group &  group,
const Scalar *  rates,
const Scalar  efficiency_factor,
const std::vector< Scalar > &  resv_coeff,
std::optional< Group::ProductionCMode >  target_cmode = std::nullopt 
) const

◆ getWellRateVector()

template<typename Scalar , typename IndexTraits >
GuideRate::RateVector Opm::GroupStateHelper< Scalar, IndexTraits >::getWellRateVector ( const std::string &  name) const

◆ groupChainTopBot()

template<typename Scalar , typename IndexTraits >
std::vector< std::string > Opm::GroupStateHelper< Scalar, IndexTraits >::groupChainTopBot ( const std::string &  bottom,
const std::string &  top 
) const

◆ groupControlledWells()

template<typename Scalar , typename IndexTraits >
int Opm::GroupStateHelper< Scalar, IndexTraits >::groupControlledWells ( const std::string &  group_name,
const std::string &  always_included_child,
const bool  is_production_group,
const Phase  injection_phase 
) const

returns the number of wells that are actively under group control for a given group with name given by group_name

◆ groupState()

template<typename Scalar , typename IndexTraits >
GroupState< Scalar > & Opm::GroupStateHelper< Scalar, IndexTraits >::groupState ( ) const
inline

◆ guideRate()

template<typename Scalar , typename IndexTraits >
const GuideRate & Opm::GroupStateHelper< Scalar, IndexTraits >::guideRate ( ) const
inline

◆ isMasterGroupEligibleForGuideRate()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::isMasterGroupEligibleForGuideRate ( const std::string &  group_name) const

Whether a reservoir-coupling master group is eligible to participate in its parent's guide-rate distribution (GCONPROD item 8 RESPOND_TO_PARENT = YES).

A necessary but not sufficient condition: a group that is eligible still only contributes to the guide-rate sum when its effective GCW > 0 (see ReservoirCouplingMaster::effectiveGCW() and the GCW gate in FractionCalculator::guideRateSum). An excluded or inactive-slave group is eligible here but effGCW=0, so it is excluded and instead contributes its rate as a parent target reduction. Returns false for any non-master group, so non-rescoup runs are unaffected.

◆ isMasterGroupEligibleForInjectionGuideRate()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::isMasterGroupEligibleForInjectionGuideRate ( const std::string &  group_name,
Phase  injection_phase 
) const

Whether a reservoir-coupling master group is eligible to participate in its parent's injection guide-rate distribution for one phase.

The injection counterpart of isMasterGroupEligibleForGuideRate(): the group must have an injection control for the phase (GCONINJE) that is available for higher-level control (GCONINJE item 8 = YES). As on the production side this is necessary but not sufficient: an eligible group only contributes to the guide-rate sum while its effective injection GCW for the phase is > 0 (see ReservoirCouplingMaster::effectiveInjectionGCW()). Returns false for any non-master group, so non-rescoup runs are unaffected.

◆ isRank0()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::isRank0 ( ) const
inline

◆ isReservoirCouplingMaster()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::isReservoirCouplingMaster ( ) const
inline

◆ isReservoirCouplingMasterGroup()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::isReservoirCouplingMasterGroup ( const Group &  group) const
inline

◆ isReservoirCouplingSlave()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::isReservoirCouplingSlave ( ) const
inline

◆ isReservoirCouplingSlaveGroup()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::isReservoirCouplingSlaveGroup ( const Group &  group) const
inline

◆ numPhases()

template<typename Scalar , typename IndexTraits >
constexpr int Opm::GroupStateHelper< Scalar, IndexTraits >::numPhases ( ) const
inlineconstexpr

◆ phaseToActivePhaseIdx()

template<typename Scalar , typename IndexTraits >
int Opm::GroupStateHelper< Scalar, IndexTraits >::phaseToActivePhaseIdx ( const Phase  phase) const

◆ phaseUsage()

template<typename Scalar , typename IndexTraits >
const PhaseUsageInfo< IndexTraits > & Opm::GroupStateHelper< Scalar, IndexTraits >::phaseUsage ( ) const
inline

◆ pushGroupState()

template<typename Scalar , typename IndexTraits >
GroupStateGuard Opm::GroupStateHelper< Scalar, IndexTraits >::pushGroupState ( GroupState< Scalar > &  group_state)
inline

◆ pushLogger()

template<typename Scalar , typename IndexTraits >
ScopedLoggerGuard Opm::GroupStateHelper< Scalar, IndexTraits >::pushLogger ( bool  do_mpi_gather = true) const
inline

Push a new logger onto the stack with auto-cleanup on destruction.

Creates a new DeferredLogger and pushes it onto the logger stack. When the returned guard goes out of scope:

  1. If do_mpi_gather is true: Messages are gathered across MPI ranks via gatherDeferredLogger() and logged on rank 0 (if terminal_output is enabled)
  2. If do_mpi_gather is false: Messages are logged locally without MPI gather
  3. The previous logger is restored
Parameters
do_mpi_gatherIf true (default), gather messages across MPI ranks on destruction. Set to false when called from contexts where MPI synchronization is not possible (e.g., NLDD domain-local operations called at different times on different ranks).
Returns
RAII guard that owns the logger and handles cleanup

Referenced by Opm::BlackoilWellModel< TypeTag >::assembleWellEqAtRestoredState().

◆ pushWellState()

◆ reportStepIdx()

template<typename Scalar , typename IndexTraits >
int Opm::GroupStateHelper< Scalar, IndexTraits >::reportStepIdx ( ) const
inline

◆ rescoup() [1/2]

template<typename Scalar , typename IndexTraits >
ReservoirCoupling::Proxy< Scalar > & Opm::GroupStateHelper< Scalar, IndexTraits >::rescoup ( )
inline

◆ rescoup() [2/2]

template<typename Scalar , typename IndexTraits >
const ReservoirCoupling::Proxy< Scalar > & Opm::GroupStateHelper< Scalar, IndexTraits >::rescoup ( ) const
inline

◆ reservoirCouplingMaster() [1/2]

template<typename Scalar , typename IndexTraits >
ReservoirCouplingMaster< Scalar > & Opm::GroupStateHelper< Scalar, IndexTraits >::reservoirCouplingMaster ( )
inline

◆ reservoirCouplingMaster() [2/2]

template<typename Scalar , typename IndexTraits >
const ReservoirCouplingMaster< Scalar > & Opm::GroupStateHelper< Scalar, IndexTraits >::reservoirCouplingMaster ( ) const
inline

◆ reservoirCouplingMasterGroupGasLiftRate()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::reservoirCouplingMasterGroupGasLiftRate ( const Group &  group,
const bool  network 
) const

Lift gas rate the slave reported for a reservoir coupling master group.

Returns
The rate, or 0 if the group is not a master group (or in a non-MPI build). The value is the same on all ranks.

◆ reservoirCouplingSlave() [1/2]

template<typename Scalar , typename IndexTraits >
ReservoirCouplingSlave< Scalar > & Opm::GroupStateHelper< Scalar, IndexTraits >::reservoirCouplingSlave ( )
inline

◆ reservoirCouplingSlave() [2/2]

template<typename Scalar , typename IndexTraits >
const ReservoirCouplingSlave< Scalar > & Opm::GroupStateHelper< Scalar, IndexTraits >::reservoirCouplingSlave ( ) const
inline

◆ schedule()

template<typename Scalar , typename IndexTraits >
const Schedule & Opm::GroupStateHelper< Scalar, IndexTraits >::schedule ( ) const
inline

◆ setCmodeGroup()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::setCmodeGroup ( const Group &  group)

◆ setRegionAveragePressureCalculator()

template<typename Scalar , typename IndexTraits >
template<class AverageRegionalPressureType >
void Opm::GroupStateHelper< Scalar, IndexTraits >::setRegionAveragePressureCalculator ( const Group &  group,
const FieldPropsManager &  fp,
std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > &  regional_average_pressure_calculator 
) const

◆ setReportStep()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::setReportStep ( int  report_step)
inline

◆ summaryState()

template<typename Scalar , typename IndexTraits >
const SummaryState & Opm::GroupStateHelper< Scalar, IndexTraits >::summaryState ( ) const
inline

◆ sumSolventRates()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::sumSolventRates ( const Group &  group,
const bool  is_injector 
) const

◆ sumWellGasLiftHeadroom()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::sumWellGasLiftHeadroom ( const Group &  group) const

Sum how much more lift gas the gas lift wells below a group can take.

For each open producer with WLIFTOPT item 2 = YES: its maximum lift gas rate (WLIFTOPT item 3, or else the largest ALQ of its VFP table) minus its current lift gas rate. A stopped well adds nothing, as it cannot take more lift gas. Wells and efficiency factors are counted as in sumWellGasLiftRates(), and the sum is rank-local in the same way.

◆ sumWellGasLiftRates()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::sumWellGasLiftRates ( const Group &  group,
const bool  network = false 
) const

Sum the lift gas rates (ALQ) of the open producers below a group.

Like the GGLIR summary vector, a well counts if its VFP table has ALQ type GRAT or if it has no VFP table. Efficiency factors are applied as in sumWellPhaseRates(). The sum is rank-local: only owned wells count, and, as in sumWellPhaseRates(), a reservoir coupling master group contributes its slave's lift gas on rank 0 only. The lift gas supply of satellite groups (GSATPROD) is added on rank 0 too, with the network efficiency factors of the groups if network is true.

◆ sumWellPhaseRates()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::sumWellPhaseRates ( bool  res_rates,
const Group &  group,
const int  phase_pos,
const bool  injector,
const bool  network = false 
) const

◆ sumWellResRates()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::sumWellResRates ( const Group &  group,
const int  phase_pos,
const bool  injector 
) const

◆ sumWellSurfaceRates()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::sumWellSurfaceRates ( const Group &  group,
const int  phase_pos,
const bool  injector 
) const

◆ terminalOutput()

template<typename Scalar , typename IndexTraits >
bool Opm::GroupStateHelper< Scalar, IndexTraits >::terminalOutput ( ) const
inline

◆ updateGpMaintTargetForGroups()

template<typename Scalar , typename IndexTraits >
template<class RegionalValues >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateGpMaintTargetForGroups ( const Group &  group,
const RegionalValues &  regional_values,
const double  dt 
)

References OPM_DEFLOG_THROW.

◆ updateGroupControlledWells()

template<typename Scalar , typename IndexTraits >
int Opm::GroupStateHelper< Scalar, IndexTraits >::updateGroupControlledWells ( const bool  is_production_group,
const Phase  injection_phase 
)

update the number of wells that are actively under group control for a given group with name given by group_name its main usage is to detect cases where there is no wells under group control

◆ updateGroupProductionRates()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateGroupProductionRates ( const Group &  group)

◆ updateGroupTargetReduction()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateGroupTargetReduction ( const Group &  group,
const bool  is_injector 
)

◆ updateNetworkLeafNodeRates()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateNetworkLeafNodeRates ( )

◆ updateNONEProductionGroups()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateNONEProductionGroups ( )

Set production control to NONE for groups not targeting any well.

For each group in the production controls map, checks whether any open producer well has GRUP control with that group as its target. If not, the group's production control is set to NONE. This is needed to get correct summary output for GMCTP/FMCTP, see https://github.com/OPM/opm-simulators/pull/6596 for more details.

Exceptions (groups excluded from the NONE reset):

  • Groups specified for gas lift optimization (GLO)
  • RC master hierarchy groups (master groups + ancestors up to FIELD), which actively distribute targets to slave groups

◆ updatePreviousGroupProductionRates()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updatePreviousGroupProductionRates ( const Group &  group)

◆ updateREINForGroups()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateREINForGroups ( const Group &  group,
bool  sum_rank 
)

◆ updateReservoirRatesInjectionGroups()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateReservoirRatesInjectionGroups ( const Group &  group)

◆ updateState()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateState ( WellState< Scalar, IndexTraits > &  well_state,
GroupState< Scalar > &  group_state 
)

◆ updateSurfaceRatesInjectionGroups()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateSurfaceRatesInjectionGroups ( const Group &  group)

◆ updateVREPForGroups()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateVREPForGroups ( const Group &  group)

◆ updateWellRates()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateWellRates ( const Group &  group,
const WellState< Scalar, IndexTraits > &  well_state_nupcol,
WellState< Scalar, IndexTraits > &  well_state 
) const

◆ updateWellRatesFromGroupTargetScale()

template<typename Scalar , typename IndexTraits >
void Opm::GroupStateHelper< Scalar, IndexTraits >::updateWellRatesFromGroupTargetScale ( const Scalar  scale,
const Group &  group,
bool  is_injector,
WellState< Scalar, IndexTraits > &  well_state 
) const

◆ wellRateContributionToGroup()

template<typename Scalar , typename IndexTraits >
Scalar Opm::GroupStateHelper< Scalar, IndexTraits >::wellRateContributionToGroup ( const std::string &  well_name,
const int  phase_pos,
const bool  res_rates,
const bool  is_injector,
const bool  network = false,
const WellState< Scalar, IndexTraits > *  well_state = nullptr 
) const

The contribution of a single well to a group rate sum.

Applies the filters, the efficiency factor and the sign convention that sumWellPhaseRates() uses, so a caller that needs to add or remove one well's share of such a sum stays consistent with it. Returns zero when the well does not contribute at all: not present in this rank's well state, not owned by this rank (each well is counted once), of the wrong type for the sum, or shut.

Being owner-filtered, the result is rank-local, exactly like sumWellPhaseRates(); a caller that compares it against an already-reduced quantity must reduce it too.

Parameters
well_nameName of the well
phase_posActive phase index
res_ratesUse reservoir rates instead of surface rates
is_injectorSum injectors rather than producers
networkUse the network efficiency factors (GEFAC/WEFAC item 3)
well_stateThe well state to take the well's rates from, or nullptr for the helper's current well state

◆ wellState()

◆ worstOffendingWell()

template<typename Scalar , typename IndexTraits >
std::pair< std::optional< std::string >, Scalar > Opm::GroupStateHelper< Scalar, IndexTraits >::worstOffendingWell ( const Group &  group,
const Group::ProductionCMode &  offended_control 
) const

Returns the name of the worst offending well and its fraction (i.e. violated_phase / preferred_phase)


The documentation for this class was generated from the following files: