20 #ifndef OPM_RESERVOIR_COUPLING_SLAVE_REPORT_STEP_HPP 21 #define OPM_RESERVOIR_COUPLING_SLAVE_REPORT_STEP_HPP 23 #include <opm/simulators/flow/rescoup/ReservoirCoupling.hpp> 24 #include <opm/input/eclipse/EclipseState/Phase.hpp> 25 #include <opm/input/eclipse/Schedule/Group/Group.hpp> 34 template <
class Scalar>
class ReservoirCouplingSlave;
54 template <
class Scalar>
55 class ReservoirCouplingSlaveReportStep {
57 using InjectionGroupTarget = ReservoirCoupling::InjectionGroupTarget<Scalar>;
58 using ProductionGroupConstraints = ReservoirCoupling::ProductionGroupConstraints<Scalar>;
59 using MasterGroupNodePressure = ReservoirCoupling::MasterGroupNodePressure<Scalar>;
60 using MessageTag = ReservoirCoupling::MessageTag;
61 using MasterProductionLimits = ReservoirCoupling::MasterProductionLimits<Scalar>;
62 using SlaveGroupInjectionData = ReservoirCoupling::SlaveGroupInjectionData<Scalar>;
63 using SlaveGroupProductionData = ReservoirCoupling::SlaveGroupProductionData<Scalar>;
68 ReservoirCouplingSlave<Scalar> &slave
73 const Parallel::Communication &
comm()
const {
return this->slave_.getComm(); }
129 {
return master_group_node_pressures_; }
137 const std::string& gname,
const Phase phase)
const;
177 {
return last_received_master_group_node_pressures_is_final_; }
187 {
return connected_to_master_coupled_network_; }
244 const std::string&
slaveName()
const {
return this->slave_.getSlaveName(); }
257 const std::string& gname,
const Phase phase,
const Scalar target,
const Group::InjectionCMode cmode);
288 template <
class DataType>
289 void sendDataToMaster_(
290 const std::vector<DataType>& data,
292 const std::string& data_type_name
299 bool is_first_substep_of_sync_timestep_{
true};
303 bool is_last_substep_of_sync_timestep_{
false};
310 std::map<std::string, std::pair<Scalar, Group::ProductionCMode>> master_production_targets_;
312 std::map<std::pair<Phase, std::string>, std::pair<Scalar, Group::InjectionCMode>> master_injection_targets_;
315 std::map<std::string, MasterProductionLimits> master_production_limits_;
319 std::map<std::string, Scalar> master_group_node_pressures_;
331 bool connected_to_master_coupled_network_{
false};
345 bool last_received_master_group_node_pressures_is_final_{
true};
348 #endif // OPM_RESERVOIR_COUPLING_SLAVE_REPORT_STEP_HPP bool connectedToMasterCoupledNetwork() const
Whether this slave is connected to the master's cross-rescoup network this sync step (i...
Definition: ReservoirCouplingSlaveReportStep.hpp:186
void sendProductionDataToMaster(const std::vector< SlaveGroupProductionData > &production_data) const
Send production data to the master process.
Definition: ReservoirCouplingSlaveReportStep.cpp:363
void setMasterGroupNodePressure(const std::string &gname, const Scalar pressure)
Store a master-computed network-leaf node pressure for a master group.
Definition: ReservoirCouplingSlaveReportStep.cpp:373
void markSlaveGroupsInSchedule(Schedule &schedule, int report_step_idx)
Mark slave groups in the Schedule as production/injection groups.
Definition: ReservoirCouplingSlaveReportStep.cpp:407
void setFirstSubstepOfSyncTimestep(bool value)
Set whether this is the first substep within a "sync" timestep.
Definition: ReservoirCouplingSlaveReportStep.hpp:227
Definition: ReservoirCoupling.hpp:42
void setLastSubstepOfSyncTimestep(bool value)
Set whether this is the last substep within a "sync" timestep.
Definition: ReservoirCouplingSlaveReportStep.hpp:232
bool hasMasterInjectionTarget(const std::string &gname, const Phase phase) const
Check if a master-imposed injection target exists for a group and phase.
Definition: ReservoirCouplingSlaveReportStep.cpp:63
Scalar masterGroupNodePressure(const std::string &gname) const
Get the master-computed network-leaf node pressure for a master group.
Definition: ReservoirCouplingSlaveReportStep.cpp:87
bool lastReceivedMasterGroupNodePressuresIsFinal() const
Whether the most recent master-group-node-pressures receive carried the is_final flag.
Definition: ReservoirCouplingSlaveReportStep.hpp:176
const MasterProductionLimits & masterProductionLimits(const std::string &gname) const
Get the master-imposed per-rate-type production limits for a group.
Definition: ReservoirCouplingSlaveReportStep.cpp:103
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
bool hasMasterGroupNodePressure(const std::string &gname) const
Check if a master-computed network-leaf node pressure exists for a master group.
Definition: ReservoirCouplingSlaveReportStep.cpp:55
ReservoirCoupling::Logger & logger() const
Get the logger for reservoir coupling operations.
Definition: ReservoirCouplingSlaveReportStep.hpp:118
const Parallel::Communication & comm() const
Get the MPI communicator for intra-slave communication.
Definition: ReservoirCouplingSlaveReportStep.hpp:73
std::pair< std::size_t, bool > receiveNumMasterGroupNodePressuresFromMaster()
Receive the master-group-node-pressures header from master.
Definition: ReservoirCouplingSlaveReportStep.cpp:269
MPI_Comm getSlaveMasterComm() const
Get the MPI communicator for slave-master communication.
Definition: ReservoirCouplingSlaveReportStep.hpp:77
std::pair< std::size_t, std::size_t > receiveNumGroupConstraintsFromMaster() const
Receive the number of injection and production constraints from master.
Definition: ReservoirCouplingSlaveReportStep.cpp:241
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.
Definition: ReservoirCouplingSlaveReportStep.cpp:95
void receiveProductionGroupConstraintsFromMaster(std::size_t num_targets)
Receive production group constraints from master and store them locally.
Definition: ReservoirCouplingSlaveReportStep.cpp:306
bool isLastSubstepOfSyncTimestep() const
Check if this is the last substep within a "sync" timestep.
Definition: ReservoirCouplingSlaveReportStep.hpp:114
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.
Definition: ReservoirCouplingSlaveReportStep.cpp:381
bool hasMasterProductionLimits(const std::string &gname) const
Check if master-imposed per-rate-type production limits exist for a group.
Definition: ReservoirCouplingSlaveReportStep.cpp:71
const std::string & slaveName() const
Get the name of this slave process.
Definition: ReservoirCouplingSlaveReportStep.hpp:244
void setMasterProductionLimits(const std::string &gname, const MasterProductionLimits &limits)
Store master-imposed per-rate-type production limits for a group.
Definition: ReservoirCouplingSlaveReportStep.cpp:391
bool hasMasterProductionTarget(const std::string &gname) const
Check if a master-imposed production target exists for a group.
Definition: ReservoirCouplingSlaveReportStep.cpp:79
void receiveInjectionGroupTargetsFromMaster(std::size_t num_targets)
Receive injection group targets from master and store them locally.
Definition: ReservoirCouplingSlaveReportStep.cpp:161
Definition: ReservoirCouplingSlave.hpp:40
void setMasterProductionTarget(const std::string &gname, const Scalar target, const Group::ProductionCMode cmode)
Store a master-imposed production target for a group.
Definition: ReservoirCouplingSlaveReportStep.cpp:399
void receiveMasterGroupNodePressuresFromMaster(std::size_t num_pressures)
Receive master-computed network-leaf node pressures from master and store them locally.
Definition: ReservoirCouplingSlaveReportStep.cpp:202
void receiveCoupledNetworkActiveStatusFromMaster()
Receive the master's single-bool flag for the current sync timestep and mirror it into last_received_...
Definition: ReservoirCouplingSlaveReportStep.cpp:125
void sendInjectionDataToMaster(const std::vector< SlaveGroupInjectionData > &injection_data) const
Send injection data to the master process.
Definition: ReservoirCouplingSlaveReportStep.cpp:353
std::pair< Scalar, Group::ProductionCMode > masterProductionTarget(const std::string &gname) const
Get the master-imposed production target and control mode for a group.
Definition: ReservoirCouplingSlaveReportStep.cpp:111
bool isFirstSubstepOfSyncTimestep() const
Check if this is the first substep within a "sync" timestep.
Definition: ReservoirCouplingSlaveReportStep.hpp:105
const std::map< std::string, Scalar > & masterGroupNodePressures() const
Get the full map of master-computed network-leaf node pressures.
Definition: ReservoirCouplingSlaveReportStep.hpp:128
ReservoirCouplingSlaveReportStep(ReservoirCouplingSlave< Scalar > &slave)
Construct a report step manager for the slave process.
Definition: ReservoirCouplingSlaveReportStep.cpp:41