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
32{
33public:
34 enum class FlowTarget {
35 RESV_PROD = 0,
36 RESV_OINJ = 1,
37 RESV_WINJ = 2,
38 RESV_GINJ = 3,
39 SURF_OINJ = 4,
40 SURF_WINJ = 5,
41 SURF_GINJ = 6,
42 };
43
44 struct State
45 {
46 std::optional<std::size_t> report_step{};
47 double error_integral{};
48 double initial_rate{};
49
50 static State serializationTestObject();
51
52 bool operator==(const State& rhs) const;
53
54 template<class Serializer>
55 void serializeOp(Serializer& serializer)
56 {
57 serializer(report_step);
58 serializer(error_integral);
59 serializer(initial_rate);
60 }
61 };
62
63 GPMaint() = default;
64 GPMaint(std::size_t report_step, const DeckRecord& record);
65 static GPMaint serializationTestObject();
66
67 double pressure_target() const;
68 double prop_constant() const;
69 double time_constant() const;
70 double rate(State& state, double current_rate, double error, double dt) const;
71 void resetState(State& state) const;
72 std::optional<std::pair<std::string, int>> region() const;
73 FlowTarget flow_target() const;
74 bool operator==(const GPMaint& other) const;
75 template<class Serializer>
76 void serializeOp(Serializer& serializer)
77 {
78 serializer(m_flow_target);
79 serializer(m_region_number);
80 serializer(m_region_name);
81 serializer(m_pressure_target);
82 serializer(m_prop_constant);
83 serializer(m_time_constant);
84 serializer(m_report_step);
85 }
86
87private:
88 static FlowTarget FlowTargetFromString(const std::string& stringvalue);
89
90 FlowTarget m_flow_target{FlowTarget::RESV_GINJ};
91 int m_region_number{};
92 std::string m_region_name{};
93 double m_pressure_target{};
94 double m_prop_constant{};
95 double m_time_constant{};
96 std::size_t m_report_step{};
97};
98
99}
100
101#endif
Definition DeckRecord.hpp:32
Definition GPMaint.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:91
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition GPMaint.hpp:45