changed: move getTHPConstraint to WellBhpThpCalculator

This commit is contained in:
Arne Morten Kvarving 2022-10-19 09:55:14 +02:00
parent cd734f7a0d
commit d4e06536a0
3 changed files with 20 additions and 10 deletions

View File

@ -48,4 +48,20 @@ WellBhpThpCalculator::wellHasTHPConstraints(const SummaryState& summaryState) co
return false;
}
double WellBhpThpCalculator::getTHPConstraint(const SummaryState& summaryState) const
{
const auto& well_ecl = well_.wellEcl();
if (well_ecl.isInjector()) {
const auto& controls = well_ecl.injectionControls(summaryState);
return controls.thp_limit;
}
if (well_ecl.isProducer( )) {
const auto& controls = well_ecl.productionControls(summaryState);
return controls.thp_limit;
}
return 0.0;
}
} // namespace Opm

View File

@ -44,6 +44,9 @@ public:
//! \brief Checks if well has THP constraints.
bool wellHasTHPConstraints(const SummaryState& summaryState) const;
//! \brief Get THP constraint for well.
double getTHPConstraint(const SummaryState& summaryState) const;
private:
const WellInterfaceGeneric& well_; //!< Reference to well interface
};

View File

@ -227,17 +227,8 @@ double WellInterfaceGeneric::getTHPConstraint(const SummaryState& summaryState)
if (dynamic_thp_limit_) {
return *dynamic_thp_limit_;
}
if (well_ecl_.isInjector()) {
const auto& controls = well_ecl_.injectionControls(summaryState);
return controls.thp_limit;
}
if (well_ecl_.isProducer( )) {
const auto& controls = well_ecl_.productionControls(summaryState);
return controls.thp_limit;
}
return 0.0;
return WellBhpThpCalculator(*this).getTHPConstraint(summaryState);
}
bool WellInterfaceGeneric::underPredictionMode() const