opm-simulators
Loading...
Searching...
No Matches
Opm::ReservoirCouplingSlave< Scalar > Class Template Reference

Public Types

using MessageTag = ReservoirCoupling::MessageTag
using Potentials = ReservoirCoupling::Potentials<Scalar>
using SlaveGroupInjectionData = ReservoirCoupling::SlaveGroupInjectionData<Scalar>
using SlaveGroupProductionData = ReservoirCoupling::SlaveGroupProductionData<Scalar>
using InjectionGroupTarget = ReservoirCoupling::InjectionGroupTarget<Scalar>
using MasterProductionLimits = typename ReservoirCoupling::MasterProductionLimits<Scalar>
using ProductionGroupConstraints = ReservoirCoupling::ProductionGroupConstraints<Scalar>

Public Member Functions

 ReservoirCouplingSlave (const Parallel::Communication &comm, const Schedule &schedule, const SimulatorTimer &timer)
bool activated () const
void clearDeferredLogger ()
const Parallel::Communication & getComm () const
MPI_Comm getMasterComm () const
const std::string & getSlaveName () const
const std::map< std::string, std::string > & getSlaveToMasterGroupNameMap () const
bool hasMasterInjectionTarget (const std::string &gname, const Phase phase) const
 Check if a master-imposed injection target exists for a group and phase.
bool hasMasterProductionLimits (const std::string &gname) const
 Check if master-imposed per-rate-type production limits exist for a group.
bool hasMasterProductionTarget (const std::string &gname) const
 Check if a master-imposed production target exists for a group.
void initTimeStepping ()
bool isFirstSubstepOfSyncTimestep () const
bool isLastSubstepOfSyncTimestep () const
 Check if this is the last substep within a "sync" timestep.
bool isSlaveGroup (const std::string &group_name) const
ReservoirCoupling::Loggerlogger ()
ReservoirCoupling::Loggerlogger () const
std::pair< Scalar, Group::InjectionCMode > masterInjectionTarget (const std::string &gname, const Phase phase) const
 Get the master-imposed injection target and control mode for a group and phase.
const MasterProductionLimits & masterProductionLimits (const std::string &gname) const
 Get the master-imposed per-rate-type production limits for a group.
std::pair< Scalar, Group::ProductionCMode > masterProductionTarget (const std::string &gname) const
 Get the master-imposed production target and control mode for a group.
void maybeActivate (int report_step)
std::size_t numSlaveGroups () const
double receiveNextTimeStepFromMaster ()
std::pair< std::size_t, std::size_t > receiveNumGroupConstraintsFromMaster () const
void receiveInjectionGroupTargetsFromMaster (std::size_t num_targets)
 Receive injection group targets from master and store them locally.
void receiveProductionGroupConstraintsFromMaster (std::size_t num_targets)
 Receive production group constraints from master and store them locally.
void sendAndReceiveInitialData ()
void sendInjectionDataToMaster (const std::vector< SlaveGroupInjectionData > &injection_data) const
void sendNextReportDateToMasterProcess () const
void sendProductionDataToMaster (const std::vector< SlaveGroupProductionData > &production_data) const
void setDeferredLogger (DeferredLogger *deferred_logger)
void setFirstSubstepOfSyncTimestep (bool value)
void setLastSubstepOfSyncTimestep (bool value)
 Set whether this is the last substep within a "sync" timestep.
const std::string & slaveGroupIdxToGroupName (std::size_t group_idx) const
bool terminated () const
bool maybeReceiveTerminateSignalFromMaster ()
 Blocking receive for terminate/continue signal from master.
void receiveTerminateAndDisconnect ()
 Receive terminate signal from master and disconnect the intercommunicator.

Member Function Documentation

◆ hasMasterInjectionTarget()

template<class Scalar>
bool Opm::ReservoirCouplingSlave< Scalar >::hasMasterInjectionTarget ( const std::string & gname,
const Phase phase ) const

Check if a master-imposed injection target exists for a group and phase.

Delegates to ReservoirCouplingSlaveReportStep

◆ hasMasterProductionLimits()

template<class Scalar>
bool Opm::ReservoirCouplingSlave< Scalar >::hasMasterProductionLimits ( const std::string & gname) const

Check if master-imposed per-rate-type production limits exist for a group.

Delegates to ReservoirCouplingSlaveReportStep

◆ hasMasterProductionTarget()

template<class Scalar>
bool Opm::ReservoirCouplingSlave< Scalar >::hasMasterProductionTarget ( const std::string & gname) const

Check if a master-imposed production target exists for a group.

Delegates to ReservoirCouplingSlaveReportStep

◆ isLastSubstepOfSyncTimestep()

template<class Scalar>
bool Opm::ReservoirCouplingSlave< Scalar >::isLastSubstepOfSyncTimestep ( ) const

Check if this is the last substep within a "sync" timestep.

This flag is used to control reservoir coupling synchronization of summary data sent from the slave to the master process. The slave should send production data to the master at the end of its "sync" timestep, while master is waiting for it in timeStepSucceeded() of the first substep of the sync step.

Returns
true if this is the last substep of a "sync" timestep, false if not

◆ masterInjectionTarget()

template<class Scalar>
std::pair< Scalar, Group::InjectionCMode > Opm::ReservoirCouplingSlave< Scalar >::masterInjectionTarget ( const std::string & gname,
const Phase phase ) const

Get the master-imposed injection target and control mode for a group and phase.

Delegates to ReservoirCouplingSlaveReportStep

◆ masterProductionLimits()

template<class Scalar>
const ReservoirCouplingSlave< Scalar >::MasterProductionLimits & Opm::ReservoirCouplingSlave< Scalar >::masterProductionLimits ( const std::string & gname) const

Get the master-imposed per-rate-type production limits for a group.

Delegates to ReservoirCouplingSlaveReportStep

◆ masterProductionTarget()

template<class Scalar>
std::pair< Scalar, Group::ProductionCMode > Opm::ReservoirCouplingSlave< Scalar >::masterProductionTarget ( const std::string & gname) const

Get the master-imposed production target and control mode for a group.

Delegates to ReservoirCouplingSlaveReportStep

◆ maybeReceiveTerminateSignalFromMaster()

template<class Scalar>
bool Opm::ReservoirCouplingSlave< Scalar >::maybeReceiveTerminateSignalFromMaster ( )

Blocking receive for terminate/continue signal from master.

This method is called at the start of each timestep iteration in the slave's substep loop. Master sends 0 (continue) or 1 (terminate) at each iteration. If terminate signal (value != 0) is received, disconnects the intercommunicator, sets the terminated flag, and returns true.

Returns
true if terminate signal received and disconnect completed, false to continue.

◆ receiveInjectionGroupTargetsFromMaster()

template<class Scalar>
void Opm::ReservoirCouplingSlave< Scalar >::receiveInjectionGroupTargetsFromMaster ( std::size_t num_targets)

Receive injection group targets from master and store them locally.

Delegates to ReservoirCouplingSlaveReportStep

◆ receiveProductionGroupConstraintsFromMaster()

template<class Scalar>
void Opm::ReservoirCouplingSlave< Scalar >::receiveProductionGroupConstraintsFromMaster ( std::size_t num_targets)

Receive production group constraints from master and store them locally.

Delegates to ReservoirCouplingSlaveReportStep

◆ receiveTerminateAndDisconnect()

template<class Scalar>
void Opm::ReservoirCouplingSlave< Scalar >::receiveTerminateAndDisconnect ( )

Receive terminate signal from master and disconnect the intercommunicator.

This method must be called at the end of the simulation to cleanly shut down the MPI intercommunicator created when the slave was spawned. It performs two steps:

  1. Receives a terminate signal from master (only on rank 0, then broadcast)
  2. Disconnects the intercommunicator (collective operation)

Both master and slaves must call their respective disconnect methods for MPI_Comm_disconnect() to complete - it is a collective operation.

◆ setLastSubstepOfSyncTimestep()

template<class Scalar>
void Opm::ReservoirCouplingSlave< Scalar >::setLastSubstepOfSyncTimestep ( bool value)

Set whether this is the last substep within a "sync" timestep.

See isLastSubstepOfSyncTimestep() for details.

Parameters
valuetrue if this is the last substep of a "sync" timestep, false if not

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