mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4563 from GitPaean/treating_zero_injection_rate_well_as_stoppped
for the wells under zero rate target control, the THP output will be zero
This commit is contained in:
commit
e9b372ff1c
@ -116,7 +116,7 @@ assembleControlEq(const WellState& well_state,
|
|||||||
return rates;
|
return rates;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (well_.wellIsStopped()) {
|
if (well_.stopppedOrZeroRateTarget(summaryState, well_state)) {
|
||||||
control_eq = primary_variables.getWQTotal();
|
control_eq = primary_variables.getWQTotal();
|
||||||
} else if (well_.isInjector() ) {
|
} else if (well_.isInjector() ) {
|
||||||
// Find scaling factor to get injection rate,
|
// Find scaling factor to get injection rate,
|
||||||
@ -164,9 +164,6 @@ assembleControlEq(const WellState& well_state,
|
|||||||
bhp_from_thp,
|
bhp_from_thp,
|
||||||
control_eq,
|
control_eq,
|
||||||
deferred_logger);
|
deferred_logger);
|
||||||
} else if (wellhelpers::rateControlWithZeroTarget(well_state.well(well_.indexOfWell()).production_cmode, prod_controls)) {
|
|
||||||
// Production mode, zero target. Treat as STOP.
|
|
||||||
control_eq = primary_variables.getWQTotal();
|
|
||||||
} else {
|
} else {
|
||||||
// Find rates.
|
// Find rates.
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
|
@ -64,7 +64,7 @@ init()
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices, class Scalar>
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
||||||
update(const WellState& well_state, const bool zero_rate_target)
|
update(const WellState& well_state, const bool stop_or_zero_rate_target)
|
||||||
{
|
{
|
||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||||
@ -104,7 +104,7 @@ update(const WellState& well_state, const bool zero_rate_target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
value_[seg][WQTotal] = total_seg_rate;
|
value_[seg][WQTotal] = total_seg_rate;
|
||||||
if (zero_rate_target && seg == 0) {
|
if (stop_or_zero_rate_target && seg == 0) {
|
||||||
value_[seg][WQTotal] = 0;
|
value_[seg][WQTotal] = 0;
|
||||||
}
|
}
|
||||||
if (std::abs(total_seg_rate) > 0.) {
|
if (std::abs(total_seg_rate) > 0.) {
|
||||||
@ -155,7 +155,7 @@ void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
|||||||
updateNewton(const BVectorWell& dwells,
|
updateNewton(const BVectorWell& dwells,
|
||||||
const double relaxation_factor,
|
const double relaxation_factor,
|
||||||
const double dFLimit,
|
const double dFLimit,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
const double max_pressure_change)
|
const double max_pressure_change)
|
||||||
{
|
{
|
||||||
const std::vector<std::array<double, numWellEq>> old_primary_variables = value_;
|
const std::vector<std::array<double, numWellEq>> old_primary_variables = value_;
|
||||||
@ -198,7 +198,7 @@ updateNewton(const BVectorWell& dwells,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zero_rate_target) {
|
if (stop_or_zero_rate_target) {
|
||||||
value_[0][WQTotal] = 0.;
|
value_[0][WQTotal] = 0.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,6 +207,7 @@ template<class FluidSystem, class Indices, class Scalar>
|
|||||||
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
||||||
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||||
const double rho,
|
const double rho,
|
||||||
|
const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
@ -393,7 +394,7 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
WellBhpThpCalculator(well_)
|
WellBhpThpCalculator(well_)
|
||||||
.updateThp(rho, [this]() { return well_.wellEcl().alq_value(); },
|
.updateThp(rho, stop_or_zero_rate_target, [this]() { return well_.wellEcl().alq_value(); },
|
||||||
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
|
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
|
||||||
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),
|
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),
|
||||||
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)},
|
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)},
|
||||||
|
@ -88,18 +88,19 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
//! \brief Copy values from well state.
|
//! \brief Copy values from well state.
|
||||||
void update(const WellState& well_state, const bool zero_rate_target);
|
void update(const WellState& well_state, const bool stop_or_zero_rate_target);
|
||||||
|
|
||||||
//! \brief Update values from newton update vector.
|
//! \brief Update values from newton update vector.
|
||||||
void updateNewton(const BVectorWell& dwells,
|
void updateNewton(const BVectorWell& dwells,
|
||||||
const double relaxation_factor,
|
const double relaxation_factor,
|
||||||
const double DFLimit,
|
const double DFLimit,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
const double max_pressure_change);
|
const double max_pressure_change);
|
||||||
|
|
||||||
//! \brief Copy values to well state.
|
//! \brief Copy values to well state.
|
||||||
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||||
const double rho,
|
const double rho,
|
||||||
|
const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ namespace Opm
|
|||||||
const WellState& well_state,
|
const WellState& well_state,
|
||||||
DeferredLogger& /* deferred_logger */)
|
DeferredLogger& /* deferred_logger */)
|
||||||
{
|
{
|
||||||
const bool zero_rate_target = this->wellUnderZeroProductionRateControl(summary_state, well_state);
|
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||||
this->primary_variables_.update(well_state, zero_rate_target);
|
this->primary_variables_.update(well_state, stop_or_zero_rate_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -615,14 +615,14 @@ namespace Opm
|
|||||||
|
|
||||||
const double dFLimit = this->param_.dwell_fraction_max_;
|
const double dFLimit = this->param_.dwell_fraction_max_;
|
||||||
const double max_pressure_change = this->param_.max_pressure_change_ms_wells_;
|
const double max_pressure_change = this->param_.max_pressure_change_ms_wells_;
|
||||||
const bool zero_rate_target = this->wellUnderZeroProductionRateControl(summary_state, well_state);
|
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||||
this->primary_variables_.updateNewton(dwells,
|
this->primary_variables_.updateNewton(dwells,
|
||||||
relaxation_factor,
|
relaxation_factor,
|
||||||
dFLimit,
|
dFLimit,
|
||||||
zero_rate_target,
|
stop_or_zero_rate_target,
|
||||||
max_pressure_change);
|
max_pressure_change);
|
||||||
|
|
||||||
this->primary_variables_.copyToWellState(*this, getRefDensity(),
|
this->primary_variables_.copyToWellState(*this, getRefDensity(), stop_or_zero_rate_target,
|
||||||
well_state, deferred_logger);
|
well_state, deferred_logger);
|
||||||
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
||||||
}
|
}
|
||||||
|
@ -365,10 +365,12 @@ namespace Opm
|
|||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
void updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
void updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const;
|
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
|
WellState& well_state,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
virtual void assembleWellEqWithoutIteration(const Simulator& ebosSimulator,
|
virtual void assembleWellEqWithoutIteration(const Simulator& ebosSimulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
|
@ -116,7 +116,7 @@ assembleControlEq(const WellState& well_state,
|
|||||||
return rates;
|
return rates;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (well_.wellIsStopped()) {
|
if (well_.stopppedOrZeroRateTarget(summaryState, well_state)) {
|
||||||
control_eq = primary_variables.eval(PrimaryVariables::WQTotal);
|
control_eq = primary_variables.eval(PrimaryVariables::WQTotal);
|
||||||
} else if (well_.isInjector()) {
|
} else if (well_.isInjector()) {
|
||||||
// Find injection rate.
|
// Find injection rate.
|
||||||
@ -143,9 +143,6 @@ assembleControlEq(const WellState& well_state,
|
|||||||
bhp_from_thp,
|
bhp_from_thp,
|
||||||
control_eq,
|
control_eq,
|
||||||
deferred_logger);
|
deferred_logger);
|
||||||
} else if (wellhelpers::rateControlWithZeroTarget(well_state.well(well_.indexOfWell()).production_cmode, prod_controls)) {
|
|
||||||
// Production mode, zero target. Treat as STOP.
|
|
||||||
control_eq = primary_variables.eval(PrimaryVariables::WQTotal);
|
|
||||||
} else {
|
} else {
|
||||||
// Find rates.
|
// Find rates.
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
|
@ -71,13 +71,15 @@ extendEval(const Eval& in) const
|
|||||||
template<class FluidSystem, class Indices, class Scalar>
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
void
|
void
|
||||||
StandardWellEval<FluidSystem,Indices,Scalar>::
|
StandardWellEval<FluidSystem,Indices,Scalar>::
|
||||||
updateWellStateFromPrimaryVariables(WellState& well_state,
|
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
|
WellState& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
this->primary_variables_.copyToWellState(well_state, deferred_logger);
|
this->primary_variables_.copyToWellState(well_state, deferred_logger);
|
||||||
|
|
||||||
WellBhpThpCalculator(baseif_).
|
WellBhpThpCalculator(baseif_).
|
||||||
updateThp(connections_.rho(),
|
updateThp(connections_.rho(),
|
||||||
|
stop_or_zero_rate_target,
|
||||||
[this,&well_state]() { return this->baseif_.getALQ(well_state); },
|
[this,&well_state]() { return this->baseif_.getALQ(well_state); },
|
||||||
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
|
{FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
|
||||||
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),
|
FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx),
|
||||||
|
@ -92,7 +92,8 @@ protected:
|
|||||||
const int num_cells,
|
const int num_cells,
|
||||||
const bool has_polymermw);
|
const bool has_polymermw);
|
||||||
|
|
||||||
void updateWellStateFromPrimaryVariables(WellState& well_state,
|
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
|
WellState& well_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
PrimaryVariables primary_variables_; //!< Primary variables for well
|
PrimaryVariables primary_variables_; //!< Primary variables for well
|
||||||
|
@ -122,7 +122,7 @@ resize(const int numWellEq)
|
|||||||
template<class FluidSystem, class Indices, class Scalar>
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
||||||
update(const WellState& well_state,
|
update(const WellState& well_state,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
@ -160,7 +160,7 @@ update(const WellState& well_state,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
value_[WQTotal] = total_well_rate;
|
value_[WQTotal] = total_well_rate;
|
||||||
if (zero_rate_target) {
|
if (stop_or_zero_rate_target) {
|
||||||
value_[WQTotal] = 0.;
|
value_[WQTotal] = 0.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ updatePolyMW(const WellState& well_state)
|
|||||||
template<class FluidSystem, class Indices, class Scalar>
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
||||||
updateNewton(const BVectorWell& dwells,
|
updateNewton(const BVectorWell& dwells,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
[[maybe_unused]] const double dFLimit,
|
[[maybe_unused]] const double dFLimit,
|
||||||
const double dBHPLimit)
|
const double dBHPLimit)
|
||||||
{
|
{
|
||||||
@ -281,7 +281,7 @@ updateNewton(const BVectorWell& dwells,
|
|||||||
|
|
||||||
// updating the total rates Q_t
|
// updating the total rates Q_t
|
||||||
value_[WQTotal] = value_[WQTotal] - dwells[0][WQTotal] * relaxation_factor_rate;
|
value_[WQTotal] = value_[WQTotal] - dwells[0][WQTotal] * relaxation_factor_rate;
|
||||||
if (zero_rate_target) {
|
if (stop_or_zero_rate_target) {
|
||||||
value_[WQTotal] = 0.;
|
value_[WQTotal] = 0.;
|
||||||
}
|
}
|
||||||
// TODO: here, we make sure it is zero for zero rated wells
|
// TODO: here, we make sure it is zero for zero rated wells
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
|
|
||||||
//! \brief Copy values from well state.
|
//! \brief Copy values from well state.
|
||||||
void update(const WellState& well_state,
|
void update(const WellState& well_state,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
//! \brief Copy polymer molecular weigt values from well state.
|
//! \brief Copy polymer molecular weigt values from well state.
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
|
|
||||||
//! \brief Update values from newton update vector.
|
//! \brief Update values from newton update vector.
|
||||||
void updateNewton(const BVectorWell& dwells,
|
void updateNewton(const BVectorWell& dwells,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
const double dFLimit,
|
const double dFLimit,
|
||||||
const double dBHPLimit);
|
const double dBHPLimit);
|
||||||
|
|
||||||
|
@ -1000,10 +1000,10 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
|
|
||||||
const bool zero_rate_target = this->wellUnderZeroProductionRateControl(summary_state, well_state);
|
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||||
updatePrimaryVariablesNewton(dwells, zero_rate_target, deferred_logger);
|
updatePrimaryVariablesNewton(dwells, stop_or_zero_rate_target, deferred_logger);
|
||||||
|
|
||||||
updateWellStateFromPrimaryVariables(well_state, deferred_logger);
|
updateWellStateFromPrimaryVariables(stop_or_zero_rate_target, well_state, deferred_logger);
|
||||||
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,12 +1015,12 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
||||||
const bool zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const double dFLimit = this->param_.dwell_fraction_max_;
|
const double dFLimit = this->param_.dwell_fraction_max_;
|
||||||
const double dBHPLimit = this->param_.dbhp_max_rel_;
|
const double dBHPLimit = this->param_.dbhp_max_rel_;
|
||||||
this->primary_variables_.updateNewton(dwells, zero_rate_target, dFLimit, dBHPLimit);
|
this->primary_variables_.updateNewton(dwells, stop_or_zero_rate_target, dFLimit, dBHPLimit);
|
||||||
|
|
||||||
// for the water velocity and skin pressure
|
// for the water velocity and skin pressure
|
||||||
if constexpr (Base::has_polymermw) {
|
if constexpr (Base::has_polymermw) {
|
||||||
@ -1037,9 +1037,11 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const
|
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
|
WellState& well_state,
|
||||||
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
this->StdWellEval::updateWellStateFromPrimaryVariables(well_state, deferred_logger);
|
this->StdWellEval::updateWellStateFromPrimaryVariables(stop_or_zero_rate_target, well_state, deferred_logger);
|
||||||
|
|
||||||
// other primary variables related to polymer injectivity study
|
// other primary variables related to polymer injectivity study
|
||||||
if constexpr (Base::has_polymermw) {
|
if constexpr (Base::has_polymermw) {
|
||||||
@ -1982,8 +1984,8 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
|
|
||||||
const bool zero_rate_target = this->wellUnderZeroProductionRateControl(summary_state, well_state);
|
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||||
this->primary_variables_.update(well_state, zero_rate_target, deferred_logger);
|
this->primary_variables_.update(well_state, stop_or_zero_rate_target, deferred_logger);
|
||||||
|
|
||||||
// other primary variables related to polymer injection
|
// other primary variables related to polymer injection
|
||||||
if constexpr (Base::has_polymermw) {
|
if constexpr (Base::has_polymermw) {
|
||||||
|
@ -224,6 +224,7 @@ computeBhpAtThpLimitInj(const std::function<std::vector<double>(const double)>&
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WellBhpThpCalculator::updateThp(const double rho,
|
void WellBhpThpCalculator::updateThp(const double rho,
|
||||||
|
const bool stop_or_zero_rate_target,
|
||||||
const std::function<double()>& alq_value,
|
const std::function<double()>& alq_value,
|
||||||
const std::array<unsigned,3>& active,
|
const std::array<unsigned,3>& active,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
@ -235,7 +236,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
|||||||
auto& ws = well_state.well(well_.indexOfWell());
|
auto& ws = well_state.well(well_.indexOfWell());
|
||||||
|
|
||||||
// When there is no vaild VFP table provided, we set the thp to be zero.
|
// 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) || stop_or_zero_rate_target) {
|
||||||
ws.thp = 0;
|
ws.thp = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ public:
|
|||||||
|
|
||||||
//! \brief Update THP.
|
//! \brief Update THP.
|
||||||
void updateThp(const double rho,
|
void updateThp(const double rho,
|
||||||
|
const bool stop_or_zero_rate_target,
|
||||||
const std::function<double()>& alq_value,
|
const std::function<double()>& alq_value,
|
||||||
const std::array<unsigned,3>& active,
|
const std::array<unsigned,3>& active,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||||
|
|
||||||
|
#include <opm/input/eclipse/Schedule/Well/WellInjectionControls.hpp>
|
||||||
#include <opm/input/eclipse/Schedule/Well/WellProductionControls.hpp>
|
#include <opm/input/eclipse/Schedule/Well/WellProductionControls.hpp>
|
||||||
#include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
|
#include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
|
||||||
|
|
||||||
@ -171,8 +172,8 @@ DenseMatrix transposeDenseDynMatrix(const DenseMatrix& M)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rateControlWithZeroTarget(const WellProducerCMode& mode,
|
bool rateControlWithZeroProdTarget(const WellProductionControls& controls,
|
||||||
const WellProductionControls& controls)
|
const WellProducerCMode mode)
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case WellProducerCMode::ORAT:
|
case WellProducerCMode::ORAT:
|
||||||
@ -198,6 +199,20 @@ bool rateControlWithZeroTarget(const WellProducerCMode& mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool rateControlWithZeroInjTarget(const WellInjectionControls& controls,
|
||||||
|
const WellInjectorCMode mode)
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
case WellInjectorCMode::RATE:
|
||||||
|
return controls.surface_rate == 0.0;
|
||||||
|
case WellInjectorCMode::RESV:
|
||||||
|
return controls.reservoir_rate == 0.0;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template class ParallelStandardWellB<double>;
|
template class ParallelStandardWellB<double>;
|
||||||
|
|
||||||
template<int Dim> using Vec = Dune::BlockVector<Dune::FieldVector<double,Dim>>;
|
template<int Dim> using Vec = Dune::BlockVector<Dune::FieldVector<double,Dim>>;
|
||||||
|
@ -31,8 +31,10 @@
|
|||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
class ParallelWellInfo;
|
class ParallelWellInfo;
|
||||||
|
struct WellProductionControls;
|
||||||
|
struct WellInjectionControls;
|
||||||
enum class WellProducerCMode;
|
enum class WellProducerCMode;
|
||||||
class WellProductionControls;
|
enum class WellInjectorCMode;
|
||||||
|
|
||||||
namespace wellhelpers {
|
namespace wellhelpers {
|
||||||
|
|
||||||
@ -86,8 +88,12 @@ template <class DenseMatrix>
|
|||||||
DenseMatrix transposeDenseDynMatrix(const DenseMatrix& M);
|
DenseMatrix transposeDenseDynMatrix(const DenseMatrix& M);
|
||||||
|
|
||||||
/// Helper to check whether the well is under zero production rate control
|
/// Helper to check whether the well is under zero production rate control
|
||||||
bool rateControlWithZeroTarget(const WellProducerCMode& mode,
|
bool rateControlWithZeroProdTarget(const WellProductionControls& controls,
|
||||||
const WellProductionControls& controls);
|
WellProducerCMode mode);
|
||||||
|
|
||||||
|
/// Helper to check whether the well is under zero injection rate control
|
||||||
|
bool rateControlWithZeroInjTarget(const WellInjectionControls& controls,
|
||||||
|
WellInjectorCMode mode);
|
||||||
|
|
||||||
} // namespace wellhelpers
|
} // namespace wellhelpers
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -360,8 +360,6 @@ protected:
|
|||||||
|
|
||||||
Eval getPerfCellPressure(const FluidState& fs) const;
|
Eval getPerfCellPressure(const FluidState& fs) const;
|
||||||
|
|
||||||
bool wellUnderZeroProductionRateControl(const SummaryState& summary_state,
|
|
||||||
const WellState& well_state) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -450,6 +450,29 @@ bool WellInterfaceGeneric::isPressureControlled(const WellState& well_state) con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool WellInterfaceGeneric::wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||||
|
const WellState& well_state) const
|
||||||
|
{
|
||||||
|
if (this->isProducer()) { // producers
|
||||||
|
const auto prod_controls = this->well_ecl_.productionControls(summary_state);
|
||||||
|
const auto prod_mode = well_state.well(this->indexOfWell()).production_cmode;
|
||||||
|
return wellhelpers::rateControlWithZeroProdTarget(prod_controls, prod_mode);
|
||||||
|
} else { // injectors
|
||||||
|
const auto inj_controls = this->well_ecl_.injectionControls(summary_state);
|
||||||
|
const auto inj_mode = well_state.well(this->indexOfWell()).injection_cmode;
|
||||||
|
return wellhelpers::rateControlWithZeroInjTarget(inj_controls, inj_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WellInterfaceGeneric::stopppedOrZeroRateTarget(const SummaryState& summary_state,
|
||||||
|
const WellState& well_state) const
|
||||||
|
{
|
||||||
|
return (this->wellIsStopped() || this->wellUnderZeroRateTarget(summary_state, well_state));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
double WellInterfaceGeneric::wmicrobes_() const
|
double WellInterfaceGeneric::wmicrobes_() const
|
||||||
{
|
{
|
||||||
auto injectorType = this->well_ecl_.injectorType();
|
auto injectorType = this->well_ecl_.injectorType();
|
||||||
|
@ -195,6 +195,8 @@ public:
|
|||||||
|
|
||||||
bool isPressureControlled(const WellState& well_state) const;
|
bool isPressureControlled(const WellState& well_state) const;
|
||||||
|
|
||||||
|
bool stopppedOrZeroRateTarget(const SummaryState& summary_state,
|
||||||
|
const WellState& well_state) const;
|
||||||
protected:
|
protected:
|
||||||
bool getAllowCrossFlow() const;
|
bool getAllowCrossFlow() const;
|
||||||
|
|
||||||
@ -209,6 +211,9 @@ protected:
|
|||||||
int polymerInjTable_() const;
|
int polymerInjTable_() const;
|
||||||
int polymerWaterTable_() const;
|
int polymerWaterTable_() const;
|
||||||
|
|
||||||
|
bool wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||||
|
const WellState& well_state) const;
|
||||||
|
|
||||||
// definition of the struct OperabilityStatus
|
// definition of the struct OperabilityStatus
|
||||||
struct OperabilityStatus {
|
struct OperabilityStatus {
|
||||||
bool isOperableAndSolvable() const {
|
bool isOperableAndSolvable() const {
|
||||||
|
@ -184,7 +184,8 @@ namespace Opm
|
|||||||
const GroupState& group_state,
|
const GroupState& group_state,
|
||||||
DeferredLogger& deferred_logger) /* const */
|
DeferredLogger& deferred_logger) /* const */
|
||||||
{
|
{
|
||||||
if (this->wellIsStopped()) {
|
const auto& summary_state = ebos_simulator.vanguard().summaryState();
|
||||||
|
if (this->stopppedOrZeroRateTarget(summary_state, well_state)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,18 +1132,4 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
bool WellInterface<TypeTag>::wellUnderZeroProductionRateControl(const SummaryState& summary_state,
|
|
||||||
const WellState& well_state) const
|
|
||||||
{
|
|
||||||
if (this->wellIsStopped()) return true;
|
|
||||||
|
|
||||||
bool zero_rate_target = false;
|
|
||||||
if (this->well_ecl_.isProducer()) {
|
|
||||||
const auto prod_controls = this->well_ecl_.productionControls(summary_state);
|
|
||||||
zero_rate_target = wellhelpers::rateControlWithZeroTarget(well_state.well(this->index_of_well_).production_cmode, prod_controls);
|
|
||||||
}
|
|
||||||
return zero_rate_target;
|
|
||||||
}
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
Loading…
Reference in New Issue
Block a user