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 {
89public:
90
91 struct BCFace {
92 int index;
93 BCType bctype;
94 BCMECHType bcmechtype;
95 BCComponent component;
96 double rate;
97 std::optional<double> pressure;
98 std::optional<double> temperature;
99
100 std::optional<MechBCValue> mechbcvalue;
101
102 BCFace() = default;
103 explicit BCFace(const DeckRecord& record);
104
105 static BCFace serializationTestObject();
106
107 bool operator==(const BCFace& other) const;
108
109 template<class Serializer>
110 void serializeOp(Serializer& serializer)
111 {
112 serializer(index);
113 serializer(bctype);
114 serializer(bcmechtype);
115 serializer(component);
116 serializer(rate);
117 serializer(pressure);
118 serializer(temperature);
119 serializer(mechbcvalue);
120 }
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:88
Definition DeckRecord.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:84
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition BCProp.hpp:91
Definition BCProp.hpp:60