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