My Project
Loading...
Searching...
No Matches
ReservoirCoupling.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_HPP
21#define OPM_RESERVOIR_COUPLING_HPP
22#include <mpi.h>
23#include <cmath>
24#include <iostream>
25#include <memory>
26
27namespace Opm {
28namespace ReservoirCoupling {
29
30enum class MessageTag : int {
31 SlaveSimulationStartDate,
32 SlaveActivationDate,
33 SlaveProcessTermination,
34 SlaveNextReportDate,
35 SlaveNextTimeStep,
36 MasterGroupNames,
37 MasterGroupNamesSize,
38};
39
40// Helper functions
41void custom_error_handler_(MPI_Comm* comm, int* err, const std::string &msg);
42void setErrhandler(MPI_Comm comm, bool is_master);
43
61struct Seconds {
63 static constexpr double abstol = 1e-15;
64
66 static constexpr double reltol = 1e-15;
67
86 static bool compare_eq(double a, double b);
87
93 static bool compare_gt(double a, double b);
94
100 static bool compare_gt_or_eq(double a, double b);
101
107 static bool compare_lt_or_eq(double a, double b);
108};
109
110} // namespace ReservoirCoupling
111} // namespace Opm
112
113#endif // OPM_RESERVOIR_COUPLING_HPP
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
Utility class for comparing double values representing epoch dates or elapsed time.
Definition ReservoirCoupling.hpp:61
static bool compare_eq(double a, double b)
Determines if two double values are equal within a specified tolerance.
Definition ReservoirCoupling.cpp:85
static bool compare_gt(double a, double b)
Determines if a is greater than b within the specified tolerance.
Definition ReservoirCoupling.cpp:100
static bool compare_lt_or_eq(double a, double b)
Determines if a is less than or equal to b within the specified tolerance.
Definition ReservoirCoupling.cpp:106
static constexpr double reltol
Relative tolerance used for comparisons.
Definition ReservoirCoupling.hpp:66
static bool compare_gt_or_eq(double a, double b)
Determines if a is greater than b within the specified tolerance.
Definition ReservoirCoupling.cpp:91
static constexpr double abstol
Absolute tolerance used for comparisons.
Definition ReservoirCoupling.hpp:63