My Project
Loading...
Searching...
No Matches
Balance.hpp
1/*
2 Copyright 2021 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 NETWORK_BALANCE_HPP
21#define NETWORK_BALANCE_HPP
22
23#include <cstddef>
24#include <optional>
25
26namespace Opm {
27 class DeckKeyword;
28 class UnitSystem;
29} // namespace Opm
30
31namespace Opm { namespace RestartIO {
32 class RstNetbalan;
33}} // namespace Opm::RestartIO
34
35namespace Opm { namespace Network {
36
38{
39public:
40 enum class CalcMode {
41 None = 0,
42 TimeInterval = 1,
43 TimeStepStart = 2,
44 NUPCOL = 3,
45 };
46
47 Balance();
48 explicit Balance(const DeckKeyword& keyword);
49 explicit Balance(bool network_active);
50 explicit Balance(const RestartIO::RstNetbalan& netbalan);
51
52 static Balance serializationTestObject();
53
54 CalcMode mode() const;
55 double interval() const;
56 double pressure_tolerance() const;
57 std::size_t pressure_max_iter() const;
58 double thp_tolerance() const;
59 std::size_t thp_max_iter() const;
60 const std::optional<double>& target_balance_error() const;
61 const std::optional<double>& max_balance_error() const;
62 const std::optional<double>& min_tstep() const;
63
64 bool operator==(const Balance& other) const;
65
66 template<class Serializer>
67 void serializeOp(Serializer& serializer)
68 {
69 serializer(this->calc_mode);
70 serializer(this->calc_interval);
71 serializer(this->ptol);
72 serializer(this->m_pressure_max_iter);
73 serializer(this->m_thp_tolerance);
74 serializer(this->m_thp_max_iter);
75 serializer(this->target_branch_balance_error);
76 serializer(this->max_branch_balance_error);
77 serializer(this->m_min_tstep);
78 }
79
80private:
81 CalcMode calc_mode{CalcMode::None};
82 double calc_interval;
83 double ptol;
84 std::size_t m_pressure_max_iter;
85
86 double m_thp_tolerance;
87 std::size_t m_thp_max_iter;
88
89 std::optional<double> target_branch_balance_error{};
90 std::optional<double> max_branch_balance_error{};
91 std::optional<double> m_min_tstep{};
92};
93
94}} // Opm::Network
95
96#endif // NETWORK_BALANCE_HPP
Definition DeckKeyword.hpp:36
Definition Balance.hpp:38
Definition netbalan.hpp:35
Class for (de-)serializing.
Definition Serializer.hpp:84
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30