opm-common
AquiferConfig.hpp
1 /*
2  Copyright (C) 2020 Equinor
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
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_AUQIFER_CONFIG_HPP
21 #define OPM_AUQIFER_CONFIG_HPP
22 
23 #include <opm/input/eclipse/EclipseState/Aquifer/Aquancon.hpp>
24 #include <opm/input/eclipse/EclipseState/Aquifer/Aquifetp.hpp>
25 #include <opm/input/eclipse/EclipseState/Aquifer/AquiferCT.hpp>
26 #include <opm/input/eclipse/EclipseState/Aquifer/AquiferFlux.hpp>
27 #include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquifers.hpp>
28 
29 #include <cstddef>
30 #include <string>
31 #include <unordered_set>
32 #include <vector>
33 
34 namespace Opm {
35  class TableManager;
36  class EclipseGrid;
37  class Deck;
38  class FieldPropsManager;
39 } // namespace Opm
40 
41 namespace Opm { namespace RestartIO {
42  class RstAquifer;
43 }} // namespace Opm::RestartIO
44 
45 namespace Opm {
46 
48  int aquifer_id{};
49  std::string tracer_name;
50  double concentration{};
51 
52  bool operator==(const AquiferTracerConcentration& other) const
53  {
54  return this->aquifer_id == other.aquifer_id
55  && this->tracer_name == other.tracer_name
56  && this->concentration == other.concentration;
57  }
58 
59  static AquiferTracerConcentration serializationTestObject()
60  {
61  return { 1, "WAQ", 1.0 };
62  }
63 
64  template<class Serializer>
65  void serializeOp(Serializer& serializer)
66  {
67  serializer(this->aquifer_id);
68  serializer(this->tracer_name);
69  serializer(this->concentration);
70  }
71 };
72 
74 public:
75 
76  AquiferConfig() = default;
77  AquiferConfig(const TableManager& tables, const EclipseGrid& grid,
78  const Deck& deck, const FieldPropsManager& field_props);
79  AquiferConfig(const Aquifetp& fetp, const AquiferCT& ct, const AquiferFlux& aqufluxs, const Aquancon& conn);
80  void load_connections(const Deck& deck, const EclipseGrid& grid);
81 
82  void pruneDeactivatedAquiferConnections(const std::vector<std::size_t>& deactivated_cells);
83  void loadFromRestart(const RestartIO::RstAquifer& aquifers,
84  const TableManager& tables);
85 
86  // there might be some aquifers (AQUFLUX only for now) are opened through
87  // SCHEDULE section while not specified in the SOLUTION section.
88  // We create dummy aquifers in the AquiferConfig to make sure we are aware of them
89  // when we handle the SUMMARY section.
90  // Since those aquifers are not active, basically we only need the id information
91  void appendAqufluxSchedule(const std::unordered_set<int>& ids);
92 
93  static AquiferConfig serializationTestObject();
94 
95  bool active() const;
96  const AquiferCT& ct() const;
97  const Aquifetp& fetp() const;
98  const AquiferFlux& aquflux() const;
99  const Aquancon& connections() const;
100  bool operator==(const AquiferConfig& other) const;
101  bool hasAquifer(const int aquID) const;
102  bool hasAnalyticalAquifer(const int aquID) const;
103 
104  bool hasNumericalAquifer() const;
105  bool hasAnalyticalAquifer() const;
106  const NumericalAquifers& numericalAquifers() const;
107  NumericalAquifers& mutableNumericalAquifers() const;
108  const std::vector<AquiferTracerConcentration>& aquiferTracers() const;
109 
110  template<class Serializer>
111  void serializeOp(Serializer& serializer)
112  {
113  serializer(aquifetp);
114  serializer(aquiferct);
115  serializer(aqconn);
116  serializer(aquiferflux);
117  serializer(numerical_aquifers);
118  serializer(aquifer_tracers_);
119  }
120 
121 private:
122  void loadAquiferTracers(const Deck& deck);
123  Aquifetp aquifetp{};
124  AquiferCT aquiferct{};
125  AquiferFlux aquiferflux{};
126  mutable NumericalAquifers numerical_aquifers{};
127  Aquancon aqconn{};
128  std::vector<AquiferTracerConcentration> aquifer_tracers_{};
129 };
130 
131 std::vector<int> analyticAquiferIDs(const AquiferConfig& cfg);
132 std::vector<int> numericAquiferIDs(const AquiferConfig& cfg);
133 }
134 
135 #endif
Definition: Aquancon.hpp:46
Definition: AquiferCT.hpp:45
Definition: FieldPropsManager.hpp:42
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:63
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: AquiferConfig.hpp:73
Definition: TableManager.hpp:71
Definition: aquifer.hpp:44
Definition: Aquifetp.hpp:45
Definition: AquiferConfig.hpp:47
Definition: Deck.hpp:46
Definition: AquiferFlux.hpp:71
Definition: NumericalAquifers.hpp:36
Class for (de-)serializing.
Definition: Serializer.hpp:95