My Project
Loading...
Searching...
No Matches
ReservoirCouplingSlave.hpp
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
23#include <opm/simulators/flow/ReservoirCoupling.hpp>
24#include <opm/input/eclipse/Schedule/Schedule.hpp>
25#include <opm/simulators/utils/ParallelCommunication.hpp>
26#include <opm/simulators/timestepping/SimulatorTimer.hpp>
27#include <opm/common/OpmLog/OpmLog.hpp>
28
29#include <mpi.h>
30
31#include <vector>
32
33namespace Opm {
34
36public:
37 using MessageTag = ReservoirCoupling::MessageTag;
38
40 const Parallel::Communication &comm, const Schedule &schedule, const SimulatorTimer &timer
41 );
42 bool activated() const { return activated_; }
43 void maybeActivate(int report_step);
44 void sendActivationDateToMasterProcess() const;
45 void sendNextReportDateToMasterProcess() const;
46 void sendSimulationStartDateToMasterProcess() const;
47 void receiveMasterGroupNamesFromMasterProcess();
48 double receiveNextTimeStepFromMaster();
49
50private:
51 void checkGrupSlavGroupNames_();
52 double getGrupSlavActivationDate_() const;
53 void saveMasterGroupNamesAsMap_(const std::vector<char>& group_names);
54
55 const Parallel::Communication &comm_;
56 const Schedule& schedule_;
57 const SimulatorTimer &timer_;
58 // MPI parent communicator for a slave process
59 MPI_Comm slave_master_comm_{MPI_COMM_NULL};
60 std::map<std::string, std::string> master_group_names_;
61 bool activated_{false};
62};
63
64} // namespace Opm
65#endif // OPM_RESERVOIR_COUPLING_SLAVE_HPP
Definition ReservoirCouplingSlave.hpp:35
Definition SimulatorTimer.hpp:39
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242