My Project
TracerConfig.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_TRACER_CONFIG_HPP
21 #define OPM_TRACER_CONFIG_HPP
22 
23 #include <opm/input/eclipse/EclipseState/Runspec.hpp>
25 
26 namespace Opm {
27 
28 class Deck;
29 class UnitSystem;
30 
31 class TracerConfig {
32 public:
33  struct TracerEntry {
34  std::string name;
35  std::string unit_string;
36  Phase phase = Phase::OIL;
37  std::optional<std::vector<double>> free_concentration;
38  std::optional<std::vector<double>> solution_concentration;
39  std::optional<TracerVdTable> free_tvdp;
40  std::optional<TracerVdTable> solution_tvdp;
41  std::string fname() const {
42  return this->name + "F";
43  }
44 
45 
46  TracerEntry() = default;
47  TracerEntry(const std::string& name_, const std::string& unit_string_,
48  Phase phase_, std::vector<double> free_concentration_)
49  : name(name_)
50  , unit_string(unit_string_)
51  , phase(phase_)
52  , free_concentration(std::move(free_concentration_))
53  {}
54 
55  TracerEntry(const std::string& name_, const std::string& unit_string_,
56  Phase phase_, std::vector<double> free_concentration_, std::vector<double> solution_concentration_)
57  : name(name_)
58  , unit_string(unit_string_)
59  , phase(phase_)
60  , free_concentration(std::move(free_concentration_))
61  , solution_concentration(std::move(solution_concentration_))
62  {}
63 
64  TracerEntry(const std::string& name_, const std::string& unit_string_,
65  Phase phase_, TracerVdTable free_tvdp_)
66  : name(name_)
67  , unit_string(unit_string_)
68  , phase(phase_)
69  , free_tvdp(std::move(free_tvdp_))
70  {}
71 
72  TracerEntry(const std::string& name_, const std::string& unit_string_,
73  Phase phase_, TracerVdTable free_tvdp_, TracerVdTable solution_tvdp_)
74  : name(name_)
75  , unit_string(unit_string_)
76  , phase(phase_)
77  , free_tvdp(std::move(free_tvdp_))
78  , solution_tvdp(std::move(solution_tvdp_))
79  {}
80 
81  TracerEntry(const std::string& name_, const std::string& unit_string_, Phase phase_)
82  : name(name_)
83  , unit_string(unit_string_)
84  , phase(phase_)
85  {}
86 
87  bool operator==(const TracerEntry& data) const {
88  return this->name == data.name &&
89  this->unit_string == data.unit_string &&
90  this->phase == data.phase &&
91  this->free_concentration == data.free_concentration &&
92  this->solution_concentration == data.solution_concentration &&
93  this->free_tvdp == data.free_tvdp &&
94  this->solution_tvdp == data.solution_tvdp;
95  }
96 
97  template<class Serializer>
98  void serializeOp(Serializer& serializer)
99  {
100  serializer(name);
101  serializer(unit_string);
102  serializer(phase);
103  serializer(free_concentration);
104  serializer(solution_concentration);
105  serializer(this->free_tvdp);
106  serializer(this->solution_tvdp);
107  }
108  };
109 
110  TracerConfig() = default;
111  TracerConfig(const UnitSystem& unit_system, const Deck& deck);
112 
113  static TracerConfig serializeObject();
114 
115  size_t size() const;
116  bool empty() const;
117 
118  const std::vector<TracerEntry>::const_iterator begin() const;
119  const std::vector<TracerEntry>::const_iterator end() const;
120  const TracerEntry& operator[](const std::string& name) const;
121  const TracerEntry& operator[](std::size_t index) const;
122 
123  template<class Serializer>
124  void serializeOp(Serializer& serializer)
125  {
126  serializer.vector(tracers);
127  }
128 
129  bool operator==(const TracerConfig& data) const;
130 
131  std::string get_unit_string(const UnitSystem& unit_system, const std::string & tracer_kw) const;
132 
133 private:
134  std::vector<TracerEntry> tracers;
135 };
136 
137 }
138 
139 #endif
A class that contains tracer concentration vs depth table.
Definition: Deck.hpp:63
Definition: Serializer.hpp:38
Definition: TracerConfig.hpp:31
A class that contains tracer concentration vs depth table.
Definition: TracerVdTable.hpp:35
Definition: UnitSystem.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: TracerConfig.hpp:33