My Project
Loading...
Searching...
No Matches
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 <cstddef>
24#include <optional>
25#include <string>
26
27namespace Opm {
28
29class DeckRecord;
30
31class GPMaint {
32public:
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 struct State {
44 std::optional<std::size_t> report_step;
45 double error_integral;
46 double initial_rate;
47
48 static State serializationTestObject();
49
50 bool operator==(const State& rhs) const;
51
52 template<class Serializer>
53 void serializeOp(Serializer& serializer)
54 {
55 serializer(report_step);
56 serializer(error_integral);
57 serializer(initial_rate);
58 }
59 };
60
61 GPMaint() = default;
62 GPMaint(std::size_t report_step, const DeckRecord& record);
63 static GPMaint serializationTestObject();
64
65 double pressure_target() const;
66 double prop_constant() const;
67 double time_constant() const;
68 double rate(State& state, double current_rate, double error, double dt) const;
69 std::optional<std::pair<std::string, int>> region() const;
70 FlowTarget flow_target() const;
71 bool operator==(const GPMaint& other) const;
72 template<class Serializer>
73 void serializeOp(Serializer& serializer)
74 {
75 serializer(m_flow_target);
76 serializer(m_region_number);
77 serializer(m_region_name);
78 serializer(m_pressure_target);
79 serializer(m_prop_constant);
80 serializer(m_time_constant);
81 serializer(m_report_step);
82 }
83
84private:
85 static FlowTarget FlowTargetFromString(const std::string& stringvalue);
86 FlowTarget m_flow_target;
87 int m_region_number;
88 std::string m_region_name;
89 double m_pressure_target;
90 double m_prop_constant;
91 double m_time_constant;
92 std::size_t m_report_step;
93};
94}
95
96#endif
Definition DeckRecord.hpp:32
Definition GPMaint.hpp:31
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
Definition GPMaint.hpp:43