My Project
Loading...
Searching...
No Matches
udq.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 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 OPM is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with OPM. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef RST_UDQ
20#define RST_UDQ
21
22#include <cstddef>
23#include <optional>
24#include <string>
25#include <unordered_set>
26#include <utility>
27#include <variant>
28#include <vector>
29#include <algorithm>
30
31#include <opm/input/eclipse/Schedule/UDQ/UDQEnums.hpp>
32#include <opm/input/eclipse/EclipseState/Phase.hpp>
33
34namespace Opm {
35
36namespace RestartIO {
37
38struct RstHeader;
39
40class RstUDQ {
41public:
42 struct RstDefine {
43 RstDefine(const std::string& expression_arg, UDQUpdate status_arg);
44
45 std::string expression;
46 UDQUpdate status;
47 std::vector<std::pair<std::string, double>> values;
48 std::optional<double> field_value;
49 };
50
51 struct RstAssign {
52 void update_value(const std::string& name_arg, double new_value);
53
54 std::optional<double> value;
55 std::unordered_set<std::string> selector;
56 };
57
58
59 RstUDQ(const std::string& name_arg,
60 const std::string& unit_arg,
61 const std::string& define_arg,
62 UDQUpdate status_arg);
63
64 RstUDQ(const std::string& name_arg,
65 const std::string& unit_arg);
66
67 void add_value(double value);
68 void add_value(const std::string& wgname, double value);
69
70 bool is_define() const;
71 UDQUpdate updateStatus() const;
72 double assign_value() const;
73 const std::unordered_set<std::string>& assign_selector() const;
74 const std::string& expression() const;
75 const std::vector<std::pair<std::string, double>>& values() const;
76 std::optional<double> field_value() const;
77
78 std::string name;
79 std::string unit;
80 UDQVarType var_type;
81
82private:
83 std::variant<std::monostate, RstDefine, RstAssign> data;
84};
85
86
87
89
90 struct RstRecord {
91 RstRecord(UDAControl c, std::size_t i, std::size_t u1, std::size_t u2);
92
93
94 UDAControl control;
95 std::size_t input_index;
96 std::size_t use_count;
97 std::size_t wg_offset;
98 };
99
100
101public:
102 RstUDQActive() = default;
103 RstUDQActive(const std::vector<int>& iuad, const std::vector<int>& iuap, const std::vector<int>& igph);
104
105 std::vector<RstRecord> iuad;
106 std::vector<int> wg_index;
107 std::vector<Phase> ig_phase;
108};
109}
110}
111
112
113
114#endif
Definition udq.hpp:88
Definition udq.hpp:40
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30