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 <vector>
25#include <cstddef>
26#include <optional>
27
28namespace Opm {
29
30class Deck;
31class DeckRecord;
32
33enum class SourceComponent {
34 OIL,
35 GAS,
36 WATER,
37 SOLVENT,
38 POLYMER,
39 NONE
40};
41
42class Source {
43public:
44
45 struct SourceCell {
46 std::array<int, 3> ijk;
47 SourceComponent component;
48 double rate;
49 std::optional<double> hrate;
50 std::optional<double> temperature;
51
52 SourceCell() = default;
53 explicit SourceCell(const DeckRecord& record);
54
55 static SourceCell serializationTestObject();
56
57 bool operator==(const SourceCell& other) const;
58 bool isSame(const SourceCell& other) const;
59 bool isSame(const std::pair<std::array<int, 3>, SourceComponent>& other) const;
60
61 template<class Serializer>
62 void serializeOp(Serializer& serializer)
63 {
64 serializer(ijk);
65 serializer(component);
66 serializer(rate);
67 serializer(hrate);
68 serializer(temperature);
69 }
70 };
71
72
73 Source() = default;
74
75 static Source serializationTestObject();
76
77 std::size_t size() const;
78 std::vector<SourceCell>::const_iterator begin() const;
79 std::vector<SourceCell>::const_iterator end() const;
80 bool operator==(const Source& other) const;
81
82 double rate(const std::pair<std::array<int, 3>, SourceComponent>& input ) const;
83 double hrate(const std::pair<std::array<int, 3>, SourceComponent>& input ) const;
84 double temperature(const std::pair<std::array<int, 3>, SourceComponent>& input) const;
85 bool hasHrate(const std::pair<std::array<int, 3>, SourceComponent>& input) const;
86 bool hasTemperature(const std::pair<std::array<int, 3>, SourceComponent>& input) const;
87 bool hasSource(const std::array<int, 3>& input) const;
88
89 void updateSource(const DeckRecord& record);
90
91 template<class Serializer>
92 void serializeOp(Serializer& serializer)
93 {
94 serializer(m_cells);
95 }
96
97private:
98 std::vector<SourceCell> m_cells;
99};
100
101} //namespace Opm
102
103#endif
Definition DeckRecord.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition Source.hpp:42
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition Source.hpp:45