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 namespace Network {
31 
32 class Balance {
33 public:
34 
35 enum class CalcMode {
36  None = 0,
37  TimeInterval = 1,
38  TimeStepStart = 2,
39  NUPCOL = 3
40 };
41 
42  Balance() = default;
43  Balance(const Tuning& tuning, const DeckKeyword& keyword);
44 
45  CalcMode mode() const;
46  double interval() const;
47  double pressure_tolerance() const;
48  std::size_t pressure_max_iter() const;
49  double thp_tolerance() const;
50  std::size_t thp_max_iter() const;
51  double target_balance_error() const;
52  double max_balance_error() const;
53  double min_tstep() const;
54 
55  static Balance serializeObject();
56  bool operator==(const Balance& other) const;
57 
58  template<class Serializer>
59  void serializeOp(Serializer& serializer)
60  {
61  serializer(this->calc_mode);
62  serializer(this->calc_interval);
63  serializer(this->ptol);
64  serializer(this->m_pressure_max_iter);
65  serializer(this->m_thp_tolerance);
66  serializer(this->m_thp_max_iter);
67  serializer(this->target_branch_balance_error);
68  serializer(this->max_branch_balance_error);
69  serializer(this->m_min_tstep);
70  }
71 
72 
73 private:
74  CalcMode calc_mode{CalcMode::None};
75  std::optional<double> calc_interval;
76  double ptol;
77  std::size_t m_pressure_max_iter;
78 
79  double m_thp_tolerance;
80  std::size_t m_thp_max_iter;
81 
82  double target_branch_balance_error;
83  double max_branch_balance_error;
84  double m_min_tstep;
85 };
86 
87 }
88 }
89 #endif
Definition: DeckKeyword.hpp:36
Definition: Balance.hpp:32
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:24