GuideRate.hpp
Go to the documentation of this file.
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_HPP
21#define GUIDE_RATE_HPP
22
23#include <string>
24#include <cstddef>
25#include <ctime>
26#include <unordered_map>
27
31
32namespace Opm {
33
34class Schedule;
35class GuideRate {
36
37public:
38// used for potentials and well rates
39struct RateVector {
40 RateVector () = default;
41 RateVector (double orat, double grat, double wrat) :
42 oil_rat(orat),
43 gas_rat(grat),
44 wat_rat(wrat)
45 {}
46
47
48 double eval(Group::GuideRateTarget target) const;
49 double eval(Well::GuideRateTarget target) const;
50 double eval(GuideRateModel::Target target) const;
51
52
53 double oil_rat;
54 double gas_rat;
55 double wat_rat;
56};
57
58
59private:
60
61struct GuideRateValue {
62 GuideRateValue() = default;
63 GuideRateValue(double t, double v, GuideRateModel::Target tg):
64 sim_time(t),
65 value(v),
66 target(tg)
67 {}
68
69 bool operator==(const GuideRateValue& other) const {
70 return (this->sim_time == other.sim_time &&
71 this->value == other.value);
72 }
73
74 bool operator!=(const GuideRateValue& other) const {
75 return !(*this == other);
76 }
77
78 double sim_time;
79 double value;
81};
82
83
84public:
85 GuideRate(const Schedule& schedule);
86 void compute(const std::string& wgname, size_t report_step, double sim_time, double oil_pot, double gas_pot, double wat_pot);
87 double get(const std::string& well, Well::GuideRateTarget target, const RateVector& rates) const;
88 double get(const std::string& group, Group::GuideRateTarget target, const RateVector& rates) const;
89 double get(const std::string& name, GuideRateModel::Target model_target, const RateVector& rates) const;
90 bool has(const std::string& name) const;
91
92private:
93 void well_compute(const std::string& wgname, size_t report_step, double sim_time, double oil_pot, double gas_pot, double wat_pot);
94 void group_compute(const std::string& wgname, size_t report_step, double sim_time, double oil_pot, double gas_pot, double wat_pot);
95 double eval_form(const GuideRateModel& model, double oil_pot, double gas_pot, double wat_pot, const GuideRateValue * prev) const;
96 double eval_group_pot() const;
97 double eval_group_resvinj() const;
98
99 std::unordered_map<std::string, GuideRateValue> values;
100 std::unordered_map<std::string, RateVector > potentials;
101 const Schedule& schedule;
102};
103
104}
105
106#endif
const char *const name
Definition: cJSON.h:258
const char *const string
Definition: cJSON.h:170
GuideRateTarget
Definition: parser/eclipse/EclipseState/Schedule/Group/group.hpp:90
Definition: GuideRateModel.hpp:29
Target
Definition: GuideRateModel.hpp:32
Definition: GuideRate.hpp:35
double get(const std::string &name, GuideRateModel::Target model_target, const RateVector &rates) const
void compute(const std::string &wgname, size_t report_step, double sim_time, double oil_pot, double gas_pot, double wat_pot)
double get(const std::string &group, Group::GuideRateTarget target, const RateVector &rates) const
GuideRate(const Schedule &schedule)
double get(const std::string &well, Well::GuideRateTarget target, const RateVector &rates) const
bool has(const std::string &name) const
Definition: Schedule.hpp:113
GuideRateTarget
Definition: custom-opm-common/opm-common/opm/parser/eclipse/EclipseState/Schedule/Well/well.hpp:136
Definition: A.hpp:4
bool operator==(const SummaryConfigNode &lhs, const SummaryConfigNode &rhs)
bool operator!=(const SummaryConfigNode &lhs, const SummaryConfigNode &rhs)
Definition: SummaryConfig.hpp:96
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
Definition: GuideRate.hpp:39
double eval(Group::GuideRateTarget target) const
RateVector(double orat, double grat, double wrat)
Definition: GuideRate.hpp:41
double wat_rat
Definition: GuideRate.hpp:55
double eval(Well::GuideRateTarget target) const
double oil_rat
Definition: GuideRate.hpp:53
double gas_rat
Definition: GuideRate.hpp:54
double eval(GuideRateModel::Target target) const