Rebased on master

This commit is contained in:
Håkon Hægland 2023-05-31 21:25:18 +02:00
parent 64c041d08f
commit 79af105de5

View File

@ -132,7 +132,8 @@ double WellBhpThpCalculator::calculateThpFromBhp(const std::vector<double>& rate
const double vfp_ref_depth = well_.vfpProperties()->getProd()->getTable(table_id).getDatumDepth(); const double vfp_ref_depth = well_.vfpProperties()->getProd()->getTable(table_id).getDatumDepth();
const double dp = wellhelpers::computeHydrostaticCorrection(well_.refDepth(), vfp_ref_depth, rho, well_.gravity()); const double dp = wellhelpers::computeHydrostaticCorrection(well_.refDepth(), vfp_ref_depth, rho, well_.gravity());
thp = well_.vfpProperties()->getProd()->thp(table_id, aqua, liquid, vapour, bhp + dp, alq); thp = well_.vfpProperties()->getProd()->thp(
table_id, aqua, liquid, vapour, bhp + dp - pressure_loss, alq.value());
} }
else { else {
OPM_DEFLOG_THROW(std::logic_error, "Expected INJECTOR or PRODUCER well", deferred_logger); OPM_DEFLOG_THROW(std::logic_error, "Expected INJECTOR or PRODUCER well", deferred_logger);
@ -273,8 +274,9 @@ void WellBhpThpCalculator::updateThp(const double rho,
if (active[Gas]) { if (active[Gas]) {
rates[ Gas ] = ws.surface_rates[pu.phase_pos[ Gas ] ]; rates[ Gas ] = ws.surface_rates[pu.phase_pos[ Gas ] ];
} }
const std::optional<double> alq = this->well_.isProducer() ? std::optional<double>(alq_value()) : std::nullopt;
ws.thp = this->calculateThpFromBhp(rates, ws.bhp, rho, alq_value(), deferred_logger); const double thp_limit = well_.getTHPConstraint(summary_state);
ws.thp = this->calculateThpFromBhp(rates, ws.bhp, rho, alq_value(), thp_limit, deferred_logger);
} }
template<class EvalWell> template<class EvalWell>