opm-common
InteHEAD.hpp
1 /*
2  Copyright 2021-2024 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 <opm/input/eclipse/Schedule/UDQ/UDQEnums.hpp>
25 
26 #include <array>
27 #include <cstddef>
28 #include <ctime>
29 #include <memory>
30 #include <vector>
31 
32 namespace Opm {
33 
34 class EclipseGrid;
35 class EclipseState;
36 class Phases;
37 class Schedule;
38 class ScheduleState;
39 class UDQInput;
40 class UnitSystem;
41 
42 } // namespace Opm
43 
44 namespace Opm { namespace RestartIO {
45 
46  class InteHEAD
47  {
48  public:
49  struct WellTableDim {
50  int numWells{};
51  int maxPerf{};
52  int maxWellInGroup{};
53  int maxGroupInField{};
54  int maxWellsInField{};
55  int mxwlstprwel{};
56  int mxdynwlst{};
57  };
58 
59  struct WellSegDims {
60  int nsegwl{};
61  int nswlmx{};
62  int nsegmx{};
63  int nlbrmx{};
64  int nisegz{};
65  int nrsegz{};
66  int nilbrz{};
67  };
68 
69  struct RegDims {
70  int ntfip{};
71  int nmfipr{};
72  int nrfreg{};
73  int ntfreg{};
74  int nplmix{};
75  };
76 
77  struct RockOpts {
78  int ttyp{};
79  };
80 
81  struct TimePoint {
82  int year{};
83  int month{}; // 1..12
84  int day{}; // 1..31
85 
86  int hour{}; // 0..23
87  int minute{}; // 0..59
88  int second{}; // 0..59
89 
90  int microseconds{}; // 0..999999
91  };
92 
93  struct Phases {
94  int oil{};
95  int water{};
96  int gas{};
97  };
98 
99  struct TuningPar {
100  int newtmx{};
101  int newtmn{};
102  int litmax{};
103  int litmin{};
104  int mxwsit{};
105  int mxwpit{};
106  int wseg_mx_rst{};
107  };
108 
109  struct Group {
110  int ngroups{};
111  };
112 
113  struct UdqParam {
114  int udqParam_1{};
115  int num_iuads{};
116  int num_iuaps{};
117 
118  std::array<int, static_cast<std::size_t>(UDQVarType::NumTypes)> numUDQs{};
119  };
120 
121  struct ActionParam {
122  int no_actions{};
123  int max_no_sched_lines_per_action{};
124  int max_no_conditions_per_action{};
125  int max_no_characters_per_line{};
126  };
127 
129  int nominated_phase;
130  };
131 
132  struct ActiveNetwork {
133  int actnetwrk;
134  };
135 
136  struct NetworkDims {
137  int noactnod{};
138  int noactbr{};
139  int nodmax{};
140  int nbrmax{};
141  int nibran{};
142  int nrbran{};
143  int ninode{};
144  int nrnode{};
145  int nznode{};
146  int ninobr{};
147  };
148 
149  struct NetBalanceDims {
150  int maxNoIterationsNBC{};
151  int maxNoIterationsTHP{};
152  };
153 
154  struct AquiferDims {
155  // Number of active analytic aquifers (# unique aquifer IDs)
156  int numAquifers {0};
157 
158  // Declared maximum number of analytic aquifers in model
159  // (AQUDIMS(5))
160  int maxNumAquifers {0};
161 
162  // Declared maximum number of connections in any analytic
163  // aquifer (AQUDIMS(6))
164  int maxNumAquiferConn {0};
165 
166  // Maximum number of *active* connections in any analytic aquifer
167  int maxNumActiveAquiferConn {0};
168 
169  // Maximum aquifer ID across all of the model's analytic aquifers.
170  int maxAquiferID {0};
171 
172  // Number of numeric aquifer records (lines of AQUNUM data, AQUDIMS(1))
173  int numNumericAquiferRecords {0};
174 
175  // Number of data elements per aquifer in IAAQ array.
176  int numIntAquiferElem {18};
177 
178  // Number of data elements per aquifer in SAAQ array.
179  int numRealAquiferElem {24};
180 
181  // Number of data elements per aquifer in XAAQ array.
182  int numDoubAquiferElem {10};
183 
184  // Number of data elements in IAQN array per numeric aquifer record.
185  int numNumericAquiferIntElem {10};
186 
187  // Number of data elements in RAQN array per numeric aquifer record.
188  int numNumericAquiferDoubleElem {13};
189 
190  // Number of data elements per coonnection in ICAQ array.
191  int numIntConnElem {7};
192 
193  // Number of data elements per connecetion in SCAQ array.
194  int numRealConnElem {2};
195 
196  // Number of data elements per connection in ACAQ array.
197  int numDoubConnElem {4};
198  };
199 
200  InteHEAD();
201  ~InteHEAD() = default;
202 
203  InteHEAD(const InteHEAD& rhs) = default;
204  InteHEAD(InteHEAD&& rhs) = default;
205 
206  InteHEAD& operator=(const InteHEAD& rhs) = default;
207  InteHEAD& operator=(InteHEAD&& rhs) = default;
208 
209  InteHEAD& dimensions(const int nx, const int ny, const int nz);
210  InteHEAD& dimensions(const std::array<int,3>& cartDims);
211  InteHEAD& numActive(const int nactive);
212 
213  InteHEAD& unitConventions(const UnitSystem& usys);
214  InteHEAD& wellTableDimensions(const WellTableDim& wtdim);
215  InteHEAD& aquiferDimensions(const AquiferDims& aqudims);
216 
217  InteHEAD& calendarDate(const TimePoint& date);
218  InteHEAD& activePhases(const Phases& phases);
219 
220  InteHEAD& drsdt(const Schedule& sched,
221  const std::size_t lookup_step);
222 
223  InteHEAD& params_NWELZ(const int niwelz, const int nswelz, const int nxwelz, const int nzwelz);
224  InteHEAD& params_NCON(const int niconz, const int nsconz, const int nxconz);
225  InteHEAD& params_GRPZ(const std::array<int, 4>& grpz);
226  InteHEAD& params_NGCTRL(const int gct);
227 
228  InteHEAD& stepParam(const int tstep, const int report_step);
229  InteHEAD& tuningParam(const TuningPar& tunpar);
230  InteHEAD& variousParam(const int version, const int iprog, const int num_tracers = 0);
231  InteHEAD& wellSegDimensions(const WellSegDims& wsdim);
232  InteHEAD& activeNetwork(const ActiveNetwork& actntwrk);
233  InteHEAD& networkDimensions(const NetworkDims& nwdim);
234  InteHEAD& netBalanceData(const NetBalanceDims& nwbaldim);
235  InteHEAD& regionDimensions(const RegDims& rdim);
236  InteHEAD& rockOpts(const RockOpts& rckop);
237  InteHEAD& ngroups(const Group& gr);
238  InteHEAD& udqParam_1(const UdqParam& udqpar);
239  InteHEAD& actionParam(const ActionParam& act_par);
240  InteHEAD& variousUDQ_ACTIONXParam();
241  InteHEAD& nominatedPhaseGuideRate(GuideRateNominatedPhase nphase);
242  InteHEAD& whistControlMode(int mode);
243  InteHEAD& liftOptParam(int in_enc);
244 
245  static int numRsegElem(const Opm::Phases& phase);
246 
247  const std::vector<int>& data() const
248  {
249  return this->data_;
250  }
251 
252  private:
253  std::vector<int> data_;
254  };
255 
256  InteHEAD::TimePoint
257  getSimulationTimePoint(const std::time_t start,
258  const double elapsed);
259 
260  InteHEAD::AquiferDims
261  inferAquiferDimensions(const EclipseState& es);
262 
263  InteHEAD::AquiferDims
264  inferAquiferDimensions(const EclipseState& es,
265  const ScheduleState& sched);
266 }} // Opm::RestartIO
267 
268 #endif // OPM_INTEHEAD_HEADER_INCLUDED
Definition: InteHEAD.hpp:93
Definition: ArrayDimChecker.cpp:239
Definition: InteHEAD.hpp:77
Definition: InteHEAD.hpp:49
Definition: InteHEAD.hpp:132
Definition: Schedule.hpp:100
Definition: InteHEAD.hpp:154
Definition: InteHEAD.hpp:149
Definition: InteHEAD.hpp:46
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: InteHEAD.hpp:113
Definition: EclipseState.hpp:66
Definition: InteHEAD.hpp:121
Definition: InteHEAD.hpp:69
Definition: InteHEAD.hpp:81
Definition: InteHEAD.hpp:109
Definition: UnitSystem.hpp:34
Definition: ScheduleState.hpp:106
Definition: InteHEAD.hpp:136
Definition: InteHEAD.hpp:99
Definition: Runspec.hpp:45