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>
70 const double simulation_time,
71 const bool write_message_to_opmlog,
72 const bool during_well_test,
73 WellTestState& well_test_state,
74 bool zero_group_target,
75 const UnitSystem& unit_system,
76 const std::time_t start_time,
78 std::string* closure_reason =
nullptr)
const;
81 const double simulation_time,
82 const bool write_message_to_opmlog,
83 WellTestState& well_test_state,
84 const UnitSystem& unit_system,
85 const std::time_t start_time,
89 const bool write_message_to_opmlog,
90 WellTestState& well_test_state,
94 struct RatioLimitCheckReport {
95 static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
100 static constexpr Scalar INFINITE_RATIO = std::numeric_limits<Scalar>::infinity();
101 bool ratio_limit_violated =
false;
102 int worst_offending_completion = INVALIDCOMPLETION;
103 Scalar violation_extent = 0.0;
106 std::string ratio_name{};
107 UnitSystem::measure ratio_measure = UnitSystem::measure::identity;
108 Scalar ratio_value = 0.0;
109 Scalar ratio_limit = 0.0;
113 struct RateLimitCheckReport {
116 std::string_view quantity_name{};
117 UnitSystem::measure rate_measure = UnitSystem::measure::identity;
120 Scalar rate_value = 0.0;
121 Scalar rate_limit = 0.0;
127 void reportEconomicLimitClosure(
const std::string& when,
128 const std::string& reason,
129 const bool write_message_to_opmlog,
130 std::string* closure_reason,
131 DeferredLogger& deferred_logger)
const;
138 static std::string rateViolationReason(
const UnitSystem& unit_system,
139 const RateLimitCheckReport& report,
140 const bool on_potentials);
149 static std::string ratioViolationReason(
const UnitSystem& unit_system,
150 std::string_view ratio_name,
151 const UnitSystem::measure ratio_measure,
152 const Scalar ratio_value,
153 const Scalar ratio_limit);
159 template<
class RatioFunc>
160 void checkMaxRatioLimit(
const SingleWellState<Scalar, IndexTraits>& ws,
161 const Scalar max_ratio_limit,
162 const RatioFunc& ratioFunc,
163 const std::unordered_set<int>& excluded_completions,
164 const std::string& ratio_name,
165 const UnitSystem::measure ratio_measure,
166 RatioLimitCheckReport& report)
const;
185 template<
class RatioFunc>
186 bool checkMaxRatioLimitWell(
const SingleWellState<Scalar, IndexTraits>& ws,
187 const Scalar max_ratio_limit,
188 const RatioFunc& ratioFunc,
189 const std::unordered_set<int>& excluded_completions,
190 Scalar& well_ratio_value)
const;
192 template<
class RatioFunc>
193 void checkMaxRatioLimitCompletions(
const SingleWellState<Scalar, IndexTraits>& ws,
194 const Scalar max_ratio_limit,
195 const Scalar well_ratio_value,
196 const RatioFunc& ratioFunc,
197 const std::unordered_set<int>& excluded_completions,
198 const std::string& ratio_name,
199 const UnitSystem::measure ratio_measure,
200 RatioLimitCheckReport& report)
const;
209 bool checkRateEconLimits(
const WellEconProductionLimits& econ_production_limits,
210 const std::vector<Scalar>& rates_or_potentials,
211 RateLimitCheckReport& report)
const;
215 RatioLimitCheckReport
216 checkRatioEconLimits(
const WellEconProductionLimits& econ_production_limits,
217 const SingleWellState<Scalar, IndexTraits>& ws,
218 const std::unordered_set<int>& excluded_completions,
219 DeferredLogger& deferred_logger)
const;
224 std::string completionDescriptor(
int complnum)
const;
238 bool closeOffendingCompletion(
int offending_completion,
239 bool close_connections_below,
240 double simulation_time,
241 bool write_message_to_opmlog,
242 WellTestState& well_test_state,
243 const std::string& when,
244 const std::string& reason,
245 std::string_view ratio_subject,
246 std::unordered_set<int>& closed_this_event,
247 DeferredLogger& deferred_logger)
const;
249 const WellInterfaceGeneric<Scalar, IndexTraits>& well_;
Definition: DeferredLogger.hpp:57
Definition: SingleWellState.hpp:44
Definition: WellInterfaceGeneric.hpp:55
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