Move computeBhpAtThpLimitProd MSW code to common and apply it for both MSW and STW

The computeBhpAtThpLimitProd for MSW is faster and sufficiently robust and should also be used by STW
This commit is contained in:
Tor Harald Sandve
2022-02-09 10:06:09 +01:00
parent 161e72f6de
commit 1001d35418
6 changed files with 326 additions and 279 deletions

View File

@@ -177,6 +177,13 @@ public:
bool changedToOpenThisStep() const {
return this->changed_to_open_this_step_;
}
std::optional<double> computeBhpAtThpLimitProdCommon(const std::function<std::vector<double>(const double)>& frates,
const SummaryState& summary_state,
const double maxPerfPress,
const double rho,
const double alq_value,
DeferredLogger& deferred_logger
) const;
protected:
bool getAllowCrossFlow() const;
double mostStrictBhpFromBhpLimits(const SummaryState& summaryState) const;
@@ -185,6 +192,23 @@ protected:
WellTestState& well_test_state,
DeferredLogger& deferred_logger) const;
std::optional<double> bhpMax(const std::function<double(const double)>& fflo,
const double bhp_limit,
const double maxPerfPress,
const double vfp_flo_front,
DeferredLogger& deferred_logger) const;
bool bruteForceBracket(const std::function<double(const double)>& eq,
const std::array<double, 2>& range,
double& low, double& high,
DeferredLogger& deferred_logger) const;
bool bisectBracket(const std::function<double(const double)>& eq,
const std::array<double, 2>& range,
double& low, double& high,
std::optional<double>& approximate_solution,
DeferredLogger& deferred_logger) const;
// definition of the struct OperabilityStatus
struct OperabilityStatus {