My Project
Loading...
Searching...
No Matches
BCProp.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_BC_PROP_HPP
22#define OPM_BC_PROP_HPP
23
24#include <vector>
25#include <cstddef>
26#include <optional>
27
28#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
29#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
30
31namespace Opm {
32
33class Deck;
34class DeckRecord;
35
36enum class BCType {
37 RATE,
38 FREE,
39 DIRICHLET,
40 THERMAL,
41 CLOSED,
42 NONE
43};
44
45enum class BCMECHType {
46 FREE,
47 FIXED,
48 NONE
49};
50
51enum class BCComponent {
52 OIL,
53 GAS,
54 WATER,
55 SOLVENT,
56 POLYMER,
57 MICR,
58 OXYG,
59 UREA,
60 NONE
61};
62
64 std::array<double,3> disp{};
65 std::array<double,6> stress{};
66 std::array<bool,3> fixeddir{};
67
68 static MechBCValue serializationTestObject()
69 {
70 return MechBCValue{{1.0, 2.0, 3.0},
71 {3.0, 4.0, 5.0, 6.0, 7.0, 8.0},
72 {true, false, true}};
73 }
74
75 template<class Serializer>
76 void serializeOp(Serializer& serializer)
77 {
78 serializer(disp);
79 serializer(stress);
80 serializer(fixeddir);
81 }
82
83 bool operator==(const MechBCValue& other) const
84 {
85 return disp == other.disp &&
86 stress == other.stress &&
87 fixeddir == other.fixeddir;
88 }
89};
90
91class BCProp
92{
93public:
94 struct BCFace
95 {
96 int index{};
97 BCType bctype{BCType::NONE};
98 BCMECHType bcmechtype{BCMECHType::NONE};
99 BCComponent component{BCComponent::NONE};
100 double rate{};
101 std::optional<double> pressure{};
102 std::optional<double> temperature{};
103
104 std::optional<MechBCValue> mechbcvalue{};
105
106 BCFace() = default;
107 explicit BCFace(const DeckRecord& record);
108
109 static BCFace serializationTestObject();
110
111 bool operator==(const BCFace& other) const;
112
113 template<class Serializer>
114 void serializeOp(Serializer& serializer)
115 {
116 serializer(index);
117 serializer(bctype);
118 serializer(bcmechtype);
119 serializer(component);
120 serializer(rate);
121 serializer(pressure);
122 serializer(temperature);
123 serializer(mechbcvalue);
124 }
125 };
126
127 BCProp() = default;
128
129 static BCProp serializationTestObject();
130
131 std::size_t size() const;
132 std::vector<BCFace>::const_iterator begin() const;
133 std::vector<BCFace>::const_iterator end() const;
134 bool operator==(const BCProp& other) const;
135 const BCFace& operator[](int index) const;
136
137 void updateBCProp(const DeckRecord& record);
138
139 template<class Serializer>
140 void serializeOp(Serializer& serializer)
141 {
142 serializer(m_faces);
143 }
144
145private:
146 std::vector<BCFace> m_faces;
147};
148
149} // namespace Opm
150
151#endif
Definition BCProp.hpp:92
Definition DeckRecord.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:94
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition BCProp.hpp:95
Definition BCProp.hpp:63