ReservoirCouplingSlave.hpp
Go to the documentation of this file.
1/*
2 Copyright 2024 Equinor ASA
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_RESERVOIR_COUPLING_SLAVE_HPP
21#define OPM_RESERVOIR_COUPLING_SLAVE_HPP
22
24#include <opm/input/eclipse/Schedule/Schedule.hpp>
27#include <opm/common/OpmLog/OpmLog.hpp>
28
29#include <mpi.h>
30
31#include <vector>
32
33namespace Opm {
34
36public:
39
41 const Parallel::Communication &comm, const Schedule &schedule, const SimulatorTimer &timer
42 );
43 bool activated() const { return activated_; }
45 const Parallel::Communication& getComm() const { return comm_; }
46 const std::map<std::string, std::string>& getSlaveToMasterGroupNameMap() const {
47 return slave_to_master_group_map_; }
48 void maybeActivate(int report_step);
52 void sendPotentialsToMaster(const std::vector<Potentials> &potentials) const;
53 void setDeferredLogger(DeferredLogger *deferred_logger) {
54 this->logger_.setDeferredLogger(deferred_logger);
55 }
56
57private:
58 void checkGrupSlavGroupNames_();
59 double getGrupSlavActivationDate_() const;
60 void receiveMasterGroupNamesFromMasterProcess_();
61 void receiveSlaveNameFromMasterProcess_();
62 void saveMasterGroupNamesAsMap_(const std::vector<char>& group_names);
63 void sendActivationDateToMasterProcess_() const;
64 void sendSimulationStartDateToMasterProcess_() const;
65
66 const Parallel::Communication &comm_;
67 const Schedule& schedule_;
68 const SimulatorTimer &timer_;
69 // MPI parent communicator for a slave process
70 MPI_Comm slave_master_comm_{MPI_COMM_NULL};
71 std::map<std::string, std::string> slave_to_master_group_map_;
72 bool activated_{false};
73 std::string slave_name_; // This is the slave name as defined in the master process
74 ReservoirCoupling::Logger logger_;
75};
76
77} // namespace Opm
78#endif // OPM_RESERVOIR_COUPLING_SLAVE_HPP
Definition: DeferredLogger.hpp:57
void setDeferredLogger(DeferredLogger *deferred_logger)
Definition: ReservoirCoupling.hpp:41
void clearDeferredLogger()
Definition: ReservoirCoupling.hpp:38
Definition: ReservoirCouplingSlave.hpp:35
bool activated() const
Definition: ReservoirCouplingSlave.hpp:43
void clearDeferredLogger()
Definition: ReservoirCouplingSlave.hpp:44
void maybeActivate(int report_step)
const std::map< std::string, std::string > & getSlaveToMasterGroupNameMap() const
Definition: ReservoirCouplingSlave.hpp:46
ReservoirCouplingSlave(const Parallel::Communication &comm, const Schedule &schedule, const SimulatorTimer &timer)
void setDeferredLogger(DeferredLogger *deferred_logger)
Definition: ReservoirCouplingSlave.hpp:53
void sendNextReportDateToMasterProcess() const
const Parallel::Communication & getComm() const
Definition: ReservoirCouplingSlave.hpp:45
void sendPotentialsToMaster(const std::vector< Potentials > &potentials) const
Definition: SimulatorTimer.hpp:39
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
MessageTag
Definition: ReservoirCoupling.hpp:47
Definition: blackoilboundaryratevector.hh:39
Definition: ReservoirCoupling.hpp:62