not updating the THP for zero rate controlled wells

This commit is contained in:
Kai Bao 2023-03-28 15:22:50 +02:00
parent f4e0a996b9
commit b6eecf5c55
10 changed files with 22 additions and 10 deletions

View File

@ -207,6 +207,7 @@ template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
const double rho,
const bool zero_rate_target,
WellState& well_state,
DeferredLogger& deferred_logger) const
{
@ -393,7 +394,7 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
}
WellBhpThpCalculator(well_)
.updateThp(rho, [this]() { return well_.wellEcl().alq_value(); },
.updateThp(rho, zero_rate_target, [this]() { return well_.wellEcl().alq_value(); },
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)},

View File

@ -100,6 +100,7 @@ public:
//! \brief Copy values to well state.
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
const double rho,
const bool zero_rate_target,
WellState& well_state,
DeferredLogger& deferred_logger) const;

View File

@ -622,7 +622,7 @@ namespace Opm
zero_rate_target,
max_pressure_change);
this->primary_variables_.copyToWellState(*this, getRefDensity(),
this->primary_variables_.copyToWellState(*this, getRefDensity(), zero_rate_target,
well_state, deferred_logger);
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
}

View File

@ -368,7 +368,9 @@ namespace Opm
const bool zero_rate_target,
DeferredLogger& deferred_logger);
void updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const;
void updateWellStateFromPrimaryVariables(const bool zero_rate_target,
WellState& well_state,
DeferredLogger& deferred_logger) const;
virtual void assembleWellEqWithoutIteration(const Simulator& ebosSimulator,
const double dt,

View File

@ -71,13 +71,15 @@ extendEval(const Eval& in) const
template<class FluidSystem, class Indices, class Scalar>
void
StandardWellEval<FluidSystem,Indices,Scalar>::
updateWellStateFromPrimaryVariables(WellState& well_state,
updateWellStateFromPrimaryVariables(const bool zero_rate_target,
WellState& well_state,
DeferredLogger& deferred_logger) const
{
this->primary_variables_.copyToWellState(well_state, deferred_logger);
WellBhpThpCalculator(baseif_).
updateThp(connections_.rho(),
zero_rate_target,
[this,&well_state]() { return this->baseif_.getALQ(well_state); },
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),

View File

@ -92,7 +92,8 @@ protected:
const int num_cells,
const bool has_polymermw);
void updateWellStateFromPrimaryVariables(WellState& well_state,
void updateWellStateFromPrimaryVariables(const bool zero_rate_target,
WellState& well_state,
DeferredLogger& deferred_logger) const;
PrimaryVariables primary_variables_; //!< Primary variables for well

View File

@ -1003,7 +1003,7 @@ namespace Opm
const bool zero_rate_target = this->wellUnderZeroRateControl(summary_state, well_state);
updatePrimaryVariablesNewton(dwells, zero_rate_target, deferred_logger);
updateWellStateFromPrimaryVariables(well_state, deferred_logger);
updateWellStateFromPrimaryVariables(zero_rate_target, well_state, deferred_logger);
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
}
@ -1037,9 +1037,11 @@ namespace Opm
template<typename TypeTag>
void
StandardWell<TypeTag>::
updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const
updateWellStateFromPrimaryVariables(const bool zero_rate_target,
WellState& well_state,
DeferredLogger& deferred_logger) const
{
this->StdWellEval::updateWellStateFromPrimaryVariables(well_state, deferred_logger);
this->StdWellEval::updateWellStateFromPrimaryVariables(zero_rate_target, well_state, deferred_logger);
// other primary variables related to polymer injectivity study
if constexpr (Base::has_polymermw) {

View File

@ -224,6 +224,7 @@ computeBhpAtThpLimitInj(const std::function<std::vector<double>(const double)>&
}
void WellBhpThpCalculator::updateThp(const double rho,
const bool zero_rate_target,
const std::function<double()>& alq_value,
const std::array<unsigned,3>& active,
WellState& well_state,
@ -235,7 +236,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
auto& ws = well_state.well(well_.indexOfWell());
// When there is no vaild VFP table provided, we set the thp to be zero.
if (!well_.isVFPActive(deferred_logger) || well_.wellIsStopped()) {
if (!well_.isVFPActive(deferred_logger) || well_.wellIsStopped() || zero_rate_target) {
ws.thp = 0;
return;
}

View File

@ -82,6 +82,7 @@ public:
//! \brief Update THP.
void updateThp(const double rho,
const bool zero_rate_target,
const std::function<double()>& alq_value,
const std::array<unsigned,3>& active,
WellState& well_state,

View File

@ -184,7 +184,8 @@ namespace Opm
const GroupState& group_state,
DeferredLogger& deferred_logger) /* const */
{
if (this->wellIsStopped()) {
const auto& summary_state = ebos_simulator.vanguard().summaryState();
if (this->wellUnderZeroRateControl(summary_state, well_state)) {
return false;
}