My Project
Loading...
Searching...
No Matches
Valve.hpp
1/*
2 Copyright 2019 Equinor.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef VALVE_HPP_HEADER_INCLUDED
21#define VALVE_HPP_HEADER_INCLUDED
22
23#include <map>
24#include <utility>
25#include <vector>
26#include <string>
27#include <optional>
28
29#include <opm/input/eclipse/Schedule/MSW/icd.hpp>
30#include <opm/input/eclipse/Deck/UDAValue.hpp>
31#include <opm/input/eclipse/Schedule/SummaryState.hpp>
32
33
34namespace Opm {
35
36 class DeckRecord;
37 class DeckKeyword;
38 class Segment;
39
40 struct ValveUDAEval {
41 const SummaryState& summary_state;
42 const std::string& well_name;
43 const size_t segment_number;
44
45 ValveUDAEval(const SummaryState& summary_state_,
46 const std::string& well_name_,
47 const size_t segment_number_);
48
49 double value(const UDAValue& value, const double udq_default = 0.0) const;
50 };
51
52
53 class Valve {
54 public:
55
56 Valve();
57 explicit Valve(const DeckRecord& record, const double udq_default = 0.0);
58 Valve(double conFlowCoeff,
59 double conCrossA,
60 double conMaxCrossA,
61 double pipeAddLength,
62 double pipeDiam,
63 double pipeRough,
64 double pipeCrossA,
65 ICDStatus stat);
66
67 static Valve serializationTestObject();
68
69 // the function will return a map
70 // [
71 // "WELL1" : [<seg1, valv1>, <seg2, valv2> ...]
72 // ....
73 static std::map<std::string, std::vector<std::pair<int, Valve> > > fromWSEGVALV(const DeckKeyword& keyword, const double udq_default = 0.0);
74
75 // parameters for constriction pressure loss
76 double conFlowCoefficient() const;
77 double conCrossArea(const std::optional<const ValveUDAEval>& uda_eval = std::nullopt) const;
78 inline double conCrossAreaValue() const { return m_con_cross_area_value; }
79 double conMaxCrossArea() const;
80 double pipeDiameter() const;
81 double pipeRoughness() const;
82 double pipeCrossArea() const;
83
84 // parameters for pressure loss along the pipe
85 double pipeAdditionalLength() const;
86
87 // Status: OPEN or SHUT
88 ICDStatus status() const;
89 int ecl_status() const;
90
91 void setConMaxCrossArea(const double area);
92
93 void setPipeAdditionalLength(const double length);
94 void setPipeDiameter(const double dia);
95 void setPipeRoughness(const double rou);
96 void setPipeCrossArea(const double area);
97
98 bool operator==(const Valve& data) const;
99
100 template<class Serializer>
101 void serializeOp(Serializer& serializer)
102 {
103 serializer(m_con_flow_coeff);
104 serializer(m_con_cross_area);
105 serializer(m_con_cross_area_value);
106 serializer(m_con_max_cross_area);
107 serializer(m_pipe_additional_length);
108 serializer(m_pipe_diameter);
109 serializer(m_pipe_roughness);
110 serializer(m_pipe_cross_area);
111 serializer(m_status);
112 serializer(m_udq_default);
113 }
114
115 private:
116 double m_con_flow_coeff;
117 UDAValue m_con_cross_area;
118 mutable double m_con_cross_area_value;
119 double m_con_max_cross_area;
120
121 double m_pipe_additional_length;
122 double m_pipe_diameter;
123 double m_pipe_roughness;
124 double m_pipe_cross_area;
125 ICDStatus m_status;
126
127 double m_udq_default{0.0};
128 };
129
130}
131
132#endif
Definition DeckKeyword.hpp:36
Definition DeckRecord.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition SummaryState.hpp:68
Definition UDAValue.hpp:32
Definition Valve.hpp:53
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition Valve.hpp:40