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 class Phases;
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 
127  struct ActiveNetwork {
128  int actnetwrk;
129  };
130 
131  struct NetworkDims {
132  int noactnod;
133  int noactbr;
134  int nodmax;
135  int nbrmax;
136  int nibran;
137  int nrbran;
138  int ninode;
139  int nrnode;
140  int nznode;
141  int ninobr;
142  };
143 
144  struct NetBalanceDims {
145  int maxNoIterationsNBC;
146  int maxNoIterationsTHP;
147  };
148 
149  struct AquiferDims {
150  // Number of active analytic aquifers (# unique aquifer IDs)
151  int numAquifers {0};
152 
153  // Declared maximum number of analytic aquifers in model
154  // (AQUDIMS(5))
155  int maxNumAquifers {0};
156 
157  // Declared maximum number of connections in any analytic
158  // aquifer (AQUDIMS(6))
159  int maxNumAquiferConn {0};
160 
161  // Maximum number of *active* connections in any analytic aquifer
162  int maxNumActiveAquiferConn {0};
163 
164  // Maximum aquifer ID across all of the model's analytic aquifers.
165  int maxAquiferID {0};
166 
167  // Number of numeric aquifer records (lines of AQUNUM data)
168  int numNumericAquiferRecords {0};
169 
170  // Number of data elements per aquifer in IAAQ array.
171  int numIntAquiferElem {18};
172 
173  // Number of data elements per aquifer in SAAQ array.
174  int numRealAquiferElem {24};
175 
176  // Number of data elements per aquifer in XAAQ array.
177  int numDoubAquiferElem {10};
178 
179  // Number of data elements in IAQN array per numeric aquifer record.
180  int numNumericAquiferIntElem {10};
181 
182  // Number of data elements in RAQN array per numeric aquifer record.
183  int numNumericAquiferDoubleElem {13};
184 
185  // Number of data elements per coonnection in ICAQ array.
186  int numIntConnElem {7};
187 
188  // Number of data elements per connecetion in SCAQ array.
189  int numRealConnElem {2};
190 
191  // Number of data elements per connection in ACAQ array.
192  int numDoubConnElem {4};
193  };
194 
195  InteHEAD();
196  ~InteHEAD() = default;
197 
198  InteHEAD(const InteHEAD& rhs) = default;
199  InteHEAD(InteHEAD&& rhs) = default;
200 
201  InteHEAD& operator=(const InteHEAD& rhs) = default;
202  InteHEAD& operator=(InteHEAD&& rhs) = default;
203 
204  InteHEAD& dimensions(const int nx, const int ny, const int nz);
205  InteHEAD& dimensions(const std::array<int,3>& cartDims);
206  InteHEAD& numActive(const int nactive);
207 
208  InteHEAD& unitConventions(const UnitSystem& usys);
209  InteHEAD& wellTableDimensions(const WellTableDim& wtdim);
210  InteHEAD& aquiferDimensions(const AquiferDims& aqudims);
211 
212  InteHEAD& calendarDate(const TimePoint& date);
213  InteHEAD& activePhases(const Phases& phases);
214 
215  InteHEAD& params_NWELZ(const int niwelz, const int nswelz, const int nxwelz, const int nzwelz);
216  InteHEAD& params_NCON(const int niconz, const int nsconz, const int nxconz);
217  InteHEAD& params_GRPZ(const std::array<int, 4>& grpz);
218  InteHEAD& params_NGCTRL(const int gct);
219 
220  InteHEAD& stepParam(const int tstep, const int report_step);
221  InteHEAD& tuningParam(const TuningPar& tunpar);
222  InteHEAD& variousParam(const int version, const int iprog);
223  InteHEAD& wellSegDimensions(const WellSegDims& wsdim);
224  InteHEAD& activeNetwork(const ActiveNetwork& actntwrk);
225  InteHEAD& networkDimensions(const NetworkDims& nwdim);
226  InteHEAD& netBalanceData(const NetBalanceDims& nwbaldim);
227  InteHEAD& regionDimensions(const RegDims& rdim);
228  InteHEAD& rockOpts(const RockOpts& rckop);
229  InteHEAD& ngroups(const Group& gr);
230  InteHEAD& udqParam_1(const UdqParam& udqpar);
231  InteHEAD& actionParam(const ActionParam& act_par);
232  InteHEAD& variousUDQ_ACTIONXParam();
233  InteHEAD& nominatedPhaseGuideRate(GuideRateNominatedPhase nphase);
234  InteHEAD& whistControlMode(int mode);
235  InteHEAD& liftOptParam(int in_enc);
236 
237  static int numRsegElem(const Opm::Phases& phase);
238  const std::vector<int>& data() const
239  {
240  return this->data_;
241  }
242 
243  private:
244  std::vector<int> data_;
245  };
246 
247  InteHEAD::TimePoint
248  getSimulationTimePoint(const std::time_t start,
249  const double elapsed);
250 
251  InteHEAD::AquiferDims
252  inferAquiferDimensions(const EclipseState& es);
253 }} // Opm::RestartIO
254 
255 #endif // OPM_INTEHEAD_HEADER_INCLUDED
Definition: EclipseState.hpp:55
Definition: Runspec.hpp:57
Definition: InteHEAD.hpp:40
Definition: UnitSystem.hpp:33
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:127
Definition: InteHEAD.hpp:149
Definition: InteHEAD.hpp:102
Definition: InteHEAD.hpp:144
Definition: InteHEAD.hpp:131
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