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 NONE
58};
59
61 std::array<double,3> disp{};
62 std::array<double,6> stress{};
63 std::array<bool,3> fixeddir{};
64
65 static MechBCValue serializationTestObject()
66 {
67 return MechBCValue{{1.0, 2.0, 3.0},
68 {3.0, 4.0, 5.0, 6.0, 7.0, 8.0},
69 {true, false, true}};
70 }
71
72 template<class Serializer>
73 void serializeOp(Serializer& serializer)
74 {
75 serializer(disp);
76 serializer(stress);
77 serializer(fixeddir);
78 }
79
80 bool operator==(const MechBCValue& other) const
81 {
82 return disp == other.disp &&
83 stress == other.stress &&
84 fixeddir == other.fixeddir;
85 }
86};
87
88class BCProp
89{
90public:
91 struct BCFace
92 {
93 int index{};
94 BCType bctype{BCType::NONE};
95 BCMECHType bcmechtype{BCMECHType::NONE};
96 BCComponent component{BCComponent::NONE};
97 double rate{};
98 std::optional<double> pressure{};
99 std::optional<double> temperature{};
100
101 std::optional<MechBCValue> mechbcvalue{};
102
103 BCFace() = default;
104 explicit BCFace(const DeckRecord& record);
105
106 static BCFace serializationTestObject();
107
108 bool operator==(const BCFace& other) const;
109
110 template<class Serializer>
111 void serializeOp(Serializer& serializer)
112 {
113 serializer(index);
114 serializer(bctype);
115 serializer(bcmechtype);
116 serializer(component);
117 serializer(rate);
118 serializer(pressure);
119 serializer(temperature);
120 serializer(mechbcvalue);
121 }
122 };
123
124 BCProp() = default;
125
126 static BCProp serializationTestObject();
127
128 std::size_t size() const;
129 std::vector<BCFace>::const_iterator begin() const;
130 std::vector<BCFace>::const_iterator end() const;
131 bool operator==(const BCProp& other) const;
132 const BCFace& operator[](int index) const;
133
134 void updateBCProp(const DeckRecord& record);
135
136 template<class Serializer>
137 void serializeOp(Serializer& serializer)
138 {
139 serializer(m_faces);
140 }
141
142private:
143 std::vector<BCFace> m_faces;
144};
145
146} // namespace Opm
147
148#endif
Definition BCProp.hpp:89
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:92
Definition BCProp.hpp:60