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 {"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
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
354 INVALID_DATA = 2,
355
360 MISSING_KEYWORD = 3,
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 std::size_t num_int() const
689 {
690 return this->int_data.size();
691 }
692
693 std::size_t num_double() const
694 {
695 return this->double_data.size();
696 }
697
698 void handle_schedule_keywords(const std::vector<DeckKeyword>& keywords);
699 bool tran_active(const std::string& keyword) const;
700 void apply_tran(const std::string& keyword, std::vector<double>& data);
701 void apply_tranz_global(const std::vector<size_t>& indices, std::vector<double>& data) const;
702 bool operator==(const FieldProps& other) const;
703 static bool rst_cmp(const FieldProps& full_arg, const FieldProps& rst_arg);
704
705 const std::unordered_map<std::string,Fieldprops::TranCalculator>& getTran() const
706 {
707 return tran;
708 }
709
710 std::vector<std::string> fip_regions() const;
711
712 void deleteMINPVV();
713
714 void set_active_indices(const std::vector<int>& indices);
715
716private:
717 void processMULTREGP(const Deck& deck);
718 void scanGRIDSection(const GRIDSection& grid_section);
719 void scanGRIDSectionOnlyACTNUM(const GRIDSection& grid_section);
720 void scanEDITSection(const EDITSection& edit_section);
721 void scanPROPSSection(const PROPSSection& props_section);
722 void scanREGIONSSection(const REGIONSSection& regions_section);
723 void scanSOLUTIONSection(const SOLUTIONSection& solution_section, const std::size_t ncomps);
724 double getSIValue(const std::string& keyword, double raw_value) const;
725 double getSIValue(ScalarOperation op, const std::string& keyword, double raw_value) const;
726
727 template <typename T>
728 void erase(const std::string& keyword);
729
730 template <typename T>
731 std::vector<T> extract(const std::string& keyword);
732
733 template <typename T>
734 std::vector<T> get_copy(const std::vector<T>& x,
735 const std::optional<T>& initial_value,
736 const bool global) const
737 {
738 return (! global) ? x : this->global_copy(x, initial_value);
739 }
740
741 template <typename T>
742 std::vector<T> get_copy(std::vector<T>&& x,
743 const std::optional<T>& initial_value,
744 const bool global) const
745 {
746 return (! global) ? std::move(x) : this->global_copy(x, initial_value);
747 }
748
749 template <typename T>
750 void operate(const DeckRecord& record,
751 Fieldprops::FieldData<T>& target_data,
752 const Fieldprops::FieldData<T>& src_data,
753 const std::vector<Box::cell_index>& index_list,
754 const bool global = false);
755
756 template <typename T>
757 Fieldprops::FieldData<T>&
758 init_get(const std::string& keyword, bool allow_unsupported = false);
759
760 template <typename T>
761 Fieldprops::FieldData<T>&
762 init_get(const std::string& keyword,
763 const Fieldprops::keywords::keyword_info<T>& kw_info,
764 const bool multiplier_in_edit = false);
765
766 std::string region_name(const DeckItem& region_item) const;
767
768 std::pair<std::vector<Box::cell_index>,bool>
769 region_index(const std::string& region_name, int region_value);
770
771 void handle_OPERATE(const DeckKeyword& keyword, Box box);
772 void handle_operation(Section section, const DeckKeyword& keyword, Box box);
773 void handle_operateR(const DeckKeyword& keyword);
774 void handle_region_operation(const DeckKeyword& keyword);
775 void handle_COPY(const DeckKeyword& keyword, Box box, bool region);
776 void distribute_toplayer(Fieldprops::FieldData<double>& field_data,
777 const std::vector<double>& deck_data,
778 const Box& box);
779
780 double get_beta(const std::string& func_name, const std::string& target_array, double raw_beta);
781 double get_alpha(const std::string& func_name, const std::string& target_array, double raw_alpha);
782
783 void handle_keyword(Section section, const DeckKeyword& keyword, Box& box);
784 void handle_double_keyword(Section section,
785 const Fieldprops::keywords::keyword_info<double>& kw_info,
786 const DeckKeyword& keyword,
787 const std::string& keyword_name,
788 const Box& box);
789
790 void handle_double_keyword(Section section,
791 const Fieldprops::keywords::keyword_info<double>& kw_info,
792 const DeckKeyword& keyword,
793 const Box& box);
794
795 void handle_int_keyword(const Fieldprops::keywords::keyword_info<int>& kw_info,
796 const DeckKeyword& keyword,
797 const Box& box);
798
799 void init_satfunc(const std::string& keyword, Fieldprops::FieldData<double>& satfunc);
800 void init_porv(Fieldprops::FieldData<double>& porv);
801 void init_tempi(Fieldprops::FieldData<double>& tempi);
802
803 std::string canonical_fipreg_name(const std::string& fipreg);
804 const std::string& canonical_fipreg_name(const std::string& fipreg) const;
805
811 void apply_multipliers();
812
813 static constexpr std::string_view getMultiplierPrefix()
814 {
815 using namespace std::literals;
816 return "__MULT__"sv;
817 }
818
819 const UnitSystem unit_system;
820 std::size_t nx,ny,nz;
821 Phases m_phases;
822 SatFuncControls m_satfuncctrl;
823 std::vector<int> m_actnum;
824 std::unordered_map<int,int> m_active_index;
825 std::vector<double> cell_volume;
826 std::vector<double> cell_depth;
827 const std::string m_default_region;
828 const EclipseGrid * grid_ptr; // A bit undecided whether to properly use the grid or not ...
829 TableManager tables;
830 std::optional<satfunc::RawTableEndPoints> m_rtep;
831 std::vector<MultregpRecord> multregp;
832 std::unordered_map<std::string, Fieldprops::FieldData<int>> int_data;
833 std::unordered_map<std::string, Fieldprops::FieldData<double>> double_data;
834 std::unordered_map<std::string, std::string> fipreg_shortname_translation{};
835
836 std::unordered_map<std::string,Fieldprops::TranCalculator> tran;
837
843 std::unordered_map<std::string,Fieldprops::keywords::keyword_info<double>> multiplier_kw_infos_;
844};
845
846}
847#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:62
Definition FieldProps.hpp:317
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.
@ 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:379
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 FieldProps.hpp:322
Definition FieldData.hpp:72