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