24#ifndef OPM_WELL_TEST_HEADER_INCLUDED
25#define OPM_WELL_TEST_HEADER_INCLUDED
27#include <opm/common/utility/TimeService.hpp>
29#include <opm/input/eclipse/Units/UnitSystem.hpp>
35#include <unordered_set>
42template<
typename Scalar,
typename IndexTraits>
class SingleWellState;
44class WellEconProductionLimits;
45template<
typename Scalar,
typename IndexTraits>
class WellInterfaceGeneric;
49template<
typename Scalar,
typename IndexTraits>
72 const double simulation_time,
73 const bool write_message_to_opmlog,
74 const bool during_well_test,
75 WellTestState& well_test_state,
76 bool zero_group_target,
77 const UnitSystem& unit_system,
78 const time_point start_time,
80 std::string* closure_reason =
nullptr)
const;
83 const double simulation_time,
84 const bool write_message_to_opmlog,
85 WellTestState& well_test_state,
86 const UnitSystem& unit_system,
87 const time_point start_time,
91 const bool write_message_to_opmlog,
92 WellTestState& well_test_state,
96 struct RatioLimitCheckReport {
97 static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
102 static constexpr Scalar INFINITE_RATIO = std::numeric_limits<Scalar>::infinity();
103 bool ratio_limit_violated =
false;
104 int worst_offending_completion = INVALIDCOMPLETION;
105 Scalar violation_extent = 0.0;
108 std::string ratio_name{};
109 UnitSystem::measure ratio_measure = UnitSystem::measure::identity;
110 Scalar ratio_value = 0.0;
111 Scalar ratio_limit = 0.0;
115 struct RateLimitCheckReport {
118 std::string_view quantity_name{};
119 UnitSystem::measure rate_measure = UnitSystem::measure::identity;
122 Scalar rate_value = 0.0;
123 Scalar rate_limit = 0.0;
129 void reportEconomicLimitClosure(
const std::string& when,
130 const std::string& reason,
131 const bool write_message_to_opmlog,
132 std::string* closure_reason,
133 DeferredLogger& deferred_logger)
const;
140 static std::string rateViolationReason(
const UnitSystem& unit_system,
141 const RateLimitCheckReport& report,
142 const bool on_potentials);
151 static std::string ratioViolationReason(
const UnitSystem& unit_system,
152 std::string_view ratio_name,
153 const UnitSystem::measure ratio_measure,
154 const Scalar ratio_value,
155 const Scalar ratio_limit);
161 template<
class RatioFunc>
162 void checkMaxRatioLimit(
const SingleWellState<Scalar, IndexTraits>& ws,
163 const Scalar max_ratio_limit,
164 const RatioFunc& ratioFunc,
165 const std::unordered_set<int>& excluded_completions,
166 const std::string& ratio_name,
167 const UnitSystem::measure ratio_measure,
168 RatioLimitCheckReport& report)
const;
187 template<
class RatioFunc>
188 bool checkMaxRatioLimitWell(
const SingleWellState<Scalar, IndexTraits>& ws,
189 const Scalar max_ratio_limit,
190 const RatioFunc& ratioFunc,
191 const std::unordered_set<int>& excluded_completions,
192 Scalar& well_ratio_value)
const;
194 template<
class RatioFunc>
195 void checkMaxRatioLimitCompletions(
const SingleWellState<Scalar, IndexTraits>& ws,
196 const Scalar max_ratio_limit,
197 const Scalar well_ratio_value,
198 const RatioFunc& ratioFunc,
199 const std::unordered_set<int>& excluded_completions,
200 const std::string& ratio_name,
201 const UnitSystem::measure ratio_measure,
202 RatioLimitCheckReport& report)
const;
211 bool checkRateEconLimits(
const WellEconProductionLimits& econ_production_limits,
212 const std::vector<Scalar>& rates_or_potentials,
213 RateLimitCheckReport& report)
const;
217 RatioLimitCheckReport
218 checkRatioEconLimits(
const WellEconProductionLimits& econ_production_limits,
219 const SingleWellState<Scalar, IndexTraits>& ws,
220 const std::unordered_set<int>& excluded_completions,
221 DeferredLogger& deferred_logger)
const;
226 std::string completionDescriptor(
int complnum)
const;
240 bool closeOffendingCompletion(
int offending_completion,
241 bool close_connections_below,
242 double simulation_time,
243 bool write_message_to_opmlog,
244 WellTestState& well_test_state,
245 const std::string& when,
246 const std::string& reason,
247 std::string_view ratio_subject,
248 std::unordered_set<int>& closed_this_event,
249 DeferredLogger& deferred_logger)
const;
251 const WellInterfaceGeneric<Scalar, IndexTraits>& well_;
Definition: DeferredLogger.hpp:57
Definition: SingleWellState.hpp:44
Definition: WellInterfaceGeneric.hpp:59
Class for performing well tests.
Definition: WellTest.hpp:50
void updateWellTestStateCECON(const SingleWellState< Scalar, IndexTraits > &ws, const double simulation_time, const bool write_message_to_opmlog, WellTestState &well_test_state, const UnitSystem &unit_system, const time_point start_time, DeferredLogger &deferred_logger) const
WellTest(const WellInterfaceGeneric< Scalar, IndexTraits > &well)
Constructor sets reference to well.
Definition: WellTest.hpp:53
void updateWellTestStatePhysical(const double simulation_time, const bool write_message_to_opmlog, WellTestState &well_test_state, DeferredLogger &deferred_logger) const
void updateWellTestStateEconomic(const SingleWellState< Scalar, IndexTraits > &ws, const double simulation_time, const bool write_message_to_opmlog, const bool during_well_test, WellTestState &well_test_state, bool zero_group_target, const UnitSystem &unit_system, const time_point start_time, DeferredLogger &deferred_logger, std::string *closure_reason=nullptr) const
Definition: blackoilbioeffectsmodules.hh:45