My Project
InteHEAD.hpp
1 /*
2  Copyright 2021 Equinor ASA.
3  Copyright 2016, 2017, 2018 Statoil ASA.
4 
5  This file is part of the Open Porous Media Project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef OPM_INTEHEAD_HEADER_INCLUDED
22 #define OPM_INTEHEAD_HEADER_INCLUDED
23 
24 #include <array>
25 #include <ctime>
26 #include <memory>
27 #include <vector>
28 
29 namespace Opm {
30 
31 class EclipseGrid;
32 class EclipseState;
33 class UnitSystem;
34 
35 }
36 
37 namespace Opm { namespace RestartIO {
38 
39  class InteHEAD
40  {
41  public:
42  struct WellTableDim {
43  int numWells;
44  int maxPerf;
45  int maxWellInGroup;
46  int maxGroupInField;
47  int maxWellsInField;
48  int mxwlstprwel;
49  int mxdynwlst;
50  };
51 
52  struct WellSegDims {
53  int nsegwl;
54  int nswlmx;
55  int nsegmx;
56  int nlbrmx;
57  int nisegz;
58  int nrsegz;
59  int nilbrz;
60  };
61 
62  struct RegDims {
63  int ntfip;
64  int nmfipr;
65  int nrfreg;
66  int ntfreg;
67  int nplmix;
68  };
69 
70  struct RockOpts {
71  int ttyp;
72  };
73 
74  struct TimePoint {
75  int year;
76  int month; // 1..12
77  int day; // 1..31
78 
79  int hour; // 0..23
80  int minute; // 0..59
81  int second; // 0..59
82 
83  int microseconds; // 0..999999
84  };
85 
86  struct Phases {
87  int oil;
88  int water;
89  int gas;
90  };
91 
92  struct TuningPar {
93  int newtmx;
94  int newtmn;
95  int litmax;
96  int litmin;
97  int mxwsit;
98  int mxwpit;
99  int wseg_mx_rst;
100  };
101 
102  struct Group {
103  int ngroups;
104  };
105 
106  struct UdqParam {
107  int udqParam_1;
108  int no_wudqs;
109  int no_gudqs;
110  int no_fudqs;
111  int no_iuads;
112  int no_iuaps;
113  };
114 
115  struct ActionParam {
116  int no_actions;
117  int max_no_sched_lines_per_action;
118  int max_no_conditions_per_action;
119  int max_no_characters_per_line;
120  };
121 
123  int nominated_phase;
124  };
125 
126  struct NetworkDims {
127  int noactnod;
128  int noactbr;
129  int nodmax;
130  int nbrmax;
131  int nibran;
132  int nrbran;
133  int ninode;
134  int nrnode;
135  int nznode;
136  int ninobr;
137  };
138 
139  struct AquiferDims {
140  // Number of active analytic aquifers (# unique aquifer IDs)
141  int numAquifers {0};
142 
143  // Declared maximum number of analytic aquifers in model
144  // (AQUDIMS(5))
145  int maxNumAquifers {0};
146 
147  // Declared maximum number of connections in any analytic
148  // aquifer (AQUDIMS(6))
149  int maxNumAquiferConn {0};
150 
151  // Maximum number of *active* connections in any analytic aquifer
152  int maxNumActiveAquiferConn {0};
153 
154  // Maximum aquifer ID across all of the model's analytic aquifers.
155  int maxAquiferID {0};
156 
157  // Number of numeric aquifer records (lines of AQUNUM data)
158  int numNumericAquiferRecords {0};
159 
160  // Number of data elements per aquifer in IAAQ array.
161  int numIntAquiferElem {18};
162 
163  // Number of data elements per aquifer in SAAQ array.
164  int numRealAquiferElem {24};
165 
166  // Number of data elements per aquifer in XAAQ array.
167  int numDoubAquiferElem {10};
168 
169  // Number of data elements in IAQN array per numeric aquifer record.
170  int numNumericAquiferIntElem {10};
171 
172  // Number of data elements in RAQN array per numeric aquifer record.
173  int numNumericAquiferDoubleElem {13};
174 
175  // Number of data elements per coonnection in ICAQ array.
176  int numIntConnElem {7};
177 
178  // Number of data elements per connecetion in SCAQ array.
179  int numRealConnElem {2};
180 
181  // Number of data elements per connection in ACAQ array.
182  int numDoubConnElem {4};
183  };
184 
185  InteHEAD();
186  ~InteHEAD() = default;
187 
188  InteHEAD(const InteHEAD& rhs) = default;
189  InteHEAD(InteHEAD&& rhs) = default;
190 
191  InteHEAD& operator=(const InteHEAD& rhs) = default;
192  InteHEAD& operator=(InteHEAD&& rhs) = default;
193 
194  InteHEAD& dimensions(const int nx, const int ny, const int nz);
195  InteHEAD& dimensions(const std::array<int,3>& cartDims);
196  InteHEAD& numActive(const int nactive);
197 
198  InteHEAD& unitConventions(const UnitSystem& usys);
199  InteHEAD& wellTableDimensions(const WellTableDim& wtdim);
200  InteHEAD& aquiferDimensions(const AquiferDims& aqudims);
201 
202  InteHEAD& calendarDate(const TimePoint& date);
203  InteHEAD& activePhases(const Phases& phases);
204 
205  InteHEAD& params_NWELZ(const int niwelz, const int nswelz, const int nxwelz, const int nzwelz);
206  InteHEAD& params_NCON(const int niconz, const int nsconz, const int nxconz);
207  InteHEAD& params_GRPZ(const std::array<int, 4>& grpz);
208  InteHEAD& params_NGCTRL(const int gct);
209 
210  InteHEAD& stepParam(const int tstep, const int report_step);
211  InteHEAD& tuningParam(const TuningPar& tunpar);
212  InteHEAD& variousParam(const int version, const int iprog);
213  InteHEAD& wellSegDimensions(const WellSegDims& wsdim);
214  InteHEAD& networkDimensions(const NetworkDims& nwdim);
215  InteHEAD& regionDimensions(const RegDims& rdim);
216  InteHEAD& rockOpts(const RockOpts& rckop);
217  InteHEAD& ngroups(const Group& gr);
218  InteHEAD& udqParam_1(const UdqParam& udqpar);
219  InteHEAD& actionParam(const ActionParam& act_par);
220  InteHEAD& variousUDQ_ACTIONXParam();
221  InteHEAD& nominatedPhaseGuideRate(GuideRateNominatedPhase nphase);
222  InteHEAD& whistControlMode(int mode);
223  InteHEAD& liftOptParam(int in_enc);
224 
225  const std::vector<int>& data() const
226  {
227  return this->data_;
228  }
229 
230  private:
231  std::vector<int> data_;
232  };
233 
234  InteHEAD::TimePoint
235  getSimulationTimePoint(const std::time_t start,
236  const double elapsed);
237 
238  InteHEAD::AquiferDims
239  inferAquiferDimensions(const EclipseState& es);
240 }} // Opm::RestartIO
241 
242 #endif // OPM_INTEHEAD_HEADER_INCLUDED
Definition: EclipseState.hpp:55
Definition: InteHEAD.hpp:40
Definition: UnitSystem.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: InteHEAD.hpp:115
Definition: InteHEAD.hpp:139
Definition: InteHEAD.hpp:102
Definition: InteHEAD.hpp:126
Definition: InteHEAD.hpp:86
Definition: InteHEAD.hpp:62
Definition: InteHEAD.hpp:70
Definition: InteHEAD.hpp:74
Definition: InteHEAD.hpp:92
Definition: InteHEAD.hpp:106
Definition: InteHEAD.hpp:52
Definition: InteHEAD.hpp:42