48 RateVector() =
default;
49 RateVector(
const double orat,
const double grat,
const double wrat)
55 static RateVector serializationTestObject()
57 return RateVector{1.0, 2.0, 3.0};
60 double eval(
const WellGuideRateTarget target)
const;
61 double eval(
const Group::GuideRateProdTarget target)
const;
62 double eval(
const GuideRateModel::Target target)
const;
64 template<
class Serializer>
77 struct GuideRateValue {
78 GuideRateValue() =
default;
79 GuideRateValue(
const double t,
const double v,
const GuideRateModel::Target tg)
85 static GuideRateValue serializationTestObject()
87 return GuideRateValue{1.0, 2.0, GuideRateModel::Target::LIQ};
90 bool operator==(
const GuideRateValue& other)
const
92 return (this->sim_time == other.sim_time)
93 && (this->value == other.value);
96 bool operator!=(
const GuideRateValue& other)
const
98 return !(*
this == other);
101 template<
class Serializer>
104 serializer(sim_time);
109 double sim_time { std::numeric_limits<double>::lowest() };
110 double value { std::numeric_limits<double>::lowest() };
111 GuideRateModel::Target target { GuideRateModel::Target::NONE };
114 explicit GuideRate(
const Schedule& schedule);
116 void setSerializationTestData();
118 void compute(
const std::string& wgname,
119 const std::size_t report_step,
120 const double sim_time,
121 const double oil_pot,
122 const double gas_pot,
123 const double wat_pot);
125 void compute(
const std::string& wgname,
127 const std::size_t report_step,
128 const std::optional<double> guide_rate);
130 bool has(
const std::string& name)
const;
131 bool hasPotentials(
const std::string& name)
const;
132 bool has(
const std::string& name,
const Phase& phase)
const;
140 void erase(
const std::string& name);
142 double get(
const std::string& well,
const WellGuideRateTarget target,
const RateVector& rates)
const;
143 double get(
const std::string& group,
const Group::GuideRateProdTarget target,
const RateVector& rates)
const;
144 double get(
const std::string& name,
const GuideRateModel::Target model_target,
const RateVector& rates)
const;
145 double get(
const std::string& group,
const Phase& phase)
const;
147 double getSI(
const std::string& well,
const WellGuideRateTarget target,
const RateVector& rates)
const;
148 double getSI(
const std::string& group,
const Group::GuideRateProdTarget target,
const RateVector& rates)
const;
149 double getSI(
const std::string& wgname,
const GuideRateModel::Target target,
const RateVector& rates)
const;
150 double getSI(
const std::string& group,
const Phase& phase)
const;
152 void init_grvalue(
const std::size_t report_step,
const std::string& wgname,
GuideRateValue value);
153 void init_grvalue_SI(
const std::size_t report_step,
const std::string& wgname,
GuideRateValue value);
155 void updateGuideRateExpiration(
const double sim_time,
156 const std::size_t report_step);
158 template<
class Serializer>
162 serializer(injection_group_values);
163 serializer(potentials);
164 serializer(guide_rates_expired);
170 GuideRateValue curr{};
171 GuideRateValue prev{};
173 static GRValState serializationTestObject()
175 return GRValState{GuideRateValue::serializationTestObject(),
176 GuideRateValue::serializationTestObject()};
179 template<
class Serializer>
180 void serializeOp(Serializer& serializer)
189 template <
class T1,
class T2>
190 std::size_t operator()(
const std::pair<T1, T2>& pair)
const
192 return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
196 using GRValPtr = std::unique_ptr<GRValState>;
197 using pair = std::pair<Phase, std::string>;
199 void well_compute(
const std::string& wgname,
200 const std::size_t report_step,
201 const double sim_time,
202 const double oil_pot,
203 const double gas_pot,
204 const double wat_pot);
206 void group_compute(
const std::string& wgname,
207 const std::size_t report_step,
208 const double sim_time,
209 const double oil_pot,
210 const double gas_pot,
211 const double wat_pot);
213 double eval_form(
const GuideRateModel& model,
214 const std::string& wgId,
215 const double oil_pot,
216 const double gas_pot,
217 const double wat_pot)
const;
219 void assign_grvalue(
const std::string& wgname,
220 const GuideRateModel& model,
222 double get_grvalue_result(
const GRValState& gr)
const;
224 const Schedule& schedule;
226 std::unordered_map<std::string, GRValPtr> values{};
227 std::unordered_map<pair, double, pair_hash> injection_group_values{};
228 std::unordered_map<std::string, RateVector> potentials{};
229 bool guide_rates_expired {
false};
void erase(const std::string &name)
Erase the guide rate for a well or group.
Definition GuideRate.cpp:218
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30