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

Computes per-master-group production targets and per-rate-type limits for reservoir coupling, and sends them to the slaves. More...

#include <RescoupConstraintsCalculator.hpp>

Public Types

using InjectionGroupTarget = ReservoirCoupling::InjectionGroupTarget< Scalar >
 
using ProductionGroupConstraints = ReservoirCoupling::ProductionGroupConstraints< Scalar >
 

Public Member Functions

 RescoupConstraintsCalculator (GuideRateHandler< Scalar, IndexTraits > &guide_rate_handler, GroupStateHelper< Scalar, IndexTraits > &group_state_helper)
 Construct a calculator bound to the master's per-sync-step state. More...
 
void calculateMasterGroupConstraintsAndSendToSlaves ()
 Run the full master-side target distribution and dispatch the resulting constraints to each activated slave. More...
 
void recalculateInjectionTargetsAndSendToSlaves ()
 Recompute only the injection targets and send them to each activated slave, replacing the ones sent earlier in this sync step. More...
 

Detailed Description

template<class Scalar, class IndexTraits>
class Opm::RescoupConstraintsCalculator< Scalar, IndexTraits >

Computes per-master-group production targets and per-rate-type limits for reservoir coupling, and sends them to the slaves.

Constructed once per sync step on the master process, drives the full target-distribution flow when its single public entry point calculateMasterGroupConstraintsAndSendToSlaves() is called. The flow is structured as a pre-phase (control restore + inactive-slave handling + GCW/reduction recompute) followed by three phases: target computation (Phase 1), cap-and-redistribute (Phase 2), and slave send (Phase 3). See the function-level comment on calculateMasterGroupConstraintsAndSendToSlaves() in the corresponding .cpp file for the per-phase narrative.

Template Parameters
ScalarFloating-point type used for rates and targets.
IndexTraitsPhase-index traits.

Member Typedef Documentation

◆ InjectionGroupTarget

template<class Scalar , class IndexTraits >
using Opm::RescoupConstraintsCalculator< Scalar, IndexTraits >::InjectionGroupTarget = ReservoirCoupling::InjectionGroupTarget<Scalar>

◆ ProductionGroupConstraints

template<class Scalar , class IndexTraits >
using Opm::RescoupConstraintsCalculator< Scalar, IndexTraits >::ProductionGroupConstraints = ReservoirCoupling::ProductionGroupConstraints<Scalar>

Constructor & Destructor Documentation

◆ RescoupConstraintsCalculator()

template<class Scalar , class IndexTraits >
Opm::RescoupConstraintsCalculator< Scalar, IndexTraits >::RescoupConstraintsCalculator ( GuideRateHandler< Scalar, IndexTraits > &  guide_rate_handler,
GroupStateHelper< Scalar, IndexTraits > &  group_state_helper 
)

Construct a calculator bound to the master's per-sync-step state.

Parameters
guide_rate_handlerSource of guide rates and the deferred logger used during the constraint calculation.
group_state_helperProvides access to the group state, the schedule, the well state, and the reservoir-coupling master facade. All intermediate state changes (control modes, GCW, target reductions) are written through this helper.

Member Function Documentation

◆ calculateMasterGroupConstraintsAndSendToSlaves()

template<class Scalar , class IndexTraits >
void Opm::RescoupConstraintsCalculator< Scalar, IndexTraits >::calculateMasterGroupConstraintsAndSendToSlaves ( )

Run the full master-side target distribution and dispatch the resulting constraints to each activated slave.

Runs on every rank of the master communicator; the slave-facing MPI sends are rank-0-only inside the underlying helpers. The driver writes group-state side effects (cmodes, GCW, reductions) and finishes with a GroupState::communicate_rates(comm) call so the post-redistribution state is consistent across master ranks. See the function-level comment on the implementation in the corresponding .cpp file for the per-phase walkthrough and the collective-call invariants.

◆ recalculateInjectionTargetsAndSendToSlaves()

template<class Scalar , class IndexTraits >
void Opm::RescoupConstraintsCalculator< Scalar, IndexTraits >::recalculateInjectionTargetsAndSendToSlaves ( )

Recompute only the injection targets and send them to each activated slave, replacing the ones sent earlier in this sync step.

The injection targets computed by calculateMasterGroupConstraintsAndSendToSlaves() are derived from the slave production rates the master holds at that moment, which are the rates the slaves reported before solving their wells for this sync step. The GCONINJE modes that turn production into an injection target are REIN (a fraction of the reinjection rate), SALE (the reinjection rate less the GCONSALE sales target) and VREP (the voidage of what was produced), so under any of those a step in which slave production changes gets an injection target for the previous step's production. This entry point is called from each master network iteration, once the slaves' latest rates have arrived, and ships targets recomputed from them. Production constraints are deliberately left untouched: the slaves have already solved their wells against them, and they are what produced the rates this recomputation is based on.

The recomputation is unconditional: it runs for every master group of every activated slave, whatever mode each one is under. A RATE target is a constant from the deck and a RESV target moves only with the other phases' reservoir injection, so for those the recomputation produces the value the slave already holds and the send is redundant. TODO: skip the groups whose target cannot have changed. The test is not simply the group's own GCONINJE record: groupInjectionTarget() walks up the hierarchy, so it is the mode of the controlling ancestor that decides, and that mode changes during a run – a group on REIN switches to RATE as soon as its target reaches the GCONINJE maximum. The filter would therefore have to be evaluated per refresh over the whole chain.


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