24#ifndef OPM_WELL_BPH_THP_CALCULATOR_HEADER_INCLUDED
25#define OPM_WELL_BPH_THP_CALCULATOR_HEADER_INCLUDED
38class WellInterfaceGeneric;
66 const SummaryState& summary_state,
67 const double maxPerfPress,
69 const double alq_value,
70 const double thp_limit,
76 const SummaryState& summary_state,
78 const double flo_rel_tol,
79 const int max_iteration,
80 const bool throwOnError,
85 const bool stop_or_zero_rate_target,
86 const std::function<
double()>& alq_value,
87 const std::array<unsigned,3>& active,
91 template<
class EvalWell>
92 EvalWell calculateBhpFromThp(
const WellState& well_state,
93 const std::vector<EvalWell>& rates,
95 const SummaryState& summaryState,
101 template<
class ErrorPolicy>
102 std::optional<double>
103 computeBhpAtThpLimitInjImpl(
const std::function<std::vector<double>(
const double)>& frates,
104 const SummaryState& summary_state,
106 const double flo_rel_tol,
107 const int max_iteration,
111 std::optional<double>
112 bhpMax(
const std::function<
double(
const double)>& fflo,
113 const double bhp_limit,
114 const double maxPerfPress,
115 const double vfp_flo_front,
119 std::optional<double>
120 computeBhpAtThpLimit(
const std::function<std::vector<double>(
const double)>& frates,
121 const std::function<
double(
const std::vector<double>)>& fbhp,
122 const std::array<double, 2>& range,
126 bool bisectBracket(
const std::function<
double(
const double)>& eq,
127 const std::array<double, 2>& range,
128 double& low,
double& high,
129 std::optional<double>& approximate_solution,
133 static bool bruteForceBracket(
const std::function<
double(
const double)>& eq,
134 const std::array<double, 2>& range,
135 double& low,
double& high,
Definition: DeferredLogger.hpp:57
Class for computing BHP limits.
Definition: WellBhpThpCalculator.hpp:42
void updateThp(const double rho, const bool stop_or_zero_rate_target, const std::function< double()> &alq_value, const std::array< unsigned, 3 > &active, WellState &well_state, DeferredLogger &deferred_logger) const
Update THP.
Definition: WellBhpThpCalculator.cpp:226
std::optional< double > computeBhpAtThpLimitProd(const std::function< std::vector< double >(const double)> &frates, const SummaryState &summary_state, const double maxPerfPress, const double rho, const double alq_value, const double thp_limit, DeferredLogger &deferred_logger) const
Compute BHP from THP limit for a producer.
Definition: WellBhpThpCalculator.cpp:142
double mostStrictBhpFromBhpLimits(const SummaryState &summaryState) const
Obtain the most strict BHP from BHP limits.
Definition: WellBhpThpCalculator.cpp:85
bool wellHasTHPConstraints(const SummaryState &summaryState) const
Checks if well has THP constraints.
Definition: WellBhpThpCalculator.cpp:51
double calculateThpFromBhp(const std::vector< double > &rates, const double bhp, const double rho, const double alq, DeferredLogger &deferred_logger) const
Calculates THP from BHP.
Definition: WellBhpThpCalculator.cpp:101
double getTHPConstraint(const SummaryState &summaryState) const
Get THP constraint for well.
Definition: WellBhpThpCalculator.cpp:69
std::optional< double > computeBhpAtThpLimitInj(const std::function< std::vector< double >(const double)> &frates, const SummaryState &summary_state, const double rho, const double flo_rel_tol, const int max_iteration, const bool throwOnError, DeferredLogger &deferred_logger) const
Compute BHP from THP limit for an injector.
Definition: WellBhpThpCalculator.cpp:207
WellBhpThpCalculator(const WellInterfaceGeneric &well)
Constructor sets reference to well.
Definition: WellBhpThpCalculator.hpp:45
Definition: WellInterfaceGeneric.hpp:51
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellState.hpp:60
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27