mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Account for pressure loss also in thp
This commit is contained in:
parent
54c7af85d4
commit
64c041d08f
@ -209,6 +209,7 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
@ -400,7 +401,7 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
|
||||
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),
|
||||
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)},
|
||||
well_state, deferred_logger);
|
||||
well_state, summary_state, deferred_logger);
|
||||
}
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <opm/material/densead/Evaluation.hpp>
|
||||
|
||||
#include <opm/simulators/wells/MultisegmentWellEquations.hpp>
|
||||
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
@ -102,6 +103,7 @@ public:
|
||||
const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Returns scaled volume fraction for a component in a segment.
|
||||
|
@ -645,7 +645,7 @@ namespace Opm
|
||||
max_pressure_change);
|
||||
|
||||
this->primary_variables_.copyToWellState(*this, getRefDensity(), stop_or_zero_rate_target,
|
||||
well_state, deferred_logger);
|
||||
well_state, summary_state, deferred_logger);
|
||||
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
||||
}
|
||||
|
||||
@ -1135,12 +1135,13 @@ namespace Opm
|
||||
std::vector<double> well_rates_bhp_limit;
|
||||
computeWellRatesWithBhp(ebos_simulator, bhp_limit, well_rates_bhp_limit, deferred_logger);
|
||||
|
||||
const double thp_limit = this->getTHPConstraint(summaryState);
|
||||
const double thp = WellBhpThpCalculator(*this).calculateThpFromBhp(well_rates_bhp_limit,
|
||||
bhp_limit,
|
||||
this->getRefDensity(),
|
||||
this->wellEcl().alq_value(),
|
||||
thp_limit,
|
||||
deferred_logger);
|
||||
const double thp_limit = this->getTHPConstraint(summaryState);
|
||||
if ( (this->isProducer() && thp < thp_limit) || (this->isInjector() && thp > thp_limit) ) {
|
||||
this->operability_status_.obey_thp_limit_under_bhp_limit = false;
|
||||
}
|
||||
|
@ -350,6 +350,7 @@ namespace Opm
|
||||
|
||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual void assembleWellEqWithoutIteration(const Simulator& ebosSimulator,
|
||||
|
@ -73,6 +73,7 @@ void
|
||||
StandardWellEval<FluidSystem,Indices,Scalar>::
|
||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
this->primary_variables_.copyToWellState(well_state, deferred_logger);
|
||||
@ -84,7 +85,7 @@ updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
|
||||
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),
|
||||
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)},
|
||||
well_state, deferred_logger);
|
||||
well_state, summary_state, deferred_logger);
|
||||
}
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
|
@ -95,6 +95,7 @@ protected:
|
||||
|
||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
PrimaryVariables primary_variables_; //!< Primary variables for well
|
||||
|
@ -917,7 +917,7 @@ namespace Opm
|
||||
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||
updatePrimaryVariablesNewton(dwells, stop_or_zero_rate_target, deferred_logger);
|
||||
|
||||
updateWellStateFromPrimaryVariables(stop_or_zero_rate_target, well_state, deferred_logger);
|
||||
updateWellStateFromPrimaryVariables(stop_or_zero_rate_target, well_state, summary_state, deferred_logger);
|
||||
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
||||
}
|
||||
|
||||
@ -953,9 +953,10 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
this->StdWellEval::updateWellStateFromPrimaryVariables(stop_or_zero_rate_target, well_state, deferred_logger);
|
||||
this->StdWellEval::updateWellStateFromPrimaryVariables(stop_or_zero_rate_target, well_state, summary_state, deferred_logger);
|
||||
|
||||
// other primary variables related to polymer injectivity study
|
||||
if constexpr (Base::has_polymermw) {
|
||||
@ -1096,12 +1097,13 @@ namespace Opm
|
||||
computeWellRatesWithBhp(ebos_simulator, bhp_limit, well_rates_bhp_limit, deferred_logger);
|
||||
|
||||
this->adaptRatesForVFP(well_rates_bhp_limit);
|
||||
const double thp_limit = this->getTHPConstraint(summaryState);
|
||||
const double thp = WellBhpThpCalculator(*this).calculateThpFromBhp(well_rates_bhp_limit,
|
||||
bhp_limit,
|
||||
this->connections_.rho(),
|
||||
this->getALQ(well_state),
|
||||
thp_limit,
|
||||
deferred_logger);
|
||||
const double thp_limit = this->getTHPConstraint(summaryState);
|
||||
if ( (this->isProducer() && thp < thp_limit) || (this->isInjector() && thp > thp_limit) ) {
|
||||
this->operability_status_.obey_thp_limit_under_bhp_limit = false;
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ double WellBhpThpCalculator::calculateThpFromBhp(const std::vector<double>& rate
|
||||
const double bhp,
|
||||
const double rho,
|
||||
const std::optional<double>& alq,
|
||||
const double thp_limit,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
assert(int(rates.size()) == 3); // the vfp related only supports three phases now.
|
||||
@ -117,21 +118,21 @@ double WellBhpThpCalculator::calculateThpFromBhp(const std::vector<double>& rate
|
||||
|
||||
// pick the density in the top layer
|
||||
double thp = 0.0;
|
||||
auto pressure_loss = getVfpBhpAdjustment(bhp, thp_limit);
|
||||
if (well_.isInjector()) {
|
||||
assert(!alq.has_value());
|
||||
const int table_id = well_.wellEcl().vfp_table_number();
|
||||
const double vfp_ref_depth = well_.vfpProperties()->getInj()->getTable(table_id).getDatumDepth();
|
||||
const double dp = wellhelpers::computeHydrostaticCorrection(well_.refDepth(), vfp_ref_depth, rho, well_.gravity());
|
||||
|
||||
thp = well_.vfpProperties()->getInj()->thp(table_id, aqua, liquid, vapour, bhp + dp);
|
||||
thp = well_.vfpProperties()->getInj()->thp(table_id, aqua, liquid, vapour, bhp + dp - pressure_loss);
|
||||
}
|
||||
else if (well_.isProducer()) {
|
||||
const int table_id = well_.wellEcl().vfp_table_number();
|
||||
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());
|
||||
|
||||
assert(alq.has_value());
|
||||
thp = well_.vfpProperties()->getProd()->thp(table_id, aqua, liquid, vapour, bhp + dp, alq.value());
|
||||
thp = well_.vfpProperties()->getProd()->thp(table_id, aqua, liquid, vapour, bhp + dp, alq);
|
||||
}
|
||||
else {
|
||||
OPM_DEFLOG_THROW(std::logic_error, "Expected INJECTOR or PRODUCER well", deferred_logger);
|
||||
@ -239,6 +240,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
||||
const std::function<double()>& alq_value,
|
||||
const std::array<unsigned,3>& active,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
@ -272,8 +274,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
||||
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, deferred_logger);
|
||||
ws.thp = this->calculateThpFromBhp(rates, ws.bhp, rho, alq_value(), deferred_logger);
|
||||
}
|
||||
|
||||
template<class EvalWell>
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
const double bhp,
|
||||
const double rho,
|
||||
const std::optional<double>& alq,
|
||||
const double thp_limit,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Compute BHP from THP limit for a producer.
|
||||
@ -86,6 +87,7 @@ public:
|
||||
const std::function<double()>& alq_value,
|
||||
const std::array<unsigned,3>& active,
|
||||
WellState& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class EvalWell>
|
||||
|
Loading…
Reference in New Issue
Block a user