mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00:59 -06:00
use rates for potentials for pressure controlled (bhp or thp) controled wells
This commit is contained in:
parent
d83b06c74b
commit
cccece4104
@ -542,32 +542,31 @@ namespace Opm
|
||||
}
|
||||
|
||||
// If the well is pressure controlled the potential equals the rate.
|
||||
/* {
|
||||
bool pressure_controlled_well = false;
|
||||
if (this->isInjector()) {
|
||||
const Well::InjectorCMode& current = well_state.currentInjectionControl()[index_of_well_];
|
||||
if (current == Well::InjectorCMode::BHP || current == Well::InjectorCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
} else {
|
||||
const Well::ProducerCMode& current = well_state.currentProductionControls()[index_of_well_];
|
||||
if (current == Well::ProducerCMode::BHP || current == Well::ProducerCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
bool pressure_controlled_well = false;
|
||||
if (this->isInjector()) {
|
||||
const Well::InjectorCMode& current = well_state.currentInjectionControl(index_of_well_);
|
||||
if (current == Well::InjectorCMode::BHP || current == Well::InjectorCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
if (pressure_controlled_well) {
|
||||
for (int compIdx = 0; compIdx < num_components_; ++compIdx) {
|
||||
const EvalWell rate = this->getQs(compIdx);
|
||||
well_potentials[ebosCompIdxToFlowCompIdx(compIdx)] = rate.value();
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
const Well::ProducerCMode& current = well_state.currentProductionControl(index_of_well_);
|
||||
if (current == Well::ProducerCMode::BHP || current == Well::ProducerCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
} */
|
||||
}
|
||||
if (pressure_controlled_well) {
|
||||
// initialized the well rates with the potentials i.e. the well rates based on bhp
|
||||
const double sign = this->well_ecl_.isInjector() ? 1.0 : -1.0;
|
||||
for (int phase = 0; phase < np; ++phase){
|
||||
well_potentials[phase] = sign * well_state.wellRates(index_of_well_)[phase];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
debug_cost_counter_ = 0;
|
||||
// does the well have a THP related constraint?
|
||||
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
||||
auto current_control = well_state.currentProductionControl(this->index_of_well_);
|
||||
if ( !Base::wellHasTHPConstraints(summaryState) || current_control == Well::ProducerCMode::BHP) {
|
||||
if (!Base::wellHasTHPConstraints(summaryState)) {
|
||||
computeWellRatesAtBhpLimit(ebosSimulator, well_potentials, deferred_logger);
|
||||
} else {
|
||||
well_potentials = computeWellPotentialWithTHP(ebosSimulator, deferred_logger);
|
||||
|
@ -2690,6 +2690,28 @@ namespace Opm
|
||||
return;
|
||||
}
|
||||
|
||||
// If the well is pressure controlled the potential equals the rate.
|
||||
bool pressure_controlled_well = false;
|
||||
if (this->isInjector()) {
|
||||
const Well::InjectorCMode& current = well_state.currentInjectionControl(index_of_well_);
|
||||
if (current == Well::InjectorCMode::BHP || current == Well::InjectorCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
} else {
|
||||
const Well::ProducerCMode& current = well_state.currentProductionControl(index_of_well_);
|
||||
if (current == Well::ProducerCMode::BHP || current == Well::ProducerCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
}
|
||||
if (pressure_controlled_well) {
|
||||
// initialized the well rates with the potentials i.e. the well rates based on bhp
|
||||
const double sign = this->well_ecl_.isInjector() ? 1.0 : -1.0;
|
||||
for (int phase = 0; phase < np; ++phase){
|
||||
well_potentials[phase] = sign * well_state.wellRates(index_of_well_)[phase];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// creating a copy of the well itself, to avoid messing up the explicit informations
|
||||
// during this copy, the only information not copied properly is the well controls
|
||||
StandardWell<TypeTag> well(*this);
|
||||
@ -2697,8 +2719,7 @@ namespace Opm
|
||||
|
||||
// does the well have a THP related constraint?
|
||||
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
||||
auto current_control = well_state.currentProductionControl(this->index_of_well_);
|
||||
if ( !well.Base::wellHasTHPConstraints(summaryState) || current_control == Well::ProducerCMode::BHP ) {
|
||||
if (!well.Base::wellHasTHPConstraints(summaryState)) {
|
||||
// get the bhp value based on the bhp constraints
|
||||
const double bhp = well.mostStrictBhpFromBhpLimits(summaryState);
|
||||
assert(std::abs(bhp) != std::numeric_limits<double>::max());
|
||||
|
Loading…
Reference in New Issue
Block a user