opm-common
state.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 it under the
7  terms of the GNU General Public License as published by the Free Software
8  Foundation, either version 3 of the License, or (at your option) any later
9  version.
10 
11  OPM is distributed in the hope that it will be useful, but WITHOUT ANY
12  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  details.
15 
16  You should have received a copy of the GNU General Public License along
17  with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef RST_STATE
21 #define RST_STATE
22 
23 #include <opm/io/eclipse/rst/action.hpp>
24 #include <opm/io/eclipse/rst/aquifer.hpp>
25 #include <opm/io/eclipse/rst/group.hpp>
26 #include <opm/io/eclipse/rst/header.hpp>
27 #include <opm/io/eclipse/rst/netbalan.hpp>
28 #include <opm/io/eclipse/rst/network.hpp>
29 #include <opm/io/eclipse/rst/udq.hpp>
30 #include <opm/io/eclipse/rst/well.hpp>
31 
32 #include <opm/input/eclipse/Schedule/OilVaporizationProperties.hpp>
33 #include <opm/input/eclipse/Schedule/Tuning.hpp>
34 
35 #include <opm/input/eclipse/Units/UnitSystem.hpp>
36 
37 #include <ctime>
38 #include <memory>
39 #include <optional>
40 #include <string>
41 #include <unordered_map>
42 #include <vector>
43 
44 namespace Opm {
45  class EclipseGrid;
46  class Parser;
47  class Runspec;
48 } // namespace Opm
49 
50 namespace Opm { namespace EclIO {
51  class RestartFileView;
52 }} // namespace Opm::EclIO
53 
54 namespace Opm { namespace RestartIO {
55 
56 struct RstState
57 {
58  RstState(std::shared_ptr<EclIO::RestartFileView> rstView,
59  const Runspec& runspec,
60  const ::Opm::EclipseGrid* grid);
61 
62  static RstState load(std::shared_ptr<EclIO::RestartFileView> rstView,
63  const Runspec& runspec,
64  const Parser& parser,
65  const ::Opm::EclipseGrid* grid = nullptr);
66 
67  const RstWell& get_well(const std::string& wname) const;
68 
69  ::Opm::UnitSystem unit_system;
70  RstHeader header;
71  RstAquifer aquifers;
72  RstNetbalan netbalan;
73  RstNetwork network;
74  std::vector<RstWell> wells;
75  std::vector<RstGroup> groups;
76  std::vector<RstUDQ> udqs;
77  std::optional<RstUDQActive> udq_active;
78  std::vector<RstAction> actions;
79  Tuning tuning;
81  std::unordered_map<std::string, std::vector<std::string>> wlists;
82 
83 private:
84  void load_oil_vaporization(const std::vector<int>& intehead,
85  const std::vector<bool>& logihead,
86  const std::vector<double>& doubhead);
87 
88  void load_tuning(const std::vector<int>& intehead,
89  const std::vector<double>& doubhead);
90 
91  void add_groups(const std::vector<std::string>& zgrp,
92  const std::vector<int>& igrp,
93  const std::vector<float>& sgrp,
94  const std::vector<double>& xgrp);
95 
96  void add_wells(const std::vector<std::string>& zwel,
97  const std::vector<int>& iwel,
98  const std::vector<float>& swel,
99  const std::vector<double>& xwel,
100  const std::vector<int>& icon,
101  const std::vector<float>& scon,
102  const std::vector<double>& xcon);
103 
104  void add_msw(const std::vector<std::string>& zwel,
105  const std::vector<int>& iwel,
106  const std::vector<float>& swel,
107  const std::vector<double>& xwel,
108  const std::vector<int>& icon,
109  const std::vector<float>& scon,
110  const std::vector<double>& xcon,
111  const std::vector<int>& iseg,
112  const std::vector<double>& rseg);
113 
114  void add_udqs(std::shared_ptr<EclIO::RestartFileView> rstView);
115 
116  void add_actions(const Parser& parser,
117  const Runspec& runspec,
118  std::time_t sim_time,
119  const std::vector<std::string>& zact,
120  const std::vector<int>& iact,
121  const std::vector<float>& sact,
122  const std::vector<std::string>& zacn,
123  const std::vector<int>& iacn,
124  const std::vector<double>& sacn,
125  const std::vector<std::string>& zlact);
126 
127  void add_wlist(const std::vector<std::string>& zwls,
128  const std::vector<int>& iwls);
129 
130 };
131 
132 }} // namespace Opm::RestartIO
133 
134 #endif
Definition: state.hpp:56
Definition: header.hpp:38
Definition: network.hpp:38
The hub of the parsing process.
Definition: Parser.hpp:61
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: Runspec.hpp:608
Definition: OilVaporizationProperties.hpp:34
Definition: netbalan.hpp:34
Definition: well.hpp:42
Definition: aquifer.hpp:44
Definition: UnitSystem.hpp:34
Definition: Tuning.hpp:48