Some small logic fixes.

- Make sure to reopen revived wells.
 - Do not use thp limit for potential calculations when well is bhp controlled.
 - Stopped wells do not check controls.
 - Set thp to control when appropriate in updateWellStateWithTarget().
This commit is contained in:
Atgeirr Flø Rasmussen 2019-10-07 11:54:57 +02:00 committed by Tor Harald Sandve
parent 6b011c1bfb
commit f618073492
2 changed files with 7 additions and 2 deletions

View File

@ -1773,6 +1773,7 @@ namespace Opm
} }
case Well2::ProducerCMode::THP: case Well2::ProducerCMode::THP:
{ {
well_state.thp()[well_index] = controls.thp_limit;
auto bhp = robustSolveBhpAtThpLimitProd(ebos_simulator, summaryState, deferred_logger); auto bhp = robustSolveBhpAtThpLimitProd(ebos_simulator, summaryState, deferred_logger);
if (bhp) { if (bhp) {
well_state.bhp()[well_index] = *bhp; well_state.bhp()[well_index] = *bhp;
@ -1946,6 +1947,7 @@ namespace Opm
} }
} else if (well_operable && !old_well_operable) { } else if (well_operable && !old_well_operable) {
deferred_logger.info(" well " + name() + " gets REVIVED during iteration "); deferred_logger.info(" well " + name() + " gets REVIVED during iteration ");
this->openWell();
changed_to_stopped_this_step_ = false; changed_to_stopped_this_step_ = false;
} }
} }
@ -2791,8 +2793,8 @@ namespace Opm
// does the well have a THP related constraint? // does the well have a THP related constraint?
const auto& summaryState = ebosSimulator.vanguard().summaryState(); const auto& summaryState = ebosSimulator.vanguard().summaryState();
// does the well have a THP related constraint? const Well2::ProducerCMode& current_control = well_state.currentProductionControls()[this->index_of_well_];
if ( !well.Base::wellHasTHPConstraints(summaryState) ) { if ( !well.Base::wellHasTHPConstraints(summaryState) || current_control == Well2::ProducerCMode::BHP ) {
// get the bhp value based on the bhp constraints // get the bhp value based on the bhp constraints
const double bhp = well.mostStrictBhpFromBhpLimits(summaryState); const double bhp = well.mostStrictBhpFromBhpLimits(summaryState);
assert(std::abs(bhp) != std::numeric_limits<double>::max()); assert(std::abs(bhp) != std::numeric_limits<double>::max());

View File

@ -449,6 +449,9 @@ namespace Opm
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) /* const */ Opm::DeferredLogger& deferred_logger) /* const */
{ {
if (this->wellIsStopped()) {
return;
}
const auto& summaryState = ebos_simulator.vanguard().summaryState(); const auto& summaryState = ebos_simulator.vanguard().summaryState();
const auto& well = well_ecl_; const auto& well = well_ecl_;