opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
GuideRateConfig.hpp
1
/*
2
Copyright 2019 Equinor ASA.
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 GUIDE_RATE_CONFIG_HPP
21
#define GUIDE_RATE_CONFIG_HPP
22
23
#include <optional>
24
#include <string>
25
#include <unordered_map>
26
#include <utility>
27
28
#include <opm/input/eclipse/Schedule/Group/GuideRateModel.hpp>
29
#include <opm/input/eclipse/Schedule/Group/Group.hpp>
30
#include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
31
32
namespace
Opm
{
33
34
class
Well
;
35
36
class
GuideRateConfig
{
37
public
:
38
39
struct
WellTarget
{
40
double
guide_rate;
41
WellGuideRateTarget target;
42
double
scaling_factor;
43
44
bool
operator==(
const
WellTarget
& data)
const
{
45
return
guide_rate == data.guide_rate &&
46
target == data.target &&
47
scaling_factor == data.scaling_factor;
48
}
49
50
template
<
class
Serializer>
51
void
serializeOp(
Serializer
& serializer)
52
{
53
serializer(guide_rate);
54
serializer(target);
55
serializer(scaling_factor);
56
}
57
};
58
59
struct
GroupProdTarget
{
60
double
guide_rate;
61
Group::GuideRateProdTarget target;
62
63
bool
operator==(
const
GroupProdTarget
& data)
const
{
64
return
guide_rate == data.guide_rate &&
65
target == data.target;
66
}
67
68
template
<
class
Serializer>
69
void
serializeOp(
Serializer
& serializer)
70
{
71
serializer(guide_rate);
72
serializer(target);
73
}
74
};
75
76
struct
GroupInjTarget
{
77
double
guide_rate;
78
Group::GuideRateInjTarget target;
79
80
bool
operator==(
const
GroupInjTarget
& data)
const
{
81
return
guide_rate == data.guide_rate &&
82
target == data.target;
83
}
84
85
template
<
class
Serializer>
86
void
serializeOp(
Serializer
& serializer)
87
{
88
serializer(guide_rate);
89
serializer(target);
90
}
91
};
92
93
static
GuideRateConfig
serializationTestObject();
94
95
const
GuideRateModel
& model()
const
;
96
bool
has_model()
const
;
97
bool
update_model(
const
GuideRateModel
& model);
98
void
update_well(
const
Well
& well);
99
void
update_injection_group(
const
std::string& group_name,
const
Group::GroupInjectionProperties
& properties);
100
void
update_production_group(
const
Group
& group);
101
const
WellTarget
& well(
const
std::string& well)
const
;
102
const
GroupProdTarget
& production_group(
const
std::string& group)
const
;
103
const
GroupInjTarget
& injection_group(
const
Phase& phase,
const
std::string& group)
const
;
104
105
bool
has_well(
const
std::string& well)
const
;
106
bool
has_injection_group(
const
Phase& phase,
const
std::string& group)
const
;
107
bool
has_production_group(
const
std::string& group)
const
;
108
109
bool
operator==(
const
GuideRateConfig
& data)
const
;
110
111
template
<
class
Serializer>
112
void
serializeOp(
Serializer
& serializer)
113
{
114
serializer(m_model);
115
serializer(wells);
116
serializer(production_groups);
117
serializer(injection_groups);
118
}
119
120
private
:
121
122
typedef
std::pair<Phase,std::string> pair;
123
124
struct
pair_hash
125
{
126
template
<
class
T1,
class
T2>
127
std::size_t operator() (
const
std::pair<T1, T2> &pair)
const
128
{
129
return
std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
130
}
131
};
132
133
std::optional<GuideRateModel> m_model;
134
std::unordered_map<std::string, WellTarget> wells;
135
std::unordered_map<std::string, GroupProdTarget> production_groups;
136
std::unordered_map<pair, GroupInjTarget, pair_hash> injection_groups;
137
138
};
139
140
}
141
142
#endif
Opm::Group
Definition
Group.hpp:50
Opm::GuideRateConfig
Definition
GuideRateConfig.hpp:36
Opm::GuideRateModel
Definition
GuideRateModel.hpp:30
Opm::Serializer
Class for (de-)serializing.
Definition
Serializer.hpp:94
Opm::Well
Definition
Well.hpp:77
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
Opm::Group::GroupInjectionProperties
Definition
Group.hpp:132
Opm::GuideRateConfig::GroupInjTarget
Definition
GuideRateConfig.hpp:76
Opm::GuideRateConfig::GroupProdTarget
Definition
GuideRateConfig.hpp:59
Opm::GuideRateConfig::WellTarget
Definition
GuideRateConfig.hpp:39
opm
input
eclipse
Schedule
Group
GuideRateConfig.hpp
Generated by
1.17.0