49 RateVector() =
default;
50 RateVector(
const double orat,
const double grat,
const double wrat)
56 static RateVector serializationTestObject()
58 return RateVector{1.0, 2.0, 3.0};
61 double eval(
const WellGuideRateTarget target)
const;
62 double eval(
const Group::GuideRateProdTarget target)
const;
63 double eval(
const GuideRateModel::Target target)
const;
65 template<
class Serializer>
78 struct GuideRateValue {
79 GuideRateValue() =
default;
80 GuideRateValue(
const double t,
const double v,
const GuideRateModel::Target tg)
86 static GuideRateValue serializationTestObject()
88 return GuideRateValue{1.0, 2.0, GuideRateModel::Target::LIQ};
91 bool operator==(
const GuideRateValue& other)
const
93 return (this->sim_time == other.sim_time)
94 && (this->value == other.value);
97 bool operator!=(
const GuideRateValue& other)
const
99 return !(*
this == other);
102 template<
class Serializer>
105 serializer(sim_time);
110 double sim_time { std::numeric_limits<double>::lowest() };
111 double value { std::numeric_limits<double>::lowest() };
112 GuideRateModel::Target target { GuideRateModel::Target::NONE };
115 explicit GuideRate(
const Schedule& schedule);
117 void setSerializationTestData();
119 void compute(
const std::string& wgname,
120 const std::size_t report_step,
121 const double sim_time,
122 const double oil_pot,
123 const double gas_pot,
124 const double wat_pot);
126 void compute(
const std::string& wgname,
128 const std::size_t report_step,
129 const std::optional<double> guide_rate);
131 bool has(
const std::string& name)
const;
132 bool hasPotentials(
const std::string& name)
const;
133 bool has(
const std::string& name,
const Phase& phase)
const;
141 void erase(
const std::string& name);
143 double get(
const std::string& well,
const WellGuideRateTarget target,
const RateVector& rates)
const;
144 double get(
const std::string& group,
const Group::GuideRateProdTarget target,
const RateVector& rates)
const;
145 double get(
const std::string& name,
const GuideRateModel::Target model_target,
const RateVector& rates)
const;
146 double get(
const std::string& group,
const Phase& phase)
const;
148 double getSI(
const std::string& well,
const WellGuideRateTarget target,
const RateVector& rates)
const;
149 double getSI(
const std::string& group,
const Group::GuideRateProdTarget target,
const RateVector& rates)
const;
150 double getSI(
const std::string& wgname,
const GuideRateModel::Target target,
const RateVector& rates)
const;
151 double getSI(
const std::string& group,
const Phase& phase)
const;
153 void init_grvalue(
const std::size_t report_step,
const std::string& wgname,
GuideRateValue value);
154 void init_grvalue_SI(
const std::size_t report_step,
const std::string& wgname,
GuideRateValue value);
156 void updateGuideRateExpiration(
const double sim_time,
157 const std::size_t report_step);
159 template<
class Serializer>
163 serializer(injection_group_values);
164 serializer(potentials);
165 serializer(potn_groups);
166 serializer(guide_rates_expired);
172 GuideRateValue curr{};
173 GuideRateValue prev{};
175 static GRValState serializationTestObject()
177 return GRValState{GuideRateValue::serializationTestObject(),
178 GuideRateValue::serializationTestObject()};
181 template<
class Serializer>
182 void serializeOp(Serializer& serializer)
191 template <
class T1,
class T2>
192 std::size_t operator()(
const std::pair<T1, T2>& pair)
const
194 return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
198 using GRValPtr = std::unique_ptr<GRValState>;
199 using pair = std::pair<Phase, std::string>;
201 void well_compute(
const std::string& wgname,
202 const std::size_t report_step,
203 const double sim_time,
204 const double oil_pot,
205 const double gas_pot,
206 const double wat_pot);
208 void group_compute(
const std::string& wgname,
209 const std::size_t report_step,
210 const double sim_time,
211 const double oil_pot,
212 const double gas_pot,
213 const double wat_pot);
215 double eval_form(
const GuideRateModel& model,
216 const std::string& wgId,
217 const double oil_pot,
218 const double gas_pot,
219 const double wat_pot)
const;
221 void assign_grvalue(
const std::string& wgname,
222 const GuideRateModel& model,
224 double get_grvalue_result(
const GRValState& gr)
const;
226 const Schedule& schedule;
228 std::unordered_map<std::string, GRValPtr> values{};
229 std::unordered_map<pair, double, pair_hash> injection_group_values{};
230 std::unordered_map<std::string, RateVector> potentials{};
231 std::unordered_set<std::string> potn_groups{};
232 bool guide_rates_expired {
false};
void erase(const std::string &name)
Erase the guide rate for a well or group.
Definition GuideRate.cpp:219
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30