My Project
GPMaint.hpp
1 /*
2  Copyright 2020 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 GPMAINT_HPP
21 #define GPMAINT_HPP
22 
23 #include <optional>
24 #include <string>
25 
26 namespace Opm {
27 
28 class DeckRecord;
29 
30 class GPMaint {
31 public:
32 
33 enum class FlowTarget {
34  RESV_PROD = 0,
35  RESV_OINJ = 1,
36  RESV_WINJ = 2,
37  RESV_GINJ = 3,
38  SURF_OINJ = 4,
39  SURF_WINJ = 5,
40  SURF_GINJ = 6,
41 };
42 
43 class State {
44 friend class GPMaint;
45  std::optional<std::size_t> report_step;
46  double error_integral;
47  double initial_rate;
48 };
49 
50 
51 
52  GPMaint() = default;
53  GPMaint(std::size_t report_step, const DeckRecord& record);
54  static GPMaint serializeObject();
55 
56  double pressure_target() const;
57  double prop_constant() const;
58  double time_constant() const;
59  double rate(State& state, double current_rate, double error, double dt) const;
60  std::optional<std::pair<std::string, int>> region() const;
61  FlowTarget flow_target() const;
62  bool operator==(const GPMaint& other) const;
63  template<class Serializer>
64  void serializeOp(Serializer& serializer)
65  {
66  serializer(m_flow_target);
67  serializer(m_region_number);
68  serializer(m_region_name);
69  serializer(m_pressure_target);
70  serializer(m_prop_constant);
71  serializer(m_time_constant);
72  serializer(m_report_step);
73  }
74 
75 private:
76  static FlowTarget FlowTargetFromString(const std::string& stringvalue);
77  FlowTarget m_flow_target;
78  int m_region_number;
79  std::string m_region_name;
80  double m_pressure_target;
81  double m_prop_constant;
82  double m_time_constant;
83  std::size_t m_report_step;
84 };
85 }
86 
87 #endif
Definition: DeckRecord.hpp:32
Definition: GPMaint.hpp:43
Definition: GPMaint.hpp:30
Definition: Serializer.hpp:38
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29