24#ifndef OPM_WELL_TEST_HEADER_INCLUDED
25#define OPM_WELL_TEST_HEADER_INCLUDED
27#include <opm/input/eclipse/Units/UnitSystem.hpp>
34#include <unordered_set>
41template<
typename Scalar,
typename IndexTraits>
class SingleWellState;
43class WellEconProductionLimits;
44template<
typename Scalar,
typename IndexTraits>
class WellInterfaceGeneric;
48template<
typename Scalar,
typename IndexTraits>
71 const double simulation_time,
72 const bool write_message_to_opmlog,
73 const bool during_well_test,
74 WellTestState& well_test_state,
75 bool zero_group_target,
76 const UnitSystem& unit_system,
77 const std::time_t start_time,
79 std::string* closure_reason =
nullptr)
const;
82 const double simulation_time,
83 const bool write_message_to_opmlog,
84 WellTestState& well_test_state,
85 const UnitSystem& unit_system,
86 const std::time_t start_time,
90 const bool write_message_to_opmlog,
91 WellTestState& well_test_state,
95 struct RatioLimitCheckReport {
96 static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
101 static constexpr Scalar INFINITE_RATIO = std::numeric_limits<Scalar>::infinity();
102 bool ratio_limit_violated =
false;
103 int worst_offending_completion = INVALIDCOMPLETION;
104 Scalar violation_extent = 0.0;
107 std::string ratio_name{};
108 UnitSystem::measure ratio_measure = UnitSystem::measure::identity;
109 Scalar ratio_value = 0.0;
110 Scalar ratio_limit = 0.0;
114 struct RateLimitCheckReport {
117 std::string_view quantity_name{};
118 UnitSystem::measure rate_measure = UnitSystem::measure::identity;
121 Scalar rate_value = 0.0;
122 Scalar rate_limit = 0.0;
128 void reportEconomicLimitClosure(
const std::string& when,
129 const std::string& reason,
130 const bool write_message_to_opmlog,
131 std::string* closure_reason,
132 DeferredLogger& deferred_logger)
const;
139 static std::string rateViolationReason(
const UnitSystem& unit_system,
140 const RateLimitCheckReport& report,
141 const bool on_potentials);
150 static std::string ratioViolationReason(
const UnitSystem& unit_system,
151 std::string_view ratio_name,
152 const UnitSystem::measure ratio_measure,
153 const Scalar ratio_value,
154 const Scalar ratio_limit);
160 template<
class RatioFunc>
161 void checkMaxRatioLimit(
const SingleWellState<Scalar, IndexTraits>& ws,
162 const Scalar max_ratio_limit,
163 const RatioFunc& ratioFunc,
164 const std::unordered_set<int>& excluded_completions,
165 const std::string& ratio_name,
166 const UnitSystem::measure ratio_measure,
167 RatioLimitCheckReport& report)
const;
186 template<
class RatioFunc>
187 bool checkMaxRatioLimitWell(
const SingleWellState<Scalar, IndexTraits>& ws,
188 const Scalar max_ratio_limit,
189 const RatioFunc& ratioFunc,
190 const std::unordered_set<int>& excluded_completions,
191 Scalar& well_ratio_value)
const;
193 template<
class RatioFunc>
194 void checkMaxRatioLimitCompletions(
const SingleWellState<Scalar, IndexTraits>& ws,
195 const Scalar max_ratio_limit,
196 const Scalar well_ratio_value,
197 const RatioFunc& ratioFunc,
198 const std::unordered_set<int>& excluded_completions,
199 const std::string& ratio_name,
200 const UnitSystem::measure ratio_measure,
201 RatioLimitCheckReport& report)
const;
210 bool checkRateEconLimits(
const WellEconProductionLimits& econ_production_limits,
211 const std::vector<Scalar>& rates_or_potentials,
212 RateLimitCheckReport& report)
const;
216 RatioLimitCheckReport
217 checkRatioEconLimits(
const WellEconProductionLimits& econ_production_limits,
218 const SingleWellState<Scalar, IndexTraits>& ws,
219 const std::unordered_set<int>& excluded_completions,
220 DeferredLogger& deferred_logger)
const;
225 std::string completionDescriptor(
int complnum)
const;
239 bool closeOffendingCompletion(
int offending_completion,
240 bool close_connections_below,
241 double simulation_time,
242 bool write_message_to_opmlog,
243 WellTestState& well_test_state,
244 const std::string& when,
245 const std::string& reason,
246 std::string_view ratio_subject,
247 std::unordered_set<int>& closed_this_event,
248 DeferredLogger& deferred_logger)
const;
250 const WellInterfaceGeneric<Scalar, IndexTraits>& well_;
Definition: DeferredLogger.hpp:57
Definition: SingleWellState.hpp:44
Definition: WellInterfaceGeneric.hpp:56
Class for performing well tests.
Definition: WellTest.hpp:49
WellTest(const WellInterfaceGeneric< Scalar, IndexTraits > &well)
Constructor sets reference to well.
Definition: WellTest.hpp:52
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 std::time_t start_time, DeferredLogger &deferred_logger, std::string *closure_reason=nullptr) const
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 std::time_t start_time, DeferredLogger &deferred_logger) const
Definition: blackoilbioeffectsmodules.hh:45