20 #ifndef OPM_RESERVOIR_COUPLING_MASTER_REPORT_STEP_HPP 21 #define OPM_RESERVOIR_COUPLING_MASTER_REPORT_STEP_HPP 23 #include <opm/simulators/flow/rescoup/ReservoirCoupling.hpp> 24 #include <opm/simulators/flow/rescoup/ReservoirCouplingMpiTraits.hpp> 25 #include <opm/output/data/Groups.hpp> 26 #include <opm/input/eclipse/Schedule/Schedule.hpp> 27 #include <opm/simulators/utils/ParallelCommunication.hpp> 28 #include <opm/common/OpmLog/OpmLog.hpp> 37 template <
class Scalar>
class ReservoirCouplingMaster;
59 template <
class Scalar>
62 using MessageTag = ReservoirCoupling::MessageTag;
78 const Parallel::Communication &
comm()
const {
return this->master_.getComm(); }
84 return this->master_.getMasterGroupNamesForSlave(slave_idx);
90 return this->master_.getMasterGroupToSlaveNameMap();
98 const std::string &slave_name,
const std::string &master_group_name)
const;
103 MPI_Comm
getSlaveComm(
int index)
const {
return this->master_.getSlaveComm(index); }
133 const std::string &group_name, ReservoirCoupling::Phase phase)
const;
170 std::size_t
numSlaveGroups(
unsigned int index)
const {
return this->master_.numSlaveGroups(index); }
174 std::size_t
numSlaves()
const {
return this->master_.numSlavesStarted(); }
203 const Schedule &
schedule()
const {
return this->master_.schedule(); }
214 std::size_t slave_idx,
bool active
217 void sendInjectionTargetsToSlave(
218 std::size_t slave_idx,
const std::vector<InjectionGroupTarget>& injection_targets
225 std::size_t slave_idx,
const std::vector<MasterGroupNodePressure>& pressures
228 void sendNumGroupConstraintsToSlave(
229 std::size_t slave_idx, std::size_t num_injection_targets, std::size_t num_production_constraints
241 std::size_t slave_idx, std::size_t num_pressures,
bool is_final
244 void sendProductionConstraintsToSlave(
245 std::size_t slave_idx,
const std::vector<ProductionGroupConstraints>& production_constraints
271 const std::string &
slaveName(
int index)
const {
return this->master_.getSlaveName(index); }
279 Scalar getMasterGroupRate_(
const std::string &group_name, ReservoirCoupling::Phase phase,
280 ReservoirCoupling::RateKind kind)
const;
286 int report_step_idx_;
289 std::map<std::string, std::vector<SlaveGroupProductionData>> slave_group_production_data_;
292 std::map<std::string, std::vector<SlaveGroupInjectionData>> slave_group_injection_data_;
296 bool is_first_substep_of_sync_timestep_{
true};
303 bool needs_slave_data_receive_{
false};
306 #endif // OPM_RESERVOIR_COUPLING_MASTER_REPORT_STEP_HPP const Parallel::Communication & comm() const
Get the MPI communicator for master-slave communication.
Definition: ReservoirCouplingMasterReportStep.hpp:78
const Potentials & getSlaveGroupPotentials(const std::string &master_group_name) const
Get the production potentials for a slave group.
Definition: ReservoirCouplingMasterReportStep.cpp:105
void sendMasterGroupNodePressuresToSlave(std::size_t slave_idx, const std::vector< MasterGroupNodePressure > &pressures) const
Send master-computed network-leaf node pressures to a slave.
Definition: ReservoirCouplingMasterReportStep.cpp:290
const Schedule & schedule() const
Get the simulation schedule.
Definition: ReservoirCouplingMasterReportStep.hpp:203
std::size_t getMasterGroupCanonicalIdx(const std::string &slave_name, const std::string &master_group_name) const
Get the canonical index for a master group.
Definition: ReservoirCouplingMasterReportStep.cpp:55
Master-computed network-leaf node pressure for a single master group.
Definition: ReservoirCoupling.hpp:287
Scalar getMasterGroupInjectionSurfaceRate(const std::string &group_name, ReservoirCoupling::Phase phase) const
Get the injection surface rate for a master group.
Definition: ReservoirCouplingMasterReportStep.cpp:63
Scalar getMasterGroupInjectionReservoirRate(const std::string &group_name, ReservoirCoupling::Phase phase) const
Get the injection reservoir rate for a master group.
Definition: ReservoirCouplingMasterReportStep.cpp:71
void setNeedsSlaveDataReceive(bool value)
Set/clear the flag for pending slave data receive.
Definition: ReservoirCouplingMasterReportStep.hpp:165
void sendNumMasterGroupNodePressuresToSlave(std::size_t slave_idx, std::size_t num_pressures, bool is_final) const
Send the count of master-computed network-leaf node pressures that will follow, plus an is_final flag...
Definition: ReservoirCouplingMasterReportStep.cpp:355
Definition: ReservoirCoupling.hpp:42
Scalar getMasterGroupProductionReservoirRate(const std::string &group_name, ReservoirCoupling::Phase phase) const
Get the production reservoir rate for a master group.
Definition: ReservoirCouplingMasterReportStep.cpp:97
ReservoirCoupling::Logger & logger() const
Get the logger for reservoir coupling operations.
Definition: ReservoirCouplingMasterReportStep.hpp:178
void receiveInjectionDataFromSlaves()
Receive injection data from all active slave processes.
Definition: ReservoirCouplingMasterReportStep.cpp:127
void receiveProductionDataFromSlaves()
Receive production data from all active slave processes.
Definition: ReservoirCouplingMasterReportStep.cpp:180
MPI_Comm getSlaveComm(int index) const
Get the MPI communicator for a specific slave process.
Definition: ReservoirCouplingMasterReportStep.hpp:103
const std::vector< std::string > & getMasterGroupNamesForSlave(std::size_t slave_idx) const
Get the names of master groups associated with a specific slave.
Definition: ReservoirCouplingMasterReportStep.hpp:83
const std::string & slaveName(int index) const
Get the name of a specific slave process.
Definition: ReservoirCouplingMasterReportStep.hpp:271
Definition: ReservoirCoupling.hpp:238
Scalar getMasterGroupProductionSurfaceRate(const std::string &group_name, ReservoirCoupling::Phase phase) const
Get the production surface rate for a master group.
Definition: ReservoirCouplingMasterReportStep.cpp:79
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
ReservoirCouplingMasterReportStep(ReservoirCouplingMaster< Scalar > &master)
Construct a report step manager for the master process.
Definition: ReservoirCouplingMasterReportStep.cpp:41
void setReportStepIdx(int report_step_idx)
Set the current report step index.
Definition: ReservoirCouplingMasterReportStep.cpp:412
bool needsSlaveDataReceive() const
Check if the master needs to receive slave data at the next timeStepSucceeded() call.
Definition: ReservoirCouplingMasterReportStep.hpp:162
Definition: ReservoirCoupling.hpp:196
std::size_t numSlaveGroups(unsigned int index) const
Get the number of slave groups for a specific slave process.
Definition: ReservoirCouplingMasterReportStep.hpp:170
void setFirstSubstepOfSyncTimestep(bool value)
Set whether this is the first substep within a "sync" timestep.
Definition: ReservoirCouplingMasterReportStep.hpp:250
const std::map< std::string, std::string > & getMasterGroupToSlaveNameMap() const
Get the mapping from master group names to slave names.
Definition: ReservoirCouplingMasterReportStep.hpp:89
std::size_t numSlaves() const
Get the total number of active slave processes.
Definition: ReservoirCouplingMasterReportStep.hpp:174
data::ReservoirCouplingGroupRates collectGroupRatesForSummary() const
Collect production/injection rates for all master groups.
Definition: ReservoirCouplingMasterReportStep.cpp:420
Definition: ReservoirCoupling.hpp:254
Definition: ReservoirCouplingMaster.hpp:38
void sendCoupledNetworkActiveStatusToSlave(std::size_t slave_idx, bool active) const
Send a single boolean to a slave telling it whether the master will iterate the cross-rescoup network...
Definition: ReservoirCouplingMasterReportStep.cpp:237
bool slaveIsActivated(int index) const
Check if a specific slave process has been activated.
Definition: ReservoirCouplingMasterReportStep.hpp:266
Definition: ReservoirCoupling.hpp:244
bool isFirstSubstepOfSyncTimestep() const
Check if this is the first substep within a "sync" timestep.
Definition: ReservoirCouplingMasterReportStep.hpp:157
Scalar getMasterGroupNetworkProductionSurfaceRate(const std::string &group_name, ReservoirCoupling::Phase phase) const
Get the network production surface rate for a master group.
Definition: ReservoirCouplingMasterReportStep.cpp:87
Manages master-side reservoir coupling operations for a single report step.
Definition: ReservoirCouplingMasterReportStep.hpp:60
Definition: ReservoirCoupling.hpp:220