My Project
Loading...
Searching...
No Matches
FieldProps.hpp
1/*
2 Copyright 2019 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
7 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 FOR
13 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along with
16 OPM. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef FIELDPROPS_HPP
20#define FIELDPROPS_HPP
21
22#include <opm/common/utility/OpmInputError.hpp>
23
24#include <opm/input/eclipse/EclipseState/Grid/Box.hpp>
25#include <opm/input/eclipse/EclipseState/Grid/FieldData.hpp>
26#include <opm/input/eclipse/EclipseState/Grid/Keywords.hpp>
27#include <opm/input/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp>
28#include <opm/input/eclipse/EclipseState/Grid/TranCalculator.hpp>
29#include <opm/input/eclipse/EclipseState/Runspec.hpp>
30#include <opm/input/eclipse/EclipseState/Util/OrderedMap.hpp>
31#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
32
33#include <opm/input/eclipse/Units/UnitSystem.hpp>
34
35#include <opm/input/eclipse/Deck/DeckSection.hpp>
36#include <opm/input/eclipse/Deck/value_status.hpp>
37
38#include <cstddef>
39#include <limits>
40#include <map>
41#include <memory>
42#include <optional>
43#include <set>
44#include <stdexcept>
45#include <string>
46#include <string_view>
47#include <type_traits>
48#include <unordered_map>
49#include <unordered_set>
50#include <utility>
51#include <vector>
52
53namespace Opm {
54
55class Deck;
56class EclipseGrid;
57class NumericalAquifers;
58
59namespace Fieldprops
60{
61
62namespace keywords {
63
64/*
65 Regarding global keywords
66 =========================
67
68 It turns out that when the option 'ALL' is used for the PINCH keyword we
69 require the MULTZ keyword specified for all cells, also the inactive cells.
70 The premise for the FieldProps implementation has all the way been that only
71 the active cells should be stored.
72
73 In order to support the ALL option of the PINCH keyword we have bolted on a
74 limited support for global storage. By setting .global = true in the
75 keyword_info describing the keyword you get:
76
77 1. Normal deck assignment like
78
79 MULTZ
80 ..... /
81
82 2. Scalar operations like EQUALS and MULTIPLY.
83
84 These operations also support the full details of the BOX behavior.
85
86 The following operations do not work
87 ------------------------------------
88
89 1. Operations involving multiple keywords like
90
91 COPY
92 MULTX MULTZ /
93 /
94
95 this also includes the OPERATE which involves multiple keywords for some
96 of its operations.
97
98 2. All region operatins like EQUALREG and MULTREG.
99
100 The operations which are not properly implemented will be intercepted and a
101 std::logic_error() exception will be thrown.
102*/
103
104
105
106inline bool isFipxxx(const std::string& keyword) {
107 // FIPxxxx can be any keyword, e.g. FIPREG or FIPXYZ that has the pattern "FIP.+"
108 // However, it can not be FIPOWG as that is an actual keyword.
109 if (keyword.size() < 4 || keyword == "FIPOWG") {
110 return false;
111 }
112 return keyword[0] == 'F' && keyword[1] == 'I' && keyword[2] == 'P';
113}
114
115
116/*
117 The aliased_keywords map defines aliases for other keywords. The FieldProps
118 objects will translate those keywords before further processing. The aliases
119 will also be exposed by the FieldPropsManager object.
120
121 However, the following methods of FieldProps do not fully support aliases:
122 - FieldProps::keys() does not return the aliases.
123 - FieldProps::erase() and FieldProps::extract() do not support aliases. Using
124 them with an aliased keyword will also remove the alias.
125
126 Note that the aliases are also added to GRID::double_keywords.
127
128 The PERMR and PERMTHT keywords are aliases for PERMX and PERMY, respectively.
129*/
130namespace ALIAS {
131 static const std::unordered_map<std::string, std::string> aliased_keywords = {{"PERMR", "PERMX"},
132 {"PERMTHT", "PERMY"}};
133}
134
135
136namespace GRID {
137static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"DISPERC",keyword_info<double>{}.unit_string("Length")},
138 {"MINPVV", keyword_info<double>{}.init(0.0).unit_string("ReservoirVolume").global_kw(true)},
139 {"MULTPV", keyword_info<double>{}.init(1.0).mult(true)},
140 {"NTG", keyword_info<double>{}.init(1.0)},
141 {"PORO", keyword_info<double>{}.distribute_top(true)},
142 {"PERMX", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
143 {"PERMY", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
144 {"PERMZ", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
145 {"PERMR", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
146 {"PERMTHT", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
147 {"TEMPI", keyword_info<double>{}.unit_string("Temperature")},
148 {"THCONR", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
149 {"THCONSF", keyword_info<double>{}},
150 {"HEATCR", keyword_info<double>{}.unit_string("Energy/ReservoirVolume*AbsoluteTemperature")},
151 {"HEATCRT", keyword_info<double>{}.unit_string("Energy/ReservoirVolume*AbsoluteTemperature*AbsoluteTemperature")},
152 {"THCROCK", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
153 {"THCOIL", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
154 {"THCGAS", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
155 {"THCWATER",keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
156 {"YMODULE", keyword_info<double>{}.unit_string("Giga*Pascal")},
157 {"PRATIO", keyword_info<double>{}.unit_string("1")},
158 {"BIOTCOEF", keyword_info<double>{}.unit_string("1")},
159 {"POELCOEF", keyword_info<double>{}.unit_string("1")},
160 {"THERMEXR", keyword_info<double>{}.unit_string("1/AbsoluteTemperature")},
161 {"THELCOEF", keyword_info<double>{}.unit_string("Pressure/AbsoluteTemperature")},
162 {"MULTX", keyword_info<double>{}.init(1.0).mult(true)},
163 {"MULTX-", keyword_info<double>{}.init(1.0).mult(true)},
164 {"MULTY", keyword_info<double>{}.init(1.0).mult(true)},
165 {"MULTY-", keyword_info<double>{}.init(1.0).mult(true)},
166 {"MULTZ", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)},
167 {"MULTZ-", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)}};
168
169static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {{"ACTNUM", keyword_info<int>{}.init(1)},
170 {"FLUXNUM", keyword_info<int>{}},
171 {"ISOLNUM", keyword_info<int>{}.init(1)},
172 {"MULTNUM", keyword_info<int>{}.init(1)},
173 {"OPERNUM", keyword_info<int>{}},
174 {"ROCKNUM", keyword_info<int>{}}};
175
176}
177
178namespace EDIT {
179
180/*
181 The TRANX, TRANY and TRANZ properties are handled very differently from the
182 other properties. It is important that these fields are not entered into the
183 double_keywords list of the EDIT section, that way we risk silent failures
184 due to the special treatment of the TRAN fields.
185*/
186
187static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"MULTPV", keyword_info<double>{}.init(1.0).mult(true)},
188 {"PORV", keyword_info<double>{}.unit_string("ReservoirVolume")},
189 {"MULTX", keyword_info<double>{}.init(1.0).mult(true)},
190 {"MULTX-", keyword_info<double>{}.init(1.0).mult(true)},
191 {"MULTY", keyword_info<double>{}.init(1.0).mult(true)},
192 {"MULTY-", keyword_info<double>{}.init(1.0).mult(true)},
193 {"MULTZ", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)},
194 {"MULTZ-", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)}};
195
196static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {};
197}
198
199namespace PROPS {
200static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"SWATINIT", keyword_info<double>{}},
201 {"PCG", keyword_info<double>{}.unit_string("Pressure")},
202 {"IPCG", keyword_info<double>{}.unit_string("Pressure")},
203 {"PCW", keyword_info<double>{}.unit_string("Pressure")},
204 {"IPCW", keyword_info<double>{}.unit_string("Pressure")}};
205static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {};
206
207#define dirfunc(base) base, base "X", base "X-", base "Y", base "Y-", base "Z", base "Z-"
208
209static const std::set<std::string> satfunc = {"SWLPC", "ISWLPC", "SGLPC", "ISGLPC",
210 dirfunc("SGL"),
211 dirfunc("ISGL"),
212 dirfunc("SGU"),
213 dirfunc("ISGU"),
214 dirfunc("SWL"),
215 dirfunc("ISWL"),
216 dirfunc("SWU"),
217 dirfunc("ISWU"),
218 dirfunc("SGCR"),
219 dirfunc("ISGCR"),
220 dirfunc("SOWCR"),
221 dirfunc("ISOWCR"),
222 dirfunc("SOGCR"),
223 dirfunc("ISOGCR"),
224 dirfunc("SWCR"),
225 dirfunc("ISWCR"),
226 dirfunc("KRW"),
227 dirfunc("IKRW"),
228 dirfunc("KRWR"),
229 dirfunc("IKRWR"),
230 dirfunc("KRO"),
231 dirfunc("IKRO"),
232 dirfunc("KRORW"),
233 dirfunc("IKRORW"),
234 dirfunc("KRORG"),
235 dirfunc("IKRORG"),
236 dirfunc("KRG"),
237 dirfunc("IKRG"),
238 dirfunc("KRGR"),
239 dirfunc("IKRGR")};
240
241#undef dirfunc
242}
243
244namespace REGIONS {
245
246static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {{"ENDNUM", keyword_info<int>{}.init(1)},
247 {"EOSNUM", keyword_info<int>{}.init(1)},
248 {"EQLNUM", keyword_info<int>{}.init(1)},
249 {"FIPNUM", keyword_info<int>{}.init(1)},
250 {"IMBNUM", keyword_info<int>{}.init(1)},
251 {"OPERNUM", keyword_info<int>{}},
252 {"STRESSEQUILNUM", keyword_info<int>{}.init(1)},
253 {"MISCNUM", keyword_info<int>{}},
254 {"MISCNUM", keyword_info<int>{}},
255 {"PVTNUM", keyword_info<int>{}.init(1)},
256 {"SATNUM", keyword_info<int>{}.init(1)},
257 {"LWSLTNUM", keyword_info<int>{}},
258 {"ROCKNUM", keyword_info<int>{}},
259 {"KRNUMX", keyword_info<int>{}},
260 {"KRNUMY", keyword_info<int>{}},
261 {"KRNUMZ", keyword_info<int>{}},
262 {"IMBNUMX", keyword_info<int>{}},
263 {"IMBNUMY", keyword_info<int>{}},
264 {"IMBNUMZ", keyword_info<int>{}},
265 };
266}
267
268namespace SOLUTION {
269
270static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"PRESSURE", keyword_info<double>{}.unit_string("Pressure")},
271 {"SPOLY", keyword_info<double>{}.unit_string("Density")},
272 {"SPOLYMW", keyword_info<double>{}},
273 {"SSOL", keyword_info<double>{}},
274 {"SWAT", keyword_info<double>{}},
275 {"SGAS", keyword_info<double>{}},
276 {"SMICR", keyword_info<double>{}.unit_string("Density")},
277 {"SOXYG", keyword_info<double>{}.unit_string("Density")},
278 {"SUREA", keyword_info<double>{}.unit_string("Density")},
279 {"SBIOF", keyword_info<double>{}},
280 {"SCALC", keyword_info<double>{}},
281 {"SALTP", keyword_info<double>{}},
282 {"SALT", keyword_info<double>{}.unit_string("Salinity")},
283 {"TEMPI", keyword_info<double>{}.unit_string("Temperature")},
284 {"RS", keyword_info<double>{}.unit_string("GasDissolutionFactor")},
285 {"RV", keyword_info<double>{}.unit_string("OilDissolutionFactor")},
286 {"RVW", keyword_info<double>{}.unit_string("OilDissolutionFactor")}
287 };
288
289static const std::unordered_map<std::string, keyword_info<double>> composition_keywords = {{"XMF", keyword_info<double>{}},
290 {"YMF", keyword_info<double>{}},
291 {"ZMF", keyword_info<double>{}},
292 };
293}
294
295namespace SCHEDULE {
296
297static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"MULTX", keyword_info<double>{}.init(1.0).mult(true)},
298 {"MULTX-", keyword_info<double>{}.init(1.0).mult(true)},
299 {"MULTY", keyword_info<double>{}.init(1.0).mult(true)},
300 {"MULTY-", keyword_info<double>{}.init(1.0).mult(true)},
301 {"MULTZ", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)},
302 {"MULTZ-", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)}};
303
304static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {{"ROCKNUM", keyword_info<int>{}}};
305
306}
307
308template <typename T>
309keyword_info<T> global_kw_info(const std::string& name, bool allow_unsupported = false);
310
311bool is_oper_keyword(const std::string& name);
312} // end namespace keywords
313
314} // end namespace Fieldprops
315
317public:
318
319 using ScalarOperation = Fieldprops::ScalarOperation;
320
322 int region_value;
323 double multiplier;
324 std::string region_name;
325
326
327 MultregpRecord(int rv, double m, const std::string& rn) :
328 region_value(rv),
329 multiplier(m),
330 region_name(rn)
331 {}
332
333
334 bool operator==(const MultregpRecord& other) const {
335 return this->region_value == other.region_value &&
336 this->multiplier == other.multiplier &&
337 this->region_name == other.region_name;
338 }
339 };
340
342 enum class GetStatus {
344 OK = 1,
345
353 INVALID_DATA = 2,
354
359 MISSING_KEYWORD = 3,
360
371 };
372
376 template<typename T>
378 {
380 const std::string& keyword;
381
384
387
393 FieldDataManager(const std::string& k, GetStatus s, const Fieldprops::FieldData<T>* d)
394 : keyword(k)
395 , status(s)
396 , data_ptr(d)
397 {}
398
412 const std::string& descr,
413 const std::string& operation) const
414 {
415 switch (this->status) {
417 return;
418
420 throw OpmInputError {
421 descr + " " + this->keyword +
422 " is not fully initialised for " + operation,
423 loc
424 };
425
427 throw OpmInputError {
428 descr + " " + this->keyword +
429 " does not exist in input deck for " + operation,
430 loc
431 };
432
434 throw OpmInputError {
435 descr + " " + this->keyword +
436 " is not supported for " + operation,
437 loc
438 };
439 }
440 }
441
447 void verify_status() const
448 {
449 switch (status) {
451 return;
452
454 throw std::runtime_error("The keyword: " + keyword + " has not been fully initialized");
455
457 throw std::out_of_range("No such keyword in deck: " + keyword);
458
460 throw std::logic_error("The keyword " + keyword + " is not supported");
461 }
462 }
463
467 const std::vector<T>* ptr() const
468 {
469 return (this->data_ptr != nullptr)
470 ? &this->data_ptr->data
471 : nullptr;
472 }
473
478 const std::vector<T>& data() const
479 {
480 this->verify_status();
481 return this->data_ptr->data;
482 }
483
489 {
490 this->verify_status();
491 return *this->data_ptr;
492 }
493
498 bool valid() const
499 {
500 return this->status == GetStatus::OK;
501 }
502 };
503
515 enum TryGetFlags : unsigned int {
518 AllowUnsupported = (1u << 0),
519
521 MustExist = (1u << 1),
522 };
523
525 FieldProps(const Deck& deck,
526 const Phases& phases,
527 EclipseGrid& grid,
528 const TableManager& table_arg,
529 const std::size_t ncomps);
530
532 FieldProps(const Deck& deck, const EclipseGrid& grid);
533
534 void reset_actnum(const std::vector<int>& actnum);
535
536 void prune_global_for_schedule_run();
537
538 void apply_numerical_aquifers(const NumericalAquifers& numerical_aquifers);
539
540 const std::string& default_region() const;
541
542 std::vector<int> actnum();
543 const std::vector<int>& actnumRaw() const;
544
545 template <typename T>
546 static bool supported(const std::string& keyword);
547
548 template <typename T>
549 bool has(const std::string& keyword) const;
550
551 template <typename T>
552 std::vector<std::string> keys() const;
553
566 template <typename T>
567 FieldDataManager<T>
568 try_get(const std::string& keyword, const unsigned int flags = 0u)
569 {
570 const auto allow_unsupported =
571 (flags & TryGetFlags::AllowUnsupported) != 0u;
572
573 if (!allow_unsupported && !FieldProps::template supported<T>(keyword)) {
574 return { keyword, GetStatus::NOT_SUPPPORTED_KEYWORD, nullptr };
575 }
576
577 const auto has0 = this->template has<T>(keyword);
578 if (!has0 && ((flags & TryGetFlags::MustExist) != 0)) {
579 // Client requested a property which must exist, e.g., as a
580 // source array for a COPY operation, but the property has not
581 // (yet) been defined in the run's input.
582 return { keyword, GetStatus::MISSING_KEYWORD, nullptr };
583 }
584
585 const auto& field_data = this->template
586 init_get<T>(keyword, std::is_same_v<T, double> && allow_unsupported);
587
588 if (field_data.valid() || allow_unsupported) {
589 // Note: FieldDataManager depends on init_get<>() producing a
590 // long-lived FieldData instance.
591 return { keyword, GetStatus::OK, &field_data };
592 }
593
594 if (! has0) {
595 // Client requested a property which did not exist and which
596 // could not be created from a default description.
597 this->template erase<T>(keyword);
598
599 return { keyword, GetStatus::MISSING_KEYWORD, nullptr };
600 }
601
602 // If we get here then the property exists but has not been fully
603 // defined yet.
604 return { keyword, GetStatus::INVALID_DATA, nullptr };
605 }
606
607 template <typename T>
608 const std::vector<T>& get(const std::string& keyword)
609 {
610 return this->template try_get<T>(keyword).data();
611 }
612
613 template <typename T>
614 std::vector<T> get_global(const std::string& keyword)
615 {
616 const auto managed_field_data = this->template try_get<T>(keyword);
617 const auto& field_data = managed_field_data.field_data();
618
619 const auto& kw_info = Fieldprops::keywords::
620 template global_kw_info<T>(keyword);
621
622 return kw_info.global
623 ? *field_data.global_data
624 : this->global_copy(field_data.data, kw_info.scalar_init);
625 }
626
627 template <typename T>
628 std::vector<T> get_copy(const std::string& keyword, bool global)
629 {
630 const auto has0 = this->template has<T>(keyword);
631
632 // Recall: FieldDataManager::field_data() will throw various
633 // exception types if the 'status' is anything other than 'OK'.
634 //
635 // Get_copy() depends on this behaviour to not proceed to extracting
636 // values in such cases. In other words, get_copy() uses exceptions
637 // for control flow, and we cannot move this try_get() call into the
638 // 'has0' branch even though the actual 'field_data' object returned
639 // from try_get() is only needed/used there.
640 const auto& field_data = this->template try_get<T>(keyword).field_data();
641
642 if (has0) {
643 return this->get_copy(field_data.data, field_data.kw_info.scalar_init, global);
644 }
645
646 const auto initial_value = Fieldprops::keywords::
647 template global_kw_info<T>(keyword).scalar_init;
648
649 return this->get_copy(this->template extract<T>(keyword), initial_value, global);
650 }
651
652 template <typename T>
653 std::vector<bool> defaulted(const std::string& keyword)
654 {
655 const auto& field = this->template init_get<T>(keyword);
656 std::vector<bool> def(field.numCells());
657
658 for (std::size_t i = 0; i < def.size(); ++i) {
659 def[i] = value::defaulted(field.value_status[i]);
660 }
661
662 return def;
663 }
664
665 template <typename T>
666 std::vector<T> global_copy(const std::vector<T>& data,
667 const std::optional<T>& default_value) const
668 {
669 const T fill_value = default_value.has_value() ? *default_value : 0;
670
671 std::vector<T> global_data(this->global_size, fill_value);
672
673 std::size_t i = 0;
674 for (std::size_t g = 0; g < this->global_size; g++) {
675 if (this->m_actnum[g]) {
676 global_data[g] = data[i];
677 ++i;
678 }
679 }
680
681 return global_data;
682 }
683
684 std::size_t active_size;
685 std::size_t global_size;
686
687 std::size_t num_int() const
688 {
689 return this->int_data.size();
690 }
691
692 std::size_t num_double() const
693 {
694 return this->double_data.size();
695 }
696
697 void handle_schedule_keywords(const std::vector<DeckKeyword>& keywords);
698 bool tran_active(const std::string& keyword) const;
699 void apply_tran(const std::string& keyword, std::vector<double>& data);
700 void apply_tranz_global(const std::vector<size_t>& indices, std::vector<double>& data) const;
701 bool operator==(const FieldProps& other) const;
702 static bool rst_cmp(const FieldProps& full_arg, const FieldProps& rst_arg);
703
704 const std::unordered_map<std::string,Fieldprops::TranCalculator>& getTran() const
705 {
706 return tran;
707 }
708
709 std::vector<std::string> fip_regions() const;
710
711 void deleteMINPVV();
712
713 void set_active_indices(const std::vector<int>& indices);
714
715private:
716 void processMULTREGP(const Deck& deck);
717 void scanGRIDSection(const GRIDSection& grid_section);
718 void scanGRIDSectionOnlyACTNUM(const GRIDSection& grid_section);
719 void scanEDITSection(const EDITSection& edit_section);
720 void scanPROPSSection(const PROPSSection& props_section);
721 void scanREGIONSSection(const REGIONSSection& regions_section);
722 void scanSOLUTIONSection(const SOLUTIONSection& solution_section, const std::size_t ncomps);
723 double getSIValue(const std::string& keyword, double raw_value) const;
724 double getSIValue(ScalarOperation op, const std::string& keyword, double raw_value) const;
725
726 template <typename T>
727 void erase(const std::string& keyword);
728
729 template <typename T>
730 std::vector<T> extract(const std::string& keyword);
731
732 template <typename T>
733 std::vector<T> get_copy(const std::vector<T>& x,
734 const std::optional<T>& initial_value,
735 const bool global) const
736 {
737 return (! global) ? x : this->global_copy(x, initial_value);
738 }
739
740 template <typename T>
741 std::vector<T> get_copy(std::vector<T>&& x,
742 const std::optional<T>& initial_value,
743 const bool global) const
744 {
745 return (! global) ? std::move(x) : this->global_copy(x, initial_value);
746 }
747
748 template <typename T>
749 void operate(const DeckRecord& record,
750 Fieldprops::FieldData<T>& target_data,
751 const Fieldprops::FieldData<T>& src_data,
752 const std::vector<Box::cell_index>& index_list,
753 const bool global = false);
754
755 template <typename T>
756 Fieldprops::FieldData<T>&
757 init_get(const std::string& keyword, bool allow_unsupported = false);
758
759 template <typename T>
760 Fieldprops::FieldData<T>&
761 init_get(const std::string& keyword,
762 const Fieldprops::keywords::keyword_info<T>& kw_info,
763 const bool multiplier_in_edit = false);
764
765 std::string region_name(const DeckItem& region_item) const;
766
767 std::pair<std::vector<Box::cell_index>,bool>
768 region_index(const std::string& region_name, int region_value);
769
770 void handle_OPERATE(const DeckKeyword& keyword, Box box);
771 void handle_operation(Section section, const DeckKeyword& keyword, Box box);
772 void handle_operateR(const DeckKeyword& keyword);
773 void handle_region_operation(const DeckKeyword& keyword);
774 void handle_COPY(const DeckKeyword& keyword, Box box, bool region);
775 void distribute_toplayer(Fieldprops::FieldData<double>& field_data,
776 const std::vector<double>& deck_data,
777 const Box& box);
778
779 double get_beta(const std::string& func_name, const std::string& target_array, double raw_beta);
780 double get_alpha(const std::string& func_name, const std::string& target_array, double raw_alpha);
781
782 void handle_keyword(Section section, const DeckKeyword& keyword, Box& box);
783 void handle_double_keyword(Section section,
784 const Fieldprops::keywords::keyword_info<double>& kw_info,
785 const DeckKeyword& keyword,
786 const std::string& keyword_name,
787 const Box& box);
788
789 void handle_double_keyword(Section section,
790 const Fieldprops::keywords::keyword_info<double>& kw_info,
791 const DeckKeyword& keyword,
792 const Box& box);
793
794 void handle_int_keyword(const Fieldprops::keywords::keyword_info<int>& kw_info,
795 const DeckKeyword& keyword,
796 const Box& box);
797
798 void init_satfunc(const std::string& keyword, Fieldprops::FieldData<double>& satfunc);
799 void init_porv(Fieldprops::FieldData<double>& porv);
800 void init_tempi(Fieldprops::FieldData<double>& tempi);
801
802 std::string canonical_fipreg_name(const std::string& fipreg);
803 const std::string& canonical_fipreg_name(const std::string& fipreg) const;
804
810 void apply_multipliers();
811
812 static constexpr std::string_view getMultiplierPrefix()
813 {
814 using namespace std::literals;
815 return "__MULT__"sv;
816 }
817
818 const UnitSystem unit_system;
819 std::size_t nx,ny,nz;
820 Phases m_phases;
821 SatFuncControls m_satfuncctrl;
822 std::vector<int> m_actnum;
823 std::unordered_map<int,int> m_active_index;
824 std::vector<double> cell_volume;
825 std::vector<double> cell_depth;
826 const std::string m_default_region;
827 const EclipseGrid * grid_ptr; // A bit undecided whether to properly use the grid or not ...
828 TableManager tables;
829 std::optional<satfunc::RawTableEndPoints> m_rtep;
830 std::vector<MultregpRecord> multregp;
831 std::unordered_map<std::string, Fieldprops::FieldData<int>> int_data;
832 std::unordered_map<std::string, Fieldprops::FieldData<double>> double_data;
833 std::unordered_map<std::string, std::string> fipreg_shortname_translation{};
834
835 std::unordered_map<std::string,Fieldprops::TranCalculator> tran;
836
842 std::unordered_map<std::string,Fieldprops::keywords::keyword_info<double>> multiplier_kw_infos_;
843};
844
845}
846#endif
Definition Deck.hpp:49
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition EclipseGrid.hpp:55
Definition FieldProps.hpp:316
FieldDataManager< T > try_get(const std::string &keyword, const unsigned int flags=0u)
Request read-only property array from internal cache.
Definition FieldProps.hpp:568
TryGetFlags
Options to restrict or relax a try_get() request.
Definition FieldProps.hpp:515
@ AllowUnsupported
Whether or not to permit looking up property names of unmatching types.
Definition FieldProps.hpp:518
@ MustExist
Whether or not the property must already exist.
Definition FieldProps.hpp:521
GetStatus
Property array existence status.
Definition FieldProps.hpp:342
@ NOT_SUPPPORTED_KEYWORD
Named property is not known to the internal handling mechanism.
@ MISSING_KEYWORD
Property has not yet been defined in the input file.
@ OK
Property exists and its property data is fully defined.
@ INVALID_DATA
Property array has not been fully initialised.
Definition KeywordLocation.hpp:27
Definition NumericalAquifers.hpp:38
Definition OpmInputError.hpp:49
Definition Runspec.hpp:46
Definition TableManager.hpp:66
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Wrapper type for field properties.
Definition FieldProps.hpp:378
FieldDataManager(const std::string &k, GetStatus s, const Fieldprops::FieldData< T > *d)
Constructor.
Definition FieldProps.hpp:393
GetStatus status
Request status.
Definition FieldProps.hpp:383
const Fieldprops::FieldData< T > & field_data() const
Read-only access to contained FieldData object.
Definition FieldProps.hpp:488
const std::vector< T > * ptr() const
Access underlying property data elements.
Definition FieldProps.hpp:467
const Fieldprops::FieldData< T > * data_ptr
Property data.
Definition FieldProps.hpp:386
void verify_status(const KeywordLocation &loc, const std::string &descr, const std::string &operation) const
Validate result of.
Definition FieldProps.hpp:411
void verify_status() const
Validate result of.
Definition FieldProps.hpp:447
bool valid() const
Property validity predicate.
Definition FieldProps.hpp:498
const std::vector< T > & data() const
Access underlying property data elements.
Definition FieldProps.hpp:478
const std::string & keyword
Property name.
Definition FieldProps.hpp:380
Definition FieldProps.hpp:321
Definition FieldData.hpp:71