|
opm-simulators
|
Manages slave-side reservoir coupling operations for a single report step. More...
#include <ReservoirCouplingSlaveReportStep.hpp>
Public Types | |
| using | InjectionGroupTarget = ReservoirCoupling::InjectionGroupTarget< Scalar > |
| using | ProductionGroupConstraints = ReservoirCoupling::ProductionGroupConstraints< Scalar > |
| using | MasterGroupNodePressure = ReservoirCoupling::MasterGroupNodePressure< Scalar > |
| using | MessageTag = ReservoirCoupling::MessageTag |
| using | MasterProductionLimits = ReservoirCoupling::MasterProductionLimits< Scalar > |
| using | SlaveGroupInjectionData = ReservoirCoupling::SlaveGroupInjectionData< Scalar > |
| using | SlaveGroupProductionData = ReservoirCoupling::SlaveGroupProductionData< Scalar > |
Public Member Functions | |
| ReservoirCouplingSlaveReportStep (ReservoirCouplingSlave< Scalar > &slave) | |
| Construct a report step manager for the slave process. More... | |
| const Parallel::Communication & | comm () const |
| Get the MPI communicator for intra-slave communication. More... | |
| MPI_Comm | getSlaveMasterComm () const |
| Get the MPI communicator for slave-master communication. More... | |
| bool | hasMasterInjectionTarget (const std::string &gname, const Phase phase) const |
| Check if a master-imposed injection target exists for a group and phase. More... | |
| bool | hasMasterGroupNodePressure (const std::string &gname) const |
| Check if a master-computed network-leaf node pressure exists for a master group. More... | |
| bool | hasMasterProductionLimits (const std::string &gname) const |
| Check if master-imposed per-rate-type production limits exist for a group. More... | |
| bool | hasMasterProductionTarget (const std::string &gname) const |
| Check if a master-imposed production target exists for a group. More... | |
| bool | isFirstSubstepOfSyncTimestep () const |
| Check if this is the first substep within a "sync" timestep. More... | |
| bool | isLastSubstepOfSyncTimestep () const |
| Check if this is the last substep within a "sync" timestep. More... | |
| ReservoirCoupling::Logger & | logger () const |
| Get the logger for reservoir coupling operations. More... | |
| Scalar | masterGroupNodePressure (const std::string &gname) const |
| Get the master-computed network-leaf node pressure for a master group. More... | |
| const std::map< std::string, Scalar > & | masterGroupNodePressures () const |
| Get the full map of master-computed network-leaf node pressures. More... | |
| 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. More... | |
| const MasterProductionLimits & | masterProductionLimits (const std::string &gname) const |
| Get the master-imposed per-rate-type production limits for a group. More... | |
| std::pair< Scalar, Group::ProductionCMode > | masterProductionTarget (const std::string &gname) const |
| Get the master-imposed production target and control mode for a group. More... | |
| void | receiveMasterGroupNodePressuresFromMaster (std::size_t num_pressures) |
| Receive master-computed network-leaf node pressures from master and store them locally. More... | |
| std::pair< std::size_t, bool > | receiveNumMasterGroupNodePressuresFromMaster () |
| Receive the master-group-node-pressures header from master. More... | |
| void | receiveCoupledNetworkActiveStatusFromMaster () |
Receive the master's single-bool flag for the current sync timestep and mirror it into last_received_master_group_node_pressures_is_final_ (is_final = !active). More... | |
| bool | lastReceivedMasterGroupNodePressuresIsFinal () const |
Whether the most recent master-group-node-pressures receive carried the is_final flag. More... | |
| bool | connectedToMasterCoupledNetwork () const |
| Whether this slave is connected to the master's cross-rescoup network this sync step (i.e. More... | |
| std::pair< std::size_t, std::size_t > | receiveNumGroupConstraintsFromMaster () const |
| Receive the number of injection and production constraints from master. More... | |
| void | receiveInjectionGroupTargetsFromMaster (std::size_t num_targets) |
| Receive injection group targets from master and store them locally. More... | |
| void | receiveProductionGroupConstraintsFromMaster (std::size_t num_targets) |
| Receive production group constraints from master and store them locally. More... | |
| void | sendProductionDataToMaster (const std::vector< SlaveGroupProductionData > &production_data) const |
| Send production data to the master process. More... | |
| void | sendInjectionDataToMaster (const std::vector< SlaveGroupInjectionData > &injection_data) const |
| Send injection data to the master process. More... | |
| void | setFirstSubstepOfSyncTimestep (bool value) |
| Set whether this is the first substep within a "sync" timestep. More... | |
| void | setLastSubstepOfSyncTimestep (bool value) |
| Set whether this is the last substep within a "sync" timestep. More... | |
| void | markSlaveGroupsInSchedule (Schedule &schedule, int report_step_idx) |
| Mark slave groups in the Schedule as production/injection groups. More... | |
| const std::string & | slaveName () const |
| Get the name of this slave process. More... | |
| void | setMasterGroupNodePressure (const std::string &gname, const Scalar pressure) |
| Store a master-computed network-leaf node pressure for a master group. More... | |
| void | setMasterInjectionTarget (const std::string &gname, const Phase phase, const Scalar target, const Group::InjectionCMode cmode) |
| Store a master-imposed injection target for a group and phase. More... | |
| void | setMasterProductionLimits (const std::string &gname, const MasterProductionLimits &limits) |
| Store master-imposed per-rate-type production limits for a group. More... | |
| void | setMasterProductionTarget (const std::string &gname, const Scalar target, const Group::ProductionCMode cmode) |
| Store a master-imposed production target for a group. More... | |
Manages slave-side reservoir coupling operations for a single report step.
This class encapsulates the slave process's communication with the master process during a single report step in reservoir coupling simulations. It handles:
The class serves as a helper to ReservoirCouplingSlave, separating the report-step-specific communication logic from the overall coupling lifecycle management. This separation improves code organization and makes the coupling logic easier to understand and maintain.
| Scalar | Floating-point type for rate and potential values (typically double or float) |
| Opm::ReservoirCouplingSlaveReportStep< Scalar >::ReservoirCouplingSlaveReportStep | ( | ReservoirCouplingSlave< Scalar > & | slave | ) |
Construct a report step manager for the slave process.
| slave | Reference to the parent ReservoirCouplingSlave object |
|
inline |
Get the MPI communicator for intra-slave communication.
|
inline |
Whether this slave is connected to the master's cross-rescoup network this sync step (i.e.
at least one of its master groups is a leaf node in the master network). Set by receiveCoupledNetworkActiveStatusFromMaster from the master's per-slave flag. Distinct from the per-iteration is_final flag: an unconnected slave never participates in the cross-rescoup exchange and balances only its own (local) network.
|
inline |
Get the MPI communicator for slave-master communication.
| bool Opm::ReservoirCouplingSlaveReportStep< Scalar >::hasMasterGroupNodePressure | ( | const std::string & | gname | ) | const |
Check if a master-computed network-leaf node pressure exists for a master group.
| gname | Slave group name |
| bool Opm::ReservoirCouplingSlaveReportStep< Scalar >::hasMasterInjectionTarget | ( | const std::string & | gname, |
| const Phase | phase | ||
| ) | const |
Check if a master-imposed injection target exists for a group and phase.
| gname | Slave group name |
| phase | Injection phase (e.g., Phase::WATER, Phase::GAS) |
| bool Opm::ReservoirCouplingSlaveReportStep< Scalar >::hasMasterProductionLimits | ( | const std::string & | gname | ) | const |
Check if master-imposed per-rate-type production limits exist for a group.
| gname | Slave group name |
| bool Opm::ReservoirCouplingSlaveReportStep< Scalar >::hasMasterProductionTarget | ( | const std::string & | gname | ) | const |
Check if a master-imposed production target exists for a group.
| gname | Slave group name |
|
inline |
Check if this is the first substep within a "sync" timestep.
This flag is used to control reservoir coupling synchronization. Master-slave data exchange should only happen at the start of each "sync" timestep, not on internal substeps or at retries after convergence chops.
|
inline |
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.
|
inline |
Whether the most recent master-group-node-pressures receive carried the is_final flag.
Updated by every call to receiveNumMasterGroupNodePressuresFromMaster, and by receiveCoupledNetworkActiveStatusFromMaster at the start of each sync step.
See last_received_master_group_node_pressures_is_final_ variable for details.
|
inline |
Get the logger for reservoir coupling operations.
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::markSlaveGroupsInSchedule | ( | Schedule & | schedule, |
| int | report_step_idx | ||
| ) |
Mark slave groups in the Schedule as production/injection groups.
For slave groups that have received master production/injection targets, mark them so isProductionGroup()/isInjectionGroup() return true. This ensures the existing constraint enforcement mechanisms recognize them.
| schedule | Non-const reference to the Schedule |
| report_step_idx | 0-based report step index |
| Scalar Opm::ReservoirCouplingSlaveReportStep< Scalar >::masterGroupNodePressure | ( | const std::string & | gname | ) | const |
Get the master-computed network-leaf node pressure for a master group.
| gname | Slave group name |
| std::out_of_range | if no pressure exists for the given group |
|
inline |
Get the full map of master-computed network-leaf node pressures.
| std::pair< Scalar, Group::InjectionCMode > Opm::ReservoirCouplingSlaveReportStep< Scalar >::masterInjectionTarget | ( | const std::string & | gname, |
| const Phase | phase | ||
| ) | const |
Get the master-imposed injection target and control mode for a group and phase.
| gname | Slave group name |
| phase | Injection phase |
| std::out_of_range | if no target exists for the given group/phase pair |
| const ReservoirCouplingSlaveReportStep< Scalar >::MasterProductionLimits & Opm::ReservoirCouplingSlaveReportStep< Scalar >::masterProductionLimits | ( | const std::string & | gname | ) | const |
Get the master-imposed per-rate-type production limits for a group.
| gname | Slave group name |
| std::out_of_range | if no limits exist for the given group |
| std::pair< Scalar, Group::ProductionCMode > Opm::ReservoirCouplingSlaveReportStep< Scalar >::masterProductionTarget | ( | const std::string & | gname | ) | const |
Get the master-imposed production target and control mode for a group.
| gname | Slave group name |
| std::out_of_range | if no target exists for the given group |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::receiveCoupledNetworkActiveStatusFromMaster | ( | ) |
Receive the master's single-bool flag for the current sync timestep and mirror it into last_received_master_group_node_pressures_is_final_ (is_final = !active).
The flag is queryable via lastReceivedMasterGroupNodePressuresIsFinal().
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::receiveInjectionGroupTargetsFromMaster | ( | std::size_t | num_targets | ) |
Receive injection group targets from master and store them locally.
| num_targets | Number of injection targets to receive |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::receiveMasterGroupNodePressuresFromMaster | ( | std::size_t | num_pressures | ) |
Receive master-computed network-leaf node pressures from master and store them locally.
Only emitted for master groups that are leaf nodes in the master's extended network.
| num_pressures | Number of pressure entries to receive |
| std::pair< std::size_t, std::size_t > Opm::ReservoirCouplingSlaveReportStep< Scalar >::receiveNumGroupConstraintsFromMaster | ( | ) | const |
Receive the number of injection and production constraints from master.
| std::pair< std::size_t, bool > Opm::ReservoirCouplingSlaveReportStep< Scalar >::receiveNumMasterGroupNodePressuresFromMaster | ( | ) |
Receive the master-group-node-pressures header from master.
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::receiveProductionGroupConstraintsFromMaster | ( | std::size_t | num_targets | ) |
Receive production group constraints from master and store them locally.
| num_targets | Number of production constraints to receive |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::sendInjectionDataToMaster | ( | const std::vector< SlaveGroupInjectionData > & | injection_data | ) | const |
Send injection data to the master process.
This method sends injection rates and related data for all slave groups to the master process via MPI communication. The data is used by the master for group control calculations and coordination.
| injection_data | Vector of injection data for each slave group |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::sendProductionDataToMaster | ( | const std::vector< SlaveGroupProductionData > & | production_data | ) | const |
Send production data to the master process.
This method sends production rates, potentials, and related data for all slave groups to the master process via MPI communication. The data is used by the master for group control calculations and coordination.
| production_data | Vector of production data for each slave group |
|
inline |
Set whether this is the first substep within a "sync" timestep.
| value | true at start of sync timestep, false after first runSubStep_() call |
|
inline |
Set whether this is the last substep within a "sync" timestep.
See isLastSubstepOfSyncTimestep() for details.
| value | true if this is the last substep of a "sync" timestep, false if not |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::setMasterGroupNodePressure | ( | const std::string & | gname, |
| const Scalar | pressure | ||
| ) |
Store a master-computed network-leaf node pressure for a master group.
| gname | Slave group name |
| pressure | Node pressure (SI units, Pa) |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::setMasterInjectionTarget | ( | const std::string & | gname, |
| const Phase | phase, | ||
| const Scalar | target, | ||
| const Group::InjectionCMode | cmode | ||
| ) |
Store a master-imposed injection target for a group and phase.
| gname | Slave group name |
| phase | Injection phase |
| target | Target injection rate |
| cmode | Injection control mode dictated by the master |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::setMasterProductionLimits | ( | const std::string & | gname, |
| const MasterProductionLimits & | limits | ||
| ) |
Store master-imposed per-rate-type production limits for a group.
| gname | Slave group name |
| limits | Per-rate-type limits (-1 = no limit for that rate type) |
| void Opm::ReservoirCouplingSlaveReportStep< Scalar >::setMasterProductionTarget | ( | const std::string & | gname, |
| const Scalar | target, | ||
| const Group::ProductionCMode | cmode | ||
| ) |
Store a master-imposed production target for a group.
| gname | Slave group name |
| target | Target production rate |
| cmode | Production control mode dictated by the master |
|
inline |
Get the name of this slave process.