opm-common
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/Tables/TableManager.hpp>
31
32#include <opm/input/eclipse/Units/UnitSystem.hpp>
33
34#include <opm/input/eclipse/Deck/DeckSection.hpp>
35#include <opm/input/eclipse/Deck/value_status.hpp>
36
37#include <cstddef>
38#include <limits>
39#include <map>
40#include <memory>
41#include <optional>
42#include <set>
43#include <stdexcept>
44#include <string>
45#include <string_view>
46#include <type_traits>
47#include <unordered_map>
48#include <unordered_set>
49#include <utility>
50#include <vector>
51
52namespace Opm {
53
54class Deck;
55class EclipseGrid;
57
58namespace Fieldprops
59{
60
61namespace keywords {
62
63/*
64 Regarding global keywords
65 =========================
66
67 It turns out that when the option 'ALL' is used for the PINCH keyword we
68 require the MULTZ keyword specified for all cells, also the inactive cells.
69 The premise for the FieldProps implementation has all the way been that only
70 the active cells should be stored.
71
72 In order to support the ALL option of the PINCH keyword we have bolted on a
73 limited support for global storage. By setting .global = true in the
74 keyword_info describing the keyword you get:
75
76 1. Normal deck assignment like
77
78 MULTZ
79 ..... /
80
81 2. Scalar operations like EQUALS and MULTIPLY.
82
83 These operations also support the full details of the BOX behavior.
84
85 The following operations do not work
86 ------------------------------------
87
88 1. Operations involving multiple keywords like
89
90 COPY
91 MULTX MULTZ /
92 /
93
94 this also includes the OPERATE which involves multiple keywords for some
95 of its operations.
96
97 2. All region operatins like EQUALREG and MULTREG.
98
99 The operations which are not properly implemented will be intercepted and a
100 std::logic_error() exception will be thrown.
101*/
102
103
104
105inline bool isFipxxx(const std::string& keyword) {
106 // FIPxxxx can be any keyword, e.g. FIPREG or FIPXYZ that has the pattern "FIP.+"
107 // However, it can not be FIPOWG as that is an actual keyword.
108 if (keyword.size() < 4 || keyword == "FIPOWG") {
109 return false;
110 }
111 return keyword[0] == 'F' && keyword[1] == 'I' && keyword[2] == 'P';
112}
113
114
115/*
116 The aliased_keywords map defines aliases for other keywords. The FieldProps
117 objects will translate those keywords before further processing. The aliases
118 will also be exposed by the FieldPropsManager object.
119
120 However, the following methods of FieldProps do not fully support aliases:
121 - FieldProps::keys() does not return the aliases.
122 - FieldProps::erase() and FieldProps::extract() do not support aliases. Using
123 them with an aliased keyword will also remove the alias.
124
125 Note that the aliases are also added to GRID::double_keywords.
126
127 The PERMR and PERMTHT keywords are aliases for PERMX and PERMY, respectively.
128*/
129namespace ALIAS {
130 static const std::unordered_map<std::string, std::string> aliased_keywords = {{"PERMR", "PERMX"},
131 {"PERMTHT", "PERMY"}};
132}
133
134
135namespace GRID {
136static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"DISPERC",keyword_info<double>{}.unit_string("Length")},
137 {"MINPVV", keyword_info<double>{}.init(0.0).unit_string("ReservoirVolume").global_kw(true)},
138 {"MULTPV", keyword_info<double>{}.init(1.0).mult(true)},
139 {"NTG", keyword_info<double>{}.init(1.0)},
140 {"PORO", keyword_info<double>{}.distribute_top(true)},
141 {"PERMX", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
142 {"PERMY", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
143 {"PERMZ", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
144 {"PERMR", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
145 {"PERMTHT", keyword_info<double>{}.unit_string("Permeability").distribute_top(true).global_kw_until_edit()},
146 {"TEMPI", keyword_info<double>{}.unit_string("Temperature")},
147 {"THCONR", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
148 {"THCONSF", keyword_info<double>{}},
149 {"HEATCR", keyword_info<double>{}.unit_string("Energy/ReservoirVolume*AbsoluteTemperature")},
150 {"HEATCRT", keyword_info<double>{}.unit_string("Energy/ReservoirVolume*AbsoluteTemperature*AbsoluteTemperature")},
151 {"THCROCK", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
152 {"THCOIL", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
153 {"THCGAS", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
154 {"THCWATER",keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
155 {"YMODULE", keyword_info<double>{}.unit_string("Ymodule")},
156 {"CSTRESS", keyword_info<double>{}.unit_string("1")},
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("Concentration")},
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("Concentration")},
277 {"SOXYG", keyword_info<double>{}.unit_string("Concentration")},
278 {"SUREA", keyword_info<double>{}.unit_string("Concentration")},
279 {"SBIOF", keyword_info<double>{}},
280 {"SCALC", keyword_info<double>{}},
281 {"SALTP", keyword_info<double>{}},
282 {"SALT", keyword_info<double>{}.unit_string("Concentration")},
283 {"TEMPI", keyword_info<double>{}.unit_string("Temperature")},
284 {"RS", keyword_info<double>{}.unit_string("GasDissolutionFactor")},
285 {"RSW", keyword_info<double>{}.unit_string("GasDissolutionFactor")},
286 {"RV", keyword_info<double>{}.unit_string("OilDissolutionFactor")},
287 {"RVW", keyword_info<double>{}.unit_string("OilDissolutionFactor")}
288 };
289
290static const std::unordered_map<std::string, keyword_info<double>> composition_keywords = {{"XMF", keyword_info<double>{}},
291 {"YMF", keyword_info<double>{}},
292 {"ZMF", keyword_info<double>{}},
293 };
294}
295
296namespace SCHEDULE {
297
298static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"MULTX", keyword_info<double>{}.init(1.0).mult(true)},
299 {"MULTX-", keyword_info<double>{}.init(1.0).mult(true)},
300 {"MULTY", keyword_info<double>{}.init(1.0).mult(true)},
301 {"MULTY-", keyword_info<double>{}.init(1.0).mult(true)},
302 {"MULTZ", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)},
303 {"MULTZ-", keyword_info<double>{}.init(1.0).mult(true).global_kw(true)}};
304
305static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {{"ROCKNUM", keyword_info<int>{}}};
306
307}
308
309template <typename T>
310keyword_info<T> global_kw_info(const std::string& name, bool allow_unsupported = false);
311
312bool is_oper_keyword(const std::string& name);
313} // end namespace keywords
314
315} // end namespace Fieldprops
316
318public:
319
320 using ScalarOperation = Fieldprops::ScalarOperation;
321
322 struct MultregpRecord {
323 int region_value;
324 double multiplier;
325 std::string region_name;
326
327
328 MultregpRecord(int rv, double m, const std::string& rn) :
329 region_value(rv),
330 multiplier(m),
331 region_name(rn)
332 {}
333
334
335 bool operator==(const MultregpRecord& other) const {
336 return this->region_value == other.region_value &&
337 this->multiplier == other.multiplier &&
338 this->region_name == other.region_name;
339 }
340 };
341
343 enum class GetStatus {
345 OK = 1,
346
355
361
372 };
373
377 template<typename T>
379 {
381 const std::string& keyword;
382
385
388
394 FieldDataManager(const std::string& k, GetStatus s, const Fieldprops::FieldData<T>* d)
395 : keyword(k)
396 , status(s)
397 , data_ptr(d)
398 {}
399
413 const std::string& descr,
414 const std::string& operation) const
415 {
416 switch (this->status) {
418 return;
419
421 throw OpmInputError {
422 descr + " " + this->keyword +
423 " is not fully initialised for " + operation,
424 loc
425 };
426
428 throw OpmInputError {
429 descr + " " + this->keyword +
430 " does not exist in input deck for " + operation,
431 loc
432 };
433
435 throw OpmInputError {
436 descr + " " + this->keyword +
437 " is not supported for " + operation,
438 loc
439 };
440 }
441 }
442
448 void verify_status() const
449 {
450 switch (status) {
452 return;
453
455 throw std::runtime_error("The keyword: " + keyword + " has not been fully initialized");
456
458 throw std::out_of_range("No such keyword in deck: " + keyword);
459
461 throw std::logic_error("The keyword " + keyword + " is not supported");
462 }
463 }
464
468 const std::vector<T>* ptr() const
469 {
470 return (this->data_ptr != nullptr)
471 ? &this->data_ptr->data
472 : nullptr;
473 }
474
479 const std::vector<T>& data() const
480 {
481 this->verify_status();
482 return this->data_ptr->data;
483 }
484
490 {
491 this->verify_status();
492 return *this->data_ptr;
493 }
494
499 bool valid() const
500 {
501 return this->status == GetStatus::OK;
502 }
503 };
504
516 enum TryGetFlags : unsigned int {
519 AllowUnsupported = (1u << 0),
520
522 MustExist = (1u << 1),
523 };
524
526 FieldProps(const Deck& deck,
527 const Phases& phases,
528 EclipseGrid& grid,
529 const TableManager& table_arg,
530 const std::size_t ncomps);
531
533 FieldProps(const Deck& deck, const EclipseGrid& grid);
534
535 void reset_actnum(const std::vector<int>& actnum);
536
537 void prune_global_for_schedule_run();
538
539 void apply_numerical_aquifers(const NumericalAquifers& numerical_aquifers);
540
541 const std::string& default_region() const;
542
543 std::vector<int> actnum();
544 const std::vector<int>& actnumRaw() const;
545
546 template <typename T>
547 static bool supported(const std::string& keyword);
548
549 template <typename T>
550 bool has(const std::string& keyword) const;
551
552 template <typename T>
553 std::vector<std::string> keys() const;
554
567 template <typename T>
568 FieldDataManager<T>
569 try_get(const std::string& keyword, const unsigned int flags = 0u)
570 {
571 const auto allow_unsupported =
572 (flags & TryGetFlags::AllowUnsupported) != 0u;
573
574 if (!allow_unsupported && !FieldProps::template supported<T>(keyword)) {
575 return { keyword, GetStatus::NOT_SUPPPORTED_KEYWORD, nullptr };
576 }
577
578 const auto has0 = this->template has<T>(keyword);
579 if (!has0 && ((flags & TryGetFlags::MustExist) != 0)) {
580 // Client requested a property which must exist, e.g., as a
581 // source array for a COPY operation, but the property has not
582 // (yet) been defined in the run's input.
583 return { keyword, GetStatus::MISSING_KEYWORD, nullptr };
584 }
585
586 const auto& field_data = this->template
587 init_get<T>(keyword, std::is_same_v<T, double> && allow_unsupported);
588
589 if (field_data.valid() || allow_unsupported) {
590 // Note: FieldDataManager depends on init_get<>() producing a
591 // long-lived FieldData instance.
592 return { keyword, GetStatus::OK, &field_data };
593 }
594
595 if (! has0) {
596 // Client requested a property which did not exist and which
597 // could not be created from a default description.
598 this->template erase<T>(keyword);
599
600 return { keyword, GetStatus::MISSING_KEYWORD, nullptr };
601 }
602
603 // If we get here then the property exists but has not been fully
604 // defined yet.
605 return { keyword, GetStatus::INVALID_DATA, nullptr };
606 }
607
608 template <typename T>
609 const std::vector<T>& get(const std::string& keyword)
610 {
611 return this->template try_get<T>(keyword).data();
612 }
613
614 template <typename T>
615 std::vector<T> get_global(const std::string& keyword)
616 {
617 const auto managed_field_data = this->template try_get<T>(keyword);
618 const auto& field_data = managed_field_data.field_data();
619
620 const auto& kw_info = Fieldprops::keywords::
621 template global_kw_info<T>(keyword);
622
623 return kw_info.global
624 ? *field_data.global_data
625 : this->global_copy(field_data.data, kw_info.scalar_init);
626 }
627
628 template <typename T>
629 std::vector<T> get_copy(const std::string& keyword, bool global)
630 {
631 const auto has0 = this->template has<T>(keyword);
632
633 // Recall: FieldDataManager::field_data() will throw various
634 // exception types if the 'status' is anything other than 'OK'.
635 //
636 // Get_copy() depends on this behaviour to not proceed to extracting
637 // values in such cases. In other words, get_copy() uses exceptions
638 // for control flow, and we cannot move this try_get() call into the
639 // 'has0' branch even though the actual 'field_data' object returned
640 // from try_get() is only needed/used there.
641 const auto& field_data = this->template try_get<T>(keyword).field_data();
642
643 if (has0) {
644 return this->get_copy(field_data.data, field_data.kw_info.scalar_init, global);
645 }
646
647 const auto initial_value = Fieldprops::keywords::
648 template global_kw_info<T>(keyword).scalar_init;
649
650 return this->get_copy(this->template extract<T>(keyword), initial_value, global);
651 }
652
653 template <typename T>
654 std::vector<bool> defaulted(const std::string& keyword)
655 {
656 const auto& field = this->template init_get<T>(keyword);
657 std::vector<bool> def(field.numCells());
658
659 for (std::size_t i = 0; i < def.size(); ++i) {
660 def[i] = value::defaulted(field.value_status[i]);
661 }
662
663 return def;
664 }
665
666 template <typename T>
667 std::vector<T> global_copy(const std::vector<T>& data,
668 const std::optional<T>& default_value) const
669 {
670 const T fill_value = default_value.has_value() ? *default_value : 0;
671
672 std::vector<T> global_data(this->global_size, fill_value);
673
674 std::size_t i = 0;
675 for (std::size_t g = 0; g < this->global_size; g++) {
676 if (this->m_actnum[g]) {
677 global_data[g] = data[i];
678 ++i;
679 }
680 }
681
682 return global_data;
683 }
684
685 std::size_t active_size;
686 std::size_t global_size;
687
688 void handle_schedule_keywords(const std::vector<DeckKeyword>& keywords);
689 bool tran_active(const std::string& keyword) const;
690 void apply_tran(const std::string& keyword, std::vector<double>& data);
691 void apply_tranz_global(const std::vector<size_t>& indices, std::vector<double>& data) const;
692 bool operator==(const FieldProps& other) const;
693 static bool rst_cmp(const FieldProps& full_arg, const FieldProps& rst_arg);
694
695 const std::unordered_map<std::string,Fieldprops::TranCalculator>& getTran() const
696 {
697 return tran;
698 }
699
700 std::vector<std::string> fip_regions() const;
701
702 void deleteMINPVV();
703
704 void set_active_indices(const std::vector<int>& indices);
705
706private:
707 void processMULTREGP(const Deck& deck);
708 void scanGRIDSection(const GRIDSection& grid_section);
709 void scanGRIDSectionOnlyACTNUM(const GRIDSection& grid_section);
710 void scanEDITSection(const EDITSection& edit_section);
711 void scanPROPSSection(const PROPSSection& props_section);
712 void scanREGIONSSection(const REGIONSSection& regions_section);
713 void scanSOLUTIONSection(const SOLUTIONSection& solution_section, const std::size_t ncomps);
714 double getSIValue(const std::string& keyword, double raw_value) const;
715 double getSIValue(ScalarOperation op, const std::string& keyword, double raw_value) const;
716
717 template <typename T>
718 void erase(const std::string& keyword);
719
720 template <typename T>
721 std::vector<T> extract(const std::string& keyword);
722
723 template <typename T>
724 std::vector<T> get_copy(const std::vector<T>& x,
725 const std::optional<T>& initial_value,
726 const bool global) const
727 {
728 return (! global) ? x : this->global_copy(x, initial_value);
729 }
730
731 template <typename T>
732 std::vector<T> get_copy(std::vector<T>&& x,
733 const std::optional<T>& initial_value,
734 const bool global) const
735 {
736 return (! global) ? std::move(x) : this->global_copy(x, initial_value);
737 }
738
739 template <typename T>
740 void operate(const DeckRecord& record,
741 Fieldprops::FieldData<T>& target_data,
742 const Fieldprops::FieldData<T>& src_data,
743 const std::vector<Box::cell_index>& index_list,
744 const bool global = false);
745
746 template <typename T>
747 Fieldprops::FieldData<T>&
748 init_get(const std::string& keyword, bool allow_unsupported = false);
749
750 template <typename T>
751 Fieldprops::FieldData<T>&
752 init_get(const std::string& keyword,
753 const Fieldprops::keywords::keyword_info<T>& kw_info,
754 const bool multiplier_in_edit = false);
755
756 std::string region_name(const DeckItem& region_item) const;
757
758 std::pair<std::vector<Box::cell_index>,bool>
759 region_index(const std::string& region_name, int region_value);
760
761 void handle_OPERATE(const DeckKeyword& keyword, Box box);
762 void handle_operation(Section section, const DeckKeyword& keyword, Box box);
763 void handle_operateR(const DeckKeyword& keyword);
764 void handle_region_operation(const DeckKeyword& keyword);
765 void handle_COPY(const DeckKeyword& keyword, Box box, bool region);
766 void distribute_toplayer(Fieldprops::FieldData<double>& field_data,
767 const std::vector<double>& deck_data,
768 const Box& box);
769
770 void handle_keyword(Section section, const DeckKeyword& keyword, Box& box);
771 void handle_double_keyword(Section section,
772 const Fieldprops::keywords::keyword_info<double>& kw_info,
773 const DeckKeyword& keyword,
774 const std::string& keyword_name,
775 const Box& box);
776
777 void handle_double_keyword(Section section,
778 const Fieldprops::keywords::keyword_info<double>& kw_info,
779 const DeckKeyword& keyword,
780 const Box& box);
781
782 void handle_int_keyword(const Fieldprops::keywords::keyword_info<int>& kw_info,
783 const DeckKeyword& keyword,
784 const Box& box);
785
786 void init_satfunc(const std::string& keyword, Fieldprops::FieldData<double>& satfunc);
787 void init_porv(Fieldprops::FieldData<double>& porv);
788 void init_tempi(Fieldprops::FieldData<double>& tempi);
789
790 std::string canonical_fipreg_name(const std::string& fipreg);
791 const std::string& canonical_fipreg_name(const std::string& fipreg) const;
792
798 void apply_multipliers();
799
800 static constexpr std::string_view getMultiplierPrefix()
801 {
802 using namespace std::literals;
803 return "__MULT__"sv;
804 }
805
806 const UnitSystem unit_system;
807 std::size_t nx,ny,nz;
808 Phases m_phases;
809 SatFuncControls m_satfuncctrl;
810 std::vector<int> m_actnum;
811 std::unordered_map<int,int> m_active_index;
812 std::vector<double> cell_volume;
813 std::vector<double> cell_depth;
814 const std::string m_default_region;
815 const EclipseGrid * grid_ptr; // A bit undecided whether to properly use the grid or not ...
816 TableManager tables;
817 std::optional<satfunc::RawTableEndPoints> m_rtep;
818 std::vector<MultregpRecord> multregp;
819 std::unordered_map<std::string, Fieldprops::FieldData<int>> int_data;
820 std::unordered_map<std::string, Fieldprops::FieldData<double>> double_data;
821 std::unordered_map<std::string, std::string> fipreg_shortname_translation{};
822
823 std::unordered_map<std::string,Fieldprops::TranCalculator> tran;
824
830 std::unordered_map<std::string,Fieldprops::keywords::keyword_info<double>> multiplier_kw_infos_;
831};
832
833}
834#endif
Definition Deck.hpp:46
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition EclipseGrid.hpp:61
FieldDataManager< T > try_get(const std::string &keyword, const unsigned int flags=0u)
Request read-only property array from internal cache.
Definition FieldProps.hpp:569
TryGetFlags
Options to restrict or relax a try_get() request.
Definition FieldProps.hpp:516
@ AllowUnsupported
Whether or not to permit looking up property names of unmatching types.
Definition FieldProps.hpp:519
@ MustExist
Whether or not the property must already exist.
Definition FieldProps.hpp:522
GetStatus
Property array existence status.
Definition FieldProps.hpp:343
@ NOT_SUPPPORTED_KEYWORD
Named property is not known to the internal handling mechanism.
Definition FieldProps.hpp:371
@ MISSING_KEYWORD
Property has not yet been defined in the input file.
Definition FieldProps.hpp:360
@ OK
Property exists and its property data is fully defined.
Definition FieldProps.hpp:345
@ INVALID_DATA
Property array has not been fully initialised.
Definition FieldProps.hpp:354
FieldProps(const Deck &deck, const Phases &phases, EclipseGrid &grid, const TableManager &table_arg, const std::size_t ncomps)
Normal constructor for FieldProps.
Definition FieldProps.cpp:837
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
bool has(const std::string &name) const
This method checks if there is something with name name in the parameter gropup.
T get(const std::string &name) const
This method is used to read a parameter from the parameter group.
FieldDataManager(const std::string &k, GetStatus s, const Fieldprops::FieldData< T > *d)
Constructor.
Definition FieldProps.hpp:394
GetStatus status
Request status.
Definition FieldProps.hpp:384
const Fieldprops::FieldData< T > & field_data() const
Read-only access to contained FieldData object.
Definition FieldProps.hpp:489
const std::vector< T > * ptr() const
Access underlying property data elements.
Definition FieldProps.hpp:468
const Fieldprops::FieldData< T > * data_ptr
Property data.
Definition FieldProps.hpp:387
void verify_status(const KeywordLocation &loc, const std::string &descr, const std::string &operation) const
Validate result of.
Definition FieldProps.hpp:412
void verify_status() const
Validate result of.
Definition FieldProps.hpp:448
bool valid() const
Property validity predicate.
Definition FieldProps.hpp:499
const std::vector< T > & data() const
Access underlying property data elements.
Definition FieldProps.hpp:479
const std::string & keyword
Property name.
Definition FieldProps.hpp:381
Definition FieldData.hpp:72
Definition Keywords.hpp:31