My Project
Loading...
Searching...
No Matches
Source.hpp
1/*
2 Copyright 2023 Equinor ASA.
3 Copyright 2023 Norce.
4
5 This file is part of the Open Porous Media project (OPM).
6
7 OPM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 OPM is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef OPM_SOURCE_PROP_HPP
22#define OPM_SOURCE_PROP_HPP
23
24#include <array>
25#include <vector>
26#include <cstddef>
27#include <optional>
28#include <map>
29
30namespace Opm {
31
32class Deck;
33class DeckRecord;
34
35enum class SourceComponent {
36 OIL,
37 GAS,
38 WATER,
39 SOLVENT,
40 POLYMER,
41 MICR,
42 OXYG,
43 UREA,
44 NONE
45};
46
47class Source
48{
49public:
51 {
52 SourceComponent component{SourceComponent::NONE};
53 double rate{};
54 std::optional<double> hrate{};
55 std::optional<double> temperature{};
56
57 SourceCell() = default;
58 explicit SourceCell(const DeckRecord& record);
59
60 static SourceCell serializationTestObject();
61
62 bool operator==(const SourceCell& other) const;
63
64 template<class Serializer>
65 void serializeOp(Serializer& serializer)
66 {
67 serializer(component);
68 serializer(rate);
69 serializer(hrate);
70 serializer(temperature);
71 }
72 };
73
74 Source() = default;
75
76 static Source serializationTestObject();
77
78 std::size_t size() const;
79 std::map<std::array<int, 3>, std::vector<SourceCell>>::const_iterator begin() const;
80 std::map<std::array<int, 3>, std::vector<SourceCell>>::const_iterator end() const;
81 bool operator==(const Source& other) const;
82
83 double rate(const std::array<int, 3>& ijk, SourceComponent input ) const;
84 std::optional<double> hrate(const std::array<int, 3>& ijk, SourceComponent input ) const;
85 std::optional<double> temperature(const std::array<int, 3>& ijk, SourceComponent input) const;
86 bool hasSource(const std::array<int, 3>& input) const;
87
88 void updateSource(const DeckRecord& record);
89
90 template<class Serializer>
91 void serializeOp(Serializer& serializer)
92 {
93 serializer(m_cells);
94 }
95
96private:
97 std::map<std::array<int, 3>, std::vector<SourceCell>> m_cells;
98};
99
100} // namespace Opm
101
102#endif
Definition DeckRecord.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:94
Definition Source.hpp:48
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition Source.hpp:51