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