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/parser/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::vector<double> free_concentration;
38  std::vector<double> solution_concentration;
39  TracerVdTable free_tvdp;
40  TracerVdTable solution_tvdp;
41 
42  TracerEntry() = default;
43  TracerEntry(const std::string& name_, const std::string& unit_string_,
44  Phase phase_, std::vector<double> free_concentration_)
45  : name(name_)
46  , unit_string(unit_string_)
47  , phase(phase_)
48  , free_concentration(std::move(free_concentration_))
49  {}
50 
51  TracerEntry(const std::string& name_, const std::string& unit_string_,
52  Phase phase_, std::vector<double> free_concentration_, std::vector<double> solution_concentration_)
53  : name(name_)
54  , unit_string(unit_string_)
55  , phase(phase_)
56  , free_concentration(std::move(free_concentration_))
57  , solution_concentration(std::move(solution_concentration_))
58  {}
59 
60  TracerEntry(const std::string& name_, const std::string& unit_string_,
61  Phase phase_, TracerVdTable free_tvdp_)
62  : name(name_)
63  , unit_string(unit_string_)
64  , phase(phase_)
65  , free_tvdp(std::move(free_tvdp_))
66  {}
67 
68  TracerEntry(const std::string& name_, const std::string& unit_string_,
69  Phase phase_, TracerVdTable free_tvdp_, TracerVdTable solution_tvdp_)
70  : name(name_)
71  , unit_string(unit_string_)
72  , phase(phase_)
73  , free_tvdp(std::move(free_tvdp_))
74  , solution_tvdp(std::move(solution_tvdp_))
75  {}
76 
77  bool operator==(const TracerEntry& data) const {
78  return this->name == data.name &&
79  this->unit_string == data.unit_string &&
80  this->phase == data.phase &&
81  this->free_concentration == data.free_concentration &&
82  this->solution_concentration == data.solution_concentration &&
83  this->free_tvdp == data.free_tvdp &&
84  this->solution_tvdp == data.solution_tvdp;
85  }
86 
87  template<class Serializer>
88  void serializeOp(Serializer& serializer)
89  {
90  serializer(name);
91  serializer(unit_string);
92  serializer(phase);
93  serializer(free_concentration);
94  serializer(solution_concentration);
95  free_tvdp.serializeOp(serializer);
96  solution_tvdp.serializeOp(serializer);
97  }
98  };
99 
100  TracerConfig() = default;
101  TracerConfig(const UnitSystem& unit_system, const Deck& deck);
102 
103  static TracerConfig serializeObject();
104 
105  size_t size() const;
106 
107  const std::vector<TracerEntry>::const_iterator begin() const;
108  const std::vector<TracerEntry>::const_iterator end() const;
109 
110  template<class Serializer>
111  void serializeOp(Serializer& serializer)
112  {
113  serializer.vector(tracers);
114  }
115 
116  bool operator==(const TracerConfig& data) const;
117 
118  std::string get_unit_string(const UnitSystem& unit_system, const std::string & tracer_kw) const;
119 
120 private:
121  std::vector<TracerEntry> tracers;
122 };
123 
124 }
125 
126 #endif
A class that contains tracer concentration vs depth table.
Definition: Deck.hpp:119
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